From: Thomas Walker Lynch Date: Sat, 20 Jun 2026 11:36:22 +0000 (+0000) Subject: version 3.0 first commit X-Git-Url: https://git.reasoningtechnology.com/sitemap.xml?a=commitdiff_plain;h=6834dfaa71a9ca48fd657d573118478c45a51214;p=RT-style version 3.0 first commit --- diff --git a/developer/authored/RT/core/block_visibility_during_layout.js b/developer/authored/RT/core/block_visibility_during_layout.js new file mode 100644 index 0000000..8513f01 --- /dev/null +++ b/developer/authored/RT/core/block_visibility_during_layout.js @@ -0,0 +1,19 @@ +// block_visibility_during_layout.js + +// 1. Hide the document immediately upon execution in the +document.documentElement.style.visibility = "hidden"; + +// 2. Define the restoration function +const restore_visibility = function() { + document.documentElement.style.visibility = ""; + document.removeEventListener("RT_layout_complete", restore_visibility); + window.removeEventListener("load", restore_visibility); +}; + +// 3. Listen for a specific completion signal from the layout engine +document.addEventListener("RT_layout_complete", restore_visibility); + +// 4. Structural Safety Net: If the layout engine fails or is never loaded, +// restore visibility on the final window 'load' event so the page doesn't remain blank. +window.addEventListener("load", restore_visibility); + diff --git a/developer/authored/RT/core/body_visibility_hidden.js b/developer/authored/RT/core/body_visibility_hidden.js deleted file mode 100644 index d6a178a..0000000 --- a/developer/authored/RT/core/body_visibility_hidden.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - Targets the root element to ensure total blackout during load. -*/ -function body_visibility_hidden(){ - const gate = document.createElement('style'); - gate.id = 'rt-visibility-gate'; - gate.textContent = 'html{visibility:hidden !important; background:black !important;}'; - document.head.appendChild(gate); -} - -window.StyleRT = window.StyleRT || {}; -window.StyleRT.body_visibility_hidden = body_visibility_hidden; diff --git a/developer/authored/RT/core/body_visibility_visible.js b/developer/authored/RT/core/body_visibility_visible.js deleted file mode 100644 index ff1c4b6..0000000 --- a/developer/authored/RT/core/body_visibility_visible.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - Restores visibility by removing the visibility gate. -*/ -function body_visibility_visible(){ - const gate = document.getElementById('rt-visibility-gate'); - if (gate){ - gate.remove(); - } - document.body.style.visibility = 'visible'; -} - -window.StyleRT = window.StyleRT || {}; -window.StyleRT.body_visibility_visible = body_visibility_visible; diff --git a/developer/authored/RT/core/loader.js b/developer/authored/RT/core/loader.js index 3f4ee68..5334d08 100644 --- a/developer/authored/RT/core/loader.js +++ b/developer/authored/RT/core/loader.js @@ -1,27 +1,22 @@ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.include = function(path_identifier){ - let parts_seq = path_identifier.split('/'); - let namespace = parts_seq[0]; - - let module_path = parts_seq.slice(1).join('/'); +window.RT.load = function(module_path){ + let target_module = module_path; - if(module_path === 'theme'){ + if(target_module === 'theme'){ let saved_theme = localStorage.getItem('RT_theme_preference'); if(!saved_theme){ saved_theme = 'dark_gold'; - localStorage.setItem('RT_theme_preference' ,saved_theme); + localStorage.setItem('RT_theme_preference', saved_theme); } - module_path = 'theme/' + saved_theme; + target_module = 'theme/' + saved_theme; } - let base_path = window.StyleRT_namespaces[namespace]; - if(!base_path){ - console.error("Namespace not found: " + namespace); - return; + let resolved_path = window.RT.dirpr_library + '/' + target_module; + + if(!resolved_path.endsWith('.js')){ + resolved_path = resolved_path + '.js'; } - let full_path = base_path + '/' + module_path + '.js'; - // FIXED: No backslashes in the closing script tag - document.write(''); + document.write(''); }; diff --git a/developer/authored/RT/core/utility.js b/developer/authored/RT/core/utility.js index b070510..d6f2ddd 100644 --- a/developer/authored/RT/core/utility.js +++ b/developer/authored/RT/core/utility.js @@ -1,11 +1,11 @@ /* - General utilities for the StyleRT library. + General utilities for the RT Style library. */ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; // --- DEBUG SYSTEM --- -window.StyleRT.debug = { +window.RT.debug = { // all debug messages enabled /* @@ -26,19 +26,18 @@ window.StyleRT.debug = { log: function(token, message) { if (this.active_tokens.has(token)) { - console.log(`[StyleRT:${token}]`, message); + console.log(`[RT:${token}]`, message); } }, warn: function(token, message) { if (this.active_tokens.has(token)) { - console.warn(`[StyleRT:${token}]`, message); + console.warn(`[RT:${token}]`, message); } }, - // New: Always log errors regardless of token, but tag them error: function(token, message) { - console.error(`[StyleRT:${token}] CRITICAL:`, message); + console.error(`[RT:${token}] CRITICAL:`, message); }, enable: function(token) { this.active_tokens.add(token); console.log(`Enabled: ${token}`); }, @@ -46,10 +45,10 @@ window.StyleRT.debug = { }; // --- UTILITIES --- -window.StyleRT.utility = { +window.RT.utility = { // --- FONT PHYSICS --- measure_ink_ratio: function(target_font, ref_font = null) { - const debug = window.StyleRT.debug; + const debug = window.RT.debug; debug.log('layout', `Measuring ink ratio for ${target_font}`); const canvas = document.createElement('canvas'); @@ -73,7 +72,6 @@ window.StyleRT.utility = { const target_m = get_metrics(target_font); const ratio = ref_m.ascent / target_m.ascent; - // debug.log('layout', `Ink Ratio calculated: ${ratio.toFixed(3)}`); return { ratio: ratio, @@ -83,8 +81,6 @@ window.StyleRT.utility = { // --- COLOR PHYSICS --- is_color_light: function(color_string) { - const debug = window.StyleRT.debug; - // 1. HSL Check if (color_string.startsWith('hsl')) { const numbers = color_string.match(/\d+/g); @@ -97,7 +93,6 @@ window.StyleRT.utility = { // 2. RGB Check const rgb = color_string.match(/\d+/g); if (!rgb) { - // debug.warn('color_layout', `Failed to parse color: "${color_string}". Defaulting to Light.`); return true; } diff --git a/developer/authored/RT/document/setup.js b/developer/authored/RT/document/setup.js deleted file mode 100644 index 343de0f..0000000 --- a/developer/authored/RT/document/setup.js +++ /dev/null @@ -1,4 +0,0 @@ -window.RT_REPO_ROOT = "../../../../"; -document.write(''); -document.write(''); -document.write(''); diff --git a/developer/authored/RT/document/style_manual.html b/developer/authored/RT/document/style_manual.html index 16ea4cd..5a10b4e 100644 --- a/developer/authored/RT/document/style_manual.html +++ b/developer/authored/RT/document/style_manual.html @@ -3,12 +3,23 @@ RT Style System: Reference Manual - + + + @@ -16,7 +27,7 @@ -

Table of custom tags

+ Table of custom tags

Style tag reference

@@ -112,7 +123,7 @@ -

Architecture overview

+ Architecture overview

The RT Style System is a client-side, JavaScript-driven publishing framework designed to turn raw HTML into high-readability technical documentation. Unlike standard CSS frameworks, RT uses JavaScript to handle complex layout tasks like ink-ratio balancing and dynamic pagination.

@@ -122,7 +133,7 @@ `setup.js` points at the style files and is installation specific.

-

Semantic tags

+ Semantic tags

The system relies on a specific set of custom tags in the RT- namespace to separate meaning from presentation.

@@ -230,7 +241,7 @@ Use <RT-cite> with the ref attribute to insert bibliographic citations. This ensures formatting remains consistent and separates citation data from standard prose.

- ... formalized as Basic Law V . + ... formalized as Basic Law V .

Dynamic cross referencing

@@ -243,7 +254,7 @@ Use <RT-index> at the end of the document to compile a glossary. Similar to the TOC compiler, this tag scans the DOM for automatic definition anchors produced by the term module and generates an alphabetized list of defined terms and neologisms.

-

Navigation and layout

+ Navigation and layout

Automatic table of contents

@@ -313,7 +324,7 @@ For major document divisions, use <RT-chapter>. The semantic processor translates this tag into an <RT-page-break> followed by an <h1 class="RT-chapter">. This ensures the chapter starts on a new page, inherits standard typography, and is automatically indexed by the TOC engine.

-

Debugging

+ Debugging

Debug tokens

@@ -352,7 +363,7 @@ For example, the term system (RT_term.js) uses the term token. When that token is enabled, the module will print messages describing how terms were detected and which term definitions were assigned IDs.

-

Themes

+ Themes

The system supports hot swapping themes by changing the script import in the head.

@@ -361,7 +372,7 @@
  • Light: style/theme_light_gold.js
  • -

    Manifest

    + Manifest 1. style_orchestrator.js (Example/default footer script) 2. utility.js (Math/Color physics) @@ -379,10 +390,10 @@ window.StyleRT.style_orchestrator(); -

    RT conventions

    + RT conventions

    Headings are first letter capitalized. Remaining words are as they would be in English prose.

    -

    Exercises

    + Exercises
    1. diff --git a/developer/authored/RT/element/TOC.js b/developer/authored/RT/element/TOC.js index fb6b10a..2f3bc6f 100644 --- a/developer/authored/RT/element/TOC.js +++ b/developer/authored/RT/element/TOC.js @@ -18,10 +18,10 @@ Next heading 2 3 */ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.TOC = function(){ - const debug = window.StyleRT.debug || { log: function(){} }; +window.RT.TOC = function(){ + const debug = window.RT.debug || { log: function(){} }; const TOC_seq = document.querySelectorAll('rt-toc'); TOC_seq.forEach( (container ,TOC_index) => { diff --git a/developer/authored/RT/element/chapter.js b/developer/authored/RT/element/chapter.js index 1cbf76e..42ba956 100644 --- a/developer/authored/RT/element/chapter.js +++ b/developer/authored/RT/element/chapter.js @@ -2,10 +2,10 @@ Processes tags. Transforms the tag into an followed by an

      with the RT-chapter class. */ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.chapter = function(){ - const debug = window.StyleRT.debug || { log: function(){} }; +window.RT.chapter = function(){ + const debug = window.RT.debug || { log: function(){} }; document.querySelectorAll('RT-chapter').forEach( (el ,index) => { if(debug.log) debug.log('chapter' ,`Processing chapter ${index + 1}`); diff --git a/developer/authored/RT/element/citation.js b/developer/authored/RT/element/citation.js deleted file mode 100644 index 857862e..0000000 --- a/developer/authored/RT/element/citation.js +++ /dev/null @@ -1,55 +0,0 @@ -window.StyleRT = window.StyleRT || {}; - -window.StyleRT.citation = function(){ - const citations = document.querySelectorAll('rt-cite'); - if(citations.length === 0) return; - - const article = document.querySelector('rt-article'); - if(!article) return; - - // 1. Ensure the H1 is a direct child of the article so the TOC can see it - let endnotesHeader = document.getElementById('endnotes-header'); - if (!endnotesHeader) { - endnotesHeader = document.createElement('h1'); - endnotesHeader.id = 'endnotes-header'; - endnotesHeader.innerText = 'Endnotes'; - article.appendChild(endnotesHeader); - } - - // 2. Locate or generate the endnotes list container - let endnoteContainer = document.querySelector('rt-endnotes'); - if(!endnoteContainer) { - endnoteContainer = document.createElement('rt-endnotes'); - article.appendChild(endnoteContainer); - } - - // 3. Ensure the list structure exists - if(!endnoteContainer.querySelector('ol')) { - endnoteContainer.innerHTML = '
        '; - } - - const list = endnoteContainer.querySelector('ol'); - - // Process each inline citation - citations.forEach((cite, index) => { - const refNum = index + 1; - const refText = cite.getAttribute('ref') || cite.innerHTML; - - cite.innerHTML = `[${refNum}]`; - cite.style.cursor = 'pointer'; - cite.style.color = 'var(--rt-brand-link)'; - cite.style.textDecoration = 'none'; - - // Append the corresponding entry into the endnotes list - const li = document.createElement('li'); - li.id = `note-${refNum}`; - li.innerHTML = `${refText} `; - list.appendChild(li); - }); - - // Style the container - endnoteContainer.style.display = 'block'; - endnoteContainer.style.marginTop = '1rem'; - endnoteContainer.style.borderTop = '1px solid var(--rt-surface-3)'; - endnoteContainer.style.paddingTop = '1rem'; -}; diff --git a/developer/authored/RT/element/code.js b/developer/authored/RT/element/code.js index 7e6dca8..0a97f16 100644 --- a/developer/authored/RT/element/code.js +++ b/developer/authored/RT/element/code.js @@ -5,7 +5,7 @@ Removes common indent from lines of code. */ function code() { - const RT = window.StyleRT; + const RT = window.RT; const U = RT.utility; const debug = RT.debug; @@ -125,5 +125,5 @@ function code() { debug.log('code', 'Render cycle complete.'); } -window.StyleRT = window.StyleRT || {}; -window.StyleRT.code = code; +window.RT = window.RT || {}; +window.RT.code = code; diff --git a/developer/authored/RT/element/constraint.js b/developer/authored/RT/element/constraint.js index dc4b596..c33b7b0 100644 --- a/developer/authored/RT/element/constraint.js +++ b/developer/authored/RT/element/constraint.js @@ -1,7 +1,7 @@ // developer/authored/RT/element/constraint.js -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.constraint = function(){ +window.RT.constraint = function(){ document.querySelectorAll('rt-constraint').forEach( (el) => { el.style.display = 'block'; el.style.borderLeft = '4px solid var(--rt-state-warning)'; diff --git a/developer/authored/RT/element/crossref.js b/developer/authored/RT/element/crossref.js index f0b2c60..aaea2bc 100644 --- a/developer/authored/RT/element/crossref.js +++ b/developer/authored/RT/element/crossref.js @@ -1,7 +1,7 @@ // developer/authored/RT/element/crossref.js -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.crossref = function(){ +window.RT.crossref = function(){ document.querySelectorAll('rt-crossref').forEach( (el) => { el.style.color = 'var(--rt-brand-link)'; el.style.textDecoration = 'underline'; diff --git a/developer/authored/RT/element/endnote.js b/developer/authored/RT/element/endnote.js new file mode 100644 index 0000000..dd887b3 --- /dev/null +++ b/developer/authored/RT/element/endnote.js @@ -0,0 +1,55 @@ +window.RT = window.RT || {}; + +window.RT.end_note = function(){ + const citations = document.querySelectorAll('rt-cite'); + if(citations.length === 0) return; + + const article = document.querySelector('rt-article'); + if(!article) return; + + // 1. Ensure the H1 is a direct child of the article so the TOC can see it + let endnotesHeader = document.getElementById('endnotes-header'); + if (!endnotesHeader) { + endnotesHeader = document.createElement('h1'); + endnotesHeader.id = 'endnotes-header'; + endnotesHeader.innerText = 'Endnotes'; + article.appendChild(endnotesHeader); + } + + // 2. Locate or generate the endnotes list container + let endnoteContainer = document.querySelector('rt-endnotes'); + if(!endnoteContainer) { + endnoteContainer = document.createElement('rt-endnotes'); + article.appendChild(endnoteContainer); + } + + // 3. Ensure the list structure exists + if(!endnoteContainer.querySelector('ol')) { + endnoteContainer.innerHTML = '
          '; + } + + const list = endnoteContainer.querySelector('ol'); + + // Process each inline citation + citations.forEach((cite, index) => { + const refNum = index + 1; + const refText = cite.getAttribute('ref') || cite.innerHTML; + + cite.innerHTML = `[${refNum}]`; + cite.style.cursor = 'pointer'; + cite.style.color = 'var(--rt-brand-link)'; + cite.style.textDecoration = 'none'; + + // Append the corresponding entry into the endnotes list + const li = document.createElement('li'); + li.id = `note-${refNum}`; + li.innerHTML = `${refText} `; + list.appendChild(li); + }); + + // Style the container + endnoteContainer.style.display = 'block'; + endnoteContainer.style.marginTop = '1rem'; + endnoteContainer.style.borderTop = '1px solid var(--rt-surface-3)'; + endnoteContainer.style.paddingTop = '1rem'; +}; diff --git a/developer/authored/RT/element/math.js b/developer/authored/RT/element/math.js index 1e2ae8f..51d86a7 100644 --- a/developer/authored/RT/element/math.js +++ b/developer/authored/RT/element/math.js @@ -31,5 +31,5 @@ function math(){ document.head.appendChild(script); } -window.StyleRT = window.StyleRT || {}; -window.StyleRT.math = math; +window.RT = window.RT || {}; +window.RT.math = math; diff --git a/developer/authored/RT/element/symbol.js b/developer/authored/RT/element/symbol.js index 748ad75..7199fda 100644 --- a/developer/authored/RT/element/symbol.js +++ b/developer/authored/RT/element/symbol.js @@ -1,7 +1,7 @@ // developer/authored/RT/element/symbol.js -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.symbol = function(){ +window.RT.symbol = function(){ document.querySelectorAll('rt-symbol').forEach( (el) => { el.style.fontFamily = '"Courier New", Courier, monospace'; el.style.fontWeight = '600'; diff --git a/developer/authored/RT/element/term.js b/developer/authored/RT/element/term.js index 4ebc634..1cc779c 100644 --- a/developer/authored/RT/element/term.js +++ b/developer/authored/RT/element/term.js @@ -5,10 +5,10 @@ - Automatically generates IDs for first occurrences for future indexing. */ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.term = function() { - const RT = window.StyleRT; +window.RT.term = function() { + const RT = window.RT; const debug = RT.debug || { log: function() {} diff --git a/developer/authored/RT/element/title.js b/developer/authored/RT/element/title.js index db821af..bfb8d4e 100644 --- a/developer/authored/RT/element/title.js +++ b/developer/authored/RT/element/title.js @@ -5,10 +5,10 @@ Usage: */ -window.StyleRT = window.StyleRT || {}; +window.RT = window.RT || {}; -window.StyleRT.title = function() { - const debug = window.StyleRT.debug || { log: function(){} }; +window.RT.title = function() { + const debug = window.RT.debug || { log: function(){} }; document.querySelectorAll('rt-title').forEach(el => { const title = el.getAttribute('title') || 'Untitled Document'; diff --git a/developer/authored/RT/layout/article_tech_ref.js b/developer/authored/RT/layout/article_tech_ref.js index 9e7386b..fc7034b 100644 --- a/developer/authored/RT/layout/article_tech_ref.js +++ b/developer/authored/RT/layout/article_tech_ref.js @@ -1,6 +1,6 @@ -// debug messsages don't work here, because RT/core/utility isn't loaded until after the function runs. +// debug messages don't work here, because core/utility isn't loaded until after the function runs. (function(){ - const RT = window.StyleRT = window.StyleRT || {}; + const RT = window.RT = window.RT || {}; const debug = RT.debug || { log: function(){} }; debug.log('scroll', "1. Initializing script."); @@ -31,27 +31,29 @@ // 4. The Lock let is_layout_locked = true; - // 5. Declare Dependencies - RT.include('RT/element/chapter'); - RT.include('RT/element/citation'); - RT.include('RT/core/utility'); - RT.include('RT/element/math'); - RT.include('RT/element/code'); - RT.include('RT/element/term'); - RT.include('RT/element/TOC'); - RT.include('RT/element/title'); - RT.include('RT/element/theme_selector'); - RT.include('RT/element/symbol'); - RT.include('RT/element/constraint'); - RT.include('RT/element/crossref'); - - - RT.include('RT/layout/paginate_by_element'); - RT.include('RT/layout/page_fixed_glow'); - RT.include('RT/layout/paginate_by_element'); - - RT.include('RT/core/body_visibility_visible'); + // Helper to ensure we only signal completion once + function unlock_layout() { + if (!is_layout_locked) return; + is_layout_locked = false; + debug.log('scroll', "10. Layout fully unlocked. Emitting completion signal."); + document.dispatchEvent(new Event("RT_layout_complete")); + } + // 5. Declare Dependencies + RT.load('element/chapter'); + RT.load('element/endnote'); + RT.load('element/math'); + RT.load('element/code'); + RT.load('element/term'); + RT.load('element/TOC'); + RT.load('element/title'); + RT.load('element/theme_selector'); + RT.load('element/symbol'); + RT.load('element/constraint'); + RT.load('element/crossref'); + + RT.load('layout/paginate_by_element'); + RT.load('layout/page_fixed_glow'); // 6. The Typography Layout RT.article = function(){ @@ -87,10 +89,10 @@ style.color = "var(--rt-content-main)"; } - window.StyleRT = window.StyleRT || {}; - window.StyleRT.config = window.StyleRT.config || {}; - window.StyleRT.config.page = window.StyleRT.config.page || {}; - window.StyleRT.config.page.height_limit = 900; + window.RT = window.RT || {}; + window.RT.config = window.RT.config || {}; + window.RT.config.page = window.RT.config.page || {}; + window.RT.config.page.height_limit = 900; const style_node = document.createElement("style"); style_node.innerHTML = ` @@ -177,9 +179,8 @@ max-width: 100%; height: auto; display: block; - margin: 1.5rem auto; /* Centers the image */ + margin: 1.5rem auto; } - `; document.head.appendChild(style_node); }; @@ -188,7 +189,7 @@ function run_semantics(){ debug.log('scroll' ,`4. run_semantics starting.`); if(RT.theme) RT.theme(); - if(RT.citation) RT.citation(); + if(RT.endnote) RT.endnote(); RT.article(); if(RT.title) RT.title(); if(RT.term) RT.term(); @@ -212,7 +213,6 @@ if(RT.TOC) RT.TOC(); if(RT.paginate_by_element) RT.paginate_by_element(); if(RT.page) RT.page(); - if(RT.body_visibility_visible) RT.body_visibility_visible(); debug.log('scroll', `6. Pagination complete.`); @@ -234,7 +234,7 @@ function enforce_scroll(target, use_hash, attempts) { if (attempts > 15) { debug.log('scroll', "8. Scroll enforcement timed out. Unlocking."); - is_layout_locked = false; + unlock_layout(); return; } @@ -264,8 +264,7 @@ debug.log('scroll', `9a. Browser late-stage rebellion detected. Re-enforcing.`); enforce_scroll(target, use_hash, attempts + 1); } else { - is_layout_locked = false; - debug.log('scroll', "10. Layout fully unlocked."); + unlock_layout(); } }, 100); } else { @@ -290,6 +289,7 @@ }); // 10. Bind to DOM Ready - document.addEventListener( 'DOMContentLoaded' ,run_semantics ); + document.addEventListener('DOMContentLoaded', run_semantics); })(); + diff --git a/developer/document/counter_tags.txt b/developer/document/counter_tags.txt new file mode 100644 index 0000000..b9ba678 --- /dev/null +++ b/developer/document/counter_tags.txt @@ -0,0 +1,6 @@ + +1. + + + +name can be any string diff --git a/shared/authored/version b/shared/authored/version index 4284d43..45626d4 100755 --- a/shared/authored/version +++ b/shared/authored/version @@ -1,5 +1,5 @@ echo "Harmony v2.2 2026-03-06" -echo "RT-style-JS_public v2.1 2026-06-01" +echo "RT-style-JS_public v3.1 2026-06-20 10:39:27 Z"