@design.estate/dees-catalog 21.42.0 → 21.44.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.
- package/dist_bundle/bundle.js +541 -182
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-72W55DOJ.js → chunk-ETDITRNI.js} +4 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-72W55DOJ.js.map → chunk-ETDITRNI.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PAFNUCDL.js → chunk-UD6S2QIF.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GTAAYRP5.js → chunk-WZGJITN2.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-CQ56NZVB.js → de-NIKZVWN2.js} +4 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-NIKZVWN2.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JNRW3HIY.js → dees-modal-BOGBX6EB.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-Y532Z546.js → dees-workspace-terminal-M3DB4LUI.js} +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.d.ts +20 -4
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.demo.js +21 -4
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.js +65 -10
- package/dist_ts_web/elements/00group-dataview/dees-thread/interfaces.d.ts +5 -0
- package/dist_ts_web/elements/00group-dataview/dees-thread/thread.markdown.d.ts +2 -1
- package/dist_ts_web/elements/00group-dataview/dees-thread/thread.markdown.js +6 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +2 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +2 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.d.ts +10 -2
- package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.js +26 -6
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.d.ts +2 -0
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.js +3 -2
- package/dist_ts_web/elements/00group-input/dees-input-reference/dees-input-reference.d.ts +1 -7
- package/dist_ts_web/elements/00group-input/dees-input-reference/dees-input-reference.js +22 -97
- package/dist_ts_web/elements/00group-input/dees-input-richtext/component.d.ts +23 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/component.js +105 -5
- package/dist_ts_web/elements/00group-input/dees-input-richtext/demo.js +29 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/index.d.ts +1 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/index.js +5 -2
- package/dist_ts_web/elements/00group-input/dees-input-richtext/markdown.d.ts +21 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/markdown.js +90 -6
- package/dist_ts_web/elements/00group-input/dees-input-richtext/references.d.ts +52 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/references.js +152 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/styles.js +23 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/template.js +2 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +6 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.d.ts +15 -2
- package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.js +44 -11
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +7 -0
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +67 -5
- package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +2 -2
- package/dist_ts_web/i18n/de.d.ts +6 -2
- package/dist_ts_web/i18n/de.js +3 -2
- package/dist_ts_web/i18n/messages.d.ts +6 -2
- package/dist_ts_web/i18n/messages.js +3 -2
- package/dist_ts_web/richtextmarkdown.d.ts +5 -1
- package/dist_ts_web/richtextmarkdown.js +6 -2
- package/package.json +1 -1
- package/readme.md +68 -12
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-dataview/dees-thread/dees-thread.demo.ts +23 -3
- package/ts_web/elements/00group-dataview/dees-thread/dees-thread.ts +50 -7
- package/ts_web/elements/00group-dataview/dees-thread/interfaces.ts +6 -0
- package/ts_web/elements/00group-dataview/dees-thread/thread.markdown.ts +5 -2
- package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +2 -1
- package/ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.ts +28 -5
- package/ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.ts +4 -2
- package/ts_web/elements/00group-input/dees-input-reference/dees-input-reference.ts +20 -88
- package/ts_web/elements/00group-input/dees-input-richtext/component.ts +83 -3
- package/ts_web/elements/00group-input/dees-input-richtext/demo.ts +34 -0
- package/ts_web/elements/00group-input/dees-input-richtext/index.ts +6 -0
- package/ts_web/elements/00group-input/dees-input-richtext/markdown.ts +93 -5
- package/ts_web/elements/00group-input/dees-input-richtext/references.ts +171 -0
- package/ts_web/elements/00group-input/dees-input-richtext/styles.ts +22 -0
- package/ts_web/elements/00group-input/dees-input-richtext/template.ts +1 -0
- package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +5 -0
- package/ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.ts +39 -10
- package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +61 -3
- package/ts_web/elements/00group-kanban/kanban.demodata.ts +1 -1
- package/ts_web/i18n/de.ts +2 -1
- package/ts_web/i18n/messages.ts +2 -1
- package/ts_web/richtextmarkdown.ts +8 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-CQ56NZVB.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PAFNUCDL.js.map → chunk-UD6S2QIF.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GTAAYRP5.js.map → chunk-WZGJITN2.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JNRW3HIY.js.map → dees-modal-BOGBX6EB.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-Y532Z546.js.map → dees-workspace-terminal-M3DB4LUI.js.map} +0 -0
package/readme.md
CHANGED
|
@@ -41,7 +41,7 @@ switcher**, **view-toggle**, and **single-selection toggle** all lead to
|
|
|
41
41
|
| Track epics, tasks and subtasks across workflow columns | [`dees-kanban`](#deeskanban) | Board, ordering, projects, filters, ticket detail with links, source and history, discussion, live refresh and stable ticket references. |
|
|
42
42
|
| Show a conversation about a record: comments by people and agents, what happened, a reply | [`dees-thread`](#deesthread) | Timeline of comments and events, Markdown composer with close/reopen actions, pending and refused posts, read-only and failed states. The host owns posting and adds the posted entry. |
|
|
43
43
|
| Show who wrote, did or owns something: a picture, else initials; an agent apart from a person | [`dees-avatar`](#deesavatar) | Round for a person, a rounded square with its own glyph for an agent or the system; a picture that fails falls back to the initials. `decorative` beside a visible name. |
|
|
44
|
-
| Compose comments with searchable inline references | [`dees-input-reference`](#deesinputreference) |
|
|
44
|
+
| Compose comments with searchable inline references | [`dees-input-richtext`](#deesinputrichtext) `searchReferences`, [`dees-input-reference`](#deesinputreference) | In Markdown, `#` at the start of a word searches the host's records at the caret and links the one chosen; `dees-input-reference` writes plain text with references, at `#_`. Both keep stable reference IDs. |
|
|
45
45
|
| Search, filter, sort, edit and act on records | [`dees-table`](#deestable) | Use its columns, selection and data actions before building a table toolbar or row-action layer. |
|
|
46
46
|
| Offer an action about what a tile shows: open its details, export it, add to it | [`dees-tile`](#deestile) `actions` | Footer or header actions, drawn and held while they run exactly like a table's header and footer actions. Never a footer bar of buttons built by hand; actions on a table's rows or on the table itself are the table's own. See [Where actions go](#where-actions-go). |
|
|
47
47
|
| Filter a view's rows: an account, a month, "Include private" | [`dees-table`](#deestable) `filters` | Behind the filter button at the end of the table's search field, which counts the active filters and opens them in the speech bubble; each active one is a removable chip in the bar above the column headers. Never a row of dropdowns and checkboxes in the header. See [Where actions go](#where-actions-go). |
|
|
@@ -115,7 +115,7 @@ class MyApp extends DeesElement {
|
|
|
115
115
|
| `@design.estate/dees-catalog` | Every component, registered on import, with the types of their properties and events. |
|
|
116
116
|
| `@design.estate/dees-catalog/icon` | `dees-icon` alone (see [DeesIcon](#deesicon)). |
|
|
117
117
|
| `@design.estate/dees-catalog/cdn` | Where the catalog loads Monaco from, as constants, and `monacoVsDirectoryUrl()` for a server that serves Monaco itself. Imports no component, Lit or DOM API, so it runs in plain Node. |
|
|
118
|
-
| `@design.estate/dees-catalog/richtext-markdown` | The richtext editor's Markdown format without the editor: `richtextMarkdownToDoc`, `richtextDocToMarkdown` and `richtextMarkdownRenderOptions`. Imports no component, Lit or DOM API, so it runs in plain Node. |
|
|
118
|
+
| `@design.estate/dees-catalog/richtext-markdown` | The richtext editor's Markdown format without the editor: `richtextMarkdownToDoc`, `richtextDocToMarkdown` and `richtextMarkdownRenderOptions`, and its references: `richtextReferenceHref`, `richtextReferenceId`, `richtextMarkdownToReferences` and `richtextReferencesToMarkdown`. Imports no component, Lit or DOM API, so it runs in plain Node. |
|
|
119
119
|
|
|
120
120
|
Name a component's event and property types from the package root, never from a
|
|
121
121
|
`dist_ts_web/...` path:
|
|
@@ -1897,7 +1897,7 @@ html`<dees-input-multitoggle
|
|
|
1897
1897
|
|
|
1898
1898
|
| Property/API | Behavior |
|
|
1899
1899
|
| --- | --- |
|
|
1900
|
-
| `options: TMultitoggleOption[]` | Strings or `{ key, label, disabled? }` objects. |
|
|
1900
|
+
| `options: TMultitoggleOption[]` | Strings or `{ key, label, disabled?, icon?, badge?, description? }` objects; `description` is the segment's tooltip. |
|
|
1901
1901
|
| `selectedOption` | Selected string/key; bind with `.selectedOption` in Lit. |
|
|
1902
1902
|
| `value`, `getValue()`, `setValue(value)` | String key, or boolean in boolean mode. `value` is a JavaScript property, not a `value` HTML attribute. |
|
|
1903
1903
|
| `type="boolean"` | Two alternatives named by `booleanTrueName` / `booleanFalseName`; `.boolValue` supplies a boolean selection. |
|
|
@@ -2181,6 +2181,7 @@ Rich text editor with formatting toolbar powered by TipTap.
|
|
|
2181
2181
|
- Undo/redo support
|
|
2182
2182
|
- Word count
|
|
2183
2183
|
- HTML or Markdown output (`format`), and a choice of toolbar buttons (`toolbar`)
|
|
2184
|
+
- Links to the host's records, searched at `#` (`searchReferences`)
|
|
2184
2185
|
- [`frameless`](#frameless-components) drops the editor's outer frame when the host owns it
|
|
2185
2186
|
|
|
2186
2187
|
The box is `minHeight` px tall (200 by default), toolbar and footer included, and its
|
|
@@ -2260,6 +2261,36 @@ the editor reads the value with the same `frontmatter: false`, so a note that st
|
|
|
2260
2261
|
- Set `format` with the value; changing it later builds the editor again and reads the
|
|
2261
2262
|
value in the new format. `setValue()`, `getValue()` and `dees-form` speak the format.
|
|
2262
2263
|
|
|
2264
|
+
**References.** With `searchReferences` (`TReferenceSearch`, `(query, signal) =>
|
|
2265
|
+
IInputReference[]`) the field links the host's own records: tickets, people, documents.
|
|
2266
|
+
`#` (`reference-trigger`) typed at the start of a word, outside code and links, opens a
|
|
2267
|
+
search at the caret that takes the focus, so `C#` stays text; the record chosen takes
|
|
2268
|
+
the trigger's place as one piece, shown as a link with its label. Escape closes the
|
|
2269
|
+
search and leaves the `#` as typed, so a heading is Escape and a space. In Markdown a
|
|
2270
|
+
reference is a link to `#reference:` and the record's id, percent-encoded
|
|
2271
|
+
(`[#CAT-12 Login fails](#reference:cat-12)`), in HTML a
|
|
2272
|
+
`<span data-reference-id="cat-12">`; references in a value show as links in either
|
|
2273
|
+
format, with or without a search. A click on one, or Enter on it, dispatches
|
|
2274
|
+
`reference-open` with its `id` and `label`, for the host to open the record. A search
|
|
2275
|
+
that cannot open shows why under the field until the next one opens; one whose
|
|
2276
|
+
`searchReferences` fails says so in its list. `reference-search-label` names the
|
|
2277
|
+
search ("Search to link" by default, `richtext.referenceSearch`).
|
|
2278
|
+
|
|
2279
|
+
```typescript
|
|
2280
|
+
<dees-input-richtext
|
|
2281
|
+
label="Payment note"
|
|
2282
|
+
format="markdown"
|
|
2283
|
+
.searchReferences=${(query, signal) => api.searchRecords(query, signal)}
|
|
2284
|
+
reference-search-label="Search records"
|
|
2285
|
+
@reference-open=${(event) => openRecord(event.detail.id)}
|
|
2286
|
+
></dees-input-richtext>
|
|
2287
|
+
```
|
|
2288
|
+
|
|
2289
|
+
`richtextReferenceHref(id)` and `richtextReferenceId(href)` write and read a reference's
|
|
2290
|
+
link; a host that keeps a text's references as records, as `TReferenceContent`, reads the
|
|
2291
|
+
Markdown with `richtextMarkdownToReferences(markdown)` (text parts stay Markdown) and
|
|
2292
|
+
writes it back with `richtextReferencesToMarkdown(content)`.
|
|
2293
|
+
|
|
2263
2294
|
#### `DeesInputWysiwyg`
|
|
2264
2295
|
Rich editor for HTML or Markdown. Use `changeSubject` for field updates, or collect
|
|
2265
2296
|
`.value` through `dees-form`.
|
|
@@ -3850,8 +3881,19 @@ composer. `submit(action?)` posts from code and `focusComposer()` focuses the ed
|
|
|
3850
3881
|
`.draft` restores a draft; `thread-draft` reports every change, so a host can keep one
|
|
3851
3882
|
per thread. `composerInfo` (a string, paragraphs split by blank lines, or a template) is an ⓘ
|
|
3852
3883
|
button at the leading end of the composer's footer that opens it in a speech bubble: who
|
|
3853
|
-
reads a reply and what it does, said once instead of above every composer.
|
|
3854
|
-
`.searchReferences`
|
|
3884
|
+
reads a reply and what it does, said once instead of above every composer.
|
|
3885
|
+
`.searchReferences` links the host's records from the composer: `#` at the start of a
|
|
3886
|
+
word searches them, as [`dees-input-richtext`](#deesinputrichtext) does, and
|
|
3887
|
+
`referenceSearchLabel` names that search. A reference in a body (a link to
|
|
3888
|
+
`#reference:` and the record's id) shows as a link and opens its record through
|
|
3889
|
+
`thread-reference-open`. `format="references"` writes plain text with references through
|
|
3890
|
+
`dees-input-reference` instead, at `#_`.
|
|
3891
|
+
|
|
3892
|
+
`view` places the composer apart: `'entries'` shows the timeline alone and
|
|
3893
|
+
`'composer'` the composer alone (`'full'`, the default, both). A host that pins the
|
|
3894
|
+
composer under the timeline, as the Kanban ticket detail does, renders the thread twice
|
|
3895
|
+
with the same properties; the composer alone starts at three lines, grows as the reader
|
|
3896
|
+
writes, and shows while the thread is loading too.
|
|
3855
3897
|
|
|
3856
3898
|
`readOnly` replaces the composer with `readOnlyReason`. `loading` and `error` keep the
|
|
3857
3899
|
items a thread has; a thread without items says it is loading, empty or failed, and
|
|
@@ -5388,7 +5430,8 @@ action footer, and the active-filter bar below the header shows each filter and
|
|
|
5388
5430
|
the search as a removable chip with Clear all. `.filterValues` (`IKanbanFilterValues`: `text`, `project`, `epic`,
|
|
5389
5431
|
`assignee` with `'none'` for unassigned, `label`, `mine`) starts the board
|
|
5390
5432
|
filtered; the reader's changes emit `kanban-filter-change`. "Assigned to me"
|
|
5391
|
-
appears when `.currentPersonId` is set
|
|
5433
|
+
appears when `.currentPersonId` is set, and that person in `.people` heads the
|
|
5434
|
+
comment composer with their avatar. `clearFilters()` clears them.
|
|
5392
5435
|
|
|
5393
5436
|
A ticket's `links` (`TKanbanLink`) name where its work lives: a branch with
|
|
5394
5437
|
an optional sha, a commit, a release with its version, or any page. A link with
|
|
@@ -5464,7 +5507,7 @@ the ticket ID and anchor element. Secondary cards remain usable independently.
|
|
|
5464
5507
|
board's modal. It displays the parent, child tickets, description, links, source,
|
|
5465
5508
|
fields, created and updated stamps, and the discussion beside the history. It
|
|
5466
5509
|
accepts `.ticket`, `.tickets`, `.columns`, `.people`, `.projects`, `.provider`,
|
|
5467
|
-
`.draft`, `.comments`, `.commentDraft`, `.activity`, `.loadingActivity`,
|
|
5510
|
+
`.draft`, `.comments`, `.commentDraft`, `.currentPerson`, `.activity`, `.loadingActivity`,
|
|
5468
5511
|
`.activityError` and `.conflict` (`IKanbanEditConflict`, a save refused as stale).
|
|
5469
5512
|
It emits `kanban-ticket-save` and `kanban-ticket-draft` intents, and for a
|
|
5470
5513
|
conflict `kanban-ticket-reload`, `kanban-conflict-apply` and
|
|
@@ -5495,16 +5538,26 @@ section, with the edit's actions at its foot, before the links, the child ticket
|
|
|
5495
5538
|
and the discussion. The fields stand there in the document as well, so the focus
|
|
5496
5539
|
order is the order on screen at every width: **Edit ticket** comes before the
|
|
5497
5540
|
discussion.
|
|
5541
|
+
The discussion's composer, headed by `.currentPerson`'s avatar, stays at the foot of
|
|
5542
|
+
the main column while the comments scroll beneath it, opaque in the detail's surface:
|
|
5543
|
+
`--dees-kanban-detail-surface`, the page's background unless the host sets its own, as
|
|
5544
|
+
the board does for its modal. On a short ticket it rests at the bottom, and the space
|
|
5545
|
+
above it belongs to the conversation. The history in the discussion's place hides it,
|
|
5546
|
+
keeping its draft; on a phone it follows the comments.
|
|
5498
5547
|
With [`frameless`](#frameless-components), as the board sets it, the detail lines
|
|
5499
5548
|
its content up with the modal's heading through the [region inset](#region-inset).
|
|
5500
5549
|
|
|
5501
5550
|
#### DeesKanbanDiscussion
|
|
5502
5551
|
|
|
5503
5552
|
`dees-kanban-discussion` renders a ticket's comments as a
|
|
5504
|
-
[`dees-thread`](#deesthread) with
|
|
5505
|
-
|
|
5506
|
-
`.
|
|
5507
|
-
|
|
5553
|
+
[`dees-thread`](#deesthread) with its standard Markdown composer, which links tickets
|
|
5554
|
+
at `#` through `.searchTickets` and is headed by `.currentPerson`'s avatar.
|
|
5555
|
+
Provide `.ticketId`, `.comments`, `.draft`, `.searchTickets`, `.currentPerson`,
|
|
5556
|
+
`.addComment`, `.loading`, `.error` and `.readOnly`. Comment bodies and the draft stay
|
|
5557
|
+
`TReferenceContent`, their text parts Markdown, so a comment written before shows as
|
|
5558
|
+
Markdown too. `.view` (`'full'`, `'entries'` or `'composer'`) shows the comments or the
|
|
5559
|
+
composer alone, as the thread's `view`. `submit()` awaits the save callback; errors
|
|
5560
|
+
leave the draft intact. Ctrl/⌘ Enter submits; Enter starts a new paragraph.
|
|
5508
5561
|
Standalone consumers handle `kanban-comment-draft` (`ticketId`, `body`),
|
|
5509
5562
|
`kanban-comment-added` (`comment`, `submittedBody`), `kanban-ticket-open` and
|
|
5510
5563
|
`kanban-comments-refresh`. The assembled board handles these events itself.
|
|
@@ -5552,6 +5605,9 @@ and cancels obsolete searches. References participate in editor undo and clipboa
|
|
|
5552
5605
|
operations. Changing `.documentKey` resets history so undo cannot cross tickets.
|
|
5553
5606
|
|
|
5554
5607
|
Set `.trigger`, `.label`, `.placeholder`, `.searchLabel` and `.disabled` as needed.
|
|
5608
|
+
A composer that writes Markdown links records the same way through
|
|
5609
|
+
[`dees-input-richtext`](#deesinputrichtext)'s `searchReferences`, as `dees-thread` and
|
|
5610
|
+
the Kanban discussion do.
|
|
5555
5611
|
For an integrated composer, style `::part(editor)` and set
|
|
5556
5612
|
`--dees-reference-min-height` (default `84px`) or `--dees-reference-font-size`
|
|
5557
5613
|
(default `var(--dees-font-body-size)`). Keep a visible focus indicator when
|
|
@@ -5914,7 +5970,7 @@ chat.addEventListener('harness-menu-action', (event) => {
|
|
|
5914
5970
|
|
|
5915
5971
|
Tool calls accept terminal status `stopped` for confirmed interruptions. Stopped cards use a warning tone, stop their running animation, and enter activity history without being treated as errors. Terminal tool aliases include `command`; file-write aliases include `fileChange` and `file_change`. File writes can provide `{ changes: [{ path, diff }] }` to render each file's unified diff.
|
|
5916
5972
|
|
|
5917
|
-
Set `modeOptions` (e.g. `['Planning', 'Building']`) to render a segmented **mode switcher**; the active `mode` changes on click — or **Shift+Tab** inside the prompt cycles it — and emits `harness-mode-change`. Inside `dees-harness-chat` the composer renders `docked` — flush edge-to-edge with a top border and an upward shadow (`--dees-shadow-up-sm`) so it meets the transcript and the session panel like the toolbar does; standalone composers keep the floating-card chrome.
|
|
5973
|
+
Set `modeOptions` (e.g. `['Planning', 'Building']`) to render a segmented **mode switcher**; the active `mode` changes on click — or **Shift+Tab** inside the prompt cycles it, passing over a disabled mode — and emits `harness-mode-change`. A mode can also be an `IHarnessComposerOption` (`{ label, value, description?, disabled? }`): the segment shows `label`, `mode` and the event carry `value` whatever the language shown, and `description` is the segment's tooltip — say there what the mode still does or asks, such as `[{ label: 'Ask', value: 'ask', description: 'Every change is proposed first.' }, { label: 'Yolo', value: 'yolo', description: 'Warnings and dangerous changes are still proposed.' }]`. Inside `dees-harness-chat` the composer renders `docked` — flush edge-to-edge with a top border and an upward shadow (`--dees-shadow-up-sm`) so it meets the transcript and the session panel like the toolbar does; standalone composers keep the floating-card chrome.
|
|
5918
5974
|
|
|
5919
5975
|
#### `DeesHarnessTodos`
|
|
5920
5976
|
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-catalog',
|
|
6
|
-
version: '21.
|
|
6
|
+
version: '21.44.0',
|
|
7
7
|
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
|
|
8
8
|
}
|
|
@@ -47,7 +47,7 @@ const conversation = (): { entries: IThreadEntry[]; events: IThreadEvent[] } =>
|
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
id: 'c2', author: lukas, createdAt: ago(185), actions: entryActions,
|
|
50
|
-
body: 'Booked the €84 on account `4288
|
|
50
|
+
body: 'Booked the €84 on account `4288`: [#2026-0314 Home office March](#reference:booking-2026-0314).',
|
|
51
51
|
attachments: [
|
|
52
52
|
{ id: 'booking-4288', name: 'Booking 2026-0314.pdf', url: 'https://example.com/bookings/2026-0314.pdf', size: 31_904 },
|
|
53
53
|
{ id: 'rent-march', name: 'Rent March.pdf', url: 'https://example.com/bookings/rent-march.pdf', size: 1_284_113 },
|
|
@@ -62,6 +62,16 @@ const conversation = (): { entries: IThreadEntry[]; events: IThreadEvent[] } =>
|
|
|
62
62
|
],
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
const bookings = [
|
|
66
|
+
{ id: 'booking-2026-0314', label: '#2026-0314 Home office March' },
|
|
67
|
+
{ id: 'booking-2026-0302', label: '#2026-0302 Rent March' },
|
|
68
|
+
{ id: 'booking-2026-0219', label: '#2026-0219 Rent February' },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
/** The bookings a reply links with #: those whose label holds the query. */
|
|
72
|
+
const searchBookings = async (queryArg: string) =>
|
|
73
|
+
bookings.filter((booking) => booking.label.toLowerCase().includes(queryArg.toLowerCase()));
|
|
74
|
+
|
|
65
75
|
const delay = (msArg: number) => new Promise((resolve) => setTimeout(resolve, msArg));
|
|
66
76
|
|
|
67
77
|
/** A question as a team, its tax advisor and its agent work on it. */
|
|
@@ -121,13 +131,14 @@ class DeesDemoThreadIssue extends DeesElement {
|
|
|
121
131
|
@newValue=${(event: CustomEvent<boolean>) => { this.refuseNext = event.detail; }}></dees-input-checkbox>
|
|
122
132
|
<dees-thread threadId="question-0314" .entries=${this.entries} .events=${this.events} .currentUser=${mara}
|
|
123
133
|
.onSubmit=${this.submit} .composerActions=${this.closed ? this.reopenAction : this.closeAction}
|
|
134
|
+
.searchReferences=${searchBookings} referenceSearchLabel="Search bookings"
|
|
124
135
|
.composerInfo=${'Jonas Weber and the Ledger assistant see your reply. A reply from you reopens the question; a reply from anyone else marks it answered.'}
|
|
125
136
|
@thread-action=${(event: CustomEvent) => showDemoResult(this, { action: event.detail.action, entry: event.detail.entry.id })}
|
|
126
137
|
@thread-reference-open=${(event: CustomEvent) => showDemoResult(this, { open: event.detail.id })}
|
|
127
138
|
@thread-attachment-open=${(event: CustomEvent) => showDemoResult(this, { attachment: event.detail.attachment.id })}
|
|
128
139
|
@thread-submit=${(event: CustomEvent) => showDemoResult(this, event.detail)}
|
|
129
140
|
></dees-thread>
|
|
130
|
-
${demoOutput('Reply, close or reopen the question; open a comment\'s menu.')}
|
|
141
|
+
${demoOutput('Reply, close or reopen the question; type # to link a booking; open a comment\'s menu or a booking.')}
|
|
131
142
|
`;
|
|
132
143
|
}
|
|
133
144
|
}
|
|
@@ -175,12 +186,21 @@ export const demoFunc = () => demoPage(
|
|
|
175
186
|
'Thread',
|
|
176
187
|
'A conversation about a record, as an issue tracker shows one: comments by people and agents, what happened between them, and a composer at its end.',
|
|
177
188
|
html`
|
|
178
|
-
${demoSection('A question', 'Two people, a tax advisor and the agent answering on the advisor\'s behalf. Replying makes the agent answer; closing turns the action into Reopen.', html`
|
|
189
|
+
${demoSection('A question', 'Two people, a tax advisor and the agent answering on the advisor\'s behalf. Replying makes the agent answer; # in a reply links a booking, which opens as thread-reference-open; closing turns the action into Reopen.', html`
|
|
179
190
|
<dees-demo-thread-issue></dees-demo-thread-issue>
|
|
180
191
|
`)}
|
|
181
192
|
${demoSection('A long thread', 'More items than collapseAfter: the middle collapses until the reader loads it.', html`
|
|
182
193
|
<dees-thread threadId="trip" .entries=${longThread().entries} .events=${longThread().events} .currentUser=${mara}></dees-thread>
|
|
183
194
|
`)}
|
|
195
|
+
${demoSection('The composer apart', 'A host that places the composer apart renders the thread twice, with the same properties: view="entries" for the timeline and view="composer" for the composer, here pinned under the timeline as a ticket\'s detail does.', html`
|
|
196
|
+
<div style="display: flex; flex-direction: column; height: 480px; overflow: hidden; border: var(--dees-line-width-hairline) solid var(--dees-color-border-default); border-radius: var(--dees-radius-lg);">
|
|
197
|
+
<div style="flex: 1; min-height: 0; overflow: auto; padding: var(--dees-spacing-md) var(--dees-spacing-lg);">
|
|
198
|
+
<dees-thread threadId="trip-apart" view="entries" .collapseAfter=${100} .entries=${longThread().entries} .events=${longThread().events} .currentUser=${mara}></dees-thread>
|
|
199
|
+
</div>
|
|
200
|
+
<dees-thread threadId="trip-apart" view="composer" .currentUser=${mara}
|
|
201
|
+
style="padding: var(--dees-spacing-md) var(--dees-spacing-lg) var(--dees-spacing-lg); border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);"></dees-thread>
|
|
202
|
+
</div>
|
|
203
|
+
`)}
|
|
184
204
|
${demoSection('Read-only', 'A closed question the reader may read but not answer; dates in full.', html`
|
|
185
205
|
<dees-thread threadId="vat" timeFormat="absolute" readOnly readOnlyReason="This question is closed. Only its owner can reopen it."
|
|
186
206
|
.entries=${closedThread().entries} .events=${closedThread().events}></dees-thread>
|
|
@@ -19,6 +19,7 @@ import { DeesContextmenu, type TContextMenuItem } from '../../00group-overlay/de
|
|
|
19
19
|
import type { DeesActionFooter, IActionFooterAction } from '../../00group-button/dees-actionfooter/dees-actionfooter.js';
|
|
20
20
|
import type { TRichtextToolbarButton } from '../../00group-input/dees-input-richtext/types.js';
|
|
21
21
|
import { referenceText, type TReferenceContent, type TReferenceSearch } from '../../00group-input/dees-input-reference/index.js';
|
|
22
|
+
import { referenceId } from '../../00group-input/dees-input-richtext/markdown.js';
|
|
22
23
|
import { renderThreadMarkdown, threadMarkdownHtml } from './thread.markdown.js';
|
|
23
24
|
import type { TBarInfo } from '../../00barinfo.js';
|
|
24
25
|
import type {
|
|
@@ -33,6 +34,7 @@ import type {
|
|
|
33
34
|
TThreadFormat,
|
|
34
35
|
TThreadSubmit,
|
|
35
36
|
TThreadTimeFormat,
|
|
37
|
+
TThreadView,
|
|
36
38
|
} from './interfaces.js';
|
|
37
39
|
import { demoFunc } from './dees-thread.demo.js';
|
|
38
40
|
import '../../00group-layout/dees-tile/dees-tile.js';
|
|
@@ -128,13 +130,14 @@ const safeHref = (hrefArg?: string): string | undefined => {
|
|
|
128
130
|
* `subjectId` opens its record through `thread-reference-open`, one with an `href` its page.
|
|
129
131
|
*
|
|
130
132
|
* COMPOSER: `dees-input-richtext` in Markdown (`format: 'markdown'`) or `dees-input-reference`
|
|
131
|
-
* (`'references'`), and the actions: the primary rightmost ("Comment", `submitLabel`), the
|
|
133
|
+
* (`'references'`), both linking records through `searchReferences` (`#` in Markdown), and the actions: the primary rightmost ("Comment", `submitLabel`), the
|
|
132
134
|
* `composerActions` beside it ("Close with comment"), and `composerInfo` behind an ⓘ at the footer's
|
|
133
135
|
* leading end. Ctrl/⌘ Enter runs the primary. Posting is not
|
|
134
136
|
* optimistic: `onSubmit` is awaited while the composer holds its text, locked, and the button shows
|
|
135
137
|
* its pending state; fulfilled, the text is gone and `thread-submit` follows, and the host adds the
|
|
136
138
|
* entry; rejected, the text stays and the error's message shows under the composer. `readOnly`
|
|
137
|
-
* replaces the composer with `readOnlyReason`.
|
|
139
|
+
* replaces the composer with `readOnlyReason`. `view` shows the timeline or the composer alone,
|
|
140
|
+
* for a host that places the composer apart, pinned under the timeline as a ticket's detail does.
|
|
138
141
|
*
|
|
139
142
|
* STATES: `loading` (a thread without items says so), `error` (with a retry as `thread-reload`;
|
|
140
143
|
* the items stay), empty, and a long thread — more items than `collapseAfter` — whose middle
|
|
@@ -190,10 +193,18 @@ export class DeesThread extends DeesElement {
|
|
|
190
193
|
@property({ type: String, reflect: true })
|
|
191
194
|
accessor format: TThreadFormat = 'markdown';
|
|
192
195
|
|
|
193
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* Finds the records the composer links: typed `#` at the start of a word in Markdown, `#_` with
|
|
198
|
+
* references. A record linked in Markdown is a link to `#reference:<id>` (`richtextReferenceHref`);
|
|
199
|
+
* in a body the thread shows it as a reference, and opening it dispatches `thread-reference-open`.
|
|
200
|
+
*/
|
|
194
201
|
@property({ attribute: false })
|
|
195
202
|
accessor searchReferences: TReferenceSearch | undefined = undefined;
|
|
196
203
|
|
|
204
|
+
/** The name of the composer's search for a record to link; the composer's own when empty. */
|
|
205
|
+
@property({ type: String, reflect: true })
|
|
206
|
+
accessor referenceSearchLabel = '';
|
|
207
|
+
|
|
197
208
|
/**
|
|
198
209
|
* The composer's text: a string in Markdown, `TReferenceContent` with references. Every change
|
|
199
210
|
* the reader makes is reported as `thread-draft`, so a host can keep it per thread.
|
|
@@ -213,6 +224,15 @@ export class DeesThread extends DeesElement {
|
|
|
213
224
|
@property({ type: String, reflect: true })
|
|
214
225
|
accessor readOnlyReason = '';
|
|
215
226
|
|
|
227
|
+
/**
|
|
228
|
+
* The timeline with the composer at its end (`full`, the default), the timeline alone
|
|
229
|
+
* (`entries`), or the composer alone (`composer`). A host placing the composer apart renders the
|
|
230
|
+
* thread twice, with the same properties; the composer alone shows once the thread is loading
|
|
231
|
+
* too, starts at three lines and grows as the reader writes.
|
|
232
|
+
*/
|
|
233
|
+
@property({ type: String, reflect: true })
|
|
234
|
+
accessor view: TThreadView = 'full';
|
|
235
|
+
|
|
216
236
|
@property({ type: Boolean, reflect: true })
|
|
217
237
|
accessor loading = false;
|
|
218
238
|
|
|
@@ -510,6 +530,12 @@ export class DeesThread extends DeesElement {
|
|
|
510
530
|
overflow-x: auto;
|
|
511
531
|
}
|
|
512
532
|
|
|
533
|
+
.markdown-body a.reference,
|
|
534
|
+
.markdown-body a.reference:hover {
|
|
535
|
+
color: var(--dees-color-link);
|
|
536
|
+
text-decoration: none;
|
|
537
|
+
}
|
|
538
|
+
|
|
513
539
|
.plain {
|
|
514
540
|
white-space: pre-wrap;
|
|
515
541
|
overflow-wrap: anywhere;
|
|
@@ -806,6 +832,7 @@ export class DeesThread extends DeesElement {
|
|
|
806
832
|
}
|
|
807
833
|
|
|
808
834
|
public render(): TemplateResult {
|
|
835
|
+
if (this.view === 'composer') return this.readOnly ? this.renderReadOnly(true) : this.renderComposer(true);
|
|
809
836
|
const items = this.items();
|
|
810
837
|
const collapsing = this.collapseAfter > 0 && items.length > this.collapseAfter
|
|
811
838
|
&& collapsedHead + this.revealed + collapsedTail < items.length;
|
|
@@ -837,7 +864,7 @@ export class DeesThread extends DeesElement {
|
|
|
837
864
|
${directives.repeat(tail, key, renderItem(tail))}
|
|
838
865
|
</ol>`
|
|
839
866
|
: ''}
|
|
840
|
-
${!items.length && (this.loading || this.error)
|
|
867
|
+
${this.view === 'entries' || (!items.length && (this.loading || this.error))
|
|
841
868
|
? ''
|
|
842
869
|
: this.readOnly ? this.renderReadOnly(!items.length) : this.renderComposer(!items.length)}
|
|
843
870
|
`;
|
|
@@ -849,6 +876,7 @@ export class DeesThread extends DeesElement {
|
|
|
849
876
|
*/
|
|
850
877
|
public async submit(action?: string): Promise<void> {
|
|
851
878
|
await this.updateComplete;
|
|
879
|
+
if (this.view === 'entries') return;
|
|
852
880
|
const footer = this.shadowRoot?.querySelector<DeesActionFooter>('.composerTile dees-actionfooter');
|
|
853
881
|
if (!action && footer) {
|
|
854
882
|
await footer.runPrimary();
|
|
@@ -982,9 +1010,18 @@ export class DeesThread extends DeesElement {
|
|
|
982
1010
|
const rendered = threadMarkdownHtml(body);
|
|
983
1011
|
return rendered === undefined
|
|
984
1012
|
? html`<div class="plain">${body}</div>`
|
|
985
|
-
: html`<div class="markdown-body">${unsafeHTML(rendered)}</div>`;
|
|
1013
|
+
: html`<div class="markdown-body" @click=${this.markdownClick}>${unsafeHTML(rendered)}</div>`;
|
|
986
1014
|
}
|
|
987
1015
|
|
|
1016
|
+
/** A reference in a Markdown body opens its record, as one in a body with references does. */
|
|
1017
|
+
private readonly markdownClick = (event: MouseEvent): void => {
|
|
1018
|
+
const link = (event.target as Element | null)?.closest('a[data-reference]');
|
|
1019
|
+
if (!link) return;
|
|
1020
|
+
event.preventDefault();
|
|
1021
|
+
const id = referenceId(link.getAttribute('href'));
|
|
1022
|
+
if (id !== null) this.openReference(id, link.textContent ?? '');
|
|
1023
|
+
};
|
|
1024
|
+
|
|
988
1025
|
private refusedActions(entry: IThreadEntry): IActionFooterAction[] {
|
|
989
1026
|
const threadId = this.threadId;
|
|
990
1027
|
return [
|
|
@@ -1115,6 +1152,7 @@ export class DeesThread extends DeesElement {
|
|
|
1115
1152
|
${this.format === 'references'
|
|
1116
1153
|
? html`<dees-input-reference class="composerInput" .label=${this.t('thread.composer')} .placeholder=${placeholder}
|
|
1117
1154
|
.documentKey=${threadId} .value=${this.referenceDraft()} .searchReferences=${this.searchReferences}
|
|
1155
|
+
.searchLabel=${this.referenceSearchLabel}
|
|
1118
1156
|
@reference-input=${(event: CustomEvent<{ value: TReferenceContent }>) => {
|
|
1119
1157
|
event.stopPropagation();
|
|
1120
1158
|
this.updateDraft(event.detail.value);
|
|
@@ -1127,13 +1165,18 @@ export class DeesThread extends DeesElement {
|
|
|
1127
1165
|
></dees-input-reference>`
|
|
1128
1166
|
: html`<dees-input-richtext class="composerInput" format="markdown" frameless auto-grow
|
|
1129
1167
|
.label=${this.t('thread.composer')} .labelPosition=${'none'} .placeholder=${placeholder}
|
|
1130
|
-
.minHeight=${128} .maxHeight=${360} .showWordCount=${false} .toolbar=${composerToolbar}
|
|
1131
|
-
.value=${bodyText(this.draft)}
|
|
1168
|
+
.minHeight=${this.view === 'composer' ? 64 : 128} .maxHeight=${360} .showWordCount=${false} .toolbar=${composerToolbar}
|
|
1169
|
+
.value=${bodyText(this.draft)} .searchReferences=${this.searchReferences}
|
|
1170
|
+
.referenceSearchLabel=${this.referenceSearchLabel}
|
|
1132
1171
|
@input=${(event: CustomEvent<{ value: string }>) => {
|
|
1133
1172
|
event.stopPropagation();
|
|
1134
1173
|
if (typeof event.detail?.value === 'string') this.updateDraft(event.detail.value);
|
|
1135
1174
|
}}
|
|
1136
1175
|
@change=${(event: Event) => event.stopPropagation()}
|
|
1176
|
+
@reference-open=${(event: CustomEvent<{ id: string; label: string }>) => {
|
|
1177
|
+
event.stopPropagation();
|
|
1178
|
+
this.openReference(event.detail.id, event.detail.label);
|
|
1179
|
+
}}
|
|
1137
1180
|
></dees-input-richtext>`}
|
|
1138
1181
|
${postError
|
|
1139
1182
|
? html`<p class="postError" role="alert"><dees-icon icon="lucide:CircleAlert" .iconSize=${14} aria-hidden="true"></dees-icon><span>${postError}</span></p>`
|
|
@@ -133,6 +133,12 @@ export type TThreadSubmit = (submission: IThreadSubmission) => unknown | Promise
|
|
|
133
133
|
/** What the composer writes: Markdown through `dees-input-richtext`, or references through `dees-input-reference`. */
|
|
134
134
|
export type TThreadFormat = 'markdown' | 'references';
|
|
135
135
|
|
|
136
|
+
/**
|
|
137
|
+
* What a thread shows: its timeline with the composer at its end (`full`), the timeline alone
|
|
138
|
+
* (`entries`), or the composer alone (`composer`), for a host that places the composer apart.
|
|
139
|
+
*/
|
|
140
|
+
export type TThreadView = 'full' | 'entries' | 'composer';
|
|
141
|
+
|
|
136
142
|
/** How a thread says when things happened: "3 hours ago", or the date and time. */
|
|
137
143
|
export type TThreadTimeFormat = 'relative' | 'absolute';
|
|
138
144
|
|
|
@@ -8,7 +8,8 @@ const maxCacheEntries = 200;
|
|
|
8
8
|
* An entry's Markdown as HTML, rendered as `dees-input-richtext` writes it and as text nobody vouches
|
|
9
9
|
* for: `richtextMarkdownRenderOptions` show HTML written into the text as text and images as links,
|
|
10
10
|
* and smartmarkdown drops unsafe link targets. Links open in a new context and never leak the
|
|
11
|
-
* opener
|
|
11
|
+
* opener; a link to `#reference:<id>` is a reference the thread opens itself (`class="reference"`,
|
|
12
|
+
* `data-reference`). Results are kept, least recently used first out, as a thread renders the same bodies again
|
|
12
13
|
* on every change.
|
|
13
14
|
*/
|
|
14
15
|
export const threadMarkdownHtml = (markdownArg: string): string | undefined => {
|
|
@@ -27,7 +28,9 @@ export const renderThreadMarkdown = async (markdownArg: string): Promise<string>
|
|
|
27
28
|
markdownArg,
|
|
28
29
|
richtextMarkdownRenderOptions,
|
|
29
30
|
);
|
|
30
|
-
const processed = rendered
|
|
31
|
+
const processed = rendered
|
|
32
|
+
.replaceAll('<a href="#reference:', '<a class="reference" data-reference href="#reference:')
|
|
33
|
+
.replaceAll('<a href=', '<a target="_blank" rel="noopener noreferrer" href=');
|
|
31
34
|
cache.set(markdownArg, processed);
|
|
32
35
|
if (cache.size > maxCacheEntries) {
|
|
33
36
|
const oldest = cache.keys().next().value;
|
|
@@ -302,8 +302,9 @@ export class DeesHarnessChat extends DeesElement {
|
|
|
302
302
|
@property({ reflect: true })
|
|
303
303
|
accessor mode: string = '';
|
|
304
304
|
|
|
305
|
+
/** Forwarded to the composer's `modeOptions`: plain strings, or labeled options with a tooltip. */
|
|
305
306
|
@property({ attribute: false })
|
|
306
|
-
accessor modeOptions: string
|
|
307
|
+
accessor modeOptions: Array<string | IHarnessComposerOption> = [];
|
|
307
308
|
|
|
308
309
|
/** Forwarded to the composer's `menuActions`: host commands in a "More options" menu beside Send. */
|
|
309
310
|
@property({ attribute: false })
|
|
@@ -41,6 +41,7 @@ import '../../00group-button/dees-button/dees-button.js';
|
|
|
41
41
|
import type { DeesButton } from '../../00group-button/dees-button/dees-button.js';
|
|
42
42
|
import { DeesContextmenu, type TContextMenuItem } from '../../00group-overlay/dees-contextmenu/dees-contextmenu.js';
|
|
43
43
|
import { DeesInputDropdown } from '../../00group-input/dees-input-dropdown/dees-input-dropdown.js';
|
|
44
|
+
import type { TMultitoggleOption } from '../../00group-input/dees-input-multitoggle/dees-input-multitoggle.js';
|
|
44
45
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
45
46
|
|
|
46
47
|
declare global {
|
|
@@ -55,6 +56,14 @@ const toDropdownOptions = (values: string[]): IDropdownOption[] =>
|
|
|
55
56
|
const toLabeledDropdownOptions = (values: IHarnessComposerOption[]): IDropdownOption[] =>
|
|
56
57
|
values.map((value) => ({ option: value.label, key: value.value, disabled: value.disabled, description: value.description }));
|
|
57
58
|
|
|
59
|
+
const modeOptionValue = (option: string | IHarnessComposerOption): string =>
|
|
60
|
+
typeof option === 'string' ? option : option.value;
|
|
61
|
+
|
|
62
|
+
const toModeToggleOptions = (values: Array<string | IHarnessComposerOption>): TMultitoggleOption[] =>
|
|
63
|
+
values.map((value) => typeof value === 'string'
|
|
64
|
+
? value
|
|
65
|
+
: { key: value.value, label: value.label, disabled: value.disabled, description: value.description });
|
|
66
|
+
|
|
58
67
|
let nextCommandMenuId = 0;
|
|
59
68
|
|
|
60
69
|
/** One row of the slash command menu: a command, or an option for a command's argument. */
|
|
@@ -340,13 +349,22 @@ export class DeesHarnessComposer extends DeesElement {
|
|
|
340
349
|
|
|
341
350
|
/**
|
|
342
351
|
* Agent mode switcher (e.g. Planning / Building). Renders a segmented
|
|
343
|
-
* control when modeOptions is set; emits harness-mode-change.
|
|
352
|
+
* control when modeOptions is set; emits harness-mode-change. `mode` is the
|
|
353
|
+
* chosen option's value.
|
|
344
354
|
*/
|
|
345
355
|
@property({ reflect: true })
|
|
346
356
|
accessor mode: string = '';
|
|
347
357
|
|
|
358
|
+
/**
|
|
359
|
+
* A plain string is its own label and value. A labeled option (`{ label, value }`) keeps
|
|
360
|
+
* `mode` independent of the language shown; its `description` is the segment's tooltip,
|
|
361
|
+
* such as what the mode still asks before acting, and `disabled` lists it unselectable.
|
|
362
|
+
*/
|
|
348
363
|
@property({ attribute: false })
|
|
349
|
-
accessor modeOptions: string
|
|
364
|
+
accessor modeOptions: Array<string | IHarnessComposerOption> = [];
|
|
365
|
+
|
|
366
|
+
/** The switch's options, rebuilt only with `modeOptions`, so typing never redraws the switch. */
|
|
367
|
+
private modeToggleOptions: TMultitoggleOption[] = [];
|
|
350
368
|
|
|
351
369
|
@property({ type: Boolean, reflect: true })
|
|
352
370
|
accessor showModelControls: boolean = true;
|
|
@@ -750,6 +768,7 @@ export class DeesHarnessComposer extends DeesElement {
|
|
|
750
768
|
// Another prompt or command list lists other entries: highlight the first completable one.
|
|
751
769
|
if (changedProperties.has('value') || changedProperties.has('commands')) this.activeMenuIndex = -1;
|
|
752
770
|
if (changedProperties.has('historyKey')) this.resetHistoryNavigation();
|
|
771
|
+
if (changedProperties.has('modeOptions')) this.modeToggleOptions = toModeToggleOptions(this.modeOptions);
|
|
753
772
|
}
|
|
754
773
|
|
|
755
774
|
public updated(changedProperties: Map<PropertyKey, unknown>): void {
|
|
@@ -834,7 +853,7 @@ export class DeesHarnessComposer extends DeesElement {
|
|
|
834
853
|
${this.modeOptions.length
|
|
835
854
|
? html`
|
|
836
855
|
<dees-input-multitoggle class="modeSwitch" label=${this.t('composer.mode')} .labelPosition=${'none'}
|
|
837
|
-
.options=${this.
|
|
856
|
+
.options=${this.modeToggleOptions} .selectedOption=${this.mode} .disabled=${this.interactionLocked}
|
|
838
857
|
@input=${(event: Event) => event.stopPropagation()}
|
|
839
858
|
@change=${(event: CustomEvent<{ value: string }>) => {
|
|
840
859
|
event.stopPropagation();
|
|
@@ -1112,8 +1131,12 @@ export class DeesHarnessComposer extends DeesElement {
|
|
|
1112
1131
|
// Shift+Tab cycles the agent mode without leaving the prompt
|
|
1113
1132
|
if (event.key === 'Tab' && event.shiftKey && this.modeOptions.length) {
|
|
1114
1133
|
event.preventDefault();
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1134
|
+
const modes = this.modeOptions
|
|
1135
|
+
.filter((option) => typeof option === 'string' || !option.disabled)
|
|
1136
|
+
.map(modeOptionValue);
|
|
1137
|
+
if (!modes.length) return;
|
|
1138
|
+
const nextMode = modes[(modes.indexOf(this.mode) + 1) % modes.length];
|
|
1139
|
+
if (nextMode === this.mode) return;
|
|
1117
1140
|
this.mode = nextMode;
|
|
1118
1141
|
this.emit('harness-mode-change', { mode: nextMode });
|
|
1119
1142
|
}
|
|
@@ -4,7 +4,8 @@ import { demoFunc } from './dees-input-multitoggle.demo.js';
|
|
|
4
4
|
import { themeDefaultStyles } from '../../00theme.js';
|
|
5
5
|
import '../../00group-utility/dees-icon/dees-icon.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/** A keyed option's `description` is its tooltip: what choosing it means. */
|
|
8
|
+
export type TMultitoggleOption = string | { key: string; label: string; disabled?: boolean; icon?: string; badge?: string | number; description?: string };
|
|
8
9
|
|
|
9
10
|
declare global {
|
|
10
11
|
interface HTMLElementTagNameMap { 'dees-input-multitoggle': DeesInputMultitoggle; }
|
|
@@ -100,7 +101,8 @@ export class DeesInputMultitoggle extends DeesInputBase<DeesInputMultitoggle> {
|
|
|
100
101
|
const key = this.optionKey(option); const label = this.optionLabel(option); const selected = key === this.selectedOption;
|
|
101
102
|
const icon = typeof option === 'string' ? undefined : option.icon;
|
|
102
103
|
const badge = typeof option === 'string' ? undefined : option.badge;
|
|
103
|
-
|
|
104
|
+
const description = typeof option === 'string' ? undefined : option.description;
|
|
105
|
+
return html`<button type="button" role="radio" class="option ${selected ? 'selected' : ''}" data-option=${label} .title=${description ?? ''}
|
|
104
106
|
aria-checked=${selected} ?disabled=${this.optionDisabled(option)} tabindex=${key === (typeof focusKey === 'object' ? focusKey.key : focusKey) ? 0 : -1}
|
|
105
107
|
@click=${() => this.handleSelection(key)} @keydown=${this.handleKeydown}><span class="option-content">${icon ? html`<dees-icon .icon=${icon} iconSize="14" aria-hidden="true"></dees-icon>` : ''}<span class="option-label">${label}</span>${badge !== undefined ? html`<span class="option-badge">${badge}</span>` : ''}</span></button>`;
|
|
106
108
|
})}
|