@juicesharp/rpiv-ask-user-question 2.13.2 → 2.13.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.
- package/package.json +3 -2
- package/view/dialog-builder.ts +19 -47
- package/view/dialog-copy.ts +51 -0
- package/view/tab-content-strategy.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-ask-user-question",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.3",
|
|
4
4
|
"description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"view/components/tab-bar.ts",
|
|
75
75
|
"view/components/wrapping-select.ts",
|
|
76
76
|
"view/dialog-builder.ts",
|
|
77
|
+
"view/dialog-copy.ts",
|
|
77
78
|
"view/props-adapter.ts",
|
|
78
79
|
"view/scroll-window.ts",
|
|
79
80
|
"view/stateful-view.ts",
|
|
@@ -98,6 +99,6 @@
|
|
|
98
99
|
}
|
|
99
100
|
},
|
|
100
101
|
"dependencies": {
|
|
101
|
-
"@juicesharp/rpiv-config": "^2.13.
|
|
102
|
+
"@juicesharp/rpiv-config": "^2.13.3"
|
|
102
103
|
}
|
|
103
104
|
}
|
package/view/dialog-builder.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DynamicBorder, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { type Component, Container, type Editor, Spacer } from "@earendil-works/pi-tui";
|
|
3
|
-
import { DEFAULT_COLLAPSE_KEY, formatKeySpecForDisplay } from "../config.js";
|
|
4
3
|
import type { QuestionnaireState } from "../state/state.js";
|
|
5
4
|
import type { QuestionData } from "../tool/types.js";
|
|
6
5
|
import type { PreviewPaneProps } from "./components/preview/preview-pane.js";
|
|
@@ -10,53 +9,26 @@ import type { StatefulView } from "./stateful-view.js";
|
|
|
10
9
|
import type { TabComponents } from "./tab-components.js";
|
|
11
10
|
import { QuestionTabStrategy, SubmitTabStrategy, type TabContentStrategy } from "./tab-content-strategy.js";
|
|
12
11
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export const HINT_PART_COLLAPSE_TEMPLATE = `${KEY_PLACEHOLDER} to collapse`;
|
|
30
|
-
export const HINT_PART_EXPAND_TEMPLATE = `${KEY_PLACEHOLDER} to expand`;
|
|
31
|
-
/** Default-key (`Ctrl+]`) rendering of the collapse template, for tests and default-config assertions. */
|
|
32
|
-
export const HINT_PART_COLLAPSE = HINT_PART_COLLAPSE_TEMPLATE.replace(
|
|
12
|
+
export {
|
|
13
|
+
COLLAPSED_HINT_TEMPLATE,
|
|
14
|
+
HINT_MULTI,
|
|
15
|
+
HINT_PART_CANCEL,
|
|
16
|
+
HINT_PART_CLEAR,
|
|
17
|
+
HINT_PART_COLLAPSE,
|
|
18
|
+
HINT_PART_COLLAPSE_TEMPLATE,
|
|
19
|
+
HINT_PART_ENTER,
|
|
20
|
+
HINT_PART_EXPAND_TEMPLATE,
|
|
21
|
+
HINT_PART_NAV,
|
|
22
|
+
HINT_PART_NEW_LINE,
|
|
23
|
+
HINT_PART_NOTES,
|
|
24
|
+
HINT_PART_TAB,
|
|
25
|
+
HINT_PART_TOGGLE,
|
|
26
|
+
HINT_SINGLE,
|
|
27
|
+
INCOMPLETE_WARNING_PREFIX,
|
|
33
28
|
KEY_PLACEHOLDER,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* `HINT_SINGLE` / `HINT_MULTI` are the resting core hint for NON-multiSelect
|
|
38
|
-
* question tabs only: `buildHintText` drops `NOTES` while the notes editor is
|
|
39
|
-
* open (`state.notesVisible`) or the "Type something." row is capturing text
|
|
40
|
-
* (`state.inputMode`), and on multiSelect tabs it interleaves `TOGGLE` between
|
|
41
|
-
* `NAV` and `NOTES`, so neither composite is a substring there — assert on
|
|
42
|
-
* `HINT_PART_*` constants in those states instead. The collapse affordance is
|
|
43
|
-
* appended AFTER cancel by `buildHintText` so the resting core stays a contiguous
|
|
44
|
-
* prefix substring of the rendered line. On narrow terminals the collapse tail
|
|
45
|
-
* clips with `…` (`OneLineClippedText`); the core is preserved.
|
|
46
|
-
*/
|
|
47
|
-
export const HINT_SINGLE = [HINT_PART_ENTER, HINT_PART_NAV, HINT_PART_NOTES, HINT_PART_CANCEL].join(" · ");
|
|
48
|
-
export const HINT_MULTI = [HINT_PART_ENTER, HINT_PART_NAV, HINT_PART_NOTES, HINT_PART_TAB, HINT_PART_CANCEL].join(
|
|
49
|
-
" · ",
|
|
50
|
-
);
|
|
51
|
-
/**
|
|
52
|
-
* Template for the single-line footer shown by `QuestionnaireSession` when
|
|
53
|
-
* `state.collapsed === true`. Bypasses `buildHintText`; the session replaces
|
|
54
|
-
* `KEY_PLACEHOLDER` with the configured key's display form.
|
|
55
|
-
*/
|
|
56
|
-
export const COLLAPSED_HINT_TEMPLATE = [HINT_PART_EXPAND_TEMPLATE, HINT_PART_CANCEL].join(" · ");
|
|
57
|
-
export const REVIEW_HEADING = "Review your answers";
|
|
58
|
-
export const READY_PROMPT = "Ready to submit your answers?";
|
|
59
|
-
export const INCOMPLETE_WARNING_PREFIX = "⚠ Answer remaining questions before submitting:";
|
|
29
|
+
READY_PROMPT,
|
|
30
|
+
REVIEW_HEADING,
|
|
31
|
+
} from "./dialog-copy.js";
|
|
60
32
|
|
|
61
33
|
/**
|
|
62
34
|
* Rows the scroll window must keep for the body before the heading (header badge +
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DEFAULT_COLLAPSE_KEY, formatKeySpecForDisplay } from "../config.js";
|
|
2
|
+
|
|
3
|
+
/** Leaf: imports nothing from `view/`, so `dialog-builder` and `tab-content-strategy` never form a runtime cycle (#208). */
|
|
4
|
+
|
|
5
|
+
export const HINT_PART_ENTER = "Enter to select";
|
|
6
|
+
export const HINT_PART_NAV = "↑/↓ to navigate";
|
|
7
|
+
export const HINT_PART_NEW_LINE = "Shift+Enter for newline";
|
|
8
|
+
export const HINT_PART_CLEAR = "Ctrl+U to clear";
|
|
9
|
+
export const HINT_PART_TOGGLE = "Space to toggle";
|
|
10
|
+
export const HINT_PART_NOTES = "n to add notes";
|
|
11
|
+
export const HINT_PART_TAB = "Tab to switch questions";
|
|
12
|
+
export const HINT_PART_CANCEL = "Esc to cancel";
|
|
13
|
+
/**
|
|
14
|
+
* Collapse/expand hint copy is templated on `KEY_PLACEHOLDER` because the
|
|
15
|
+
* shortcut is configurable (`collapseKey`) and `rpiv-i18n`'s `tr` has no
|
|
16
|
+
* interpolation — locale entries carry the same `{key}` placeholder and call
|
|
17
|
+
* sites `.replace()` it with `formatKeySpecForDisplay(collapseKey)` after
|
|
18
|
+
* lookup, so per-locale word order is preserved.
|
|
19
|
+
*/
|
|
20
|
+
export const KEY_PLACEHOLDER = "{key}";
|
|
21
|
+
export const HINT_PART_COLLAPSE_TEMPLATE = `${KEY_PLACEHOLDER} to collapse`;
|
|
22
|
+
export const HINT_PART_EXPAND_TEMPLATE = `${KEY_PLACEHOLDER} to expand`;
|
|
23
|
+
/** Default-key (`Ctrl+]`) rendering of the collapse template, for tests and default-config assertions. */
|
|
24
|
+
export const HINT_PART_COLLAPSE = HINT_PART_COLLAPSE_TEMPLATE.replace(
|
|
25
|
+
KEY_PLACEHOLDER,
|
|
26
|
+
formatKeySpecForDisplay(DEFAULT_COLLAPSE_KEY),
|
|
27
|
+
);
|
|
28
|
+
/**
|
|
29
|
+
* `HINT_SINGLE` / `HINT_MULTI` are the resting core hint for NON-multiSelect
|
|
30
|
+
* question tabs only: `buildHintText` drops `NOTES` while the notes editor is
|
|
31
|
+
* open (`state.notesVisible`) or the "Type something." row is capturing text
|
|
32
|
+
* (`state.inputMode`), and on multiSelect tabs it interleaves `TOGGLE` between
|
|
33
|
+
* `NAV` and `NOTES`, so neither composite is a substring there — assert on
|
|
34
|
+
* `HINT_PART_*` constants in those states instead. The collapse affordance is
|
|
35
|
+
* appended AFTER cancel by `buildHintText` so the resting core stays a contiguous
|
|
36
|
+
* prefix substring of the rendered line. On narrow terminals the collapse tail
|
|
37
|
+
* clips with `…` (`OneLineClippedText`); the core is preserved.
|
|
38
|
+
*/
|
|
39
|
+
export const HINT_SINGLE = [HINT_PART_ENTER, HINT_PART_NAV, HINT_PART_NOTES, HINT_PART_CANCEL].join(" · ");
|
|
40
|
+
export const HINT_MULTI = [HINT_PART_ENTER, HINT_PART_NAV, HINT_PART_NOTES, HINT_PART_TAB, HINT_PART_CANCEL].join(
|
|
41
|
+
" · ",
|
|
42
|
+
);
|
|
43
|
+
/**
|
|
44
|
+
* Template for the single-line footer shown by `QuestionnaireSession` when
|
|
45
|
+
* `state.collapsed === true`. Bypasses `buildHintText`; the session replaces
|
|
46
|
+
* `KEY_PLACEHOLDER` with the configured key's display form.
|
|
47
|
+
*/
|
|
48
|
+
export const COLLAPSED_HINT_TEMPLATE = [HINT_PART_EXPAND_TEMPLATE, HINT_PART_CANCEL].join(" · ");
|
|
49
|
+
export const REVIEW_HEADING = "Review your answers";
|
|
50
|
+
export const READY_PROMPT = "Ready to submit your answers?";
|
|
51
|
+
export const INCOMPLETE_WARNING_PREFIX = "⚠ Answer remaining questions before submitting:";
|
|
@@ -5,8 +5,8 @@ import { t } from "../state/i18n-bridge.js";
|
|
|
5
5
|
import { formatAnswerScalar } from "../tool/format-answer.js";
|
|
6
6
|
import type { QuestionData } from "../tool/types.js";
|
|
7
7
|
import type { PreviewPane, PreviewPaneProps } from "./components/preview/preview-pane.js";
|
|
8
|
+
import type { DialogState } from "./dialog-builder.js";
|
|
8
9
|
import {
|
|
9
|
-
type DialogState,
|
|
10
10
|
HINT_PART_CANCEL,
|
|
11
11
|
HINT_PART_CLEAR,
|
|
12
12
|
HINT_PART_COLLAPSE_TEMPLATE,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
KEY_PLACEHOLDER,
|
|
21
21
|
READY_PROMPT,
|
|
22
22
|
REVIEW_HEADING,
|
|
23
|
-
} from "./dialog-
|
|
23
|
+
} from "./dialog-copy.js";
|
|
24
24
|
import type { StatefulView } from "./stateful-view.js";
|
|
25
25
|
import type { TabComponents } from "./tab-components.js";
|
|
26
26
|
|