@stackone/malachite 2.113.0 → 2.114.0
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/COMPONENTS.md +2 -1
- package/dist/components/Confetti.js +46 -45
- package/dist/components/Confetti.js.map +1 -1
- package/dist/components/LoadingScreen.js +133 -0
- package/dist/components/LoadingScreen.js.map +1 -0
- package/dist/components/confettiPhysics.js +57 -0
- package/dist/components/confettiPhysics.js.map +1 -0
- package/dist/components/stackOneWordmarkPaths.js +10 -0
- package/dist/components/stackOneWordmarkPaths.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +318 -316
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -47,12 +47,13 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
|
|
|
47
47
|
- **`UsageCard`** — A small metered card: a title (optionally a link via `titleLink`, drawn with a trailing arrow), a right-aligned `detail` such as "700/1,000", and a body, usually a `Progress`. Used by `Sidebar.Usage`, and fine on its own, e.g. on a billing page. _Key props:_ `title`, `titleLink`, `detail`, `children`, `aria-label` (required; names the group), `busy` (sets `aria-busy` only).
|
|
48
48
|
- **`Progress`** — Progress bar.
|
|
49
49
|
- **`LoadingBar`** — Indeterminate full-width loading line; the variant colour sweeps across a pale track for work of unknown duration. Toggle `active` rather than unmounting, so the reserved height prevents layout shift. _Key props:_ `active`, `LoadingBarVariant` (`default` | `warning` | `error`), `LoadingBarSize` (`small` | `medium` | `large`), `aria-label`, `aria-labelledby`, `className`, `style`.
|
|
50
|
+
- **`LoadingScreen`** — The whole viewport while an app has nothing to show yet: the StackOne wordmark over a bar scanning back and forth, on the sunken page background, in either theme. It matches the screen unified-cloud paints before its bundle loads, so a page handing over to it, or from it, reads as one wait (an IdP page a sign-out passes through, say). Fixed to the viewport; render it as the page, not inside a card. Reduced motion stops the scan at full width. For loading inside a page use `LoadingBar` or `Skeleton`. _Key props:_ `aria-label` (default "Loading"), `aria-labelledby`, `className`.
|
|
50
51
|
- **`ToastProvider`** — Transient top-centre toasts for the outcome of an action. Wrap the app once in `ToastProvider` and call `useToast().show({ message, variant })` anywhere beneath it. Corners match a medium button. Each toast auto-dismisses, pauses while hovered and dismisses on click; at most three show at once. Toasts are announced through always-mounted live regions (`status` for success, `alert` for error), and the pills themselves are hidden from assistive tech and never take focus, so they cannot fight a dialog's focus trap. The host mounts on the first toast and joins the top layer, so toasts paint above elevated side panels. _Key props:_ `ToastProvider`: `children`, `duration` (ms, default 3000). `useToast()` → `show({ message, variant })`, `ToastVariant` (`success` | `error`, default `success`).
|
|
51
52
|
- **`Spinner`** — Loading spinner.
|
|
52
53
|
- **`Skeleton`** — Loading placeholders. Includes `Skeleton.Avatar` and `Skeleton.Input`. The shimmer stops under `prefers-reduced-motion`, leaving the plain placeholder.
|
|
53
54
|
- **`Tooltip`** — Hover/focus tooltip; also works on disabled controls (see CLAUDE.md). It describes its trigger once shown, so `describesTrigger={false}` where the same sentence is already on screen and referenced — otherwise a screen reader reads it twice. _Key props:_ `text`, `placement`, `delay`, `maxWidth`, `shouldShow`, `triggerAs`, `describesTrigger`, `isShrinkable`, `fill`, `wrapChildren`, `suppressed` (holds the tooltip back, e.g. while the popup its trigger opens is up), `showOnFocus` (false where script can move focus onto the trigger, e.g. an option a panel focuses on open), `focusableTrigger` (makes a trigger that cannot take focus — text, a static `Tag` — a tab stop, so the tooltip is not mouse-only; not for focusable children).
|
|
54
55
|
- **`TruncatedTooltip`** — Shows a tooltip only when its text is truncated.
|
|
55
|
-
- **`Confetti`** — Celebratory confetti burst for success moments. _Key props:_ `
|
|
56
|
+
- **`Confetti`** — Celebratory confetti burst for success moments: two cannons at the bottom corners throw the pieces up, then they flutter down, tumbling, and fade, on one canvas over the viewport. Fires once on mount; re-mount it (a changing `key`) to replay. Theme colours by default, green-led. Skipped entirely under `prefers-reduced-motion`. _Key props:_ `count` (default 150), `colors` (picked at random; list one twice to weight it), `className`.
|
|
56
57
|
- **`ConfirmationDialog`** — Asks the customer to confirm one consequential action — a preset over `Modal`, not a second dialog implementation. `variant` picks a whole coherent set at once (badge fill, tray tint, caption colour, badge icon and confirm-button variant), so `destructive` cannot end up with a non-destructive confirm button; `destructive` also renders as `role="alertdialog"`, and `description` is wired to the dialog through `aria-describedby`, so the consequence is announced and not just the title. `confirmPhrase` gates the confirm action on typing that exact phrase, for a consequence severe enough that one click should not be able to cause it — the typed value and the phrase are both trimmed, since copying a name picks up a trailing space and a saved name can carry padding that never renders, except that a phrase of only whitespace is matched exactly as given, so an empty field cannot confirm it; the match stays case-sensitive, and the field clears each time the dialog opens, being a per-decision gate rather than a value. Neither a destructive dialog nor one carrying a `confirmPhrase` dismisses on a scrim click, and `loading` suppresses the pointer routes — the scrim and the close button — as well as disabling the buttons. It never suppresses ESC: that is the only guaranteed keyboard exit from a focus trap, so it always reaches `onClose` and whether to abort is left to the caller. ESC reaches it whenever it is the topmost overlay, so it can be opened over a panel. `confirmDisabled` holds only the confirm action back, for a consequence still being worked out (a check the callout reports on, so pair it with a callout saying why); cancel and every dismissal route stay live. `callout` renders an `Alert` in a full-width band at the top of the body — it scrolls with the body rather than being pinned under the header, and with no `description`, `children` or `confirmPhrase` there is no body, so the band sits directly on the footer — and its `type` is chosen independently of `variant` — the frames pair a green badge with an amber callout. `titleAdornment` names the entity beside the title, `badgeIcon` overrides the variant’s glyph for an action-specific one, and `tip` is the `{ label?, message }` caption on the tray beneath the card, which `Modal` renders and describes. `children` is where extra body content goes. `onConfirm` does not close the dialog, so the caller can hold it open on `loading` while the request is in flight. `confirmPhraseLabel` also takes `{ prefix, suffix }`, which renders the phrase itself as a copyable token between the two — the gate is case-sensitive and space-exact inside the phrase, so a customer who has identified the right entity should not be locked out by a glyph they cannot tell apart. The copy control sits outside the element that names the field, so “Copy…” never lands in the field’s accessible name; `confirmPhraseCopyLabel` names it and `onPhraseCopied` reports a completed write with the phrase it copied. A rejected write says so in the field rather than failing silently, and the control is disabled where the Clipboard API is unavailable. A near miss is named rather than left to a disabled button: typing the phrase with the wrong case or the wrong spacing says which, once the whole phrase is there, and that message is the field’s `aria-describedby`. _Key props:_ `open`, `onClose`, `onConfirm`, `title`, `description`, `titleAdornment`, `badgeIcon`, `variant` (`default` | `warning` | `destructive` | `success`), `callout`, `confirmPhrase`, `confirmPhraseLabel`, `confirmPhraseCopyLabel`, `confirmPhrasePlaceholder`, `onPhraseCopied`, `confirmLabel`, `cancelLabel`, `loading`, `confirmDisabled`, `tip`, `size`, `aria-label`, `aria-labelledby`.
|
|
57
58
|
|
|
58
59
|
## Forms & inputs
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"var(--malachite-
|
|
6
|
-
"var(--malachite-
|
|
7
|
-
"var(--malachite-
|
|
8
|
-
"var(--malachite-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as O, jsx as C } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as m, useEffect as S } from "react";
|
|
3
|
+
import { createPieces as F, stepPiece as _, isFinished as k, isLaunched as T, wobbleOf as j, opacityOf as L } from "./confettiPhysics.js";
|
|
4
|
+
const P = [
|
|
5
|
+
"var(--malachite-accent-background, rgb(0, 175, 102))",
|
|
6
|
+
"var(--malachite-accent-background, rgb(0, 175, 102))",
|
|
7
|
+
"var(--malachite-accent-foreground, rgb(2, 122, 66))",
|
|
8
|
+
"var(--malachite-tag-primary-foreground, rgb(37, 130, 234))",
|
|
9
|
+
"var(--malachite-tag-assistant-foreground, rgb(110, 86, 207))"
|
|
10
|
+
], M = "\0", D = 0.72, K = 1 / 30, N = () => typeof window > "u" || typeof window.matchMedia != "function" ? !0 : window.matchMedia("(prefers-reduced-motion: reduce)").matches, q = (o, u) => u.map((i) => {
|
|
11
|
+
o.style.color = i;
|
|
12
|
+
const r = getComputedStyle(o).color || i, a = r.match(/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/), s = a ? `rgb(${a.slice(1, 4).map((l) => Math.round(Number(l) * D)).join(", ")})` : r;
|
|
13
|
+
return { front: r, back: s };
|
|
14
|
+
}), H = ({
|
|
15
|
+
count: o = 150,
|
|
16
|
+
colors: u = P,
|
|
17
|
+
className: i = ""
|
|
13
18
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const a =
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
{
|
|
33
|
-
duration: 2600 + e * 17 % 1600,
|
|
34
|
-
delay: e * 11 % 500,
|
|
35
|
-
easing: "cubic-bezier(0.2, 0.6, 0.4, 1)",
|
|
36
|
-
fill: "forwards"
|
|
37
|
-
}
|
|
38
|
-
), t;
|
|
39
|
-
});
|
|
40
|
-
return () => {
|
|
41
|
-
for (const c of m) c.remove();
|
|
19
|
+
const r = m(null), a = m(null), s = m(null), l = u.join(M);
|
|
20
|
+
return S(() => {
|
|
21
|
+
const g = r.current, n = a.current, p = s.current;
|
|
22
|
+
if (!g || !n || !p || N()) return;
|
|
23
|
+
const e = n.getContext("2d");
|
|
24
|
+
if (!e) return;
|
|
25
|
+
const w = q(p, l.split(M)), b = g.getBoundingClientRect(), d = { width: b.width, height: b.height }, h = window.devicePixelRatio || 1;
|
|
26
|
+
n.width = Math.round(d.width * h), n.height = Math.round(d.height * h);
|
|
27
|
+
const f = F(o, w.length, d), c = { frame: 0, last: performance.now() }, v = (R) => {
|
|
28
|
+
const E = Math.min((R - c.last) / 1e3, K);
|
|
29
|
+
c.last = R, e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(0, 0, n.width, n.height);
|
|
30
|
+
const y = f.filter((t) => (_(t, E), !k(t, d)));
|
|
31
|
+
for (const t of y.filter(T)) {
|
|
32
|
+
const A = Math.cos(t.tilt), x = w[t.colorIndex];
|
|
33
|
+
e.setTransform(h, 0, 0, h, 0, 0), e.translate(t.x + j(t), t.y), e.rotate(t.rotation), e.scale(1, A), e.globalAlpha = L(t), e.fillStyle = A >= 0 ? x.front : x.back, e.fillRect(-t.width / 2, -t.height / 2, t.width, t.height);
|
|
34
|
+
}
|
|
35
|
+
f.splice(0, f.length, ...y), f.length > 0 && (c.frame = requestAnimationFrame(v));
|
|
42
36
|
};
|
|
43
|
-
|
|
37
|
+
return c.frame = requestAnimationFrame(v), () => {
|
|
38
|
+
cancelAnimationFrame(c.frame), e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(0, 0, n.width, n.height);
|
|
39
|
+
};
|
|
40
|
+
}, [o, l]), /* @__PURE__ */ O(
|
|
44
41
|
"div",
|
|
45
42
|
{
|
|
46
|
-
ref:
|
|
43
|
+
ref: r,
|
|
47
44
|
"aria-hidden": !0,
|
|
48
|
-
className: `pointer-events-none fixed inset-0 overflow-hidden z-50 ${
|
|
45
|
+
className: `pointer-events-none fixed inset-0 overflow-hidden z-50 ${i}`,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ C("canvas", { ref: a, style: { width: "100%", height: "100%", display: "block" } }),
|
|
48
|
+
/* @__PURE__ */ C("span", { ref: s, style: { display: "none" } })
|
|
49
|
+
]
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
};
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
H as Confetti,
|
|
55
|
+
H as default
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=Confetti.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Confetti.js","sources":["../../src/components/Confetti.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\n\n// Theme tokens
|
|
1
|
+
{"version":3,"file":"Confetti.js","sources":["../../src/components/Confetti.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport {\n type ConfettiViewport,\n createPieces,\n isFinished,\n isLaunched,\n opacityOf,\n stepPiece,\n wobbleOf,\n} from './confettiPhysics';\n\n// Theme tokens, resolved in the component's own subtree so they follow light and dark. Green\n// leads (listed twice), with the brand's blue and purple; no status colours, which would read\n// as a warning in the middle of a celebration.\nconst DEFAULT_COLORS = [\n 'var(--malachite-accent-background, rgb(0, 175, 102))',\n 'var(--malachite-accent-background, rgb(0, 175, 102))',\n 'var(--malachite-accent-foreground, rgb(2, 122, 66))',\n 'var(--malachite-tag-primary-foreground, rgb(37, 130, 234))',\n 'var(--malachite-tag-assistant-foreground, rgb(110, 86, 207))',\n];\n\n/** Joins the palette into a content key; NUL cannot occur in a CSS colour value. */\nconst COLORS_KEY_SEPARATOR = '\\u0000';\n\n// The face turned away from the viewer is drawn this much darker, so a tumbling piece flashes.\nconst BACK_FACE_SHADE = 0.72;\n// A frame after a stall (a background tab) is stepped as this much time at most, so pieces do\n// not teleport.\nconst MAX_FRAME_SECONDS = 1 / 30;\n\n/**\n * `window.matchMedia` is absent under SSR and in older test environments. When it cannot\n * be consulted, assume reduced motion — skipping a decorative burst is the safe default.\n */\nconst prefersReducedMotion = (): boolean => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return true;\n }\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n};\n\ninterface ResolvedColor {\n front: string;\n back: string;\n}\n\n// A canvas cannot read `var()`, so each colour is resolved through a probe in this subtree,\n// where the theme's custom properties apply.\nconst resolveColors = (probe: HTMLElement, palette: string[]): ResolvedColor[] =>\n palette.map((color) => {\n probe.style.color = color;\n const front = getComputedStyle(probe).color || color;\n const channels = front.match(/rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)/);\n const back = channels\n ? `rgb(${channels\n .slice(1, 4)\n .map((channel) => Math.round(Number(channel) * BACK_FACE_SHADE))\n .join(', ')})`\n : front;\n return { front, back };\n });\n\nexport interface ConfettiProps {\n /** Number of confetti pieces, split between the two cannons. */\n count?: number;\n /** Colors picked at random across the pieces; list one twice to weight it. */\n colors?: string[];\n className?: string;\n}\n\n// A burst from two cannons at the bottom corners, drawn on one canvas: the pieces are thrown up\n// against gravity and air drag, then flutter down, tumbling, and fade. Fires once on mount and\n// skips entirely under prefers-reduced-motion; it is aria-hidden decoration carrying nothing.\nconst Confetti: React.FC<ConfettiProps> = ({\n count = 150,\n colors = DEFAULT_COLORS,\n className = '',\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const probeRef = useRef<HTMLSpanElement>(null);\n\n // Keyed on the palette's contents, not the array's identity: an inline\n // `colors={['red', 'blue']}` is a new array every render and would re-fire the burst.\n const colorsKey = colors.join(COLORS_KEY_SEPARATOR);\n\n useEffect(() => {\n const container = ref.current;\n const canvas = canvasRef.current;\n const probe = probeRef.current;\n if (!container || !canvas || !probe || prefersReducedMotion()) return;\n const context = canvas.getContext('2d');\n if (!context) return;\n\n const palette = resolveColors(probe, colorsKey.split(COLORS_KEY_SEPARATOR));\n const bounds = container.getBoundingClientRect();\n const viewport: ConfettiViewport = { width: bounds.width, height: bounds.height };\n const pixelRatio = window.devicePixelRatio || 1;\n canvas.width = Math.round(viewport.width * pixelRatio);\n canvas.height = Math.round(viewport.height * pixelRatio);\n\n const pieces = createPieces(count, palette.length, viewport);\n const state = { frame: 0, last: performance.now() };\n\n const draw = (now: number): void => {\n const seconds = Math.min((now - state.last) / 1000, MAX_FRAME_SECONDS);\n state.last = now;\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.clearRect(0, 0, canvas.width, canvas.height);\n\n const live = pieces.filter((piece) => {\n stepPiece(piece, seconds);\n return !isFinished(piece, viewport);\n });\n for (const piece of live.filter(isLaunched)) {\n const turn = Math.cos(piece.tilt);\n const color = palette[piece.colorIndex];\n context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n context.translate(piece.x + wobbleOf(piece), piece.y);\n context.rotate(piece.rotation);\n context.scale(1, turn);\n context.globalAlpha = opacityOf(piece);\n context.fillStyle = turn >= 0 ? color.front : color.back;\n context.fillRect(-piece.width / 2, -piece.height / 2, piece.width, piece.height);\n }\n\n pieces.splice(0, pieces.length, ...live);\n if (pieces.length > 0) {\n state.frame = requestAnimationFrame(draw);\n }\n };\n state.frame = requestAnimationFrame(draw);\n\n return () => {\n cancelAnimationFrame(state.frame);\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.clearRect(0, 0, canvas.width, canvas.height);\n };\n }, [count, colorsKey]);\n\n return (\n <div\n ref={ref}\n aria-hidden\n className={`pointer-events-none fixed inset-0 overflow-hidden z-50 ${className}`}\n >\n <canvas ref={canvasRef} style={{ width: '100%', height: '100%', display: 'block' }} />\n <span ref={probeRef} style={{ display: 'none' }} />\n </div>\n );\n};\n\nexport default Confetti;\nexport { Confetti };\n"],"names":["DEFAULT_COLORS","COLORS_KEY_SEPARATOR","BACK_FACE_SHADE","MAX_FRAME_SECONDS","prefersReducedMotion","resolveColors","probe","palette","color","front","channels","back","channel","Confetti","count","colors","className","ref","useRef","canvasRef","probeRef","colorsKey","useEffect","container","canvas","context","bounds","viewport","pixelRatio","pieces","createPieces","state","draw","now","seconds","live","piece","stepPiece","isFinished","isLaunched","turn","wobbleOf","opacityOf","jsxs","jsx"],"mappings":";;;AAcA,MAAMA,IAAiB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GAGMC,IAAuB,MAGvBC,IAAkB,MAGlBC,IAAoB,IAAI,IAMxBC,IAAuB,MACrB,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe,aACvD,KAEJ,OAAO,WAAW,kCAAkC,EAAE,SAU3DC,IAAgB,CAACC,GAAoBC,MACvCA,EAAQ,IAAI,CAACC,MAAU;AACnB,EAAAF,EAAM,MAAM,QAAQE;AACpB,QAAMC,IAAQ,iBAAiBH,CAAK,EA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MAE9E,UAAA;AAAA,QAAA,gBAAA4B,EAAC,UAAA,EAAO,KAAKzB,GAAW,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,SAAS,QAAA,EAAQ,CAAG;AAAA,QACpF,gBAAAyB,EAAC,UAAK,KAAKxB,GAAU,OAAO,EAAE,SAAS,SAAO,CAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7D;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as f, useId as g } from "react";
|
|
3
|
+
import { WORDMARK_VIEW_BOX as u, MARK_TOP_PATH as _, MARK_BOTTOM_PATH as b, MARK_LEFT_PATH as R, MARK_RIGHT_PATH as T, WORDMARK_TEXT_PATH as y } from "./stackOneWordmarkPaths.js";
|
|
4
|
+
import { useAdoptedStyleSheet as C } from "./useAdoptedStyleSheet.js";
|
|
5
|
+
const l = 164, E = 21, v = 4, x = 28, r = "#00AF66", s = "#285C4D", d = "malachite-loading-screen-scan", o = "malachite-loading-screen-band", c = 40, K = `
|
|
6
|
+
@keyframes ${d} {
|
|
7
|
+
from { transform: translateX(-100%); }
|
|
8
|
+
to { transform: translateX(${100 / (c / 100)}%); }
|
|
9
|
+
}
|
|
10
|
+
.${o} {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
width: ${c}%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
border-radius: 999px;
|
|
17
|
+
background-color: var(--malachite-accent-background, rgb(0, 175, 102));
|
|
18
|
+
animation: ${d} 1.1s ease-in-out infinite alternate;
|
|
19
|
+
}
|
|
20
|
+
@media (prefers-reduced-motion: reduce) {
|
|
21
|
+
.${o} {
|
|
22
|
+
animation: none;
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
}`, m = "var(--malachite-card-sunken-background, rgb(250, 250, 250))", M = "var(--malachite-card-subtle-divider, rgb(241, 241, 241))", h = `color-mix(in srgb, var(--malachite-text-primary, rgb(10, 10, 10)) 12%, ${m})`, I = ({
|
|
26
|
+
"aria-label": p = "Loading",
|
|
27
|
+
"aria-labelledby": i,
|
|
28
|
+
className: A = ""
|
|
29
|
+
}) => {
|
|
30
|
+
const n = f(null);
|
|
31
|
+
C(n, K, "malachite-loading-screen-keyframes");
|
|
32
|
+
const t = `mal-loading-screen-${g().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
33
|
+
return /* @__PURE__ */ a(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
ref: n,
|
|
37
|
+
role: "progressbar",
|
|
38
|
+
"aria-busy": !0,
|
|
39
|
+
"aria-label": i === void 0 ? p : void 0,
|
|
40
|
+
"aria-labelledby": i,
|
|
41
|
+
className: A,
|
|
42
|
+
style: {
|
|
43
|
+
position: "fixed",
|
|
44
|
+
inset: 0,
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexDirection: "column",
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
gap: x,
|
|
50
|
+
backgroundColor: m
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ a(
|
|
54
|
+
"svg",
|
|
55
|
+
{
|
|
56
|
+
viewBox: u,
|
|
57
|
+
width: l,
|
|
58
|
+
height: E,
|
|
59
|
+
fill: "none",
|
|
60
|
+
"aria-hidden": !0,
|
|
61
|
+
style: { color: "var(--malachite-text-primary, rgb(10, 10, 10))" },
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ a("defs", { children: [
|
|
64
|
+
/* @__PURE__ */ a(
|
|
65
|
+
"linearGradient",
|
|
66
|
+
{
|
|
67
|
+
id: `${t}-top`,
|
|
68
|
+
x1: "133.334",
|
|
69
|
+
y1: "20.1114",
|
|
70
|
+
x2: "66.667",
|
|
71
|
+
y2: "20.1114",
|
|
72
|
+
gradientUnits: "userSpaceOnUse",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ e("stop", { stopColor: r }),
|
|
75
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: s })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ a(
|
|
80
|
+
"linearGradient",
|
|
81
|
+
{
|
|
82
|
+
id: `${t}-bottom`,
|
|
83
|
+
x1: "66.667",
|
|
84
|
+
y1: "97.8888",
|
|
85
|
+
x2: "133.334",
|
|
86
|
+
y2: "97.8888",
|
|
87
|
+
gradientUnits: "userSpaceOnUse",
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ e("stop", { stopColor: r }),
|
|
90
|
+
/* @__PURE__ */ e("stop", { offset: "1", stopColor: s })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ e("path", { "data-malachite-shape": "", d: _, fill: `url(#${t}-top)` }),
|
|
96
|
+
/* @__PURE__ */ e(
|
|
97
|
+
"path",
|
|
98
|
+
{
|
|
99
|
+
"data-malachite-shape": "",
|
|
100
|
+
d: b,
|
|
101
|
+
fill: `url(#${t}-bottom)`
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ e("path", { "data-malachite-shape": "", d: R, fill: r }),
|
|
105
|
+
/* @__PURE__ */ e("path", { "data-malachite-shape": "", d: T, fill: r }),
|
|
106
|
+
/* @__PURE__ */ e("path", { d: y, fill: "currentColor" })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ e(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
position: "relative",
|
|
115
|
+
overflow: "hidden",
|
|
116
|
+
width: l,
|
|
117
|
+
height: v,
|
|
118
|
+
borderRadius: 999,
|
|
119
|
+
backgroundColor: M,
|
|
120
|
+
backgroundImage: `linear-gradient(${h}, ${h})`
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */ e("div", { className: o })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
export {
|
|
130
|
+
I as LoadingScreen,
|
|
131
|
+
I as default
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=LoadingScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingScreen.js","sources":["../../src/components/LoadingScreen.tsx"],"sourcesContent":["import React, { useId, useRef } from 'react';\nimport {\n MARK_BOTTOM_PATH,\n MARK_LEFT_PATH,\n MARK_RIGHT_PATH,\n MARK_TOP_PATH,\n WORDMARK_TEXT_PATH,\n WORDMARK_VIEW_BOX,\n} from './stackOneWordmarkPaths';\nimport { useAdoptedStyleSheet } from './useAdoptedStyleSheet';\n\nexport interface LoadingScreenProps {\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n}\n\nconst WIDTH_PX = 164;\nconst WORDMARK_HEIGHT_PX = 21;\nconst BAR_HEIGHT_PX = 4;\nconst GAP_PX = 28;\n\n// The brand mark's own colours, fixed like Avatar's placeholder logo: StackOne's mark looks\n// the same in every theme. Only the lettering follows the theme.\nconst MARK_GREEN = '#00AF66';\nconst MARK_SHADE = '#285C4D';\n\nconst KEYFRAME_NAME = 'malachite-loading-screen-scan';\nconst BAND_CLASS = 'malachite-loading-screen-band';\nconst BAND_WIDTH_PERCENT = 40;\n// A media query cannot override an inline style, so the band is styled here. Reduced motion\n// stops the scan at full width: a band frozen part way would read as progress.\nconst KEYFRAMES_CSS = `\n@keyframes ${KEYFRAME_NAME} {\n from { transform: translateX(-100%); }\n to { transform: translateX(${100 / (BAND_WIDTH_PERCENT / 100)}%); }\n}\n.${BAND_CLASS} {\n position: absolute;\n top: 0;\n left: 0;\n width: ${BAND_WIDTH_PERCENT}%;\n height: 100%;\n border-radius: 999px;\n background-color: var(--malachite-accent-background, rgb(0, 175, 102));\n animation: ${KEYFRAME_NAME} 1.1s ease-in-out infinite alternate;\n}\n@media (prefers-reduced-motion: reduce) {\n .${BAND_CLASS} {\n animation: none;\n width: 100%;\n }\n}`;\n\nconst PAGE_BACKGROUND = 'var(--malachite-card-sunken-background, rgb(250, 250, 250))';\nconst TRACK_FALLBACK = 'var(--malachite-card-subtle-divider, rgb(241, 241, 241))';\nconst TRACK_MIX = `color-mix(in srgb, var(--malachite-text-primary, rgb(10, 10, 10)) 12%, ${PAGE_BACKGROUND})`;\n\n/**\n * The whole viewport while an app has nothing to show yet: the StackOne wordmark over a bar\n * scanning back and forth, on the page background. It is the screen unified-cloud paints before\n * its bundle loads, so a page that hands over to it, or from it, reads as one wait.\n */\nconst LoadingScreen: React.FC<LoadingScreenProps> = ({\n 'aria-label': ariaLabel = 'Loading',\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n}) => {\n const ref = useRef<HTMLDivElement>(null);\n useAdoptedStyleSheet(ref, KEYFRAMES_CSS, 'malachite-loading-screen-keyframes');\n const gradientId = `mal-loading-screen-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n\n return (\n <div\n ref={ref}\n role=\"progressbar\"\n aria-busy\n aria-label={ariaLabelledBy === undefined ? ariaLabel : undefined}\n aria-labelledby={ariaLabelledBy}\n className={className}\n style={{\n position: 'fixed',\n inset: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: GAP_PX,\n backgroundColor: PAGE_BACKGROUND,\n }}\n >\n <svg\n viewBox={WORDMARK_VIEW_BOX}\n width={WIDTH_PX}\n height={WORDMARK_HEIGHT_PX}\n fill=\"none\"\n aria-hidden\n // The lettering takes `currentColor` from malachite's icon rule; the mark opts out.\n style={{ color: 'var(--malachite-text-primary, rgb(10, 10, 10))' }}\n >\n <defs>\n <linearGradient\n id={`${gradientId}-top`}\n x1=\"133.334\"\n y1=\"20.1114\"\n x2=\"66.667\"\n y2=\"20.1114\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor={MARK_GREEN} />\n <stop offset=\"1\" stopColor={MARK_SHADE} />\n </linearGradient>\n <linearGradient\n id={`${gradientId}-bottom`}\n x1=\"66.667\"\n y1=\"97.8888\"\n x2=\"133.334\"\n y2=\"97.8888\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor={MARK_GREEN} />\n <stop offset=\"1\" stopColor={MARK_SHADE} />\n </linearGradient>\n </defs>\n <path data-malachite-shape=\"\" d={MARK_TOP_PATH} fill={`url(#${gradientId}-top)`} />\n <path\n data-malachite-shape=\"\"\n d={MARK_BOTTOM_PATH}\n fill={`url(#${gradientId}-bottom)`}\n />\n <path data-malachite-shape=\"\" d={MARK_LEFT_PATH} fill={MARK_GREEN} />\n <path data-malachite-shape=\"\" d={MARK_RIGHT_PATH} fill={MARK_GREEN} />\n <path d={WORDMARK_TEXT_PATH} fill=\"currentColor\" />\n </svg>\n <div\n style={{\n position: 'relative',\n overflow: 'hidden',\n width: WIDTH_PX,\n height: BAR_HEIGHT_PX,\n borderRadius: 999,\n backgroundColor: TRACK_FALLBACK,\n backgroundImage: `linear-gradient(${TRACK_MIX}, ${TRACK_MIX})`,\n }}\n >\n <div className={BAND_CLASS} />\n </div>\n </div>\n );\n};\n\nexport default LoadingScreen;\nexport { LoadingScreen };\n"],"names":["WIDTH_PX","WORDMARK_HEIGHT_PX","BAR_HEIGHT_PX","GAP_PX","MARK_GREEN","MARK_SHADE","KEYFRAME_NAME","BAND_CLASS","BAND_WIDTH_PERCENT","KEYFRAMES_CSS","PAGE_BACKGROUND","TRACK_FALLBACK","TRACK_MIX","LoadingScreen","ariaLabel","ariaLabelledBy","className","ref","useRef","useAdoptedStyleSheet","gradientId","useId","jsxs","WORDMARK_VIEW_BOX","jsx","MARK_TOP_PATH","MARK_BOTTOM_PATH","MARK_LEFT_PATH","MARK_RIGHT_PATH","WORDMARK_TEXT_PATH"],"mappings":";;;;AAiBA,MAAMA,IAAW,K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A;AAAA,UAAA;AAAA,QAAA;AAAA,QAErD,gBAAAL;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,OAAO;AAAA,cACH,UAAU;AAAA,cACV,UAAU;AAAA,cACV,OAAOxB;AAAA,cACP,QAAQE;AAAA,cACR,cAAc;AAAA,cACd,iBAAiBS;AAAA,cACjB,iBAAiB,mBAAmBC,CAAS,KAAKA,CAAS;AAAA,YAAA;AAAA,YAG/D,UAAA,gBAAAY,EAAC,OAAA,EAAI,WAAWjB,EAAA,CAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MAChC;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const a = (t, s, n) => s + t() * (n - s), P = (t) => {
|
|
2
|
+
const s = t();
|
|
3
|
+
if (s < 0.6) {
|
|
4
|
+
const n = a(t, 10, 14);
|
|
5
|
+
return { width: n, height: n * 0.5 };
|
|
6
|
+
}
|
|
7
|
+
if (s < 0.85) {
|
|
8
|
+
const n = a(t, 7, 10);
|
|
9
|
+
return { width: n, height: n };
|
|
10
|
+
}
|
|
11
|
+
return { width: 4, height: a(t, 14, 18) };
|
|
12
|
+
}, i = (t, s, n, h = Math.random) => {
|
|
13
|
+
const o = Math.min(
|
|
14
|
+
Math.max(n.height, 420),
|
|
15
|
+
1100
|
|
16
|
+
);
|
|
17
|
+
return Array.from({ length: t }, (f, _) => {
|
|
18
|
+
const l = _ % 2 === 0, e = a(h, 52, 80) * Math.PI / 180, M = o * a(h, 2.1, 2.7), g = l ? 1 : -1;
|
|
19
|
+
return {
|
|
20
|
+
x: l ? 0 : n.width,
|
|
21
|
+
y: n.height + 20,
|
|
22
|
+
vx: Math.cos(e) * M * g,
|
|
23
|
+
vy: -Math.sin(e) * M,
|
|
24
|
+
...P(h),
|
|
25
|
+
colorIndex: Math.floor(h() * s),
|
|
26
|
+
rotation: h() * Math.PI * 2,
|
|
27
|
+
rotationSpeed: a(h, -3, 3),
|
|
28
|
+
tilt: h() * Math.PI * 2,
|
|
29
|
+
tiltSpeed: a(h, 4, 10),
|
|
30
|
+
wobblePhase: h() * Math.PI * 2,
|
|
31
|
+
wobbleSpeed: a(h, 3, 6),
|
|
32
|
+
fallSpeed: a(h, 190, 300),
|
|
33
|
+
delay: a(h, 0, 0.18),
|
|
34
|
+
age: 0,
|
|
35
|
+
life: a(h, 3, 4)
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}, y = (t, s) => {
|
|
39
|
+
t.age += s;
|
|
40
|
+
const n = t.age - t.delay;
|
|
41
|
+
if (n <= 0)
|
|
42
|
+
return;
|
|
43
|
+
const h = Math.min(s, n), o = Math.exp(-1.6 * h);
|
|
44
|
+
t.vx *= o, t.vy < 0 ? t.vy = (t.vy + 1100 * h) * o : t.vy += (t.fallSpeed - t.vy) * (1 - Math.exp(-4 * h)), t.x += t.vx * h, t.y += t.vy * h, t.rotation += t.rotationSpeed * h, t.tilt += t.tiltSpeed * h, t.wobblePhase += t.wobbleSpeed * h;
|
|
45
|
+
}, A = (t) => {
|
|
46
|
+
const s = Math.max(0, Math.min(t.vy / t.fallSpeed, 1));
|
|
47
|
+
return Math.sin(t.wobblePhase) * 10 * s;
|
|
48
|
+
}, E = (t) => Math.max(0, Math.min((t.life - t.age) / 0.7, 1)), I = (t) => t.age > t.delay, S = (t, s) => t.age >= t.life || t.vy > 0 && t.y > s.height + 40;
|
|
49
|
+
export {
|
|
50
|
+
i as createPieces,
|
|
51
|
+
S as isFinished,
|
|
52
|
+
I as isLaunched,
|
|
53
|
+
E as opacityOf,
|
|
54
|
+
y as stepPiece,
|
|
55
|
+
A as wobbleOf
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=confettiPhysics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confettiPhysics.js","sources":["../../src/components/confettiPhysics.ts"],"sourcesContent":["export interface ConfettiViewport {\n width: number;\n height: number;\n}\n\nexport interface ConfettiPiece {\n x: number;\n y: number;\n vx: number;\n vy: number;\n width: number;\n height: number;\n colorIndex: number;\n rotation: number;\n rotationSpeed: number;\n tilt: number;\n tiltSpeed: number;\n wobblePhase: number;\n wobbleSpeed: number;\n fallSpeed: number;\n delay: number;\n age: number;\n life: number;\n}\n\n// Pixels and seconds. Rising, a piece is thrown against gravity and air drag; falling, paper\n// does not keep accelerating, so it settles to its own slow fall speed and flutters.\nconst GRAVITY = 1100;\nconst DRAG = 1.6;\nconst FALL_SETTLE_RATE = 4;\nconst FADE_SECONDS = 0.7;\nconst MAX_WOBBLE_PX = 10;\nconst OFFSCREEN_MARGIN_PX = 40;\n// Launch speed scales with the viewport's height so the burst peaks a third to a fifth of the\n// way down, but within these bounds so a very short or tall viewport still reads as a burst.\nconst MIN_LAUNCH_HEIGHT_PX = 420;\nconst MAX_LAUNCH_HEIGHT_PX = 1100;\n\nconst between = (random: () => number, low: number, high: number): number =>\n low + random() * (high - low);\n\nconst sizeFor = (random: () => number): Pick<ConfettiPiece, 'width' | 'height'> => {\n const shape = random();\n if (shape < 0.6) {\n const width = between(random, 10, 14);\n return { width, height: width * 0.5 };\n }\n if (shape < 0.85) {\n const side = between(random, 7, 10);\n return { width: side, height: side };\n }\n return { width: 4, height: between(random, 14, 18) };\n};\n\n/**\n * Two cannons at the bottom corners, each firing half the pieces up and inward. `random` is\n * injectable so a spec can pin the burst.\n */\nexport const createPieces = (\n count: number,\n paletteSize: number,\n viewport: ConfettiViewport,\n random: () => number = Math.random,\n): ConfettiPiece[] => {\n const launchHeight = Math.min(\n Math.max(viewport.height, MIN_LAUNCH_HEIGHT_PX),\n MAX_LAUNCH_HEIGHT_PX,\n );\n\n return Array.from({ length: count }, (_, index) => {\n const fromLeft = index % 2 === 0;\n const angle = (between(random, 52, 80) * Math.PI) / 180;\n const speed = launchHeight * between(random, 2.1, 2.7);\n const direction = fromLeft ? 1 : -1;\n\n return {\n x: fromLeft ? 0 : viewport.width,\n y: viewport.height + OFFSCREEN_MARGIN_PX / 2,\n vx: Math.cos(angle) * speed * direction,\n vy: -Math.sin(angle) * speed,\n ...sizeFor(random),\n colorIndex: Math.floor(random() * paletteSize),\n rotation: random() * Math.PI * 2,\n rotationSpeed: between(random, -3, 3),\n tilt: random() * Math.PI * 2,\n tiltSpeed: between(random, 4, 10),\n wobblePhase: random() * Math.PI * 2,\n wobbleSpeed: between(random, 3, 6),\n fallSpeed: between(random, 190, 300),\n delay: between(random, 0, 0.18),\n age: 0,\n life: between(random, 3, 4),\n };\n });\n};\n\nexport const stepPiece = (piece: ConfettiPiece, seconds: number): void => {\n piece.age += seconds;\n const moving = piece.age - piece.delay;\n if (moving <= 0) {\n return;\n }\n const elapsed = Math.min(seconds, moving);\n const drag = Math.exp(-DRAG * elapsed);\n\n piece.vx *= drag;\n if (piece.vy < 0) {\n piece.vy = (piece.vy + GRAVITY * elapsed) * drag;\n } else {\n piece.vy += (piece.fallSpeed - piece.vy) * (1 - Math.exp(-FALL_SETTLE_RATE * elapsed));\n }\n piece.x += piece.vx * elapsed;\n piece.y += piece.vy * elapsed;\n piece.rotation += piece.rotationSpeed * elapsed;\n piece.tilt += piece.tiltSpeed * elapsed;\n piece.wobblePhase += piece.wobbleSpeed * elapsed;\n};\n\n/** Sideways sway, growing as the piece slows into its fall. */\nexport const wobbleOf = (piece: ConfettiPiece): number => {\n const falling = Math.max(0, Math.min(piece.vy / piece.fallSpeed, 1));\n return Math.sin(piece.wobblePhase) * MAX_WOBBLE_PX * falling;\n};\n\nexport const opacityOf = (piece: ConfettiPiece): number =>\n Math.max(0, Math.min((piece.life - piece.age) / FADE_SECONDS, 1));\n\nexport const isLaunched = (piece: ConfettiPiece): boolean => piece.age > piece.delay;\n\nexport const isFinished = (piece: ConfettiPiece, viewport: ConfettiViewport): boolean =>\n piece.age >= piece.life || (piece.vy > 0 && piece.y > viewport.height + OFFSCREEN_MARGIN_PX);\n"],"names":["between","random","low","high","sizeFor","shape","width","side","createPieces","count","paletteSize","viewport","launchHeight","_","index","fromLeft","angle","spe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AAM,OAAO,KAAc,CAAC,CAAC,GAEvDQ,IAAa,CAACR,MAAkCA,EAAM,MAAMA,EAAM,OAElES,IAAa,CAACT,GAAsBT,MAC7CS,EAAM,OAAOA,EAAM,QAASA,EAAM,KAAK,KAAKA,EAAM,IAAIT,EAAS,SAAS;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const C = "0 0 935 119", H = "M66.667 39.5559H133.334V0.666992H101.489C82.2572 0.666992 66.667 0.666992 66.667 21.0594V39.5559Z", V = "M133.334 78.4443H66.667V117.333H98.5114C117.743 117.333 133.334 117.333 133.334 96.9408V78.4443Z", M = "M133.333 0.666992H66.8889H0L3.26502e-06 78.4448H66.8889V39.5629L66.8796 37.9157C66.7622 17.3783 83.3783 0.666992 103.916 0.666992H133.333Z", Z = "M66.667 117.333H133.111H200V39.5557H133.111V78.4375L133.121 80.0847C133.238 100.622 116.622 117.333 96.0844 117.333H66.667Z", L = "M315.323 34.6385C314.874 30.1125 312.948 26.5964 309.544 24.0902C306.14 21.584 301.521 20.331 295.685 20.331C291.72 20.331 288.373 20.892 285.642 22.0142C282.911 23.099 280.817 24.6139 279.358 26.5589C277.937 28.504 277.226 30.7109 277.226 33.1797C277.151 35.237 277.581 37.0324 278.516 38.5661C279.489 40.0997 280.817 41.4276 282.5 42.5497C284.183 43.6345 286.128 44.5883 288.335 45.4112C290.542 46.1967 292.899 46.87 295.405 47.4311L305.729 49.8999C310.741 51.022 315.342 52.5182 319.531 54.3885C323.721 56.2588 327.349 58.5592 330.416 61.2898C333.483 64.0204 335.859 67.2372 337.542 70.9403C339.263 74.6435 340.142 78.889 340.179 83.6768C340.142 90.709 338.346 96.8061 334.793 101.968C331.277 107.093 326.189 111.076 319.531 113.919C312.911 116.724 304.924 118.127 295.573 118.127C286.297 118.127 278.217 116.706 271.335 113.863C264.489 111.02 259.14 106.812 255.288 101.239C251.472 95.6278 249.471 88.6892 249.284 80.4226H272.793C273.055 84.2753 274.159 87.4922 276.104 90.0732C278.086 92.6167 280.723 94.5431 284.015 95.8523C287.344 97.1241 291.103 97.7599 295.293 97.7599C299.407 97.7599 302.979 97.1615 306.009 95.9645C309.076 94.7675 311.452 93.103 313.135 90.9709C314.818 88.8388 315.66 86.3887 315.66 83.6207C315.66 81.0398 314.893 78.8703 313.359 77.1122C311.863 75.3542 309.656 73.858 306.739 72.6236C303.858 71.3892 300.324 70.267 296.134 69.2571L283.622 66.1151C273.934 63.7585 266.285 60.0741 260.674 55.0618C255.063 50.0495 252.277 43.2978 252.314 34.8068C252.277 27.8494 254.128 21.7711 257.869 16.5717C261.647 11.3724 266.827 7.31392 273.411 4.3963C279.994 1.47869 287.475 0.0198821 295.854 0.0198821C304.382 0.0198821 311.826 1.47869 318.185 4.3963C324.581 7.31392 329.556 11.3724 333.109 16.5717C336.663 21.7711 338.496 27.7933 338.608 34.6385H315.323ZM392.432 30.3182V48.2727H340.532V30.3182H392.432ZM352.315 9.67045H376.217V90.017C376.217 92.224 376.553 93.9446 377.227 95.179C377.9 96.3759 378.835 97.2176 380.032 97.7038C381.266 98.1901 382.688 98.4332 384.296 98.4332C385.418 98.4332 386.54 98.3397 387.663 98.1527C388.785 97.9283 389.645 97.7599 390.244 97.6477L394.003 115.434C392.806 115.808 391.123 116.238 388.953 116.724C386.784 117.248 384.146 117.566 381.042 117.678C375.281 117.903 370.232 117.136 365.893 115.378C361.591 113.62 358.243 110.889 355.849 107.186C353.455 103.483 352.277 98.8073 352.315 93.1591V9.67045ZM423.097 118.127C417.598 118.127 412.698 117.173 408.397 115.266C404.095 113.321 400.691 110.459 398.185 106.681C395.716 102.866 394.482 98.1153 394.482 92.4297C394.482 87.6418 395.361 83.6207 397.119 80.3665C398.877 77.1122 401.271 74.4938 404.301 72.5114C407.331 70.5289 410.772 69.0327 414.625 68.0227C418.515 67.0128 422.592 66.3021 426.856 65.8906C431.869 65.367 435.908 64.8807 438.976 64.4318C442.043 63.9455 444.268 63.2348 445.652 62.2997C447.036 61.3646 447.728 59.9806 447.728 58.1477V57.8111C447.728 54.2576 446.606 51.5083 444.362 49.5632C442.155 47.6181 439.013 46.6456 434.936 46.6456C430.634 46.6456 427.212 47.5994 424.668 49.5071C422.124 51.3774 420.441 53.7339 419.618 56.5767L397.512 54.7812C398.634 49.5445 400.841 45.0185 404.133 41.2031C407.424 37.3504 411.67 34.3954 416.869 32.3381C422.106 30.2434 428.165 29.196 435.048 29.196C439.836 29.196 444.418 29.7571 448.794 30.8793C453.208 32.0014 457.117 33.7408 460.521 36.0973C463.962 38.4538 466.674 41.4837 468.657 45.1868C470.639 48.8525 471.63 53.2476 471.63 58.3722V116.5H448.963V104.549H448.289C446.905 107.242 445.054 109.617 442.735 111.675C440.416 113.695 437.629 115.284 434.375 116.444C431.12 117.566 427.361 118.127 423.097 118.127ZM429.942 101.631C433.458 101.631 436.563 100.939 439.256 99.5554C441.949 98.134 444.063 96.2263 445.596 93.8324C447.13 91.4384 447.897 88.7266 447.897 85.6967V76.5511C447.149 77.0374 446.12 77.4863 444.811 77.8977C443.539 78.2718 442.099 78.6271 440.49 78.9638C438.882 79.263 437.274 79.5436 435.665 79.8054C434.057 80.0298 432.598 80.2356 431.289 80.4226C428.483 80.834 426.033 81.4886 423.939 82.3864C421.844 83.2841 420.217 84.4998 419.057 86.0334C417.898 87.5296 417.318 89.3999 417.318 91.6442C417.318 94.8984 418.496 97.3859 420.853 99.1065C423.247 100.79 426.276 101.631 429.942 101.631ZM519.633 118.183C510.805 118.183 503.212 116.313 496.853 112.572C490.532 108.795 485.669 103.558 482.265 96.8622C478.899 90.1667 477.215 82.4612 477.215 73.7457C477.215 64.9181 478.917 57.1752 482.321 50.517C485.762 43.8215 490.644 38.6035 496.965 34.8629C503.287 31.085 510.805 29.196 519.521 29.196C527.039 29.196 533.623 30.5613 539.271 33.2919C544.919 36.0225 549.389 39.8565 552.681 44.794C555.972 49.7315 557.786 55.5294 558.123 62.1875H535.568C534.932 57.8859 533.249 54.4259 530.518 51.8075C527.825 49.1518 524.29 47.8239 519.914 47.8239C516.21 47.8239 512.975 48.8338 510.207 50.8537C507.476 52.8362 505.344 55.7351 503.811 59.5504C502.277 63.3658 501.51 67.9853 501.51 73.4091C501.51 78.9077 502.258 83.5833 503.754 87.4361C505.288 91.2888 507.439 94.2251 510.207 96.245C512.975 98.2649 516.21 99.2749 519.914 99.2749C522.644 99.2749 525.094 98.7138 527.264 97.5916C529.471 96.4695 531.285 94.8423 532.706 92.7102C534.165 90.5407 535.119 87.941 535.568 84.9112H558.123C557.749 91.4946 555.954 97.2924 552.737 102.305C549.557 107.28 545.162 111.17 539.551 113.975C533.941 116.781 527.301 118.183 519.633 118.183ZM585.604 91.7003L585.66 63.0291H589.139L616.744 30.3182H644.181L607.094 73.6335H601.427L585.604 91.7003ZM563.946 116.5V1.59091H587.848V116.5H563.946ZM617.81 116.5L592.449 78.9638L608.384 62.0753L645.808 116.5H617.81ZM752.471 59.0455C752.471 71.5762 750.096 82.2367 745.346 91.027C740.633 99.8172 734.199 106.531 726.045 111.17C717.928 115.771 708.801 118.071 698.664 118.071C688.452 118.071 679.288 115.752 671.171 111.114C663.054 106.475 656.639 99.7611 651.926 90.9709C647.213 82.1806 644.856 71.5388 644.856 59.0455C644.856 46.5147 647.213 35.8542 651.926 27.0639C656.639 18.2737 663.054 11.5781 671.171 6.97727C679.288 2.33901 688.452 0.0198821 698.664 0.0198821C708.801 0.0198821 717.928 2.33901 726.045 6.97727C734.199 11.5781 740.633 18.2737 745.346 27.0639C750.096 35.8542 752.471 46.5147 752.471 59.0455ZM727.84 59.0455C727.84 50.9285 726.624 44.0833 724.193 38.5099C721.799 32.9366 718.414 28.7098 714.038 25.8295C709.661 22.9493 704.537 21.5092 698.664 21.5092C692.791 21.5092 687.667 22.9493 683.29 25.8295C678.914 28.7098 675.51 32.9366 673.079 38.5099C670.685 44.0833 669.488 50.9285 669.488 59.0455C669.488 67.1624 670.685 74.0076 673.079 79.581C675.51 85.1544 678.914 89.3812 683.29 92.2614C687.667 95.1416 692.791 96.5817 698.664 96.5817C704.537 96.5817 709.661 95.1416 714.038 92.2614C718.414 89.3812 721.799 85.1544 724.193 79.581C726.624 74.0076 727.84 67.1624 727.84 59.0455ZM784.441 66.6761V116.5H760.539V30.3182H783.319V45.5234H784.329C786.237 40.5111 789.435 36.5462 793.923 33.6285C798.412 30.6735 803.855 29.196 810.251 29.196C816.236 29.196 821.454 30.5052 825.905 33.1236C830.356 35.7419 833.816 39.4825 836.285 44.3452C838.754 49.1705 839.988 54.9309 839.988 61.6264V116.5H816.086V65.8906C816.123 60.6165 814.777 56.5019 812.046 53.5469C809.316 50.5545 805.556 49.0582 800.769 49.0582C797.552 49.0582 794.709 49.7502 792.24 51.1342C789.809 52.5182 787.901 54.5381 786.517 57.1939C785.171 59.8123 784.479 62.973 784.441 66.6761ZM888.622 118.183C879.757 118.183 872.126 116.388 865.73 112.797C859.371 109.169 854.471 104.044 851.03 97.4233C847.588 90.7652 845.868 82.8913 845.868 73.8018C845.868 64.9368 847.588 57.1565 851.03 50.4609C854.471 43.7654 859.315 38.5473 865.562 34.8068C871.846 31.0663 879.214 29.196 887.668 29.196C893.354 29.196 898.647 30.1125 903.547 31.9453C908.484 33.7408 912.786 36.4526 916.451 40.081C920.155 43.7093 923.035 48.2727 925.092 53.7713C927.149 59.2325 928.178 65.6288 928.178 72.9602V79.5249H855.406V64.7124H905.679C905.679 61.2711 904.931 58.2225 903.434 55.5668C901.938 52.911 899.862 50.835 897.206 49.3388C894.588 47.8052 891.54 47.0384 888.061 47.0384C884.433 47.0384 881.216 47.88 878.41 49.5632C875.642 51.209 873.473 53.4347 871.902 56.2401C870.331 59.008 869.526 62.094 869.489 65.4979V79.581C869.489 83.8452 870.275 87.5296 871.846 90.6342C873.454 93.7389 875.717 96.1328 878.635 97.8161C881.552 99.4993 885.012 100.341 889.015 100.341C891.67 100.341 894.102 99.9669 896.309 99.2188C898.516 98.4706 900.405 97.3485 901.976 95.8523C903.547 94.3561 904.744 92.5232 905.567 90.3537L927.673 91.8125C926.551 97.1241 924.25 101.762 920.772 105.727C917.33 109.655 912.879 112.722 907.418 114.929C901.994 117.098 895.729 118.183 888.622 118.183Z";
|
|
2
|
+
export {
|
|
3
|
+
V as MARK_BOTTOM_PATH,
|
|
4
|
+
M as MARK_LEFT_PATH,
|
|
5
|
+
Z as MARK_RIGHT_PATH,
|
|
6
|
+
H as MARK_TOP_PATH,
|
|
7
|
+
L as WORDMARK_TEXT_PATH,
|
|
8
|
+
C as WORDMARK_VIEW_BOX
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=stackOneWordmarkPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stackOneWordmarkPaths.js","sources":["../../src/components/stackOneWordmarkPaths.ts"],"sourcesContent":["// The StackOne wordmark, as unified-cloud draws it before its bundle loads (`index.html`).\nexport const WORDMARK_VIEW_BOX = '0 0 935 119';\n\nexport const MARK_TOP_PATH =\n 'M66.667 39.5559H133.334V0.666992H101.489C82.2572 0.666992 66.667 0.666992 66.667 21.0594V39.5559Z';\nexport const MARK_BOTTOM_PATH =\n 'M133.334 78.4443H66.667V117.333H98.5114C117.743 117.333 133.334 117.333 133.334 96.9408V78.4443Z';\nexport const MARK_LEFT_PATH =\n 'M133.333 0.666992H66.8889H0L3.26502e-06 78.4448H66.8889V39.5629L66.8796 37.9157C66.7622 17.3783 83.3783 0.666992 103.916 0.666992H133.333Z';\nexport const MARK_RIGHT_PATH =\n 'M66.667 117.333H133.111H200V39.5557H133.111V78.4375L133.121 80.0847C133.238 100.622 116.622 117.333 96.0844 117.333H66.667Z';\nexport const WORDMARK_TEXT_PATH =\n 'M315.323 34.6385C314.874 30.1125 312.948 26.5964 309.544 24.0902C306.14 21.584 301.521 20.331 295.685 20.331C291.72 20.331 288.373 20.892 285.642 22.0142C282.911 23.099 280.817 24.6139 279.358 26.5589C277.937 28.504 277.226 30.7109 277.226 33.1797C277.151 35.237 277.581 37.0324 278.516 38.5661C279.489 40.0997 280.817 41.4276 282.5 42.5497C284.183 43.6345 286.128 44.5883 288.335 45.4112C290.542 46.1967 292.899 46.87 295.405 47.4311L305.729 49.8999C310.741 51.022 315.342 52.5182 319.531 54.3885C323.721 56.2588 327.349 58.5592 330.416 61.2898C333.483 64.0204 335.859 67.2372 337.542 70.9403C339.263 74.6435 340.142 78.889 340.179 83.6768C340.142 90.709 338.346 96.8061 334.793 101.968C331.277 107.093 326.189 111.076 319.531 113.919C312.911 116.724 304.924 118.127 295.573 118.127C286.297 118.127 278.217 116.706 271.335 113.863C264.489 111.02 259.14 106.812 255.288 101.239C251.472 95.6278 249.471 88.6892 249.284 80.4226H272.793C273.055 84.2753 274.159 87.4922 276.104 90.0732C278.086 92.6167 280.723 94.5431 284.015 95.8523C287.344 97.1241 291.103 97.7599 295.293 97.7599C299.407 97.7599 302.979 97.1615 306.009 95.9645C309.076 94.7675 311.452 93.103 313.135 90.9709C314.818 88.8388 315.66 86.3887 315.66 83.6207C315.66 81.0398 314.893 78.8703 313.359 77.1122C311.863 75.3542 309.656 73.858 306.739 72.6236C303.858 71.3892 300.324 70.267 296.134 69.2571L283.622 66.1151C273.934 63.7585 266.285 60.0741 260.674 55.0618C255.063 50.0495 252.277 43.2978 252.314 34.8068C252.277 27.8494 254.128 21.7711 257.869 16.5717C261.647 11.3724 266.827 7.31392 273.411 4.3963C279.994 1.47869 287.475 0.0198821 295.854 0.0198821C304.382 0.0198821 311.826 1.47869 318.185 4.3963C324.581 7.31392 329.556 11.3724 333.109 16.5717C336.663 21.7711 338.496 27.7933 338.608 34.6385H315.323ZM392.432 30.3182V48.2727H340.532V30.3182H392.432ZM352.315 9.67045H376.217V90.017C376.217 92.224 376.553 93.9446 377.227 95.179C377.9 96.3759 378.835 97.2176 380.032 97.7038C381.266 98.1901 382.688 98.4332 384.296 98.4332C385.418 98.4332 386.54 98.3397 387.663 98.1527C388.785 97.9283 389.645 97.7599 390.244 97.6477L394.003 115.434C392.806 115.808 391.123 116.238 388.953 116.724C386.784 117.248 384.146 117.566 381.042 117.678C375.281 117.903 370.232 117.136 365.893 115.378C361.591 113.62 358.243 110.889 355.849 107.186C353.455 103.483 352.277 98.8073 352.315 93.1591V9.67045ZM423.097 118.127C417.598 118.127 412.698 117.173 408.397 115.266C404.095 113.321 400.691 110.459 398.185 106.681C395.716 102.866 394.482 98.1153 394.482 92.4297C394.482 87.6418 395.361 83.6207 397.119 80.3665C398.877 77.1122 401.271 74.4938 404.301 72.5114C407.331 70.5289 410.772 69.0327 414.625 68.0227C418.515 67.0128 422.592 66.3021 426.856 65.8906C431.869 65.367 435.908 64.8807 438.976 64.4318C442.043 63.9455 444.268 63.2348 445.652 62.2997C447.036 61.3646 447.728 59.9806 447.728 58.1477V57.8111C447.728 54.2576 446.606 51.5083 444.362 49.5632C442.155 47.6181 439.013 46.6456 434.936 46.6456C430.634 46.6456 427.212 47.5994 424.668 49.5071C422.124 51.3774 420.441 53.7339 419.618 56.5767L397.512 54.7812C398.634 49.5445 400.841 45.0185 404.133 41.2031C407.424 37.3504 411.67 34.3954 416.869 32.3381C422.106 30.2434 428.165 29.196 435.048 29.196C439.836 29.196 444.418 29.7571 448.794 30.8793C453.208 32.0014 457.117 33.7408 460.521 36.0973C463.962 38.4538 466.674 41.4837 468.657 45.1868C470.639 48.8525 471.63 53.2476 471.63 58.3722V116.5H448.963V104.549H448.289C446.905 107.242 445.054 109.617 442.735 111.675C440.416 113.695 437.629 115.284 434.375 116.444C431.12 117.566 427.361 118.127 423.097 118.127ZM429.942 101.631C433.458 101.631 436.563 100.939 439.256 99.5554C441.949 98.134 444.063 96.2263 445.596 93.8324C447.13 91.4384 447.897 88.7266 447.897 85.6967V76.5511C447.149 77.0374 446.12 77.4863 444.811 77.8977C443.539 78.2718 442.099 78.6271 440.49 78.9638C438.882 79.263 437.274 79.5436 435.665 79.8054C434.057 80.0298 432.598 80.2356 431.289 80.4226C428.483 80.834 426.033 81.4886 423.939 82.3864C421.844 83.2841 420.217 84.4998 419.057 86.0334C417.898 87.5296 417.318 89.3999 417.318 91.6442C417.318 94.8984 418.496 97.3859 420.853 99.1065C423.247 100.79 426.276 101.631 429.942 101.631ZM519.633 118.183C510.805 118.183 503.212 116.313 496.853 112.572C490.532 108.795 485.669 103.558 482.265 96.8622C478.899 90.1667 477.215 82.4612 477.215 73.7457C477.215 64.9181 478.917 57.1752 482.321 50.517C485.762 43.8215 490.644 38.6035 496.965 34.8629C503.287 31.085 510.805 29.196 519.521 29.196C527.039 29.196 533.623 30.5613 539.271 33.2919C544.919 36.0225 549.389 39.8565 552.681 44.794C555.972 49.7315 557.786 55.5294 558.123 62.1875H535.568C534.932 57.8859 533.249 54.4259 530.518 51.8075C527.825 49.1518 524.29 47.8239 519.914 47.8239C516.21 47.8239 512.975 48.8338 510.207 50.8537C507.476 52.8362 505.344 55.7351 503.811 59.5504C502.277 63.3658 501.51 67.9853 501.51 73.4091C501.51 78.9077 502.258 83.5833 503.754 87.4361C505.288 91.2888 507.439 94.2251 510.207 96.245C512.975 98.2649 516.21 99.2749 519.914 99.2749C522.644 99.2749 525.094 98.7138 527.264 97.5916C529.471 96.4695 531.285 94.8423 532.706 92.7102C534.165 90.5407 535.119 87.941 535.568 84.9112H558.123C557.749 91.4946 555.954 97.2924 552.737 102.305C549.557 107.28 545.162 111.17 539.551 113.975C533.941 116.781 527.301 118.183 519.633 118.183ZM585.604 91.7003L585.66 63.0291H589.139L616.744 30.3182H644.181L607.094 73.6335H601.427L585.604 91.7003ZM563.946 116.5V1.59091H587.848V116.5H563.946ZM617.81 116.5L592.449 78.9638L608.384 62.0753L645.808 116.5H617.81ZM752.471 59.0455C752.471 71.5762 750.096 82.2367 745.346 91.027C740.633 99.8172 734.199 106.531 726.045 111.17C717.928 115.771 708.801 118.071 698.664 118.071C688.452 118.071 679.288 115.752 671.171 111.114C663.054 106.475 656.639 99.7611 651.926 90.9709C647.213 82.1806 644.856 71.5388 644.856 59.0455C644.856 46.5147 647.213 35.8542 651.926 27.0639C656.639 18.2737 663.054 11.5781 671.171 6.97727C679.288 2.33901 688.452 0.0198821 698.664 0.0198821C708.801 0.0198821 717.928 2.33901 726.045 6.97727C734.199 11.5781 740.633 18.2737 745.346 27.0639C750.096 35.8542 752.471 46.5147 752.471 59.0455ZM727.84 59.0455C727.84 50.9285 726.624 44.0833 724.193 38.5099C721.799 32.9366 718.414 28.7098 714.038 25.8295C709.661 22.9493 704.537 21.5092 698.664 21.5092C692.791 21.5092 687.667 22.9493 683.29 25.8295C678.914 28.7098 675.51 32.9366 673.079 38.5099C670.685 44.0833 669.488 50.9285 669.488 59.0455C669.488 67.1624 670.685 74.0076 673.079 79.581C675.51 85.1544 678.914 89.3812 683.29 92.2614C687.667 95.1416 692.791 96.5817 698.664 96.5817C704.537 96.5817 709.661 95.1416 714.038 92.2614C718.414 89.3812 721.799 85.1544 724.193 79.581C726.624 74.0076 727.84 67.1624 727.84 59.0455ZM784.441 66.6761V116.5H760.539V30.3182H783.319V45.5234H784.329C786.237 40.5111 789.435 36.5462 793.923 33.6285C798.412 30.6735 803.855 29.196 810.251 29.196C816.236 29.196 821.454 30.5052 825.905 33.1236C830.356 35.7419 833.816 39.4825 836.285 44.3452C838.754 49.1705 839.988 54.9309 839.988 61.6264V116.5H816.086V65.8906C816.123 60.6165 814.777 56.5019 812.046 53.5469C809.316 50.5545 805.556 49.0582 800.769 49.0582C797.552 49.0582 794.709 49.7502 792.24 51.1342C789.809 52.5182 787.901 54.5381 786.517 57.1939C785.171 59.8123 784.479 62.973 784.441 66.6761ZM888.622 118.183C879.757 118.183 872.126 116.388 865.73 112.797C859.371 109.169 854.471 104.044 851.03 97.4233C847.588 90.7652 845.868 82.8913 845.868 73.8018C845.868 64.9368 847.588 57.1565 851.03 50.4609C854.471 43.7654 859.315 38.5473 865.562 34.8068C871.846 31.0663 879.214 29.196 887.668 29.196C893.354 29.196 898.647 30.1125 903.547 31.9453C908.484 33.7408 912.786 36.4526 916.451 40.081C920.155 43.7093 923.035 48.2727 925.092 53.7713C927.149 59.2325 928.178 65.6288 928.178 72.9602V79.5249H855.406V64.7124H905.679C905.679 61.2711 904.931 58.2225 903.434 55.5668C901.938 52.911 899.862 50.835 897.206 49.3388C894.588 47.8052 891.54 47.0384 888.061 47.0384C884.433 47.0384 881.216 47.88 878.41 49.5632C875.642 51.209 873.473 53.4347 871.902 56.2401C870.331 59.008 869.526 62.094 869.489 65.4979V79.581C869.489 83.8452 870.275 87.5296 871.846 90.6342C873.454 93.7389 875.717 96.1328 878.635 97.8161C881.552 99.4993 885.012 100.341 889.015 100.341C891.67 100.341 894.102 99.9669 896.309 99.2188C898.516 98.4706 900.405 97.3485 901.976 95.8523C903.547 94.3561 904.744 92.5232 905.567 90.3537L927.673 91.8125C926.551 97.1241 924.25 101.762 920.772 105.727C917.33 109.655 912.879 112.722 907.418 114.929C901.994 117.098 895.729 118.183 888.622 118.183Z';\n"],"names":["WORDMARK_VIEW_BOX","MARK_TOP_PATH","MARK_BOTTOM_PATH","MARK_LEFT_PATH","MARK_RIGHT_PATH","WORDMARK_TEXT_PATH"],"mappings":"AACO,MAAMA,IAAoB,eAEpBC,IACT,qGACSC,IACT,oGACSC,IACT,8IACSC,IACT,+HACSC,IACT;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1422,9 +1422,9 @@ export declare interface CommandPaletteRowProps {
|
|
|
1422
1422
|
export declare const Confetti: default_2.FC<ConfettiProps>;
|
|
1423
1423
|
|
|
1424
1424
|
export declare interface ConfettiProps {
|
|
1425
|
-
/** Number of confetti pieces. */
|
|
1425
|
+
/** Number of confetti pieces, split between the two cannons. */
|
|
1426
1426
|
count?: number;
|
|
1427
|
-
/** Colors
|
|
1427
|
+
/** Colors picked at random across the pieces; list one twice to weight it. */
|
|
1428
1428
|
colors?: string[];
|
|
1429
1429
|
className?: string;
|
|
1430
1430
|
}
|
|
@@ -3643,6 +3643,19 @@ export declare type LoadingBarSize = 'small' | 'medium' | 'large';
|
|
|
3643
3643
|
|
|
3644
3644
|
export declare type LoadingBarVariant = 'default' | 'warning' | 'error';
|
|
3645
3645
|
|
|
3646
|
+
/**
|
|
3647
|
+
* The whole viewport while an app has nothing to show yet: the StackOne wordmark over a bar
|
|
3648
|
+
* scanning back and forth, on the page background. It is the screen unified-cloud paints before
|
|
3649
|
+
* its bundle loads, so a page that hands over to it, or from it, reads as one wait.
|
|
3650
|
+
*/
|
|
3651
|
+
export declare const LoadingScreen: default_2.FC<LoadingScreenProps>;
|
|
3652
|
+
|
|
3653
|
+
export declare interface LoadingScreenProps {
|
|
3654
|
+
'aria-label'?: string;
|
|
3655
|
+
'aria-labelledby'?: string;
|
|
3656
|
+
className?: string;
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3646
3659
|
export declare const LogsIcon: React.FC<IconProps_75>;
|
|
3647
3660
|
|
|
3648
3661
|
export declare const MagicWandIcon: React.FC<IconProps_76>;
|