@40rty/ams-ui 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +8 -6
- package/dist/chunk-BFZ3YCUY.js +163 -0
- package/dist/{chunk-54QPRWEG.js → chunk-OKP7MC72.js} +89 -281
- package/dist/chunk-QXCHHCPU.js +58 -0
- package/dist/chunk-TEPH476O.js +218 -0
- package/dist/css/shell/spacefront-island.css +286 -0
- package/dist/css/shell/spacefront-presence.css +222 -0
- package/dist/css/shell/spacefront-thread-panel.css +255 -0
- package/dist/index.js +6 -4
- package/dist/island.js +137 -0
- package/dist/presence.js +134 -0
- package/dist/shell.js +305 -451
- package/dist/thread-panel.js +238 -0
- package/dist/types/island/index.d.ts +1 -0
- package/dist/types/presence/index.d.ts +1 -0
- package/dist/types/shell/PresenceActivity.d.ts +22 -0
- package/dist/types/shell/SideDock.d.ts +3 -2
- package/dist/types/shell/SpacefrontIsland.d.ts +36 -0
- package/dist/types/shell/SpacefrontPresence.d.ts +25 -0
- package/dist/types/shell/SpacefrontThreadPanel.d.ts +45 -0
- package/dist/types/shell/ThreadPanelConversation.d.ts +14 -0
- package/dist/types/shell/host-shell-store.d.ts +35 -0
- package/dist/types/thread-panel/index.d.ts +1 -0
- package/package.json +17 -2
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
<SpacefrontPresence /> — the agent presence band for a host-owned page.
|
|
3
|
+
Published as `@40rty/ams-ui/presence.css`. Same contract as `island.css`:
|
|
4
|
+
plain CSS, UNLAYERED, every element reset by `.fourty-sp :is(…)` (0,1,1)
|
|
5
|
+
and every rule `.fourty-sp .fourty-sp__x` (0,2,0).
|
|
6
|
+
|
|
7
|
+
Themed through the SHARED shell tokens (see `island.css`), so it matches
|
|
8
|
+
the island it sits on and the panel it tops:
|
|
9
|
+
--fourty-surface (#fff) --fourty-fg (#111) --fourty-accent (fg)
|
|
10
|
+
--fourty-accent-fg (surface) --fourty-radius (16px)
|
|
11
|
+
--fourty-font-family (inherit)
|
|
12
|
+
…and its own:
|
|
13
|
+
--fourty-presence-shadow (the island's lift, lighter)
|
|
14
|
+
--fourty-presence-thumb (28px) scanned-record thumbnail size
|
|
15
|
+
============================================================================ */
|
|
16
|
+
|
|
17
|
+
/* The root doubles its class (0,2,0): it is portalled INTO the island and the
|
|
18
|
+
panel, whose own resets (`.fourty-si :is(div, …)`, 0,1,1) would otherwise
|
|
19
|
+
unset the band's box. */
|
|
20
|
+
.fourty-sp.fourty-sp {
|
|
21
|
+
--_surface: var(--fourty-surface, #fff);
|
|
22
|
+
--_fg: var(--fourty-fg, #111);
|
|
23
|
+
--_accent: var(--fourty-accent, var(--_fg));
|
|
24
|
+
--_accent-fg: var(--fourty-accent-fg, var(--_surface));
|
|
25
|
+
--_radius: var(--fourty-radius, 16px);
|
|
26
|
+
--_thumb: var(--fourty-presence-thumb, 28px);
|
|
27
|
+
display: grid;
|
|
28
|
+
gap: 10px;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
width: 100%;
|
|
31
|
+
padding: 10px 12px;
|
|
32
|
+
border-radius: var(--_radius);
|
|
33
|
+
background: var(--_surface);
|
|
34
|
+
box-shadow: var(--fourty-presence-shadow,
|
|
35
|
+
0 0 0 1px color-mix(in srgb, var(--_fg) 12%, transparent),
|
|
36
|
+
0 6px 16px -6px color-mix(in srgb, var(--_fg) 24%, transparent));
|
|
37
|
+
font-family: var(--fourty-font-family, inherit);
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
line-height: 1.4;
|
|
40
|
+
color: var(--_fg);
|
|
41
|
+
text-align: left;
|
|
42
|
+
pointer-events: auto;
|
|
43
|
+
animation: fourty-sp-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* The reset — the host's element globals stop here. */
|
|
47
|
+
.fourty-sp :is(div, p, span, ul, li, button, img, svg) {
|
|
48
|
+
all: unset;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
}
|
|
51
|
+
.fourty-sp :focus-visible {
|
|
52
|
+
outline: 2px solid var(--_accent);
|
|
53
|
+
outline-offset: 2px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Activity — thumbs of what is being read, and the line. */
|
|
57
|
+
.fourty-sp .fourty-sp__activity {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: 10px;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
}
|
|
63
|
+
.fourty-sp .fourty-sp__thumbs {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex: 0 0 auto;
|
|
66
|
+
}
|
|
67
|
+
.fourty-sp .fourty-sp__thumb {
|
|
68
|
+
display: block;
|
|
69
|
+
width: var(--_thumb);
|
|
70
|
+
height: var(--_thumb);
|
|
71
|
+
margin-left: calc(var(--_thumb) * -0.3);
|
|
72
|
+
border-radius: 6px;
|
|
73
|
+
object-fit: cover;
|
|
74
|
+
background: color-mix(in srgb, var(--_fg) 8%, var(--_surface));
|
|
75
|
+
box-shadow: 0 0 0 2px var(--_surface);
|
|
76
|
+
animation: fourty-sp-thumb 260ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
|
|
77
|
+
}
|
|
78
|
+
.fourty-sp .fourty-sp__thumb:first-child {
|
|
79
|
+
margin-left: 0;
|
|
80
|
+
}
|
|
81
|
+
.fourty-sp .fourty-sp__line {
|
|
82
|
+
display: block;
|
|
83
|
+
min-width: 0;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
text-overflow: ellipsis;
|
|
87
|
+
color: color-mix(in srgb, var(--_fg) 78%, transparent);
|
|
88
|
+
}
|
|
89
|
+
.fourty-sp .fourty-sp__line--thinking {
|
|
90
|
+
color: transparent;
|
|
91
|
+
background: linear-gradient(100deg,
|
|
92
|
+
color-mix(in srgb, var(--_fg) 45%, transparent) 40%,
|
|
93
|
+
var(--_fg) 50%,
|
|
94
|
+
color-mix(in srgb, var(--_fg) 45%, transparent) 60%) 0 0 / 250% 100%;
|
|
95
|
+
-webkit-background-clip: text;
|
|
96
|
+
background-clip: text;
|
|
97
|
+
animation: fourty-sp-shimmer 1.6s linear infinite;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Facts — what the agent understood, each forgettable. */
|
|
101
|
+
.fourty-sp .fourty-sp__facts {
|
|
102
|
+
display: grid;
|
|
103
|
+
gap: 6px;
|
|
104
|
+
}
|
|
105
|
+
.fourty-sp .fourty-sp__eyebrow {
|
|
106
|
+
display: block;
|
|
107
|
+
font-size: 11px;
|
|
108
|
+
font-weight: 600;
|
|
109
|
+
letter-spacing: 0.06em;
|
|
110
|
+
text-transform: uppercase;
|
|
111
|
+
color: color-mix(in srgb, var(--_fg) 55%, transparent);
|
|
112
|
+
}
|
|
113
|
+
.fourty-sp .fourty-sp__fact-list {
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-wrap: wrap;
|
|
116
|
+
gap: 6px;
|
|
117
|
+
}
|
|
118
|
+
.fourty-sp .fourty-sp__fact {
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 6px;
|
|
122
|
+
padding: 3px 4px 3px 10px;
|
|
123
|
+
border-radius: 999px;
|
|
124
|
+
background: color-mix(in srgb, var(--_fg) 7%, var(--_surface));
|
|
125
|
+
}
|
|
126
|
+
.fourty-sp .fourty-sp__fact-label {
|
|
127
|
+
display: inline;
|
|
128
|
+
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
129
|
+
}
|
|
130
|
+
.fourty-sp .fourty-sp__fact-value {
|
|
131
|
+
display: inline;
|
|
132
|
+
font-weight: 600;
|
|
133
|
+
}
|
|
134
|
+
.fourty-sp .fourty-sp__more {
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
padding: 3px 8px;
|
|
138
|
+
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
139
|
+
}
|
|
140
|
+
.fourty-sp .fourty-sp__forget,
|
|
141
|
+
.fourty-sp .fourty-sp__dismiss {
|
|
142
|
+
display: grid;
|
|
143
|
+
place-items: center;
|
|
144
|
+
width: 20px;
|
|
145
|
+
height: 20px;
|
|
146
|
+
border-radius: 999px;
|
|
147
|
+
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
transition: background-color 150ms ease, color 150ms ease;
|
|
150
|
+
}
|
|
151
|
+
.fourty-sp .fourty-sp__dismiss {
|
|
152
|
+
width: 28px;
|
|
153
|
+
height: 28px;
|
|
154
|
+
}
|
|
155
|
+
.fourty-sp .fourty-sp__forget svg,
|
|
156
|
+
.fourty-sp .fourty-sp__dismiss svg {
|
|
157
|
+
display: block;
|
|
158
|
+
width: 12px;
|
|
159
|
+
height: 12px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* A standing question — answer it, or dismiss it. */
|
|
163
|
+
.fourty-sp .fourty-sp__ask {
|
|
164
|
+
display: grid;
|
|
165
|
+
gap: 8px;
|
|
166
|
+
}
|
|
167
|
+
.fourty-sp .fourty-sp__question {
|
|
168
|
+
display: block;
|
|
169
|
+
font-weight: 600;
|
|
170
|
+
}
|
|
171
|
+
.fourty-sp .fourty-sp__replies {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-wrap: wrap;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 6px;
|
|
176
|
+
}
|
|
177
|
+
.fourty-sp .fourty-sp__reply {
|
|
178
|
+
padding: 4px 14px;
|
|
179
|
+
border-radius: 999px;
|
|
180
|
+
background: var(--_fg);
|
|
181
|
+
color: var(--_surface);
|
|
182
|
+
cursor: pointer;
|
|
183
|
+
transition: background-color 150ms ease, color 150ms ease;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@media (hover: hover) {
|
|
187
|
+
.fourty-sp .fourty-sp__reply:hover {
|
|
188
|
+
background: var(--_accent);
|
|
189
|
+
color: var(--_accent-fg);
|
|
190
|
+
}
|
|
191
|
+
.fourty-sp .fourty-sp__forget:hover,
|
|
192
|
+
.fourty-sp .fourty-sp__dismiss:hover {
|
|
193
|
+
background: color-mix(in srgb, var(--_fg) 10%, transparent);
|
|
194
|
+
color: var(--_fg);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@keyframes fourty-sp-in {
|
|
199
|
+
from { opacity: 0; transform: translateY(6px); }
|
|
200
|
+
}
|
|
201
|
+
@keyframes fourty-sp-thumb {
|
|
202
|
+
from { opacity: 0; transform: scale(0.8); }
|
|
203
|
+
}
|
|
204
|
+
@keyframes fourty-sp-shimmer {
|
|
205
|
+
to { background-position: -150% 0; }
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@media (prefers-reduced-motion: reduce) {
|
|
209
|
+
.fourty-sp,
|
|
210
|
+
.fourty-sp .fourty-sp__thumb,
|
|
211
|
+
.fourty-sp .fourty-sp__line--thinking {
|
|
212
|
+
animation: none;
|
|
213
|
+
}
|
|
214
|
+
.fourty-sp .fourty-sp__line--thinking {
|
|
215
|
+
color: color-mix(in srgb, var(--_fg) 55%, transparent);
|
|
216
|
+
}
|
|
217
|
+
.fourty-sp .fourty-sp__reply,
|
|
218
|
+
.fourty-sp .fourty-sp__forget,
|
|
219
|
+
.fourty-sp .fourty-sp__dismiss {
|
|
220
|
+
transition: none;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
<SpacefrontThreadPanel /> — the chat side panel for a host-owned page.
|
|
3
|
+
Published as `@40rty/ams-ui/thread-panel.css`. Same contract as
|
|
4
|
+
`island.css`: plain CSS, UNLAYERED, every element reset by
|
|
5
|
+
`.fourty-tp :is(…)` (0,1,1) and every rule `.fourty-tp .fourty-tp__x`
|
|
6
|
+
(0,2,0), so a host's `form button { width: 100% }` cannot reach it.
|
|
7
|
+
|
|
8
|
+
Themed through the SHARED shell tokens (see `island.css`):
|
|
9
|
+
--fourty-surface (#fff) --fourty-fg (#111) --fourty-accent (fg)
|
|
10
|
+
--fourty-accent-fg (surface) --fourty-radius (16px)
|
|
11
|
+
--fourty-font-family (inherit)
|
|
12
|
+
…and the panel's own placement properties:
|
|
13
|
+
--fourty-panel-offset-top (0) clears a host header
|
|
14
|
+
--fourty-panel-offset-bottom (0) clears a host bottom bar
|
|
15
|
+
--fourty-panel-inset-right (0) docks it beside a host's own right column
|
|
16
|
+
--fourty-panel-z-index (45) above the island (40)
|
|
17
|
+
--fourty-panel-edge (1px hairline of fg on the left edge)
|
|
18
|
+
--fourty-panel-error (#b42318)
|
|
19
|
+
The panel sets `--fourty-thread-panel-inset` on <html> (its width while
|
|
20
|
+
docked open on desktop, else 0px) for the host's canvas to pad by.
|
|
21
|
+
============================================================================ */
|
|
22
|
+
|
|
23
|
+
.fourty-tp {
|
|
24
|
+
--_surface: var(--fourty-surface, #fff);
|
|
25
|
+
--_fg: var(--fourty-fg, #111);
|
|
26
|
+
--_accent: var(--fourty-accent, var(--_fg));
|
|
27
|
+
--_accent-fg: var(--fourty-accent-fg, var(--_surface));
|
|
28
|
+
--_radius: var(--fourty-radius, 16px);
|
|
29
|
+
--_ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: var(--fourty-panel-offset-top, 0);
|
|
32
|
+
bottom: var(--fourty-panel-offset-bottom, 0);
|
|
33
|
+
right: var(--fourty-panel-inset-right, 0);
|
|
34
|
+
z-index: var(--fourty-panel-z-index, 45);
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
font-family: var(--fourty-font-family, inherit);
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
line-height: 1.45;
|
|
40
|
+
color: var(--_fg);
|
|
41
|
+
text-align: left;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* The reset — the host's element globals stop here. */
|
|
45
|
+
.fourty-tp :is(div, p, form, button, input, svg, section, header, h2) {
|
|
46
|
+
all: unset;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
.fourty-tp :focus-visible {
|
|
50
|
+
outline: 2px solid var(--_accent);
|
|
51
|
+
outline-offset: 2px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* The tab — the collapsed panel, on the right edge. */
|
|
55
|
+
.fourty-tp .fourty-tp__tab {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 50%;
|
|
58
|
+
right: 0;
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
writing-mode: vertical-rl;
|
|
61
|
+
padding: 18px 10px;
|
|
62
|
+
border-radius: var(--_radius) 0 0 var(--_radius);
|
|
63
|
+
background: var(--_fg);
|
|
64
|
+
color: var(--_surface);
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
letter-spacing: 0.04em;
|
|
67
|
+
box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--_fg) 30%, transparent);
|
|
68
|
+
pointer-events: auto;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
animation: fourty-tp-in 220ms var(--_ease);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.fourty-tp .fourty-tp__panel {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
height: 100%;
|
|
77
|
+
background: var(--_surface);
|
|
78
|
+
box-shadow: var(--fourty-panel-edge, -1px 0 0 color-mix(in srgb, var(--_fg) 14%, transparent));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.fourty-tp .fourty-tp__head {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: space-between;
|
|
85
|
+
gap: 8px;
|
|
86
|
+
padding: 14px 12px 8px 16px;
|
|
87
|
+
}
|
|
88
|
+
.fourty-tp .fourty-tp__title {
|
|
89
|
+
display: block;
|
|
90
|
+
font-size: 15px;
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
}
|
|
93
|
+
.fourty-tp .fourty-tp__close {
|
|
94
|
+
display: grid;
|
|
95
|
+
place-items: center;
|
|
96
|
+
width: 32px;
|
|
97
|
+
height: 32px;
|
|
98
|
+
border-radius: 999px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
transition: background-color 150ms ease;
|
|
101
|
+
}
|
|
102
|
+
.fourty-tp .fourty-tp__close svg {
|
|
103
|
+
display: block;
|
|
104
|
+
width: 16px;
|
|
105
|
+
height: 16px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Where <SpacefrontPresence /> attaches while the panel is open. */
|
|
109
|
+
.fourty-tp .fourty-tp__presence {
|
|
110
|
+
display: block;
|
|
111
|
+
padding: 0 12px 8px;
|
|
112
|
+
}
|
|
113
|
+
.fourty-tp .fourty-tp__presence:empty {
|
|
114
|
+
display: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.fourty-tp .fourty-tp__thread {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex: 1 1 auto;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: 18px;
|
|
122
|
+
min-height: 0;
|
|
123
|
+
overflow-y: auto;
|
|
124
|
+
overscroll-behavior: contain;
|
|
125
|
+
padding: 8px 16px 16px;
|
|
126
|
+
}
|
|
127
|
+
.fourty-tp .fourty-tp__turn {
|
|
128
|
+
display: grid;
|
|
129
|
+
gap: 8px;
|
|
130
|
+
}
|
|
131
|
+
.fourty-tp .fourty-tp__asked {
|
|
132
|
+
display: block;
|
|
133
|
+
justify-self: end;
|
|
134
|
+
max-width: 85%;
|
|
135
|
+
padding: 8px 12px;
|
|
136
|
+
border-radius: calc(var(--_radius) * 0.75);
|
|
137
|
+
background: color-mix(in srgb, var(--_fg) 7%, var(--_surface));
|
|
138
|
+
}
|
|
139
|
+
.fourty-tp .fourty-tp__answer {
|
|
140
|
+
display: block;
|
|
141
|
+
line-height: 1.55;
|
|
142
|
+
}
|
|
143
|
+
.fourty-tp .fourty-tp__muted {
|
|
144
|
+
display: block;
|
|
145
|
+
color: color-mix(in srgb, var(--_fg) 60%, transparent);
|
|
146
|
+
}
|
|
147
|
+
.fourty-tp .fourty-tp__error {
|
|
148
|
+
display: block;
|
|
149
|
+
color: var(--fourty-panel-error, #b42318);
|
|
150
|
+
}
|
|
151
|
+
.fourty-tp .fourty-tp__working {
|
|
152
|
+
display: block;
|
|
153
|
+
color: transparent;
|
|
154
|
+
background: linear-gradient(100deg,
|
|
155
|
+
color-mix(in srgb, var(--_fg) 45%, transparent) 40%,
|
|
156
|
+
var(--_fg) 50%,
|
|
157
|
+
color-mix(in srgb, var(--_fg) 45%, transparent) 60%) 0 0 / 250% 100%;
|
|
158
|
+
-webkit-background-clip: text;
|
|
159
|
+
background-clip: text;
|
|
160
|
+
animation: fourty-tp-shimmer 1.6s linear infinite;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.fourty-tp .fourty-tp__chips {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-wrap: wrap;
|
|
166
|
+
gap: 8px;
|
|
167
|
+
padding: 0 16px 10px;
|
|
168
|
+
}
|
|
169
|
+
.fourty-tp .fourty-tp__chip {
|
|
170
|
+
padding: 4px 14px;
|
|
171
|
+
border: 1px solid color-mix(in srgb, var(--_fg) 24%, transparent);
|
|
172
|
+
border-radius: 999px;
|
|
173
|
+
background: var(--_surface);
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.fourty-tp .fourty-tp__face {
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 8px;
|
|
182
|
+
margin: 0 12px 12px;
|
|
183
|
+
padding: 6px 6px 6px 12px;
|
|
184
|
+
border-radius: var(--_radius);
|
|
185
|
+
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_fg) 18%, transparent);
|
|
186
|
+
}
|
|
187
|
+
.fourty-tp .fourty-tp__field {
|
|
188
|
+
flex: 1 1 auto;
|
|
189
|
+
min-width: 0;
|
|
190
|
+
margin: 0;
|
|
191
|
+
border: 0;
|
|
192
|
+
background: transparent;
|
|
193
|
+
padding: 8px 0;
|
|
194
|
+
font-size: 16px; /* under 16px iOS zooms the page on focus */
|
|
195
|
+
cursor: text;
|
|
196
|
+
}
|
|
197
|
+
.fourty-tp .fourty-tp__field::placeholder {
|
|
198
|
+
color: color-mix(in srgb, var(--_fg) 52%, transparent);
|
|
199
|
+
opacity: 1;
|
|
200
|
+
}
|
|
201
|
+
.fourty-tp .fourty-tp__stamp {
|
|
202
|
+
display: grid;
|
|
203
|
+
place-items: center;
|
|
204
|
+
flex: 0 0 34px;
|
|
205
|
+
width: 34px;
|
|
206
|
+
height: 34px;
|
|
207
|
+
border-radius: 999px;
|
|
208
|
+
background: var(--_fg);
|
|
209
|
+
color: var(--_surface);
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
|
|
212
|
+
}
|
|
213
|
+
.fourty-tp .fourty-tp__stamp svg {
|
|
214
|
+
display: block;
|
|
215
|
+
width: 16px;
|
|
216
|
+
height: 16px;
|
|
217
|
+
}
|
|
218
|
+
.fourty-tp .fourty-tp__stamp:disabled {
|
|
219
|
+
opacity: 0.4;
|
|
220
|
+
cursor: default;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@media (hover: hover) {
|
|
224
|
+
.fourty-tp .fourty-tp__chip:hover,
|
|
225
|
+
.fourty-tp .fourty-tp__stamp:not(:disabled):hover {
|
|
226
|
+
background: var(--_accent);
|
|
227
|
+
color: var(--_accent-fg);
|
|
228
|
+
border-color: var(--_accent);
|
|
229
|
+
}
|
|
230
|
+
.fourty-tp .fourty-tp__close:hover {
|
|
231
|
+
background: color-mix(in srgb, var(--_fg) 8%, transparent);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes fourty-tp-in {
|
|
236
|
+
from { opacity: 0; }
|
|
237
|
+
}
|
|
238
|
+
@keyframes fourty-tp-shimmer {
|
|
239
|
+
to { background-position: -150% 0; }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@media (prefers-reduced-motion: reduce) {
|
|
243
|
+
.fourty-tp .fourty-tp__tab,
|
|
244
|
+
.fourty-tp .fourty-tp__working {
|
|
245
|
+
animation: none;
|
|
246
|
+
}
|
|
247
|
+
.fourty-tp .fourty-tp__working {
|
|
248
|
+
color: color-mix(in srgb, var(--_fg) 55%, transparent);
|
|
249
|
+
}
|
|
250
|
+
.fourty-tp .fourty-tp__close,
|
|
251
|
+
.fourty-tp .fourty-tp__chip,
|
|
252
|
+
.fourty-tp .fourty-tp__stamp {
|
|
253
|
+
transition: none;
|
|
254
|
+
}
|
|
255
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -38,13 +38,15 @@ import {
|
|
|
38
38
|
Thought,
|
|
39
39
|
colorSwatch,
|
|
40
40
|
presenceClass,
|
|
41
|
-
readFacts,
|
|
42
|
-
readLabel,
|
|
43
41
|
registerDefaultPresenceForms,
|
|
44
42
|
useLabels,
|
|
45
|
-
useMeasuredHeight
|
|
43
|
+
useMeasuredHeight
|
|
44
|
+
} from "./chunk-OKP7MC72.js";
|
|
45
|
+
import {
|
|
46
|
+
readFacts,
|
|
47
|
+
readLabel,
|
|
46
48
|
useVisibleFacts
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-TEPH476O.js";
|
|
48
50
|
import {
|
|
49
51
|
AnimatePresence,
|
|
50
52
|
Reveal,
|
package/dist/island.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
stopHostKeys,
|
|
4
|
+
useHostShell,
|
|
5
|
+
useIslandSlot,
|
|
6
|
+
useRegisterIsland
|
|
7
|
+
} from "./chunk-QXCHHCPU.js";
|
|
8
|
+
|
|
9
|
+
// src/shell/SpacefrontIsland.tsx
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { renderInline, useComposerChipSelect, useComposerDraft, useFourtySession, useThreadRows } from "@40rty/ams-sdk";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var FOLD_STEP = 24;
|
|
14
|
+
var FOLD_AFTER = 120;
|
|
15
|
+
function SpacefrontIsland({
|
|
16
|
+
placeholder = "Ask anything\u2026",
|
|
17
|
+
emptyText = "Tell us what you\u2019re looking for.",
|
|
18
|
+
workingText = "Pulling that together\u2026",
|
|
19
|
+
pillLabel = "Ask",
|
|
20
|
+
container = "viewport",
|
|
21
|
+
stopKeyPropagation = true
|
|
22
|
+
}) {
|
|
23
|
+
const session = useFourtySession();
|
|
24
|
+
const [draft, setDraft] = useComposerDraft();
|
|
25
|
+
const { rows, isEmpty } = useThreadRows();
|
|
26
|
+
const selectChip = useComposerChipSelect();
|
|
27
|
+
const chips = session.suggestions === null ? [] : session.suggestions.actions.filter((chip) => chip.label.trim() !== "");
|
|
28
|
+
const latest = rows.length > 0 ? rows[rows.length - 1] : void 0;
|
|
29
|
+
const working = session.isRunning || session.isSubmitting;
|
|
30
|
+
const [threadOpen, setThreadOpen] = React.useState(false);
|
|
31
|
+
const [folded, setFolded] = React.useState(false);
|
|
32
|
+
const rootRef = React.useRef(null);
|
|
33
|
+
const [presenceSlot, setPresenceSlot] = React.useState(null);
|
|
34
|
+
useRegisterIsland();
|
|
35
|
+
useIslandSlot(presenceSlot);
|
|
36
|
+
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
|
+
const send = () => {
|
|
51
|
+
if (draft.trim() === "" || working) return;
|
|
52
|
+
session.sendMessage(draft);
|
|
53
|
+
setDraft("");
|
|
54
|
+
setThreadOpen(false);
|
|
55
|
+
};
|
|
56
|
+
const isolate = (event) => {
|
|
57
|
+
if (stopKeyPropagation) stopHostKeys(event);
|
|
58
|
+
};
|
|
59
|
+
const status = (() => {
|
|
60
|
+
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
|
+
if (threadOpen) {
|
|
65
|
+
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
|
+
/* @__PURE__ */ jsx("p", { className: "fourty-si__asked", children: row.visitorText }),
|
|
67
|
+
/* @__PURE__ */ jsx("p", { children: renderInline(row.prose, row.key) })
|
|
68
|
+
] }, row.key)) });
|
|
69
|
+
}
|
|
70
|
+
if (latest === void 0) return isEmpty ? /* @__PURE__ */ jsx("p", { className: "fourty-si__muted", children: emptyText }) : null;
|
|
71
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className: "fourty-si__latest", "aria-expanded": false, onClick: () => setThreadOpen(true), children: renderInline(latest.prose, latest.key) });
|
|
72
|
+
})();
|
|
73
|
+
if (panelSlot !== null) return null;
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
ref: rootRef,
|
|
78
|
+
className: "fourty-si",
|
|
79
|
+
"data-container": container,
|
|
80
|
+
"data-folded": folded,
|
|
81
|
+
"data-working": working,
|
|
82
|
+
onKeyDown: (event) => {
|
|
83
|
+
isolate(event);
|
|
84
|
+
if (event.key === "Escape" && threadOpen) setThreadOpen(false);
|
|
85
|
+
},
|
|
86
|
+
onKeyUp: isolate,
|
|
87
|
+
children: folded ? /* @__PURE__ */ jsx("button", { type: "button", className: "fourty-si__pill", "aria-label": `${pillLabel} \u2014 open the assistant`, onClick: () => setFolded(false), children: pillLabel }) : /* @__PURE__ */ jsxs("div", { className: "fourty-si__stack", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("div", { ref: setPresenceSlot, className: "fourty-si__presence" }),
|
|
89
|
+
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)) }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "fourty-si__slab", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
type: "button",
|
|
95
|
+
className: "fourty-si__grip",
|
|
96
|
+
"aria-label": threadOpen ? "Close the conversation" : "Open the conversation",
|
|
97
|
+
"aria-expanded": threadOpen,
|
|
98
|
+
onClick: () => setThreadOpen(!threadOpen),
|
|
99
|
+
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
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx("div", { className: "fourty-si__status", "aria-live": "polite", children: status }),
|
|
103
|
+
/* @__PURE__ */ jsxs(
|
|
104
|
+
"form",
|
|
105
|
+
{
|
|
106
|
+
className: "fourty-si__face",
|
|
107
|
+
onSubmit: (event) => {
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
send();
|
|
110
|
+
},
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"input",
|
|
114
|
+
{
|
|
115
|
+
type: "text",
|
|
116
|
+
className: "fourty-si__field",
|
|
117
|
+
"aria-label": placeholder,
|
|
118
|
+
placeholder,
|
|
119
|
+
enterKeyHint: "send",
|
|
120
|
+
autoComplete: "off",
|
|
121
|
+
value: draft,
|
|
122
|
+
onChange: (event) => setDraft(event.target.value),
|
|
123
|
+
onFocus: () => setThreadOpen(false)
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx("button", { type: "submit", className: "fourty-si__stamp", "aria-label": "Send", disabled: working || draft.trim() === "", 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" }) }) })
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] })
|
|
131
|
+
] })
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
SpacefrontIsland
|
|
137
|
+
};
|