@aparte/core 0.30.0 → 0.31.0

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.
@@ -7,7 +7,7 @@ export { AparteComposer, AparteComposerInput, AparteComposerSend, AparteComposer
7
7
  export type { AparteComposerEventMap, AparteComposerEventType, AparteComposerState, AparteComposerChangeEventDetail, AparteComposerPanelMode, AparteActionClickEventDetail } from './composer/index.js';
8
8
  export { AparteConversationList } from './conversation-list/index.js';
9
9
  export type { AparteConversationListItem, AparteConversationSelectDetail, AparteConversationDeleteDetail, AparteConversationArchiveDetail, AparteConversationPinDetail, AparteConversationRenameDetail, AparteConversationStatus, AparteConversationStatusDetail } from './conversation-list/index.js';
10
- export { AparteSuggestions } from './suggestions/index.js';
10
+ export { AparteSuggestions, setupSuggestionBlocks, SUGGESTIONS_BLOCK_LANGUAGE } from './suggestions/index.js';
11
11
  export type { AparteSuggestion, AparteSuggestionEventDetail } from './suggestions/index.js';
12
12
  export { AparteContext } from './context/index.js';
13
13
  export type { AparteContextLevel, AparteContextThresholdEventDetail } from './context/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAChF,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACzN,YAAY,EAAE,sBAAsB,EAAE,uBAA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ACrD,YAAY,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC"}
@@ -47,6 +47,11 @@ export interface AparteSuggestionEventDetail {
47
47
  * lands. The element sets and lifts `hidden` itself and never lifts one you set.
48
48
  * With no transcript to read — a composer outside any chat — the first send hides it
49
49
  * until the attribute is removed.
50
+ * @attr {boolean} answers - Shows the replies the LAST message offered instead of fixed
51
+ * starters: a code block in language `suggestions` in that answer
52
+ * (`setupSuggestionBlocks`), e.g. the
53
+ * free times a booking bot proposes. Empty until an answer offers some, emptied the
54
+ * moment a message is sent, and when the last message is the person's.
50
55
  * @attr {string} target - The id of the `<aparte-chat>` whose composer should receive
51
56
  * the click, when the element is not inside that composer.
52
57
  * @attr {boolean} data-empty - Reflected BY the element while it has no suggestion to
@@ -122,8 +127,18 @@ export declare class AparteSuggestions extends HTMLElement {
122
127
  * chat's transcript would be worse than following none, which falls back to the send.
123
128
  */
124
129
  private _resolveTranscript;
125
- /** Follow the transcript while `empty-only` is set, and stop following it when it is not. */
130
+ /** Follow the transcript while `empty-only` or `answers` is set, and stop following it when neither is. */
126
131
  private _watchTranscript;
132
+ private _onTranscript;
133
+ /**
134
+ * `answers`: the replies the LAST message offered, written by a ```suggestions block
135
+ * (`setupSuggestionBlocks`) as a hidden `[data-aparte-suggestions]` mark in that
136
+ * message. A last message that is the person's, or that offers none, shows none: the
137
+ * offer was for the answer it came with.
138
+ */
139
+ private _applyAnswers;
140
+ /** Show these replies; the same ones already shown redraw nothing (a transcript mutation is frequent). */
141
+ private _showAnswers;
127
142
  /** Set `hidden`, or lift it only when this element set it: a `hidden` the page wrote stays. */
128
143
  private _setHidden;
129
144
  private _render;
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-suggestions.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/aparte-suggestions.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAA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IAEtC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAOtB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,cAAc;IAOtB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAO1B,2GAA2G;IAC3G,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,aAAa,CAGnB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAQrB,0GAA0G;IAC1G,OAAO,CAAC,YAAY;IAMpB,+FAA+F;IAC/F,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,OAAO;IAyBf,OAAO,CAAC,SAAS;CAwBpB"}
@@ -1,3 +1,4 @@
1
1
  export { AparteSuggestions } from './aparte-suggestions.js';
2
+ export { setupSuggestionBlocks, SUGGESTIONS_BLOCK_LANGUAGE } from './suggestion-blocks.js';
2
3
  export type { AparteSuggestion, AparteSuggestionEventDetail } from './aparte-suggestions.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAC3F,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Replies an answer offers, written as text: a ```suggestions block of JSON in a reply,
3
+ * for a backend that only sends text (an n8n workflow, a plain completion), the way
4
+ * `@aparte/plugin-cards` reads a ```card-<name> block. Nothing of it shows in the
5
+ * message: `<aparte-suggestions answers>` above the composer shows the replies of the last
6
+ * answer, and a click sends one as if typed.
7
+ *
8
+ * Which day suits you?
9
+ * ```suggestions
10
+ * ["Tuesday 3", "Wednesday 4", {"label": "Another week", "prompt": "Next week, please"}]
11
+ * ```
12
+ *
13
+ * One more user of `registerCodeLanguageRenderer`, the seam a block's language goes
14
+ * through: no system of its own.
15
+ */
16
+ import { type AparteConfig } from '../../config/index.js';
17
+ /** The language the block is written in. */
18
+ export declare const SUGGESTIONS_BLOCK_LANGUAGE = "suggestions";
19
+ /**
20
+ * Read the code blocks in language `suggestions` in replies as the replies that
21
+ * `<aparte-suggestions answers>` offers. Returns the function that stops it. Off until called: a block is then no longer
22
+ * shown as code, so it is the app's choice.
23
+ *
24
+ * @example
25
+ * setupSuggestionBlocks();
26
+ * // and, in the composer, an `<aparte-suggestions answers>` element
27
+ */
28
+ export declare function setupSuggestionBlocks(config?: AparteConfig): () => void;
29
+ //# sourceMappingURL=suggestion-blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestion-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/suggestions/suggestion-blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG9E,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AAiBxD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,GAAE,YAAiC,GAAG,MAAM,IAAI,CAa3F"}