@klarkxy/dsh-font 0.1.1 → 0.1.3

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.
@@ -364,6 +364,29 @@ ${scope} {
364
364
  & .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
365
365
  & .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }
366
366
 
367
+ /* --- Native textarea. The primitives ship no textarea either, so a settings
368
+ * prompt keeps the platform element and the same field shell as the select:
369
+ * 0.5px l4, radius-md, layer-3, 13/1.5 type. It grows vertically instead of
370
+ * locking to the select's 34px row. --- */
371
+ & .dsh-ui-textarea {
372
+ box-sizing: border-box;
373
+ width: 100%;
374
+ min-width: 0;
375
+ resize: vertical;
376
+ padding: 8px 12px;
377
+ border: 0.5px solid var(--dsw-alias-border-l4);
378
+ border-radius: var(--dsw-radius-md);
379
+ background: var(--dsw-alias-bg-layer-3);
380
+ font: inherit;
381
+ font-size: 13px;
382
+ line-height: 1.5;
383
+ color: var(--dsw-alias-label-primary);
384
+ }
385
+ & .dsh-ui-textarea:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }
386
+ & .dsh-ui-textarea:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
387
+ & .dsh-ui-textarea::placeholder { color: var(--dsw-alias-label-dimmed); }
388
+ & .dsh-ui-textarea[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }
389
+
367
390
  /* Long panels scroll inside themselves instead of growing the host page. */
368
391
  & .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
369
392
  & .dsh-ui-panel-wide { max-width: 100%; }
@@ -1 +1 @@
1
- {"version":3,"file":"client.inner.cjs","names":["useSyncExternalStore","useState","Input","Button"],"sources":["../../dsh-plugin-kit/src/official-ui.ts","../src/contracts.ts","../src/client.tsx"],"sourcesContent":["/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","/** Browser-safe contracts for @klarkxy/dsh-font: settings shape, font presets,\n * normalization, the CSS-variable application core, and the local store.\n * No React, no cordis — every export runs in Node tests and the browser. */\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-font'\n\n/** localStorage key. Fonts are a property of the rendering environment (each\n * browser/machine has its own installed fonts), so they persist browser-local,\n * exactly like the host's own GUI preferences (dsh-client-store, ui-theme\n * notes). The conversation font size is NOT stored here: the official\n * `ctx.theme.setFontSize()` entry persists it host-side already. */\nexport const STORAGE_KEY = 'klarkxy.dsh-font.v1'\n\n/** DSH 0.2.0-rc.2 ui-theme/theme-settings.ts bounds, shared by its native stepper. */\nexport const FONT_SIZE_MIN = 10\nexport const FONT_SIZE_MAX = 22\nexport const FONT_SIZE_DEFAULT = 14\n\n/** DSH rc.2 defines these font stacks on :root. Root inline overrides also\n * reach derived Markdown, brand and terminal font tokens. */\nexport const UI_FONT_VARIABLE = '--dsw-font-family'\nexport const CODE_FONT_VARIABLE = '--ds-font-family-code'\n\nexport interface FontSettings {\n /** Full CSS font-family stack for the interface; empty keeps the host default. */\n uiFont: string\n /** Full CSS font-family stack for code blocks, inline code and terminals. */\n codeFont: string\n}\n\nexport function defaultFontSettings(): FontSettings {\n return { uiFont: '', codeFont: '' }\n}\n\n/** A raw font-family string is placed into a single CSS declaration via\n * CSSStyleDeclaration.setProperty, which cannot escape the declaration — but\n * trimming control characters and the CSS delimiters keeps pasted garbage from\n * producing a silently-dead value. */\nexport function normalizeFontFamily(value: unknown): string {\n if (typeof value !== 'string') return ''\n return value\n .replace(/[\\u0000-\\u001F\\u007F;{}<>]/g, '')\n .trim()\n .slice(0, 300)\n}\n\nexport function parseFontSettings(raw: unknown): FontSettings {\n let source = raw\n if (typeof source === 'string') {\n try {\n source = JSON.parse(source)\n } catch {\n return defaultFontSettings()\n }\n }\n if (!source || typeof source !== 'object' || Array.isArray(source)) return defaultFontSettings()\n const record = source as Record<string, unknown>\n return {\n uiFont: normalizeFontFamily(record.uiFont),\n codeFont: normalizeFontFamily(record.codeFont),\n }\n}\n\nexport function serializeFontSettings(settings: FontSettings): string {\n return JSON.stringify({\n uiFont: normalizeFontFamily(settings.uiFont),\n codeFont: normalizeFontFamily(settings.codeFont),\n })\n}\n\nexport interface FontPreset {\n readonly id: string\n readonly label: { readonly zh: string; readonly en: string }\n /** The font-family stack committed when the preset is picked. */\n readonly value: string\n}\n\nexport const UI_FONT_PRESETS: readonly FontPreset[] = [\n { id: 'yahei', label: { zh: '微软雅黑', en: 'Microsoft YaHei' }, value: '\"Microsoft YaHei\", \"PingFang SC\", sans-serif' },\n { id: 'pingfang', label: { zh: '苹方', en: 'PingFang SC' }, value: '\"PingFang SC\", -apple-system, sans-serif' },\n { id: 'simsun', label: { zh: '宋体', en: 'SimSun' }, value: '\"SimSun\", \"Songti SC\", serif' },\n { id: 'kaiti', label: { zh: '楷体', en: 'KaiTi' }, value: '\"KaiTi\", \"Kaiti SC\", \"STKaiti\", serif' },\n { id: 'source-han-sans', label: { zh: '思源黑体', en: 'Source Han Sans' }, value: '\"Source Han Sans SC\", \"Noto Sans CJK SC\", \"Noto Sans SC\", sans-serif' },\n { id: 'source-han-serif', label: { zh: '思源宋体', en: 'Source Han Serif' }, value: '\"Source Han Serif SC\", \"Noto Serif CJK SC\", \"Noto Serif SC\", serif' },\n]\n\nexport const CODE_FONT_PRESETS: readonly FontPreset[] = [\n { id: 'cascadia', label: { zh: 'Cascadia', en: 'Cascadia' }, value: '\"Cascadia Mono\", \"Cascadia Code\", monospace' },\n { id: 'jetbrains-mono', label: { zh: 'JetBrains Mono', en: 'JetBrains Mono' }, value: '\"JetBrains Mono\", monospace' },\n { id: 'fira-code', label: { zh: 'Fira Code', en: 'Fira Code' }, value: '\"Fira Code\", monospace' },\n { id: 'consolas', label: { zh: 'Consolas', en: 'Consolas' }, value: 'Consolas, monospace' },\n { id: 'sarasa', label: { zh: '更纱黑体', en: 'Sarasa Mono' }, value: '\"Sarasa Mono SC\", \"Sarasa Term SC\", monospace' },\n { id: 'maple-mono', label: { zh: 'Maple Mono', en: 'Maple Mono' }, value: '\"Maple Mono NF CN\", \"Maple Mono\", monospace' },\n]\n\nexport function presetFor(value: string, presets: readonly FontPreset[]): FontPreset | undefined {\n return presets.find(preset => preset.value === value)\n}\n\nexport type FontGenericFamily = 'sans-serif' | 'monospace'\n\n/** Build the committed stack for a family picked from the system font list.\n * The family name comes from the OS (Local Font Access API); quotes and\n * backslashes are stripped so it can be safely re-quoted as one family. */\nexport function fontStackFor(family: string, generic: FontGenericFamily): string {\n const cleaned = normalizeFontFamily(family).replace(/[\"\\\\]/g, '')\n if (!cleaned) return generic\n return `\"${cleaned}\", ${generic}`\n}\n\n/** A system font offered in the picker: `family` is the exact name CSS\n * matching needs; `fullName` is an informative localized alias (e.g. converted\n * CJK fonts whose family is the Latin alias), '' when it only restates the\n * family (\"Microsoft YaHei Regular\" adds nothing). */\nexport interface SystemFontFamily {\n readonly family: string\n readonly fullName: string\n}\n\n/** Distinct, normalized, family-sorted entries out of a queryLocalFonts()\n * result (entries carry `family` and `fullName`; duplicates per style are\n * expected). */\nexport function uniqueSystemFonts(fonts: readonly unknown[]): SystemFontFamily[] {\n const byFamily = new Map<string, string>()\n for (const item of fonts) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) continue\n const record = item as Record<string, unknown>\n const family = normalizeFontFamily(record.family).replace(/[\"\\\\]/g, '')\n if (!family || byFamily.has(family)) continue\n const fullName = normalizeFontFamily(record.fullName).replace(/[\"\\\\]/g, '')\n byFamily.set(family, fullName && fullName !== family && !fullName.startsWith(`${family} `) ? fullName : '')\n }\n return [...byFamily.entries()]\n .map(([family, fullName]) => ({ family, fullName }))\n .sort((a, b) => a.family.localeCompare(b.family))\n}\n\n/** Picker label: the UI locale's recognizable name leads, the alias stays in\n * parentheses because the canonical family is still what a custom input needs. */\nexport function systemFontLabel(item: SystemFontFamily, locale: 'zh' | 'en'): string {\n if (!item.fullName) return item.family\n return locale === 'zh' ? `${item.fullName}(${item.family})` : `${item.family}(${item.fullName})`\n}\n\n/** Minimal write face of CSSStyleDeclaration — document.documentElement.style\n * satisfies it, and tests supply a recording double. */\nexport interface FontStyleTarget {\n setProperty(name: string, value: string): void\n removeProperty(name: string): void\n}\n\nexport function applyFontSettings(style: FontStyleTarget, settings: FontSettings): void {\n if (settings.uiFont) style.setProperty(UI_FONT_VARIABLE, settings.uiFont)\n else style.removeProperty(UI_FONT_VARIABLE)\n if (settings.codeFont) style.setProperty(CODE_FONT_VARIABLE, settings.codeFont)\n else style.removeProperty(CODE_FONT_VARIABLE)\n}\n\nexport function clearFontSettings(style: FontStyleTarget): void {\n style.removeProperty(UI_FONT_VARIABLE)\n style.removeProperty(CODE_FONT_VARIABLE)\n}\n\n/** Read face required to restore only overrides still owned by this instance. */\nexport interface OwnedFontStyleTarget extends FontStyleTarget {\n getPropertyValue(name: string): string\n getPropertyPriority(name: string): string\n setProperty(name: string, value: string, priority?: string): void\n}\n\n/** Root inline overrides preserve the existing local persistence/unload\n * boundary. Save the underlying value (including !important) on first write\n * or when the host replaces a value, and never retract somebody else's write. */\nexport function createFontSettingsOverride(style: OwnedFontStyleTarget) {\n const owned = new Map<string, { previous: string; priority: string; value: string }>()\n function release(name: string) {\n const entry = owned.get(name)\n if (!entry) return\n if (style.getPropertyValue(name) === entry.value && style.getPropertyPriority(name) === '') {\n if (entry.previous) style.setProperty(name, entry.previous, entry.priority)\n else style.removeProperty(name)\n }\n owned.delete(name)\n }\n return {\n apply(settings: FontSettings) {\n for (const [name, value] of [\n [UI_FONT_VARIABLE, settings.uiFont],\n [CODE_FONT_VARIABLE, settings.codeFont],\n ] as const) {\n if (!value) { release(name); continue }\n const current = style.getPropertyValue(name)\n const priority = style.getPropertyPriority(name)\n const entry = owned.get(name)\n if (!entry || current !== entry.value || priority !== '') {\n owned.set(name, { previous: current, priority, value: '' })\n }\n style.setProperty(name, value)\n owned.get(name)!.value = style.getPropertyValue(name)\n }\n },\n dispose() { for (const name of [...owned.keys()]) release(name) },\n }\n}\n\nexport interface FontSettingsStorage {\n getItem(key: string): string | null\n setItem(key: string, value: string): void\n removeItem(key: string): void\n}\n\nexport interface FontSettingsStore {\n load(): FontSettings\n save(next: FontSettings): void\n}\n\n/** Browser-local persistence. A fully-default setting removes the key so a\n * reset leaves no residue; storage failures (private mode, quota) degrade to\n * in-memory behaviour rather than breaking the panel. */\nexport function createFontSettingsStore(storage: FontSettingsStorage | undefined): FontSettingsStore {\n let current = defaultFontSettings()\n // A failed local write must win over stale persisted values on page remount.\n // Successful writes restore the existing ability to read external updates.\n let pendingPersistence = false\n return {\n load() {\n if (storage && !pendingPersistence) {\n try {\n current = parseFontSettings(storage.getItem(STORAGE_KEY))\n } catch {\n /* keep the last readable or locally saved snapshot */\n }\n }\n return { ...current }\n },\n save(next) {\n current = parseFontSettings(next)\n if (!storage) return\n pendingPersistence = true\n try {\n if (!current.uiFont && !current.codeFont) storage.removeItem(STORAGE_KEY)\n else storage.setItem(STORAGE_KEY, serializeFontSettings(current))\n pendingPersistence = false\n } catch {\n /* stay in-memory */\n }\n },\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport { Button, Input } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport { useState, useSyncExternalStore } from 'react'\nimport {\n CODE_FONT_PRESETS, FONT_SIZE_DEFAULT, FONT_SIZE_MAX, FONT_SIZE_MIN, PLUGIN_NAME,\n UI_FONT_PRESETS,\n createFontSettingsOverride, createFontSettingsStore, fontStackFor, normalizeFontFamily,\n presetFor, systemFontLabel, uniqueSystemFonts,\n type FontGenericFamily, type FontPreset, type FontSettings, type FontSettingsStorage, type FontSettingsStore,\n type SystemFontFamily,\n} from './contracts.ts'\n\nexport const name = 'dsh-font-client'\nexport const inject = ['slots', 'theme', 'locale'] as const\n\ninterface ThemeSnapshotLike {\n fontSize: number\n}\n\ninterface ThemeLike {\n getTheme(): ThemeSnapshotLike\n setFontSize(px: number): void\n}\n\ntype Client = {\n theme: ThemeLike\n locale: { getSnapshot(): { active: string }; subscribe(fn: () => void): () => void }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; key: string; label?: string }, render: unknown): () => void\n }\n on(event: 'theme/change', listener: (snapshot: ThemeSnapshotLike) => void): () => void\n}\n\nconst COPY = {\n zh: {\n label: '字体',\n uiFont: '界面字体',\n codeFont: '代码字体',\n fontSize: '会话字号',\n defaultOption: '默认',\n customOption: '自定义…',\n customUiPlaceholder: '例如 \"Microsoft YaHei\", sans-serif',\n customCodePlaceholder: '例如 \"JetBrains Mono\", monospace',\n uiHelp: '作用于整个界面的文字。自定义时输入完整的 font-family 字体栈,留空恢复默认。',\n codeHelp: '作用于代码块、行内代码与终端的等宽字体。',\n sizeHelp: '与「设置 → 通用」中的字号同步,范围 10–22。',\n loadFonts: '读取系统字体',\n reloadFonts: '重新读取系统字体',\n loadingFonts: '正在读取系统字体…',\n fontsLoaded: (count: number) => `已读取 ${count} 款系统字体;新装字体后点「重新读取」刷新列表。`,\n fontsPartial: '列表来自浏览器枚举:仅安装到当前用户的字体可能不在其中,可以直接输入字体名使用。',\n fontsDenied: '系统字体读取被拒绝或当前环境不支持,仍可手动输入字体名。',\n systemGroup: '系统字体',\n reset: '全部恢复默认',\n summary: (ui: string, code: string, size: number) => `界面 ${ui} · 代码 ${code} · ${size}px`,\n defaultName: '默认',\n },\n en: {\n label: 'Font',\n uiFont: 'Interface font',\n codeFont: 'Code font',\n fontSize: 'Conversation font size',\n defaultOption: 'Default',\n customOption: 'Custom…',\n customUiPlaceholder: 'e.g. \"Microsoft YaHei\", sans-serif',\n customCodePlaceholder: 'e.g. \"JetBrains Mono\", monospace',\n uiHelp: 'Applies to all interface text. For a custom value enter a full font-family stack; empty restores the default.',\n codeHelp: 'Monospace font for code blocks, inline code and terminals.',\n sizeHelp: 'Synced with Settings → General; 10–22 px.',\n loadFonts: 'Load system fonts',\n reloadFonts: 'Reload system fonts',\n loadingFonts: 'Loading system fonts…',\n fontsLoaded: (count: number) => `${count} installed fonts loaded; choose “Reload system fonts” after installing new ones.`,\n fontsPartial: 'The list comes from the browser’s enumeration: fonts installed only for the current user may be missing — you can still type the family name directly.',\n fontsDenied: 'Access to system fonts was denied or is unsupported here; you can still type a font name.',\n systemGroup: 'Installed fonts',\n reset: 'Reset all to defaults',\n summary: (ui: string, code: string, size: number) => `${ui} · ${code} · ${size}px`,\n defaultName: 'Default',\n },\n} as const\n\nexport function fontCopy(locale: 'zh' | 'en') {\n return COPY[locale]\n}\n\n/* The panel's own geometry only: reading width, and the custom-stack input row\n * rhythm. Everything visual comes from the contract recipes and primitives. */\nconst styles = `${officialUiCss('font-root')}\n.font-root { max-width: 760px; }\n.font-custom { margin-top: 8px; }\n`\n\nfunction readStorage(): FontSettingsStorage | undefined {\n try {\n return typeof localStorage === 'undefined' ? undefined : localStorage\n } catch {\n return undefined\n }\n}\n\nfunction useLocale(client: Client): 'zh' | 'en' {\n const getSnapshot = () => (client.locale.getSnapshot().active.toLowerCase().startsWith('zh') ? 'zh' : 'en') as 'zh' | 'en'\n return useSyncExternalStore(\n fn => client.locale.subscribe(fn),\n getSnapshot,\n getSnapshot,\n )\n}\n\nfunction useFontSize(client: Client): number {\n return useSyncExternalStore(\n fn => client.on('theme/change', () => fn()),\n () => client.theme.getTheme().fontSize,\n () => client.theme.getTheme().fontSize,\n )\n}\n\nfunction presetMode(value: string, presets: readonly FontPreset[]): string {\n return presetFor(value, presets)?.id ?? (value ? 'custom' : '')\n}\n\nexport function FontField(props: {\n label: string\n help: string\n value: string\n presets: readonly FontPreset[]\n locale: 'zh' | 'en'\n generic: FontGenericFamily\n systemFonts?: readonly SystemFontFamily[]\n defaultLabel: string\n customLabel: string\n customPlaceholder: string\n systemGroupLabel: string\n onCommit(value: string): void\n}) {\n // undefined = not editing; the input otherwise shows the committed stack.\n const [draft, setDraft] = useState<string | undefined>(undefined)\n // With an empty (default) value nothing matches \"custom\" on its own, so the\n // choice itself must be remembered until a stack is committed.\n const [customOpen, setCustomOpen] = useState(false)\n const mode = customOpen ? 'custom' : presetMode(props.value, props.presets)\n\n function commitDraft() {\n if (draft === undefined) return\n const next = normalizeFontFamily(draft)\n setDraft(undefined)\n if (!next) setCustomOpen(false)\n if (next !== props.value) props.onCommit(next)\n }\n\n return <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{props.label}</span>\n <select\n className=\"dsh-ui-select\"\n value={mode}\n onChange={event => {\n const id = event.target.value\n setDraft(undefined)\n if (id === 'custom') { setCustomOpen(true); return }\n setCustomOpen(false)\n if (id.startsWith('sys:')) { props.onCommit(fontStackFor(id.slice(4), props.generic)); return }\n const preset = props.presets.find(item => item.id === id)\n props.onCommit(preset ? preset.value : '')\n }}\n >\n <option value=\"\">{props.defaultLabel}</option>\n {props.presets.map(preset => (\n <option key={preset.id} value={preset.id}>{preset.label[props.locale]}</option>\n ))}\n <option value=\"custom\">{props.customLabel}</option>\n {props.systemFonts && props.systemFonts.length > 0 ? <optgroup label={props.systemGroupLabel}>\n {props.systemFonts.map(item => <option key={item.family} value={`sys:${item.family}`}>{systemFontLabel(item, props.locale)}</option>)}\n </optgroup> : null}\n </select>\n {mode === 'custom' ? <span className=\"font-custom\">\n <Input\n value={draft ?? props.value}\n placeholder={props.customPlaceholder}\n onChange={event => setDraft(event.target.value)}\n onBlur={commitDraft}\n onKeyDown={event => { if (event.key === 'Enter') commitDraft() }}\n />\n </span> : null}\n <span className=\"dsh-ui-help\">{props.help}</span>\n </label>\n}\n\nexport function FontSettingsPanel(props: {\n client: Client\n store: FontSettingsStore\n applySettings(settings: FontSettings): void\n view?: 'summary' | 'page'\n}) {\n const locale = useLocale(props.client)\n const text = COPY[locale]\n const [settings, setSettings] = useState<FontSettings>(() => props.store.load())\n const fontSize = useFontSize(props.client)\n // System font list is shared by both fields: one permission prompt, one list.\n const [fontList, setFontList] = useState<{ state: 'idle' | 'loading' | 'ready' | 'denied'; families: readonly SystemFontFamily[] }>(\n { state: 'idle', families: [] },\n )\n\n async function loadSystemFonts() {\n if (fontList.state === 'loading') return\n // Every click re-enumerates: fonts installed after the first read appear\n // on the next one (the button relabels to \"reload\" once a list exists).\n // Local Font Access API: Chromium-only and gated behind a permission\n // prompt; anything else (Firefox, Safari, denied permission, Electron\n // policy) falls through to the preset + manual-input flow unchanged.\n const query = (globalThis as { queryLocalFonts?: () => Promise<readonly unknown[]> }).queryLocalFonts\n if (typeof query !== 'function') { setFontList({ state: 'denied', families: [] }); return }\n setFontList(current => ({ state: 'loading', families: current.families }))\n try {\n const fonts = await query()\n setFontList({ state: 'ready', families: uniqueSystemFonts(fonts) })\n } catch {\n setFontList(current => ({ state: 'denied', families: current.families }))\n }\n }\n\n function update(patch: Partial<FontSettings>) {\n const next: FontSettings = {\n uiFont: normalizeFontFamily(patch.uiFont ?? settings.uiFont),\n codeFont: normalizeFontFamily(patch.codeFont ?? settings.codeFont),\n }\n props.store.save(next)\n props.applySettings(next)\n setSettings(next)\n }\n\n const uiName = presetFor(settings.uiFont, UI_FONT_PRESETS)?.label[locale] ?? (settings.uiFont || text.defaultName)\n const codeName = presetFor(settings.codeFont, CODE_FONT_PRESETS)?.label[locale] ?? (settings.codeFont || text.defaultName)\n\n if (props.view === 'summary') {\n return <span className=\"font-root\" data-testid=\"font-summary\">{text.summary(uiName, codeName, fontSize)}</span>\n }\n\n const sizes: number[] = []\n for (let px = FONT_SIZE_MIN; px <= FONT_SIZE_MAX; px += 1) sizes.push(px)\n\n return <section className=\"font-root dsh-ui-panel\" data-testid=\"font-settings\">\n <FontField\n label={text.uiFont}\n help={text.uiHelp}\n value={settings.uiFont}\n presets={UI_FONT_PRESETS}\n locale={locale}\n generic=\"sans-serif\"\n systemFonts={fontList.families}\n defaultLabel={text.defaultOption}\n customLabel={text.customOption}\n customPlaceholder={text.customUiPlaceholder}\n systemGroupLabel={text.systemGroup}\n onCommit={value => update({ uiFont: value })}\n />\n <FontField\n label={text.codeFont}\n help={text.codeHelp}\n value={settings.codeFont}\n presets={CODE_FONT_PRESETS}\n locale={locale}\n generic=\"monospace\"\n systemFonts={fontList.families}\n defaultLabel={text.defaultOption}\n customLabel={text.customOption}\n customPlaceholder={text.customCodePlaceholder}\n systemGroupLabel={text.systemGroup}\n onCommit={value => update({ codeFont: value })}\n />\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.fontSize}</span>\n <select\n className=\"dsh-ui-select\"\n value={fontSize}\n onChange={event => {\n const px = Number(event.target.value)\n if (Number.isInteger(px) && px >= FONT_SIZE_MIN && px <= FONT_SIZE_MAX && px !== fontSize) {\n // The theme service is the only write entry; it validates again and\n // persists through the host settings scope, and theme/change keeps\n // this panel in sync with the native Settings → General stepper.\n try { props.client.theme.setFontSize(px) } catch { /* out-of-range guard already applied */ }\n }\n }}\n >\n {sizes.map(px => <option key={px} value={px}>{px}px</option>)}\n </select>\n <span className=\"dsh-ui-help\">{text.sizeHelp}</span>\n </label>\n <div className=\"dsh-ui-actions\">\n <Button variant=\"outline\" size=\"md\" disabled={fontList.state === 'loading'}\n onClick={() => { void loadSystemFonts() }}>\n {fontList.state === 'loading' ? text.loadingFonts : fontList.state === 'ready' ? text.reloadFonts : text.loadFonts}\n </Button>\n <Button variant=\"outline\" size=\"md\" onClick={() => {\n update({ uiFont: '', codeFont: '' })\n if (fontSize !== FONT_SIZE_DEFAULT) props.client.theme.setFontSize(FONT_SIZE_DEFAULT)\n }}>{text.reset}</Button>\n </div>\n {fontList.state === 'ready' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsLoaded(fontList.families.length)}</p> : null}\n {fontList.state === 'ready' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsPartial}</p> : null}\n {fontList.state === 'denied' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsDenied}</p> : null}\n </section>\n}\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client & { effect: Context['effect'] }\n const store = createFontSettingsStore(readStorage())\n let applySettings = (_settings: FontSettings) => {}\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', PLUGIN_NAME)\n style.textContent = styles\n document.head.appendChild(style)\n return () => style.remove()\n }, 'font.styles')\n // rc.2 defines font stacks on :root; root inline overrides reach its derived\n // code, Markdown and terminal tokens without changing host theme settings.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const override = createFontSettingsOverride(document.documentElement.style)\n applySettings = next => override.apply(next)\n applySettings(store.load())\n return () => { override.dispose(); applySettings = () => {} }\n }, 'font.apply')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register(\n { name: 'plugins.bundle.config', key: PLUGIN_NAME },\n (slotProps: { view?: 'summary' | 'page' }) =>\n <FontSettingsPanel client={client} store={store} applySettings={next => applySettings(next)} view={slotProps?.view} />,\n )), 'font.settings')\n}\n"],"mappings":";;;;AAuH6D,OAAO,OAAO;;CAlFzE,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;CACF;;CAEA,QAAQ;EAAC;EAAyB;EAAyB;EAAyB;CAAuB;;CAE3G,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACF;;CAEA,aAAa;EACX;EACA;EACA;CACF;;CAEA,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,OAAO;EACL;EACA;EACA;EACA;EACA;CACF;;CAEA,QAAQ;EAAC;EAAmB;EAAmB;EAAmB;CAAoB;;CAEtF,WAAW;EACT;EACA;EACA;EACA;EACA;CACF;;CAEA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;;CAEA,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AAIyE,CAAqB,CAAC,CAAC,KAAK;;;;;;AAUvG,MAA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AD;IAAG,MAAK;IAAS,WAAU;IAAe,UAAA,KAAK;GAAe,CAAA,IAAI;EAC1F;;AACX;AAEA,SAAgB,MAAM,KAAoB;CACxC,MAAM,SAAS;CACf,MAAM,QAAQ,wBAAwB,YAAY,CAAC;CACnD,IAAI,iBAAiB,cAA4B,CAAC;CAClD,IAAI,aAAa;EACf,IAAI,OAAO,aAAa,aAAa,aAAa,CAAC;EACnD,MAAM,QAAQ,SAAS,cAAc,OAAO;EAC5C,MAAM,aAAa,eAAe,WAAW;EAC7C,MAAM,cAAc;EACpB,SAAS,KAAK,YAAY,KAAK;EAC/B,aAAa,MAAM,OAAO;CAC5B,GAAG,aAAa;CAGhB,IAAI,aAAa;EACf,IAAI,OAAO,aAAa,aAAa,aAAa,CAAC;EACnD,MAAM,WAAW,2BAA2B,SAAS,gBAAgB,KAAK;EAC1E,iBAAgB,SAAQ,SAAS,MAAM,IAAI;EAC3C,cAAc,MAAM,KAAK,CAAC;EAC1B,aAAa;GAAE,SAAS,QAAQ;GAAG,sBAAsB,CAAC;EAAE;CAC9D,GAAG,YAAY;CACf,IAAI,aAAa,OAAO,MAAM,OAAO,+BAA+B,OAAO,MAAM,SAC/E;EAAE,MAAM;EAAyB,KAAK;CAAY,IACjD,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;EAA2B;EAAe;EAAO,gBAAe,SAAQ,cAAc,IAAI;EAAG,MAAM,WAAW;CAAO,CAAA,CACzH,CAAC,GAAG,eAAe;AACrB"}
1
+ {"version":3,"file":"client.inner.cjs","names":["useSyncExternalStore","useState","Input","Button"],"sources":["../../dsh-plugin-kit/src/official-ui.ts","../src/contracts.ts","../src/client.tsx"],"sourcesContent":["/**\n * Shared contract that keeps every plugin's browser-side UI on the official\n * DeepSeek Harness Web design language.\n *\n * Two rules produce that language, and both are load-bearing here:\n *\n * 1. Colour, radius, elevation and focus come from the host theme's real\n * `--dsw-*` tokens, written under their own names. Plugins never invent a\n * token, never alias the official ones behind a private palette (a private\n * alias is just a second, diverging theme), and never carries a literal\n * fallback — the host publishes light and dark, and a literal would pin one\n * of them. The only non-colour custom properties used are the host's own\n * content-font axis and frame clearance.\n *\n * 2. Anything the host already ships is used, not reimplemented. Controls come\n * from `@deepseek-ai/dsh-client-ui-primitives` (`Button`, `Input`,\n * `Checkbox`, `Switch`, `Tag`, `Pill`, `SegmentedControl`, `Menu`, `Modal`,\n * `Tooltip`, `Toast`, `DisclosureRow`, `StateDot`, `PathLabel`, the settings\n * form suite). This module only styles what primitives do not cover: page\n * scaffolding, field layout, banners, empty states and scroll regions.\n *\n * The metrics below are transcribed from the primitives' own CSS modules so a\n * feature panel lines up pixel-for-pixel with a native one: the 14/22 body and\n * 13/20 compact type tiers, the 0.5px hairline scale, and the elevation family\n * that draws a surface's edge in its shadow (`border: 0`) instead of a border.\n */\n\n/**\n * Every `--dsw-*` token this repo is allowed to reference, grouped by role.\n *\n * Plugins may only colour through this list. It is exported so the guard test\n * can fail a build when a stylesheet reaches for anything else — the failure\n * mode this prevents is silent: an unknown token resolves to nothing, so a\n * border disappears or a label inherits the wrong colour with no error anywhere.\n */\nexport const OFFICIAL_THEME_TOKENS = {\n /** Surfaces, from the page up to the topmost nested card. */\n surface: [\n '--dsw-alias-bg-base',\n '--dsw-alias-bg-layer-1',\n '--dsw-alias-bg-layer-2',\n '--dsw-alias-bg-layer-3',\n '--dsw-alias-bg-layer-4',\n '--dsw-alias-bg-module-platform',\n '--dsw-alias-bg-overlay',\n ],\n /** Hairlines. l1 is near-invisible on a menu surface, so menus use l2+. */\n border: ['--dsw-alias-border-l1', '--dsw-alias-border-l2', '--dsw-alias-border-l3', '--dsw-alias-border-l4'],\n /** Text. `caption` is menu shortcut text, `dimmed` is placeholder text. */\n label: [\n '--dsw-alias-label-primary',\n '--dsw-alias-label-secondary',\n '--dsw-alias-label-tertiary',\n '--dsw-alias-label-caption',\n '--dsw-alias-label-dimmed',\n '--dsw-alias-label-error',\n '--dsw-alias-label-primary-foreground',\n ],\n /** Interactive fills. The `-danger` hover belongs to destructive rows. */\n interactive: [\n '--dsw-alias-interactive-bg-hover',\n '--dsw-alias-interactive-bg-active',\n '--dsw-alias-interactive-bg-hover-danger',\n ],\n /** Accent and status. `business` is the focus ring's default colour. */\n accent: [\n '--dsw-alias-brand-primary',\n '--dsw-alias-button-primary-fill',\n '--dsw-alias-button-primary-hover',\n '--dsw-alias-button-tool-bar-fill',\n '--dsw-alias-button-tool-bar-hover',\n '--dsw-alias-button-ghost-active-fill',\n '--dsw-alias-button-ghost-active-border',\n ],\n state: [\n '--dsw-alias-state-business-primary',\n '--dsw-alias-state-success-primary',\n '--dsw-alias-state-warn-primary',\n '--dsw-alias-state-error-primary',\n '--dsw-alias-state-idle-primary',\n ],\n /** Corner scale: sm 8, md 12, lg the large card, panel the modal. */\n radius: ['--dsw-radius-sm', '--dsw-radius-md', '--dsw-radius-lg', '--dsw-radius-panel'],\n /** An elevated surface draws its edge in the shadow, so it keeps border: 0. */\n elevation: [\n '--dsw-elevation-soft',\n '--dsw-elevation-stroke',\n '--dsw-elevation-stroke-color',\n '--dsw-elevation-panel',\n '--dsw-elevation-prominent',\n ],\n /** Floats, masks and scrollbars. */\n overlay: [\n '--dsw-menu-surface-fill',\n '--dsw-menu-backdrop-filter',\n '--dsw-mask-blur',\n '--dsw-alias-bg-mask-1',\n '--dsw-alias-menu-icon',\n '--dsw-alias-scrollbar-bg-l2',\n '--dsw-alias-scrollbar-hover-l2',\n '--dsw-shadow-lv3',\n ],\n /** Motion, focus and type axis, published by the host rather than by a component. */\n system: [\n '--dsw-focus-ring-width',\n '--dsw-focus-ring-color',\n '--dsw-font-markdown-code-font-family',\n '--ds-transition-duration',\n '--ds-ease-in-out',\n '--ds-font-family-code',\n '--dsh-scrollbar-thumb',\n '--dsh-scrollbar-thumb-hover',\n '--dsh-content-font-size-secondary',\n '--dsh-content-font-delta',\n '--dsh-frame-top-clearance',\n ],\n} as const\n\n/** Every official token name, flat. Used by the token guard test. */\nexport const OFFICIAL_THEME_TOKEN_NAMES: readonly string[] = Object.values(OFFICIAL_THEME_TOKENS).flat()\n\n/** The elevation steps a surface can be raised by, softest first. */\nexport type OfficialElevation = 'soft' | 'stroke' | 'panel' | 'prominent'\n\n/**\n * The host's focus ring shorthand, verbatim. Writing this per control is how\n * rings drift apart; a stylesheet that draws its own focus style should use\n * {@link officialFocus} instead. The colour fallback is the host's own default.\n */\nexport const OFFICIAL_FOCUS_RING =\n 'var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary))'\n\n/**\n * A complete `outline` declaration at the official geometry. `offset` defaults\n * to the 2px the native controls use; the host's inline field rules sit at 1px\n * and a segmented tab pulls the ring inside itself at -2px.\n */\nexport function officialFocus(offset = '2px'): string {\n return `outline: ${OFFICIAL_FOCUS_RING}; outline-offset: ${offset}`\n}\n\n/**\n * An elevated surface. The host draws a raised surface's edge inside its\n * shadow rather than as a border, so a card sets `border: 0` and takes the edge\n * from the elevation — which is also why its border stays off the alias-border\n * set that a flat, non-elevated rule would use.\n */\nexport function officialElevation(level: OfficialElevation): string {\n return `border: 0; box-shadow: var(--dsw-elevation-${level})`\n}\n\n/**\n * An elevated surface whose edge should read as a specific hairline. Rebinding\n * the stroke colour is how a menu card picks l1 while a panel picks l3, without\n * the two growing apart by hand.\n */\nexport function officialStrokedElevation(level: OfficialElevation, color: string): string {\n return `--dsw-elevation-stroke-color: ${color}; ${officialElevation(level)}`\n}\n\n/**\n * The shared stylesheet for a plugin UI, scoped under that plugin's root class.\n *\n * Scoping is what keeps this safe to always-bundle into every client: the rules\n * can only match inside the plugin's own subtree, so two plugins can both mount\n * `dsh-ui-card` without either styling the other's markup.\n *\n * Each recipe matches the root element *and* its descendants, because the\n * commonest arrangement is one element that is both — a surface that carries\n * the root class and `dsh-ui-card`, or a portaled dialog that is the root and\n * the `dsh-ui-surface`. A descendant-only scope would silently leave those\n * unstyled, with no error anywhere.\n *\n * A caveat worth knowing: `Modal` and `Menu` portal to `document.body`, so their\n * content leaves the plugin's subtree entirely. A portaled surface therefore\n * needs its own root class on an element inside the portal.\n *\n * Only patterns that primitives do not provide live here. If a control appears\n * below that `Button`/`Input`/`Switch`/`Tag`/`Menu` already covers, that is a\n * bug in this file: use the primitive and delete the recipe.\n */\nexport function officialUiCss(roots: string | readonly string[]): string {\n // One plugin often mounts several unrelated surfaces (a settings seat, a chat\n // card, a header menu), so the caller names every root. The rules below are\n // nested under a single selector list and use `&`, which the browser expands\n // per root — so one stylesheet covers all of them without duplicating itself.\n const scope = (typeof roots === 'string' ? [roots] : roots).map(root => `.${root}`).join(', ')\n const sheet = `\n/* Official DSH Web UI contract. Generated by @klarkxy/dsh-plugin-kit/official-ui.\n * Do not hand-edit the copy inside a plugin: change this module so every plugin\n * moves together. Scope: ${scope} */\n/* The scope rule below stays open for the whole sheet: every rule after it\n * nests with the parent selector, so one stylesheet can cover several unrelated\n * roots without leaking into a neighbouring plugin. Its closing brace is last. */\n${scope} {\n color: var(--dsw-alias-label-primary);\n font-family: inherit;\n font-size: 14px;\n line-height: 22px;\n min-width: 0;\n\n& *, & *::before, & *::after { box-sizing: border-box; }\n& h1, & h2, & h3, & h4, & p, & figure { margin: 0; }\n/* Keyboard focus only: pointer input keeps the native resting appearance. The\n * ring needs no radius of its own — the outline already follows the control's\n * own border-radius, and overriding it here would flatten every control. */\n& :focus-visible { ${officialFocus()}; }\n& [hidden] { display: none !important; }\n\n/* --- Type tiers. The same 14/22 and 13/20 steps the primitives use. --- */\n& .dsh-ui-title { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-heading { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-compact { font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-meta { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-hint { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-error { font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-warn { color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-success { color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-muted { color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n& .dsh-ui-wrap { min-width: 0; overflow-wrap: anywhere; }\n\n/* --- Layout scaffolding. --- */\n& .dsh-ui-stack { display: flex; flex-direction: column; gap: 12px; }\n& .dsh-ui-stack-lg { display: flex; flex-direction: column; gap: 20px; }\n& .dsh-ui-row { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-row-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }\n& .dsh-ui-spacer { flex: 1; min-width: 0; }\n/* A 0.5px l2 rule is the host's section divider; reserve the same rhythm. */\n& .dsh-ui-divider { height: 0.5px; background: var(--dsw-alias-border-l2); }\n& .dsh-ui-section { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 0.5px solid var(--dsw-alias-border-l2); }\n\n/* --- Card: a raised surface whose edge lives in the shadow. --- */\n& .dsh-ui-card {\n ${officialElevation('stroke')}\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n min-width: 0;\n}\n& .dsh-ui-card--flat { border: 0.5px solid var(--dsw-alias-border-l3); box-shadow: none; }\n& .dsh-ui-card--nested { background: var(--dsw-alias-bg-layer-2); }\n& .dsh-ui-card--plain { background: none; }\n\n/* --- Field: label, control, help, error. The control itself is an\n * official primitive, so this only owns the vertical rhythm. --- */\n& .dsh-ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }\n& .dsh-ui-field + .dsh-ui-field { border-top: 0.5px solid var(--dsw-alias-border-l2); padding-top: 12px; }\n& .dsh-ui-label { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n& .dsh-ui-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }\n& .dsh-ui-help { font-size: 12px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }\n& .dsh-ui-help p { margin: 0; }\n& .dsh-ui-help p + p { margin-top: 8px; }\n& .dsh-ui-required { color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-control { width: 100%; min-width: 0; }\n/* An invalid control is marked on the control, not only in the message. */\n& .dsh-ui-control[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-readonly { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-readonly > dt { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n& .dsh-ui-readonly > dd { margin: 0; font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }\n\n/* --- Buttons row. A no-op container: it exists so actions line up on the\n * trailing edge the way every native panel does. --- */\n& .dsh-ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }\n& .dsh-ui-actions-end { justify-content: flex-end; }\n\n/* --- Banners. A banner is a left-rail notice, the shape used for warnings,\n * deprecations and blocking instructions. --- */\n& .dsh-ui-banner {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 14px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-left: 3px solid var(--dsw-alias-state-warn-primary);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-banner-title { font-weight: 500; color: var(--dsw-alias-state-warn-primary); }\n& .dsh-ui-banner--info { border-left-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-banner--danger { border-left-color: var(--dsw-alias-state-error-primary); }\n& .dsh-ui-banner--success { border-left-color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-banner p { margin: 0; }\n\n/* --- Inline notice: a transient confirmation with no chrome of its own. --- */\n& .dsh-ui-notice { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 18px; color: var(--dsw-alias-state-success-primary); }\n& .dsh-ui-notice--error { color: var(--dsw-alias-state-error-primary); }\n\n/* --- Empty and loading states. Both sit in a dashed well so an empty panel\n * reads as \"nothing here yet\" rather than as a broken layout. --- */\n& .dsh-ui-empty {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n padding: 20px 16px;\n border: 0.5px dashed var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n font-size: 13px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n& .dsh-ui-loading { display: flex; align-items: center; gap: 8px; padding: 20px 0; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary); }\n\n/* --- Selectable list. A row is a button-sized target with a hover fill and\n * a selected fill; the name carries the weight, the description does not. --- */\n& .dsh-ui-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n& .dsh-ui-list-scroll { max-height: min(66vh, 760px); overflow-y: auto; overflow-x: hidden; }\n& .dsh-ui-list-row { border-radius: var(--dsw-radius-md); }\n& .dsh-ui-list-row:hover { background: var(--dsw-alias-interactive-bg-hover); }\n& .dsh-ui-list-row[aria-selected='true'], & .dsh-ui-list-row[data-selected] { background: var(--dsw-alias-interactive-bg-active); }\n& .dsh-ui-list-item {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n min-width: 0;\n padding: 10px 12px;\n border: 0;\n border-radius: var(--dsw-radius-md);\n background: none;\n font: inherit;\n color: inherit;\n text-align: start;\n cursor: pointer;\n}\n& .dsh-ui-list-item:disabled { cursor: default; }\n& .dsh-ui-list-item:disabled:hover { background: none; }\n& .dsh-ui-list-name { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow-wrap: anywhere; }\n& .dsh-ui-list-desc { font-size: 12px; line-height: 18px; color: var(--dsw-alias-label-tertiary); }\n\n/* --- Code and structured output. Wraps rather than scrolls, because a\n * feature panel is read rather than scanned. --- */\n& .dsh-ui-code {\n padding: 10px 12px;\n border: 0.5px solid var(--dsw-alias-border-l3);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n font-family: var(--ds-font-family-code);\n font-size: 12px;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n overflow-wrap: anywhere;\n white-space: pre-wrap;\n}\n& .dsh-ui-scroll { max-height: 60vh; overflow: auto; overscroll-behavior: contain; }\n\n/* --- A toggle row: label on the left, switch on the trailing edge. This is\n * layout only; the switch itself is the official primitive. --- */\n& .dsh-ui-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 12px 0; }\n& .dsh-ui-toggle-row + .dsh-ui-toggle-row { border-top: 0.5px solid var(--dsw-alias-border-l2); }\n& .dsh-ui-toggle-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }\n& .dsh-ui-toggle-label { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Floating surface: a panel anchored to a trigger. This is the material\n * a menu card is made of — the translucent fill plus its backdrop blur, with\n * the edge riding inside the prominent elevation. A plugin that hand-rolls this\n * is how tokens like --dsw-specific-menu get invented; use this instead. --- */\n& .dsh-ui-surface {\n --dsw-elevation-stroke-color: var(--dsw-alias-border-l1);\n --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);\n --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);\n position: relative;\n display: flex;\n flex-direction: column;\n border: 0;\n border-radius: var(--dsw-radius-lg);\n background: var(--dsw-menu-surface-fill);\n backdrop-filter: var(--dsw-menu-backdrop-filter);\n box-shadow: var(--dsw-elevation-prominent);\n color: var(--dsw-alias-label-primary);\n font-size: 13px;\n line-height: 20px;\n min-width: 0;\n}\n& .dsh-ui-surface-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; overflow-y: auto; }\n& .dsh-ui-surface-head { display: flex; align-items: center; gap: 8px; min-width: 0; }\n& .dsh-ui-surface-title { font-size: 14px; line-height: 22px; font-weight: 500; color: var(--dsw-alias-label-primary); }\n\n/* --- Native select. The primitives ship no select, so a plugin that offers a\n * closed list of choices keeps the platform control and matches the official\n * settings field geometry exactly (34px, 0.5px l4, radius-md, layer-3). A\n * SegmentedControl is the primitive to reach for when the choices are few\n * enough to show at once. --- */\n& .dsh-ui-select {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n height: 34px;\n padding: 0 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n cursor: pointer;\n}\n& .dsh-ui-select:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* --- Native textarea. The primitives ship no textarea either, so a settings\n * prompt keeps the platform element and the same field shell as the select:\n * 0.5px l4, radius-md, layer-3, 13/1.5 type. It grows vertically instead of\n * locking to the select's 34px row. --- */\n& .dsh-ui-textarea {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n resize: vertical;\n padding: 8px 12px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-3);\n font: inherit;\n font-size: 13px;\n line-height: 1.5;\n color: var(--dsw-alias-label-primary);\n}\n& .dsh-ui-textarea:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }\n& .dsh-ui-textarea:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }\n& .dsh-ui-textarea::placeholder { color: var(--dsw-alias-label-dimmed); }\n& .dsh-ui-textarea[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }\n\n/* Long panels scroll inside themselves instead of growing the host page. */\n& .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }\n& .dsh-ui-panel-wide { max-width: 100%; }\n\n@media (prefers-reduced-motion: reduce) {\n & *, & *::before, & *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }\n}\n}\n`\n // Widen every recipe from \"a descendant of the root\" to \"the root, or one of\n // its descendants\". Written as a transform rather than by hand so no recipe\n // can be added later with only the descendant form. The pattern is narrow on\n // purpose: a leading `&` followed by one recipe class and no combinator, so\n // sibling and child rules such as `.dsh-ui-field + .dsh-ui-field` keep their\n // own meaning and are left alone.\n return sheet.replace(/^& (\\.dsh-ui-[a-z0-9-]+)(?![+>~])/gm, (_match, className: string) =>\n `&${className}, & ${className}`)\n}\n","/** Browser-safe contracts for @klarkxy/dsh-font: settings shape, font presets,\n * normalization, the CSS-variable application core, and the local store.\n * No React, no cordis — every export runs in Node tests and the browser. */\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-font'\n\n/** localStorage key. Fonts are a property of the rendering environment (each\n * browser/machine has its own installed fonts), so they persist browser-local,\n * exactly like the host's own GUI preferences (dsh-client-store, ui-theme\n * notes). The conversation font size is NOT stored here: the official\n * `ctx.theme.setFontSize()` entry persists it host-side already. */\nexport const STORAGE_KEY = 'klarkxy.dsh-font.v1'\n\n/** DSH 0.2.0-rc.2 ui-theme/theme-settings.ts bounds, shared by its native stepper. */\nexport const FONT_SIZE_MIN = 10\nexport const FONT_SIZE_MAX = 22\nexport const FONT_SIZE_DEFAULT = 14\n\n/** DSH rc.2 defines these font stacks on :root. Root inline overrides also\n * reach derived Markdown, brand and terminal font tokens. */\nexport const UI_FONT_VARIABLE = '--dsw-font-family'\nexport const CODE_FONT_VARIABLE = '--ds-font-family-code'\n\nexport interface FontSettings {\n /** Full CSS font-family stack for the interface; empty keeps the host default. */\n uiFont: string\n /** Full CSS font-family stack for code blocks, inline code and terminals. */\n codeFont: string\n}\n\nexport function defaultFontSettings(): FontSettings {\n return { uiFont: '', codeFont: '' }\n}\n\n/** A raw font-family string is placed into a single CSS declaration via\n * CSSStyleDeclaration.setProperty, which cannot escape the declaration — but\n * trimming control characters and the CSS delimiters keeps pasted garbage from\n * producing a silently-dead value. */\nexport function normalizeFontFamily(value: unknown): string {\n if (typeof value !== 'string') return ''\n return value\n .replace(/[\\u0000-\\u001F\\u007F;{}<>]/g, '')\n .trim()\n .slice(0, 300)\n}\n\nexport function parseFontSettings(raw: unknown): FontSettings {\n let source = raw\n if (typeof source === 'string') {\n try {\n source = JSON.parse(source)\n } catch {\n return defaultFontSettings()\n }\n }\n if (!source || typeof source !== 'object' || Array.isArray(source)) return defaultFontSettings()\n const record = source as Record<string, unknown>\n return {\n uiFont: normalizeFontFamily(record.uiFont),\n codeFont: normalizeFontFamily(record.codeFont),\n }\n}\n\nexport function serializeFontSettings(settings: FontSettings): string {\n return JSON.stringify({\n uiFont: normalizeFontFamily(settings.uiFont),\n codeFont: normalizeFontFamily(settings.codeFont),\n })\n}\n\nexport interface FontPreset {\n readonly id: string\n readonly label: { readonly zh: string; readonly en: string }\n /** The font-family stack committed when the preset is picked. */\n readonly value: string\n}\n\nexport const UI_FONT_PRESETS: readonly FontPreset[] = [\n { id: 'yahei', label: { zh: '微软雅黑', en: 'Microsoft YaHei' }, value: '\"Microsoft YaHei\", \"PingFang SC\", sans-serif' },\n { id: 'pingfang', label: { zh: '苹方', en: 'PingFang SC' }, value: '\"PingFang SC\", -apple-system, sans-serif' },\n { id: 'simsun', label: { zh: '宋体', en: 'SimSun' }, value: '\"SimSun\", \"Songti SC\", serif' },\n { id: 'kaiti', label: { zh: '楷体', en: 'KaiTi' }, value: '\"KaiTi\", \"Kaiti SC\", \"STKaiti\", serif' },\n { id: 'source-han-sans', label: { zh: '思源黑体', en: 'Source Han Sans' }, value: '\"Source Han Sans SC\", \"Noto Sans CJK SC\", \"Noto Sans SC\", sans-serif' },\n { id: 'source-han-serif', label: { zh: '思源宋体', en: 'Source Han Serif' }, value: '\"Source Han Serif SC\", \"Noto Serif CJK SC\", \"Noto Serif SC\", serif' },\n]\n\nexport const CODE_FONT_PRESETS: readonly FontPreset[] = [\n { id: 'cascadia', label: { zh: 'Cascadia', en: 'Cascadia' }, value: '\"Cascadia Mono\", \"Cascadia Code\", monospace' },\n { id: 'jetbrains-mono', label: { zh: 'JetBrains Mono', en: 'JetBrains Mono' }, value: '\"JetBrains Mono\", monospace' },\n { id: 'fira-code', label: { zh: 'Fira Code', en: 'Fira Code' }, value: '\"Fira Code\", monospace' },\n { id: 'consolas', label: { zh: 'Consolas', en: 'Consolas' }, value: 'Consolas, monospace' },\n { id: 'sarasa', label: { zh: '更纱黑体', en: 'Sarasa Mono' }, value: '\"Sarasa Mono SC\", \"Sarasa Term SC\", monospace' },\n { id: 'maple-mono', label: { zh: 'Maple Mono', en: 'Maple Mono' }, value: '\"Maple Mono NF CN\", \"Maple Mono\", monospace' },\n]\n\nexport function presetFor(value: string, presets: readonly FontPreset[]): FontPreset | undefined {\n return presets.find(preset => preset.value === value)\n}\n\nexport type FontGenericFamily = 'sans-serif' | 'monospace'\n\n/** Build the committed stack for a family picked from the system font list.\n * The family name comes from the OS (Local Font Access API); quotes and\n * backslashes are stripped so it can be safely re-quoted as one family. */\nexport function fontStackFor(family: string, generic: FontGenericFamily): string {\n const cleaned = normalizeFontFamily(family).replace(/[\"\\\\]/g, '')\n if (!cleaned) return generic\n return `\"${cleaned}\", ${generic}`\n}\n\n/** A system font offered in the picker: `family` is the exact name CSS\n * matching needs; `fullName` is an informative localized alias (e.g. converted\n * CJK fonts whose family is the Latin alias), '' when it only restates the\n * family (\"Microsoft YaHei Regular\" adds nothing). */\nexport interface SystemFontFamily {\n readonly family: string\n readonly fullName: string\n}\n\n/** Distinct, normalized, family-sorted entries out of a queryLocalFonts()\n * result (entries carry `family` and `fullName`; duplicates per style are\n * expected). */\nexport function uniqueSystemFonts(fonts: readonly unknown[]): SystemFontFamily[] {\n const byFamily = new Map<string, string>()\n for (const item of fonts) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) continue\n const record = item as Record<string, unknown>\n const family = normalizeFontFamily(record.family).replace(/[\"\\\\]/g, '')\n if (!family || byFamily.has(family)) continue\n const fullName = normalizeFontFamily(record.fullName).replace(/[\"\\\\]/g, '')\n byFamily.set(family, fullName && fullName !== family && !fullName.startsWith(`${family} `) ? fullName : '')\n }\n return [...byFamily.entries()]\n .map(([family, fullName]) => ({ family, fullName }))\n .sort((a, b) => a.family.localeCompare(b.family))\n}\n\n/** Picker label: the UI locale's recognizable name leads, the alias stays in\n * parentheses because the canonical family is still what a custom input needs. */\nexport function systemFontLabel(item: SystemFontFamily, locale: 'zh' | 'en'): string {\n if (!item.fullName) return item.family\n return locale === 'zh' ? `${item.fullName}(${item.family})` : `${item.family}(${item.fullName})`\n}\n\n/** Minimal write face of CSSStyleDeclaration — document.documentElement.style\n * satisfies it, and tests supply a recording double. */\nexport interface FontStyleTarget {\n setProperty(name: string, value: string): void\n removeProperty(name: string): void\n}\n\nexport function applyFontSettings(style: FontStyleTarget, settings: FontSettings): void {\n if (settings.uiFont) style.setProperty(UI_FONT_VARIABLE, settings.uiFont)\n else style.removeProperty(UI_FONT_VARIABLE)\n if (settings.codeFont) style.setProperty(CODE_FONT_VARIABLE, settings.codeFont)\n else style.removeProperty(CODE_FONT_VARIABLE)\n}\n\nexport function clearFontSettings(style: FontStyleTarget): void {\n style.removeProperty(UI_FONT_VARIABLE)\n style.removeProperty(CODE_FONT_VARIABLE)\n}\n\n/** Read face required to restore only overrides still owned by this instance. */\nexport interface OwnedFontStyleTarget extends FontStyleTarget {\n getPropertyValue(name: string): string\n getPropertyPriority(name: string): string\n setProperty(name: string, value: string, priority?: string): void\n}\n\n/** Root inline overrides preserve the existing local persistence/unload\n * boundary. Save the underlying value (including !important) on first write\n * or when the host replaces a value, and never retract somebody else's write. */\nexport function createFontSettingsOverride(style: OwnedFontStyleTarget) {\n const owned = new Map<string, { previous: string; priority: string; value: string }>()\n function release(name: string) {\n const entry = owned.get(name)\n if (!entry) return\n if (style.getPropertyValue(name) === entry.value && style.getPropertyPriority(name) === '') {\n if (entry.previous) style.setProperty(name, entry.previous, entry.priority)\n else style.removeProperty(name)\n }\n owned.delete(name)\n }\n return {\n apply(settings: FontSettings) {\n for (const [name, value] of [\n [UI_FONT_VARIABLE, settings.uiFont],\n [CODE_FONT_VARIABLE, settings.codeFont],\n ] as const) {\n if (!value) { release(name); continue }\n const current = style.getPropertyValue(name)\n const priority = style.getPropertyPriority(name)\n const entry = owned.get(name)\n if (!entry || current !== entry.value || priority !== '') {\n owned.set(name, { previous: current, priority, value: '' })\n }\n style.setProperty(name, value)\n owned.get(name)!.value = style.getPropertyValue(name)\n }\n },\n dispose() { for (const name of [...owned.keys()]) release(name) },\n }\n}\n\nexport interface FontSettingsStorage {\n getItem(key: string): string | null\n setItem(key: string, value: string): void\n removeItem(key: string): void\n}\n\nexport interface FontSettingsStore {\n load(): FontSettings\n save(next: FontSettings): void\n}\n\n/** Browser-local persistence. A fully-default setting removes the key so a\n * reset leaves no residue; storage failures (private mode, quota) degrade to\n * in-memory behaviour rather than breaking the panel. */\nexport function createFontSettingsStore(storage: FontSettingsStorage | undefined): FontSettingsStore {\n let current = defaultFontSettings()\n // A failed local write must win over stale persisted values on page remount.\n // Successful writes restore the existing ability to read external updates.\n let pendingPersistence = false\n return {\n load() {\n if (storage && !pendingPersistence) {\n try {\n current = parseFontSettings(storage.getItem(STORAGE_KEY))\n } catch {\n /* keep the last readable or locally saved snapshot */\n }\n }\n return { ...current }\n },\n save(next) {\n current = parseFontSettings(next)\n if (!storage) return\n pendingPersistence = true\n try {\n if (!current.uiFont && !current.codeFont) storage.removeItem(STORAGE_KEY)\n else storage.setItem(STORAGE_KEY, serializeFontSettings(current))\n pendingPersistence = false\n } catch {\n /* stay in-memory */\n }\n },\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport { Button, Input } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { officialUiCss } from '@klarkxy/dsh-plugin-kit/official-ui'\nimport { useState, useSyncExternalStore } from 'react'\nimport {\n CODE_FONT_PRESETS, FONT_SIZE_DEFAULT, FONT_SIZE_MAX, FONT_SIZE_MIN, PLUGIN_NAME,\n UI_FONT_PRESETS,\n createFontSettingsOverride, createFontSettingsStore, fontStackFor, normalizeFontFamily,\n presetFor, systemFontLabel, uniqueSystemFonts,\n type FontGenericFamily, type FontPreset, type FontSettings, type FontSettingsStorage, type FontSettingsStore,\n type SystemFontFamily,\n} from './contracts.ts'\n\nexport const name = 'dsh-font-client'\nexport const inject = ['slots', 'theme', 'locale'] as const\n\ninterface ThemeSnapshotLike {\n fontSize: number\n}\n\ninterface ThemeLike {\n getTheme(): ThemeSnapshotLike\n setFontSize(px: number): void\n}\n\ntype Client = {\n theme: ThemeLike\n locale: { getSnapshot(): { active: string }; subscribe(fn: () => void): () => void }\n slots: {\n inject(key: string, callback: () => unknown): () => void\n register(spec: { name: string; key: string; label?: string }, render: unknown): () => void\n }\n on(event: 'theme/change', listener: (snapshot: ThemeSnapshotLike) => void): () => void\n}\n\nconst COPY = {\n zh: {\n label: '字体',\n uiFont: '界面字体',\n codeFont: '代码字体',\n fontSize: '会话字号',\n defaultOption: '默认',\n customOption: '自定义…',\n customUiPlaceholder: '例如 \"Microsoft YaHei\", sans-serif',\n customCodePlaceholder: '例如 \"JetBrains Mono\", monospace',\n uiHelp: '作用于整个界面的文字。自定义时输入完整的 font-family 字体栈,留空恢复默认。',\n codeHelp: '作用于代码块、行内代码与终端的等宽字体。',\n sizeHelp: '与「设置 → 通用」中的字号同步,范围 10–22。',\n loadFonts: '读取系统字体',\n reloadFonts: '重新读取系统字体',\n loadingFonts: '正在读取系统字体…',\n fontsLoaded: (count: number) => `已读取 ${count} 款系统字体;新装字体后点「重新读取」刷新列表。`,\n fontsPartial: '列表来自浏览器枚举:仅安装到当前用户的字体可能不在其中,可以直接输入字体名使用。',\n fontsDenied: '系统字体读取被拒绝或当前环境不支持,仍可手动输入字体名。',\n systemGroup: '系统字体',\n reset: '全部恢复默认',\n summary: (ui: string, code: string, size: number) => `界面 ${ui} · 代码 ${code} · ${size}px`,\n defaultName: '默认',\n },\n en: {\n label: 'Font',\n uiFont: 'Interface font',\n codeFont: 'Code font',\n fontSize: 'Conversation font size',\n defaultOption: 'Default',\n customOption: 'Custom…',\n customUiPlaceholder: 'e.g. \"Microsoft YaHei\", sans-serif',\n customCodePlaceholder: 'e.g. \"JetBrains Mono\", monospace',\n uiHelp: 'Applies to all interface text. For a custom value enter a full font-family stack; empty restores the default.',\n codeHelp: 'Monospace font for code blocks, inline code and terminals.',\n sizeHelp: 'Synced with Settings → General; 10–22 px.',\n loadFonts: 'Load system fonts',\n reloadFonts: 'Reload system fonts',\n loadingFonts: 'Loading system fonts…',\n fontsLoaded: (count: number) => `${count} installed fonts loaded; choose “Reload system fonts” after installing new ones.`,\n fontsPartial: 'The list comes from the browser’s enumeration: fonts installed only for the current user may be missing — you can still type the family name directly.',\n fontsDenied: 'Access to system fonts was denied or is unsupported here; you can still type a font name.',\n systemGroup: 'Installed fonts',\n reset: 'Reset all to defaults',\n summary: (ui: string, code: string, size: number) => `${ui} · ${code} · ${size}px`,\n defaultName: 'Default',\n },\n} as const\n\nexport function fontCopy(locale: 'zh' | 'en') {\n return COPY[locale]\n}\n\n/* The panel's own geometry only: reading width, and the custom-stack input row\n * rhythm. Everything visual comes from the contract recipes and primitives. */\nconst styles = `${officialUiCss('font-root')}\n.font-root { max-width: 760px; }\n.font-custom { margin-top: 8px; }\n`\n\nfunction readStorage(): FontSettingsStorage | undefined {\n try {\n return typeof localStorage === 'undefined' ? undefined : localStorage\n } catch {\n return undefined\n }\n}\n\nfunction useLocale(client: Client): 'zh' | 'en' {\n const getSnapshot = () => (client.locale.getSnapshot().active.toLowerCase().startsWith('zh') ? 'zh' : 'en') as 'zh' | 'en'\n return useSyncExternalStore(\n fn => client.locale.subscribe(fn),\n getSnapshot,\n getSnapshot,\n )\n}\n\nfunction useFontSize(client: Client): number {\n return useSyncExternalStore(\n fn => client.on('theme/change', () => fn()),\n () => client.theme.getTheme().fontSize,\n () => client.theme.getTheme().fontSize,\n )\n}\n\nfunction presetMode(value: string, presets: readonly FontPreset[]): string {\n return presetFor(value, presets)?.id ?? (value ? 'custom' : '')\n}\n\nexport function FontField(props: {\n label: string\n help: string\n value: string\n presets: readonly FontPreset[]\n locale: 'zh' | 'en'\n generic: FontGenericFamily\n systemFonts?: readonly SystemFontFamily[]\n defaultLabel: string\n customLabel: string\n customPlaceholder: string\n systemGroupLabel: string\n onCommit(value: string): void\n}) {\n // undefined = not editing; the input otherwise shows the committed stack.\n const [draft, setDraft] = useState<string | undefined>(undefined)\n // With an empty (default) value nothing matches \"custom\" on its own, so the\n // choice itself must be remembered until a stack is committed.\n const [customOpen, setCustomOpen] = useState(false)\n const mode = customOpen ? 'custom' : presetMode(props.value, props.presets)\n\n function commitDraft() {\n if (draft === undefined) return\n const next = normalizeFontFamily(draft)\n setDraft(undefined)\n if (!next) setCustomOpen(false)\n if (next !== props.value) props.onCommit(next)\n }\n\n return <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{props.label}</span>\n <select\n className=\"dsh-ui-select\"\n value={mode}\n onChange={event => {\n const id = event.target.value\n setDraft(undefined)\n if (id === 'custom') { setCustomOpen(true); return }\n setCustomOpen(false)\n if (id.startsWith('sys:')) { props.onCommit(fontStackFor(id.slice(4), props.generic)); return }\n const preset = props.presets.find(item => item.id === id)\n props.onCommit(preset ? preset.value : '')\n }}\n >\n <option value=\"\">{props.defaultLabel}</option>\n {props.presets.map(preset => (\n <option key={preset.id} value={preset.id}>{preset.label[props.locale]}</option>\n ))}\n <option value=\"custom\">{props.customLabel}</option>\n {props.systemFonts && props.systemFonts.length > 0 ? <optgroup label={props.systemGroupLabel}>\n {props.systemFonts.map(item => <option key={item.family} value={`sys:${item.family}`}>{systemFontLabel(item, props.locale)}</option>)}\n </optgroup> : null}\n </select>\n {mode === 'custom' ? <span className=\"font-custom\">\n <Input\n value={draft ?? props.value}\n placeholder={props.customPlaceholder}\n onChange={event => setDraft(event.target.value)}\n onBlur={commitDraft}\n onKeyDown={event => { if (event.key === 'Enter') commitDraft() }}\n />\n </span> : null}\n <span className=\"dsh-ui-help\">{props.help}</span>\n </label>\n}\n\nexport function FontSettingsPanel(props: {\n client: Client\n store: FontSettingsStore\n applySettings(settings: FontSettings): void\n view?: 'summary' | 'page'\n}) {\n const locale = useLocale(props.client)\n const text = COPY[locale]\n const [settings, setSettings] = useState<FontSettings>(() => props.store.load())\n const fontSize = useFontSize(props.client)\n // System font list is shared by both fields: one permission prompt, one list.\n const [fontList, setFontList] = useState<{ state: 'idle' | 'loading' | 'ready' | 'denied'; families: readonly SystemFontFamily[] }>(\n { state: 'idle', families: [] },\n )\n\n async function loadSystemFonts() {\n if (fontList.state === 'loading') return\n // Every click re-enumerates: fonts installed after the first read appear\n // on the next one (the button relabels to \"reload\" once a list exists).\n // Local Font Access API: Chromium-only and gated behind a permission\n // prompt; anything else (Firefox, Safari, denied permission, Electron\n // policy) falls through to the preset + manual-input flow unchanged.\n const query = (globalThis as { queryLocalFonts?: () => Promise<readonly unknown[]> }).queryLocalFonts\n if (typeof query !== 'function') { setFontList({ state: 'denied', families: [] }); return }\n setFontList(current => ({ state: 'loading', families: current.families }))\n try {\n const fonts = await query()\n setFontList({ state: 'ready', families: uniqueSystemFonts(fonts) })\n } catch {\n setFontList(current => ({ state: 'denied', families: current.families }))\n }\n }\n\n function update(patch: Partial<FontSettings>) {\n const next: FontSettings = {\n uiFont: normalizeFontFamily(patch.uiFont ?? settings.uiFont),\n codeFont: normalizeFontFamily(patch.codeFont ?? settings.codeFont),\n }\n props.store.save(next)\n props.applySettings(next)\n setSettings(next)\n }\n\n const uiName = presetFor(settings.uiFont, UI_FONT_PRESETS)?.label[locale] ?? (settings.uiFont || text.defaultName)\n const codeName = presetFor(settings.codeFont, CODE_FONT_PRESETS)?.label[locale] ?? (settings.codeFont || text.defaultName)\n\n if (props.view === 'summary') {\n return <span className=\"font-root\" data-testid=\"font-summary\">{text.summary(uiName, codeName, fontSize)}</span>\n }\n\n const sizes: number[] = []\n for (let px = FONT_SIZE_MIN; px <= FONT_SIZE_MAX; px += 1) sizes.push(px)\n\n return <section className=\"font-root dsh-ui-panel\" data-testid=\"font-settings\">\n <FontField\n label={text.uiFont}\n help={text.uiHelp}\n value={settings.uiFont}\n presets={UI_FONT_PRESETS}\n locale={locale}\n generic=\"sans-serif\"\n systemFonts={fontList.families}\n defaultLabel={text.defaultOption}\n customLabel={text.customOption}\n customPlaceholder={text.customUiPlaceholder}\n systemGroupLabel={text.systemGroup}\n onCommit={value => update({ uiFont: value })}\n />\n <FontField\n label={text.codeFont}\n help={text.codeHelp}\n value={settings.codeFont}\n presets={CODE_FONT_PRESETS}\n locale={locale}\n generic=\"monospace\"\n systemFonts={fontList.families}\n defaultLabel={text.defaultOption}\n customLabel={text.customOption}\n customPlaceholder={text.customCodePlaceholder}\n systemGroupLabel={text.systemGroup}\n onCommit={value => update({ codeFont: value })}\n />\n <label className=\"dsh-ui-field\">\n <span className=\"dsh-ui-label\">{text.fontSize}</span>\n <select\n className=\"dsh-ui-select\"\n value={fontSize}\n onChange={event => {\n const px = Number(event.target.value)\n if (Number.isInteger(px) && px >= FONT_SIZE_MIN && px <= FONT_SIZE_MAX && px !== fontSize) {\n // The theme service is the only write entry; it validates again and\n // persists through the host settings scope, and theme/change keeps\n // this panel in sync with the native Settings → General stepper.\n try { props.client.theme.setFontSize(px) } catch { /* out-of-range guard already applied */ }\n }\n }}\n >\n {sizes.map(px => <option key={px} value={px}>{px}px</option>)}\n </select>\n <span className=\"dsh-ui-help\">{text.sizeHelp}</span>\n </label>\n <div className=\"dsh-ui-actions\">\n <Button variant=\"outline\" size=\"md\" disabled={fontList.state === 'loading'}\n onClick={() => { void loadSystemFonts() }}>\n {fontList.state === 'loading' ? text.loadingFonts : fontList.state === 'ready' ? text.reloadFonts : text.loadFonts}\n </Button>\n <Button variant=\"outline\" size=\"md\" onClick={() => {\n update({ uiFont: '', codeFont: '' })\n if (fontSize !== FONT_SIZE_DEFAULT) props.client.theme.setFontSize(FONT_SIZE_DEFAULT)\n }}>{text.reset}</Button>\n </div>\n {fontList.state === 'ready' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsLoaded(fontList.families.length)}</p> : null}\n {fontList.state === 'ready' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsPartial}</p> : null}\n {fontList.state === 'denied' ? <p role=\"status\" className=\"dsh-ui-hint\">{text.fontsDenied}</p> : null}\n </section>\n}\n\nexport function apply(ctx: Context): void {\n const client = ctx as unknown as Client & { effect: Context['effect'] }\n const store = createFontSettingsStore(readStorage())\n let applySettings = (_settings: FontSettings) => {}\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const style = document.createElement('style')\n style.setAttribute('data-plugin', PLUGIN_NAME)\n style.textContent = styles\n document.head.appendChild(style)\n return () => style.remove()\n }, 'font.styles')\n // rc.2 defines font stacks on :root; root inline overrides reach its derived\n // code, Markdown and terminal tokens without changing host theme settings.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const override = createFontSettingsOverride(document.documentElement.style)\n applySettings = next => override.apply(next)\n applySettings(store.load())\n return () => { override.dispose(); applySettings = () => {} }\n }, 'font.apply')\n ctx.effect(() => client.slots.inject('plugins.bundle.config', () => client.slots.register(\n { name: 'plugins.bundle.config', key: PLUGIN_NAME },\n (slotProps: { view?: 'summary' | 'page' }) =>\n <FontSettingsPanel client={client} store={store} applySettings={next => applySettings(next)} view={slotProps?.view} />,\n )), 'font.settings')\n}\n"],"mappings":";;;;AAuH6D,OAAO,OAAO;;CAlFzE,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;CACF;;CAEA,QAAQ;EAAC;EAAyB;EAAyB;EAAyB;CAAuB;;CAE3G,OAAO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ACjD,cACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;EAA2B;EAAe;EAAO,gBAAe,SAAQ,cAAc,IAAI;EAAG,MAAM,WAAW;CAAO,CAAA,CACzH,CAAC,GAAG,eAAe;AACrB"}
package/lib/client.js CHANGED
@@ -370,6 +370,29 @@ ${scope} {
370
370
  & .dsh-ui-select:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
371
371
  & .dsh-ui-select[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }
372
372
 
373
+ /* --- Native textarea. The primitives ship no textarea either, so a settings
374
+ * prompt keeps the platform element and the same field shell as the select:
375
+ * 0.5px l4, radius-md, layer-3, 13/1.5 type. It grows vertically instead of
376
+ * locking to the select's 34px row. --- */
377
+ & .dsh-ui-textarea {
378
+ box-sizing: border-box;
379
+ width: 100%;
380
+ min-width: 0;
381
+ resize: vertical;
382
+ padding: 8px 12px;
383
+ border: 0.5px solid var(--dsw-alias-border-l4);
384
+ border-radius: var(--dsw-radius-md);
385
+ background: var(--dsw-alias-bg-layer-3);
386
+ font: inherit;
387
+ font-size: 13px;
388
+ line-height: 1.5;
389
+ color: var(--dsw-alias-label-primary);
390
+ }
391
+ & .dsh-ui-textarea:focus-visible { outline: none; border-color: var(--dsw-alias-state-business-primary); }
392
+ & .dsh-ui-textarea:disabled { color: var(--dsw-alias-label-tertiary); cursor: default; }
393
+ & .dsh-ui-textarea::placeholder { color: var(--dsw-alias-label-dimmed); }
394
+ & .dsh-ui-textarea[aria-invalid='true'] { border-color: var(--dsw-alias-state-error-primary); }
395
+
373
396
  /* Long panels scroll inside themselves instead of growing the host page. */
374
397
  & .dsh-ui-panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
375
398
  & .dsh-ui-panel-wide { max-width: 100%; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klarkxy/dsh-font",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Font: customize the interface font, code font, and conversation font size of the DeepSeek Harness Web GUI.",
5
5
  "icon": "./icon.svg",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -57,7 +57,7 @@
57
57
  "test": "vitest run --root ../.. --config vitest.editor-plugins.config.ts --maxWorkers=2 plugins/dsh-font/src"
58
58
  },
59
59
  "dependencies": {
60
- "@klarkxy/dsh-plugin-kit": "0.3.2"
60
+ "@klarkxy/dsh-plugin-kit": "0.3.4"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@deepseek-ai/cordis": ">=4.0.4"
@@ -97,6 +97,6 @@
97
97
  },
98
98
  "homepage": "https://klarkxy.github.io/dsh-plugins/plugins/font/",
99
99
  "dshRelease": {
100
- "contentHash": "a234269ae4dfcbf8c1136ebb571912683af3e258489f654db141e6604fe02a3e"
100
+ "contentHash": "51ff2603dc94f4b459fdf55c07869cb82ea50fc38e3a56d8d599bcd2ddd1e740"
101
101
  }
102
102
  }