Mission Control Dashboard - Initial implementation

This commit is contained in:
Daniel Arroyo
2026-03-27 18:36:05 +00:00
parent 257cea2c7d
commit a8fb4d4555
12516 changed files with 2307128 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
import { Feature, resolveVariant } from 'motion-dom';
let id = 0;
class ExitAnimationFeature extends Feature {
constructor() {
super(...arguments);
this.id = id++;
this.isExitComplete = false;
}
update() {
if (!this.node.presenceContext)
return;
const { isPresent, onExitComplete } = this.node.presenceContext;
const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
if (!this.node.animationState || isPresent === prevIsPresent) {
return;
}
if (isPresent && prevIsPresent === false) {
/**
* When re-entering, if the exit animation already completed
* (element is at rest), reset to initial values so the enter
* animation replays from the correct position.
*/
if (this.isExitComplete) {
const { initial, custom } = this.node.getProps();
if (typeof initial === "string") {
const resolved = resolveVariant(this.node, initial, custom);
if (resolved) {
const { transition, transitionEnd, ...target } = resolved;
for (const key in target) {
this.node
.getValue(key)
?.jump(target[key]);
}
}
}
this.node.animationState.reset();
this.node.animationState.animateChanges();
}
else {
this.node.animationState.setActive("exit", false);
}
this.isExitComplete = false;
return;
}
const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
if (onExitComplete && !isPresent) {
exitAnimation.then(() => {
this.isExitComplete = true;
onExitComplete(this.id);
});
}
}
mount() {
const { register, onExitComplete } = this.node.presenceContext || {};
if (onExitComplete) {
onExitComplete(this.id);
}
if (register) {
this.unmount = register(this.id);
}
}
unmount() { }
}
export { ExitAnimationFeature };
//# sourceMappingURL=exit.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"exit.mjs","sources":["../../../../../src/motion/features/animation/exit.ts"],"sourcesContent":["import { Feature, resolveVariant } from \"motion-dom\"\n\nlet id = 0\n\nexport class ExitAnimationFeature extends Feature<unknown> {\n private id: number = id++\n private isExitComplete = false\n\n update() {\n if (!this.node.presenceContext) return\n\n const { isPresent, onExitComplete } = this.node.presenceContext\n const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {}\n\n if (!this.node.animationState || isPresent === prevIsPresent) {\n return\n }\n\n if (isPresent && prevIsPresent === false) {\n /**\n * When re-entering, if the exit animation already completed\n * (element is at rest), reset to initial values so the enter\n * animation replays from the correct position.\n */\n if (this.isExitComplete) {\n const { initial, custom } = this.node.getProps()\n\n if (typeof initial === \"string\") {\n const resolved = resolveVariant(\n this.node,\n initial,\n custom\n )\n if (resolved) {\n const { transition, transitionEnd, ...target } =\n resolved\n for (const key in target) {\n this.node\n .getValue(key)\n ?.jump(\n target[\n key as keyof typeof target\n ] as any\n )\n }\n }\n }\n\n this.node.animationState.reset()\n this.node.animationState.animateChanges()\n } else {\n this.node.animationState.setActive(\"exit\", false)\n }\n\n this.isExitComplete = false\n return\n }\n\n const exitAnimation = this.node.animationState.setActive(\n \"exit\",\n !isPresent\n )\n\n if (onExitComplete && !isPresent) {\n exitAnimation.then(() => {\n this.isExitComplete = true\n onExitComplete(this.id)\n })\n }\n }\n\n mount() {\n const { register, onExitComplete } = this.node.presenceContext || {}\n\n if (onExitComplete) {\n onExitComplete(this.id)\n }\n\n if (register) {\n this.unmount = register(this.id)\n }\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;AAEA,IAAI,EAAE,GAAG,CAAC;AAEJ,MAAO,oBAAqB,SAAQ,OAAgB,CAAA;AAA1D,IAAA,WAAA,GAAA;;QACY,IAAA,CAAA,EAAE,GAAW,EAAE,EAAE;QACjB,IAAA,CAAA,cAAc,GAAG,KAAK;IA8ElC;IA5EI,MAAM,GAAA;AACF,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE;QAEhC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe;AAC/D,QAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,IAAI,EAAE;QAExE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAA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AC3B,YAAA,CAAC,CAAC;QACN;IACJ;IAEA,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE;QAEpE,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B;QAEA,IAAI,QAAQ,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC;IACJ;AAEA,IAAA,OAAO,KAAI;AACd;;;;"}

View File

@@ -0,0 +1,39 @@
import { Feature, createAnimationState, isAnimationControls } from 'motion-dom';
class AnimationFeature extends Feature {
/**
* We dynamically generate the AnimationState manager as it contains a reference
* to the underlying animation library. We only want to load that if we load this,
* so people can optionally code split it out using the `m` component.
*/
constructor(node) {
super(node);
node.animationState || (node.animationState = createAnimationState(node));
}
updateAnimationControlsSubscription() {
const { animate } = this.node.getProps();
if (isAnimationControls(animate)) {
this.unmountControls = animate.subscribe(this.node);
}
}
/**
* Subscribe any provided AnimationControls to the component's VisualElement
*/
mount() {
this.updateAnimationControlsSubscription();
}
update() {
const { animate } = this.node.getProps();
const { animate: prevAnimate } = this.node.prevProps || {};
if (animate !== prevAnimate) {
this.updateAnimationControlsSubscription();
}
}
unmount() {
this.node.animationState.reset();
this.unmountControls?.();
}
}
export { AnimationFeature };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../src/motion/features/animation/index.ts"],"sourcesContent":["import {\n createAnimationState,\n Feature,\n isAnimationControls,\n type VisualElement,\n} from \"motion-dom\"\n\nexport class AnimationFeature extends Feature<unknown> {\n unmountControls?: () => void\n\n /**\n * We dynamically generate the AnimationState manager as it contains a reference\n * to the underlying animation library. We only want to load that if we load this,\n * so people can optionally code split it out using the `m` component.\n */\n constructor(node: VisualElement) {\n super(node)\n node.animationState ||= createAnimationState(node)\n }\n\n updateAnimationControlsSubscription() {\n const { animate } = this.node.getProps()\n if (isAnimationControls(animate)) {\n this.unmountControls = animate.subscribe(this.node)\n }\n }\n\n /**\n * Subscribe any provided AnimationControls to the component's VisualElement\n */\n mount() {\n this.updateAnimationControlsSubscription()\n }\n\n update() {\n const { animate } = this.node.getProps()\n const { animate: prevAnimate } = this.node.prevProps || {}\n if (animate !== prevAnimate) {\n this.updateAnimationControlsSubscription()\n }\n }\n\n unmount() {\n this.node.animationState!.reset()\n this.unmountControls?.()\n }\n}\n"],"names":[],"mappings":";;AAOM,MAAO,gBAAiB,SAAQ,OAAgB,CAAA;AAGlD;;;;AAIG;AACH,IAAA,WAAA,CAAY,IAAmB,EAAA;QAC3B,KAAK,CAAC,IAAI,CAAC;QACX,IAAI,CAAC,cAAc,KAAnB,IAAI,CAAC,cAAc,GAAK,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACtD;IAEA,mCAAmC,GAAA;QAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACxC,QAAA,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE;YAC9B,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACvD;IACJ;AAEA;;AAEG;IACH,KAAK,GAAA;QACD,IAAI,CAAC,mCAAmC,EAAE;IAC9C;IAEA,MAAM,GAAA;QACF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACxC,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE;AAC1D,QAAA,IAAI,OAAO,KAAK,WAAW,EAAE;YACzB,IAAI,CAAC,mCAAmC,EAAE;QAC9C;IACJ;IAEA,OAAO,GAAA;AACH,QAAA,IAAI,CAAC,IAAI,CAAC,cAAe,CAAC,KAAK,EAAE;AACjC,QAAA,IAAI,CAAC,eAAe,IAAI;IAC5B;AACH;;;;"}