You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.1 KiB
128 lines
3.1 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
export const feedMorfo = {
|
|
name: 'Feed',
|
|
kebab: 'feed',
|
|
scope: ['soma'],
|
|
apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/feed/',
|
|
translations: {
|
|
label: { es: 'Feed', en: 'Feed' }
|
|
},
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'provider',
|
|
archetype: 'provider',
|
|
kind: 'public',
|
|
defaultElement: 'section',
|
|
role: 'feed',
|
|
optional: false,
|
|
data: [{ attr: 'data-busy', value: v.propRef('busy'), severity: 'optional' }],
|
|
aria: [
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.propRef('ariaLabel'),
|
|
severity: 'recommended'
|
|
},
|
|
{
|
|
attr: 'aria-labelledby',
|
|
value: v.propRef('ariaLabelledby'),
|
|
condition: { when: 'prop-truthy', prop: 'ariaLabelledby' },
|
|
severity: 'optional'
|
|
},
|
|
{
|
|
attr: 'aria-busy',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'busy' }
|
|
}
|
|
],
|
|
keyboard: [
|
|
{ key: 'PageDown', action: 'next-item' },
|
|
{ key: 'PageUp', action: 'prev-item' },
|
|
{ key: 'Ctrl+Home', action: 'first-item' },
|
|
{ key: 'Ctrl+End', action: 'last-item' }
|
|
]
|
|
},
|
|
{
|
|
name: 'Article',
|
|
kebab: 'article',
|
|
archetype: 'item',
|
|
kind: 'public',
|
|
defaultElement: 'article',
|
|
role: 'article',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-posinset', value: v.propRef('posinset'), emit: 'value' },
|
|
{ attr: 'data-level', value: v.propRef('level'), emit: 'value' }
|
|
],
|
|
aria: [
|
|
{ attr: 'aria-posinset', value: v.propRef('posinset') },
|
|
{ attr: 'aria-setsize', value: v.propRef('setsize') },
|
|
{
|
|
attr: 'aria-labelledby',
|
|
value: v.partRef('article-title'),
|
|
condition: { when: 'part-present', part: 'article-title' },
|
|
severity: 'recommended'
|
|
},
|
|
{
|
|
attr: 'aria-describedby',
|
|
value: v.partRef('article-description'),
|
|
condition: { when: 'part-present', part: 'article-description' },
|
|
severity: 'optional'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'ArticleTitle',
|
|
kebab: 'article-title',
|
|
archetype: 'title',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'heading',
|
|
optional: true,
|
|
data: [],
|
|
aria: [{ attr: 'aria-level', value: v.propRef('level') }]
|
|
},
|
|
{
|
|
name: 'ArticleDescription',
|
|
kebab: 'article-description',
|
|
archetype: 'description',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Thread',
|
|
kebab: 'thread',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'feed',
|
|
optional: true,
|
|
data: [{ attr: 'data-level', value: v.propRef('level'), emit: 'value' }],
|
|
aria: [
|
|
{
|
|
attr: 'aria-labelledby',
|
|
value: v.partRef('article-title'),
|
|
condition: { when: 'part-present', part: 'article-title' },
|
|
severity: 'optional'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'Sentinel',
|
|
kebab: 'sentinel',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [
|
|
{ attr: 'data-intersecting', value: v.propRef('intersecting'), severity: 'optional' }
|
|
],
|
|
aria: [{ attr: 'aria-hidden', value: v.literal('true') }]
|
|
}
|
|
]
|
|
} as const satisfies Morfo;
|