// SPDX-License-Identifier: Apache-2.0
; specs/widgets/basics-pub-or-private.t27 -- the infographic of lesson 16 of the t27 basics course (specs/course/t27-basics.t27)
; Source of truth for public/widgets/basics-pub-or-private/ (gHashTag/trinity): scripts/widget-pages-from-spec.mjs compiles
; this file, checks its constants, evaluates the tests below and writes the page. tool.js is one import of
; ../infographic.js, which draws SAY_TABLE_* as a real <table> and SAY_FLOW_* as an SVG diagram with a
; <title>, black and white, and holds no words of its own. ASCII only (L3), English only (LANG-EN).
; The lesson spec it illustrates: public/t27/files/specs/basics/16_pub_or_private.t27.
; phi^2 + 1/phi^2 = 3 | TRINITY

module widget_basics_pub_or_private;

pub const KIND : str = "widget-tool";
pub const ID : str = "basics-pub-or-private";
pub const TITLE : str = "t27 basics 16: what pub changes in the generated code";
pub const DESCRIPTION : str = "A pub and a private t27 constant side by side with the TypeScript the real compiler wrote for each. Lesson 16 of the t27 basics course.";
pub const IMAGE_ALT : str = "A black and white table of two t27 constants, pub const OFFERED and const OWN, with the TypeScript line gen-ts wrote for each; both are exported.";
pub const HOOK : str = "pub says what a module offers. gen-ts exports the private one too: see the lines.";
pub const CATEGORY : str = "compiler";
pub const DATA_SOURCES : [2]str = ["The lesson spec public/t27/files/specs/basics/16_pub_or_private.t27, compiled clean on 7 backends by public/t27/t27_compiler.wasm, whose tests pass in the site test runner", "Compiler verdicts, error lines, code and counts quoted on this page are what the same wasm answered in node 22 when the course was authored; words without a run behind them are said to be read, not run"];
pub const READS_LOCAL_FILES : bool = false;
pub const SENDS_NOTHING : bool = true;

; --- The table -----------------------------------------------------------------------------
pub const SAY_TABLE_CAPTION : str = "pub and private constants through gen-ts";
pub const SAY_TABLE_HEAD : [2]str = ["t27", "gen-ts wrote"];
pub const SAY_TABLE_CELLS : [4]str = ["pub const OFFERED : u8 = 1;", "export const OFFERED = 1 satisfies number;", "const OWN : u8 = 2;", "export const OWN = 2 satisfies number;"];
pub const K_TABLE_COLS : u8 = 2;
pub const K_TABLE_ROWS : u8 = 2;
pub const K_TABLE_CELLS : u16 = 4;

; --- The diagram and the note ----------------------------------------------------------------
pub const SAY_NOTE : str = "The right column is what t27_compiler.wasm wrote for the ts backend.";

test the_cells_fill_whole_rows {
    assert K_TABLE_ROWS * K_TABLE_COLS == K_TABLE_CELLS;
}

test the_table_has_a_body {
    assert K_TABLE_ROWS > 0;
    assert K_TABLE_COLS > 0;
}
