@litfamily/litclaude 1.0.54 → 1.0.55
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/CHANGELOG.md +12 -0
- package/README.md +8 -8
- package/README_ko-KR.md +8 -8
- package/docs/assets/readme/badge-version.svg +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/lib/mod/frame.mjs +28 -6
- package/plugins/litclaude/lib/mod/motion.mjs +24 -3
- package/plugins/litclaude/lib/mod/timeline.mjs +38 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.55 - 2026-11-19
|
|
4
|
+
|
|
5
|
+
- The terminal LIT card now looks alive while LitClaude works. Small embers drift through the free cells of
|
|
6
|
+
the skills row: each starts as a turning stroke (`| / - \`), cools into a spark (`* +`) and goes out as a
|
|
7
|
+
dot, fading from white through flame orange to pink. Every ember is plain ASCII, so the terminal always
|
|
8
|
+
repaints it. The stage map's text stays still and readable.
|
|
9
|
+
- When a workflow moves to its next stage, the new stage's pill flashes and springs: it lights up, dips once
|
|
10
|
+
below its colour and settles within about 0.7 seconds. Moving to a different workflow does not kick.
|
|
11
|
+
- An idle card is calmer: the embers go out, and the border and the stages already done sink toward the
|
|
12
|
+
card's colour, so a working card and an idle one are easy to tell apart.
|
|
13
|
+
- The embers and the spring run only with full motion. `subtle` and `off` keep the card as it was.
|
|
14
|
+
|
|
3
15
|
## 1.0.54 - 2026-11-18
|
|
4
16
|
|
|
5
17
|
- One request can now use several LitClaude skills in order. When a `lit` prompt matches more than one skill,
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/cover-motion.webp" width="100%" alt="LitFamily motion cover: seven armored robots power on one by one, the LitClaude robot wakes with glowing eyes and a lit frame, then LITFAMILY and KEEP THE WORK LIT. light up." /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">A Claude Code plugin that helps every session plan the work, build it, check it, and leave a note the next session can pick up.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/readme/badge-version.svg" alt="1.0.55" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude#readme">Full guide and skills gallery on GitHub</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/README_ko-KR.md">한국어</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Add `lit` to a Claude Code prompt and Claude pins the goal, writes a failing test first,
|
|
@@ -83,7 +83,7 @@ the `/plugin` menu.
|
|
|
83
83
|
## More
|
|
84
84
|
|
|
85
85
|
- [Full guide and skills gallery on GitHub](https://github.com/wjgoarxiv/litclaude#readme)
|
|
86
|
-
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
87
|
-
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
88
|
-
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
89
|
-
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
86
|
+
- [Privacy and network behavior](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/privacy.md)
|
|
87
|
+
- [Migration and ownership conflicts](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/migration.md)
|
|
88
|
+
- [Release history](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/CHANGELOG.md)
|
|
89
|
+
- [MIT license](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/LICENSE)
|
package/README_ko-KR.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
1
|
+
<p align="center"><picture><source media="(prefers-reduced-motion: reduce)" srcset="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/cover-motion-still.webp" /><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/cover-motion.webp" width="100%" alt="LitFamily 모션 커버: 일곱 로봇 패널이 차례로 켜지고, LitClaude 로봇의 눈과 테두리가 빛난 뒤 LITFAMILY와 KEEP THE WORK LIT. 문구가 밝아지는 영상" /></picture></p>
|
|
2
2
|
|
|
3
3
|
<h1 align="center">LitClaude</h1>
|
|
4
4
|
<p align="center"><strong>Keep the work lit.</strong></p>
|
|
5
5
|
<p align="center">Claude Code에서 세션마다 계획하고, 만들고, 확인한 뒤 다음 세션이 이어받을 기록을 남기게 돕는 플러그인입니다.</p>
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
8
|
-
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/readme/badge-version.svg" alt="1.0.55" />
|
|
8
|
+
<a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/LICENSE"><img src="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/assets/readme/badge-license.svg" alt="MIT license" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
11
|
+
<a href="https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md">전체 안내와 스킬 갤러리는 GitHub에서</a> · <a href="https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/README.md">English</a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
Claude Code 프롬프트에 `lit`을 붙이면 Claude가 목표를 고정하고, 실패하는 테스트를 먼저 쓰고,
|
|
@@ -81,7 +81,7 @@ npx @litfamily/litclaude@latest uninstall
|
|
|
81
81
|
## 더 보기
|
|
82
82
|
|
|
83
83
|
- [전체 안내와 스킬 갤러리 (GitHub)](https://github.com/wjgoarxiv/litclaude/blob/main/README_ko-KR.md)
|
|
84
|
-
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
85
|
-
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
86
|
-
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
87
|
-
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.
|
|
84
|
+
- [개인정보와 네트워크 동작](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/privacy.md)
|
|
85
|
+
- [이전과 소유권 충돌](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/docs/migration.md)
|
|
86
|
+
- [변경 이력](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/CHANGELOG.md)
|
|
87
|
+
- [MIT 라이선스](https://cdn.jsdelivr.net/npm/@litfamily/litclaude@1.0.55/LICENSE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="146" height="20" role="img" aria-label="release: 1.0.55"><title>release: 1.0.55</title><g shape-rendering="crispEdges"><rect width="49" height="20" fill="#080d14"/><rect x="49" width="97" height="20" fill="#ff6337"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text x="255" y="140" textLength="390" transform="scale(.1)">release</text><text x="965" y="140" textLength="870" transform="scale(.1)" fill="#080D14">1.0.55</text></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@litfamily/litclaude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.55",
|
|
4
4
|
"description": "Claude Code plugin: add lit to a prompt and Claude plans, tests, checks and reviews the work, then leaves a handoff for the next session.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
import { gauge, knownFacts } from "../rewind/gauge.mjs";
|
|
36
36
|
import { textWidth, truncateToWidth } from "./layout.mjs";
|
|
37
37
|
import { CLUB_GLINT, CLUB_GOLD, CLUB_PILL, CLUB_STOPS, LOOKS, laneColor, lookOf } from "./looks.mjs";
|
|
38
|
-
import { barCells, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
|
|
38
|
+
import { barCells, emberColor, gradientAt, lerpColor, rainbowAt } from "./motion.mjs";
|
|
39
39
|
import { glyphSet } from "./settings.mjs";
|
|
40
40
|
import { formatDuration } from "./view.mjs";
|
|
41
41
|
|
|
@@ -395,7 +395,8 @@ const shortLabel = (label) => label.replace(/^[A-Za-z]+/u, (word) => word.slice(
|
|
|
395
395
|
// `━` cells by its `rainbow` instead.
|
|
396
396
|
const railSpans = (model, sample, index, cells, accent, rainbow = null) => {
|
|
397
397
|
if (cells === 0) return [span(" ")];
|
|
398
|
-
|
|
398
|
+
// Idle, the rails behind the current stage keep their grade but sink toward the rail colour.
|
|
399
|
+
const grade = rainbow ?? (model.idle ? (position) => lerpColor(mapColor(accent, position), PILL.rail, 0.6) : (position) => mapColor(accent, position));
|
|
399
400
|
const { stages } = model.workflow;
|
|
400
401
|
const last = Math.max(1, stages.length - 1);
|
|
401
402
|
const at = (cell) => (index - 1 + (cell + 0.5) / cells) / last;
|
|
@@ -440,10 +441,15 @@ const mapTrack = (model, sample, { glyphs, accent, rail, short = false, window =
|
|
|
440
441
|
let fill = model.idle ? lerpColor(accent, PILL.muted, 0.5) : accent;
|
|
441
442
|
if (model.ctxWarning) fill = lerpColor(fill, PALETTE.amber, sample.warn);
|
|
442
443
|
if (sample.ambient && !model.idle) fill = lerpColor(fill, "#ffffff", 0.2 * sample.ambient.breath);
|
|
444
|
+
// The stage just changed: the new stage's pill takes the spring's kick (motion.mjs springKick).
|
|
445
|
+
const kick = model.idle ? 0 : sample.kick ?? 0;
|
|
446
|
+
if (kick > 0) fill = lerpColor(fill, "#ffffff", 0.7 * kick);
|
|
447
|
+
else if (kick < 0) fill = lerpColor(fill, PILL.ink, -0.35 * kick);
|
|
443
448
|
const sweep = model.idle ? null : sample.ambient?.sweep ?? null;
|
|
444
449
|
out.push(...pill(litText(revealed.slice(0, label.length).padEnd(label.length), { fg: PILL.ink, bg: fill, bold: true }, sweep), fill, glyphs));
|
|
445
450
|
} else {
|
|
446
|
-
|
|
451
|
+
const done = mapColor(accent, index / last);
|
|
452
|
+
out.push(span(revealed, { fg: stage.state === "done" ? (model.idle ? lerpColor(done, PALETTE.dim, 0.6) : done) : PALETTE.dim }));
|
|
447
453
|
}
|
|
448
454
|
});
|
|
449
455
|
if (window && shown.at(-1) < stages.length - 1) out.push(span(" …", { fg: PALETTE.dim }));
|
|
@@ -711,6 +717,22 @@ const sparkled = (row, inner, sample, rainbow) => {
|
|
|
711
717
|
return fitRow([...row, span(" "), ...sky], inner);
|
|
712
718
|
};
|
|
713
719
|
|
|
720
|
+
// The glyph particles of body row `r`, drifting through the cells the row leaves free (two gap
|
|
721
|
+
// cells kept), while LitClaude works. Each is ASCII and moves by its glyph and colour together.
|
|
722
|
+
const embered = (row, inner, sample, model, r) => {
|
|
723
|
+
const particles = model.idle ? null : sample.ambient?.particles;
|
|
724
|
+
const list = particles?.rows[r];
|
|
725
|
+
const spare = inner - rowWidth(row) - 2;
|
|
726
|
+
if (!list || spare < 4) return fitRow(row, inner);
|
|
727
|
+
const sky = Array.from({ length: spare }, () => span(" "));
|
|
728
|
+
for (const { x, age, glyph } of list) {
|
|
729
|
+
const cell = Math.min(spare - 1, Math.floor(x * spare));
|
|
730
|
+
const color = emberColor(age, particles.style.heat);
|
|
731
|
+
if (color !== PALETTE.faint) sky[cell] = span(particles.style.ramp[glyph], { fg: color, bold: age < 0.3 });
|
|
732
|
+
}
|
|
733
|
+
return fitRow([...row, span(" "), ...sky], inner);
|
|
734
|
+
};
|
|
735
|
+
|
|
714
736
|
// After a break the idle card offers the cross-session brief, in the longest form that fits.
|
|
715
737
|
const AWAY_HINTS = Object.freeze([[" · back? type ", "lit adhd", " to catch up"], [" · back? ", "lit adhd", ""], [" ", "lit adhd", ""]]);
|
|
716
738
|
const awayHint = (room, accent) => {
|
|
@@ -732,7 +754,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
|
|
|
732
754
|
const invite = inviteChip(model, glyphs);
|
|
733
755
|
if (chips.length === 0) {
|
|
734
756
|
if (!model.idle && model.next && !model.workflow?.next) return fitRow([span("▸ ", { fg: accent }), span(truncateToWidth(model.next, inner - 2), { fg: PALETTE.white })], inner);
|
|
735
|
-
if (!model.idle) return
|
|
757
|
+
if (!model.idle) return embered([span("no LitFamily skill yet in this request", { fg: PALETTE.dim })], inner, sample, model, 3);
|
|
736
758
|
const hints = [
|
|
737
759
|
[span("no LitFamily skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent }), span(" to start one", { fg: PALETTE.dim })],
|
|
738
760
|
[span("no skill yet · type ", { fg: PALETTE.dim }), span("lit <task>", { fg: accent })],
|
|
@@ -760,7 +782,7 @@ const chipsRow = (model, sample, { inner, glyphs, accent, rainbow }) => {
|
|
|
760
782
|
}
|
|
761
783
|
if (shown < chips.length) row.push(...(row.length ? [span(" ")] : []), ...mutedPill(`+${chips.length - shown}`, glyphs));
|
|
762
784
|
if (model.away) return fitRow([...row, ...awayHint(inner - rowWidth(row), accent)], inner);
|
|
763
|
-
return withChip(row, invite, inner) ?? sparkled(row, inner, sample, rainbow);
|
|
785
|
+
return withChip(row, invite, inner) ?? (rainbow ? sparkled(row, inner, sample, rainbow) : embered(row, inner, sample, model, 3));
|
|
764
786
|
};
|
|
765
787
|
|
|
766
788
|
const noticeRow = (sample, inner) => {
|
|
@@ -838,7 +860,7 @@ const edgeColor = (model, sample, accent, look) => {
|
|
|
838
860
|
if (look === "turn") return sample.ambient ? lerpColor(lerpColor(PALETTE.amber, PALETTE.faint, 0.5), PALETTE.amber, sample.ambient.breath) : PALETTE.amber;
|
|
839
861
|
if (model.warnings.length) return PALETTE.amber;
|
|
840
862
|
if (look === "club") return CLUB_GOLD;
|
|
841
|
-
if (model.idle) return lerpColor(PALETTE.faint, accent, 0.
|
|
863
|
+
if (model.idle) return lerpColor(PALETTE.faint, accent, 0.2);
|
|
842
864
|
return lerpColor(accent, "#ffffff", 0.15 + 0.3 * (sample.ambient?.breath ?? 0));
|
|
843
865
|
};
|
|
844
866
|
|
|
@@ -36,6 +36,7 @@ export const TIMINGS = Object.freeze({
|
|
|
36
36
|
clock: 1000,
|
|
37
37
|
hue: 4800,
|
|
38
38
|
sparks: 3600,
|
|
39
|
+
kick: 720,
|
|
39
40
|
// The club look's glint along the top border (full motion only): the first pass waits
|
|
40
41
|
// `clubGlintRest`, each pass lasts `clubGlint`, and passes start `clubGlintPeriod` apart.
|
|
41
42
|
clubGlint: 1400,
|
|
@@ -49,12 +50,32 @@ export const TIMINGS = Object.freeze({
|
|
|
49
50
|
// draws its final frame and starts no frame timer; a clock on the card still ticks each second.
|
|
50
51
|
export const motionProfile = (mode) => {
|
|
51
52
|
if (mode === "off") {
|
|
52
|
-
return { mode, duration: () => 0, enterEase: EASE.linear, noticeEase: EASE.linear, shimmer: false, embers: false, ambient: null };
|
|
53
|
+
return { mode, duration: () => 0, enterEase: EASE.linear, noticeEase: EASE.linear, shimmer: false, embers: false, ambient: null, particles: null };
|
|
53
54
|
}
|
|
54
55
|
if (mode === "subtle") {
|
|
55
|
-
return { mode, duration: (ms) => Math.round(ms * 0.75), enterEase: EASE.outCubic, noticeEase: EASE.outCubic, shimmer: false, embers: false, ambient: { sweep: false, comet: false } };
|
|
56
|
+
return { mode, duration: (ms) => Math.round(ms * 0.75), enterEase: EASE.outCubic, noticeEase: EASE.outCubic, shimmer: false, embers: false, ambient: { sweep: false, comet: false }, particles: null };
|
|
56
57
|
}
|
|
57
|
-
return { mode: "full", duration: (ms) => ms, enterEase: EASE.outBack, noticeEase: EASE.outBack, shimmer: true, embers: true, ambient: { sweep: true, comet: true } };
|
|
58
|
+
return { mode: "full", duration: (ms) => ms, enterEase: EASE.outBack, noticeEase: EASE.outBack, shimmer: true, embers: true, ambient: { sweep: true, comet: true }, particles: PARTICLES };
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// The glyph particles that drift through the card's free cells while LitClaude works (full motion
|
|
62
|
+
// only). Every particle is ASCII, so each change repaints (see frame.mjs). A particle is born as a
|
|
63
|
+
// spinning stroke (`| / - \`), cools into a spark (`* +`) and dies as a dot (`. '`); its colour runs
|
|
64
|
+
// white-hot, flame orange, pink, then fades into the card. `rows` names the body rows that carry
|
|
65
|
+
// them (3 the skills row; the map row's text never moves), `count` how many burn per row, `life` a
|
|
66
|
+
// particle's lifetime in ms and `heat` how bright they burn (0 to 1).
|
|
67
|
+
export const PARTICLES = Object.freeze({ rows: Object.freeze([3]), count: 12, life: 1800, heat: 1, ramp: Object.freeze(["|", "/", "-", "\\", "*", "+", "+", "'", "."]) });
|
|
68
|
+
|
|
69
|
+
// The particle ink by age (0 just born, 1 gone), drawn over the card's background.
|
|
70
|
+
const EMBER_STOPS = Object.freeze(["#fff4e0", "#ffb070", "#ff6337", "#ff2d95", "#30363d"]);
|
|
71
|
+
export const emberColor = (age, heat = 1) => lerpColor("#30363d", gradientAt(EMBER_STOPS, age), heat * Math.sin(Math.PI * Math.min(1, Math.max(0, age)) ** 0.6));
|
|
72
|
+
|
|
73
|
+
// The stage kick `t` ms after the current stage changed: how far the new stage's pill lights
|
|
74
|
+
// toward white (above 0) or dips toward its ink (below 0): a damped spring that overshoots twice
|
|
75
|
+
// and is still by TIMINGS.kick.
|
|
76
|
+
export const springKick = (t) => {
|
|
77
|
+
if (!(t >= 0) || t >= TIMINGS.kick) return 0;
|
|
78
|
+
return Math.exp(-t / 190) * Math.cos((2 * Math.PI * t) / 300);
|
|
58
79
|
};
|
|
59
80
|
|
|
60
81
|
// The rewind look (plans/lit-adhd.md D7): while lit-adhd runs, the card's border and rails take a
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// frame (sampleTimeline) and stops its frame timer as soon as nothing moves (timelineBusy). Times are
|
|
4
4
|
// the surface module's own frame clock in milliseconds; nothing here reads a wall clock.
|
|
5
5
|
|
|
6
|
-
import { EASE, TIMINGS, isSettled, phase, retarget, sample, still } from "./motion.mjs";
|
|
6
|
+
import { EASE, TIMINGS, isSettled, phase, retarget, sample, springKick, still } from "./motion.mjs";
|
|
7
7
|
|
|
8
8
|
const PHASES = ["plan", "work", "review"];
|
|
9
9
|
// The count the bar follows: the workflow stage's n/m, else the plan or goal progress.
|
|
@@ -23,6 +23,12 @@ const lanesOf = (model, now) => {
|
|
|
23
23
|
return times.length ? { base: Math.max(...times), at: now } : null;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
// The workflow stage that is now, as one key, so the timeline sees the moment it changes.
|
|
27
|
+
const stageKeyOf = (model) => {
|
|
28
|
+
const flow = model.workflow;
|
|
29
|
+
return flow && flow.current >= 0 ? `${flow.family}:${flow.stages[flow.current]?.id}` : null;
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
const entryEnd = (profile) => 3 * profile.duration(TIMINGS.stagger) + profile.duration(TIMINGS.entry);
|
|
27
33
|
|
|
28
34
|
// One entry per chip: `at` is the firing the model reported, `arrivedAt` when this timeline saw
|
|
@@ -70,6 +76,7 @@ export const createTimeline = (model, now, profile) => {
|
|
|
70
76
|
leaving: null,
|
|
71
77
|
completion: model.completion ? { data: model.completion, at: now } : null,
|
|
72
78
|
chips: chipsOf(model, now),
|
|
79
|
+
stage: { key: stageKeyOf(model), at: null },
|
|
73
80
|
};
|
|
74
81
|
};
|
|
75
82
|
|
|
@@ -97,6 +104,10 @@ export const advanceTimeline = (timeline, model, now, profile) => {
|
|
|
97
104
|
next.completion = model.completion ? { data: model.completion, at: now } : null;
|
|
98
105
|
}
|
|
99
106
|
next.chips = chipsOf(model, now, timeline.chips);
|
|
107
|
+
const stage = stageKeyOf(model);
|
|
108
|
+
// Only a step inside one workflow kicks; a switch to another family arrives with its chip's light.
|
|
109
|
+
const sameFamily = (key) => Boolean(stage && key && key.split(":")[0] === stage.split(":")[0]);
|
|
110
|
+
if (stage !== (timeline.stage?.key ?? null)) next.stage = { key: stage, at: sameFamily(timeline.stage?.key) ? now : null };
|
|
100
111
|
next.ambient = ambientOf(model, now, profile, timeline.ambient);
|
|
101
112
|
next.glint = glintOf(model, now, profile, timeline.glint);
|
|
102
113
|
next.step = stepOf(model, now);
|
|
@@ -156,6 +167,29 @@ const sparksAt = (elapsed) => SPARK_SEEDS.map(({ start, speed, twinkle }) => {
|
|
|
156
167
|
// the card (`comet`, 0 to 1: the top rule left to right, then the bottom rule right to left),
|
|
157
168
|
// where the bright head stands on the rail leaving the current stage (`flow`, 0 to 1), how far the
|
|
158
169
|
// rewind look's hue has turned (`hue`, 0 to 1 over TIMINGS.hue) and its sparks (`sparks`, full only).
|
|
170
|
+
// The glyph particles of the profile's style: fixed seeds per row (the same LCG idea as the sparks),
|
|
171
|
+
// each burning through its life, reborn at a fresh place every generation. A particle is `x` (0 to
|
|
172
|
+
// 1 across the row's free cells), `age` (0 to 1) and `glyph` (an index into the style's ramp).
|
|
173
|
+
const PARTICLE_SEEDS = (() => {
|
|
174
|
+
let state = 29;
|
|
175
|
+
const next = () => {
|
|
176
|
+
state = (state * 1103515245 + 12345) % 2147483648;
|
|
177
|
+
return state / 2147483648;
|
|
178
|
+
};
|
|
179
|
+
return Object.freeze(Array.from({ length: 24 }, () => Object.freeze({ offset: next(), drift: next() - 0.5, place: next(), pace: 0.75 + 0.5 * next() })));
|
|
180
|
+
})();
|
|
181
|
+
const placeOf = (seed, generation) => {
|
|
182
|
+
const v = Math.sin((seed.place * 977 + generation * 131.7) * 12.9898) * 43758.5453;
|
|
183
|
+
return v - Math.floor(v);
|
|
184
|
+
};
|
|
185
|
+
const particlesAt = (elapsed, style) => Object.fromEntries(style.rows.map((row, r) => [row, PARTICLE_SEEDS.slice(r * 12, r * 12 + style.count).map((seed) => {
|
|
186
|
+
const cycle = (elapsed * seed.pace) / style.life + seed.offset;
|
|
187
|
+
const generation = Math.floor(cycle);
|
|
188
|
+
const age = cycle - generation;
|
|
189
|
+
const x = placeOf(seed, generation) + seed.drift * 0.08 * age;
|
|
190
|
+
return { x: Math.min(0.999, Math.max(0, x)), age, glyph: Math.min(style.ramp.length - 1, Math.floor(age * style.ramp.length)) };
|
|
191
|
+
})]));
|
|
192
|
+
|
|
159
193
|
const ambientSample = (timeline, now, profile) => {
|
|
160
194
|
if (!ambientActive(timeline, profile)) return null;
|
|
161
195
|
const elapsed = Math.max(0, now - timeline.ambient.at);
|
|
@@ -168,6 +202,7 @@ const ambientSample = (timeline, now, profile) => {
|
|
|
168
202
|
flow: profile.ambient.sweep ? (elapsed % TIMINGS.flow) / TIMINGS.flow : null,
|
|
169
203
|
hue: (elapsed % TIMINGS.hue) / TIMINGS.hue,
|
|
170
204
|
sparks: profile.ambient.sweep ? sparksAt(elapsed) : null,
|
|
205
|
+
particles: profile.particles ? { style: profile.particles, rows: particlesAt(elapsed, profile.particles) } : null,
|
|
171
206
|
};
|
|
172
207
|
};
|
|
173
208
|
|
|
@@ -181,6 +216,7 @@ export const timelineBusy = (timeline, now, profile) => {
|
|
|
181
216
|
if (timeline.notice && now < timeline.notice.at + d(TIMINGS.noticeIn)) return true;
|
|
182
217
|
if (timeline.leaving && now < timeline.leaving.at + d(TIMINGS.noticeOut)) return true;
|
|
183
218
|
if (timeline.completion && now < timeline.completion.at + d(TIMINGS.completion)) return true;
|
|
219
|
+
if (profile.particles && timeline.stage?.at !== null && timeline.stage?.at !== undefined && now < timeline.stage.at + TIMINGS.kick) return true;
|
|
184
220
|
return Object.values(timeline.chips).some((chip) => (chip.arrivedAt !== null && now < chip.arrivedAt + d(TIMINGS.shimmer))
|
|
185
221
|
|| (chip.from !== chip.state && now < chip.changedAt + d(TIMINGS.crossfade)));
|
|
186
222
|
};
|
|
@@ -251,6 +287,7 @@ export const sampleTimeline = (timeline, now, profile) => {
|
|
|
251
287
|
glint: glintAt(timeline, now),
|
|
252
288
|
step: timeline.step ? { name: timeline.step.name, elapsedMs: timeline.step.base + Math.max(0, now - timeline.step.at) } : null,
|
|
253
289
|
lanes: timeline.lanes ? { elapsedMs: timeline.lanes.base + Math.max(0, now - timeline.lanes.at) } : null,
|
|
290
|
+
kick: profile.particles && timeline.stage?.at !== null && timeline.stage?.at !== undefined ? springKick(now - timeline.stage.at) : 0,
|
|
254
291
|
spin: Math.floor(Math.max(0, now) / TIMINGS.spin) % 4,
|
|
255
292
|
};
|
|
256
293
|
};
|