notationBuiltInWord function
String?
notationBuiltInWord(
- String word, {
- Catalog? catalog,
- NotationVocabulary vocabulary = NotationVocabulary.core,
- bool primitive = false,
What the notation already has under word, in one line with its
signature, or null when it has nothing a writer's definition would hide:
a type of the notation or of the catalog (Card, Text), a page word
(App, Rail, Footer), or a name vocabulary's alias table reads as
one of those (RangeSlider, a Slider). A design
system's component (a page's definition may replace it, docs/design/20
section 6) and a word the design system defines are not.
The owner's decision (2026-11-18): a built-in word wins. A page's or a
site's define, primitive or component of such a name is not used,
and is said at the definition (before, define Card was not used, with
no word).
Implementation
String? notationBuiltInWord(String word, {Catalog? catalog, NotationVocabulary vocabulary = NotationVocabulary.core, bool primitive = false}) {
if (word.isEmpty) return null;
final c = catalog ?? Catalog.current;
if (PageWords.words.contains(word)) return '$word, a word of the page (its frames and their lines: App, Sidebar, Rail, Main, Nav, Section, Footer, Dialog…): $word …';
final lower = '${word[0].toLowerCase()}${word.substring(1)}';
final type = notationTypes[word]?.type ?? (c.widget(lower) != null ? lower : null);
if (type != null) return '$word, a word of the notation (a $type): $word "text" key=value …';
// A name the notation reads as another of its words (an alias: MonthGrid
// as Calendar, DataTable as Table) is not a word it has: a page's or a
// site's own definition of the name is the one read, as it is over a
// dictionary's. (The alias won, and the writer's month grid was a bare
// date picker with its parameters left out.) A `primitive` of the name
// has no lines to read in its place (a labelled box would stand in for
// what the notation draws): there the alias is the notation's word still.
if (primitive) {
if (vocabulary.types[word] case final a? when !vocabulary.definitions.containsKey(word)) {
return '$word, read as the notation\'s ${a.to}${a.variant == null ? '' : '.${a.variant}'}';
}
}
return null;
}