New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lightningtv/solid

Package Overview
Dependencies
Maintainers
0
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningtv/solid - npm Package Compare versions

Comparing version

to
2.7.6-1

58

dist/src/primitives/Lazy.jsx

@@ -1,32 +0,32 @@

import { Index, createEffect, createMemo, createSignal, Show, onCleanup, } from 'solid-js';
import { Index, createEffect, createMemo, createSignal, Show, onCleanup, untrack, } from 'solid-js';
import { Dynamic } from '@lightningtv/solid';
import { Row, Column } from '@lightningtv/solid/primitives';
function createLazy(props, keyHandler) {
const [offset, setOffset] = createSignal(props.selected ?? 0);
const [asyncCount, setAsyncCount] = createSignal(0);
function createLazy(component, props, keyHandler) {
const [offset, setOffset] = createSignal(0);
let timeoutId = null;
createEffect(() => setOffset(props.selected ?? 0));
createEffect(() => {
if (props.async && props.each) {
setAsyncCount(0);
let count = 0;
const loadItems = () => {
if (count < props.upCount + offset()) {
setAsyncCount(count + 1);
timeoutId = setTimeout(loadItems, 1);
count++;
}
};
loadItems();
}
else {
setAsyncCount(props.upCount + offset());
}
});
const items = createMemo(() => (Array.isArray(props.each) ? props.each.slice(0, asyncCount() + offset()) : []));
createEffect(() => setOffset(props.selected || 0));
if (props.async) {
createEffect(() => {
if (props.each) {
let count = untrack(offset);
const loadItems = () => {
if (count < props.upCount) {
setOffset(count + 1);
timeoutId = setTimeout(loadItems, 1);
count++;
}
};
loadItems();
}
});
}
const items = createMemo(() => (Array.isArray(props.each) ? props.each.slice(0, offset()) : []));
const updateOffset = () => {
const maxOffset = props.each ? props.each.length - 1 : 0;
if (offset() >= maxOffset)
return;
if (timeoutId)
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
setOffset((prev) => Math.min(prev + 1, (Array.isArray(props.each) ? props.each.length : 0) - props.upCount));
setOffset((prev) => Math.min(prev + 1, maxOffset));
}, props.delay ?? 0);

@@ -39,4 +39,4 @@ };

return (<Show when={items().length > 0} fallback={props.fallback}>
<Dynamic component={props.component} {...props} {...keyHandler(updateOffset)}>
<Index each={items()}>{props.children}</Index>
<Dynamic component={component} {...props} {...keyHandler(updateOffset)}>
<Index each={items()} children={props.children}/>
</Dynamic>

@@ -46,9 +46,7 @@ </Show>);

export function LazyRow(props) {
props.component = Row;
return createLazy(props, (updateOffset) => ({ onRight: updateOffset }));
return createLazy(Row, props, (updateOffset) => ({ onRight: updateOffset }));
}
export function LazyColumn(props) {
props.component = Column;
return createLazy(props, (updateOffset) => ({ onDown: updateOffset }));
return createLazy(Column, props, (updateOffset) => ({ onDown: updateOffset }));
}
//# sourceMappingURL=Lazy.jsx.map
{
"name": "@lightningtv/solid",
"version": "2.7.6-0",
"version": "2.7.6-1",
"description": "Lightning Renderer for Solid Universal",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet