@tutti-os/ui-rich-text 0.0.12 → 0.0.13
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 +50 -57
- package/dist/at-panel/index.css +190 -0
- package/dist/at-panel/index.css.map +1 -0
- package/dist/at-panel/index.d.ts +63 -0
- package/dist/at-panel/index.js +1165 -0
- package/dist/at-panel/index.js.map +1 -0
- package/dist/at-panel/model.d.ts +386 -0
- package/dist/at-panel/model.js +39 -0
- package/dist/at-panel/model.js.map +1 -0
- package/dist/chunk-E4PWFY3N.js +264 -0
- package/dist/chunk-E4PWFY3N.js.map +1 -0
- package/dist/{chunk-K5POY2YJ.js → chunk-QK6NMNYN.js} +124 -46
- package/dist/chunk-QK6NMNYN.js.map +1 -0
- package/dist/{chunk-52PIIFZA.js → chunk-QOVFZUZN.js} +58 -49
- package/dist/chunk-QOVFZUZN.js.map +1 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/editor/index.d.ts +30 -13
- package/dist/editor/index.js +501 -171
- package/dist/editor/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{mention-QICvf4wE.d.ts → mention-CgUcsO8r.d.ts} +35 -19
- package/dist/plugins/index.d.ts +8 -8
- package/dist/plugins/index.js +8 -8
- package/dist/types/index.d.ts +36 -24
- package/package.json +17 -3
- package/dist/chunk-52PIIFZA.js.map +0 -1
- package/dist/chunk-K5POY2YJ.js.map +0 -1
package/README.md
CHANGED
|
@@ -47,100 +47,95 @@ Current refactor plan:
|
|
|
47
47
|
4. Keep domain-specific reference protocols in their owning packages and only
|
|
48
48
|
promote the generic rich-text seam here when it is truly host-agnostic.
|
|
49
49
|
|
|
50
|
-
## Mention
|
|
50
|
+
## Mention Protocol
|
|
51
51
|
|
|
52
|
-
The
|
|
52
|
+
The stable `@` mention storage protocol is provider-agnostic:
|
|
53
|
+
|
|
54
|
+
```md
|
|
55
|
+
[@Label](mention://provider-id/entity-id?workspaceId=ws_1)
|
|
56
|
+
```
|
|
53
57
|
|
|
54
58
|
Boundary split:
|
|
55
59
|
|
|
56
60
|
- the editor core owns trigger detection, selection state, keyboard handling,
|
|
57
61
|
insertion lifecycle, and storage shape
|
|
58
|
-
- the host
|
|
59
|
-
reverse resolution
|
|
62
|
+
- the host trigger provider owns query behavior, suggestion copy, insert
|
|
63
|
+
mapping, and reverse resolution
|
|
60
64
|
|
|
61
65
|
Stable stored attrs:
|
|
62
66
|
|
|
63
67
|
```ts
|
|
64
|
-
|
|
68
|
+
interface RichTextMentionAttrs {
|
|
65
69
|
trigger: "@";
|
|
66
|
-
|
|
70
|
+
providerId: string;
|
|
67
71
|
entityId: string;
|
|
68
72
|
label: string;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
meta?: Readonly<Record<string, string>>;
|
|
73
|
-
};
|
|
73
|
+
scope?: Readonly<Record<string, string>>;
|
|
74
|
+
presentation?: RichTextMentionPresentation;
|
|
75
|
+
}
|
|
74
76
|
```
|
|
75
77
|
|
|
76
78
|
Why this shape:
|
|
77
79
|
|
|
78
|
-
- `
|
|
80
|
+
- `providerId` identifies which host capability owns the token
|
|
79
81
|
- `entityId` is the durable identity and must not depend on visible copy
|
|
80
82
|
- `label` is the last rendered fallback text so readonly and indexing can still
|
|
81
83
|
work without a roundtrip
|
|
82
|
-
- `
|
|
83
|
-
|
|
84
|
+
- `scope` holds short identity fields needed to locate the entity
|
|
85
|
+
- `presentation` is editor-only display data and is not serialized to Markdown
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
Trigger provider contract:
|
|
86
88
|
|
|
87
89
|
```ts
|
|
88
|
-
interface
|
|
90
|
+
interface RichTextTriggerProvider<TItem = unknown> {
|
|
89
91
|
id: string;
|
|
90
|
-
trigger
|
|
92
|
+
trigger: RichTextTrigger;
|
|
93
|
+
boundary?: RichTextTriggerBoundary;
|
|
91
94
|
query: (
|
|
92
|
-
input:
|
|
95
|
+
input: RichTextTriggerQueryInput
|
|
93
96
|
) => Promise<readonly TItem[]> | readonly TItem[];
|
|
94
97
|
getItemKey: (item: TItem) => string;
|
|
95
98
|
getItemLabel: (item: TItem) => string;
|
|
96
99
|
getItemSubtitle?: (item: TItem) => string | null | undefined;
|
|
100
|
+
getItemThumbnailUrl?: (
|
|
101
|
+
item: TItem
|
|
102
|
+
) => string | null | undefined | Promise<string | null | undefined>;
|
|
97
103
|
getItemKeywords?: (item: TItem) => readonly string[] | undefined;
|
|
98
|
-
|
|
99
|
-
renderText?: (attrs: RichTextMentionAttrs) => string;
|
|
104
|
+
toInsertResult: (item: TItem) => RichTextTriggerInsertResult;
|
|
100
105
|
resolveMention?: (
|
|
101
|
-
|
|
102
|
-
) =>
|
|
103
|
-
| Promise<RichTextResolvedMention<TResolved>>
|
|
104
|
-
| RichTextResolvedMention<TResolved>;
|
|
106
|
+
identity: RichTextMentionIdentity
|
|
107
|
+
) => Promise<RichTextMentionResolved | null> | RichTextMentionResolved | null;
|
|
105
108
|
}
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
Interpretation:
|
|
109
112
|
|
|
110
|
-
- `query` decides what
|
|
113
|
+
- `query` decides what a trigger can mention
|
|
111
114
|
- `getItemLabel` and `getItemSubtitle` decide the suggestion copy
|
|
112
|
-
- `
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
resolved entity payload
|
|
115
|
+
- `toInsertResult` maps a chosen item into a mention, markdown-link, or text
|
|
116
|
+
insertion
|
|
117
|
+
- `resolveMention` restores editor-only label or presentation data from the
|
|
118
|
+
stored mention identity
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
Mention data:
|
|
119
121
|
|
|
120
122
|
```ts
|
|
121
|
-
|
|
123
|
+
interface RichTextMentionInsert {
|
|
124
|
+
entityId: string;
|
|
125
|
+
label: string;
|
|
126
|
+
scope?: Readonly<Record<string, string>>;
|
|
127
|
+
presentation?: RichTextMentionPresentation;
|
|
128
|
+
}
|
|
122
129
|
|
|
123
|
-
|
|
124
|
-
state: RichTextMentionRenderState;
|
|
130
|
+
interface RichTextMentionResolved {
|
|
125
131
|
label?: string;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
entity?: TResolved;
|
|
129
|
-
};
|
|
132
|
+
presentation?: RichTextMentionPresentation;
|
|
133
|
+
}
|
|
130
134
|
```
|
|
131
135
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- `missing` means the original resource no longer exists and should render in a
|
|
136
|
-
muted non-interactive style
|
|
137
|
-
- `disabled` means the resource still exists but the current host should not
|
|
138
|
-
allow normal interaction, for example because of permissions or product rules
|
|
139
|
-
- `loading` is a temporary host-controlled resolution state
|
|
140
|
-
|
|
141
|
-
This package intentionally keeps the public status model visual and generic.
|
|
142
|
-
Business-specific reasons such as deleted, archived, forbidden, or offline stay
|
|
143
|
-
inside the host plugin and collapse into one of the fixed render states above.
|
|
136
|
+
Markdown serialization includes only `providerId`, `entityId`, `label`, and
|
|
137
|
+
short `scope` fields. It does not serialize `presentation`, `href`, `kind`,
|
|
138
|
+
`version`, or arbitrary metadata.
|
|
144
139
|
|
|
145
140
|
Helpers now exported:
|
|
146
141
|
|
|
@@ -155,14 +150,12 @@ Helpers now exported:
|
|
|
155
150
|
|
|
156
151
|
Runtime surfaces now exported:
|
|
157
152
|
|
|
158
|
-
- `
|
|
153
|
+
- `RichTextTriggerTextarea`
|
|
159
154
|
- `RichTextMentionReadonly`
|
|
160
155
|
|
|
161
156
|
Current runtime behavior:
|
|
162
157
|
|
|
163
|
-
- the registry aggregates multiple
|
|
164
|
-
- query results are flattened into a shared result shape
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
- readonly rendering maps the resolved state into one fixed visual shape family
|
|
168
|
-
with overridable labels, tooltips, and click handling
|
|
158
|
+
- the registry aggregates multiple trigger providers in declaration order
|
|
159
|
+
- query results are flattened into a shared result shape
|
|
160
|
+
- mention hydration uses `resolveMention` when the owning trigger provider is
|
|
161
|
+
available and keeps the label-only fallback when it is not
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/* src/at-panel/mentionPalette.css */
|
|
2
|
+
.rich-text-at-mention-palette-scroll-region {
|
|
3
|
+
scrollbar-width: none !important;
|
|
4
|
+
-ms-overflow-style: none !important;
|
|
5
|
+
scrollbar-gutter: auto;
|
|
6
|
+
}
|
|
7
|
+
.rich-text-at-mention-palette-scroll-region::-webkit-scrollbar {
|
|
8
|
+
display: none !important;
|
|
9
|
+
width: 0 !important;
|
|
10
|
+
height: 0 !important;
|
|
11
|
+
}
|
|
12
|
+
.rich-text-at-mention-palette-scrollbar {
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 4px;
|
|
15
|
+
right: 4px;
|
|
16
|
+
bottom: 4px;
|
|
17
|
+
width: 4px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
opacity: 0;
|
|
20
|
+
pointer-events: auto;
|
|
21
|
+
transition: opacity 160ms ease-in-out;
|
|
22
|
+
}
|
|
23
|
+
.rich-text-at-mention-palette-scrollbar-thumb {
|
|
24
|
+
width: 4px;
|
|
25
|
+
min-height: 24px;
|
|
26
|
+
border-radius: 999px;
|
|
27
|
+
background: var(--transparency-block);
|
|
28
|
+
cursor: grab;
|
|
29
|
+
transition: background-color 160ms ease-in-out;
|
|
30
|
+
will-change: transform;
|
|
31
|
+
}
|
|
32
|
+
.rich-text-at-mention-palette-scrollbar:hover .rich-text-at-mention-palette-scrollbar-thumb {
|
|
33
|
+
background: var(--transparency-hover);
|
|
34
|
+
}
|
|
35
|
+
.rich-text-at-mention-palette-scrollbar[data-dragging=true] {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|
|
38
|
+
.rich-text-at-mention-palette-scrollbar[data-dragging=true] .rich-text-at-mention-palette-scrollbar-thumb {
|
|
39
|
+
background: var(--transparency-hover);
|
|
40
|
+
cursor: grabbing;
|
|
41
|
+
}
|
|
42
|
+
.rich-text-at-mention-palette {
|
|
43
|
+
container-type: inline-size;
|
|
44
|
+
}
|
|
45
|
+
.tsh-underline-tabs.rich-text-at-mention-palette-tabs {
|
|
46
|
+
height: 41px;
|
|
47
|
+
padding: 8px 16px 0;
|
|
48
|
+
}
|
|
49
|
+
.rich-text-at-mention-palette-header {
|
|
50
|
+
padding: 8px 0 0;
|
|
51
|
+
}
|
|
52
|
+
.rich-text-at-mention-palette-footer {
|
|
53
|
+
min-height: 36px;
|
|
54
|
+
border-top: 1px solid var(--line-2, var(--tutti-line-2));
|
|
55
|
+
background: var(--background-fronted, var(--background-panel));
|
|
56
|
+
}
|
|
57
|
+
.rich-text-at-mention-palette-hint {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: flex-end;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 36px;
|
|
64
|
+
padding: 0 16px 1px;
|
|
65
|
+
color: var(--agent-gui-text-secondary, var(--text-secondary));
|
|
66
|
+
font-size: 13px;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
line-height: 20px;
|
|
69
|
+
pointer-events: auto;
|
|
70
|
+
}
|
|
71
|
+
.rich-text-at-mention-palette-hint-item {
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 5px;
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
}
|
|
77
|
+
.rich-text-at-mention-palette-hint-button,
|
|
78
|
+
.rich-text-at-mention-palette-shortcut-button {
|
|
79
|
+
appearance: none;
|
|
80
|
+
border: 0;
|
|
81
|
+
font: inherit;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
}
|
|
84
|
+
.rich-text-at-mention-palette-hint-button {
|
|
85
|
+
padding: 0;
|
|
86
|
+
background: transparent;
|
|
87
|
+
color: inherit;
|
|
88
|
+
}
|
|
89
|
+
.rich-text-at-mention-palette-shortcut {
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
height: 20px;
|
|
94
|
+
min-width: 20px;
|
|
95
|
+
border-radius: 4px;
|
|
96
|
+
background: color-mix(in srgb, var(--transparency-block) 72%, transparent);
|
|
97
|
+
color: var(--agent-gui-text-secondary, var(--text-secondary));
|
|
98
|
+
font-size: 13px;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
line-height: 1;
|
|
101
|
+
padding: 4px 6px;
|
|
102
|
+
}
|
|
103
|
+
.rich-text-at-mention-palette-hint-button:hover .rich-text-at-mention-palette-shortcut,
|
|
104
|
+
.rich-text-at-mention-palette-hint-button:focus-visible .rich-text-at-mention-palette-shortcut,
|
|
105
|
+
.rich-text-at-mention-palette-shortcut-button:hover,
|
|
106
|
+
.rich-text-at-mention-palette-shortcut-button:focus-visible {
|
|
107
|
+
background: var(--transparency-block);
|
|
108
|
+
}
|
|
109
|
+
.rich-text-at-mention-palette-hint-button:focus-visible,
|
|
110
|
+
.rich-text-at-mention-palette-shortcut-button:focus-visible {
|
|
111
|
+
outline: 2px solid var(--line-1);
|
|
112
|
+
outline-offset: 2px;
|
|
113
|
+
}
|
|
114
|
+
.rich-text-at-mention-palette-shortcut--arrow {
|
|
115
|
+
width: 20px;
|
|
116
|
+
min-width: 20px;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
line-height: 1;
|
|
119
|
+
padding: 0;
|
|
120
|
+
}
|
|
121
|
+
.rich-text-at-mention-palette-shortcut-group {
|
|
122
|
+
display: inline-flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: 5px;
|
|
125
|
+
}
|
|
126
|
+
.rich-text-at-mention-palette-hint-separator {
|
|
127
|
+
color: var(--line-2, var(--tutti-line-2));
|
|
128
|
+
}
|
|
129
|
+
.rich-text-at-mention-palette:hover .rich-text-at-mention-palette-scrollbar[data-scrollable=true] {
|
|
130
|
+
opacity: 1;
|
|
131
|
+
}
|
|
132
|
+
.rich-text-at-mention-palette {
|
|
133
|
+
--agent-mention-file-icon-size: 16px;
|
|
134
|
+
}
|
|
135
|
+
.rich-text-at-mention-file-thumb {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
width: var(--agent-mention-file-icon-size, 16px);
|
|
140
|
+
height: var(--agent-mention-file-icon-size, 16px);
|
|
141
|
+
flex: 0 0 var(--agent-mention-file-icon-size, 16px);
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
border-radius: 4px;
|
|
144
|
+
background-color: var(--bg-block, var(--block));
|
|
145
|
+
vertical-align: middle;
|
|
146
|
+
}
|
|
147
|
+
.rich-text-at-mention-file-thumb img {
|
|
148
|
+
display: block;
|
|
149
|
+
width: 100%;
|
|
150
|
+
height: 100%;
|
|
151
|
+
object-fit: cover;
|
|
152
|
+
}
|
|
153
|
+
.rich-text-at-mention-file-icon {
|
|
154
|
+
width: var(--agent-mention-file-icon-size, 16px);
|
|
155
|
+
height: var(--agent-mention-file-icon-size, 16px);
|
|
156
|
+
flex: 0 0 var(--agent-mention-file-icon-size, 16px);
|
|
157
|
+
background-color: var(--folder);
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
}
|
|
160
|
+
.rich-text-at-mention-kind-icon {
|
|
161
|
+
display: block;
|
|
162
|
+
width: 16px;
|
|
163
|
+
height: 16px;
|
|
164
|
+
flex: 0 0 16px;
|
|
165
|
+
background-color: currentColor;
|
|
166
|
+
border-radius: 22.5%;
|
|
167
|
+
}
|
|
168
|
+
.rich-text-at-mention-avatar-img--user-placeholder {
|
|
169
|
+
background-color: var(--muted);
|
|
170
|
+
}
|
|
171
|
+
[data-workspace-app-icon=true] {
|
|
172
|
+
display: inline-grid;
|
|
173
|
+
min-width: 0;
|
|
174
|
+
min-height: 0;
|
|
175
|
+
place-items: center;
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
border-radius: 22.5%;
|
|
178
|
+
background: var(--workspace-app-icon-bg, transparent);
|
|
179
|
+
}
|
|
180
|
+
[data-workspace-app-icon=true] > img {
|
|
181
|
+
display: block;
|
|
182
|
+
width: 100%;
|
|
183
|
+
height: 100%;
|
|
184
|
+
object-fit: cover;
|
|
185
|
+
object-position: center;
|
|
186
|
+
}
|
|
187
|
+
[data-workspace-app-icon=true] > .rich-text-at-mention-kind-icon {
|
|
188
|
+
display: block;
|
|
189
|
+
}
|
|
190
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/at-panel/mentionPalette.css"],"sourcesContent":[".rich-text-at-mention-palette-scroll-region {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n scrollbar-gutter: auto;\n}\n\n.rich-text-at-mention-palette-scroll-region::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.rich-text-at-mention-palette-scrollbar {\n position: absolute;\n top: 4px;\n right: 4px;\n bottom: 4px;\n width: 4px;\n cursor: pointer;\n opacity: 0;\n pointer-events: auto;\n transition: opacity 160ms ease-in-out;\n}\n\n.rich-text-at-mention-palette-scrollbar-thumb {\n width: 4px;\n min-height: 24px;\n border-radius: 999px;\n background: var(--transparency-block);\n cursor: grab;\n transition: background-color 160ms ease-in-out;\n will-change: transform;\n}\n\n.rich-text-at-mention-palette-scrollbar:hover\n .rich-text-at-mention-palette-scrollbar-thumb {\n background: var(--transparency-hover);\n}\n\n.rich-text-at-mention-palette-scrollbar[data-dragging=\"true\"] {\n opacity: 1;\n}\n\n.rich-text-at-mention-palette-scrollbar[data-dragging=\"true\"]\n .rich-text-at-mention-palette-scrollbar-thumb {\n background: var(--transparency-hover);\n cursor: grabbing;\n}\n\n.rich-text-at-mention-palette {\n container-type: inline-size;\n}\n\n.tsh-underline-tabs.rich-text-at-mention-palette-tabs {\n height: 41px;\n padding: 8px 16px 0;\n}\n\n.rich-text-at-mention-palette-header {\n padding: 8px 0 0;\n}\n\n.rich-text-at-mention-palette-footer {\n min-height: 36px;\n border-top: 1px solid var(--line-2, var(--tutti-line-2));\n background: var(--background-fronted, var(--background-panel));\n}\n\n.rich-text-at-mention-palette-hint {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n width: 100%;\n height: 36px;\n padding: 0 16px 1px;\n color: var(--agent-gui-text-secondary, var(--text-secondary));\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n pointer-events: auto;\n}\n\n.rich-text-at-mention-palette-hint-item {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n white-space: nowrap;\n}\n\n.rich-text-at-mention-palette-hint-button,\n.rich-text-at-mention-palette-shortcut-button {\n appearance: none;\n border: 0;\n font: inherit;\n cursor: pointer;\n}\n\n.rich-text-at-mention-palette-hint-button {\n padding: 0;\n background: transparent;\n color: inherit;\n}\n\n.rich-text-at-mention-palette-shortcut {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: 20px;\n min-width: 20px;\n border-radius: 4px;\n background: color-mix(in srgb, var(--transparency-block) 72%, transparent);\n color: var(--agent-gui-text-secondary, var(--text-secondary));\n font-size: 13px;\n font-weight: 600;\n line-height: 1;\n padding: 4px 6px;\n}\n\n.rich-text-at-mention-palette-hint-button:hover\n .rich-text-at-mention-palette-shortcut,\n.rich-text-at-mention-palette-hint-button:focus-visible\n .rich-text-at-mention-palette-shortcut,\n.rich-text-at-mention-palette-shortcut-button:hover,\n.rich-text-at-mention-palette-shortcut-button:focus-visible {\n background: var(--transparency-block);\n}\n\n.rich-text-at-mention-palette-hint-button:focus-visible,\n.rich-text-at-mention-palette-shortcut-button:focus-visible {\n outline: 2px solid var(--line-1);\n outline-offset: 2px;\n}\n\n.rich-text-at-mention-palette-shortcut--arrow {\n width: 20px;\n min-width: 20px;\n font-size: 13px;\n line-height: 1;\n padding: 0;\n}\n\n.rich-text-at-mention-palette-shortcut-group {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n}\n\n.rich-text-at-mention-palette-hint-separator {\n color: var(--line-2, var(--tutti-line-2));\n}\n\n.rich-text-at-mention-palette:hover\n .rich-text-at-mention-palette-scrollbar[data-scrollable=\"true\"] {\n opacity: 1;\n}\n\n.rich-text-at-mention-palette {\n --agent-mention-file-icon-size: 16px;\n}\n\n/*\n * Structural styling for the shared MentionRow elements. These mirror the\n * agent composer's rules (in `agentactivity.css`) under package-owned\n * `rich-text-at-mention-*` class names so any consumer (e.g. issue-manager)\n * that does NOT load the agent stylesheet still renders styled rows. The agent\n * keeps passing its own class names via `renderMentionRow(item, classNames)`.\n */\n.rich-text-at-mention-file-thumb {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--agent-mention-file-icon-size, 16px);\n height: var(--agent-mention-file-icon-size, 16px);\n flex: 0 0 var(--agent-mention-file-icon-size, 16px);\n overflow: hidden;\n border-radius: 4px;\n background-color: var(--bg-block, var(--block));\n vertical-align: middle;\n}\n\n.rich-text-at-mention-file-thumb img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n/*\n * NOTE: the masked file kind-icon glyph and the fallback app glyph need raw SVG\n * mask assets. Those cannot live in this package (the `check-ui-boundaries`\n * gate restricts raw .svg assets to `packages/ui/system/src/icons/`), so only\n * the structural box (size/layout) is owned here. The agent composer supplies\n * its own masked glyph rules via `agentactivity.css` + its own class names. The\n * issue-manager file glyph + app fallback glyph are completed in Phases 3-4.\n */\n.rich-text-at-mention-file-icon {\n width: var(--agent-mention-file-icon-size, 16px);\n height: var(--agent-mention-file-icon-size, 16px);\n flex: 0 0 var(--agent-mention-file-icon-size, 16px);\n background-color: var(--folder);\n border-radius: 4px;\n}\n\n/* Fallback app glyph box (shown when a workspace-app mention has no icon URL). */\n.rich-text-at-mention-kind-icon {\n display: block;\n width: 16px;\n height: 16px;\n flex: 0 0 16px;\n background-color: currentColor;\n border-radius: 22.5%;\n}\n\n/* Session user-avatar placeholder background (no avatar URL). */\n.rich-text-at-mention-avatar-img--user-placeholder {\n background-color: var(--muted);\n}\n\n/*\n * Workspace-app icon container. Data-attribute based (matches the agent's\n * global rule) so the rounded app icon renders for any consumer of the shared\n * row, including surfaces that do not load `agentactivity.css`.\n */\n[data-workspace-app-icon=\"true\"] {\n display: inline-grid;\n min-width: 0;\n min-height: 0;\n place-items: center;\n overflow: hidden;\n border-radius: 22.5%;\n background: var(--workspace-app-icon-bg, transparent);\n}\n\n[data-workspace-app-icon=\"true\"] > img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n}\n\n[data-workspace-app-icon=\"true\"] > .rich-text-at-mention-kind-icon {\n display: block;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { MentionPaletteProps, MentionRowItem } from './model.js';
|
|
2
|
+
export { DEFAULT_RICH_TEXT_AT_PANEL_PAGE_SIZE, MentionFileVisualKind, MentionFileVisualKindInput, MentionPaletteCategory, MentionPaletteEntry, MentionPaletteFilterId, MentionPaletteGroup, MentionPaletteGroupId, MentionPaletteState, MentionPaletteTheme, MentionRowAppFactoryItem, MentionRowAppItem, MentionRowFileItem, MentionRowIssueItem, MentionRowSessionItem, MentionRowStatusTag, MentionRowStatusTone, MentionRowStatusVariant, RICH_TEXT_AT_ALL_FILTER_ID, RichTextAtFilterId, RichTextAtFilterTab, RichTextAtGroupId, RichTextAtSearchGroup, RichTextTriggerProviderGroup, activityMentionStatusBadgeClassName, activityMentionStatusTone, buildDefaultRichTextTriggerProviderGroups, buildMentionPaletteState, buildRichTextAtFilterTabs, findRichTextTriggerProviderGroup, flattenMentionPaletteEntries, groupRichTextAtMatches, issueMentionStatusBadgeClassName, issueMentionStatusTone, mentionStatusBadgeClassName, normalizeAtPanelQuery, resolveMentionFileThumbnailUrl, resolveMentionFileVisualKind, richTextAtGroupExpandCount } from './model.js';
|
|
3
|
+
import { JSX } from 'react';
|
|
4
|
+
import '../types/index.js';
|
|
5
|
+
import '../mention-CgUcsO8r.js';
|
|
6
|
+
|
|
7
|
+
declare function MentionPalette<TItem>(props: MentionPaletteProps<TItem>): JSX.Element;
|
|
8
|
+
|
|
9
|
+
type MentionRowDataAttributeMode = "shared" | "agent";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Structural class-name hooks for the elements a {@link MentionRow} renders that
|
|
13
|
+
* rely on a stylesheet (file icon/thumb, the app fallback kind-icon, and the
|
|
14
|
+
* session avatar placeholder modifier). Every key is optional and defaults to a
|
|
15
|
+
* PACKAGE-OWNED `rich-text-at-mention-*` class whose CSS ships with
|
|
16
|
+
* `mentionPalette.css`, so any consumer renders styled rows out of the box.
|
|
17
|
+
*
|
|
18
|
+
* Surfaces with their own stylesheet (e.g. the agent composer) pass their exact
|
|
19
|
+
* existing class names here so their rendered DOM stays byte-identical.
|
|
20
|
+
*/
|
|
21
|
+
interface MentionRowClassNames {
|
|
22
|
+
/** The masked file kind-icon `<span>`. */
|
|
23
|
+
fileIcon?: string;
|
|
24
|
+
/** The image-thumbnail wrapper `<span>` (rendered for image files). */
|
|
25
|
+
fileThumb?: string;
|
|
26
|
+
/** The fallback app icon glyph rendered when no `iconUrl` is present. */
|
|
27
|
+
kindIcon?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Modifier class added to the session user avatar `<img>` when the user has no
|
|
30
|
+
* avatar URL and the placeholder asset is shown.
|
|
31
|
+
*/
|
|
32
|
+
avatarImgUserPlaceholder?: string;
|
|
33
|
+
}
|
|
34
|
+
interface MentionRowRenderOptions {
|
|
35
|
+
classNames?: MentionRowClassNames;
|
|
36
|
+
dataAttributeMode?: MentionRowDataAttributeMode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Render the inner content of a single `@`-mention palette row from a
|
|
40
|
+
* fully-resolved {@link MentionRowItem}. The surrounding option button / active
|
|
41
|
+
* state is provided by the shared `MentionPalette` shell; this renders only the
|
|
42
|
+
* row body.
|
|
43
|
+
*
|
|
44
|
+
* Pass {@link classNames} to override the package-owned structural class hooks
|
|
45
|
+
* (e.g. so the agent composer keeps emitting its own stylesheet's class names).
|
|
46
|
+
*/
|
|
47
|
+
declare function renderMentionRow(item: MentionRowItem, options?: MentionRowClassNames | MentionRowRenderOptions): React.ReactNode;
|
|
48
|
+
|
|
49
|
+
interface AtPanelKeyboardActions {
|
|
50
|
+
moveSelection: (delta: 1 | -1) => void;
|
|
51
|
+
commitSelection: () => void;
|
|
52
|
+
close: () => void;
|
|
53
|
+
cycleFilter?: (delta: 1 | -1) => void;
|
|
54
|
+
}
|
|
55
|
+
interface AtPanelKeyboardEventLike {
|
|
56
|
+
key: string;
|
|
57
|
+
shiftKey?: boolean;
|
|
58
|
+
preventDefault: () => void;
|
|
59
|
+
}
|
|
60
|
+
declare function makeAtPanelKeyDown(actions: AtPanelKeyboardActions): (event: AtPanelKeyboardEventLike) => boolean;
|
|
61
|
+
declare function useAtPanelKeyboard(actions: AtPanelKeyboardActions): (event: AtPanelKeyboardEventLike) => boolean;
|
|
62
|
+
|
|
63
|
+
export { type AtPanelKeyboardActions, type AtPanelKeyboardEventLike, MentionPalette, MentionPaletteProps, type MentionRowClassNames, type MentionRowDataAttributeMode, MentionRowItem, type MentionRowRenderOptions, makeAtPanelKeyDown, renderMentionRow, useAtPanelKeyboard };
|