@anvpx/motion-scenes 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/catalog.d.ts +17 -0
- package/dist/catalog.js +51 -0
- package/dist/custom.d.ts +86 -0
- package/dist/custom.js +170 -0
- package/dist/define-scene.d.ts +31 -0
- package/dist/define-scene.js +128 -0
- package/dist/html.d.ts +5 -0
- package/dist/html.js +14 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/position.d.ts +21 -0
- package/dist/position.js +16 -0
- package/dist/registry.d.ts +4 -0
- package/dist/registry.js +68 -0
- package/dist/runtime/easing.d.ts +14 -0
- package/dist/runtime/easing.js +45 -0
- package/dist/runtime/mount.d.ts +50 -0
- package/dist/runtime/mount.js +153 -0
- package/dist/runtime/timeline.d.ts +147 -0
- package/dist/runtime/timeline.js +199 -0
- package/dist/runtime-files.d.ts +2 -0
- package/dist/runtime-files.js +15 -0
- package/dist/scene-contract.d.ts +7 -0
- package/dist/scene-contract.js +104 -0
- package/dist/scene3d/post.d.ts +12 -0
- package/dist/scene3d/post.js +16 -0
- package/dist/scene3d/reflector.d.ts +9 -0
- package/dist/scene3d/reflector.js +17 -0
- package/dist/scene3d/textures.d.ts +9 -0
- package/dist/scene3d/textures.js +11 -0
- package/dist/scene3d/volumetric.d.ts +9 -0
- package/dist/scene3d/volumetric.js +16 -0
- package/dist/scenes/bug/index.d.ts +1 -0
- package/dist/scenes/bug/index.js +45 -0
- package/dist/scenes/bug/scene.d.ts +2 -0
- package/dist/scenes/bug/scene.js +6 -0
- package/dist/scenes/bug/style.css +30 -0
- package/dist/scenes/bullets/index.d.ts +1 -0
- package/dist/scenes/bullets/index.js +128 -0
- package/dist/scenes/bullets/scene.d.ts +2 -0
- package/dist/scenes/bullets/scene.js +6 -0
- package/dist/scenes/bullets/style.css +91 -0
- package/dist/scenes/callout/index.d.ts +9 -0
- package/dist/scenes/callout/index.js +95 -0
- package/dist/scenes/callout/scene.d.ts +2 -0
- package/dist/scenes/callout/scene.js +43 -0
- package/dist/scenes/callout/style.css +97 -0
- package/dist/scenes/caption/index.d.ts +1 -0
- package/dist/scenes/caption/index.js +72 -0
- package/dist/scenes/caption/scene.d.ts +11 -0
- package/dist/scenes/caption/scene.js +33 -0
- package/dist/scenes/caption/style.css +33 -0
- package/dist/scenes/chapter/index.d.ts +1 -0
- package/dist/scenes/chapter/index.js +29 -0
- package/dist/scenes/chapter/scene.d.ts +2 -0
- package/dist/scenes/chapter/scene.js +6 -0
- package/dist/scenes/chapter/style.css +25 -0
- package/dist/scenes/chart/index.d.ts +1 -0
- package/dist/scenes/chart/index.js +24 -0
- package/dist/scenes/chart/render.d.ts +4 -0
- package/dist/scenes/chart/render.js +257 -0
- package/dist/scenes/chart/scale.d.ts +11 -0
- package/dist/scenes/chart/scale.js +53 -0
- package/dist/scenes/chart/scene.d.ts +2 -0
- package/dist/scenes/chart/scene.js +73 -0
- package/dist/scenes/chart/schema.d.ts +36 -0
- package/dist/scenes/chart/schema.js +109 -0
- package/dist/scenes/chart/style.css +425 -0
- package/dist/scenes/code/index.d.ts +1 -0
- package/dist/scenes/code/index.js +109 -0
- package/dist/scenes/code/scene.d.ts +2 -0
- package/dist/scenes/code/scene.js +108 -0
- package/dist/scenes/code/style.css +155 -0
- package/dist/scenes/code/tokenize.d.ts +8 -0
- package/dist/scenes/code/tokenize.js +145 -0
- package/dist/scenes/compare/index.d.ts +1 -0
- package/dist/scenes/compare/index.js +128 -0
- package/dist/scenes/compare/scene.d.ts +2 -0
- package/dist/scenes/compare/scene.js +58 -0
- package/dist/scenes/compare/style.css +187 -0
- package/dist/scenes/countdown/index.d.ts +1 -0
- package/dist/scenes/countdown/index.js +46 -0
- package/dist/scenes/countdown/scene.d.ts +2 -0
- package/dist/scenes/countdown/scene.js +21 -0
- package/dist/scenes/countdown/style.css +32 -0
- package/dist/scenes/flow/index.d.ts +1 -0
- package/dist/scenes/flow/index.js +66 -0
- package/dist/scenes/flow/inspect.d.ts +26 -0
- package/dist/scenes/flow/inspect.js +25 -0
- package/dist/scenes/flow/layout.d.ts +83 -0
- package/dist/scenes/flow/layout.js +222 -0
- package/dist/scenes/flow/measure.d.ts +15 -0
- package/dist/scenes/flow/measure.js +33 -0
- package/dist/scenes/flow/plan.d.ts +42 -0
- package/dist/scenes/flow/plan.js +117 -0
- package/dist/scenes/flow/scene.d.ts +2 -0
- package/dist/scenes/flow/scene.js +6 -0
- package/dist/scenes/flow/schema.d.ts +49 -0
- package/dist/scenes/flow/schema.js +60 -0
- package/dist/scenes/flow/style.css +54 -0
- package/dist/scenes/hero/index.d.ts +3 -0
- package/dist/scenes/hero/index.js +77 -0
- package/dist/scenes/hero/scene.d.ts +2 -0
- package/dist/scenes/hero/scene.js +6 -0
- package/dist/scenes/hero/style.css +143 -0
- package/dist/scenes/icon-grid/index.d.ts +1 -0
- package/dist/scenes/icon-grid/index.js +69 -0
- package/dist/scenes/icon-grid/scene.d.ts +2 -0
- package/dist/scenes/icon-grid/scene.js +6 -0
- package/dist/scenes/icon-grid/style.css +74 -0
- package/dist/scenes/kinetic/index.d.ts +1 -0
- package/dist/scenes/kinetic/index.js +62 -0
- package/dist/scenes/kinetic/scene.d.ts +2 -0
- package/dist/scenes/kinetic/scene.js +98 -0
- package/dist/scenes/kinetic/style.css +94 -0
- package/dist/scenes/kpi-grid/index.d.ts +1 -0
- package/dist/scenes/kpi-grid/index.js +161 -0
- package/dist/scenes/kpi-grid/scene.d.ts +2 -0
- package/dist/scenes/kpi-grid/scene.js +6 -0
- package/dist/scenes/kpi-grid/style.css +141 -0
- package/dist/scenes/lower-third/index.d.ts +1 -0
- package/dist/scenes/lower-third/index.js +33 -0
- package/dist/scenes/lower-third/scene.d.ts +2 -0
- package/dist/scenes/lower-third/scene.js +6 -0
- package/dist/scenes/lower-third/style.css +45 -0
- package/dist/scenes/media-frame/index.d.ts +1 -0
- package/dist/scenes/media-frame/index.js +99 -0
- package/dist/scenes/media-frame/scene.d.ts +2 -0
- package/dist/scenes/media-frame/scene.js +85 -0
- package/dist/scenes/media-frame/style.css +275 -0
- package/dist/scenes/outro/index.d.ts +1 -0
- package/dist/scenes/outro/index.js +54 -0
- package/dist/scenes/outro/scene.d.ts +2 -0
- package/dist/scenes/outro/scene.js +6 -0
- package/dist/scenes/outro/style.css +92 -0
- package/dist/scenes/poster/index.d.ts +3 -0
- package/dist/scenes/poster/index.js +62 -0
- package/dist/scenes/poster/scene.d.ts +2 -0
- package/dist/scenes/poster/scene.js +6 -0
- package/dist/scenes/poster/style.css +102 -0
- package/dist/scenes/progress/index.d.ts +1 -0
- package/dist/scenes/progress/index.js +40 -0
- package/dist/scenes/progress/scene.d.ts +2 -0
- package/dist/scenes/progress/scene.js +17 -0
- package/dist/scenes/progress/style.css +31 -0
- package/dist/scenes/quote/index.d.ts +3 -0
- package/dist/scenes/quote/index.js +69 -0
- package/dist/scenes/quote/scene.d.ts +2 -0
- package/dist/scenes/quote/scene.js +6 -0
- package/dist/scenes/quote/style.css +86 -0
- package/dist/scenes/scene3d/index.d.ts +1 -0
- package/dist/scenes/scene3d/index.js +58 -0
- package/dist/scenes/scene3d/scene.d.ts +2 -0
- package/dist/scenes/scene3d/scene.js +413 -0
- package/dist/scenes/scene3d/style.css +43 -0
- package/dist/scenes/stat/index.d.ts +4 -0
- package/dist/scenes/stat/index.js +72 -0
- package/dist/scenes/stat/scene.d.ts +2 -0
- package/dist/scenes/stat/scene.js +6 -0
- package/dist/scenes/stat/style.css +95 -0
- package/dist/scenes/steps/index.d.ts +1 -0
- package/dist/scenes/steps/index.js +147 -0
- package/dist/scenes/steps/scene.d.ts +2 -0
- package/dist/scenes/steps/scene.js +6 -0
- package/dist/scenes/steps/style.css +190 -0
- package/dist/scenes/sticker/index.d.ts +1 -0
- package/dist/scenes/sticker/index.js +48 -0
- package/dist/scenes/sticker/scene.d.ts +2 -0
- package/dist/scenes/sticker/scene.js +57 -0
- package/dist/scenes/sticker/style.css +88 -0
- package/dist/scenes/table/index.d.ts +1 -0
- package/dist/scenes/table/index.js +131 -0
- package/dist/scenes/table/scene.d.ts +2 -0
- package/dist/scenes/table/scene.js +6 -0
- package/dist/scenes/table/style.css +102 -0
- package/dist/scenes/timeline/index.d.ts +1 -0
- package/dist/scenes/timeline/index.js +68 -0
- package/dist/scenes/timeline/scene.d.ts +2 -0
- package/dist/scenes/timeline/scene.js +6 -0
- package/dist/scenes/timeline/style.css +161 -0
- package/dist/scenes/title/index.d.ts +1 -0
- package/dist/scenes/title/index.js +52 -0
- package/dist/scenes/title/scene.d.ts +2 -0
- package/dist/scenes/title/scene.js +6 -0
- package/dist/scenes/title/style.css +80 -0
- package/dist/scenes/waveform/index.d.ts +1 -0
- package/dist/scenes/waveform/index.js +39 -0
- package/dist/scenes/waveform/scene.d.ts +2 -0
- package/dist/scenes/waveform/scene.js +35 -0
- package/dist/scenes/waveform/style.css +44 -0
- package/dist/shared/fit-text.d.ts +24 -0
- package/dist/shared/fit-text.js +82 -0
- package/dist/shared/format.d.ts +24 -0
- package/dist/shared/format.js +59 -0
- package/dist/shared/frame.d.ts +14 -0
- package/dist/shared/frame.js +21 -0
- package/dist/shared/icon-search.d.ts +9 -0
- package/dist/shared/icon-search.js +26 -0
- package/dist/shared/icon.d.ts +15 -0
- package/dist/shared/icon.js +28 -0
- package/dist/shared/index.d.ts +11 -0
- package/dist/shared/index.js +7 -0
- package/dist/shared/markup.d.ts +12 -0
- package/dist/shared/markup.js +43 -0
- package/dist/shared/measure.d.ts +7 -0
- package/dist/shared/measure.js +34 -0
- package/dist/shared/motion.d.ts +94 -0
- package/dist/shared/motion.js +117 -0
- package/dist/source-hash.d.ts +4 -0
- package/dist/source-hash.js +26 -0
- package/dist/test-fixtures.d.ts +9 -0
- package/dist/test-fixtures.js +22 -0
- package/dist/text-file.d.ts +1 -0
- package/dist/text-file.js +3 -0
- package/dist/words.d.ts +11 -0
- package/dist/words.js +93 -0
- package/package.json +36 -3
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#scene-root {
|
|
2
|
+
gap: var(--mk-space-xl);
|
|
3
|
+
}
|
|
4
|
+
#scene-root .mk-head {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: flex-start;
|
|
8
|
+
gap: var(--mk-space-md);
|
|
9
|
+
}
|
|
10
|
+
#scene-root .mk-heading {
|
|
11
|
+
font-family: var(--mk-font-display, var(--mk-font-sans));
|
|
12
|
+
font-size: var(--mk-font-size-title);
|
|
13
|
+
font-weight: 800;
|
|
14
|
+
line-height: 1.04;
|
|
15
|
+
letter-spacing: -0.03em;
|
|
16
|
+
text-wrap: balance;
|
|
17
|
+
}
|
|
18
|
+
#scene-root .mk-grid {
|
|
19
|
+
list-style: none;
|
|
20
|
+
padding: 0;
|
|
21
|
+
display: grid;
|
|
22
|
+
gap: var(--mk-space-xl);
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
}
|
|
25
|
+
#scene-root .mk-cols-2 {
|
|
26
|
+
grid-template-columns: repeat(2, 1fr);
|
|
27
|
+
}
|
|
28
|
+
#scene-root .mk-cols-3 {
|
|
29
|
+
grid-template-columns: repeat(3, 1fr);
|
|
30
|
+
}
|
|
31
|
+
#scene-root .mk-cols-4 {
|
|
32
|
+
grid-template-columns: repeat(4, 1fr);
|
|
33
|
+
}
|
|
34
|
+
#scene-root .mk-card {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
gap: var(--mk-space-md);
|
|
39
|
+
padding: var(--mk-space-xl);
|
|
40
|
+
background: var(--mk-color-card);
|
|
41
|
+
border: var(--mk-stroke-card, 2px) solid var(--mk-color-divider);
|
|
42
|
+
border-radius: var(--mk-radius-xl);
|
|
43
|
+
box-shadow: var(
|
|
44
|
+
--mk-shadow-card,
|
|
45
|
+
0 24px 56px -28px color-mix(in srgb, var(--mk-color-fg) 40%, transparent)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
#scene-root .mk-chip {
|
|
49
|
+
display: grid;
|
|
50
|
+
place-items: center;
|
|
51
|
+
width: 112px;
|
|
52
|
+
height: 112px;
|
|
53
|
+
margin-bottom: var(--mk-space-sm);
|
|
54
|
+
border-radius: var(--mk-radius-lg);
|
|
55
|
+
background: var(--mk-color-accentSoft);
|
|
56
|
+
color: var(--mk-color-accent);
|
|
57
|
+
}
|
|
58
|
+
#scene-root .mk-label {
|
|
59
|
+
font-size: var(--mk-font-size-lg);
|
|
60
|
+
font-weight: 700;
|
|
61
|
+
line-height: 1.12;
|
|
62
|
+
letter-spacing: -0.01em;
|
|
63
|
+
text-wrap: balance;
|
|
64
|
+
overflow-wrap: break-word;
|
|
65
|
+
}
|
|
66
|
+
#scene-root .mk-dense .mk-label {
|
|
67
|
+
font-size: var(--mk-font-size-md);
|
|
68
|
+
}
|
|
69
|
+
#scene-root .mk-detail {
|
|
70
|
+
font-size: var(--mk-font-size-sm);
|
|
71
|
+
line-height: 1.3;
|
|
72
|
+
color: var(--mk-color-muted);
|
|
73
|
+
text-wrap: pretty;
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const kineticScene: import("@anvpx/motion-schema").ScenePlugin;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineScene } from "../../define-scene.js";
|
|
3
|
+
import { animAttrs, esc } from "../../html.js";
|
|
4
|
+
import { textWidth } from "../../shared/measure.js";
|
|
5
|
+
import { readText } from "../../text-file.js";
|
|
6
|
+
import { limitWords, text } from "../../words.js";
|
|
7
|
+
const MAX_WORDS = 8;
|
|
8
|
+
const MAX_CHARS = 18;
|
|
9
|
+
/** Share of the frame a word may fill. */
|
|
10
|
+
const FILL_WIDTH = 0.8;
|
|
11
|
+
const FILL_HEIGHT = 0.74;
|
|
12
|
+
const STACK_LINE = 1.08;
|
|
13
|
+
/** Theme font steps, largest first; every one is >= 28 px. */
|
|
14
|
+
const STEPS = ["hero", "heroMd", "heroSm", "display", "title", "xl", "lg"];
|
|
15
|
+
const configSchema = limitWords(z
|
|
16
|
+
.strictObject({
|
|
17
|
+
words: z
|
|
18
|
+
.array(text.max(MAX_CHARS))
|
|
19
|
+
.min(1, `need 1-${MAX_WORDS} words`)
|
|
20
|
+
.max(MAX_WORDS, `need 1-${MAX_WORDS} words`),
|
|
21
|
+
mode: z.enum(["slam", "stack", "swap"]).default("slam"),
|
|
22
|
+
emphasis: z.int().min(1).max(MAX_WORDS).optional(),
|
|
23
|
+
})
|
|
24
|
+
.superRefine((props, ctx) => {
|
|
25
|
+
if (props.emphasis !== undefined && props.emphasis > props.words.length) {
|
|
26
|
+
ctx.addIssue({
|
|
27
|
+
code: "custom",
|
|
28
|
+
path: ["emphasis"],
|
|
29
|
+
message: `emphasis ${props.emphasis} does not exist; words are numbered 1-${props.words.length}`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}), (props) => props.words);
|
|
33
|
+
const px = (ctx, step) => ctx.theme.fontSizes[step] ?? 0;
|
|
34
|
+
/** Largest step at which `fits(px)` holds; falls back to the smallest. */
|
|
35
|
+
const largest = (ctx, fits) => STEPS.find((step) => px(ctx, step) > 0 && fits(px(ctx, step))) ?? "lg";
|
|
36
|
+
const render = (props, ctx) => {
|
|
37
|
+
const maxWidth = ctx.width * FILL_WIDTH;
|
|
38
|
+
const stacked = props.mode === "stack";
|
|
39
|
+
const shared = largest(ctx, (size) => props.words.length * size * STACK_LINE <= ctx.height * FILL_HEIGHT &&
|
|
40
|
+
props.words.every((word) => textWidth(word, size) <= maxWidth));
|
|
41
|
+
const words = props.words.map((word, index) => {
|
|
42
|
+
const step = stacked ? shared : largest(ctx, (size) => textWidth(word, size) <= maxWidth);
|
|
43
|
+
const em = props.emphasis === index + 1 ? " mk-em" : "";
|
|
44
|
+
return `<p class="mk-word mk-sz-${step}${em}" data-i="${index}">${esc(word)}</p>`;
|
|
45
|
+
});
|
|
46
|
+
const beats = props.words.map(() => '<i class="mk-beat"><b></b></i>').join("");
|
|
47
|
+
return `<div class="mk-stage mk-mode-${props.mode}" data-mode="${props.mode}">
|
|
48
|
+
${words.join("\n")}
|
|
49
|
+
</div>
|
|
50
|
+
<div class="mk-beats" aria-hidden="true" ${animAttrs("fade", 0)}>${beats}</div>`;
|
|
51
|
+
};
|
|
52
|
+
export const kineticScene = defineScene({
|
|
53
|
+
type: "kinetic",
|
|
54
|
+
configSchema,
|
|
55
|
+
meta: {
|
|
56
|
+
purpose: "One word or short phrase per beat at full screen (slam, stack or swap); for hooks, rules of three and key messages.",
|
|
57
|
+
example: { words: ["Plan", "Build", "Ship"], mode: "slam", emphasis: 3 },
|
|
58
|
+
},
|
|
59
|
+
style: readText("./style.css", import.meta.url),
|
|
60
|
+
script: readText("./scene.js", import.meta.url),
|
|
61
|
+
render: (props, ctx) => ({ body: render(props, ctx) }),
|
|
62
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { clamp01, ease } from "../../runtime/easing.js";
|
|
3
|
+
import { mountTimeline } from "../../runtime/mount.js";
|
|
4
|
+
const IN_SECONDS = 0.28;
|
|
5
|
+
const IN_SHARE = 0.4;
|
|
6
|
+
const OUT_SECONDS = 0.22;
|
|
7
|
+
const OUT_SHARE = 0.3;
|
|
8
|
+
const SLAM_FROM = 1.7;
|
|
9
|
+
const SWAP_RISE_EM = 0.55;
|
|
10
|
+
const STACK_RISE_EM = 0.3;
|
|
11
|
+
const STACK_DIM = 0.55;
|
|
12
|
+
/**
|
|
13
|
+
* @param {number} t
|
|
14
|
+
* @param {number} from
|
|
15
|
+
* @param {number} span
|
|
16
|
+
*/
|
|
17
|
+
const within = (t, from, span) => clamp01(span > 0 ? (t - from) / span : t >= from ? 1 : 0);
|
|
18
|
+
/** @type {import("../../runtime/mount.js").CreateScene} */
|
|
19
|
+
export function createScene(root, config, ctx) {
|
|
20
|
+
const inner = mountTimeline(root, config, ctx, { baseDelay: 0.1, staggerFrames: 4, rise: 0 });
|
|
21
|
+
const mode = /** @type {HTMLElement} */ (root.querySelector(".mk-stage")).dataset.mode;
|
|
22
|
+
const words = /** @type {HTMLElement[]} */ (Array.from(root.querySelectorAll(".mk-word")));
|
|
23
|
+
const fills = /** @type {HTMLElement[]} */ (Array.from(root.querySelectorAll(".mk-beat b")));
|
|
24
|
+
const count = words.length;
|
|
25
|
+
const duration = ctx.duration ?? (Number(root.dataset.duration) || 6);
|
|
26
|
+
const beat = duration / count;
|
|
27
|
+
const inSpan = Math.min(IN_SECONDS, beat * IN_SHARE);
|
|
28
|
+
const outSpan = Math.min(OUT_SECONDS, beat * OUT_SHARE);
|
|
29
|
+
/**
|
|
30
|
+
* @param {HTMLElement} el
|
|
31
|
+
* @param {number} opacity
|
|
32
|
+
* @param {string} transform
|
|
33
|
+
*/
|
|
34
|
+
const paint = (el, opacity, transform) => {
|
|
35
|
+
el.style.opacity = String(opacity);
|
|
36
|
+
el.style.transform = transform;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @param {HTMLElement} el
|
|
40
|
+
* @param {number} i
|
|
41
|
+
* @param {number} t
|
|
42
|
+
*/
|
|
43
|
+
const slam = (el, i, t) => {
|
|
44
|
+
// A slam is a hard cut: opaque from the first frame, so no blank frame between words.
|
|
45
|
+
const live = t >= i * beat && (i === count - 1 || t < (i + 1) * beat);
|
|
46
|
+
if (!live)
|
|
47
|
+
return paint(el, 0, "");
|
|
48
|
+
const local = within(t, i * beat, inSpan);
|
|
49
|
+
const scale = 1 + (SLAM_FROM - 1) * (1 - ease("spring-snappy", local));
|
|
50
|
+
paint(el, 1, `scale(${scale})`);
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* @param {HTMLElement} el
|
|
54
|
+
* @param {number} i
|
|
55
|
+
* @param {number} t
|
|
56
|
+
*/
|
|
57
|
+
const swap = (el, i, t) => {
|
|
58
|
+
const enter = within(t, i * beat, inSpan);
|
|
59
|
+
const leave = i === count - 1 ? 0 : within(t, (i + 1) * beat, outSpan);
|
|
60
|
+
if (t < i * beat || leave >= 1)
|
|
61
|
+
return paint(el, 0, "");
|
|
62
|
+
const rise = (1 - ease("out", enter)) * SWAP_RISE_EM - ease("in", leave) * SWAP_RISE_EM;
|
|
63
|
+
paint(el, enter * (1 - leave), `translateY(${rise}em)`);
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* @param {HTMLElement} el
|
|
67
|
+
* @param {number} i
|
|
68
|
+
* @param {number} t
|
|
69
|
+
*/
|
|
70
|
+
const stack = (el, i, t) => {
|
|
71
|
+
const enter = within(t, i * beat, inSpan);
|
|
72
|
+
const older = i === count - 1 ? 0 : within(t, (i + 1) * beat, inSpan);
|
|
73
|
+
const keep = el.classList.contains("mk-em") ? 1 : 1 - (1 - STACK_DIM) * ease("out", older);
|
|
74
|
+
paint(el, enter * keep, `translateY(${(1 - ease("out", enter)) * STACK_RISE_EM}em)`);
|
|
75
|
+
};
|
|
76
|
+
const draw = mode === "stack" ? stack : mode === "swap" ? swap : slam;
|
|
77
|
+
/** @param {number} t */
|
|
78
|
+
const seek = (t) => {
|
|
79
|
+
inner.seek(t);
|
|
80
|
+
words.forEach((el, i) => {
|
|
81
|
+
draw(el, i, t);
|
|
82
|
+
});
|
|
83
|
+
fills.forEach((fill, i) => {
|
|
84
|
+
fill.style.transform = `scaleX(${within(t, i * beat, beat)})`;
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const dispose = () => {
|
|
88
|
+
inner.dispose();
|
|
89
|
+
for (const el of words) {
|
|
90
|
+
el.style.removeProperty("opacity");
|
|
91
|
+
el.style.removeProperty("transform");
|
|
92
|
+
}
|
|
93
|
+
for (const fill of fills)
|
|
94
|
+
fill.style.removeProperty("transform");
|
|
95
|
+
};
|
|
96
|
+
seek(0);
|
|
97
|
+
return { seek, dispose, ready: inner.ready };
|
|
98
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#scene-root {
|
|
2
|
+
align-items: center;
|
|
3
|
+
text-align: center;
|
|
4
|
+
}
|
|
5
|
+
#scene-root .mk-stage {
|
|
6
|
+
flex: 1;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 0;
|
|
9
|
+
display: grid;
|
|
10
|
+
place-items: center;
|
|
11
|
+
}
|
|
12
|
+
#scene-root .mk-mode-stack {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
#scene-root .mk-word {
|
|
19
|
+
font-family: var(--mk-font-display, var(--mk-font-sans));
|
|
20
|
+
grid-area: 1 / 1;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
font-weight: 800;
|
|
23
|
+
line-height: 1.08;
|
|
24
|
+
letter-spacing: -0.04em;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
color: var(--mk-color-fg);
|
|
27
|
+
opacity: 0;
|
|
28
|
+
will-change: transform, opacity;
|
|
29
|
+
}
|
|
30
|
+
#scene-root .mk-mode-stack .mk-word {
|
|
31
|
+
grid-area: auto;
|
|
32
|
+
}
|
|
33
|
+
#scene-root .mk-em {
|
|
34
|
+
color: var(--mk-color-accent);
|
|
35
|
+
}
|
|
36
|
+
#scene-root .mk-mode-slam .mk-em,
|
|
37
|
+
#scene-root .mk-mode-swap .mk-em {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
#scene-root .mk-mode-slam .mk-em::after,
|
|
41
|
+
#scene-root .mk-mode-swap .mk-em::after {
|
|
42
|
+
content: "";
|
|
43
|
+
position: absolute;
|
|
44
|
+
left: 16%;
|
|
45
|
+
right: 16%;
|
|
46
|
+
bottom: -0.06em;
|
|
47
|
+
height: 0.07em;
|
|
48
|
+
border-radius: var(--mk-radius-full);
|
|
49
|
+
background: linear-gradient(90deg, var(--mk-color-accent), var(--mk-color-accent2));
|
|
50
|
+
}
|
|
51
|
+
#scene-root .mk-sz-hero {
|
|
52
|
+
font-size: var(--mk-font-size-hero);
|
|
53
|
+
}
|
|
54
|
+
#scene-root .mk-sz-heroMd {
|
|
55
|
+
font-size: var(--mk-font-size-heroMd);
|
|
56
|
+
}
|
|
57
|
+
#scene-root .mk-sz-heroSm {
|
|
58
|
+
font-size: var(--mk-font-size-heroSm);
|
|
59
|
+
}
|
|
60
|
+
#scene-root .mk-sz-display {
|
|
61
|
+
font-size: var(--mk-font-size-display);
|
|
62
|
+
}
|
|
63
|
+
#scene-root .mk-sz-title {
|
|
64
|
+
font-size: var(--mk-font-size-title);
|
|
65
|
+
}
|
|
66
|
+
#scene-root .mk-sz-xl {
|
|
67
|
+
font-size: var(--mk-font-size-xl);
|
|
68
|
+
}
|
|
69
|
+
#scene-root .mk-sz-lg {
|
|
70
|
+
font-size: var(--mk-font-size-lg);
|
|
71
|
+
}
|
|
72
|
+
#scene-root .mk-beats {
|
|
73
|
+
flex: none;
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: var(--mk-space-md);
|
|
76
|
+
justify-content: center;
|
|
77
|
+
padding-top: var(--mk-space-md);
|
|
78
|
+
}
|
|
79
|
+
#scene-root .mk-beat {
|
|
80
|
+
display: block;
|
|
81
|
+
width: 72px;
|
|
82
|
+
height: 10px;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
border-radius: var(--mk-radius-full);
|
|
85
|
+
background: var(--mk-color-divider);
|
|
86
|
+
}
|
|
87
|
+
#scene-root .mk-beat b {
|
|
88
|
+
display: block;
|
|
89
|
+
width: 100%;
|
|
90
|
+
height: 100%;
|
|
91
|
+
background: var(--mk-color-accent);
|
|
92
|
+
transform-origin: left center;
|
|
93
|
+
transform: scaleX(0);
|
|
94
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const kpiGridScene: import("@anvpx/motion-schema").ScenePlugin;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineScene } from "../../define-scene.js";
|
|
3
|
+
import { animAttrs, esc } from "../../html.js";
|
|
4
|
+
import { fmt } from "../../shared/format.js";
|
|
5
|
+
import { frameCss, frameOf } from "../../shared/frame.js";
|
|
6
|
+
import { sceneIcon } from "../../shared/icon.js";
|
|
7
|
+
import { textWidth } from "../../shared/measure.js";
|
|
8
|
+
import { readText } from "../../text-file.js";
|
|
9
|
+
import { limitWords, present, text } from "../../words.js";
|
|
10
|
+
import { countsExactly, MAX_COUNT_DIGITS } from "../stat/index.js";
|
|
11
|
+
const COUNT_MESSAGE = "need 2-6 items";
|
|
12
|
+
const TRENDS = ["up", "down", "flat"];
|
|
13
|
+
const TREND_ICON = {
|
|
14
|
+
up: "trending-up",
|
|
15
|
+
down: "trending-down",
|
|
16
|
+
flat: "minus",
|
|
17
|
+
};
|
|
18
|
+
const itemSchema = z.strictObject({
|
|
19
|
+
value: z.union([text, z.number()]),
|
|
20
|
+
label: text,
|
|
21
|
+
unit: text.optional(),
|
|
22
|
+
delta: text.optional(),
|
|
23
|
+
trend: z.enum(TRENDS).optional(),
|
|
24
|
+
/** Which direction is good news; default up. A fall in churn is good. */
|
|
25
|
+
good: z.enum(["up", "down"]).optional(),
|
|
26
|
+
});
|
|
27
|
+
const configSchema = limitWords(z
|
|
28
|
+
.strictObject({
|
|
29
|
+
title: text.optional(),
|
|
30
|
+
items: z.array(itemSchema).min(2, COUNT_MESSAGE).max(6, COUNT_MESSAGE),
|
|
31
|
+
cols: z.number().int().min(2).max(3).optional(),
|
|
32
|
+
})
|
|
33
|
+
.superRefine((props, ctx) => {
|
|
34
|
+
props.items.forEach((item, index) => {
|
|
35
|
+
if (!countsExactly(item.value)) {
|
|
36
|
+
ctx.addIssue({
|
|
37
|
+
code: "custom",
|
|
38
|
+
path: ["items", index, "value"],
|
|
39
|
+
message: `too large to count up exactly (max ${MAX_COUNT_DIGITS} digits)`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (item.trend !== undefined && item.delta === undefined) {
|
|
43
|
+
ctx.addIssue({
|
|
44
|
+
code: "custom",
|
|
45
|
+
path: ["items", index, "trend"],
|
|
46
|
+
message: "trend needs a delta to show",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (item.good !== undefined && item.trend === undefined) {
|
|
50
|
+
ctx.addIssue({
|
|
51
|
+
code: "custom",
|
|
52
|
+
path: ["items", index, "good"],
|
|
53
|
+
message: "good needs a trend to colour",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}), (props) => [
|
|
58
|
+
...present(props.title),
|
|
59
|
+
...props.items.flatMap((item) => present(item.value, item.unit, item.label, item.delta)),
|
|
60
|
+
]);
|
|
61
|
+
/** Value sizes, largest first; a single row of cards may use the display size. */
|
|
62
|
+
const VALUE_STEPS = ["display", "title", "xl", "lg"];
|
|
63
|
+
const UNIT_STEP = "lg";
|
|
64
|
+
const FALLBACK_PX = { display: 128, title: 96, xl: 72, lg: 48 };
|
|
65
|
+
const GAP_PX = 32;
|
|
66
|
+
/** Card padding (2 x space.xl) plus border. */
|
|
67
|
+
const CARD_PAD_PX = 2 * 64 + 4;
|
|
68
|
+
const WIDTH_MARGIN = 0.92;
|
|
69
|
+
const SAFE_SIDES = 0.1;
|
|
70
|
+
/** Portrait reads best as one column of wide cards; a square frame keeps pairs. */
|
|
71
|
+
const colsOf = (props, ctx) => {
|
|
72
|
+
if (props.cols !== undefined)
|
|
73
|
+
return props.cols;
|
|
74
|
+
const n = props.items.length;
|
|
75
|
+
const frame = frameOf(ctx);
|
|
76
|
+
if (frame === "portrait")
|
|
77
|
+
return n <= 4 ? 1 : 2;
|
|
78
|
+
return n <= 3 ? n : n === 4 ? 2 : 3;
|
|
79
|
+
};
|
|
80
|
+
/** Tall frames have narrow cards: the change pill never wraps. */
|
|
81
|
+
const TALL_CSS = `#scene-root .mk-delta { white-space: nowrap; padding: var(--mk-space-xs) var(--mk-space-md); }
|
|
82
|
+
#scene-root .mk-delta svg { width: 24px; height: 24px; }`;
|
|
83
|
+
/** Square frames keep the landscape grid but with shorter cards so two rows fit. */
|
|
84
|
+
const SQUARE_CSS = `#scene-root .mk-card { padding: var(--mk-space-lg); }
|
|
85
|
+
#scene-root .mk-rows-1 .mk-card { min-height: 300px; }
|
|
86
|
+
#scene-root .mk-rows-2 .mk-card { min-height: 260px; }`;
|
|
87
|
+
const px = (ctx, step) => ctx.theme.fontSizes[step] ?? FALLBACK_PX[step] ?? 48;
|
|
88
|
+
const MAX_DECIMALS = 2;
|
|
89
|
+
const decimalsOf = (value) => Math.min(MAX_DECIMALS, (String(value).split(".")[1] ?? "").length);
|
|
90
|
+
const shown = (value) => typeof value === "number" ? fmt(value, { decimals: decimalsOf(value) }) : value;
|
|
91
|
+
/** Largest value size whose value and unit fit one line of the card. */
|
|
92
|
+
const valueStep = (ctx, items, cols) => {
|
|
93
|
+
const rows = Math.ceil(items.length / cols);
|
|
94
|
+
const inner = (ctx.width * (1 - SAFE_SIDES) - GAP_PX * (cols - 1)) / cols - CARD_PAD_PX;
|
|
95
|
+
const steps = rows > 1 && !(cols === 1 && rows <= 3) ? VALUE_STEPS.slice(1) : VALUE_STEPS;
|
|
96
|
+
const fits = (step) => items.every((item) => {
|
|
97
|
+
const unit = item.unit ? textWidth(item.unit, px(ctx, UNIT_STEP)) + GAP_PX / 2 : 0;
|
|
98
|
+
return textWidth(shown(item.value), px(ctx, step)) + unit <= inner * WIDTH_MARGIN;
|
|
99
|
+
});
|
|
100
|
+
return steps.find(fits) ?? VALUE_STEPS[VALUE_STEPS.length - 1] ?? "lg";
|
|
101
|
+
};
|
|
102
|
+
const toneOf = (item) => {
|
|
103
|
+
if (item.trend === undefined)
|
|
104
|
+
return "none";
|
|
105
|
+
if (item.trend === "flat")
|
|
106
|
+
return "flat";
|
|
107
|
+
return item.trend === (item.good ?? "up") ? "good" : "bad";
|
|
108
|
+
};
|
|
109
|
+
const deltaHtml = (item, index) => {
|
|
110
|
+
if (item.delta === undefined)
|
|
111
|
+
return "";
|
|
112
|
+
const trend = item.trend ?? "none";
|
|
113
|
+
const icon = item.trend === undefined
|
|
114
|
+
? ""
|
|
115
|
+
: sceneIcon(TREND_ICON[item.trend], { at: `props.items[${index}].trend`, size: 32 });
|
|
116
|
+
return `<p class="mk-delta mk-trend-${trend} mk-tone-${toneOf(item)}">${icon}<span>${esc(item.delta)}</span></p>`;
|
|
117
|
+
};
|
|
118
|
+
const cardHtml = (item, index, step, size) => {
|
|
119
|
+
const value = esc(shown(item.value));
|
|
120
|
+
const unit = item.unit ? `<span class="mk-unit">${esc(item.unit)}</span>` : "";
|
|
121
|
+
return `<li class="mk-card" ${animAttrs("rise", step, `item-${index + 1}`)}>
|
|
122
|
+
<p class="mk-label">${esc(item.label)}</p>
|
|
123
|
+
<p class="mk-figure"><span class="mk-value mk-v-${size}" data-step="${step}" data-count="${value}">${value}</span>${unit}</p>
|
|
124
|
+
${deltaHtml(item, index)}
|
|
125
|
+
</li>`;
|
|
126
|
+
};
|
|
127
|
+
const render = (props, ctx) => {
|
|
128
|
+
const offset = props.title ? 1 : 0;
|
|
129
|
+
const cols = colsOf(props, ctx);
|
|
130
|
+
const size = valueStep(ctx, props.items, cols);
|
|
131
|
+
const head = props.title
|
|
132
|
+
? `<div class="mk-head">
|
|
133
|
+
<h1 class="mk-heading" ${animAttrs("rise", 0, "title")}>${esc(props.title)}</h1>
|
|
134
|
+
<span class="mk-rule" ${animAttrs("grow", 0, "title")}></span>
|
|
135
|
+
</div>
|
|
136
|
+
`
|
|
137
|
+
: "";
|
|
138
|
+
const cards = props.items.map((item, index) => cardHtml(item, index, index + offset, size));
|
|
139
|
+
const rows = Math.ceil(props.items.length / cols);
|
|
140
|
+
return `${head}<ul class="mk-grid mk-cols-${cols} mk-rows-${rows}">\n${cards.join("\n")}\n</ul>`;
|
|
141
|
+
};
|
|
142
|
+
export const kpiGridScene = defineScene({
|
|
143
|
+
type: "kpi-grid",
|
|
144
|
+
configSchema,
|
|
145
|
+
meta: {
|
|
146
|
+
purpose: "2-6 headline numbers side by side, each with label, unit, change and trend arrow (good=down when a fall is good); values count up.",
|
|
147
|
+
example: {
|
|
148
|
+
title: "Quarter at a glance",
|
|
149
|
+
items: [
|
|
150
|
+
{ value: "$4.2M", label: "Revenue", delta: "+12%", trend: "up" },
|
|
151
|
+
{ value: 86, unit: "%", label: "Retention", delta: "-2 pts", trend: "down" },
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
style: readText("./style.css", import.meta.url),
|
|
156
|
+
script: readText("./scene.js", import.meta.url),
|
|
157
|
+
render: (props, ctx, root) => ({
|
|
158
|
+
body: render(props, ctx),
|
|
159
|
+
css: frameCss(ctx, root, { tall: TALL_CSS, square: SQUARE_CSS }),
|
|
160
|
+
}),
|
|
161
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { mountTimeline } from "../../runtime/mount.js";
|
|
3
|
+
/** @type {import("../../runtime/mount.js").CreateScene} */
|
|
4
|
+
export function createScene(root, config, ctx) {
|
|
5
|
+
return mountTimeline(root, config, ctx, { baseDelay: 0.2, staggerFrames: 5, rise: 40 });
|
|
6
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#scene-root {
|
|
2
|
+
gap: var(--mk-space-xl);
|
|
3
|
+
}
|
|
4
|
+
#scene-root .mk-head {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: flex-start;
|
|
8
|
+
gap: var(--mk-space-md);
|
|
9
|
+
}
|
|
10
|
+
#scene-root .mk-heading {
|
|
11
|
+
font-family: var(--mk-font-display, var(--mk-font-sans));
|
|
12
|
+
font-size: var(--mk-font-size-xl);
|
|
13
|
+
font-weight: 800;
|
|
14
|
+
line-height: 1.04;
|
|
15
|
+
letter-spacing: -0.03em;
|
|
16
|
+
text-wrap: balance;
|
|
17
|
+
}
|
|
18
|
+
#scene-root .mk-grid {
|
|
19
|
+
list-style: none;
|
|
20
|
+
padding: 0;
|
|
21
|
+
display: grid;
|
|
22
|
+
gap: var(--mk-space-lg);
|
|
23
|
+
align-items: stretch;
|
|
24
|
+
}
|
|
25
|
+
#scene-root .mk-cols-2 {
|
|
26
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
27
|
+
}
|
|
28
|
+
#scene-root .mk-cols-3 {
|
|
29
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
30
|
+
}
|
|
31
|
+
#scene-root .mk-card {
|
|
32
|
+
position: relative;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
gap: var(--mk-space-md);
|
|
39
|
+
padding: var(--mk-space-xl) var(--mk-space-xl) var(--mk-space-lg);
|
|
40
|
+
background: var(--mk-color-card);
|
|
41
|
+
border: var(--mk-stroke-card, 2px) solid var(--mk-color-divider);
|
|
42
|
+
border-radius: var(--mk-radius-xl);
|
|
43
|
+
box-shadow: var(
|
|
44
|
+
--mk-shadow-card,
|
|
45
|
+
0 24px 56px -28px color-mix(in srgb, var(--mk-color-fg) 40%, transparent)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
#scene-root .mk-card::before {
|
|
49
|
+
content: "";
|
|
50
|
+
position: absolute;
|
|
51
|
+
inset: 0 0 auto 0;
|
|
52
|
+
height: 8px;
|
|
53
|
+
background: linear-gradient(90deg, var(--mk-color-accent), var(--mk-color-accent2));
|
|
54
|
+
}
|
|
55
|
+
#scene-root .mk-rows-1 .mk-card {
|
|
56
|
+
min-height: 380px;
|
|
57
|
+
}
|
|
58
|
+
#scene-root .mk-rows-2 .mk-card {
|
|
59
|
+
min-height: 320px;
|
|
60
|
+
}
|
|
61
|
+
#scene-root .mk-label {
|
|
62
|
+
font-size: var(--mk-font-size-md);
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: 1.2;
|
|
65
|
+
color: var(--mk-color-muted);
|
|
66
|
+
text-wrap: balance;
|
|
67
|
+
}
|
|
68
|
+
#scene-root .mk-figure {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: baseline;
|
|
71
|
+
gap: var(--mk-space-sm);
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
74
|
+
#scene-root .mk-value {
|
|
75
|
+
font-family: var(--mk-font-display, var(--mk-font-sans));
|
|
76
|
+
display: inline-block;
|
|
77
|
+
transform-origin: left bottom;
|
|
78
|
+
font-weight: 800;
|
|
79
|
+
line-height: 1;
|
|
80
|
+
letter-spacing: -0.03em;
|
|
81
|
+
font-variant-numeric: var(--mk-numeric, tabular-nums);
|
|
82
|
+
color: var(--mk-color-fg);
|
|
83
|
+
}
|
|
84
|
+
#scene-root .mk-v-display {
|
|
85
|
+
font-size: var(--mk-font-size-display);
|
|
86
|
+
}
|
|
87
|
+
#scene-root .mk-v-title {
|
|
88
|
+
font-size: var(--mk-font-size-title);
|
|
89
|
+
}
|
|
90
|
+
#scene-root .mk-v-xl {
|
|
91
|
+
font-size: var(--mk-font-size-xl);
|
|
92
|
+
}
|
|
93
|
+
#scene-root .mk-v-lg {
|
|
94
|
+
font-size: var(--mk-font-size-lg);
|
|
95
|
+
}
|
|
96
|
+
#scene-root .mk-unit {
|
|
97
|
+
font-size: var(--mk-font-size-lg);
|
|
98
|
+
font-weight: 700;
|
|
99
|
+
color: var(--mk-color-muted);
|
|
100
|
+
}
|
|
101
|
+
#scene-root .mk-delta {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: var(--mk-space-sm);
|
|
105
|
+
padding: var(--mk-space-sm) var(--mk-space-md);
|
|
106
|
+
border-radius: var(--mk-radius-full);
|
|
107
|
+
background: var(--mk-color-accentSoft);
|
|
108
|
+
font-size: var(--mk-font-size-sm);
|
|
109
|
+
font-weight: 700;
|
|
110
|
+
font-variant-numeric: var(--mk-numeric, tabular-nums);
|
|
111
|
+
color: var(--mk-color-fg);
|
|
112
|
+
}
|
|
113
|
+
#scene-root .mk-delta svg {
|
|
114
|
+
width: 32px;
|
|
115
|
+
height: 32px;
|
|
116
|
+
flex: none;
|
|
117
|
+
}
|
|
118
|
+
#scene-root .mk-tone-good {
|
|
119
|
+
/* 6% tint keeps the status arrow at >= 4.5:1; the ring carries the visible hue */
|
|
120
|
+
background: color-mix(in srgb, var(--mk-status-good, var(--mk-chart-3)) 6%, var(--mk-color-card));
|
|
121
|
+
box-shadow: inset 0 0 0 2px
|
|
122
|
+
color-mix(in srgb, var(--mk-status-good, var(--mk-chart-3)) 40%, var(--mk-color-card));
|
|
123
|
+
}
|
|
124
|
+
#scene-root .mk-tone-good svg {
|
|
125
|
+
color: var(--mk-status-good, var(--mk-chart-3));
|
|
126
|
+
}
|
|
127
|
+
#scene-root .mk-tone-bad {
|
|
128
|
+
/* 6% tint keeps the status arrow at >= 4.5:1; the ring carries the visible hue */
|
|
129
|
+
background: color-mix(in srgb, var(--mk-status-bad, var(--mk-chart-5)) 6%, var(--mk-color-card));
|
|
130
|
+
box-shadow: inset 0 0 0 2px
|
|
131
|
+
color-mix(in srgb, var(--mk-status-bad, var(--mk-chart-5)) 40%, var(--mk-color-card));
|
|
132
|
+
}
|
|
133
|
+
#scene-root .mk-tone-bad svg {
|
|
134
|
+
color: var(--mk-status-bad, var(--mk-chart-5));
|
|
135
|
+
}
|
|
136
|
+
#scene-root .mk-tone-flat {
|
|
137
|
+
background: var(--mk-color-surface);
|
|
138
|
+
}
|
|
139
|
+
#scene-root .mk-tone-flat svg {
|
|
140
|
+
color: var(--mk-color-muted);
|
|
141
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const lowerThirdScene: import("@anvpx/motion-schema").ScenePlugin;
|