@molecule/app-ide-panel-logic 1.3.1 → 1.4.1
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 +285 -3
- package/dist/chatTimelineOrdering.d.ts +175 -1
- package/dist/chatTimelineOrdering.d.ts.map +1 -1
- package/dist/chatTimelineOrdering.js +192 -1
- package/dist/chatTimelineOrdering.js.map +1 -1
- package/dist/components/chat-card-event-utilities.d.ts +320 -0
- package/dist/components/chat-card-event-utilities.d.ts.map +1 -0
- package/dist/components/chat-card-event-utilities.js +198 -0
- package/dist/components/chat-card-event-utilities.js.map +1 -0
- package/dist/components/chat-card-style.d.ts +7 -1
- package/dist/components/chat-card-style.d.ts.map +1 -1
- package/dist/components/chat-card-style.js +8 -2
- package/dist/components/chat-card-style.js.map +1 -1
- package/dist/components/chat-composer-utilities.d.ts +472 -0
- package/dist/components/chat-composer-utilities.d.ts.map +1 -0
- package/dist/components/chat-composer-utilities.js +519 -0
- package/dist/components/chat-composer-utilities.js.map +1 -0
- package/dist/components/chat-dictation-controller.d.ts +376 -0
- package/dist/components/chat-dictation-controller.d.ts.map +1 -0
- package/dist/components/chat-dictation-controller.js +559 -0
- package/dist/components/chat-dictation-controller.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +24 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -1
- package/dist/components/chat-effort-utilities.js +41 -0
- package/dist/components/chat-effort-utilities.js.map +1 -1
- package/dist/components/chat-format-utilities.d.ts +71 -0
- package/dist/components/chat-format-utilities.d.ts.map +1 -0
- package/dist/components/chat-format-utilities.js +192 -0
- package/dist/components/chat-format-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +168 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -1
- package/dist/components/chat-models-utilities.js +253 -0
- package/dist/components/chat-models-utilities.js.map +1 -1
- package/dist/components/chat-settings-utilities.d.ts +153 -1
- package/dist/components/chat-settings-utilities.d.ts.map +1 -1
- package/dist/components/chat-settings-utilities.js +204 -1
- package/dist/components/chat-settings-utilities.js.map +1 -1
- package/dist/components/chat-stream-utilities.d.ts +165 -1
- package/dist/components/chat-stream-utilities.d.ts.map +1 -1
- package/dist/components/chat-stream-utilities.js +155 -1
- package/dist/components/chat-stream-utilities.js.map +1 -1
- package/dist/components/chat-tests-controller.d.ts +249 -0
- package/dist/components/chat-tests-controller.d.ts.map +1 -0
- package/dist/components/chat-tests-controller.js +504 -0
- package/dist/components/chat-tests-controller.js.map +1 -0
- package/dist/components/chat-timeline-utilities.d.ts +90 -0
- package/dist/components/chat-timeline-utilities.d.ts.map +1 -0
- package/dist/components/chat-timeline-utilities.js +71 -0
- package/dist/components/chat-timeline-utilities.js.map +1 -0
- package/dist/components/chat-ui-constants.d.ts +98 -0
- package/dist/components/chat-ui-constants.d.ts.map +1 -0
- package/dist/components/chat-ui-constants.js +146 -0
- package/dist/components/chat-ui-constants.js.map +1 -0
- package/dist/components/chat-undo-utilities.d.ts +47 -0
- package/dist/components/chat-undo-utilities.d.ts.map +1 -0
- package/dist/components/chat-undo-utilities.js +73 -0
- package/dist/components/chat-undo-utilities.js.map +1 -0
- package/dist/components/context-usage-utilities.d.ts +25 -3
- package/dist/components/context-usage-utilities.d.ts.map +1 -1
- package/dist/components/context-usage-utilities.js +42 -2
- package/dist/components/context-usage-utilities.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/panels.d.ts +6 -0
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +6 -0
- package/dist/panels.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chat "system card" vocabulary and the one construction of a system card
|
|
3
|
+
* from a recorded `CardEvent`.
|
|
4
|
+
*
|
|
5
|
+
* The React panel carries these notices inline in its chat timeline — the
|
|
6
|
+
* model/mode/setting/skills/custom system cards, the dismissable tips, the
|
|
7
|
+
* captured activity cards, commit cards, attached files and the composer's
|
|
8
|
+
* command/mode/effort/file pickers. Every framework's panel shows the same
|
|
9
|
+
* cards, so the types and the `CardEvent` → {@link SystemCard} mapping live
|
|
10
|
+
* here, framework-neutral. A view supplies its own `t()`, model catalog,
|
|
11
|
+
* region choices, custom-card factory and logger through
|
|
12
|
+
* {@link CardEventToSystemCardDeps}; nothing in this module reads React state,
|
|
13
|
+
* refs, props or hooks.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { effectiveModelRegion } from './chat-models-utilities.js';
|
|
18
|
+
/**
|
|
19
|
+
* Build a renderable {@link SystemCard} from a card-message's raw {@link CardEvent}. This is the ONE
|
|
20
|
+
* construction, used IDENTICALLY for a live `card` event (now a card-message in the transcript)
|
|
21
|
+
* and for a card-message loaded on refresh — so the rendered card is the same in both, with
|
|
22
|
+
* no separate store and no client-side "should I show this" decision. App-specific copy /
|
|
23
|
+
* actions stay client-side (the server records only the raw data); returns null for an
|
|
24
|
+
* unrenderable card (a custom event with no registered factory, or a non-execute mode) so
|
|
25
|
+
* the timeline simply omits it.
|
|
26
|
+
*
|
|
27
|
+
* @param cardEvent - The raw recorded card payload.
|
|
28
|
+
* @param id - The card-message's id, carried onto the built card.
|
|
29
|
+
* @param timestamp - The card-message's timestamp, carried onto the built card.
|
|
30
|
+
* @param deps - The caller's translate function, model catalog, region choices, custom-card factory resolver and logger.
|
|
31
|
+
* @returns The system card to render, or null when the event has nothing to show.
|
|
32
|
+
*/
|
|
33
|
+
export function cardEventToSystemCard(cardEvent, id, timestamp, deps) {
|
|
34
|
+
const { t, models, modelRegions, getFactory, logger } = deps;
|
|
35
|
+
// Suffix a card's copy with the member who made the change, when the
|
|
36
|
+
// server attributed one — so a teammate watching knows WHO flipped the
|
|
37
|
+
// model/effort/mode, live and on reload.
|
|
38
|
+
const withBy = (text) => {
|
|
39
|
+
const by = cardEvent.by;
|
|
40
|
+
return by
|
|
41
|
+
? t('ide.chat.cardBy', { text, name: by }, { defaultValue: '{{text}} — {{name}}' })
|
|
42
|
+
: text;
|
|
43
|
+
};
|
|
44
|
+
switch (cardEvent.kind) {
|
|
45
|
+
case 'model': {
|
|
46
|
+
const label = cardEvent.label || cardEvent.model;
|
|
47
|
+
// Append the model's effective processing-region code — catalog
|
|
48
|
+
// models only. A custom/BYO endpoint has no meaningful region: its
|
|
49
|
+
// catalog `regions` defaults to ['us'] as a placeholder, not a real
|
|
50
|
+
// re-host choice, so never surface a region for it.
|
|
51
|
+
const def = models.find((m) => m.id === cardEvent.model);
|
|
52
|
+
const regionCode = def && def.provider !== 'custom'
|
|
53
|
+
? effectiveModelRegion(def, modelRegions[def.id]).toUpperCase()
|
|
54
|
+
: null;
|
|
55
|
+
return {
|
|
56
|
+
id,
|
|
57
|
+
text: withBy(regionCode
|
|
58
|
+
? t('ide.chat.modelInUseRegion', { model: label, region: regionCode }, { defaultValue: 'Now using {{model}} ({{region}})' })
|
|
59
|
+
: t('ide.chat.modelInUse', { model: label }, { defaultValue: 'Now using {{model}}' })),
|
|
60
|
+
timestamp,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
case 'mode':
|
|
64
|
+
// The plan→build handoff ("🔨 Building your app") and the plan-mode
|
|
65
|
+
// announcement a new conversation is seeded with ("📝 Plan mode") —
|
|
66
|
+
// the server records mode cards only for those two.
|
|
67
|
+
if (cardEvent.mode === 'plan') {
|
|
68
|
+
return {
|
|
69
|
+
id,
|
|
70
|
+
text: withBy(t('ide.chat.phasePlanning', undefined, { defaultValue: '📝 Plan mode' })),
|
|
71
|
+
timestamp,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (cardEvent.mode !== 'execute')
|
|
75
|
+
return null;
|
|
76
|
+
return {
|
|
77
|
+
id,
|
|
78
|
+
text: withBy(t('ide.chat.phaseBuilding', undefined, { defaultValue: '🔨 Building your app' })),
|
|
79
|
+
timestamp,
|
|
80
|
+
};
|
|
81
|
+
case 'setting': {
|
|
82
|
+
// A Synthase-altering setting changed (effort / fast mode / max loops /
|
|
83
|
+
// region / auto-fix / auto-approve) — announced to every member, live
|
|
84
|
+
// and on reload. Copy reuses the same localized strings as the local
|
|
85
|
+
// confirmation cards, so the shared card reads identically.
|
|
86
|
+
let text = null;
|
|
87
|
+
if (cardEvent.setting === 'effort') {
|
|
88
|
+
const level = String(cardEvent.value ?? 'default');
|
|
89
|
+
const cardMode = cardEvent.mode ?? '';
|
|
90
|
+
text = cardEvent.label
|
|
91
|
+
? t('ide.chat.effort.setMode', { mode: cardMode, level, model: cardEvent.label }, { defaultValue: 'Reasoning effort for {{mode}} set to {{level}} ({{model}}).' })
|
|
92
|
+
: t('ide.chat.setting.effort', { mode: cardMode, level }, { defaultValue: 'Reasoning effort for {{mode}} set to {{level}}.' });
|
|
93
|
+
}
|
|
94
|
+
else if (cardEvent.setting === 'fastMode') {
|
|
95
|
+
text = cardEvent.value
|
|
96
|
+
? t('ide.chat.fastModeOn', undefined, {
|
|
97
|
+
defaultValue: 'Fast mode on — faster responses at a higher rate',
|
|
98
|
+
})
|
|
99
|
+
: t('ide.chat.fastModeOff', undefined, { defaultValue: 'Fast mode off' });
|
|
100
|
+
}
|
|
101
|
+
else if (cardEvent.setting === 'maxToolLoops') {
|
|
102
|
+
text = t('ide.chat.maxLoopsSet', { n: Number(cardEvent.value ?? 0) }, { defaultValue: 'Max tool iterations set to {{n}}' });
|
|
103
|
+
}
|
|
104
|
+
else if (cardEvent.setting === 'region') {
|
|
105
|
+
text = t('ide.chat.modelInUseRegion', { model: cardEvent.label ?? '', region: String(cardEvent.value ?? '').toUpperCase() }, { defaultValue: 'Now using {{model}} ({{region}})' });
|
|
106
|
+
}
|
|
107
|
+
else if (cardEvent.setting === 'autoFix') {
|
|
108
|
+
text = cardEvent.value
|
|
109
|
+
? t('ide.chat.autoFixEnabled', undefined, { defaultValue: 'Auto-fix enabled.' })
|
|
110
|
+
: t('ide.chat.autoFixDisabled', undefined, { defaultValue: 'Auto-fix disabled.' });
|
|
111
|
+
}
|
|
112
|
+
else if (cardEvent.setting === 'autoApprove') {
|
|
113
|
+
text = cardEvent.value
|
|
114
|
+
? t('ide.chat.autoApproveEnabled', undefined, {
|
|
115
|
+
defaultValue: 'Auto-approve on — destructive commands run without asking. The exfiltration guard still asks. Turn off with /autoapprove.',
|
|
116
|
+
})
|
|
117
|
+
: t('ide.chat.autoApproveDisabled', undefined, {
|
|
118
|
+
defaultValue: 'Auto-approve off — destructive commands ask before running.',
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (!text)
|
|
122
|
+
return null;
|
|
123
|
+
return { id, text: withBy(text), timestamp };
|
|
124
|
+
}
|
|
125
|
+
case 'skills':
|
|
126
|
+
return {
|
|
127
|
+
id,
|
|
128
|
+
variant: 'skillsLoaded',
|
|
129
|
+
text: t('ide.chat.skills.loadedCount', { count: cardEvent.count }, { defaultValue: '🧠 Loaded {{count}} skills' }),
|
|
130
|
+
timestamp,
|
|
131
|
+
};
|
|
132
|
+
case 'custom': {
|
|
133
|
+
// App-registered renderer (registerCustomEventCard) builds the copy/actions/tone
|
|
134
|
+
// from the raw data — keeping app-specific text out of this shared package.
|
|
135
|
+
//
|
|
136
|
+
// This runs in a memo ABOVE the timeline's per-item boundaries, so a factory
|
|
137
|
+
// that throws would take the whole panel down rather than one card — and the
|
|
138
|
+
// factory is host code reading model-authored `data`, exactly the combination
|
|
139
|
+
// that caused the 2026-08-14 outage. One unrenderable card must cost one card.
|
|
140
|
+
let card;
|
|
141
|
+
try {
|
|
142
|
+
card = getFactory(cardEvent.name)?.(cardEvent.data);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
logger.error('Custom chat card factory threw — dropping the card', {
|
|
146
|
+
error,
|
|
147
|
+
name: cardEvent.name,
|
|
148
|
+
});
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (!card)
|
|
152
|
+
return null;
|
|
153
|
+
return {
|
|
154
|
+
id,
|
|
155
|
+
text: card.text,
|
|
156
|
+
...(card.action ? { action: card.action } : {}),
|
|
157
|
+
...(card.emphasized ? { emphasized: card.emphasized } : {}),
|
|
158
|
+
...(card.tone ? { tone: card.tone } : {}),
|
|
159
|
+
...(card.icon ? { icon: card.icon } : {}),
|
|
160
|
+
...(card.content ? { content: card.content } : {}),
|
|
161
|
+
...(card.coversLimitType ? { coversLimitType: card.coversLimitType } : {}),
|
|
162
|
+
...(card.critical ? { critical: true } : {}),
|
|
163
|
+
timestamp,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
default:
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// ---------------------------------------------------------------------------
|
|
171
|
+
// One translated sentence around an inline segment
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
/**
|
|
174
|
+
* The stand-in a translated sentence is rendered with, to find where its slot lands. A
|
|
175
|
+
* private-use character: no translation or name carries it.
|
|
176
|
+
*/
|
|
177
|
+
export const CARD_SEGMENT_SLOT = '';
|
|
178
|
+
/**
|
|
179
|
+
* A card body that puts one inline segment (a clickable code name, a link) where a
|
|
180
|
+
* translated sentence's placeholder sits: `Loaded {{name}} skill` gives
|
|
181
|
+
* `['Loaded ', segment, ' skill']`. The sentence stays ONE translation, so each language
|
|
182
|
+
* places the name where its grammar wants it; two fragment keys around the name
|
|
183
|
+
* ("Loaded " + " skill") forced English word order on every language.
|
|
184
|
+
*
|
|
185
|
+
* @param render - Renders the sentence with the given text as the placeholder's value
|
|
186
|
+
* (the caller's `t()` call).
|
|
187
|
+
* @param segment - The segment that takes the placeholder's place.
|
|
188
|
+
* @returns The segments in order, without empty strings, or `null` when the rendered
|
|
189
|
+
* sentence does not carry the placeholder exactly once (render the plain text then).
|
|
190
|
+
*/
|
|
191
|
+
export function cardSegmentsAround(render, segment) {
|
|
192
|
+
const parts = render(CARD_SEGMENT_SLOT).split(CARD_SEGMENT_SLOT);
|
|
193
|
+
if (parts.length !== 2)
|
|
194
|
+
return null;
|
|
195
|
+
const [before, after] = parts;
|
|
196
|
+
return [...(before ? [before] : []), segment, ...(after ? [after] : [])];
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=chat-card-event-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-card-event-utilities.js","sourceRoot":"","sources":["../../src/components/chat-card-event-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgBH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAgSjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CACnC,SAAoB,EACpB,EAAU,EACV,SAAiB,EACjB,IAA+B;IAE/B,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5D,qEAAqE;IACrE,uEAAuE;IACvE,yCAAyC;IACzC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAU,EAAE;QACtC,MAAM,EAAE,GAAI,SAA6B,CAAC,EAAE,CAAA;QAC5C,OAAO,EAAE;YACP,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAC;YACnF,CAAC,CAAC,IAAI,CAAA;IACV,CAAC,CAAA;IACD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAA;YAChD,gEAAgE;YAChE,mEAAmE;YACnE,oEAAoE;YACpE,oDAAoD;YACpD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,SAAS,CAAC,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AC,CAAC,CAAC,EAAE,CAAC;gBAC1E,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC5C,SAAS;aACV,CAAA;QACH,CAAC;QACD;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,mDAAmD;AACnD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAgC,EAChC,OAA6B;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAChE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACnC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,KAAK,CAAA;IAC7B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1E,CAAC"}
|
|
@@ -74,8 +74,14 @@ export interface ChatCardStyle {
|
|
|
74
74
|
* bottom-margin rhythm at the call site — e.g.
|
|
75
75
|
* `style={{ display: 'flex', gap: 10, marginBottom: TIMELINE_ITEM_GAP, ...chatCardStyle(accent) }}`.
|
|
76
76
|
*
|
|
77
|
+
* A card that deepens its frame on hover sets the whole `border` to
|
|
78
|
+
* `chatCardStyle(accent, 70).border`, never `borderColor` alone: the frame is a shorthand
|
|
79
|
+
* holding a CSS variable, and a longhand written over it leaves its other longhands with no
|
|
80
|
+
* readable value (`getPropertyValue` returns `''`), in a browser and in the conformance kit.
|
|
81
|
+
*
|
|
77
82
|
* @param accent - Tint/border source colour. Defaults to the theme primary (neutral cards).
|
|
83
|
+
* @param borderPct - Opacity of the accent in the border mix (percent). Defaults to the resting 40.
|
|
78
84
|
* @returns The container `style` chrome (border, background, padding, radius).
|
|
79
85
|
*/
|
|
80
|
-
export declare function chatCardStyle(accent?: string): ChatCardStyle;
|
|
86
|
+
export declare function chatCardStyle(accent?: string, borderPct?: number): ChatCardStyle;
|
|
81
87
|
//# sourceMappingURL=chat-card-style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-card-style.d.ts","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,sCAAsC,CAAA;AAE3E,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAEtF;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED
|
|
1
|
+
{"version":3,"file":"chat-card-style.d.ts","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,sCAAsC,CAAA;AAE3E,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,MAAiC,EAAE,GAAG,SAAK,GAAG,MAAM,CAEtF;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,MAAM,GAAE,MAAiC,EACzC,SAAS,SAAK,GACb,aAAa,CAOf"}
|
|
@@ -64,14 +64,20 @@ export function chatCardBg(accent = CHAT_CARD_NEUTRAL_ACCENT, pct = 10) {
|
|
|
64
64
|
* bottom-margin rhythm at the call site — e.g.
|
|
65
65
|
* `style={{ display: 'flex', gap: 10, marginBottom: TIMELINE_ITEM_GAP, ...chatCardStyle(accent) }}`.
|
|
66
66
|
*
|
|
67
|
+
* A card that deepens its frame on hover sets the whole `border` to
|
|
68
|
+
* `chatCardStyle(accent, 70).border`, never `borderColor` alone: the frame is a shorthand
|
|
69
|
+
* holding a CSS variable, and a longhand written over it leaves its other longhands with no
|
|
70
|
+
* readable value (`getPropertyValue` returns `''`), in a browser and in the conformance kit.
|
|
71
|
+
*
|
|
67
72
|
* @param accent - Tint/border source colour. Defaults to the theme primary (neutral cards).
|
|
73
|
+
* @param borderPct - Opacity of the accent in the border mix (percent). Defaults to the resting 40.
|
|
68
74
|
* @returns The container `style` chrome (border, background, padding, radius).
|
|
69
75
|
*/
|
|
70
|
-
export function chatCardStyle(accent = CHAT_CARD_NEUTRAL_ACCENT) {
|
|
76
|
+
export function chatCardStyle(accent = CHAT_CARD_NEUTRAL_ACCENT, borderPct = 40) {
|
|
71
77
|
return {
|
|
72
78
|
padding: '10px 12px',
|
|
73
79
|
borderRadius: 8,
|
|
74
|
-
border: `1px solid ${chatCardBorder(accent)}`,
|
|
80
|
+
border: `1px solid ${chatCardBorder(accent, borderPct)}`,
|
|
75
81
|
background: chatCardBg(accent),
|
|
76
82
|
};
|
|
77
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-card-style.js","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mCAAmC,CAAA;AAE3E,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,wBAAwB,EAAE,GAAG,GAAG,EAAE;IAChF,OAAO,sBAAsB,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB,wBAAwB,EAAE,GAAG,GAAG,EAAE;IAC5E,OAAO,sBAAsB,MAAM,IAAI,GAAG,iBAAiB,CAAA;AAC7D,CAAC;AAiBD
|
|
1
|
+
{"version":3,"file":"chat-card-style.js","sourceRoot":"","sources":["../../src/components/chat-card-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mCAAmC,CAAA;AAE3E,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,wBAAwB,EAAE,GAAG,GAAG,EAAE;IAChF,OAAO,sBAAs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