@salilvnair/dui 1.0.13 → 1.0.14
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/dist/index.js +5290 -5138
- package/dist/index.js.map +1 -1
- package/dist/lib/components/input/HighlightedInputView.d.ts +12 -1
- package/dist/lib/components/input/KeyValueTableRowView.d.ts +11 -1
- package/dist/lib/components/input/KeyValueTableView.d.ts +3 -1
- package/dist/lib/components/input/url-ghost.d.ts +36 -0
- package/dist/lib/components/input/url-suggest.d.ts +39 -0
- package/dist/lib/components/input/url-suggest.test.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,17 @@ export interface HighlightedInputViewProps {
|
|
|
24
24
|
/** Running mock server URLs — shown at the top with a server icon */
|
|
25
25
|
mockServers?: MockServerSuggestion[];
|
|
26
26
|
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Hide the value behind dots, with an eye to reveal it.
|
|
29
|
+
*
|
|
30
|
+
* Done with `-webkit-text-security` rather than by swapping in a password
|
|
31
|
+
* input, because swapping the element loses the caret, the undo stack and
|
|
32
|
+
* the variable tokens — and a token is the thing most worth seeing once you
|
|
33
|
+
* have revealed it. Masking is presentational here: the text is still the
|
|
34
|
+
* text, editing still works, and the DOM still holds the real value, which
|
|
35
|
+
* is exactly as true of `<input type=password>`.
|
|
36
|
+
*/
|
|
37
|
+
masked?: boolean;
|
|
27
38
|
accentColor?: string;
|
|
28
39
|
/** Falls back to DuiProvider size when omitted. */
|
|
29
40
|
size?: DuiSize;
|
|
@@ -34,4 +45,4 @@ export interface HighlightedInputViewProps {
|
|
|
34
45
|
style?: React.CSSProperties;
|
|
35
46
|
className?: string;
|
|
36
47
|
}
|
|
37
|
-
export declare function HighlightedInputView({ testId, value, onChange, onKeyDown, onBlur, placeholder, suggestions, mockServers, disabled, accentColor, size, height, borderRadius, style, className, }: HighlightedInputViewProps): import("react").JSX.Element;
|
|
48
|
+
export declare function HighlightedInputView({ testId, value, onChange, onKeyDown, onBlur, placeholder, suggestions, mockServers, disabled, masked, accentColor, size, height, borderRadius, style, className, }: HighlightedInputViewProps): import("react").JSX.Element;
|
|
@@ -29,6 +29,16 @@ export interface KeyValueTableRowViewProps {
|
|
|
29
29
|
};
|
|
30
30
|
/** HTTP header key/value autocomplete — editable mode only */
|
|
31
31
|
autocompleteKeys?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Draw `{{variable}}` in the value cell as a token, the way a URL bar does.
|
|
34
|
+
*
|
|
35
|
+
* Off by default: a plain input is the right thing for a table of ordinary
|
|
36
|
+
* strings. On, the value cell becomes the same contenteditable editor the
|
|
37
|
+
* URL bars use — which is the point of it being the same component rather
|
|
38
|
+
* than a second one that looks similar. A masked or read-only cell stays a
|
|
39
|
+
* plain input; a secret rendered as readable tokens is not a secret.
|
|
40
|
+
*/
|
|
41
|
+
highlightVars?: boolean;
|
|
32
42
|
size?: DuiSize;
|
|
33
43
|
accentColor?: string;
|
|
34
44
|
onKeyChange?: (val: string) => void;
|
|
@@ -37,4 +47,4 @@ export interface KeyValueTableRowViewProps {
|
|
|
37
47
|
onEnabledChange?: (enabled: boolean) => void;
|
|
38
48
|
onRemove?: () => void;
|
|
39
49
|
}
|
|
40
|
-
export declare function KeyValueTableRowView({ testId, rowKey, value, description, enabled, readOnly, masked, maskSensitive, deletable, showDescription, placeholder, autocompleteKeys, size, onKeyChange, onValueChange, onDescriptionChange, onEnabledChange, onRemove, }: KeyValueTableRowViewProps): import("react").JSX.Element;
|
|
50
|
+
export declare function KeyValueTableRowView({ testId, rowKey, value, description, enabled, readOnly, highlightVars, masked, maskSensitive, deletable, showDescription, placeholder, autocompleteKeys, size, onKeyChange, onValueChange, onDescriptionChange, onEnabledChange, onRemove, }: KeyValueTableRowViewProps): import("react").JSX.Element;
|
|
@@ -41,6 +41,8 @@ export interface KeyValueTableViewProps {
|
|
|
41
41
|
value?: string;
|
|
42
42
|
};
|
|
43
43
|
className?: string;
|
|
44
|
+
/** Draw `{{variable}}` in every value cell as a token — see KeyValueTableRowView. */
|
|
45
|
+
highlightVars?: boolean;
|
|
44
46
|
/** Show HTTP header key autocomplete + value suggestions */
|
|
45
47
|
autocompleteKeys?: boolean;
|
|
46
48
|
/** Mask values for known sensitive keys (Authorization, token, etc.) */
|
|
@@ -65,4 +67,4 @@ export interface KeyValueTableViewProps {
|
|
|
65
67
|
/** Called when a deletable pinned row is removed */
|
|
66
68
|
onPinnedRemove?: (id: string) => void;
|
|
67
69
|
}
|
|
68
|
-
export declare function KeyValueTableView({ testId, rows, onChange, showDescription, placeholder, className, autocompleteKeys, maskSensitive, hideToolbar, label, accentColor, toolbarExtra, size, bordered, pinnedTopRows, onPinnedRemove, }: KeyValueTableViewProps): import("react").JSX.Element;
|
|
70
|
+
export declare function KeyValueTableView({ testId, rows, onChange, showDescription, placeholder, className, autocompleteKeys, highlightVars, maskSensitive, hideToolbar, label, accentColor, toolbarExtra, size, bordered, pinnedTopRows, onPinnedRemove, }: KeyValueTableViewProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Suggested } from './url-suggest';
|
|
2
|
+
/**
|
|
3
|
+
* The greyed completion drawn after the caret, and the caret tracking it needs.
|
|
4
|
+
*
|
|
5
|
+
* Shared by the two inputs that take `suggestions` — SelectTextInputView
|
|
6
|
+
* (REST, SOAP) and HighlightedInputView (GraphQL, gRPC, MCP, WebSocket, SSE,
|
|
7
|
+
* Socket.IO, MQTT). They are the same editor twice over: the same token
|
|
8
|
+
* engine, the same undo stack, the same caret helpers. Writing the completion
|
|
9
|
+
* into each of them separately would have made it two features that drift.
|
|
10
|
+
*/
|
|
11
|
+
/** Where the caret is, kept in state so suggestions can follow it. */
|
|
12
|
+
export declare function useCaret(editorRef: React.RefObject<HTMLDivElement | null>, initial: number): {
|
|
13
|
+
caret: number;
|
|
14
|
+
syncCaret: () => void;
|
|
15
|
+
setCaret: (n: number) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function useSuggested(value: string, caret: number, suggestions: string[]): Suggested;
|
|
18
|
+
/**
|
|
19
|
+
* The completion itself, laid over the editor.
|
|
20
|
+
*
|
|
21
|
+
* It draws the whole line — the typed part invisible, the completion greyed —
|
|
22
|
+
* so the browser's own text layout puts the grey text exactly where the caret
|
|
23
|
+
* is. Measuring the typed text and offsetting by hand is the usual way to do
|
|
24
|
+
* this, and it is wrong by a fraction of a pixel per character.
|
|
25
|
+
*
|
|
26
|
+
* Every box-model value is passed in by the caller rather than guessed, since
|
|
27
|
+
* the two hosts size their editors differently; a ghost one pixel out of step
|
|
28
|
+
* with the real text reads as a rendering fault.
|
|
29
|
+
*/
|
|
30
|
+
export declare function GhostText({ value, ghost, style }: {
|
|
31
|
+
value: string;
|
|
32
|
+
ghost: string;
|
|
33
|
+
style: React.CSSProperties;
|
|
34
|
+
}): import("react").JSX.Element | null;
|
|
35
|
+
/** Tab, or Right at the end of the line — the two keys that mean "take it". */
|
|
36
|
+
export declare function isAcceptGhostKey(e: React.KeyboardEvent): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What to suggest for a URL field that is being EDITED, not just started.
|
|
3
|
+
*
|
|
4
|
+
* ── The bug ──
|
|
5
|
+
*
|
|
6
|
+
* Suggestions only ever appeared when the field was empty. Not by design: the
|
|
7
|
+
* filter ran `suggestion.includes(wholeValue)`, and the whole value of a field
|
|
8
|
+
* somebody is editing is almost never a substring of anything in history.
|
|
9
|
+
*
|
|
10
|
+
* Take `https://azp.prod.com/xyz/abc`, put the caret after `http` and delete
|
|
11
|
+
* the `s`. The reader is clearly asking "what else starts like this?" — but
|
|
12
|
+
* the filter went looking for a history entry containing the entire string,
|
|
13
|
+
* tail and all, found none, and showed nothing. Clearing the field was the
|
|
14
|
+
* only way to get a list back, which is how this looked like a rule.
|
|
15
|
+
*
|
|
16
|
+
* ── What it does instead ──
|
|
17
|
+
*
|
|
18
|
+
* It matches on the text BEFORE THE CARET and ignores the tail. That is the
|
|
19
|
+
* part the reader has committed to; the tail is what they are in the middle
|
|
20
|
+
* of replacing. Entries that start with it come first, entries that merely
|
|
21
|
+
* contain it come after — a prefix match is what somebody typing a URL means,
|
|
22
|
+
* and a substring match is still worth offering when nothing starts that way.
|
|
23
|
+
*/
|
|
24
|
+
export interface Suggested {
|
|
25
|
+
/**
|
|
26
|
+
* The completion to draw greyed after the caret, or '' when there is none.
|
|
27
|
+
*
|
|
28
|
+
* Only ever the tail of the FIRST prefix match, so accepting it can never
|
|
29
|
+
* produce a URL that was not already in history.
|
|
30
|
+
*/
|
|
31
|
+
ghost: string;
|
|
32
|
+
/** What the dropdown lists, best match first. */
|
|
33
|
+
matches: string[];
|
|
34
|
+
}
|
|
35
|
+
/** Does `text` carry `prefix`, ignoring case? Prefix beats substring. */
|
|
36
|
+
export declare function matchRank(text: string, prefix: string): 0 | 1 | -1;
|
|
37
|
+
/** The text the reader has committed to: everything left of the caret. */
|
|
38
|
+
export declare function prefixAt(value: string, caret: number): string;
|
|
39
|
+
export declare function suggestFor(value: string, caret: number, suggestions: string[], limit?: number): Suggested;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|