@widgetic/design-system 0.5.40 → 0.5.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/components/ContentRefreshOverlay.svelte +103 -0
- package/dist/components/ContentRefreshOverlay.svelte.d.ts +18 -0
- package/dist/components/EmptyState.svelte +6 -2
- package/dist/components/chat/Composer.svelte +380 -19
- package/dist/components/chat/Composer.svelte.d.ts +88 -1
- package/dist/components/chat/PlanCard.svelte +218 -88
- package/dist/components/chat/PlanCard.svelte.d.ts +11 -0
- package/dist/components/chat/QuestionCard.svelte +180 -70
- package/dist/components/chat/QuestionCard.svelte.d.ts +28 -2
- package/dist/components/chat/QuestionCardSummary.svelte +96 -0
- package/dist/components/chat/QuestionCardSummary.svelte.d.ts +20 -0
- package/dist/components/chat/QueueCard.svelte +185 -0
- package/dist/components/chat/QueueCard.svelte.d.ts +40 -0
- package/dist/components/chat/composerLogic.d.ts +31 -0
- package/dist/components/chat/composerLogic.js +37 -0
- package/dist/components/chat/composerReferences.d.ts +28 -0
- package/dist/components/chat/composerReferences.js +23 -0
- package/dist/components/chat/index.d.ts +8 -3
- package/dist/components/chat/index.js +10 -2
- package/dist/components/chat/questionCardLogic.d.ts +40 -3
- package/dist/components/chat/questionCardLogic.js +54 -3
- package/dist/components/chat/queueCardLogic.d.ts +7 -0
- package/dist/components/chat/queueCardLogic.js +5 -0
- package/dist/components/creator/CreatorBar.svelte +54 -1
- package/dist/components/creator/CreatorBar.svelte.d.ts +5 -0
- package/dist/components/creator/index.d.ts +1 -2
- package/dist/components/creator/index.js +2 -0
- package/dist/components/index.d.ts +8 -7
- package/dist/components/index.js +8 -6
- package/dist/components/modals/BaseModal.svelte +23 -4
- package/dist/components/modals/BaseModal.svelte.d.ts +5 -0
- package/dist/components/navigation/breadcrumbSlideIn.d.ts +6 -2
- package/dist/components/navigation/breadcrumbSlideIn.js +6 -6
- package/dist/components/search-input/SearchInput.svelte +317 -14
- package/dist/components/search-input/SearchInput.svelte.d.ts +3 -0
- package/dist/components/search-input/index.d.ts +1 -0
- package/dist/components/search-input/index.js +1 -0
- package/dist/components/search-input/index2.d.ts +4 -0
- package/dist/components/search-input/recentSearches.d.ts +16 -0
- package/dist/components/search-input/recentSearches.js +141 -0
- package/dist/components/shell/NavRow.svelte +53 -10
- package/dist/components/shell/NavRow.svelte.d.ts +23 -2
- package/dist/components/shell/NotificationRow.svelte +3 -2
- package/dist/components/shell/ProfileRow.svelte +6 -4
- package/dist/components/shell/ProfileRow.svelte.d.ts +2 -2
- package/dist/components/shell/SettingsDialog.svelte +23 -1
- package/dist/components/shell/WidgetRow.svelte +4 -3
- package/dist/components/shell/WidgetRow.svelte.d.ts +2 -2
- package/dist/components/toast/ToasterModal.svelte +8 -3
- package/dist/components/toast/ToasterModal.svelte.d.ts +2 -0
- package/dist/components/ui/accordion/accordion-trigger.svelte +19 -0
- package/dist/components/ui/button/button.svelte +4 -2
- package/dist/components/ui/chip/chip.svelte +39 -1
- package/dist/components/ui/chip/chip.svelte.d.ts +8 -0
- package/dist/components/ui/chip/chipProgress.d.ts +14 -0
- package/dist/components/ui/chip/chipProgress.js +21 -0
- package/dist/components/ui/dialog/dialog-content.svelte +24 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +2 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +2 -1
- package/dist/components/ui/hover-card/hover-card-content.svelte +2 -1
- package/dist/components/ui/icon-button/icon-button.svelte +2 -0
- package/dist/components/ui/icon-button/icon-button.svelte.d.ts +5 -0
- package/dist/components/ui/number-controls/index.d.ts +2 -0
- package/dist/components/ui/number-controls/index.js +2 -0
- package/dist/components/ui/number-controls/number-controls.svelte +530 -0
- package/dist/components/ui/number-controls/number-controls.svelte.d.ts +46 -0
- package/dist/components/ui/number-controls/numberControlsSteps.d.ts +17 -0
- package/dist/components/ui/number-controls/numberControlsSteps.js +23 -0
- package/dist/components/ui/number-controls/numberControlsValueArea.d.ts +29 -0
- package/dist/components/ui/number-controls/numberControlsValueArea.js +51 -0
- package/dist/components/ui/popover/popover-content.svelte +2 -1
- package/dist/components/ui/select/select-content.svelte +2 -1
- package/dist/components/ui/text-flip/index.d.ts +1 -0
- package/dist/components/ui/text-flip/index.js +1 -0
- package/dist/components/ui/text-flip/text-flip.svelte +103 -0
- package/dist/components/ui/text-flip/text-flip.svelte.d.ts +15 -0
- package/dist/components/ui/text-flip/textFlipLogic.d.ts +49 -0
- package/dist/components/ui/text-flip/textFlipLogic.js +151 -0
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/inline-completion/completionAnswer.d.ts +11 -0
- package/dist/inline-completion/completionAnswer.js +49 -0
- package/dist/inline-completion/completionCache.d.ts +24 -0
- package/dist/inline-completion/completionCache.js +47 -0
- package/dist/inline-completion/completionController.d.ts +61 -0
- package/dist/inline-completion/completionController.js +280 -0
- package/dist/inline-completion/completionKeys.d.ts +21 -0
- package/dist/inline-completion/completionKeys.js +19 -0
- package/dist/inline-completion/completionText.d.ts +53 -0
- package/dist/inline-completion/completionText.js +79 -0
- package/dist/inline-completion/completionTypes.d.ts +71 -0
- package/dist/inline-completion/completionTypes.js +5 -0
- package/dist/inline-completion/gatewayCompletion.d.ts +37 -0
- package/dist/inline-completion/gatewayCompletion.js +77 -0
- package/dist/inline-completion/ghostTap.d.ts +19 -0
- package/dist/inline-completion/ghostTap.js +20 -0
- package/dist/inline-completion/hintMemory.d.ts +43 -0
- package/dist/inline-completion/hintMemory.js +90 -0
- package/dist/inline-completion/httpSource.d.ts +40 -0
- package/dist/inline-completion/httpSource.js +149 -0
- package/dist/inline-completion/index.d.ts +30 -0
- package/dist/inline-completion/index.js +20 -0
- package/dist/inline-completion/inlineCompletionAction.d.ts +54 -0
- package/dist/inline-completion/inlineCompletionAction.js +310 -0
- package/dist/inline-completion/outcomeReporter.d.ts +49 -0
- package/dist/inline-completion/outcomeReporter.js +139 -0
- package/dist/inline-completion/promiseLike.d.ts +9 -0
- package/dist/inline-completion/promiseLike.js +9 -0
- package/dist/prompt-references/ReferenceMenu.svelte +344 -0
- package/dist/prompt-references/ReferenceMenu.svelte.d.ts +26 -0
- package/dist/prompt-references/index.d.ts +27 -0
- package/dist/prompt-references/index.js +20 -0
- package/dist/prompt-references/neutralizingSource.d.ts +21 -0
- package/dist/prompt-references/neutralizingSource.js +29 -0
- package/dist/prompt-references/promptReferences.d.ts +28 -0
- package/dist/prompt-references/promptReferences.js +766 -0
- package/dist/prompt-references/referenceBadge.d.ts +61 -0
- package/dist/prompt-references/referenceBadge.js +82 -0
- package/dist/prompt-references/referenceBadgePainter.d.ts +31 -0
- package/dist/prompt-references/referenceBadgePainter.js +106 -0
- package/dist/prompt-references/referenceEditing.d.ts +60 -0
- package/dist/prompt-references/referenceEditing.js +135 -0
- package/dist/prompt-references/referenceLabels.d.ts +56 -0
- package/dist/prompt-references/referenceLabels.js +215 -0
- package/dist/prompt-references/referenceMeasure.d.ts +12 -0
- package/dist/prompt-references/referenceMeasure.js +63 -0
- package/dist/prompt-references/referenceMenuHost.svelte.d.ts +29 -0
- package/dist/prompt-references/referenceMenuHost.svelte.js +43 -0
- package/dist/prompt-references/referenceMenuKeys.d.ts +26 -0
- package/dist/prompt-references/referenceMenuKeys.js +49 -0
- package/dist/prompt-references/referenceMenuPlacement.d.ts +63 -0
- package/dist/prompt-references/referenceMenuPlacement.js +66 -0
- package/dist/prompt-references/referenceTokens.d.ts +175 -0
- package/dist/prompt-references/referenceTokens.js +332 -0
- package/dist/prompt-references/referenceTrigger.d.ts +52 -0
- package/dist/prompt-references/referenceTrigger.js +100 -0
- package/dist/prompt-references/referenceTypes.d.ts +38 -0
- package/dist/prompt-references/referenceTypes.js +4 -0
- package/dist/prompt-references/sentReferences.d.ts +50 -0
- package/dist/prompt-references/sentReferences.js +122 -0
- package/dist/styles/tokens.css +126 -1
- package/dist/textarea-overlay/index.d.ts +9 -0
- package/dist/textarea-overlay/index.js +7 -0
- package/dist/textarea-overlay/mirrorSegments.d.ts +31 -0
- package/dist/textarea-overlay/mirrorSegments.js +47 -0
- package/dist/textarea-overlay/mirrorSizing.d.ts +39 -0
- package/dist/textarea-overlay/mirrorSizing.js +40 -0
- package/dist/textarea-overlay/textareaOverlay.d.ts +25 -0
- package/dist/textarea-overlay/textareaOverlay.js +277 -0
- package/dist/utils/modalEnterKey.d.ts +139 -0
- package/dist/utils/modalEnterKey.js +276 -0
- package/dist/utils/modalFocusTrap.d.ts +7 -0
- package/dist/utils/modalFocusTrap.js +22 -0
- package/dist/utils/overlayMotion.d.ts +10 -0
- package/dist/utils/overlayMotion.js +12 -3
- package/dist/utils/reducedMotion.d.ts +9 -0
- package/dist/utils/reducedMotion.js +13 -0
- package/dist/utils/revealOpeningSection.d.ts +51 -0
- package/dist/utils/revealOpeningSection.js +109 -0
- package/package.json +16 -1
- package/dist/components/ui/number-stepper/index.d.ts +0 -3
- package/dist/components/ui/number-stepper/index.js +0 -3
- package/dist/components/ui/number-stepper/number-stepper.svelte +0 -212
- package/dist/components/ui/number-stepper/number-stepper.svelte.d.ts +0 -24
- package/dist/components/ui/number-stepper/numberStepperSteps.d.ts +0 -26
- package/dist/components/ui/number-stepper/numberStepperSteps.js +0 -45
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes the prompt-references action and its menu share. Types only: nothing here runs.
|
|
3
|
+
*/
|
|
4
|
+
/** A file a person may refer to: what the menu lists and what a badge shows. */
|
|
5
|
+
export interface ReferenceItem {
|
|
6
|
+
/** What the host knows the file by (the gateway's upload id, or the tray's own id). Echoed back in `references`. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The word typed after `#`, without the `#`: one to 24 letters, digits and underscores (see `assignReferenceLabel`). */
|
|
9
|
+
label: string;
|
|
10
|
+
/** The file's number in the tray, counted from 1: `#2` offers the second file. */
|
|
11
|
+
number: number;
|
|
12
|
+
/** The file's own name, shown beside the label. */
|
|
13
|
+
fileName: string;
|
|
14
|
+
/** An address of a picture of the file (an object URL, a data URL, a link). Without one the badge shows a file icon. */
|
|
15
|
+
previewUrl?: string | null;
|
|
16
|
+
/** The size, already written for people ("1.2 MB"). */
|
|
17
|
+
sizeLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
/** The words the action shows or speaks. The host passes them from its own messages, so the design system holds no English. */
|
|
20
|
+
export interface ReferenceMessages {
|
|
21
|
+
/** The name a screen reader hears for the list of files ("Attached files"). */
|
|
22
|
+
menuLabel: string;
|
|
23
|
+
/** What the X of a badge is called, with `{name}` for the file's name ("Remove {name}"). */
|
|
24
|
+
remove: string;
|
|
25
|
+
}
|
|
26
|
+
/** What the action tells a host about a badge or a menu row the pointer or the focus is on, for the tray to show the same file. */
|
|
27
|
+
export interface ReferenceHoverEvent {
|
|
28
|
+
/** The label of the file, or null when nothing is hovered any more. */
|
|
29
|
+
label: string | null;
|
|
30
|
+
/** Which part of the interface it came from. */
|
|
31
|
+
source: 'menu' | 'badge';
|
|
32
|
+
}
|
|
33
|
+
/** The menu as the host may want to know about it (the DS Composer clears its ghost text while it is open). */
|
|
34
|
+
export interface ReferenceMenuStatus {
|
|
35
|
+
open: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A debug line for one transition (menu opened or closed, badge inserted or removed, chrome dropped): once per event. */
|
|
38
|
+
export type PromptReferencesLogger = (message: string, detail?: unknown) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type TokenReadingOptions } from './referenceTokens.ts';
|
|
2
|
+
/** A file attached to a sent message, as far as its words are concerned. */
|
|
3
|
+
export interface SentAttachment {
|
|
4
|
+
/** The name the file is stored under (`hero-banner.png`). */
|
|
5
|
+
fileName?: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* The label the file was called by when the message was written, when the page kept it. Used as it is: nothing is worked out for a
|
|
8
|
+
* file that has one.
|
|
9
|
+
*/
|
|
10
|
+
label?: string | null;
|
|
11
|
+
/** Whether a badge may stand for this file. A picture has a thumbnail to show; a file with none can leave its words plain. Default true. */
|
|
12
|
+
badge?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** A run of the message that is only text. */
|
|
15
|
+
export interface SentTextSegment {
|
|
16
|
+
kind: 'text';
|
|
17
|
+
text: string;
|
|
18
|
+
}
|
|
19
|
+
/** A `#word` that names one of the message's files. */
|
|
20
|
+
export interface SentBadgeSegment {
|
|
21
|
+
kind: 'badge';
|
|
22
|
+
/** The word as it was written, trigger character included (`#Hero_Banner`): what the badge says, so the text is never changed. */
|
|
23
|
+
word: string;
|
|
24
|
+
/** The label of the file it names (`hero_banner`). */
|
|
25
|
+
label: string;
|
|
26
|
+
/** The place of that file among the message's attachments. */
|
|
27
|
+
attachmentIndex: number;
|
|
28
|
+
}
|
|
29
|
+
export type SentSegment = SentTextSegment | SentBadgeSegment;
|
|
30
|
+
export interface SegmentSentTextOptions extends TokenReadingOptions {
|
|
31
|
+
/**
|
|
32
|
+
* The most badges one message shows; the words after them stay plain. A bound on the work a message can ask for, far above what a
|
|
33
|
+
* message with five or twenty files names. Default 40.
|
|
34
|
+
*/
|
|
35
|
+
maxBadges?: number;
|
|
36
|
+
}
|
|
37
|
+
/** The most badges a message shows when the page does not say. */
|
|
38
|
+
export declare const DEFAULT_MAX_SENT_BADGES = 40;
|
|
39
|
+
/**
|
|
40
|
+
* The label each attachment is called by in the text of its message, in the attachments' order: the label the page kept, or the one
|
|
41
|
+
* its name gives, or null where there is none to be sure of (see the top of this file).
|
|
42
|
+
*/
|
|
43
|
+
export declare function labelsOfSentAttachments(attachments: readonly SentAttachment[]): (string | null)[];
|
|
44
|
+
/**
|
|
45
|
+
* The text of a sent message cut into plain runs and badges, in order, so that joining the `text` of the runs and the `word` of the
|
|
46
|
+
* badges gives the message again. A message with no badge comes back as one text run (and an empty text as none).
|
|
47
|
+
*/
|
|
48
|
+
export declare function segmentSentText(text: string, attachments: readonly SentAttachment[], options?: SegmentSentTextOptions): SentSegment[];
|
|
49
|
+
/** Whether the segments hold at least one badge (the message needs more than plain text to be drawn). */
|
|
50
|
+
export declare function hasSentBadges(segments: readonly SentSegment[]): boolean;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files a SENT message names: which `#word`s of its text stand for which of the files attached to it, so the message can show
|
|
3
|
+
* the same badge (thumbnail and name, no X) the box showed while it was written. Pure functions, no DOM.
|
|
4
|
+
*
|
|
5
|
+
* A sent message keeps no record of the labels its files were called by: the text has `#hero_banner`, and the message has a file
|
|
6
|
+
* called `hero-banner.png`. So the label is worked out again from the file's name, by the rule that gave it in the first place
|
|
7
|
+
* (`labelFromFileName`), and a word is a badge only when it spells that label. A page that did keep the labels (a message sent in
|
|
8
|
+
* this session) passes them and gets exactly the badges that were made.
|
|
9
|
+
*
|
|
10
|
+
* The rule is cautious on purpose: a wrong thumbnail is worse than none. Whatever cannot be told for sure stays plain text, which
|
|
11
|
+
* is what the message said in the first place:
|
|
12
|
+
* - A name that says nothing (`image.png`, `Screenshot 2026-…`) has no label to work out, so `#Image_2` stays plain.
|
|
13
|
+
* - Files whose names are the same (`hero.png` twice) were told apart by `_2`, `_3` in the order they were attached, and a saved
|
|
14
|
+
* message does not keep that order for sure: those files, and any `_<number>` label next to them, stay plain.
|
|
15
|
+
* - A word that names no attached file stays plain, as does a word that is only part of a longer one (`#hero_banner_x`).
|
|
16
|
+
*/
|
|
17
|
+
import { isValidReferenceLabel, labelFromFileName } from "./referenceLabels.js";
|
|
18
|
+
import { findReferenceWords } from "./referenceTokens.js";
|
|
19
|
+
/** The most badges a message shows when the page does not say. */
|
|
20
|
+
export const DEFAULT_MAX_SENT_BADGES = 40;
|
|
21
|
+
/** A label that ends in `_<number>`, the way a second file of the same name is told from the first. */
|
|
22
|
+
const NUMBERED_LABEL = /_\d+$/u;
|
|
23
|
+
/**
|
|
24
|
+
* The label each attachment is called by in the text of its message, in the attachments' order: the label the page kept, or the one
|
|
25
|
+
* its name gives, or null where there is none to be sure of (see the top of this file).
|
|
26
|
+
*/
|
|
27
|
+
export function labelsOfSentAttachments(attachments) {
|
|
28
|
+
const keptLabels = attachments.map((attachment) => {
|
|
29
|
+
const label = attachment.label;
|
|
30
|
+
return typeof label === 'string' && isValidReferenceLabel(label) ? label : null;
|
|
31
|
+
});
|
|
32
|
+
const namedLabels = attachments.map((attachment, index) => {
|
|
33
|
+
if (keptLabels[index] !== null)
|
|
34
|
+
return null;
|
|
35
|
+
const label = labelFromFileName(attachment.fileName ?? '');
|
|
36
|
+
return label === '' ? null : label;
|
|
37
|
+
});
|
|
38
|
+
// Which names are worked out for more than one file, and which labels the page kept (a worked-out label equal to one of those
|
|
39
|
+
// would be a second file with that label).
|
|
40
|
+
const countsOfNames = new Map();
|
|
41
|
+
for (const label of namedLabels) {
|
|
42
|
+
if (label === null)
|
|
43
|
+
continue;
|
|
44
|
+
const key = label.toLowerCase();
|
|
45
|
+
countsOfNames.set(key, (countsOfNames.get(key) ?? 0) + 1);
|
|
46
|
+
}
|
|
47
|
+
const keptKeys = new Set(keptLabels
|
|
48
|
+
.filter((label) => label !== null)
|
|
49
|
+
.map((label) => label.toLowerCase()));
|
|
50
|
+
const hasSharedNames = [...countsOfNames.values()].some((count) => count > 1);
|
|
51
|
+
const taken = new Set();
|
|
52
|
+
return attachments.map((attachment, index) => {
|
|
53
|
+
if (attachment.badge === false)
|
|
54
|
+
return null;
|
|
55
|
+
const kept = keptLabels[index];
|
|
56
|
+
const worked = namedLabels[index];
|
|
57
|
+
const label = kept ?? worked;
|
|
58
|
+
if (label === null)
|
|
59
|
+
return null;
|
|
60
|
+
const key = label.toLowerCase();
|
|
61
|
+
if (kept === null) {
|
|
62
|
+
if ((countsOfNames.get(key) ?? 0) > 1)
|
|
63
|
+
return null;
|
|
64
|
+
if (keptKeys.has(key))
|
|
65
|
+
return null;
|
|
66
|
+
if (hasSharedNames && NUMBERED_LABEL.test(label))
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
// Two files with one label cannot happen when labels are given as they are made; if they do, the first is the one the word means.
|
|
70
|
+
if (taken.has(key))
|
|
71
|
+
return null;
|
|
72
|
+
taken.add(key);
|
|
73
|
+
return label;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The text of a sent message cut into plain runs and badges, in order, so that joining the `text` of the runs and the `word` of the
|
|
78
|
+
* badges gives the message again. A message with no badge comes back as one text run (and an empty text as none).
|
|
79
|
+
*/
|
|
80
|
+
export function segmentSentText(text, attachments, options = {}) {
|
|
81
|
+
if (text === '')
|
|
82
|
+
return [];
|
|
83
|
+
const labels = labelsOfSentAttachments(attachments);
|
|
84
|
+
const indexByLabel = new Map();
|
|
85
|
+
labels.forEach((label, index) => {
|
|
86
|
+
if (label !== null)
|
|
87
|
+
indexByLabel.set(label.toLowerCase(), index);
|
|
88
|
+
});
|
|
89
|
+
if (indexByLabel.size === 0)
|
|
90
|
+
return [{ kind: 'text', text }];
|
|
91
|
+
const maxBadges = Math.max(0, Math.floor(options.maxBadges ?? DEFAULT_MAX_SENT_BADGES));
|
|
92
|
+
const segments = [];
|
|
93
|
+
let cursor = 0;
|
|
94
|
+
let badgeCount = 0;
|
|
95
|
+
for (const word of findReferenceWords(text, options)) {
|
|
96
|
+
if (badgeCount >= maxBadges)
|
|
97
|
+
break;
|
|
98
|
+
const attachmentIndex = indexByLabel.get(word.label.toLowerCase());
|
|
99
|
+
if (attachmentIndex === undefined)
|
|
100
|
+
continue;
|
|
101
|
+
if (word.triggerIndex > cursor) {
|
|
102
|
+
segments.push({ kind: 'text', text: text.slice(cursor, word.triggerIndex) });
|
|
103
|
+
}
|
|
104
|
+
segments.push({
|
|
105
|
+
kind: 'badge',
|
|
106
|
+
word: text.slice(word.triggerIndex, word.labelEnd),
|
|
107
|
+
label: labels[attachmentIndex],
|
|
108
|
+
attachmentIndex
|
|
109
|
+
});
|
|
110
|
+
cursor = word.labelEnd;
|
|
111
|
+
badgeCount += 1;
|
|
112
|
+
}
|
|
113
|
+
if (badgeCount === 0)
|
|
114
|
+
return [{ kind: 'text', text }];
|
|
115
|
+
if (cursor < text.length)
|
|
116
|
+
segments.push({ kind: 'text', text: text.slice(cursor) });
|
|
117
|
+
return segments;
|
|
118
|
+
}
|
|
119
|
+
/** Whether the segments hold at least one badge (the message needs more than plain text to be drawn). */
|
|
120
|
+
export function hasSentBadges(segments) {
|
|
121
|
+
return segments.some((segment) => segment.kind === 'badge');
|
|
122
|
+
}
|
package/dist/styles/tokens.css
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
--color-light-green: #e3f0db;
|
|
19
19
|
/*
|
|
20
20
|
* Success toast pill (round 5): the green of the reference toast, one step darker so that white 14px/500 text keeps 4.5:1 (4.54:1).
|
|
21
|
-
* Used by the toast only
|
|
21
|
+
* Used by the toast only. It is the Figma primitive status/toast-green (added to the Primitives collection on 18 Nov 2026, so
|
|
22
|
+
* that the Foundations list and the library hold every colour of this file); a second use asks for a semantic token first.
|
|
22
23
|
*/
|
|
23
24
|
--color-toast-green: #008932;
|
|
24
25
|
|
|
@@ -71,6 +72,8 @@
|
|
|
71
72
|
--brand-subtle: var(--color-light-green);
|
|
72
73
|
--border: var(--color-neutral-200);
|
|
73
74
|
--border-strong: var(--color-alpha-dark-30);
|
|
75
|
+
/* The quiet line (Figma border/subtle, 18 Nov 2026): neutral/100, for the divider between the header of a panel and its body, where `--border` is too loud. */
|
|
76
|
+
--border-subtle: var(--color-neutral-100);
|
|
74
77
|
--input: var(--color-neutral-200);
|
|
75
78
|
--ring: var(--color-deep-forest-green);
|
|
76
79
|
--sidebar: var(--color-neutral-100);
|
|
@@ -123,6 +126,9 @@
|
|
|
123
126
|
--duration-base: 160ms;
|
|
124
127
|
--duration-slow: 250ms;
|
|
125
128
|
--duration-enter: 500ms;
|
|
129
|
+
/* A floating surface (dropdown, sub-menu, popover, select list, hover card) opening from its trigger: see `floating-motion` */
|
|
130
|
+
--duration-floating: 150ms;
|
|
131
|
+
--floating-slide: 8px;
|
|
126
132
|
--stagger-item: 50ms;
|
|
127
133
|
--ease-standard: ease;
|
|
128
134
|
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
@@ -170,6 +176,7 @@
|
|
|
170
176
|
--brand-subtle: var(--color-alpha-sage-15);
|
|
171
177
|
--border: var(--color-alpha-sage-25);
|
|
172
178
|
--border-strong: var(--color-alpha-light-30);
|
|
179
|
+
--border-subtle: var(--color-alpha-light-10);
|
|
173
180
|
--input: var(--color-alpha-sage-25);
|
|
174
181
|
--ring: var(--color-sage-green);
|
|
175
182
|
--sidebar: var(--color-dark);
|
|
@@ -213,6 +220,7 @@
|
|
|
213
220
|
--color-brand-subtle: var(--brand-subtle);
|
|
214
221
|
--color-border: var(--border);
|
|
215
222
|
--color-border-strong: var(--border-strong);
|
|
223
|
+
--color-border-subtle: var(--border-subtle);
|
|
216
224
|
--color-input: var(--input);
|
|
217
225
|
--color-ring: var(--ring);
|
|
218
226
|
--color-sidebar: var(--sidebar);
|
|
@@ -341,6 +349,123 @@
|
|
|
341
349
|
}
|
|
342
350
|
}
|
|
343
351
|
|
|
352
|
+
/*
|
|
353
|
+
* The motion of a floating surface that opens from a trigger (the dropdown and its sub-menus, the popover, the select list, the
|
|
354
|
+
* hover card; the account and workspace menus of the sidebar are dropdowns): it fades in while it slides `--floating-slide` (8px)
|
|
355
|
+
* from the side it opens towards, in `--duration-floating` (150ms) on `--ease-out`, so it arrives quickly and almost at once, the
|
|
356
|
+
* way a dialog slides in (owner, 18 Nov 2026). On the way out it only fades, in `--duration-fast`. People who ask for less motion get
|
|
357
|
+
* no animation at all. It reads the `data-state` and `data-side` that bits-ui writes on the floating element, so put it on the
|
|
358
|
+
* element that carries them (the `Content`), and do not combine it with the `animate-in` / `slide-in-from-*` utilities.
|
|
359
|
+
*
|
|
360
|
+
* Why not those utilities: `tailwindcss-animate` writes the slide as `--tw-enter-translate-y` in a `data-[side=bottom]:` rule and
|
|
361
|
+
* `data-[state=open]:animate-in` resets that variable to `initial`. Tailwind 4 puts the `data-[side=...]` rules before the
|
|
362
|
+
* `data-[state=...]` ones, so the reset won and the menus only faded: no slide at all (measured with `getAnimations()`).
|
|
363
|
+
* An open surface is anything that is not `closed`, because a tooltip says `delayed-open` and `instant-open`.
|
|
364
|
+
*/
|
|
365
|
+
@keyframes floating-enter {
|
|
366
|
+
from {
|
|
367
|
+
opacity: 0;
|
|
368
|
+
transform: translate3d(var(--floating-slide-x, 0px), var(--floating-slide-y, 0px), 0);
|
|
369
|
+
}
|
|
370
|
+
to {
|
|
371
|
+
opacity: 1;
|
|
372
|
+
transform: none;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
@keyframes floating-exit {
|
|
376
|
+
from {
|
|
377
|
+
opacity: 1;
|
|
378
|
+
}
|
|
379
|
+
to {
|
|
380
|
+
opacity: 0;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
@utility floating-motion {
|
|
384
|
+
&[data-side='bottom'] {
|
|
385
|
+
--floating-slide-y: calc(var(--floating-slide) * -1);
|
|
386
|
+
}
|
|
387
|
+
&[data-side='top'] {
|
|
388
|
+
--floating-slide-y: var(--floating-slide);
|
|
389
|
+
}
|
|
390
|
+
&[data-side='right'] {
|
|
391
|
+
--floating-slide-x: calc(var(--floating-slide) * -1);
|
|
392
|
+
}
|
|
393
|
+
&[data-side='left'] {
|
|
394
|
+
--floating-slide-x: var(--floating-slide);
|
|
395
|
+
}
|
|
396
|
+
&:not([data-state='closed']) {
|
|
397
|
+
animation: floating-enter var(--duration-floating) var(--ease-out) backwards;
|
|
398
|
+
}
|
|
399
|
+
&[data-state='closed'] {
|
|
400
|
+
animation: floating-exit var(--duration-fast) ease-out forwards;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@media (prefers-reduced-motion: reduce) {
|
|
404
|
+
&:not([data-state='closed']),
|
|
405
|
+
&[data-state='closed'] {
|
|
406
|
+
animation: none;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/*
|
|
412
|
+
* Text that is being worked on: a soft band of a lighter colour keeps passing over it, the way "Planning" waits for the plan, the
|
|
413
|
+
* task that is being built is shown, or "thinking" is said. Put `shimmer` on an element that holds only text and is as wide as that text
|
|
414
|
+
* (an inline-block, a flex item, `w-fit`, or `justify-self-start` in a grid): the band travels across the box of the element, so on a box
|
|
415
|
+
* stretched wider than its text the band passes over the text for only a moment of each pass.
|
|
416
|
+
*
|
|
417
|
+
* The colours are tokens of the theme, so it follows light and dark by itself. A usage can change them with
|
|
418
|
+
* --shimmer-base-color the colour the text has (default `--foreground`)
|
|
419
|
+
* --shimmer-glint-color the colour of the band that passes over it (default `--muted-foreground`)
|
|
420
|
+
* --shimmer-duration one pass, with a short rest after it (default 2s)
|
|
421
|
+
* Do not give the element a `text-*` colour class: the base colour is the first variable above, and it is also the colour of the
|
|
422
|
+
* text where the band does not move. The band starts where the text starts, so it travels right to left on a right to left screen.
|
|
423
|
+
* With reduced motion the band does not move: the text keeps its base colour.
|
|
424
|
+
*/
|
|
425
|
+
@utility shimmer {
|
|
426
|
+
color: var(--shimmer-base-color, var(--foreground));
|
|
427
|
+
background-image: linear-gradient(
|
|
428
|
+
100deg,
|
|
429
|
+
var(--shimmer-base-color, var(--foreground)) 40%,
|
|
430
|
+
var(--shimmer-glint-color, var(--muted-foreground)) 50%,
|
|
431
|
+
var(--shimmer-base-color, var(--foreground)) 60%
|
|
432
|
+
);
|
|
433
|
+
background-size: 250% 100%;
|
|
434
|
+
background-position: 100% 0;
|
|
435
|
+
-webkit-background-clip: text;
|
|
436
|
+
background-clip: text;
|
|
437
|
+
-webkit-text-fill-color: transparent;
|
|
438
|
+
animation: shimmer-sweep var(--shimmer-duration, 2s) linear infinite;
|
|
439
|
+
|
|
440
|
+
&:dir(rtl) {
|
|
441
|
+
animation-direction: reverse;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@media (prefers-reduced-motion: reduce) {
|
|
445
|
+
animation: none;
|
|
446
|
+
background-image: none;
|
|
447
|
+
-webkit-text-fill-color: currentcolor;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* The band crosses the text for the first 70% of the time and the text rests in its base colour for the rest. The band is 250% as wide as
|
|
453
|
+
* the box and its glint spans the 40% to 60% of that: at `100% 0` its right edge is just at the left edge of the box and at `0% 0` its
|
|
454
|
+
* left edge is just at the right edge, so the whole pass is spent over the text (a longer way would be time spent over nothing).
|
|
455
|
+
* The pass says `linear` itself, in its keyframe: the `ease-*` utilities of `tailwindcss-animate` set `animation-timing-function` of an
|
|
456
|
+
* element, and one of them (`ease-out`, which a fade on the same element asks for) would otherwise slow the band down.
|
|
457
|
+
*/
|
|
458
|
+
@keyframes shimmer-sweep {
|
|
459
|
+
0% {
|
|
460
|
+
background-position: 100% 0;
|
|
461
|
+
animation-timing-function: linear;
|
|
462
|
+
}
|
|
463
|
+
70%,
|
|
464
|
+
100% {
|
|
465
|
+
background-position: 0% 0;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
344
469
|
/* Figma text styles (prefixed with text- to avoid legacy typography utilities in fonts.css) */
|
|
345
470
|
@utility text-display-hero {
|
|
346
471
|
font-family: 'Inter', system-ui, sans-serif;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@widgetic/design-system/textarea-overlay` — the mirror layer over a text field: one transparent copy of the field's text on which
|
|
3
|
+
* owners paint what the field cannot show (the ghost text of `inline-completion`, the file badges of `prompt-references`), each under
|
|
4
|
+
* its own owner name.
|
|
5
|
+
*/
|
|
6
|
+
export { acquireTextareaOverlay } from './textareaOverlay.ts';
|
|
7
|
+
export type { OverlayDecoration, OverlayField, OverlayHandle } from './textareaOverlay.ts';
|
|
8
|
+
export { buildMirrorSegments } from './mirrorSegments.ts';
|
|
9
|
+
export type { MirrorDecoration, MirrorSegment } from './mirrorSegments.ts';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@widgetic/design-system/textarea-overlay` — the mirror layer over a text field: one transparent copy of the field's text on which
|
|
3
|
+
* owners paint what the field cannot show (the ghost text of `inline-completion`, the file badges of `prompt-references`), each under
|
|
4
|
+
* its own owner name.
|
|
5
|
+
*/
|
|
6
|
+
export { acquireTextareaOverlay } from "./textareaOverlay.js";
|
|
7
|
+
export { buildMirrorSegments } from "./mirrorSegments.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure part of the mirror layer: how the text of a field and the decorations that owners put on it become the pieces the mirror paints.
|
|
3
|
+
* No DOM, so Node's test runner loads this file.
|
|
4
|
+
*
|
|
5
|
+
* A decoration sits at a range of the field's text. `start === end` is an insertion (the ghost text after the caret); `start < end`
|
|
6
|
+
* COVERS the range (a file badge over the characters that reserve its room): the mirror paints the decoration's node where those
|
|
7
|
+
* characters are, and nothing of them.
|
|
8
|
+
*/
|
|
9
|
+
/** What one owner puts on the text: where, and whatever the painter needs to build the node (the layer does not look at it). */
|
|
10
|
+
export interface MirrorDecoration<Payload = unknown> {
|
|
11
|
+
/** Who put it there (`ghost`, `references`): an owner replaces its own decorations without touching another's. */
|
|
12
|
+
owner: string;
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
payload: Payload;
|
|
16
|
+
}
|
|
17
|
+
export type MirrorSegment<Payload = unknown> = {
|
|
18
|
+
kind: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'decoration';
|
|
22
|
+
decoration: MirrorDecoration<Payload>;
|
|
23
|
+
/** The text of the field the decoration covers ('' for an insertion). */ covered: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The text cut into the pieces to paint, in order: text between decorations, and the decorations. Decorations are ordered by where they
|
|
27
|
+
* start (an insertion before a cover that starts at the same place); a decoration that would overlap the one before it (a cover over
|
|
28
|
+
* the same characters, an insertion inside a cover) is dropped, so the pieces always add up to the text with the covered parts
|
|
29
|
+
* replaced.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildMirrorSegments<Payload = unknown>(value: string, decorations: readonly MirrorDecoration<Payload>[]): MirrorSegment<Payload>[];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure part of the mirror layer: how the text of a field and the decorations that owners put on it become the pieces the mirror paints.
|
|
3
|
+
* No DOM, so Node's test runner loads this file.
|
|
4
|
+
*
|
|
5
|
+
* A decoration sits at a range of the field's text. `start === end` is an insertion (the ghost text after the caret); `start < end`
|
|
6
|
+
* COVERS the range (a file badge over the characters that reserve its room): the mirror paints the decoration's node where those
|
|
7
|
+
* characters are, and nothing of them.
|
|
8
|
+
*/
|
|
9
|
+
/** A decoration with its range made sense of: whole numbers inside the text, `start <= end`. Null when it cannot be (not numbers). */
|
|
10
|
+
function clampedDecoration(decoration, length) {
|
|
11
|
+
const { start, end } = decoration;
|
|
12
|
+
if (!Number.isFinite(start) || !Number.isFinite(end))
|
|
13
|
+
return null;
|
|
14
|
+
const first = Math.min(length, Math.max(0, Math.floor(Math.min(start, end))));
|
|
15
|
+
const last = Math.min(length, Math.max(0, Math.floor(Math.max(start, end))));
|
|
16
|
+
return { ...decoration, start: first, end: last };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The text cut into the pieces to paint, in order: text between decorations, and the decorations. Decorations are ordered by where they
|
|
20
|
+
* start (an insertion before a cover that starts at the same place); a decoration that would overlap the one before it (a cover over
|
|
21
|
+
* the same characters, an insertion inside a cover) is dropped, so the pieces always add up to the text with the covered parts
|
|
22
|
+
* replaced.
|
|
23
|
+
*/
|
|
24
|
+
export function buildMirrorSegments(value, decorations) {
|
|
25
|
+
const ordered = decorations
|
|
26
|
+
.map((decoration) => clampedDecoration(decoration, value.length))
|
|
27
|
+
.filter((decoration) => decoration !== null)
|
|
28
|
+
.sort((left, right) => left.start - right.start || left.end - right.end);
|
|
29
|
+
const segments = [];
|
|
30
|
+
let cursor = 0;
|
|
31
|
+
for (const decoration of ordered) {
|
|
32
|
+
// Inside what the one before covers: it would paint over it.
|
|
33
|
+
if (decoration.start < cursor)
|
|
34
|
+
continue;
|
|
35
|
+
if (decoration.start > cursor)
|
|
36
|
+
segments.push({ kind: 'text', text: value.slice(cursor, decoration.start) });
|
|
37
|
+
segments.push({
|
|
38
|
+
kind: 'decoration',
|
|
39
|
+
decoration,
|
|
40
|
+
covered: value.slice(decoration.start, decoration.end)
|
|
41
|
+
});
|
|
42
|
+
cursor = decoration.end;
|
|
43
|
+
}
|
|
44
|
+
if (cursor < value.length)
|
|
45
|
+
segments.push({ kind: 'text', text: value.slice(cursor) });
|
|
46
|
+
return segments;
|
|
47
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sizes of the mirror, worked out from what the browser says about the field. Pure, so the arithmetic is tested without a browser:
|
|
3
|
+
* both are places where a rounded number made the mirror wrap a word on another line than the field does.
|
|
4
|
+
*/
|
|
5
|
+
/** The least width, in pixels, that counts as a scrollbar when the field's own width and its client width are compared. */
|
|
6
|
+
export declare const MIN_SCROLLBAR_WIDTH_PX = 2;
|
|
7
|
+
/** The lengths of the field's computed style that its width is made of, each as the browser writes it ("12px"). */
|
|
8
|
+
export interface FieldBoxMeasures {
|
|
9
|
+
width: string;
|
|
10
|
+
boxSizing: string;
|
|
11
|
+
paddingInlineStart: string;
|
|
12
|
+
paddingInlineEnd: string;
|
|
13
|
+
borderInlineStartWidth: string;
|
|
14
|
+
borderInlineEndWidth: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The field's width from border edge to border edge, as the layout has it: fraction included. `offsetWidth` rounds it, and a line can
|
|
18
|
+
* break on the half pixel that rounding drops (measured: about one width in twenty moved a break), so a mirror sized by it would wrap
|
|
19
|
+
* a word on another line than the field does.
|
|
20
|
+
*
|
|
21
|
+
* `roundedWidth` (the field's `offsetWidth`) is what is left when the style has no width to read (`auto`: a box that is not shown as a
|
|
22
|
+
* block).
|
|
23
|
+
*/
|
|
24
|
+
export declare function borderBoxWidthOf(measures: FieldBoxMeasures, roundedWidth: number): number;
|
|
25
|
+
/** What the field's box is made of, as the browser reports it. */
|
|
26
|
+
export interface FieldWidths {
|
|
27
|
+
/** The width with borders and a scrollbar, rounded (`offsetWidth`). */
|
|
28
|
+
offsetWidth: number;
|
|
29
|
+
/** The width without borders and a scrollbar, rounded (`clientWidth`). */
|
|
30
|
+
clientWidth: number;
|
|
31
|
+
/** The two borders together. */
|
|
32
|
+
borderWidth: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The room a scrollbar takes from the field's text (and none from its box): the mirror keeps the same room by padding. A real
|
|
36
|
+
* scrollbar is several pixels wide; a pixel or so is only the rounding of two fractional sizes, and would narrow the mirror's lines
|
|
37
|
+
* (and move a break) where the field has no scrollbar at all.
|
|
38
|
+
*/
|
|
39
|
+
export declare function scrollbarWidthOf(widths: FieldWidths): number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sizes of the mirror, worked out from what the browser says about the field. Pure, so the arithmetic is tested without a browser:
|
|
3
|
+
* both are places where a rounded number made the mirror wrap a word on another line than the field does.
|
|
4
|
+
*/
|
|
5
|
+
/** The least width, in pixels, that counts as a scrollbar when the field's own width and its client width are compared. */
|
|
6
|
+
export const MIN_SCROLLBAR_WIDTH_PX = 2;
|
|
7
|
+
/** A length as a number; `auto`, an empty string or anything else that is not a length counts as nothing. */
|
|
8
|
+
function lengthOf(written) {
|
|
9
|
+
return Number.parseFloat(written) || 0;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The field's width from border edge to border edge, as the layout has it: fraction included. `offsetWidth` rounds it, and a line can
|
|
13
|
+
* break on the half pixel that rounding drops (measured: about one width in twenty moved a break), so a mirror sized by it would wrap
|
|
14
|
+
* a word on another line than the field does.
|
|
15
|
+
*
|
|
16
|
+
* `roundedWidth` (the field's `offsetWidth`) is what is left when the style has no width to read (`auto`: a box that is not shown as a
|
|
17
|
+
* block).
|
|
18
|
+
*/
|
|
19
|
+
export function borderBoxWidthOf(measures, roundedWidth) {
|
|
20
|
+
const resolved = Number.parseFloat(measures.width);
|
|
21
|
+
if (!Number.isFinite(resolved))
|
|
22
|
+
return roundedWidth;
|
|
23
|
+
if (measures.boxSizing !== 'content-box')
|
|
24
|
+
return resolved;
|
|
25
|
+
// Both sides are added, so which one is the start does not matter.
|
|
26
|
+
return (resolved +
|
|
27
|
+
lengthOf(measures.paddingInlineStart) +
|
|
28
|
+
lengthOf(measures.paddingInlineEnd) +
|
|
29
|
+
lengthOf(measures.borderInlineStartWidth) +
|
|
30
|
+
lengthOf(measures.borderInlineEndWidth));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The room a scrollbar takes from the field's text (and none from its box): the mirror keeps the same room by padding. A real
|
|
34
|
+
* scrollbar is several pixels wide; a pixel or so is only the rounding of two fractional sizes, and would narrow the mirror's lines
|
|
35
|
+
* (and move a break) where the field has no scrollbar at all.
|
|
36
|
+
*/
|
|
37
|
+
export function scrollbarWidthOf(widths) {
|
|
38
|
+
const widthLeftToScrollbar = widths.offsetWidth - widths.clientWidth - widths.borderWidth;
|
|
39
|
+
return widthLeftToScrollbar >= MIN_SCROLLBAR_WIDTH_PX ? widthLeftToScrollbar : 0;
|
|
40
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The fields a mirror can sit over. */
|
|
2
|
+
export type OverlayField = HTMLTextAreaElement | HTMLInputElement;
|
|
3
|
+
/** What an owner paints: a range of the field's text, and the node that stands for it (an insertion when the range is empty). */
|
|
4
|
+
export interface OverlayDecoration {
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
/** Builds the node to paint. `covered` is the text of the field that the node replaces ('' for an insertion). Called at every paint. */
|
|
8
|
+
render: (covered: string) => Node;
|
|
9
|
+
}
|
|
10
|
+
/** One owner's handle on the mirror of one field. */
|
|
11
|
+
export interface OverlayHandle {
|
|
12
|
+
/** The mirror itself, for tests and for hosts that need to know where it is. */
|
|
13
|
+
readonly element: HTMLElement;
|
|
14
|
+
/** Replaces this owner's decorations (an empty list removes them) and repaints. Several calls in one task paint once. */
|
|
15
|
+
setDecorations(decorations: readonly OverlayDecoration[]): void;
|
|
16
|
+
/** Measures the field again (size, fonts, typography) and repaints: after something changed that raises no event. */
|
|
17
|
+
refresh(): void;
|
|
18
|
+
/** Lets go of the mirror: this owner's decorations go, and the mirror itself goes with the last owner. Safe to call twice. */
|
|
19
|
+
release(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Takes a handle on the mirror of `field` for `owner`, making the mirror if the field has none yet. Returns null when there is nowhere
|
|
23
|
+
* to put one (the field is not in a document). Owners must be distinct per kind of decoration (`ghost`, `references`).
|
|
24
|
+
*/
|
|
25
|
+
export declare function acquireTextareaOverlay(field: OverlayField, owner: string): OverlayHandle | null;
|