MCPcopy Index your code
hub / github.com/tinyplex/tinybase / Body

Function Body

src/ui-solid-inspector/index.tsx:1055–1141  ·  view source on GitHub ↗
(props: StoreProp)

Source from the content-addressed store, hash-verified

1053};
1054
1055const Body = (props: StoreProp) => {
1056 let article: HTMLElement | undefined;
1057 let idleCallback = 0;
1058 const [scrolled, setScrolled] = createSignal(false);
1059 const state = useTable(STATE_TABLE, props.s);
1060 const scrollValues = useValues(props.s);
1061
1062 createEffect(() => {
1063 const {scrollLeft, scrollTop} = scrollValues();
1064 if (article && !scrolled()) {
1065 const observer = new MutationObserver(() => {
1066 if (
1067 article &&
1068 article.scrollWidth >=
1069 mathFloor(scrollLeft as number) + article.clientWidth &&
1070 article.scrollHeight >=
1071 mathFloor(scrollTop as number) + article.clientHeight
1072 ) {
1073 article.scrollTo(scrollLeft as number, scrollTop as number);
1074 }
1075 });
1076 observer.observe(article, {childList: true, subtree: true});
1077 onCleanup(() => observer.disconnect());
1078 }
1079 });
1080
1081 const handleScroll = (event: Event & {currentTarget: HTMLElement}) => {
1082 const {scrollLeft, scrollTop} = event.currentTarget;
1083 cancelInspectorIdleCallback(idleCallback);
1084 idleCallback = requestInspectorIdleCallback(() => {
1085 setScrolled(true);
1086 props.s.setPartialValues({scrollLeft, scrollTop});
1087 });
1088 };
1089
1090 const store = useStore();
1091 const storeIds = useStoreIds();
1092 const metrics = useMetrics();
1093 const metricsIds = useMetricsIds();
1094 const indexes = useIndexes();
1095 const indexesIds = useIndexesIds();
1096 const relationships = useRelationships();
1097 const relationshipsIds = useRelationshipsIds();
1098 const queries = useQueries();
1099 const queriesIds = useQueriesIds();
1100
1101 return (
1102 <>
1103 {state() &&
1104 isUndefined(store()) &&
1105 arrayIsEmpty(storeIds()) &&
1106 isUndefined(metrics()) &&
1107 arrayIsEmpty(metricsIds()) &&
1108 isUndefined(indexes()) &&
1109 arrayIsEmpty(indexesIds()) &&
1110 isUndefined(relationships()) &&
1111 arrayIsEmpty(relationshipsIds()) &&
1112 isUndefined(queries()) &&

Callers

nothing calls this directly

Calls 15

useTableFunction · 0.90
useValuesFunction · 0.90
useStoreFunction · 0.90
useStoreIdsFunction · 0.90
useMetricsFunction · 0.90
useMetricsIdsFunction · 0.90
useIndexesFunction · 0.90
useIndexesIdsFunction · 0.90
useRelationshipsFunction · 0.90
useRelationshipsIdsFunction · 0.90
useQueriesFunction · 0.90
useQueriesIdsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…