chore(clues): drop internal-only exports, dead helpers and orphan facades
43 client clue symbols had no consumer outside their module; they are now module-private. Removes the dead isClueSelectionServerAction, the scope-note alias, the unused ClueTabSettings shape, the Feishu/GitHub/detail re-export facades nothing imported, and the last orphan clue CSS rule.
This commit is contained in:
1 parent
594d75cd13
commit
30a73d38f5
17 files changed
+40
-88
No files matched your search
@@ -290,7 +290,7 @@ function StateChip(props: { readonly state: ClueResourceState; readonly dot: num
|
||||
// ── Components ─────────────────────────────────────────────────────────────
|
||||
|
||||
/** Props of {@link ResourceSummary}. */
|
||||
export interface ResourceSummaryProps {
|
||||
interface ResourceSummaryProps {
|
||||
/** The source-owned snapshot; absent/empty renders nothing but the action seat. */
|
||||
readonly info?: ClueResourceInfo
|
||||
/**
|
||||
@@ -383,7 +383,7 @@ export function ResourceSummary({ info, actions, className }: ResourceSummaryPro
|
||||
}
|
||||
|
||||
/** Props of {@link ResourceInlineMeta}. */
|
||||
export interface ResourceInlineMetaProps {
|
||||
interface ResourceInlineMetaProps {
|
||||
readonly info?: ClueResourceInfo
|
||||
readonly className?: string
|
||||
}
|
||||
|
||||
@@ -37,13 +37,6 @@
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
}
|
||||
|
||||
.destinationLabel {
|
||||
display: block;
|
||||
padding: 0 4px 4px;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
font: var(--dsw-font-xxxs-11);
|
||||
}
|
||||
|
||||
.destinations {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
@@ -51,23 +51,8 @@ export const CLUE_SELECTION_ACTIONS = [
|
||||
/** One menu entry. */
|
||||
export type ClueSelectionAction = (typeof CLUE_SELECTION_ACTIONS)[number]
|
||||
|
||||
/** The server-owned action names (insert is local-only). */
|
||||
export const CLUE_SELECTION_SERVER_ACTIONS = [
|
||||
'explain',
|
||||
'rewrite',
|
||||
'expand',
|
||||
'continue',
|
||||
'shorten',
|
||||
'translate',
|
||||
] as const
|
||||
|
||||
/** One server-owned selection action. */
|
||||
export type ClueSelectionServerAction = (typeof CLUE_SELECTION_SERVER_ACTIONS)[number]
|
||||
|
||||
/** Whether a value is a server-owned action. */
|
||||
export function isClueSelectionServerAction(value: unknown): value is ClueSelectionServerAction {
|
||||
return typeof value === 'string' && (CLUE_SELECTION_SERVER_ACTIONS as readonly string[]).includes(value)
|
||||
}
|
||||
/** One server-owned selection action (insert is local-only). */
|
||||
type ClueSelectionServerAction = Exclude<ClueSelectionAction, 'insert'>
|
||||
|
||||
/** The exact request payload of `clues.actions.start`. */
|
||||
export interface ClueSelectionActionRequest {
|
||||
@@ -93,7 +78,7 @@ export interface ClueSelectionActionScope {
|
||||
}
|
||||
|
||||
/** The transport seam (tests and integration may replace it). */
|
||||
export type ClueSelectionActionStarter = (request: ClueSelectionActionRequest) => Promise<unknown>
|
||||
type ClueSelectionActionStarter = (request: ClueSelectionActionRequest) => Promise<unknown>
|
||||
|
||||
/** Core and lazy editor bundles inline this module independently; only the page owns bridge state. */
|
||||
interface SelectionBridgeState {
|
||||
@@ -124,7 +109,7 @@ export function startClueSelectionAction(request: ClueSelectionActionRequest): P
|
||||
}
|
||||
|
||||
/** One insert decision: the parent appends the payload to its composer draft. */
|
||||
export interface ClueSelectionInsertInput {
|
||||
interface ClueSelectionInsertInput {
|
||||
/** Present when the wrapper/bridge knows the owning clue target. */
|
||||
readonly workspaceId?: string
|
||||
readonly sessionId?: string
|
||||
@@ -145,7 +130,7 @@ export type ClueSelectionInsertHandler = (input: ClueSelectionInsertInput) => bo
|
||||
* `ResourceSelectionActions` wrapper (the shared TextEditor uses the target
|
||||
* fields; a bare bridge supplies `onInsert` only).
|
||||
*/
|
||||
export interface ClueSelectionActionContext {
|
||||
interface ClueSelectionActionContext {
|
||||
readonly workspaceId?: string
|
||||
readonly sessionId?: string
|
||||
readonly resource?: ClueClientResourceInput
|
||||
@@ -229,7 +214,7 @@ export function useClueSelectionActionContext(): ClueSelectionActionContext | un
|
||||
}
|
||||
|
||||
/** Typed selection labels from the integrated locale dictionaries. */
|
||||
export const CLUE_SELECTION_LOCALE_KEYS = {
|
||||
const CLUE_SELECTION_LOCALE_KEYS = {
|
||||
menu: 'clueSelectionMenu',
|
||||
insert: 'clueSelectionInsert',
|
||||
explain: 'clueSelectionExplain',
|
||||
@@ -246,12 +231,12 @@ export const CLUE_SELECTION_LOCALE_KEYS = {
|
||||
|
||||
type SelectionLabelKey = keyof typeof CLUE_SELECTION_LOCALE_KEYS
|
||||
/** The localized label of one key, checked against the integrated dictionary. */
|
||||
export function clueSelectionLabel(key: SelectionLabelKey): string {
|
||||
function clueSelectionLabel(key: SelectionLabelKey): string {
|
||||
return t(CLUE_SELECTION_LOCALE_KEYS[key])
|
||||
}
|
||||
|
||||
/** The localized label of one menu action. */
|
||||
export function clueSelectionActionLabel(action: ClueSelectionAction): string {
|
||||
function clueSelectionActionLabel(action: ClueSelectionAction): string {
|
||||
return clueSelectionLabel(action)
|
||||
}
|
||||
|
||||
@@ -266,12 +251,12 @@ function requestResourceOf(resource: ClueClientResourceInput): ClueClientResourc
|
||||
}
|
||||
|
||||
/** The actions a surface offers; comments are intentionally narrower. */
|
||||
export function clueSelectionActionsFor(comment: boolean | undefined): readonly ClueSelectionAction[] {
|
||||
function clueSelectionActionsFor(comment: boolean | undefined): readonly ClueSelectionAction[] {
|
||||
return comment === true ? ['insert', 'explain'] : CLUE_SELECTION_ACTIONS
|
||||
}
|
||||
|
||||
/** One menu anchor (viewport coordinates, like `SelectionPopup`). */
|
||||
export interface SelectionActionMenuProps {
|
||||
interface SelectionActionMenuProps {
|
||||
readonly workspaceId: string
|
||||
readonly sessionId: string
|
||||
readonly resource: ClueClientResourceInput
|
||||
@@ -457,7 +442,7 @@ export function SelectionActionMenu(props: SelectionActionMenuProps): ReactNode
|
||||
}
|
||||
|
||||
/** Props of the wrapper surface. */
|
||||
export interface ResourceSelectionActionsProps {
|
||||
interface ResourceSelectionActionsProps {
|
||||
readonly workspaceId: string
|
||||
readonly sessionId: string
|
||||
readonly resource: ClueClientResourceInput
|
||||
|
||||
@@ -63,7 +63,7 @@ const PERMISSION_COPY: Readonly<Record<string, CopyKey>> = {
|
||||
}
|
||||
|
||||
/** Props of the configuration page (S6 window content). */
|
||||
export interface SourceConfigPageProps {
|
||||
interface SourceConfigPageProps {
|
||||
readonly sourceId: string
|
||||
readonly sourceName: string
|
||||
readonly dependencyIds: readonly string[]
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
import { createElement, useId, useMemo, useState, type ReactNode } from 'react'
|
||||
import type { ClueFormatRendererProps, JsonValue } from '../../../../clues/types.ts'
|
||||
import {
|
||||
DOCS_EDIT_SCOPE_NOTE,
|
||||
FEISHU_FORMATS,
|
||||
parseDocEditData,
|
||||
parseDocReadData,
|
||||
@@ -38,7 +37,7 @@ import { appDateTime } from './time.ts'
|
||||
const MAX_PREVIEW_CHARS = 40_000
|
||||
|
||||
/** Props of {@link FeishuDocsPreview}. */
|
||||
export interface FeishuDocsPreviewProps extends ClueFormatRendererProps {
|
||||
interface FeishuDocsPreviewProps extends ClueFormatRendererProps {
|
||||
readonly labels: FeishuClientLabels
|
||||
/** App-locale date/time formatter (S9 supplies it; fallback is the browser locale). */
|
||||
readonly formatDateTime?: (value: string) => string
|
||||
@@ -616,8 +615,5 @@ export function FeishuDocsPreview(props: FeishuDocsPreviewProps): ReactNode {
|
||||
)
|
||||
}
|
||||
|
||||
/** The host-visible scope note (exported for S9's settings copy). */
|
||||
export const FEISHU_DOCS_EDIT_SCOPE_NOTE = DOCS_EDIT_SCOPE_NOTE
|
||||
|
||||
/** The editable-block contract is exported for S9 renderer wiring/tests. */
|
||||
export type { FeishuDocEditBlock, FeishuDocEditData, FeishuDocReadData }
|
||||
@@ -275,8 +275,3 @@ export function registerFeishuSourceClient(
|
||||
currentFormats = new Map()
|
||||
}
|
||||
}
|
||||
|
||||
export { DEFAULT_FEISHU_LABELS, resolveFeishuLabels, type FeishuClientLabels } from './labels.ts'
|
||||
export { FeishuDocsPreview } from './docs-preview.tsx'
|
||||
export { FeishuTaskEditor } from './task-editor.tsx'
|
||||
export { FeishuDocsGlyph, FeishuTasksGlyph, feishuDocsIcon, feishuTasksIcon } from './icons.tsx'
|
||||
@@ -22,9 +22,6 @@ import type { BetterSidebarCluesClientFace } from '../../registry.ts'
|
||||
import { githubMarkdownRenderer } from './editor.tsx'
|
||||
import { GithubIssueIcon, GithubPullRequestIcon } from './icons.tsx'
|
||||
|
||||
export { githubMarkdownRenderer, isGithubSource } from './editor.tsx'
|
||||
export { GithubIssueIcon, GithubPullRequestIcon } from './icons.tsx'
|
||||
|
||||
/**
|
||||
* Register the GitHub source presentation and the title+body editor.
|
||||
* @param face - `ctx.betterSidebar.clues`.
|
||||
|
||||
@@ -43,22 +43,10 @@ import design from '../../ui/design.module.css'
|
||||
import css from './clues-tab.module.css'
|
||||
|
||||
/** The plugin-settings key of the clue tab (one sparse blob). */
|
||||
export const CLUE_TAB_SETTINGS_KEY = 'clues'
|
||||
const CLUE_TAB_SETTINGS_KEY = 'clues'
|
||||
|
||||
/** The subset of the tab component props the clue page consumes. */
|
||||
export type CluesTabProps = Pick<TabComponentProps, 'ctx' | 'store' | 'scope' | 'visible'>
|
||||
|
||||
/** The persisted clue-tab settings shape. */
|
||||
export interface ClueTabSettings {
|
||||
/** workspaceId -> sourceId -> persisted range value. */
|
||||
readonly scopes?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>
|
||||
/** Most recently inserted/opened pack ids (ordering only). */
|
||||
readonly recentPacks?: readonly string[]
|
||||
/** Expanded sidebar sections (VSCode-style explorer state). */
|
||||
readonly layout?: { readonly browse?: boolean; readonly packs?: boolean }
|
||||
/** Last chosen source, restored when the tab opens again. */
|
||||
readonly activeSource?: string
|
||||
}
|
||||
type CluesTabProps = Pick<TabComponentProps, 'ctx' | 'store' | 'scope' | 'visible'>
|
||||
|
||||
/** The persisted section state, with the explorer defaults applied. */
|
||||
function sectionLayoutOf(blob: Record<string, unknown>): { browse: boolean; packs: boolean } {
|
||||
|
||||
@@ -94,14 +94,14 @@ export function SourceNavigation(props: {
|
||||
|
||||
|
||||
/** Whether this source needs an explicitly chosen range before listing. */
|
||||
export function scopeRequired(sourceId: string): boolean {
|
||||
function scopeRequired(sourceId: string): boolean {
|
||||
return sourceId === BUILTIN_SOURCE_IDS.githubIssues
|
||||
|| sourceId === BUILTIN_SOURCE_IDS.githubPulls
|
||||
|| sourceId === BUILTIN_SOURCE_IDS.feishuDocs
|
||||
}
|
||||
|
||||
/** The `kind` of a persisted Feishu docs range, when it has one. */
|
||||
export function feishuRangeKind(scope: JsonValue | undefined): string | undefined {
|
||||
function feishuRangeKind(scope: JsonValue | undefined): string | undefined {
|
||||
if (scope === null || typeof scope !== 'object' || Array.isArray(scope)) return undefined
|
||||
const kind = (scope as Record<string, unknown>).kind
|
||||
return typeof kind === 'string' ? kind : undefined
|
||||
|
||||
@@ -83,16 +83,16 @@ import type { BetterSidebarWindowsClientFace } from '../../windows/types.ts'
|
||||
import css from './clues-tab.module.css'
|
||||
|
||||
/** The persisted range per source id (JSON value, absent = not chosen). */
|
||||
export type ClueScopes = Readonly<Record<string, JsonValue | undefined>>
|
||||
type ClueScopes = Readonly<Record<string, JsonValue | undefined>>
|
||||
|
||||
/** Imperative seam the tab uses to start a collection from a detail window. */
|
||||
export interface ClueBrowserController {
|
||||
interface ClueBrowserController {
|
||||
/** Add one resource to a pack through the SAME collection window/CAS flow. */
|
||||
addToPack(target: ClueDetailTarget): void
|
||||
}
|
||||
|
||||
/** Props of the browser. */
|
||||
export interface ClueBrowserProps {
|
||||
interface ClueBrowserProps {
|
||||
readonly workspaceId: string
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
|
||||
@@ -89,13 +89,13 @@ export function clearClueCollectionDrafts(): void {
|
||||
}
|
||||
|
||||
/** The mutable close guard the hosted window reads. */
|
||||
export interface ClueCollectGuard {
|
||||
interface ClueCollectGuard {
|
||||
busy: boolean
|
||||
handle?: WindowHandle
|
||||
}
|
||||
|
||||
/** Options of {@link openClueCollectionWindow}. */
|
||||
export interface OpenClueCollectionWindowOptions {
|
||||
interface OpenClueCollectionWindowOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
readonly workspaceId: string
|
||||
@@ -113,7 +113,7 @@ export interface OpenClueCollectionWindowOptions {
|
||||
}
|
||||
|
||||
/** Options of {@link openClueCollectionForTarget}. */
|
||||
export interface OpenClueCollectionForTargetOptions {
|
||||
interface OpenClueCollectionForTargetOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
readonly workspaceId: string
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ResourceDiscussionProps {
|
||||
onCreate(body: string, replyToId: string | undefined, requestId: string): Promise<void>
|
||||
}
|
||||
|
||||
export function reviewStateLabel(state: string): string {
|
||||
function reviewStateLabel(state: string): string {
|
||||
switch (state.toUpperCase()) {
|
||||
case 'APPROVED': return copy('clueReviewApproved')
|
||||
case 'CHANGES_REQUESTED': return copy('clueReviewChangesRequested')
|
||||
|
||||
@@ -36,13 +36,13 @@ export function createPackWindowId(workspaceId: string): string {
|
||||
* latch (state alone is one render behind a double click); `handle` is wired
|
||||
* after `open()` returns so the page can close its own window.
|
||||
*/
|
||||
export interface CreatePackGuard {
|
||||
interface CreatePackGuard {
|
||||
busy: boolean
|
||||
handle?: WindowHandle
|
||||
}
|
||||
|
||||
/** Options of {@link openCreatePackWindow}. */
|
||||
export interface OpenCreatePackWindowOptions {
|
||||
interface OpenCreatePackWindowOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
readonly workspaceId: string
|
||||
@@ -86,7 +86,7 @@ export function openCreatePackWindow(options: OpenCreatePackWindowOptions): Wind
|
||||
}
|
||||
|
||||
/** The interactive create-pack surface. */
|
||||
export function CreatePackPage(props: OpenCreatePackWindowOptions & { readonly guard: CreatePackGuard }): ReactNode {
|
||||
function CreatePackPage(props: OpenCreatePackWindowOptions & { readonly guard: CreatePackGuard }): ReactNode {
|
||||
const { face, workspaceId, guard, onCreated, onNotice } = props
|
||||
const inputRef = useRef<HTMLInputElement | null>(null)
|
||||
const [draft, setDraft] = useState('')
|
||||
|
||||
@@ -137,7 +137,7 @@ export interface ClueDetailTarget {
|
||||
}
|
||||
|
||||
/** Options of {@link openClueDetailWindow}. */
|
||||
export interface ClueDetailWindowOptions {
|
||||
interface ClueDetailWindowOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
readonly workspaceId: string
|
||||
@@ -229,7 +229,7 @@ function httpUrlOf(value: unknown): string | undefined {
|
||||
* A source-body URL (Feishu docs `sourceUrl`, task `url`) for locators that
|
||||
* do not carry one. It only feeds the credential-free "open source" link.
|
||||
*/
|
||||
export function sourceUrlFromData(data: JsonValue | undefined): string | undefined {
|
||||
function sourceUrlFromData(data: JsonValue | undefined): string | undefined {
|
||||
if (data === null || typeof data !== 'object' || Array.isArray(data)) return undefined
|
||||
const record = data as Record<string, unknown>
|
||||
return httpUrlOf(record.sourceUrl) ?? httpUrlOf(record.url)
|
||||
@@ -241,14 +241,14 @@ export function sourceUrlFromData(data: JsonValue | undefined): string | undefin
|
||||
* a direct-URL target like `owner/repo#42` must adopt the real title once the
|
||||
* source returns it. Empty/absent values never erase the current title.
|
||||
*/
|
||||
export function sourceTitleOf(data: JsonValue | undefined): string | undefined {
|
||||
function sourceTitleOf(data: JsonValue | undefined): string | undefined {
|
||||
if (data === null || typeof data !== 'object' || Array.isArray(data)) return undefined
|
||||
const title = (data as Record<string, unknown>).title
|
||||
return typeof title === 'string' && title.trim() !== '' ? title.trim() : undefined
|
||||
}
|
||||
|
||||
/** The localized explanation of a source-owned read-only marker. */
|
||||
export function readOnlyReasonCopy(reason: string | undefined): string {
|
||||
function readOnlyReasonCopy(reason: string | undefined): string {
|
||||
switch (reason) {
|
||||
case 'archived':
|
||||
return t('clueDetailReadOnlyArchived')
|
||||
@@ -1653,5 +1653,3 @@ export function openClueDetailWindow(options: ClueDetailWindowOptions): WindowHa
|
||||
controller.attach(handle, guard)
|
||||
return handle
|
||||
}
|
||||
|
||||
export { ResourceInlineMeta, ResourceSummary } from '../resource-summary.tsx'
|
||||
@@ -83,7 +83,7 @@ import type { ClueDetailTarget } from './detail.tsx'
|
||||
import css from './pack.module.css'
|
||||
|
||||
/** The workspace the pack belongs to (display only; never used to guess). */
|
||||
export interface PackWorkspaceChoice {
|
||||
interface PackWorkspaceChoice {
|
||||
readonly workspaceId: string
|
||||
readonly title: string
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export interface PackDraftGuard {
|
||||
}
|
||||
|
||||
/** Options of {@link openPackManagementWindow}. */
|
||||
export interface PackManagementOptions {
|
||||
interface PackManagementOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly workspaceId: string
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
@@ -187,7 +187,7 @@ function memberRowsOf(pack: CluePack, clues: readonly Clue[]): MemberRow[] {
|
||||
}
|
||||
|
||||
/** The window id of one pack (a second open focuses the same surface). */
|
||||
export function packWindowId(packId: string): string {
|
||||
function packWindowId(packId: string): string {
|
||||
return `pack:${packId}`
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ import { openClueSettings, type ClueSettingsGroup } from '../settings/navigation
|
||||
import { t } from '../../locales.ts'
|
||||
|
||||
/** The settings window id (one instance; a second open focuses it). */
|
||||
export const CLUE_SETTINGS_WINDOW_ID = 'clue-settings'
|
||||
const CLUE_SETTINGS_WINDOW_ID = 'clue-settings'
|
||||
|
||||
/** Options of {@link openClueSettingsWindow}. */
|
||||
export interface OpenClueSettingsWindowOptions {
|
||||
interface OpenClueSettingsWindowOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly store: SidebarStore
|
||||
readonly service: BetterSidebarService
|
||||
|
||||
@@ -44,10 +44,10 @@ import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx'
|
||||
import css from './share.module.css'
|
||||
|
||||
/** The share window id (one instance per plugin; opening again focuses it). */
|
||||
export const CLUE_SHARE_WINDOW_ID = 'clue-share'
|
||||
const CLUE_SHARE_WINDOW_ID = 'clue-share'
|
||||
|
||||
/** Options of {@link openShareWindow}. */
|
||||
export interface OpenShareWindowOptions {
|
||||
interface OpenShareWindowOptions {
|
||||
readonly windows: BetterSidebarWindowsClientFace
|
||||
readonly workspaceId: string
|
||||
readonly face: BetterSidebarCluesClientFace
|
||||
|
||||
Reference in new issue
Block a user