mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-21 16:25:11 +02:00
Add Tizen 5.5 Polyfills, implement dpad navigation with specified components
This commit is contained in:
@@ -1,37 +1,31 @@
|
||||
<script lang="ts">
|
||||
import CardPlaceholder from '../Card/CardPlaceholder.svelte';
|
||||
import { Container } from '../../actions/focusAction';
|
||||
import classNames from 'classnames';
|
||||
import Container from '../../../Container.svelte';
|
||||
import type { Readable } from 'svelte/store';
|
||||
export let size: 'dynamic' | 'md' | 'lg' = 'md';
|
||||
export let orientation: 'landscape' | 'portrait' = 'landscape';
|
||||
|
||||
export let container: Container;
|
||||
let carousel = container.createChild('carousel').setDirection('horizontal');
|
||||
let focusIndexStore = carousel.focusIndex;
|
||||
let focusWithinStore = carousel.hasFocusWithin;
|
||||
|
||||
Container.focusedObject.subscribe((fo) => console.log('focusedObject', fo));
|
||||
carousel.hasFocus.subscribe((hf) => console.log('hasFocus', hf));
|
||||
|
||||
let registerer = carousel.getChildRegisterer();
|
||||
let focusIndex: Readable<number>;
|
||||
let focusWithin: Readable<boolean>;
|
||||
</script>
|
||||
|
||||
<p
|
||||
class={classNames({
|
||||
'bg-blue-500': $focusWithinStore
|
||||
'bg-blue-500': $focusWithin
|
||||
})}
|
||||
>
|
||||
Index: {$focusIndexStore}
|
||||
Index: {$focusIndex}
|
||||
</p>
|
||||
|
||||
{#each Array(10) as _, i (i)}
|
||||
<div
|
||||
tabindex="0"
|
||||
use:registerer
|
||||
<Container
|
||||
bind:focusIndex
|
||||
bind:focusWithin
|
||||
class={classNames({
|
||||
'bg-red-500': $focusIndexStore === i && $focusWithinStore
|
||||
'bg-red-500': $focusIndex === i && $focusWithin
|
||||
})}
|
||||
>
|
||||
<CardPlaceholder {size} index={i} {orientation} />
|
||||
</div>
|
||||
</Container>
|
||||
{/each}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
import { Container } from '../actions/focusAction';
|
||||
|
||||
export let container: Container;
|
||||
const registerer = container.getHtmlElementRegisterer();
|
||||
const registerer = container.getRegisterer();
|
||||
|
||||
export let handleClick = () => {
|
||||
container.focus();
|
||||
};
|
||||
</script>
|
||||
|
||||
<button use:registerer tabindex="0" on:click={handleClick} class="outline-none ring-0">
|
||||
<button use:registerer on:click={handleClick} class="outline-none ring-0">
|
||||
<slot />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user