21 - the ADF tables carry ADF's nouns
CI / gate (push) Successful in 29s
CI / publish (push) Has been skipped

This commit is contained in:
2026-09-21 21:39:59 +02:00
parent e964abaa4b
commit c2acee7a1d
16 changed files with 111 additions and 102 deletions
@@ -1,6 +1,6 @@
import type { AttributeVocabulary } from './attribute-vocabulary.ts'
export type BlockDirective = {
export type BlockNode = {
attributes: AttributeVocabulary
contentModel: 'block' | 'code' | 'inline' | 'none'
}
@@ -41,7 +41,7 @@ const mediaAttributes: AttributeVocabulary = {
const syncBlockAttributes: AttributeVocabulary = { localId: 'string', resourceId: 'string' }
export const blockDirectives = {
export const blockNodes = {
blockTaskItem: { attributes: localIdAttributes, contentModel: 'block' },
blockquote: { attributes: localIdAttributes, contentModel: 'block' },
bodiedExtension: { attributes: extensionAttributes, contentModel: 'block' },
@@ -80,14 +80,14 @@ export const blockDirectives = {
tableRow: { attributes: localIdAttributes, contentModel: 'block' },
taskItem: { attributes: localIdAttributes, contentModel: 'inline' },
taskList: { attributes: localIdAttributes, contentModel: 'block' },
} satisfies Readonly<Record<string, BlockDirective>>
} satisfies Readonly<Record<string, BlockNode>>
export type BlockType = keyof typeof blockDirectives
export type BlockType = keyof typeof blockNodes
export function blockDirective(type: string): BlockDirective | undefined {
return isBlockType(type) ? blockDirectives[type] : undefined
export function blockNodeNamed(type: string): BlockNode | undefined {
return isBlockType(type) ? blockNodes[type] : undefined
}
function isBlockType(type: string): type is BlockType {
return Object.hasOwn(blockDirectives, type)
return Object.hasOwn(blockNodes, type)
}
@@ -1,11 +1,11 @@
import type { AttributeVocabulary } from './attribute-vocabulary.ts'
export type InlineDirective = {
export type InlineNode = {
attributes: AttributeVocabulary
textAttribute?: string
}
export const inlineDirectives: Readonly<Record<string, InlineDirective>> = {
export const inlineNodes: Readonly<Record<string, InlineNode>> = {
date: { attributes: { localId: 'string', timestamp: 'string' } },
emoji: { attributes: { id: 'string', localId: 'string', shortName: 'string', text: 'string' }, textAttribute: 'text' },
hardBreak: { attributes: { localId: 'string', text: 'string' } },
@@ -27,6 +27,6 @@ export const inlineDirectives: Readonly<Record<string, InlineDirective>> = {
status: { attributes: { color: 'string', localId: 'string', style: 'string', text: 'string' }, textAttribute: 'text' },
}
export function inlineDirective(type: string): InlineDirective | undefined {
return Object.hasOwn(inlineDirectives, type) ? inlineDirectives[type] : undefined
export function inlineNodeNamed(type: string): InlineNode | undefined {
return Object.hasOwn(inlineNodes, type) ? inlineNodes[type] : undefined
}