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,12 @@
"use client";
import { scrapeHTMLMotionValuesFromProps } from 'motion-dom';
import { makeUseVisualState } from '../../motion/utils/use-visual-state.mjs';
import { createHtmlRenderState } from './utils/create-render-state.mjs';
const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({
scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,
createRenderState: createHtmlRenderState,
});
export { useHTMLVisualState };
//# sourceMappingURL=use-html-visual-state.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"use-html-visual-state.mjs","sources":["../../../../src/render/html/use-html-visual-state.ts"],"sourcesContent":["\"use client\"\n\nimport { scrapeHTMLMotionValuesFromProps } from \"motion-dom\"\nimport { makeUseVisualState } from \"../../motion/utils/use-visual-state\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport const useHTMLVisualState = /*@__PURE__*/ makeUseVisualState({\n scrapeMotionValuesFromProps: scrapeHTMLMotionValuesFromProps,\n createRenderState: createHtmlRenderState,\n})\n"],"names":[],"mappings":";;;;;AAMO;AACH;AACA;AACH;;"}

View File

@@ -0,0 +1,57 @@
"use client";
import { isMotionValue, isForcedMotionValue, buildHTMLStyles } from 'motion-dom';
import { useMemo } from 'react';
import { createHtmlRenderState } from './utils/create-render-state.mjs';
function copyRawValuesOnly(target, source, props) {
for (const key in source) {
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
target[key] = source[key];
}
}
}
function useInitialMotionValues({ transformTemplate }, visualState) {
return useMemo(() => {
const state = createHtmlRenderState();
buildHTMLStyles(state, visualState, transformTemplate);
return Object.assign({}, state.vars, state.style);
}, [visualState]);
}
function useStyle(props, visualState) {
const styleProp = props.style || {};
const style = {};
/**
* Copy non-Motion Values straight into style
*/
copyRawValuesOnly(style, styleProp, props);
Object.assign(style, useInitialMotionValues(props, visualState));
return style;
}
function useHTMLProps(props, visualState) {
// The `any` isn't ideal but it is the type of createElement props argument
const htmlProps = {};
const style = useStyle(props, visualState);
if (props.drag && props.dragListener !== false) {
// Disable the ghost element when a user drags
htmlProps.draggable = false;
// Disable text selection
style.userSelect =
style.WebkitUserSelect =
style.WebkitTouchCallout =
"none";
// Disable scrolling on the draggable direction
style.touchAction =
props.drag === true
? "none"
: `pan-${props.drag === "x" ? "y" : "x"}`;
}
if (props.tabIndex === undefined &&
(props.onTap || props.onTapStart || props.whileTap)) {
htmlProps.tabIndex = 0;
}
htmlProps.style = style;
return htmlProps;
}
export { copyRawValuesOnly, useHTMLProps };
//# sourceMappingURL=use-props.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"use-props.mjs","sources":["../../../../src/render/html/use-props.ts"],"sourcesContent":["\"use client\"\n\nimport { AnyResolvedKeyframe, buildHTMLStyles, isForcedMotionValue, isMotionValue, MotionValue } from \"motion-dom\"\nimport { HTMLProps, useMemo } from \"react\"\nimport { MotionProps } from \"../../motion/types\"\nimport { ResolvedValues } from \"../types\"\nimport { createHtmlRenderState } from \"./utils/create-render-state\"\n\nexport function copyRawValuesOnly(\n target: ResolvedValues,\n source: { [key: string]: AnyResolvedKeyframe | MotionValue },\n props: MotionProps\n) {\n for (const key in source) {\n if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {\n target[key] = source[key] as AnyResolvedKeyframe\n }\n }\n}\n\nfunction useInitialMotionValues(\n { transformTemplate }: MotionProps,\n visualState: ResolvedValues\n) {\n return useMemo(() => {\n const state = createHtmlRenderState()\n\n buildHTMLStyles(state, visualState, transformTemplate)\n\n return Object.assign({}, state.vars, state.style)\n }, [visualState])\n}\n\nfunction useStyle(\n props: MotionProps,\n visualState: ResolvedValues\n): ResolvedValues {\n const styleProp = props.style || {}\n const style = {}\n\n /**\n * Copy non-Motion Values straight into style\n */\n copyRawValuesOnly(style, styleProp as any, props)\n\n Object.assign(style, useInitialMotionValues(props, visualState))\n\n return style\n}\n\nexport function useHTMLProps(\n props: MotionProps & HTMLProps<HTMLElement>,\n visualState: ResolvedValues\n) {\n // The `any` isn't ideal but it is the type of createElement props argument\n const htmlProps: any = {}\n const style = useStyle(props, visualState)\n\n if (props.drag && props.dragListener !== false) {\n // Disable the ghost element when a user drags\n htmlProps.draggable = false\n\n // Disable text selection\n style.userSelect =\n style.WebkitUserSelect =\n style.WebkitTouchCallout =\n \"none\"\n\n // Disable scrolling on the draggable direction\n style.touchAction =\n props.drag === true\n ? \"none\"\n : `pan-${props.drag === \"x\" ? \"y\" : \"x\"}`\n }\n\n if (\n props.tabIndex === undefined &&\n (props.onTap || props.onTapStart || props.whileTap)\n ) {\n htmlProps.tabIndex = 0\n }\n\n htmlProps.style = style\n\n return htmlProps\n}\n"],"names":[],"mappings":";;;;;;AAaI;AACI;;;;AAIR;AAEA;;AAKQ;AAEA;AAEA;AACJ;AACJ;AAEA;AAII;;AAGA;;AAEG;AACH;AAEA;AAEA;AACJ;AAEM;;;;;;AAUE;;AAGA;AACI;AACA;AACI;;AAGR;;AAEQ;AACA;;AAGZ;AAEI;AAEA;;AAGJ;AAEA;AACJ;;"}

View File

@@ -0,0 +1,9 @@
const createHtmlRenderState = () => ({
style: {},
transform: {},
transformOrigin: {},
vars: {},
});
export { createHtmlRenderState };
//# sourceMappingURL=create-render-state.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"create-render-state.mjs","sources":["../../../../../src/render/html/utils/create-render-state.ts"],"sourcesContent":["import { HTMLRenderState } from \"../types\"\n\nexport const createHtmlRenderState = (): HTMLRenderState => ({\n style: {},\n transform: {},\n transformOrigin: {},\n vars: {},\n})\n"],"names":[],"mappings":"AAEO,MAAM,qBAAqB,GAAG,OAAwB;AACzD,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,IAAI,EAAE,EAAE;AACX,CAAA;;;;"}