@datalayer/design 1.0.8 → 1.0.10
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/lib/avatar/SvgAvatarOrb.d.ts +25 -8
- package/lib/avatar/SvgAvatarOrb.js +55 -11
- package/lib/avatar/index.d.ts +1 -1
- package/lib/avatar/index.js +1 -1
- package/lib/pages/SvgPage.js +17 -15
- package/lib/svg/SvgOgStacked.d.ts +26 -0
- package/lib/svg/SvgOgStacked.js +48 -0
- package/lib/svg/gallery.d.ts +1 -1
- package/lib/svg/gallery.js +1 -0
- package/lib/svg/index.d.ts +1 -0
- package/lib/svg/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type ColorPalette } from '@datalayer/primer-addons';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* What the avatar is doing: the floating assistant's states, each acted out.
|
|
4
|
+
*
|
|
5
|
+
* - `idle`: resting, its colours swirling slowly.
|
|
6
|
+
* - `greeting`: it has just appeared — a pop, then the idle swirl.
|
|
7
|
+
* - `thinking`: working on an answer — a faster swirl, a ring leaving it.
|
|
8
|
+
* - `working`: running a long task — the fastest swirl, an arc orbiting it.
|
|
9
|
+
* - `waiting`: waiting for the person — a slow, breathing glow around it.
|
|
10
|
+
* - `speaking`: an answer arriving — a gentle pulse, as of a voice.
|
|
11
|
+
* - `paused`: its application paused — still, and greyed.
|
|
12
|
+
* - `goodbye`: being sent away — it shrinks and fades, once.
|
|
13
|
+
*/
|
|
14
|
+
export type AvatarOrbState = 'idle' | 'greeting' | 'thinking' | 'working' | 'waiting' | 'speaking' | 'paused' | 'goodbye';
|
|
15
|
+
/** Every state, in the order a picker shows them. */
|
|
16
|
+
export declare const AVATAR_ORB_STATES: readonly AvatarOrbState[];
|
|
4
17
|
/**
|
|
5
18
|
* Its colours: `iridescent`, the cyan, pink and lavender of an agent's orb
|
|
6
19
|
* (after CopilotKit's, on its Soar page); `theme`, the theme's own bright
|
|
@@ -10,7 +23,7 @@ export type AvatarOrbTone = 'iridescent' | 'theme';
|
|
|
10
23
|
type SvgAvatarOrbProps = {
|
|
11
24
|
/** Its diameter in pixels (it is drawn in a 100-unit box). @default 32 */
|
|
12
25
|
size?: number;
|
|
13
|
-
/**
|
|
26
|
+
/** What it is doing (`AvatarOrbState`). @default 'idle' */
|
|
14
27
|
state?: AvatarOrbState;
|
|
15
28
|
/** @default 'iridescent' */
|
|
16
29
|
tone?: AvatarOrbTone;
|
|
@@ -21,13 +34,17 @@ type SvgAvatarOrbProps = {
|
|
|
21
34
|
};
|
|
22
35
|
/**
|
|
23
36
|
* An agent's avatar: an iridescent sphere whose colours swirl inside it,
|
|
24
|
-
* after the orb CopilotKit shows beside its agents
|
|
25
|
-
*
|
|
26
|
-
* shading (a pale light high on
|
|
37
|
+
* after the orb CopilotKit shows beside its agents, acting out what the agent
|
|
38
|
+
* is doing (`state`). Soft blobs of colour turn about the centre at different
|
|
39
|
+
* speeds, blurred together, under a sphere's shading (a pale light high on
|
|
40
|
+
* the left, a darker edge) and a thin rim.
|
|
27
41
|
*
|
|
28
42
|
* Pure SVG and SMIL, so it animates wherever an image does; ids are scoped
|
|
29
|
-
* with `useId`, so several avatars share a page.
|
|
30
|
-
*
|
|
43
|
+
* with `useId`, so several avatars share a page. The drawing starts again on
|
|
44
|
+
* each change of state, so a state's one-off motion (greeting, goodbye) plays
|
|
45
|
+
* from the moment it begins. A reduced-motion reader sees it still: no
|
|
46
|
+
* animation is drawn at all (a CSS rule cannot stop SMIL), each state keeping
|
|
47
|
+
* its still pose — the ring, the glow, the arc held where they stand.
|
|
31
48
|
*/
|
|
32
49
|
export declare function SvgAvatarOrb({ size, state, tone, palette, title }: SvgAvatarOrbProps): import("react").JSX.Element;
|
|
33
50
|
export default SvgAvatarOrb;
|
|
@@ -4,14 +4,47 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
*
|
|
5
5
|
* CC BY 4.0 License
|
|
6
6
|
*/
|
|
7
|
-
import { useId } from 'react';
|
|
7
|
+
import { Fragment, useId, useSyncExternalStore } from 'react';
|
|
8
8
|
import { useColorPalette } from '@datalayer/primer-addons';
|
|
9
|
+
/** Every state, in the order a picker shows them. */
|
|
10
|
+
export const AVATAR_ORB_STATES = [
|
|
11
|
+
'idle',
|
|
12
|
+
'greeting',
|
|
13
|
+
'thinking',
|
|
14
|
+
'working',
|
|
15
|
+
'waiting',
|
|
16
|
+
'speaking',
|
|
17
|
+
'paused',
|
|
18
|
+
'goodbye',
|
|
19
|
+
];
|
|
9
20
|
const IRIDESCENT = { a: '#1fd0ff', b: '#ff4fae', c: '#c4bdff' };
|
|
21
|
+
/* How fast each state swirls: the blobs' durations are idle's, divided by this. */
|
|
22
|
+
const PACE = {
|
|
23
|
+
idle: 1,
|
|
24
|
+
greeting: 1.5,
|
|
25
|
+
thinking: 3,
|
|
26
|
+
working: 5,
|
|
27
|
+
waiting: 0.8,
|
|
28
|
+
speaking: 2,
|
|
29
|
+
paused: 0,
|
|
30
|
+
goodbye: 1.5,
|
|
31
|
+
};
|
|
32
|
+
const REDUCED_MOTION = '(prefers-reduced-motion: reduce)';
|
|
33
|
+
/* Whether the reader asks for reduced motion, followed as it changes. */
|
|
34
|
+
function subscribeReducedMotion(onChange) {
|
|
35
|
+
if (typeof window === 'undefined' || !window.matchMedia)
|
|
36
|
+
return () => { };
|
|
37
|
+
const query = window.matchMedia(REDUCED_MOTION);
|
|
38
|
+
query.addEventListener('change', onChange);
|
|
39
|
+
return () => query.removeEventListener('change', onChange);
|
|
40
|
+
}
|
|
41
|
+
function prefersReducedMotion() {
|
|
42
|
+
return typeof window !== 'undefined' && !!window.matchMedia && window.matchMedia(REDUCED_MOTION).matches;
|
|
43
|
+
}
|
|
10
44
|
/*
|
|
11
45
|
* The blobs inside the sphere: each a soft ellipse off the centre, turning
|
|
12
46
|
* about it at its own speed and in its own direction, so the colours flow
|
|
13
|
-
* into one another and never settle into one figure.
|
|
14
|
-
* thinking runs them three times faster.
|
|
47
|
+
* into one another and never settle into one figure.
|
|
15
48
|
*/
|
|
16
49
|
const BLOBS = [
|
|
17
50
|
{ colour: 'c', cx: 50, cy: 50, rx: 46, ry: 46, dur: 0, turn: 1, tilt: 0 },
|
|
@@ -21,23 +54,34 @@ const BLOBS = [
|
|
|
21
54
|
{ colour: 'b', cx: 40, cy: 72, rx: 20, ry: 11, dur: 6, turn: -1, tilt: 20 },
|
|
22
55
|
{ colour: 'a', cx: 70, cy: 64, rx: 18, ry: 10, dur: 8, turn: 1, tilt: -40 },
|
|
23
56
|
];
|
|
57
|
+
/** A scale about the sphere's centre, as SMIL's `values` take it. */
|
|
58
|
+
const scaled = (factors) => factors.map(f => `${50 - 50 * f} ${50 - 50 * f}`).join(';');
|
|
59
|
+
const scales = (factors) => factors.join(';');
|
|
24
60
|
/**
|
|
25
61
|
* An agent's avatar: an iridescent sphere whose colours swirl inside it,
|
|
26
|
-
* after the orb CopilotKit shows beside its agents
|
|
27
|
-
*
|
|
28
|
-
* shading (a pale light high on
|
|
62
|
+
* after the orb CopilotKit shows beside its agents, acting out what the agent
|
|
63
|
+
* is doing (`state`). Soft blobs of colour turn about the centre at different
|
|
64
|
+
* speeds, blurred together, under a sphere's shading (a pale light high on
|
|
65
|
+
* the left, a darker edge) and a thin rim.
|
|
29
66
|
*
|
|
30
67
|
* Pure SVG and SMIL, so it animates wherever an image does; ids are scoped
|
|
31
|
-
* with `useId`, so several avatars share a page.
|
|
32
|
-
*
|
|
68
|
+
* with `useId`, so several avatars share a page. The drawing starts again on
|
|
69
|
+
* each change of state, so a state's one-off motion (greeting, goodbye) plays
|
|
70
|
+
* from the moment it begins. A reduced-motion reader sees it still: no
|
|
71
|
+
* animation is drawn at all (a CSS rule cannot stop SMIL), each state keeping
|
|
72
|
+
* its still pose — the ring, the glow, the arc held where they stand.
|
|
33
73
|
*/
|
|
34
74
|
export function SvgAvatarOrb({ size = 32, state = 'idle', tone = 'iridescent', palette, title }) {
|
|
35
75
|
const current = useColorPalette();
|
|
36
76
|
const p = palette ?? current;
|
|
37
77
|
const id = useId().replace(/[^a-zA-Z0-9_-]/g, '');
|
|
38
|
-
const
|
|
39
|
-
const pace =
|
|
78
|
+
const moving = !useSyncExternalStore(subscribeReducedMotion, prefersReducedMotion, () => false);
|
|
79
|
+
const pace = PACE[state];
|
|
80
|
+
const swirling = moving && pace > 0;
|
|
40
81
|
const colours = tone === 'theme' ? { a: p.spark, b: p.blaze, c: p.surge, white: '#ffffff' } : { ...IRIDESCENT, white: '#ffffff' };
|
|
41
|
-
|
|
82
|
+
const paused = state === 'paused';
|
|
83
|
+
// The whole sphere's own motion: a pop, a pulse, a fade.
|
|
84
|
+
const body = !moving ? null : state === 'greeting' ? (_jsxs(Fragment, { children: [_jsx("animateTransform", { attributeName: "transform", type: "translate", values: scaled([0.4, 1.12, 0.96, 1]), keyTimes: "0;0.5;0.75;1", dur: "0.9s", fill: "freeze" }), _jsx("animateTransform", { attributeName: "transform", type: "scale", additive: "sum", values: scales([0.4, 1.12, 0.96, 1]), keyTimes: "0;0.5;0.75;1", dur: "0.9s", fill: "freeze" })] })) : state === 'speaking' ? (_jsxs(Fragment, { children: [_jsx("animateTransform", { attributeName: "transform", type: "translate", values: scaled([1, 1.05, 0.99, 1.04, 1]), dur: "0.8s", repeatCount: "indefinite" }), _jsx("animateTransform", { attributeName: "transform", type: "scale", additive: "sum", values: scales([1, 1.05, 0.99, 1.04, 1]), dur: "0.8s", repeatCount: "indefinite" })] })) : state === 'goodbye' ? (_jsxs(Fragment, { children: [_jsx("animateTransform", { attributeName: "transform", type: "translate", values: scaled([1, 1.06, 0.3]), keyTimes: "0;0.25;1", dur: "1.1s", fill: "freeze" }), _jsx("animateTransform", { attributeName: "transform", type: "scale", additive: "sum", values: scales([1, 1.06, 0.3]), keyTimes: "0;0.25;1", dur: "1.1s", fill: "freeze" }), _jsx("animate", { attributeName: "opacity", values: "1;1;0", keyTimes: "0;0.25;1", dur: "1.1s", fill: "freeze" })] })) : null;
|
|
85
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 100 100", role: title ? 'img' : undefined, "aria-hidden": title ? undefined : true, "aria-label": title, "data-avatar-orb-state": state, style: { overflow: 'visible' }, children: [title ? _jsx("title", { children: title }) : null, _jsxs("defs", { children: [_jsx("clipPath", { id: `${id}-clip`, children: _jsx("circle", { cx: "50", cy: "50", r: "44" }) }), _jsx("filter", { id: `${id}-blend`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: _jsx("feGaussianBlur", { stdDeviation: "4.5" }) }), _jsx("filter", { id: `${id}-paused`, children: _jsx("feColorMatrix", { type: "saturate", values: "0.15" }) }), _jsxs("radialGradient", { id: `${id}-light`, cx: "0.32", cy: "0.28", r: "0.55", children: [_jsx("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "0.55" }), _jsx("stop", { offset: "100%", stopColor: "#ffffff", stopOpacity: "0" })] }), _jsxs("radialGradient", { id: `${id}-edge`, cx: "0.5", cy: "0.5", r: "0.5", children: [_jsx("stop", { offset: "72%", stopColor: colours.c, stopOpacity: "0" }), _jsx("stop", { offset: "100%", stopColor: colours.c, stopOpacity: "0.55" })] }), _jsxs("radialGradient", { id: `${id}-glow`, cx: "0.5", cy: "0.5", r: "0.5", children: [_jsx("stop", { offset: "70%", stopColor: colours.a, stopOpacity: "0.5" }), _jsx("stop", { offset: "100%", stopColor: colours.a, stopOpacity: "0" })] })] }), _jsxs("g", { id: id, opacity: paused ? 0.6 : 1, filter: paused ? `url(#${id}-paused)` : undefined, children: [body, state === 'waiting' ? (_jsx("circle", { cx: "50", cy: "50", r: "56", fill: `url(#${id}-glow)`, opacity: moving ? 0.4 : 0.7, children: moving ? _jsx("animate", { attributeName: "opacity", values: "0.25;0.85;0.25", dur: "2.6s", repeatCount: "indefinite" }) : null })) : null, state === 'thinking' ? (_jsx("circle", { cx: "50", cy: "50", r: moving ? 44 : 48, fill: "none", stroke: colours.a, strokeWidth: "3", opacity: moving ? 1 : 0.5, children: moving ? (_jsxs(Fragment, { children: [_jsx("animate", { attributeName: "r", values: "44;52", dur: "1.4s", repeatCount: "indefinite" }), _jsx("animate", { attributeName: "opacity", values: "0.7;0", dur: "1.4s", repeatCount: "indefinite" })] })) : null })) : null, state === 'working' ? (_jsx("circle", { cx: "50", cy: "50", r: "49", fill: "none", stroke: colours.b, strokeWidth: "3.5", strokeLinecap: "round", strokeDasharray: "60 248", children: moving ? (_jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 50 50", to: "360 50 50", dur: "1.2s", repeatCount: "indefinite" })) : null })) : null, _jsxs("g", { clipPath: `url(#${id}-clip)`, children: [_jsx("g", { filter: `url(#${id}-blend)`, children: BLOBS.map((blob, index) => (_jsxs("g", { children: [swirling && blob.dur ? (_jsx("animateTransform", { attributeName: "transform", type: "rotate", from: `0 50 50`, to: `${360 * blob.turn} 50 50`, dur: `${blob.dur / pace}s`, repeatCount: "indefinite" })) : null, _jsx("ellipse", { cx: blob.cx, cy: blob.cy, rx: blob.rx, ry: blob.ry, transform: `rotate(${blob.tilt} ${blob.cx} ${blob.cy})`, fill: colours[blob.colour], opacity: blob.colour === 'white' ? 0.85 : 0.95, children: swirling && blob.dur ? (_jsx("animate", { attributeName: "rx", values: `${blob.rx};${blob.rx * 1.25};${blob.rx}`, dur: `${(blob.dur * 0.7 + index) / pace}s`, repeatCount: "indefinite" })) : null })] }, index))) }), _jsx("circle", { cx: "50", cy: "50", r: "44", fill: `url(#${id}-light)` }), _jsx("circle", { cx: "50", cy: "50", r: "44", fill: `url(#${id}-edge)` })] }), _jsx("circle", { cx: "50", cy: "50", r: "43.5", fill: "none", stroke: "#ffffff", strokeOpacity: "0.35", strokeWidth: "1" })] })] }, state));
|
|
42
86
|
}
|
|
43
87
|
export default SvgAvatarOrb;
|
package/lib/avatar/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SvgAvatarOrb } from './SvgAvatarOrb';
|
|
1
|
+
export { SvgAvatarOrb, AVATAR_ORB_STATES } from './SvgAvatarOrb';
|
|
2
2
|
export type { AvatarOrbState, AvatarOrbTone } from './SvgAvatarOrb';
|
|
3
3
|
export { DATALAYER_AVATAR_GALLERY } from './gallery';
|
|
4
4
|
export type { DatalayerAvatarGalleryName } from './gallery';
|
package/lib/avatar/index.js
CHANGED
package/lib/pages/SvgPage.js
CHANGED
|
@@ -7,7 +7,7 @@ import GIF from 'gif.js';
|
|
|
7
7
|
import gifWorkerUrl from 'gif.js/dist/gif.worker.js?url';
|
|
8
8
|
import { DatalayerLogo, DatalayerLogoText, DatalayerTextAI, getLogoColors, useColorPalette, useThemeStore, } from '@datalayer/primer-addons';
|
|
9
9
|
import { DATALAYER_SVG_GALLERY } from '../svg/gallery';
|
|
10
|
-
import { SvgAvatarOrb } from '../avatar';
|
|
10
|
+
import { AVATAR_ORB_STATES, SvgAvatarOrb } from '../avatar';
|
|
11
11
|
import DI from '../svg/SvgDI';
|
|
12
12
|
import { SvgDla as DlaMark } from '../svg/SvgDla';
|
|
13
13
|
import * as SvgAssets from '../svg';
|
|
@@ -288,18 +288,24 @@ function SvgAI2Preview(props) {
|
|
|
288
288
|
function SvgAI3Preview(props) {
|
|
289
289
|
return _jsx(SvgAIMarkPreview, { ariaLabel: "AI3 mark", Component: SvgAssets.SvgAI3, props: props });
|
|
290
290
|
}
|
|
291
|
-
/*
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
/*
|
|
292
|
+
* The avatar in the gallery: one card for each tone, and under it a button
|
|
293
|
+
* for each state the floating assistant acts out, to see each one. Pressing
|
|
294
|
+
* the state shown again plays it again (greeting and goodbye play once).
|
|
295
|
+
*/
|
|
296
|
+
function AvatarOrbCard({ tone, title }) {
|
|
297
|
+
const [state, setState] = useState('idle');
|
|
298
|
+
const [replay, setReplay] = useState(0);
|
|
299
|
+
return (_jsxs(Box, { sx: { width: '100%', display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2, py: 2 }, children: [_jsx(Box, { sx: { minHeight: 150, display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(SvgAvatarOrb, { size: 120, state: state, tone: tone, title: `${title}, ${state}` }, replay) }), _jsx(Box, { role: "group", "aria-label": "Avatar state", onClick: (event) => event.stopPropagation(), sx: { display: 'flex', flexWrap: 'wrap', gap: 1, justifyContent: 'center' }, children: AVATAR_ORB_STATES.map(one => (_jsx(Button, { size: "small", variant: one === state ? 'primary' : 'default', "aria-pressed": one === state, onClick: () => {
|
|
300
|
+
setState(one);
|
|
301
|
+
setReplay(count => count + 1);
|
|
302
|
+
}, children: one }, one))) })] }));
|
|
294
303
|
}
|
|
295
304
|
function SvgAvatarOrbPreview() {
|
|
296
|
-
return _jsx(AvatarOrbCard, {
|
|
297
|
-
}
|
|
298
|
-
function SvgAvatarOrbThinkingPreview() {
|
|
299
|
-
return _jsx(AvatarOrbCard, { state: "thinking", tone: "iridescent", title: "Avatar, thinking" });
|
|
305
|
+
return _jsx(AvatarOrbCard, { tone: "iridescent", title: "Avatar" });
|
|
300
306
|
}
|
|
301
307
|
function SvgAvatarOrbThemePreview() {
|
|
302
|
-
return _jsx(AvatarOrbCard, {
|
|
308
|
+
return _jsx(AvatarOrbCard, { tone: "theme", title: "Avatar, in the theme's colours" });
|
|
303
309
|
}
|
|
304
310
|
const SVG_COMPONENT_OVERRIDES = {
|
|
305
311
|
SvgSpitfire: SvgSpitfireInline,
|
|
@@ -371,10 +377,6 @@ const DATALAYER_SVGS = [
|
|
|
371
377
|
name: 'SvgAvatarOrb',
|
|
372
378
|
Component: SvgAvatarOrbPreview,
|
|
373
379
|
},
|
|
374
|
-
{
|
|
375
|
-
name: 'SvgAvatarOrbThinking',
|
|
376
|
-
Component: SvgAvatarOrbThinkingPreview,
|
|
377
|
-
},
|
|
378
380
|
{
|
|
379
381
|
name: 'SvgAvatarOrbTheme',
|
|
380
382
|
Component: SvgAvatarOrbThemePreview,
|
|
@@ -396,7 +398,7 @@ const LOGO_SVG_NAMES = new Set([
|
|
|
396
398
|
'SvgLinesColored',
|
|
397
399
|
'SvgLinesLogo',
|
|
398
400
|
]);
|
|
399
|
-
const COMMUNICATION_SVG_NAMES = new Set(['SvgDiscord', 'SvgFastA2ADonation', 'SvgJupyterMcp', 'SvgJupyterMcp2', 'SvgOSAContributions', 'SvgOg', 'SvgRadar']);
|
|
401
|
+
const COMMUNICATION_SVG_NAMES = new Set(['SvgDiscord', 'SvgFastA2ADonation', 'SvgJupyterMcp', 'SvgJupyterMcp2', 'SvgOSAContributions', 'SvgOg', 'SvgOgStacked', 'SvgRadar']);
|
|
400
402
|
const CASES_SVG_NAMES = new Set(['SvgEarthHero', 'SvgUsecasesHero', 'SvgLightHouse']);
|
|
401
403
|
const ARTIFACTS_SVG_NAMES = new Set([
|
|
402
404
|
'SvgNotebookArtifact',
|
|
@@ -411,7 +413,7 @@ const ARTIFACTS_SVG_NAMES = new Set([
|
|
|
411
413
|
]);
|
|
412
414
|
const PIXELS_SVG_NAMES = new Set(['SvgPixel1', 'SvgPixel2']);
|
|
413
415
|
/* An agent's avatar, drawn in the theme's colours (src/avatar). */
|
|
414
|
-
const AVATAR_SVG_NAMES = new Set(['SvgAvatarOrb', '
|
|
416
|
+
const AVATAR_SVG_NAMES = new Set(['SvgAvatarOrb', 'SvgAvatarOrbTheme']);
|
|
415
417
|
const PICTOS_SVG_NAMES = new Set(['SvgSkubble']);
|
|
416
418
|
/*
|
|
417
419
|
* The marks of the companies Datalayer works WITH, which are not
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open Graph card for Datalayer, stacked: the mark, the wordmark under it,
|
|
3
|
+
* and the baseline under that, all inside the card's centre square.
|
|
4
|
+
*
|
|
5
|
+
* 1200×630 (1.91:1), as `SvgOg`, so Facebook, LinkedIn, X, Slack and Discord
|
|
6
|
+
* show it whole. The difference is for the apps that crop a link's picture
|
|
7
|
+
* to a square around its centre — WhatsApp's thumbnail, among others: there
|
|
8
|
+
* a wide wordmark is cut to its middle letters, blown up. Stacked, everything
|
|
9
|
+
* sits in the centre 630×630, so the square crop is the whole card's subject.
|
|
10
|
+
*
|
|
11
|
+
* The wordmark is drawn from outlines (no web font) and the baseline from a
|
|
12
|
+
* system stack, so it rasterises the same wherever it is exported.
|
|
13
|
+
*/
|
|
14
|
+
import { type ColorMode, type ColorPalette, type ThemeVariant } from '@datalayer/primer-addons';
|
|
15
|
+
type SvgOgStackedProps = {
|
|
16
|
+
/** The line under the wordmark. */
|
|
17
|
+
tagline?: string;
|
|
18
|
+
/** Background palette. Derived from `variant`/`colorMode` when absent. */
|
|
19
|
+
palette?: ColorPalette;
|
|
20
|
+
/** Draw the card for this theme rather than for the reader's own. */
|
|
21
|
+
variant?: ThemeVariant;
|
|
22
|
+
/** The colour mode to go with `variant`. The store's when absent. */
|
|
23
|
+
colorMode?: ColorMode;
|
|
24
|
+
};
|
|
25
|
+
export declare function SvgOgStacked({ tagline, palette: paletteProp, variant, colorMode: colorModeProp, }?: SvgOgStackedProps): import("react").JSX.Element;
|
|
26
|
+
export default SvgOgStacked;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022-2026 Datalayer, Inc.
|
|
4
|
+
*
|
|
5
|
+
* CC BY 4.0 License
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Open Graph card for Datalayer, stacked: the mark, the wordmark under it,
|
|
9
|
+
* and the baseline under that, all inside the card's centre square.
|
|
10
|
+
*
|
|
11
|
+
* 1200×630 (1.91:1), as `SvgOg`, so Facebook, LinkedIn, X, Slack and Discord
|
|
12
|
+
* show it whole. The difference is for the apps that crop a link's picture
|
|
13
|
+
* to a square around its centre — WhatsApp's thumbnail, among others: there
|
|
14
|
+
* a wide wordmark is cut to its middle letters, blown up. Stacked, everything
|
|
15
|
+
* sits in the centre 630×630, so the square crop is the whole card's subject.
|
|
16
|
+
*
|
|
17
|
+
* The wordmark is drawn from outlines (no web font) and the baseline from a
|
|
18
|
+
* system stack, so it rasterises the same wherever it is exported.
|
|
19
|
+
*/
|
|
20
|
+
import { DatalayerLogo, DatalayerText, getColorPalette, getLogoColors, useThemeStore, } from '@datalayer/primer-addons';
|
|
21
|
+
const WIDTH = 1200;
|
|
22
|
+
const HEIGHT = 630;
|
|
23
|
+
/* The mark, square, centred. */
|
|
24
|
+
const MARK_SIZE = 200;
|
|
25
|
+
const MARK_Y = 100;
|
|
26
|
+
/*
|
|
27
|
+
* The wordmark's ink, in `DatalayerText`'s own coordinates at its base scale
|
|
28
|
+
* (0.7, `x`=0, `y`=0): 72.457×15.002 outline units from (17.358, 281.998),
|
|
29
|
+
* measured with getBBox on the rendered outlines.
|
|
30
|
+
*/
|
|
31
|
+
const WORD_INK = { x: 17.358 * 0.7, y: 281.998 * 0.7, width: 72.457 * 0.7, height: 15.002 * 0.7 };
|
|
32
|
+
const WORD_WIDTH = 460;
|
|
33
|
+
const WORD_HEIGHT = (WORD_WIDTH / WORD_INK.width) * WORD_INK.height;
|
|
34
|
+
const WORD_Y = MARK_Y + MARK_SIZE + 34;
|
|
35
|
+
const TAGLINE_SIZE = 52;
|
|
36
|
+
const TAGLINE_BASELINE = WORD_Y + WORD_HEIGHT + 30 + TAGLINE_SIZE;
|
|
37
|
+
export function SvgOgStacked({ tagline = 'Agent Applications', palette: paletteProp, variant, colorMode: colorModeProp, } = {}) {
|
|
38
|
+
const stored = useThemeStore();
|
|
39
|
+
const theme = variant ?? stored.theme;
|
|
40
|
+
const colorMode = colorModeProp ?? stored.colorMode;
|
|
41
|
+
const effectiveColorMode = colorMode === 'auto'
|
|
42
|
+
? (typeof window !== 'undefined' && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
|
|
43
|
+
: colorMode;
|
|
44
|
+
const logoColors = getLogoColors(theme, effectiveColorMode);
|
|
45
|
+
const p = paletteProp ?? getColorPalette(theme, effectiveColorMode);
|
|
46
|
+
return (_jsxs("svg", { viewBox: `0 0 ${WIDTH} ${HEIGHT}`, xmlns: "http://www.w3.org/2000/svg", style: { width: '100%', height: 'auto', display: 'block' }, role: "img", "aria-label": `Datalayer — ${tagline}`, children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: "og-stacked-bg", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [_jsx("stop", { offset: "0%", stopColor: p.bg }), _jsx("stop", { offset: "100%", stopColor: p.bgAlt })] }), _jsxs("radialGradient", { id: "og-stacked-halo", cx: "50%", cy: "45%", r: "55%", children: [_jsx("stop", { offset: "0%", stopColor: p.primary, stopOpacity: p.isLight ? '0.14' : '0.24' }), _jsx("stop", { offset: "100%", stopColor: p.primary, stopOpacity: "0" })] }), _jsx("pattern", { id: "og-stacked-dots", width: "40", height: "40", patternUnits: "userSpaceOnUse", children: _jsx("circle", { cx: "20", cy: "20", r: "1", fill: p.primary, opacity: p.isLight ? '0.14' : '0.10' }) })] }), _jsx("rect", { width: WIDTH, height: HEIGHT, fill: "url(#og-stacked-bg)" }), _jsx("rect", { width: WIDTH, height: HEIGHT, fill: "url(#og-stacked-dots)" }), _jsx("rect", { width: WIDTH, height: HEIGHT, fill: "url(#og-stacked-halo)" }), _jsx(DatalayerLogo, { size: MARK_SIZE, x: (WIDTH - MARK_SIZE) / 2, y: MARK_Y, variant: theme, colorMode: effectiveColorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary }), _jsx("svg", { x: (WIDTH - WORD_WIDTH) / 2, y: WORD_Y, width: WORD_WIDTH, height: WORD_HEIGHT, viewBox: `${WORD_INK.x} ${WORD_INK.y} ${WORD_INK.width} ${WORD_INK.height}`, children: _jsx(DatalayerText, { primaryColor: logoColors.primary, secondaryColor: logoColors.textColor, x: 0, y: 0 }) }), _jsx("text", { x: WIDTH / 2, y: TAGLINE_BASELINE, textAnchor: "middle", fill: p.textLight, fontSize: TAGLINE_SIZE, fontWeight: "600", letterSpacing: "0.5", fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif", children: tagline })] }));
|
|
47
|
+
}
|
|
48
|
+
export default SvgOgStacked;
|
package/lib/svg/gallery.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DATALAYER_SVG_GALLERY: readonly ["SvgJupyterEmbed", "SvgAgentRuntimes", "SvgVSCodeExtension", "SvgBlogHero", "SvgPricingHero", "SvgContactHero", "SvgAgentsHomeHero", "SvgLoginHero", "SvgUsecasesHero", "SvgIntegrationsHero", "SvgPartnersHero", "SvgChangelogHero", "SvgAboutHero", "SvgCareersHero", "SvgCommunityHero", "SvgJoin", "SvgJoinConfirm", "SvgInvites", "SvgDiscord", "SvgTutorialsHero", "SvgResearchHero", "SvgEvalsHero", "SvgEventsHero", "SvgStarsHero", "SvgSpitfire", "SvgBlackSnake", "SvgLinesLogo", "SvgOrganizationsAtScale", "SvgIndividualsAndTeams", "SvgAgentsHero", "SvgLibraryHero", "SvgEarthHero", "SvgOg", "SvgLightHouse", "SvgDaytonaStartupGrid", "SvgFastA2ADonation", "SvgJupyterMcp", "SvgJupyterMcp2", "SvgOSAContributions", "SvgRadar", "SvgNotebookArtifact", "SvgDocumentArtifact", "SvgDeckArtifact", "SvgCellArtifact", "SvgCellOutputshotPlaceholder", "SvgLessonArtifact", "SvgExerciseArtifact", "SvgAssignmentArtifact", "SvgDataset", "SvgLines", "SvgPublication", "SvgPixel1", "SvgPixel2", "SvgSkubble", "SvgEricCharles", "SvgPrivacyHero", "SvgTermsHero", "SvgNotFound", "SvgUnauthorized", "SvgAI", "SvgAI2", "SvgAI3", "SvgDI", "SvgDla"];
|
|
1
|
+
export declare const DATALAYER_SVG_GALLERY: readonly ["SvgJupyterEmbed", "SvgAgentRuntimes", "SvgVSCodeExtension", "SvgBlogHero", "SvgPricingHero", "SvgContactHero", "SvgAgentsHomeHero", "SvgLoginHero", "SvgUsecasesHero", "SvgIntegrationsHero", "SvgPartnersHero", "SvgChangelogHero", "SvgAboutHero", "SvgCareersHero", "SvgCommunityHero", "SvgJoin", "SvgJoinConfirm", "SvgInvites", "SvgDiscord", "SvgTutorialsHero", "SvgResearchHero", "SvgEvalsHero", "SvgEventsHero", "SvgStarsHero", "SvgSpitfire", "SvgBlackSnake", "SvgLinesLogo", "SvgOrganizationsAtScale", "SvgIndividualsAndTeams", "SvgAgentsHero", "SvgLibraryHero", "SvgEarthHero", "SvgOg", "SvgOgStacked", "SvgLightHouse", "SvgDaytonaStartupGrid", "SvgFastA2ADonation", "SvgJupyterMcp", "SvgJupyterMcp2", "SvgOSAContributions", "SvgRadar", "SvgNotebookArtifact", "SvgDocumentArtifact", "SvgDeckArtifact", "SvgCellArtifact", "SvgCellOutputshotPlaceholder", "SvgLessonArtifact", "SvgExerciseArtifact", "SvgAssignmentArtifact", "SvgDataset", "SvgLines", "SvgPublication", "SvgPixel1", "SvgPixel2", "SvgSkubble", "SvgEricCharles", "SvgPrivacyHero", "SvgTermsHero", "SvgNotFound", "SvgUnauthorized", "SvgAI", "SvgAI2", "SvgAI3", "SvgDI", "SvgDla"];
|
|
2
2
|
export type DatalayerSvgGalleryName = (typeof DATALAYER_SVG_GALLERY)[number];
|
package/lib/svg/gallery.js
CHANGED
package/lib/svg/index.d.ts
CHANGED
|
@@ -67,4 +67,5 @@ export { SvgTermsHero } from './SvgTermsHero';
|
|
|
67
67
|
export { SvgNotFound } from './SvgNotFound';
|
|
68
68
|
export { SvgUnauthorized } from './SvgUnauthorized';
|
|
69
69
|
export { SvgOg } from './SvgOg';
|
|
70
|
+
export { SvgOgStacked } from './SvgOgStacked';
|
|
70
71
|
export { SvgLightHouse } from './SvgLightHouse';
|
package/lib/svg/index.js
CHANGED
|
@@ -66,4 +66,5 @@ export { SvgTermsHero } from './SvgTermsHero';
|
|
|
66
66
|
export { SvgNotFound } from './SvgNotFound';
|
|
67
67
|
export { SvgUnauthorized } from './SvgUnauthorized';
|
|
68
68
|
export { SvgOg } from './SvgOg';
|
|
69
|
+
export { SvgOgStacked } from './SvgOgStacked';
|
|
69
70
|
export { SvgLightHouse } from './SvgLightHouse';
|