forked from home-assistant/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use local version 0.7 of lit-virtualizer (home-assistant#9321)
- Loading branch information
1 parent
00c6b0f
commit 2427d68
Showing
64 changed files
with
4,207 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { LitElement, TemplateResult } from "lit"; | ||
import { | ||
LayoutSpecifier, | ||
Layout, | ||
LayoutConstructor, | ||
} from "./uni-virtualizer/lib/layouts/Layout.js"; | ||
/** | ||
* A LitElement wrapper of the scroll directive. | ||
* | ||
* Import this module to declare the lit-virtualizer custom element. | ||
* Pass an items array, renderItem method, and scroll target as properties | ||
* to the <lit-virtualizer> element. | ||
*/ | ||
export declare class LitVirtualizer extends LitElement { | ||
renderItem?: (item: any, index?: number) => TemplateResult; | ||
items: Array<unknown>; | ||
scrollTarget: Element | Window; | ||
keyFunction: ((item: unknown) => unknown) | undefined; | ||
private _layout; | ||
private _scrollToIndex; | ||
createRenderRoot(): this; | ||
/** | ||
* The method used for rendering each item. | ||
*/ | ||
set layout(layout: Layout | LayoutConstructor | LayoutSpecifier | null); | ||
get layout(): Layout | LayoutConstructor | LayoutSpecifier | null; | ||
/** | ||
* Scroll to the specified index, placing that item at the given position | ||
* in the scroll view. | ||
*/ | ||
scrollToIndex(index: number, position?: string): Promise<void>; | ||
render(): TemplateResult; | ||
} | ||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"lit-virtualizer": LitVirtualizer; | ||
} | ||
} | ||
//# sourceMappingURL=lit-virtualizer.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { TemplateResult, ChildPart } from "lit"; | ||
import { PartInfo } from "lit/directive.js"; | ||
import { AsyncDirective } from "lit/async-directive.js"; | ||
import { | ||
Layout, | ||
LayoutConstructor, | ||
LayoutSpecifier, | ||
} from "./uni-virtualizer/lib/layouts/Layout.js"; | ||
import { | ||
VirtualScroller, | ||
ScrollToIndexValue, | ||
} from "./uni-virtualizer/lib/VirtualScroller.js"; | ||
/** | ||
* Configuration options for the scroll directive. | ||
*/ | ||
interface ScrollConfig { | ||
/** | ||
* A function that returns a lit-html TemplateResult. It will be used | ||
* to generate the DOM for each item in the virtual list. | ||
*/ | ||
renderItem?: (item: any, index?: number) => TemplateResult; | ||
keyFunction?: (item: any) => unknown; | ||
layout?: Layout | LayoutConstructor | LayoutSpecifier | null; | ||
/** | ||
* An element that receives scroll events for the virtual scroller. | ||
*/ | ||
scrollTarget?: Element | Window; | ||
/** | ||
* The list of items to display via the renderItem function. | ||
*/ | ||
items?: Array<any>; | ||
/** | ||
* Limit for the number of items to display. Defaults to the length of the | ||
* items array. | ||
*/ | ||
totalItems?: number; | ||
/** | ||
* Index and position of the item to scroll to. | ||
*/ | ||
scrollToIndex?: ScrollToIndexValue; | ||
} | ||
export declare const defaultKeyFunction: (item: any) => any; | ||
export declare const defaultRenderItem: (item: any) => TemplateResult<1>; | ||
declare class ScrollDirective extends AsyncDirective { | ||
container: HTMLElement | null; | ||
scroller: VirtualScroller | null; | ||
first: number; | ||
last: number; | ||
renderItem: (item: any, index?: number) => TemplateResult; | ||
keyFunction: (item: any) => unknown; | ||
items: Array<unknown>; | ||
constructor(part: PartInfo); | ||
render(config?: ScrollConfig): unknown; | ||
update(part: ChildPart, [config]: [ScrollConfig]): unknown; | ||
private _initialize; | ||
} | ||
export declare const scroll: ( | ||
config?: ScrollConfig | undefined | ||
) => import("lit-html/directive").DirectiveResult<typeof ScrollDirective>; | ||
export {}; | ||
//# sourceMappingURL=scroll.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.