|
|
|
|
@ -67,12 +67,17 @@ export class VirtualListProvider {
|
|
|
|
|
private constructor(opts: VirtualListOpts) {
|
|
|
|
|
this.opts = opts;
|
|
|
|
|
this.soma = Soma.require();
|
|
|
|
|
this.runtime = this.soma.runtime(virtualListMorfo, {});
|
|
|
|
|
this.runtime = this.soma.runtime(virtualListMorfo, {
|
|
|
|
|
props: {
|
|
|
|
|
orientation: () => this.opts.orientation.current
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.runtimePart = this.runtime.part('provider', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this,
|
|
|
|
|
context: VirtualListProvider.ctx
|
|
|
|
|
context: VirtualListProvider.ctx,
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -293,8 +298,7 @@ export class VirtualListProvider {
|
|
|
|
|
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
|
this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
'data-orientation': this.opts.orientation.current
|
|
|
|
|
...this.runtimePart.props
|
|
|
|
|
} as const)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -321,7 +325,8 @@ export class VirtualListViewportProvider {
|
|
|
|
|
owner: this,
|
|
|
|
|
onRefChange: (el) => {
|
|
|
|
|
this.provider.viewportRef = el;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
@ -355,7 +360,6 @@ export class VirtualListViewportProvider {
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
|
this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
'data-orientation': this.provider.opts.orientation.current,
|
|
|
|
|
style: {
|
|
|
|
|
position: 'relative',
|
|
|
|
|
overflow: this.provider.isHorizontal ? 'auto hidden' : 'hidden auto'
|
|
|
|
|
@ -395,7 +399,8 @@ export class VirtualListWindowViewportProvider {
|
|
|
|
|
owner: this,
|
|
|
|
|
onRefChange: (el) => {
|
|
|
|
|
this.provider.windowHostRef = el;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
@ -447,7 +452,6 @@ export class VirtualListWindowViewportProvider {
|
|
|
|
|
readonly props = $derived.by(() =>
|
|
|
|
|
this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
'data-orientation': this.provider.opts.orientation.current,
|
|
|
|
|
style: {
|
|
|
|
|
position: 'relative'
|
|
|
|
|
}
|
|
|
|
|
@ -475,7 +479,12 @@ export class VirtualListItemProvider {
|
|
|
|
|
this.runtimePart = this.provider.runtime.part('item', {
|
|
|
|
|
id: opts.id,
|
|
|
|
|
ref: opts.ref,
|
|
|
|
|
owner: this
|
|
|
|
|
owner: this,
|
|
|
|
|
props: {
|
|
|
|
|
index: () => this.opts.index.current,
|
|
|
|
|
orientation: () => this.provider.opts.orientation.current
|
|
|
|
|
},
|
|
|
|
|
syncAttrs: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ResizeObserver: report real rendered size back to the provider so
|
|
|
|
|
@ -525,8 +534,6 @@ export class VirtualListItemProvider {
|
|
|
|
|
: { [crossAxis]: '100%' };
|
|
|
|
|
return this.runtimePart.assert({
|
|
|
|
|
...this.runtimePart.props,
|
|
|
|
|
'data-index': this.opts.index.current,
|
|
|
|
|
'data-orientation': this.provider.opts.orientation.current,
|
|
|
|
|
style: {
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
top: '0',
|
|
|
|
|
|