@40rty/ams-ui 0.5.4 → 0.5.6
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/{chunk-2QRYXSCB.js → chunk-CKNELL6G.js} +582 -823
- package/dist/{chunk-JQNZ5UUK.js → chunk-I5QE47QY.js} +12 -41
- package/dist/chunk-WDL5PHO2.js +36 -0
- package/dist/chunk-WVD2Y2N2.js +318 -0
- package/dist/conversation.js +10 -7
- package/dist/css/shell/spacefront-island.css +113 -74
- package/dist/index.js +12 -12
- package/dist/island.js +80 -51
- package/dist/shell.js +19 -11
- package/dist/types/catalog-data/content.d.ts +16 -16
- package/dist/types/catalog-data/ecommerce.d.ts +88 -88
- package/dist/types/catalog-data/social.d.ts +28 -28
- package/dist/types/conversation/blocks/schemas.d.ts +72 -72
- package/dist/types/shell/SpacefrontIsland.d.ts +13 -10
- package/dist/types/shell/index.d.ts +1 -1
- package/dist/types/shell/mobile/MorphIsland.d.ts +1 -1
- package/dist/types/shell/mobile/{hero-entry-point.d.ts → entry-point.d.ts} +35 -14
- package/dist/types/shell/mobile/island-metrics.d.ts +1 -1
- package/dist/types/shell/use-scroll-edges.d.ts +15 -0
- package/package.json +2 -2
|
@@ -7,7 +7,16 @@
|
|
|
7
7
|
HOST-PROOF. Every element is reset by `.fourty-si :is(…)` (0,1,1), which
|
|
8
8
|
beats a host's element globals (`input`, `form button`), and every rule
|
|
9
9
|
below is `.fourty-si .fourty-si__x` (0,2,0), which beats the reset and any
|
|
10
|
-
host rule short of two classes. The tests pin both numbers.
|
|
10
|
+
host rule short of two classes. The tests pin both numbers. The shared
|
|
11
|
+
composer controls (attach, dictation, the attachment strip) sit in a
|
|
12
|
+
`.fourty-si__tool` and are left out of the reset — through `:where`, so the
|
|
13
|
+
reset's specificity does not move — because they style themselves inline
|
|
14
|
+
and their glyphs draw with inherited SVG properties a reset would erase.
|
|
15
|
+
|
|
16
|
+
THE SHAPE is the spacefront's own page composer: follow-up chips over one
|
|
17
|
+
frosted bar that never folds away — answer line, then attach · field ·
|
|
18
|
+
dictation · send; while the agent works the field gives way to its
|
|
19
|
+
activity line.
|
|
11
20
|
|
|
12
21
|
Themed ONLY through custom properties. The SHARED shell tokens come first —
|
|
13
22
|
the island, `thread-panel.css` and `presence.css` all read them, so a store
|
|
@@ -19,29 +28,36 @@
|
|
|
19
28
|
--fourty-radius (16px) corner
|
|
20
29
|
--fourty-font-family (inherit)
|
|
21
30
|
Each island property below falls back to its shared token:
|
|
22
|
-
--fourty-island-surface (
|
|
31
|
+
--fourty-island-surface (surface at 78%, frosted)
|
|
32
|
+
--fourty-island-blur (24px) the frost behind the bar
|
|
23
33
|
--fourty-island-fg (--fourty-fg)
|
|
24
34
|
--fourty-island-radius (--fourty-radius)
|
|
25
|
-
--fourty-island-edge (1px
|
|
26
|
-
--fourty-island-shadow (
|
|
27
|
-
--fourty-island-
|
|
28
|
-
--fourty-island-
|
|
35
|
+
--fourty-island-edge (1px surface at 60%)
|
|
36
|
+
--fourty-island-shadow (0 12px 40px, 18% black)
|
|
37
|
+
--fourty-island-send-surface (fg) the send button
|
|
38
|
+
--fourty-island-send-fg (surface)
|
|
39
|
+
--fourty-island-mark (fg) the working dots
|
|
29
40
|
--fourty-island-accent (--fourty-accent)
|
|
30
41
|
--fourty-island-accent-fg (--fourty-accent-fg)
|
|
31
42
|
--fourty-island-error (#b42318)
|
|
32
43
|
--fourty-island-font-family (--fourty-font-family)
|
|
33
44
|
--fourty-island-offset-bottom (16px) clears a host bottom bar
|
|
34
45
|
--fourty-island-inset-left / -right (0) the column, container="viewport"
|
|
35
|
-
--fourty-island-max-width (
|
|
46
|
+
--fourty-island-max-width (920px)
|
|
36
47
|
--fourty-island-z-index (40)
|
|
37
48
|
============================================================================ */
|
|
38
49
|
|
|
39
50
|
.fourty-si {
|
|
40
|
-
--
|
|
51
|
+
--_base: var(--fourty-surface, #fff);
|
|
52
|
+
--_surface: var(--fourty-island-surface, color-mix(in srgb, var(--_base) 78%, transparent));
|
|
41
53
|
--_fg: var(--fourty-island-fg, var(--fourty-fg, #111));
|
|
42
54
|
--_accent: var(--fourty-island-accent, var(--fourty-accent, var(--_fg)));
|
|
43
|
-
--_accent-fg: var(--fourty-island-accent-fg, var(--fourty-accent-fg, var(--
|
|
55
|
+
--_accent-fg: var(--fourty-island-accent-fg, var(--fourty-accent-fg, var(--_base)));
|
|
44
56
|
--_ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
57
|
+
/* The shared attach / dictation controls ink themselves from these; the
|
|
58
|
+
bar's own ink, not the page's muted text (a dark brand's is near-white). */
|
|
59
|
+
--fourty-attach-color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
60
|
+
--fourty-mic-idle: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
45
61
|
position: fixed;
|
|
46
62
|
left: var(--fourty-island-inset-left, 0);
|
|
47
63
|
right: var(--fourty-island-inset-right, 0);
|
|
@@ -66,7 +82,7 @@
|
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
/* The reset — the host's element globals stop here. */
|
|
69
|
-
.fourty-si :is(div, p, form, button, input, svg) {
|
|
85
|
+
.fourty-si :is(div, p, form, button, input, textarea, svg):where(:not(.fourty-si__tool, .fourty-si__tool *)) {
|
|
70
86
|
all: unset;
|
|
71
87
|
box-sizing: border-box;
|
|
72
88
|
}
|
|
@@ -77,9 +93,9 @@
|
|
|
77
93
|
|
|
78
94
|
.fourty-si .fourty-si__stack {
|
|
79
95
|
display: grid;
|
|
80
|
-
gap:
|
|
96
|
+
gap: 10px;
|
|
81
97
|
width: 100%;
|
|
82
|
-
max-width: var(--fourty-island-max-width,
|
|
98
|
+
max-width: var(--fourty-island-max-width, 920px);
|
|
83
99
|
pointer-events: auto;
|
|
84
100
|
animation: fourty-si-in 220ms var(--_ease);
|
|
85
101
|
}
|
|
@@ -95,36 +111,38 @@
|
|
|
95
111
|
.fourty-si .fourty-si__chips {
|
|
96
112
|
display: flex;
|
|
97
113
|
flex-wrap: wrap;
|
|
98
|
-
justify-content: center;
|
|
99
114
|
gap: 8px;
|
|
100
115
|
}
|
|
101
116
|
.fourty-si .fourty-si__chip {
|
|
102
|
-
padding:
|
|
103
|
-
border: 1px solid color-mix(in srgb, var(--_fg)
|
|
117
|
+
padding: 6px 14px;
|
|
118
|
+
border: 1px solid color-mix(in srgb, var(--_fg) 18%, transparent);
|
|
104
119
|
border-radius: 999px;
|
|
105
|
-
background: var(--
|
|
120
|
+
background: var(--_base);
|
|
121
|
+
font-size: 13px;
|
|
122
|
+
box-shadow: 0 4px 14px rgb(0 0 0 / 0.08);
|
|
106
123
|
cursor: pointer;
|
|
107
124
|
transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
|
|
108
125
|
}
|
|
109
126
|
|
|
127
|
+
/* The bar — frosted, so the page reads under it. */
|
|
110
128
|
.fourty-si .fourty-si__slab {
|
|
111
129
|
display: flex;
|
|
112
130
|
flex-direction: column;
|
|
113
131
|
overflow: hidden;
|
|
114
132
|
border-radius: var(--fourty-island-radius, var(--fourty-radius, 16px));
|
|
115
133
|
background: var(--_surface);
|
|
134
|
+
-webkit-backdrop-filter: blur(var(--fourty-island-blur, 24px)) saturate(1.5);
|
|
135
|
+
backdrop-filter: blur(var(--fourty-island-blur, 24px)) saturate(1.5);
|
|
116
136
|
box-shadow:
|
|
117
|
-
var(--fourty-island-edge, 0 0 0 1px color-mix(in srgb, var(--
|
|
118
|
-
var(--fourty-island-shadow, 0
|
|
119
|
-
0 6px 16px -4px color-mix(in srgb, var(--_fg) 26%, transparent),
|
|
120
|
-
0 20px 44px -12px color-mix(in srgb, var(--_fg) 36%, transparent));
|
|
137
|
+
var(--fourty-island-edge, 0 0 0 1px color-mix(in srgb, var(--_base) 60%, transparent)),
|
|
138
|
+
var(--fourty-island-shadow, 0 12px 40px rgb(0 0 0 / 0.18));
|
|
121
139
|
}
|
|
122
140
|
|
|
123
141
|
/* The grip — the rulebook's shallow up-chevron, turned over while the thread is open. */
|
|
124
142
|
.fourty-si .fourty-si__grip {
|
|
125
143
|
display: flex;
|
|
126
144
|
justify-content: center;
|
|
127
|
-
padding: 8px 0;
|
|
145
|
+
padding: 8px 0 2px;
|
|
128
146
|
cursor: pointer;
|
|
129
147
|
}
|
|
130
148
|
.fourty-si .fourty-si__chevron {
|
|
@@ -132,25 +150,30 @@
|
|
|
132
150
|
width: 32px;
|
|
133
151
|
height: 5px;
|
|
134
152
|
overflow: visible;
|
|
135
|
-
color: color-mix(in srgb, var(--_fg) 42%,
|
|
153
|
+
color: color-mix(in srgb, var(--_fg) 42%, transparent);
|
|
136
154
|
transition: transform 220ms var(--_ease);
|
|
137
155
|
}
|
|
138
156
|
.fourty-si .fourty-si__grip[aria-expanded='true'] .fourty-si__chevron {
|
|
139
157
|
transform: rotate(180deg);
|
|
140
158
|
}
|
|
141
159
|
|
|
142
|
-
|
|
160
|
+
/* The answer line on top of the field. */
|
|
161
|
+
.fourty-si .fourty-si__answer {
|
|
143
162
|
display: block;
|
|
144
|
-
padding:
|
|
163
|
+
padding: 8px 16px 0;
|
|
145
164
|
}
|
|
146
165
|
.fourty-si .fourty-si__latest {
|
|
147
166
|
display: -webkit-box;
|
|
148
167
|
-webkit-box-orient: vertical;
|
|
149
168
|
-webkit-line-clamp: 2;
|
|
150
169
|
overflow: hidden;
|
|
151
|
-
color: color-mix(in srgb, var(--_fg)
|
|
170
|
+
color: color-mix(in srgb, var(--_fg) 78%, transparent);
|
|
152
171
|
cursor: pointer;
|
|
153
172
|
}
|
|
173
|
+
.fourty-si .fourty-si__headline {
|
|
174
|
+
font-weight: 600;
|
|
175
|
+
color: var(--_fg);
|
|
176
|
+
}
|
|
154
177
|
.fourty-si .fourty-si__muted {
|
|
155
178
|
display: block;
|
|
156
179
|
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
@@ -164,7 +187,7 @@
|
|
|
164
187
|
gap: 12px;
|
|
165
188
|
max-height: 16rem;
|
|
166
189
|
overflow-y: auto;
|
|
167
|
-
padding-bottom:
|
|
190
|
+
padding-bottom: 4px;
|
|
168
191
|
overscroll-behavior: contain;
|
|
169
192
|
}
|
|
170
193
|
.fourty-si .fourty-si__turn {
|
|
@@ -178,33 +201,69 @@
|
|
|
178
201
|
color: color-mix(in srgb, var(--_fg) 55%, transparent);
|
|
179
202
|
}
|
|
180
203
|
|
|
181
|
-
/*
|
|
182
|
-
.fourty-si .fourty-si__working {
|
|
183
|
-
display: block;
|
|
184
|
-
color: transparent;
|
|
185
|
-
background: linear-gradient(100deg,
|
|
186
|
-
color-mix(in srgb, var(--_fg) 45%, transparent) 40%,
|
|
187
|
-
var(--_fg) 50%,
|
|
188
|
-
color-mix(in srgb, var(--_fg) 45%, transparent) 60%) 0 0 / 250% 100%;
|
|
189
|
-
-webkit-background-clip: text;
|
|
190
|
-
background-clip: text;
|
|
191
|
-
animation: fourty-si-shimmer 1.6s linear infinite;
|
|
192
|
-
}
|
|
193
|
-
|
|
204
|
+
/* The face — attach · field · dictation · send, or the activity line. */
|
|
194
205
|
.fourty-si .fourty-si__face {
|
|
195
206
|
display: flex;
|
|
196
207
|
align-items: center;
|
|
197
|
-
gap:
|
|
198
|
-
padding: 8px
|
|
208
|
+
gap: 12px;
|
|
209
|
+
padding: 8px 8px 8px 14px;
|
|
210
|
+
}
|
|
211
|
+
.fourty-si .fourty-si__tool {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-self: stretch;
|
|
214
|
+
align-items: center;
|
|
215
|
+
flex: 0 0 auto;
|
|
216
|
+
}
|
|
217
|
+
.fourty-si .fourty-si__status {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
.fourty-si .fourty-si__status[data-working='true'] {
|
|
221
|
+
display: flex;
|
|
222
|
+
flex: 1 1 auto;
|
|
223
|
+
align-items: center;
|
|
224
|
+
gap: 12px;
|
|
225
|
+
min-width: 0;
|
|
226
|
+
min-height: 40px;
|
|
227
|
+
}
|
|
228
|
+
.fourty-si .fourty-si__dots {
|
|
229
|
+
display: flex;
|
|
230
|
+
flex: none;
|
|
231
|
+
gap: 4px;
|
|
232
|
+
}
|
|
233
|
+
.fourty-si .fourty-si__dots span {
|
|
234
|
+
display: block;
|
|
235
|
+
width: 6px;
|
|
236
|
+
height: 6px;
|
|
237
|
+
background: var(--fourty-island-mark, var(--_fg));
|
|
238
|
+
animation: fourty-si-pulse 1.2s ease-in-out infinite;
|
|
239
|
+
}
|
|
240
|
+
.fourty-si .fourty-si__dots span:nth-child(2) {
|
|
241
|
+
animation-delay: 200ms;
|
|
242
|
+
}
|
|
243
|
+
.fourty-si .fourty-si__dots span:nth-child(3) {
|
|
244
|
+
animation-delay: 400ms;
|
|
245
|
+
}
|
|
246
|
+
.fourty-si .fourty-si__activity {
|
|
247
|
+
display: block;
|
|
248
|
+
min-width: 0;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
white-space: nowrap;
|
|
251
|
+
text-overflow: ellipsis;
|
|
252
|
+
font-size: 14.5px;
|
|
253
|
+
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
199
254
|
}
|
|
200
255
|
.fourty-si .fourty-si__field {
|
|
256
|
+
display: block;
|
|
201
257
|
flex: 1 1 auto;
|
|
202
258
|
min-width: 0;
|
|
203
259
|
margin: 0;
|
|
204
260
|
border: 0;
|
|
205
261
|
background: transparent;
|
|
206
|
-
padding: 8px
|
|
262
|
+
padding: 8px 0;
|
|
207
263
|
font-size: 16px; /* under 16px iOS zooms the page on focus */
|
|
264
|
+
line-height: 1.4;
|
|
265
|
+
resize: none;
|
|
266
|
+
white-space: pre-wrap;
|
|
208
267
|
cursor: text;
|
|
209
268
|
}
|
|
210
269
|
.fourty-si .fourty-si__field::placeholder {
|
|
@@ -212,47 +271,31 @@
|
|
|
212
271
|
opacity: 1;
|
|
213
272
|
}
|
|
214
273
|
|
|
215
|
-
/* The send
|
|
274
|
+
/* The send button — a filled square-ish stamp, the primary action. */
|
|
216
275
|
.fourty-si .fourty-si__stamp {
|
|
217
276
|
display: grid;
|
|
218
277
|
place-items: center;
|
|
219
|
-
flex: 0 0
|
|
220
|
-
width:
|
|
221
|
-
height:
|
|
278
|
+
flex: 0 0 40px;
|
|
279
|
+
width: 40px;
|
|
280
|
+
height: 40px;
|
|
222
281
|
margin: 0;
|
|
223
282
|
border: 0;
|
|
224
|
-
border-radius: 999px;
|
|
225
|
-
background: var(--_fg);
|
|
226
|
-
color: var(--
|
|
283
|
+
border-radius: var(--fourty-chat-send-radius, 999px);
|
|
284
|
+
background: var(--fourty-island-send-surface, var(--_fg));
|
|
285
|
+
color: var(--fourty-island-send-fg, var(--_base));
|
|
227
286
|
cursor: pointer;
|
|
228
287
|
transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
|
|
229
288
|
}
|
|
230
289
|
.fourty-si .fourty-si__stamp svg {
|
|
231
290
|
display: block;
|
|
232
|
-
width:
|
|
233
|
-
height:
|
|
291
|
+
width: 17px;
|
|
292
|
+
height: 17px;
|
|
234
293
|
}
|
|
235
294
|
.fourty-si .fourty-si__stamp:disabled {
|
|
236
295
|
opacity: 0.4;
|
|
237
296
|
cursor: default;
|
|
238
297
|
}
|
|
239
298
|
|
|
240
|
-
/* The pill — 112 × 40, fully round (ISLAND_COLLAPSED_W/H). */
|
|
241
|
-
.fourty-si .fourty-si__pill {
|
|
242
|
-
display: grid;
|
|
243
|
-
place-items: center;
|
|
244
|
-
width: 112px;
|
|
245
|
-
height: 40px;
|
|
246
|
-
border-radius: 20px;
|
|
247
|
-
background: var(--fourty-island-collapsed-surface, var(--_fg));
|
|
248
|
-
color: var(--fourty-island-collapsed-fg, var(--_surface));
|
|
249
|
-
font-weight: 600;
|
|
250
|
-
box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--_fg) 30%, transparent);
|
|
251
|
-
pointer-events: auto;
|
|
252
|
-
cursor: pointer;
|
|
253
|
-
animation: fourty-si-in 220ms var(--_ease);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
299
|
@media (hover: hover) {
|
|
257
300
|
.fourty-si .fourty-si__chip:hover,
|
|
258
301
|
.fourty-si .fourty-si__stamp:not(:disabled):hover {
|
|
@@ -265,19 +308,15 @@
|
|
|
265
308
|
@keyframes fourty-si-in {
|
|
266
309
|
from { opacity: 0; transform: translateY(8px) scale(0.98); }
|
|
267
310
|
}
|
|
268
|
-
@keyframes fourty-si-
|
|
269
|
-
|
|
311
|
+
@keyframes fourty-si-pulse {
|
|
312
|
+
50% { opacity: 0.3; }
|
|
270
313
|
}
|
|
271
314
|
|
|
272
315
|
@media (prefers-reduced-motion: reduce) {
|
|
273
316
|
.fourty-si .fourty-si__stack,
|
|
274
|
-
.fourty-si .fourty-
|
|
275
|
-
.fourty-si .fourty-si__working {
|
|
317
|
+
.fourty-si .fourty-si__dots span {
|
|
276
318
|
animation: none;
|
|
277
319
|
}
|
|
278
|
-
.fourty-si .fourty-si__working {
|
|
279
|
-
color: color-mix(in srgb, var(--_fg) 55%, transparent);
|
|
280
|
-
}
|
|
281
320
|
.fourty-si .fourty-si__chevron,
|
|
282
321
|
.fourty-si .fourty-si__chip,
|
|
283
322
|
.fourty-si .fourty-si__stamp {
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,9 @@ import {
|
|
|
13
13
|
} from "./chunk-E3IJDSKY.js";
|
|
14
14
|
import {
|
|
15
15
|
DragSheet,
|
|
16
|
-
Spinner,
|
|
17
|
-
cn,
|
|
18
16
|
useMediaQuery,
|
|
19
17
|
useScrollLock
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-I5QE47QY.js";
|
|
21
19
|
import {
|
|
22
20
|
AgentPresenceWidget,
|
|
23
21
|
BriefHandle,
|
|
@@ -47,16 +45,20 @@ import {
|
|
|
47
45
|
readLabel,
|
|
48
46
|
useVisibleFacts
|
|
49
47
|
} from "./chunk-RMJDSHLA.js";
|
|
48
|
+
import {
|
|
49
|
+
useContainerWidth,
|
|
50
|
+
useFocusTrap
|
|
51
|
+
} from "./chunk-GQURT3IR.js";
|
|
52
|
+
import {
|
|
53
|
+
Spinner,
|
|
54
|
+
cn
|
|
55
|
+
} from "./chunk-WDL5PHO2.js";
|
|
50
56
|
import {
|
|
51
57
|
AnimatePresence,
|
|
52
58
|
Reveal,
|
|
53
59
|
motion,
|
|
54
60
|
useReducedMotion
|
|
55
61
|
} from "./chunk-432XYPDT.js";
|
|
56
|
-
import {
|
|
57
|
-
useContainerWidth,
|
|
58
|
-
useFocusTrap
|
|
59
|
-
} from "./chunk-GQURT3IR.js";
|
|
60
62
|
|
|
61
63
|
// src/catalog.ts
|
|
62
64
|
import { adaptComponent, adaptCatalogComponent, buildComponentLibrary } from "@40rty/ams-sdk";
|
|
@@ -4234,6 +4236,7 @@ import { useAgentDriven, useComposerDraft, useFourtySession as useFourtySession3
|
|
|
4234
4236
|
|
|
4235
4237
|
// src/utils/use-composer-mode.tsx
|
|
4236
4238
|
import * as React30 from "react";
|
|
4239
|
+
import { createLocalStorageAdapter } from "@40rty/ams-sdk";
|
|
4237
4240
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
4238
4241
|
var ComposerModeContext = React30.createContext(null);
|
|
4239
4242
|
function ComposerModeProvider({
|
|
@@ -4244,17 +4247,14 @@ function ComposerModeProvider({
|
|
|
4244
4247
|
const fallback = defaultMode !== void 0 ? defaultMode : "bottom";
|
|
4245
4248
|
const [mode, setModeState] = React30.useState(() => {
|
|
4246
4249
|
if (lock) return fallback;
|
|
4247
|
-
|
|
4248
|
-
const v = window.localStorage.getItem("fourty-composer-mode");
|
|
4250
|
+
const v = createLocalStorageAdapter().get("fourty-composer-mode");
|
|
4249
4251
|
if (v === "side" || v === "bottom") return v;
|
|
4250
4252
|
return fallback;
|
|
4251
4253
|
});
|
|
4252
4254
|
const setMode = React30.useCallback((next) => {
|
|
4253
4255
|
if (lock) return;
|
|
4254
4256
|
setModeState(next);
|
|
4255
|
-
|
|
4256
|
-
window.localStorage.setItem("fourty-composer-mode", next);
|
|
4257
|
-
}
|
|
4257
|
+
createLocalStorageAdapter().set("fourty-composer-mode", next);
|
|
4258
4258
|
}, [lock]);
|
|
4259
4259
|
const value = React30.useMemo(() => ({ mode, setMode }), [mode, setMode]);
|
|
4260
4260
|
return /* @__PURE__ */ jsx53(ComposerModeContext.Provider, { value, children });
|
package/dist/island.js
CHANGED
|
@@ -5,90 +5,100 @@ import {
|
|
|
5
5
|
useIslandSlot,
|
|
6
6
|
useRegisterIsland
|
|
7
7
|
} from "./chunk-QXCHHCPU.js";
|
|
8
|
+
import {
|
|
9
|
+
AttachButton,
|
|
10
|
+
AttachmentStrip,
|
|
11
|
+
DictationButton
|
|
12
|
+
} from "./chunk-WVD2Y2N2.js";
|
|
13
|
+
import "./chunk-WDL5PHO2.js";
|
|
14
|
+
import "./chunk-432XYPDT.js";
|
|
8
15
|
|
|
9
16
|
// src/shell/SpacefrontIsland.tsx
|
|
10
17
|
import * as React from "react";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
import {
|
|
19
|
+
renderInline,
|
|
20
|
+
splitAnswer,
|
|
21
|
+
useComposerChipSelect,
|
|
22
|
+
useConversationPresence,
|
|
23
|
+
useFourtySession,
|
|
24
|
+
usePromptComposer,
|
|
25
|
+
useThreadRows
|
|
26
|
+
} from "@40rty/ams-sdk";
|
|
27
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
function AnswerProse({ prose, rowKey }) {
|
|
29
|
+
const { headline, body } = splitAnswer(prose);
|
|
30
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
/* @__PURE__ */ jsx("strong", { className: "fourty-si__headline", children: renderInline(headline, `${rowKey}-h`) }),
|
|
32
|
+
body.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
" ",
|
|
34
|
+
renderInline(body, `${rowKey}-b`)
|
|
35
|
+
] })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
function activityText(activity, workingText) {
|
|
39
|
+
if (activity.kind === "voice" || activity.kind === "reasoning") return activity.text;
|
|
40
|
+
if (activity.kind === "searching") return `Looking through ${activity.query}`;
|
|
41
|
+
return workingText;
|
|
42
|
+
}
|
|
15
43
|
function SpacefrontIsland({
|
|
16
44
|
placeholder = "Ask anything\u2026",
|
|
17
45
|
emptyText = "Tell us what you\u2019re looking for.",
|
|
18
46
|
workingText = "Pulling that together\u2026",
|
|
19
|
-
pillLabel = "Ask",
|
|
20
47
|
container = "viewport",
|
|
21
48
|
stopKeyPropagation = true
|
|
22
49
|
}) {
|
|
23
50
|
const session = useFourtySession();
|
|
24
|
-
const
|
|
51
|
+
const { value, setValue, attachments, dictation, onPaste, canSend, submit } = usePromptComposer();
|
|
52
|
+
const presence = useConversationPresence();
|
|
25
53
|
const { rows, isEmpty } = useThreadRows();
|
|
26
54
|
const selectChip = useComposerChipSelect();
|
|
27
55
|
const chips = session.suggestions === null ? [] : session.suggestions.actions.filter((chip) => chip.label.trim() !== "");
|
|
28
56
|
const latest = rows.length > 0 ? rows[rows.length - 1] : void 0;
|
|
29
57
|
const working = session.isRunning || session.isSubmitting;
|
|
30
58
|
const [threadOpen, setThreadOpen] = React.useState(false);
|
|
31
|
-
const [folded, setFolded] = React.useState(false);
|
|
32
|
-
const rootRef = React.useRef(null);
|
|
33
59
|
const [presenceSlot, setPresenceSlot] = React.useState(null);
|
|
34
60
|
useRegisterIsland();
|
|
35
61
|
useIslandSlot(presenceSlot);
|
|
36
62
|
const { panelSlot } = useHostShell();
|
|
37
|
-
React.useEffect(() => {
|
|
38
|
-
let last = window.scrollY;
|
|
39
|
-
const onScroll = () => {
|
|
40
|
-
const y = window.scrollY;
|
|
41
|
-
if (Math.abs(y - last) < FOLD_STEP) return;
|
|
42
|
-
const root = rootRef.current;
|
|
43
|
-
const typing = root !== null && root.contains(document.activeElement);
|
|
44
|
-
setFolded(!typing && y > last && y > FOLD_AFTER);
|
|
45
|
-
last = y;
|
|
46
|
-
};
|
|
47
|
-
window.addEventListener("scroll", onScroll, { passive: true });
|
|
48
|
-
return () => window.removeEventListener("scroll", onScroll);
|
|
49
|
-
}, []);
|
|
50
63
|
const send = () => {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
setDraft("");
|
|
64
|
+
if (!canSend || working) return;
|
|
65
|
+
submit();
|
|
54
66
|
setThreadOpen(false);
|
|
55
67
|
};
|
|
56
68
|
const isolate = (event) => {
|
|
57
69
|
if (stopKeyPropagation) stopHostKeys(event);
|
|
58
70
|
};
|
|
59
|
-
const
|
|
71
|
+
const answer = (() => {
|
|
60
72
|
if (session.error !== null) return /* @__PURE__ */ jsx("p", { className: "fourty-si__error", role: "alert", children: session.error });
|
|
61
|
-
if (working && (latest === void 0 || latest.prose === "")) {
|
|
62
|
-
return /* @__PURE__ */ jsx("p", { className: "fourty-si__working", children: workingText });
|
|
63
|
-
}
|
|
64
73
|
if (threadOpen) {
|
|
65
74
|
return /* @__PURE__ */ jsx("div", { className: "fourty-si__thread", children: rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: "fourty-si__muted", children: emptyText }) : rows.map((row) => /* @__PURE__ */ jsxs("div", { className: "fourty-si__turn", children: [
|
|
66
75
|
/* @__PURE__ */ jsx("p", { className: "fourty-si__asked", children: row.visitorText }),
|
|
67
|
-
/* @__PURE__ */ jsx("p", { children:
|
|
76
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(AnswerProse, { prose: row.prose, rowKey: row.key }) })
|
|
68
77
|
] }, row.key)) });
|
|
69
78
|
}
|
|
70
|
-
if (latest === void 0
|
|
71
|
-
|
|
79
|
+
if (latest === void 0 || latest.prose === "") {
|
|
80
|
+
return isEmpty && !working ? /* @__PURE__ */ jsx("p", { className: "fourty-si__muted", children: emptyText }) : null;
|
|
81
|
+
}
|
|
82
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className: "fourty-si__latest", "aria-expanded": false, onClick: () => setThreadOpen(true), children: /* @__PURE__ */ jsx(AnswerProse, { prose: latest.prose, rowKey: latest.key }) });
|
|
72
83
|
})();
|
|
73
84
|
if (panelSlot !== null) return null;
|
|
74
85
|
return /* @__PURE__ */ jsx(
|
|
75
86
|
"div",
|
|
76
87
|
{
|
|
77
|
-
ref: rootRef,
|
|
78
88
|
className: "fourty-si",
|
|
79
89
|
"data-container": container,
|
|
80
|
-
"data-folded": folded,
|
|
81
90
|
"data-working": working,
|
|
82
91
|
onKeyDown: (event) => {
|
|
83
92
|
isolate(event);
|
|
84
93
|
if (event.key === "Escape" && threadOpen) setThreadOpen(false);
|
|
85
94
|
},
|
|
86
95
|
onKeyUp: isolate,
|
|
87
|
-
children:
|
|
96
|
+
children: /* @__PURE__ */ jsxs("div", { className: "fourty-si__stack", children: [
|
|
88
97
|
/* @__PURE__ */ jsx("div", { ref: setPresenceSlot, className: "fourty-si__presence" }),
|
|
89
98
|
chips.length > 0 && /* @__PURE__ */ jsx("div", { className: "fourty-si__chips", role: "group", "aria-label": "Suggestions", children: chips.map((chip) => /* @__PURE__ */ jsx("button", { type: "button", className: "fourty-si__chip", onClick: () => selectChip(chip), children: chip.label }, chip.id)) }),
|
|
99
|
+
attachments.attachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "fourty-si__tool", children: /* @__PURE__ */ jsx(AttachmentStrip, { attachments: attachments.attachments, onRemove: attachments.remove }) }),
|
|
90
100
|
/* @__PURE__ */ jsxs("div", { className: "fourty-si__slab", children: [
|
|
91
|
-
/* @__PURE__ */ jsx(
|
|
101
|
+
(rows.length > 0 || threadOpen) && /* @__PURE__ */ jsx(
|
|
92
102
|
"button",
|
|
93
103
|
{
|
|
94
104
|
type: "button",
|
|
@@ -99,7 +109,7 @@ function SpacefrontIsland({
|
|
|
99
109
|
children: /* @__PURE__ */ jsx("svg", { className: "fourty-si__chevron", viewBox: "0 0 32 5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("polyline", { points: "1,4 16,1 31,4", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
100
110
|
}
|
|
101
111
|
),
|
|
102
|
-
/* @__PURE__ */ jsx("div", { className: "fourty-
|
|
112
|
+
answer !== null && /* @__PURE__ */ jsx("div", { className: "fourty-si__answer", children: answer }),
|
|
103
113
|
/* @__PURE__ */ jsxs(
|
|
104
114
|
"form",
|
|
105
115
|
{
|
|
@@ -109,21 +119,40 @@ function SpacefrontIsland({
|
|
|
109
119
|
send();
|
|
110
120
|
},
|
|
111
121
|
children: [
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
/* @__PURE__ */ jsx("span", { className: "fourty-si__status", "aria-live": "polite", "data-working": working, children: working && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
123
|
+
/* @__PURE__ */ jsxs("span", { className: "fourty-si__dots", "aria-hidden": "true", children: [
|
|
124
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
125
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
126
|
+
/* @__PURE__ */ jsx("span", {})
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "fourty-si__activity", children: activityText(presence.activity, workingText) })
|
|
129
|
+
] }) }),
|
|
130
|
+
!working && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "fourty-si__tool", children: /* @__PURE__ */ jsx(AttachButton, { onFiles: attachments.addFiles }) }),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
"textarea",
|
|
134
|
+
{
|
|
135
|
+
className: "fourty-si__field",
|
|
136
|
+
rows: 1,
|
|
137
|
+
"aria-label": placeholder,
|
|
138
|
+
placeholder,
|
|
139
|
+
enterKeyHint: "send",
|
|
140
|
+
autoComplete: "off",
|
|
141
|
+
value,
|
|
142
|
+
onChange: (event) => setValue(event.target.value),
|
|
143
|
+
onPaste,
|
|
144
|
+
onFocus: () => setThreadOpen(false),
|
|
145
|
+
onKeyDown: (event) => {
|
|
146
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
147
|
+
event.preventDefault();
|
|
148
|
+
send();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "fourty-si__tool", children: /* @__PURE__ */ jsx(DictationButton, { listening: dictation.listening, supported: dictation.supported, onToggle: dictation.toggle }) }),
|
|
154
|
+
/* @__PURE__ */ jsx("button", { type: "submit", className: "fourty-si__stamp", "aria-label": "Send", disabled: !canSend, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M8 13V3M3.5 7.5 8 3l4.5 4.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
155
|
+
] })
|
|
127
156
|
]
|
|
128
157
|
}
|
|
129
158
|
)
|