notationSiteRule top-level constant
String
const notationSiteRule
How an app or a site of several screens is written as files
(notationPrompt with site): the layout expand <site folder> reads
(docs/reference/notation: site.md, and "Calling one" of components.md),
as lines of the prompt's list.
Implementation
const String notationSiteRule =
'- An app or a site of several screens is a folder of files. pages/<name>.txt is one screen, the whole file (pages/home.txt, '
'pages/transactions.txt): its file name is its name, in lower case with a hyphen for a space, and it has no ### line. '
'go transactions on any page shows pages/transactions.txt.\n'
'- components/<Word>.txt is one word of the app\'s own, shared by every page (the app\'s navigation, a row of a list, a stat): its '
'first line is define and the word as a line would use it, each value its default (define BudgetRow "name" spent=0 limit=100; '
'a string takes a default too: define SiteNav "current"=home); '
'under it, indented, the lines it stands for, which read its strings and parameters by name in braces ({name}, {spent}); ... on '
'a line of its own is where the lines written under a use go. A line of its lines takes an at phone block as a page\'s does: '
'the word\'s own design at that width, at every use. Every page and every other component then calls it as any other '
'word (BudgetRow "Groceries" spent=320 limit=400), with nothing more said. One word a file, its file named after it, and none of '
'the words taught here: a name the page has is the page\'s, never a component (not Nav, Sidebar, Rail, Main, Section, Footer, '
'Hero, Panel, Pane, Drawer, Dialog, Sheet, Card, Badge, Chip, Avatar), so give '
'the app\'s own bar a name of its own (LedgerNav, SiteTop).\n'
'- app.txt is the state every page and component shares, read and set by name with no state line of their own: state lines '
'as a page writes them and nothing else, one a line (state plan="pro", state income=4800 saved, state left={income-spent}). A '
'long list is one item a line, so it shows as it is written: state txns=[ then each record on a line of its own ending in a '
'comma, then ] on the last. State only one page uses stays a state line on that page.\n'
'- Write pages/home.txt first, reading the shared state by name (its lists draw empty until app.txt declares them); then '
'app.txt; then site.json when the request names a look; then the components that page calls; then the next page and its '
'components.\n'
'- site.json is the app\'s own looks, set once so no line repeats them: {"theme": {"primary": "#FF1B5E3F" (the accent), '
'"surface": "#FFFBF7EF" (the page\'s ground), "onSurface" (the text), "fontFamily", "titleFontFamily" (headings), "radius", '
'"colors": {"ink": "#FF1F2A24"} (read as color=ink, fill=ink), "textStyles", "dark": {…}, "mode"}, "pages": ["home.json", '
'"budgets.json"]} (a page order; with none, home is first and the rest follow by name). A colour is "#AARRGGBB" or a name its '
'colors define. When the request names colours, a font or a mood, write the theme right after the first page and app.txt, '
'before any other page (primary, surface, onSurface, titleFontFamily, radius): every page written after it is then seen in '
'the app\'s own looks, and a theme left for last is a theme not written. Only a request that names no look leaves it out. '
'"dark" holds the colours that differ in the dark ({"surface": "#FF0F1115", "onSurface": "#FFF2F3F5"}); an app that is '
'always dark also sets "mode": "dark" beside it, so that it opens dark on those colours ("mode": "light": always light; with '
'no mode it follows the device). The preview\'s own light or dark switch changes what the person looks at, never what the app is.';