@kortix/ui 0.16.3 → 0.16.5
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/_vendor/kortix-shared.js +1 -4
- package/dist/customize/sections/view/review-center-connected.js +64 -71
- package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
- package/dist/customize/sections/view/secret-delivery.js +20 -29
- package/dist/customize/sections/view/secrets-view.js +9 -24
- package/dist/customize/settings/rail-copy-context.d.ts +2 -0
- package/dist/customize/settings/rail-copy-context.js +2 -0
- package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
- package/dist/files/renderers/show-content-renderer.js +3 -1
- package/dist/i18n/en.d.ts +130 -22
- package/dist/i18n/en.js +142 -34
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
- package/dist/internal/auth/auth-card-shell.d.ts +24 -3
- package/dist/internal/auth/auth-card-shell.js +15 -8
- package/dist/internal/auth/auth-primitives.d.ts +15 -2
- package/dist/internal/auth/auth-primitives.js +22 -5
- package/dist/internal/chrome/chrome-connect.d.ts +3 -5
- package/dist/internal/chrome/chrome-connect.js +7 -10
- package/dist/internal/chrome/extension.d.ts +1 -8
- package/dist/internal/chrome/extension.js +1 -8
- package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
- package/dist/internal/chrome/use-chrome-offered.js +13 -15
- package/dist/internal/components/agent-mark.d.ts +2 -1
- package/dist/internal/components/agent-mark.js +14 -3
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/layout/project-nav-row.d.ts +3 -1
- package/dist/internal/layout/project-nav-row.js +2 -2
- package/dist/internal/layout/project-page-header.js +5 -4
- package/dist/internal/stores/user-preferences-store.d.ts +17 -0
- package/dist/internal/stores/user-preferences-store.js +5 -0
- package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
- package/dist/markdown/setup-links/secret-intake-form.js +60 -16
- package/dist/markdown/setup-links/setup-link-button.js +6 -1
- package/dist/primitives/color-picker.d.ts +19 -0
- package/dist/primitives/color-picker.js +27 -0
- package/dist/primitives/faded-scroll-area.js +4 -0
- package/dist/primitives/glyph-picker.d.ts +11 -0
- package/dist/primitives/glyph-picker.js +10 -6
- package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
- package/dist/primitives/gradient-wallpaper-gl.js +446 -0
- package/dist/primitives/gradient-wallpaper.d.ts +20 -0
- package/dist/primitives/gradient-wallpaper.js +242 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/session/agents/agent-hover-card.d.ts +26 -0
- package/dist/session/agents/agent-hover-card.js +70 -0
- package/dist/session/agents/agent-strip.js +33 -7
- package/dist/session/agents/agent-surface.d.ts +26 -1
- package/dist/session/agents/agent-surface.js +57 -6
- package/dist/session/agents/held-messages.js +2 -2
- package/dist/session/agents/subagent-dialog-content.js +2 -2
- package/dist/session/composer/ComposerCard.js +4 -4
- package/dist/session/composer/composer-toolbar.d.ts +8 -1
- package/dist/session/composer/composer-toolbar.js +2 -2
- package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
- package/dist/session/composer/dictation/dictation-control.js +28 -0
- package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
- package/dist/session/composer/dictation/dictation-state.js +71 -0
- package/dist/session/composer/dictation/recorder.d.ts +30 -0
- package/dist/session/composer/dictation/recorder.js +129 -0
- package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
- package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
- package/dist/session/composer/queued-prompt-list.js +5 -1
- package/dist/session/panel/easy/apps-card.js +3 -10
- package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
- package/dist/session/panel/easy/background-tasks-card.js +119 -0
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.js +4 -6
- package/dist/session/panel/easy/context-card.js +8 -9
- package/dist/session/panel/easy/context-meter.d.ts +2 -0
- package/dist/session/panel/easy/context-meter.js +18 -4
- package/dist/session/panel/easy/detail-view.js +7 -4
- package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
- package/dist/session/panel/easy/easy-panel-logic.js +4 -17
- package/dist/session/panel/easy/easy-panel.js +5 -4
- package/dist/session/panel/easy/outputs-card.d.ts +1 -13
- package/dist/session/panel/easy/outputs-card.js +14 -40
- package/dist/session/panel/easy/panel-card.d.ts +13 -40
- package/dist/session/panel/easy/panel-card.js +17 -55
- package/dist/session/panel/easy/plan-card.js +4 -7
- package/dist/session/panel/model-switch-event.d.ts +2 -2
- package/dist/session/panel/model-switch-event.js +13 -9
- package/dist/session/panel/session-panel-provider.d.ts +2 -1
- package/dist/session/panel/session-panel-provider.js +3 -3
- package/dist/session/panel/shared/collect-tool-parts.js +2 -2
- package/dist/session/panel/shared/derive-panels.js +14 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
- package/dist/session/panel/shared/use-panel-handoffs.js +26 -17
- package/dist/session/thread/chat-minimap.js +7 -1
- package/dist/session/thread/session-body.js +1 -1
- package/dist/session/thread/session-chat.js +59 -15
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +7 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +9 -0
- package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
- package/dist/session/tool/shared/infrastructure-rows.js +19 -19
- package/dist/session/tool/show-group-renderer.d.ts +5 -5
- package/dist/session/tool/show-group-renderer.js +7 -4
- package/dist/session/tool/tool-part-renderer.js +25 -9
- package/dist/session/tool/tool-renderers.d.ts +1 -1
- package/dist/session/tool/tool-renderers.js +1 -1
- package/dist/session/tool/tools/bash-tool.js +3 -2
- package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
- package/dist/session/tool/tools/codemode-tool.js +54 -2
- package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +19 -8
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
- package/dist/session/tool/tools/task-tool.js +17 -5
- package/dist/session/turn/peer-message-row.d.ts +3 -0
- package/dist/session/turn/peer-message-row.js +8 -2
- package/dist/session/turn/subagent-notice-row.js +5 -3
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +130 -22
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/wallpaper-gradients.d.ts +106 -0
- package/dist/theme/wallpaper-gradients.js +347 -0
- package/dist/theme/wallpapers.d.ts +23 -3
- package/dist/theme/wallpapers.js +53 -29
- package/dist/workspace/admin/project-admin-dashboard.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -1
- package/dist/workspace/new/use-create-workspace.d.ts +5 -3
- package/dist/workspace/new/use-create-workspace.js +1 -1
- package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
- package/dist/workspace/projects/modal/project-icon-field.js +3 -3
- package/dist/workspace/review/review-center.d.ts +9 -1
- package/dist/workspace/review/review-center.js +107 -14
- package/dist/workspace/review/review-detail.d.ts +19 -0
- package/dist/workspace/review/review-detail.js +18 -3
- package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
- package/dist/workspace/review/review-swipe-deck.js +304 -0
- package/dist/workspace/review/review-swipe.d.ts +17 -0
- package/dist/workspace/review/review-swipe.js +10 -0
- package/dist/workspace/session-spaces/space-picker.js +3 -3
- package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
- package/dist/workspace/setup/setup-banner-snooze.js +44 -0
- package/dist/workspace/setup/setup-banner.js +19 -36
- package/dist/workspace/setup/setup-steps.d.ts +0 -5
- package/dist/workspace/setup/setup-steps.js +0 -7
- package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
- package/dist/workspace/setup/workspace-setup-modal.js +202 -0
- package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
- package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +24 -5
- package/dist/workspace/sidebar/project-session-list.js +2 -1
- package/dist/workspace/sidebar/project-sidebar.js +6 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
- package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
- package/package.json +14 -10
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/modules.md +3 -1
- package/dist/primitives/toast-clearance.d.ts +0 -36
- package/dist/primitives/toast-clearance.js +0 -94
- package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
- package/dist/workspace/setup/workspace-setup-page.js +0 -91
|
@@ -8,9 +8,9 @@ import Loading from '../../primitives/loading.js';
|
|
|
8
8
|
import { outcomeTint } from '../../internal/outcomes/outcome-vocabulary.js';
|
|
9
9
|
import { useTranslations } from '../../i18n/index.js';
|
|
10
10
|
import { cn } from '../../lib/utils.js';
|
|
11
|
-
import { getSecretSetupLink, submitSecretSetupLink, } from '@kortix/sdk';
|
|
11
|
+
import { getSecretSetupLink, submitBrowserLoginSetupLink, submitSecretSetupLink, } from '@kortix/sdk';
|
|
12
12
|
import { ArrowUpRightIcon, CheckIcon, ClockCountdownIcon, LinkBreakIcon, WarningCircleIcon, } from '@phosphor-icons/react';
|
|
13
|
-
import { Fragment, useEffect, useState } from 'react';
|
|
13
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
14
14
|
import { classifySetupLinkError, describeLinkExpiry, describeWithheldSecrets, splitTextLinks, } from './util.js';
|
|
15
15
|
import { setupLinkApiBase } from './api-base.js';
|
|
16
16
|
/** Every phase that is not the form: tinted tile, title, one muted line. */
|
|
@@ -31,14 +31,19 @@ function LinkedText({ text }) {
|
|
|
31
31
|
* values the human types. Shared by the public /secret-intake/[token] page and
|
|
32
32
|
* the in-chat modal. The value is write-only — it's never read back here.
|
|
33
33
|
*/
|
|
34
|
-
export function SecretIntakeForm({ token, onDone, compact, }) {
|
|
34
|
+
export function SecretIntakeForm({ token, onDone, compact, onLinkInfo, }) {
|
|
35
35
|
const tI18nHardcoded = useTranslations('hardcodedUi');
|
|
36
36
|
const base = setupLinkApiBase();
|
|
37
|
+
const onLinkInfoRef = useRef(onLinkInfo);
|
|
38
|
+
onLinkInfoRef.current = onLinkInfo;
|
|
37
39
|
const [phase, setPhase] = useState('loading');
|
|
38
40
|
const [info, setInfo] = useState(null);
|
|
39
41
|
const [expiresIn, setExpiresIn] = useState(null);
|
|
40
42
|
const [values, setValues] = useState({});
|
|
43
|
+
// A `browser` link asks for website logins: a username and a password each.
|
|
44
|
+
const [logins, setLogins] = useState({});
|
|
41
45
|
// Who can use the values: everyone (the default) or only the person who asked.
|
|
46
|
+
// A website login acts as one person, so it starts as theirs alone.
|
|
42
47
|
const [onlyRequester, setOnlyRequester] = useState(false);
|
|
43
48
|
const tSharing = useTranslations('accessSharing');
|
|
44
49
|
const [error, setError] = useState(null);
|
|
@@ -51,6 +56,8 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
|
|
|
51
56
|
if (cancelled)
|
|
52
57
|
return;
|
|
53
58
|
setInfo(body);
|
|
59
|
+
onLinkInfoRef.current?.(body);
|
|
60
|
+
setOnlyRequester(body.scope === 'browser' && Boolean(body.requester));
|
|
54
61
|
setExpiresIn(describeLinkExpiry(body.expires_at, Date.now()));
|
|
55
62
|
setPhase('ready');
|
|
56
63
|
}
|
|
@@ -76,23 +83,41 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
|
|
|
76
83
|
cancelled = true;
|
|
77
84
|
};
|
|
78
85
|
}, [base, token, tI18nHardcoded]);
|
|
86
|
+
/** A `browser` link's logins with both parts filled; the password is kept verbatim. */
|
|
87
|
+
function filledLogins(fields) {
|
|
88
|
+
const filled = {};
|
|
89
|
+
for (const f of fields) {
|
|
90
|
+
const username = (logins[f.name]?.username ?? '').trim();
|
|
91
|
+
const password = logins[f.name]?.password ?? '';
|
|
92
|
+
if (username && password)
|
|
93
|
+
filled[f.name] = { username, password };
|
|
94
|
+
}
|
|
95
|
+
return filled;
|
|
96
|
+
}
|
|
79
97
|
async function submit() {
|
|
80
98
|
if (!info)
|
|
81
99
|
return;
|
|
100
|
+
const isLoginLink = info.scope === 'browser';
|
|
82
101
|
const filled = {};
|
|
83
102
|
for (const f of info.fields) {
|
|
84
103
|
const v = (values[f.name] ?? '').trim();
|
|
85
104
|
if (v.length > 0)
|
|
86
105
|
filled[f.name] = v;
|
|
87
106
|
}
|
|
88
|
-
|
|
89
|
-
|
|
107
|
+
const filledLoginValues = isLoginLink ? filledLogins(info.fields) : {};
|
|
108
|
+
if (Object.keys(isLoginLink ? filledLoginValues : filled).length === 0) {
|
|
109
|
+
setError(isLoginLink
|
|
110
|
+
? tI18nHardcoded.raw('secretIntakeLogin.missing')
|
|
111
|
+
: 'Enter a value before saving.');
|
|
90
112
|
return;
|
|
91
113
|
}
|
|
92
114
|
setPhase('submitting');
|
|
93
115
|
setError(null);
|
|
94
116
|
try {
|
|
95
|
-
const
|
|
117
|
+
const audience = onlyRequester ? { only_requester: true } : undefined;
|
|
118
|
+
const result = isLoginLink
|
|
119
|
+
? await submitBrowserLoginSetupLink(token, filledLoginValues, { backendUrl: base }, audience)
|
|
120
|
+
: await submitSecretSetupLink(token, filled, { backendUrl: base }, audience);
|
|
96
121
|
setWithheldNotice(describeWithheldSecrets(result));
|
|
97
122
|
setPhase('done');
|
|
98
123
|
onDone?.();
|
|
@@ -139,10 +164,19 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
|
|
|
139
164
|
.join(' ');
|
|
140
165
|
return (_jsx(StatusNotice, { icon: WarningCircleIcon, tone: "warning", title: tI18nHardcoded('secretIntakeWithheld.title', { agent }), description: description }));
|
|
141
166
|
}
|
|
167
|
+
if (info?.scope === 'browser') {
|
|
168
|
+
return (_jsx(StatusNotice, { icon: CheckIcon, tone: "success", title: tI18nHardcoded.raw('secretIntakeLogin.savedTitle'), description: tI18nHardcoded.raw('secretIntakeLogin.savedDescription') }));
|
|
169
|
+
}
|
|
142
170
|
return (_jsx(StatusNotice, { icon: CheckIcon, tone: "success", title: tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextSavedSecurelyd63e94b1'), description: tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextYouCand69604da') }));
|
|
143
171
|
}
|
|
144
172
|
const submitting = phase === 'submitting';
|
|
145
173
|
const fields = info?.fields ?? [];
|
|
174
|
+
const isLogin = info?.scope === 'browser';
|
|
175
|
+
const loginSites = [...new Set(fields.flatMap((f) => f.sites ?? []))];
|
|
176
|
+
const setLogin = (name, patch) => setLogins((current) => {
|
|
177
|
+
const previous = current[name] ?? { username: '', password: '' };
|
|
178
|
+
return { ...current, [name]: { ...previous, ...patch } };
|
|
179
|
+
});
|
|
146
180
|
const footnote = [
|
|
147
181
|
compact
|
|
148
182
|
? null
|
|
@@ -151,16 +185,26 @@ export function SecretIntakeForm({ token, onDone, compact, }) {
|
|
|
151
185
|
]
|
|
152
186
|
.filter(Boolean)
|
|
153
187
|
.join(' ');
|
|
154
|
-
return (_jsxs("div", { className: "space-y-5", children: [_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children:
|
|
155
|
-
? tI18nHardcoded.
|
|
156
|
-
: info?.scope === '
|
|
157
|
-
? tI18nHardcoded.raw('
|
|
158
|
-
:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
188
|
+
return (_jsxs("div", { className: "space-y-5", children: [_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: isLogin
|
|
189
|
+
? tI18nHardcoded('secretIntakeLogin.delivery', { sites: loginSites.join(', ') })
|
|
190
|
+
: info?.scope === 'runtime'
|
|
191
|
+
? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryRuntime1760e931')
|
|
192
|
+
: info?.scope === 'connector'
|
|
193
|
+
? tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryConnectorb21e2055')
|
|
194
|
+
: tI18nHardcoded.raw('autoComponentsSetupLinksSecretIntakeFormJsxTextDeliveryScopec3e2a686') }), _jsxs(FieldGroup, { className: "gap-5", children: [isLogin &&
|
|
195
|
+
fields.map((f) => (_jsxs(Field, { className: "space-y-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-foreground text-sm font-medium", children: f.label || _jsx("code", { className: "font-mono", children: f.name }) }), f.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: _jsx(LinkedText, { text: f.description }) })) : null] }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { htmlFor: `login-${f.name}-username`, className: "text-muted-foreground", children: tI18nHardcoded.raw('secretIntakeLogin.username') }), _jsx(Input, { id: `login-${f.name}-username`, name: `${f.name}-username`, type: "text", autoComplete: "off", spellCheck: false,
|
|
196
|
+
// 16px below `sm` so iOS Safari does not zoom the page on focus.
|
|
197
|
+
className: "max-sm:text-base", value: logins[f.name]?.username ?? '', disabled: submitting, onChange: (e) => setLogin(f.name, { username: e.target.value }) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { htmlFor: `login-${f.name}-password`, className: "text-muted-foreground", children: tI18nHardcoded.raw('secretIntakeLogin.password') }), _jsx(Input, { id: `login-${f.name}-password`, name: `${f.name}-password`, type: "password",
|
|
198
|
+
// Not the Kortix account: keep the browser from filling it in.
|
|
199
|
+
autoComplete: "new-password", spellCheck: false, className: "font-mono max-sm:text-base", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: logins[f.name]?.password ?? '', disabled: submitting, onChange: (e) => setLogin(f.name, { password: e.target.value }), onKeyDown: (e) => {
|
|
200
|
+
if (e.key === 'Enter' && fields.length === 1)
|
|
201
|
+
void submit();
|
|
202
|
+
} })] })] }, f.name))), !isLogin && fields.map((f) => (_jsxs(Field, { className: "space-y-2", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(FieldLabel, { htmlFor: `secret-${f.name}`, className: "text-foreground", children: f.label || _jsx("code", { className: "font-mono", children: f.name }) }), f.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: _jsx(LinkedText, { text: f.description }) })) : null] }), _jsx(Input, { id: `secret-${f.name}`, name: f.name, type: "password", autoComplete: "off", spellCheck: false,
|
|
203
|
+
// 16px below `sm` so iOS Safari does not zoom the page on focus.
|
|
204
|
+
className: "font-mono max-sm:text-base", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: values[f.name] ?? '', disabled: submitting, onChange: (e) => setValues((v) => ({ ...v, [f.name]: e.target.value })), onKeyDown: (e) => {
|
|
205
|
+
if (e.key === 'Enter' && fields.length === 1)
|
|
206
|
+
void submit();
|
|
207
|
+
} })] }, f.name)))] }), info?.requester ? (_jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: tSharing('whoCanUse') }), _jsxs(RadioGroup, { value: onlyRequester ? 'requester' : 'project', onValueChange: (next) => setOnlyRequester(next === 'requester'), className: "space-y-2", children: [_jsx(RadioGroupItem, { value: "project", id: "secret-intake-everyone", label: tSharing('everyone', { project: info.project_name }), description: tSharing('everyoneMeta'), size: "lg", variant: "outline", disabled: submitting }), _jsx(RadioGroupItem, { value: "requester", id: "secret-intake-requester", label: info.requester.label
|
|
164
208
|
? tSharing('onlyRequester', { name: info.requester.label })
|
|
165
209
|
: tSharing('onlyRequesterUnnamed'), description: tSharing('onlyRequesterDescription'), size: "lg", variant: "outline", disabled: submitting })] })] })) : null, _jsxs("div", { className: "space-y-3", children: [error ? (_jsx("p", { role: "alert", className: "text-destructive text-xs", children: error })) : null, _jsxs(Button, { type: "button", className: "w-full", onClick: submit, disabled: submitting, children: [submitting ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, submitting
|
|
166
210
|
? tI18nHardcoded.raw('i18nComplete.text23e39291d613')
|
|
@@ -82,6 +82,9 @@ export function SetupLinkButton({ kind, token, children, }) {
|
|
|
82
82
|
* omits the field, and that card reads "Waiting for you" again after a reload.
|
|
83
83
|
*/
|
|
84
84
|
const [settledHere, setSettled] = useState(false);
|
|
85
|
+
// A secret link that asks for a website login titles its dialog as one.
|
|
86
|
+
const [secretScope, setSecretScope] = useState(null);
|
|
87
|
+
const tLogin = useTranslations('hardcodedUi');
|
|
85
88
|
const inline = useContext(SetupLinkInlineContext);
|
|
86
89
|
const localizedCopy = useLocalizedUiCatalog(COPY);
|
|
87
90
|
const titles = useLocalizedUiCatalog(CONNECTOR_TITLES);
|
|
@@ -146,5 +149,7 @@ export function SetupLinkButton({ kind, token, children, }) {
|
|
|
146
149
|
// The query container for `ConnectorHandshake`'s narrow layout. Below
|
|
147
150
|
// 28rem the title wraps to two lines instead of cutting off the app name.
|
|
148
151
|
titleClassName: "@max-md/connect:line-clamp-2 @max-md/connect:whitespace-normal", className: "@container/connect my-2" }));
|
|
149
|
-
return (_jsxs(_Fragment, { children: [card, token !== null && kind === 'connector' && ConnectorConnectModal ? (_jsx(ConnectorConnectModal, { token: token, open: open, onOpenChange: handleOpenChange, onConnected: handleSettled, fallbackName: appName })) : null, token !== null && kind === 'secret' ? (_jsx(Modal, { open: open, onOpenChange: handleOpenChange, children: _jsxs(ModalContent, { className: "lg:max-w-lg", children: [_jsxs(ModalHeader, { className: "pr-12", children: [_jsx(ModalTitle, { children:
|
|
152
|
+
return (_jsxs(_Fragment, { children: [card, token !== null && kind === 'connector' && ConnectorConnectModal ? (_jsx(ConnectorConnectModal, { token: token, open: open, onOpenChange: handleOpenChange, onConnected: handleSettled, fallbackName: appName })) : null, token !== null && kind === 'secret' ? (_jsx(Modal, { open: open, onOpenChange: handleOpenChange, children: _jsxs(ModalContent, { className: "lg:max-w-lg", children: [_jsxs(ModalHeader, { className: "pr-12", children: [_jsx(ModalTitle, { children: secretScope === 'browser' ? tLogin.raw('secretIntakeLogin.modalTitle') : copy.title }), _jsx(ModalDescription, { className: "text-pretty", children: secretScope === 'browser'
|
|
153
|
+
? tLogin.raw('secretIntakeLogin.modalDescription')
|
|
154
|
+
: copy.blurb })] }), _jsx(ModalBody, { className: "max-h-[60vh] overflow-y-auto", children: _jsx(SecretIntakeForm, { token: token, compact: true, onDone: handleSettled, onLinkInfo: (linkInfo) => setSecretScope(linkInfo.scope ?? null) }) })] }) })) : null] }));
|
|
150
155
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour picker panel with the same shape as the project icon picker's
|
|
3
|
+
* colour row (`glyph-picker.tsx`): a row of preset dots, a divider, and a
|
|
4
|
+
* rainbow dot that swaps the row for the custom field. The selected dot
|
|
5
|
+
* carries a ring in its own colour; no glyph is drawn on it (HEX, a
|
|
6
|
+
* saturation/value square, a hue rail). Built for a `PopoverContent`.
|
|
7
|
+
*
|
|
8
|
+
* `value` and every preset are `#rrggbb`. A pick never closes the panel, so
|
|
9
|
+
* the result can be judged live; clicking outside closes it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ColorPickerPanel({ value, presets, onChange, customLabel, presetLabel, }: {
|
|
12
|
+
value: string;
|
|
13
|
+
presets: readonly string[];
|
|
14
|
+
onChange: (color: string) => void;
|
|
15
|
+
/** Accessible name of the rainbow dot. */
|
|
16
|
+
customLabel: string;
|
|
17
|
+
/** Accessible name of a preset dot, given its hex value. */
|
|
18
|
+
presetLabel: (color: string) => string;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { COLOR_DOT, COLOR_DOT_RAINBOW, CustomColor } from './glyph-picker.js';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* A colour picker panel with the same shape as the project icon picker's
|
|
8
|
+
* colour row (`glyph-picker.tsx`): a row of preset dots, a divider, and a
|
|
9
|
+
* rainbow dot that swaps the row for the custom field. The selected dot
|
|
10
|
+
* carries a ring in its own colour; no glyph is drawn on it (HEX, a
|
|
11
|
+
* saturation/value square, a hue rail). Built for a `PopoverContent`.
|
|
12
|
+
*
|
|
13
|
+
* `value` and every preset are `#rrggbb`. A pick never closes the panel, so
|
|
14
|
+
* the result can be judged live; clicking outside closes it.
|
|
15
|
+
*/
|
|
16
|
+
export function ColorPickerPanel({ value, presets, onChange, customLabel, presetLabel, }) {
|
|
17
|
+
const current = value.toLowerCase();
|
|
18
|
+
const isPreset = presets.some((preset) => preset.toLowerCase() === current);
|
|
19
|
+
const [customOpen, setCustomOpen] = useState(!isPreset);
|
|
20
|
+
if (customOpen) {
|
|
21
|
+
return _jsx(CustomColor, { color: current, onChange: onChange, onClose: () => setCustomOpen(false) });
|
|
22
|
+
}
|
|
23
|
+
return (_jsxs("div", { className: "flex h-12 items-center justify-between gap-2 px-4", children: [presets.map((preset) => {
|
|
24
|
+
const selected = preset.toLowerCase() === current;
|
|
25
|
+
return (_jsx("button", { type: "button", "aria-pressed": selected, "aria-label": presetLabel(preset), onClick: () => onChange(preset.toLowerCase()), style: { background: preset, '--glyph': preset }, className: cn(COLOR_DOT, selected && 'ring-offset-popover ring-[1.5px] ring-[color:var(--glyph)] ring-offset-2') }, preset));
|
|
26
|
+
}), _jsx("span", { "aria-hidden": true, className: "bg-border h-5 w-px shrink-0" }), _jsx("button", { type: "button", "aria-pressed": !isPreset, "aria-label": customLabel, onClick: () => setCustomOpen(true), className: cn(COLOR_DOT, COLOR_DOT_RAINBOW, !isPreset && 'ring-foreground ring-offset-popover ring-[1.5px] ring-offset-2') })] }));
|
|
27
|
+
}
|
|
@@ -57,6 +57,10 @@ export const FadedScrollArea = React.forwardRef(function FadedScrollArea({ child
|
|
|
57
57
|
return;
|
|
58
58
|
const ro = new ResizeObserver(updateScrollFades);
|
|
59
59
|
ro.observe(el);
|
|
60
|
+
// Rows that load after mount grow the content, not the box: watch both.
|
|
61
|
+
// Assumes stable direct children (one list element, as the callers use).
|
|
62
|
+
for (const child of el.children)
|
|
63
|
+
ro.observe(child);
|
|
60
64
|
el.addEventListener('scroll', updateScrollFades, { passive: true });
|
|
61
65
|
window.addEventListener('resize', updateScrollFades);
|
|
62
66
|
// Stop wheel/touch events here, so a scroll lock listening on an ancestor
|
|
@@ -2,6 +2,8 @@ export interface GlyphSelection {
|
|
|
2
2
|
name: string;
|
|
3
3
|
color: string;
|
|
4
4
|
}
|
|
5
|
+
export declare const COLOR_DOT: string;
|
|
6
|
+
export declare const COLOR_DOT_RAINBOW = "bg-[conic-gradient(from_180deg,#f25f5c,#f7b32b,#a6d96a,#4fc3f7,#7e57c2,#e05fbf,#f25f5c)]";
|
|
5
7
|
/**
|
|
6
8
|
* A glyph's keyword list always includes its own lowercased name, so an empty
|
|
7
9
|
* query matches everything. `startsWith`, not `includes`: a substring test
|
|
@@ -16,3 +18,12 @@ export declare function GlyphPicker({ color, selected, onColorChange, onGlyphSel
|
|
|
16
18
|
onGlyphSelect: (glyph: GlyphSelection) => void;
|
|
17
19
|
className?: string;
|
|
18
20
|
}): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* The custom colour field: a HEX input, a saturation/value square and a hue
|
|
23
|
+
* rail. Shared with `color-picker.tsx`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function CustomColor({ color, onChange, onClose, }: {
|
|
26
|
+
color: string;
|
|
27
|
+
onChange: (color: string) => void;
|
|
28
|
+
onClose: () => void;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
@@ -38,10 +38,10 @@ const SWATCH = {
|
|
|
38
38
|
purple: 'bg-glyph-solid-purple',
|
|
39
39
|
magenta: 'bg-glyph-solid-magenta',
|
|
40
40
|
};
|
|
41
|
-
const
|
|
41
|
+
export const COLOR_DOT = cn('relative flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full', 'transition-[scale,box-shadow] duration-fast active:scale-[0.92]', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover');
|
|
42
42
|
/** Selected dot: a ring one gap away, in the dot's own colour. */
|
|
43
43
|
const DOT_SELECTED = 'ring-[1.5px] ring-offset-2 ring-offset-popover ring-[color:var(--glyph)]';
|
|
44
|
-
const
|
|
44
|
+
export const COLOR_DOT_RAINBOW = 'bg-[conic-gradient(from_180deg,#f25f5c,#f7b32b,#a6d96a,#4fc3f7,#7e57c2,#e05fbf,#f25f5c)]';
|
|
45
45
|
/**
|
|
46
46
|
* A glyph's keyword list always includes its own lowercased name, so an empty
|
|
47
47
|
* query matches everything. `startsWith`, not `includes`: a substring test
|
|
@@ -70,8 +70,8 @@ export function GlyphPicker({ color, selected, onColorChange, onGlyphSelect, cla
|
|
|
70
70
|
.filter((group) => group.names.length > 0);
|
|
71
71
|
return (_jsxs("div", { style: glyphStyle(resolved), className: cn('isolate flex h-[388px] w-full flex-col', className), children: [customOpen ? (_jsx(CustomColor, { color: isCustom ? resolved : presetHex(resolved), onChange: onColorChange, onClose: () => setCustomOpen(false) })) : (_jsxs("div", { className: "border-border flex h-12 shrink-0 items-center justify-between border-b px-4", children: [PROJECT_GLYPH_COLORS.map((preset) => {
|
|
72
72
|
const selected = preset === resolved;
|
|
73
|
-
return (_jsx("button", { type: "button", "data-swatch": preset, "aria-pressed": selected, "aria-label": `Colour: ${preset}`, onClick: () => onColorChange(preset), style: selected ? { '--glyph': `var(--glyph-solid-${preset})` } : undefined, className: cn(
|
|
74
|
-
}), _jsx("span", { "aria-hidden": true, className: "bg-border h-5 w-px" }), _jsx("button", { type: "button", "data-swatch": "custom", "aria-pressed": isCustom, "aria-label": "Custom colour", onClick: () => setCustomOpen(true), className: cn(
|
|
73
|
+
return (_jsx("button", { type: "button", "data-swatch": preset, "aria-pressed": selected, "aria-label": `Colour: ${preset}`, onClick: () => onColorChange(preset), style: selected ? { '--glyph': `var(--glyph-solid-${preset})` } : undefined, className: cn(COLOR_DOT, SWATCH[preset], selected && DOT_SELECTED), children: selected ? _jsx(CheckIcon, { weight: "bold", className: "size-3 text-white" }) : null }, preset));
|
|
74
|
+
}), _jsx("span", { "aria-hidden": true, className: "bg-border h-5 w-px" }), _jsx("button", { type: "button", "data-swatch": "custom", "aria-pressed": isCustom, "aria-label": "Custom colour", onClick: () => setCustomOpen(true), className: cn(COLOR_DOT, COLOR_DOT_RAINBOW, isCustom && 'ring-foreground ring-offset-popover ring-[1.5px] ring-offset-2') })] })), _jsx("div", { className: "border-border flex h-11 shrink-0 items-center border-b px-4", children: _jsx("input", { type: "search", "aria-label": "Search icons", placeholder: "Search icons\u2026", value: search, onChange: (event) => setSearch(event.target.value), className: "text-foreground placeholder:text-muted-foreground h-full w-full bg-transparent text-sm outline-none [&::-webkit-search-cancel-button]:appearance-none" }) }), _jsx("div", { className: "relative flex-1 overflow-y-auto px-3 pb-3 select-none", children: groups.length > 0 ? (groups.map((group) => (_jsxs("section", { "aria-label": group.label, children: [_jsx("h3", { className: "text-muted-foreground px-1 pt-3 pb-1.5 text-xs font-medium", children: group.label }), _jsx("div", { className: "grid grid-cols-10", children: group.names.map((name) => {
|
|
75
75
|
const Glyph = glyphComponent(name);
|
|
76
76
|
if (!Glyph)
|
|
77
77
|
return null;
|
|
@@ -141,7 +141,11 @@ function useDrag(onMove) {
|
|
|
141
141
|
},
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
/**
|
|
145
|
+
* The custom colour field: a HEX input, a saturation/value square and a hue
|
|
146
|
+
* rail. Shared with `color-picker.tsx`.
|
|
147
|
+
*/
|
|
148
|
+
export function CustomColor({ color, onChange, onClose, }) {
|
|
145
149
|
const [hsv, setHsv] = useState(() => hexToHsv(color));
|
|
146
150
|
const [draft, setDraft] = useState(color.slice(1).toUpperCase());
|
|
147
151
|
const hex = hsvToHex(hsv);
|
|
@@ -161,7 +165,7 @@ function CustomColor({ color, onChange, onClose, }) {
|
|
|
161
165
|
setHsv(hexToHsv(value));
|
|
162
166
|
onChange(value);
|
|
163
167
|
}
|
|
164
|
-
}, className: "text-foreground -ml-2 w-20 bg-transparent font-mono text-sm tabular-nums outline-none" })] }), _jsx("button", { type: "button", "aria-label": "Back to preset colours", onClick: onClose, className: cn(
|
|
168
|
+
}, className: "text-foreground -ml-2 w-20 bg-transparent font-mono text-sm tabular-nums outline-none" })] }), _jsx("button", { type: "button", "aria-label": "Back to preset colours", onClick: onClose, className: cn(COLOR_DOT, COLOR_DOT_RAINBOW, 'ring-foreground ring-offset-popover ring-[1.5px] ring-offset-2') })] }), _jsxs("div", { className: "flex gap-3", children: [_jsx("div", { ...square, role: "slider", "aria-label": "Saturation and brightness", "aria-valuenow": Math.round(hsv.s * 100), "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuetext": hex, className: "relative h-32 flex-1 cursor-crosshair touch-none rounded-md", style: {
|
|
165
169
|
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, ${hsvToHex({ h: hsv.h, s: 1, v: 1 })})`,
|
|
166
170
|
}, children: _jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute size-4 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgb(0_0_0/0.25),0_1px_3px_rgb(0_0_0/0.4)]", style: { left: `${hsv.s * 100}%`, top: `${(1 - hsv.v) * 100}%`, background: hex } }) }), _jsx("div", { ...rail, role: "slider", "aria-label": "Hue", "aria-valuenow": Math.round(hsv.h), "aria-valuemin": 0, "aria-valuemax": 360, className: "relative h-32 w-2.5 cursor-ns-resize touch-none rounded-full bg-[linear-gradient(to_bottom,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)]", children: _jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute left-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgb(0_0_0/0.25)]", style: { top: `${(hsv.h / 360) * 100}%`, background: hsvToHex({ h: hsv.h, s: 1, v: 1 }) } }) })] })] }));
|
|
167
171
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gradient wallpaper renderer: one single-pass WebGL1 fragment shader for
|
|
3
|
+
* every colored wallpaper.
|
|
4
|
+
*
|
|
5
|
+
* Frame budget. The canvas is `pixelScale()` CSS pixels per canvas pixel
|
|
6
|
+
* (2, or more on a very large page), at any device pixel ratio, and the
|
|
7
|
+
* browser upscales it. A canvas never exceeds `MAX_CANVAS_PIXELS` (1 MP): a
|
|
8
|
+
* 1920×1080 page is 960×540 (0.5 MP), a 3840×2160 page is 1280×720 (0.9 MP),
|
|
9
|
+
* against 8.3 MP for a native canvas. The dither finish wants this anyway
|
|
10
|
+
* (its dots are 2 CSS px), and the grain finish is all low frequencies, so
|
|
11
|
+
* the upscale is not visible.
|
|
12
|
+
*
|
|
13
|
+
* Per pixel, a pattern costs 0 to 2 four-octave noise lookups (16 hashes
|
|
14
|
+
* each). The dither finish evaluates the pattern twice, at the cell and at
|
|
15
|
+
* its block, except for `clouds`, which evaluates it once. The worst case is
|
|
16
|
+
* 4 lookups: a dithered `bloom` or `mesh`.
|
|
17
|
+
*
|
|
18
|
+
* The context is created with `failIfMajorPerformanceCaveat`: a browser that
|
|
19
|
+
* would run WebGL on the CPU gets no canvas and the CSS fallback instead.
|
|
20
|
+
*
|
|
21
|
+
* The output is premultiplied color over a transparent canvas. The page's
|
|
22
|
+
* real background shows through, so a wallpaper works on every interface
|
|
23
|
+
* theme without knowing its background color.
|
|
24
|
+
*/
|
|
25
|
+
import { type GradientFinish, type GradientPattern } from '../theme/wallpaper-gradients.js';
|
|
26
|
+
/** The fewest CSS pixels per canvas pixel. */
|
|
27
|
+
export declare const PIXEL_SCALE = 2;
|
|
28
|
+
/** The most pixels a wallpaper canvas holds. */
|
|
29
|
+
export declare const MAX_CANVAS_PIXELS = 1000000;
|
|
30
|
+
/** CSS pixels per canvas pixel for a host of this CSS size: a whole number,
|
|
31
|
+
* so every canvas pixel covers the same number of device pixels. */
|
|
32
|
+
export declare function pixelScale(cssWidth: number, cssHeight: number): number;
|
|
33
|
+
export interface GradientDrawParams {
|
|
34
|
+
pattern: GradientPattern;
|
|
35
|
+
finish: GradientFinish;
|
|
36
|
+
/** 2–5 hex colors. */
|
|
37
|
+
colors: string[];
|
|
38
|
+
calm: number;
|
|
39
|
+
anchor?: [number, number];
|
|
40
|
+
}
|
|
41
|
+
export interface GradientRenderer {
|
|
42
|
+
/** Draws one frame at `time` seconds. The canvas size is read at draw. */
|
|
43
|
+
draw(params: GradientDrawParams, time: number): void;
|
|
44
|
+
/** True after the browser took the context away: `draw` then does nothing. */
|
|
45
|
+
isLost(): boolean;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|
|
48
|
+
export declare function hexToRgb(hex: string): [number, number, number];
|
|
49
|
+
/** The `u_colors` uniform: `colors` as RGB triples, padded with the last. */
|
|
50
|
+
export declare function packColors(colors: string[]): Float32Array;
|
|
51
|
+
/**
|
|
52
|
+
* Returns null when WebGL is unavailable or the program does not build. The
|
|
53
|
+
* caller then renders nothing: a wallpaper is decoration.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createGradientRenderer(canvas: HTMLCanvasElement): GradientRenderer | null;
|
|
56
|
+
/**
|
|
57
|
+
* Draws one frame into `target`, a 2D canvas, at the target's own size. That
|
|
58
|
+
* size is the canvas a page would get: a 480×270 target shows what a 960×540
|
|
59
|
+
* page shows. Returns false, and leaves the target alone, without WebGL.
|
|
60
|
+
*/
|
|
61
|
+
export declare function drawGradientStill(params: GradientDrawParams, target: HTMLCanvasElement): boolean;
|