Sight Word Flashcard Generator: Keep the Word ID with Its Guidance

HTML for this example

Select the code and use your copy shortcut. Changes in this preview are temporary.

<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sight Word Flashcard Generator: Keep the Word ID with Its Guidance</title><style>*{box-sizing:border-box}body{margin:0;color:var(--ink,#233342);background:var(--bg,#eef2f3);font:17px/1.6 system-ui,sans-serif}main{max-width:980px;margin:auto;padding:clamp(16px,4vw,38px)}h1{font:700 clamp(30px,5vw,49px)/1.12 Georgia,serif;margin:10px 0 20px;max-width:800px}h2{font-size:24px;line-height:1.3;margin:0 0 15px}h3{font-size:19px;margin:12px 0}p{margin:0 0 16px}.eyebrow{font-weight:750;letter-spacing:.08em;text-transform:uppercase;font-size:16px}header{padding:10px 0 25px;border-bottom:3px solid var(--accent,#24586d);margin-bottom:24px}.lede{font-size:20px;max-width:760px}.panel{background:var(--paper,#fff);padding:clamp(18px,3vw,28px);border:1px solid var(--line,#c6d1d8);border-radius:12px;margin:20px 0}.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.grid>*{min-width:0}.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:16px 0}.stack>*{margin:12px 0}button{font:700 17px/1.4 system-ui,sans-serif;cursor:pointer;color:white;background:var(--accent,#24586d);border:2px solid var(--accent,#24586d);border-radius:7px;padding:11px 17px;max-width:100%;overflow-wrap:anywhere}button.secondary{background:transparent;color:var(--ink,#233342)}button[aria-pressed=true]{box-shadow:inset 0 0 0 3px #fff;outline:2px solid var(--ink,#233342)}button:disabled{opacity:.55;cursor:default}input,textarea,select{font:17px/1.5 system-ui,sans-serif;color:inherit;background:white;border:1px solid #778591;padding:10px 12px;border-radius:6px;max-width:100%;width:100%;min-width:0}input[type=checkbox]{width:22px;height:22px}textarea{min-height:110px;resize:vertical}label{display:block;font-weight:700;margin:12px 0 7px}button:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:3px solid #aa3d70;outline-offset:4px}.result{padding:18px;border-left:5px solid var(--accent,#24586d);background:var(--soft,#e5eff2);white-space:pre-wrap;overflow-wrap:anywhere;margin:20px 0}.result:empty{display:none}.hint{font-size:16px;color:var(--muted,#435968)}table{border-collapse:collapse;width:100%;table-layout:fixed;margin:16px 0}th,td{text-align:left;vertical-align:top;overflow-wrap:anywhere;padding:12px 8px;border-bottom:1px solid var(--line,#c6d1d8)}caption{text-align:left;font-weight:750;margin:8px 0}details{padding:18px;border:1px dashed #7b8b96;margin:20px 0}summary{cursor:pointer;font-weight:750}pre{font:16px/1.6 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;background:#162735;color:#f5f8fa;padding:18px;border-radius:8px}canvas,svg{display:block;max-width:100%;height:auto}footer{margin:28px 0;font-size:16px}.badge{font-weight:750;color:var(--accent,#24586d)}.metric{font:700 38px/1.3 Georgia,serif}.board{display:grid;gap:5px;max-width:440px;margin:20px auto}.board button{padding:7px;min-height:45px}.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}@media(max-width:560px){.grid{grid-template-columns:1fr}main{padding:16px}th,td{padding:10px 5px}.row button{flex-grow:1}.metric{font-size:32px}}
:root{--bg:#f3ecdf;--paper:#fffdf6;--accent:#725633;--soft:#f0e3cb;--ink:#423522}.frontgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.front{border:2px dashed #a48b67;min-height:130px;padding:20px;text-align:center;display:flex;align-items:center;justify-content:center;white-space:pre-wrap;font:700 28px/1.5 Georgia,serif}.front.blank{font:17px system-ui;color:#6d604f}@media(max-width:420px){.front{font-size:25px;padding:12px}}.frontgrid[hidden]{display:none}</style></head><body><main><header><p class="eyebrow">Teacher proof · Fronts and guidance</p><h1>Sight Word Flashcard Generator: Keep the Word ID with Its Guidance</h1><p class="lede">Generate a layout proof without inventing the instructional decisions behind it.</p><p class="hint">Original fictional sample. Changes last only while this page remains open.</p></header><section class="panel"><h2>Teacher-supplied records</h2><label for="records">Editable JSON word records</label><textarea id="records" rows="14">[
  {
    "id": "W01",
    "word": "said",
    "chunks": [
      "s",
      "ai",
      "d"
    ],
    "notes": "Illustrative spelling chunks; real teacher guidance pending.",
    "source": "TO CONFIRM",
    "spokenTarget": "TO CONFIRM",
    "labels": [
      "TO CONFIRM",
      "TO CONFIRM",
      "TO CONFIRM"
    ],
    "guidanceDate": "TO CONFIRM",
    "confirmation": "Pending teacher review"
  },
  {
    "id": "W02",
    "word": "the",
    "chunks": [
      "th",
      "e"
    ],
    "notes": "Instructional labels and spoken target TO CONFIRM.",
    "source": "TO CONFIRM",
    "spokenTarget": "TO CONFIRM",
    "labels": [
      "TO CONFIRM",
      "TO CONFIRM"
    ],
    "guidanceDate": "TO CONFIRM",
    "confirmation": "Pending teacher review"
  }
]</textarea><div class="row"><button id="generate" type="button">Generate proof</button><button id="reverse" type="button">Reverse input order</button><button id="reveal" type="button">Reveal teacher sheet</button><button id="clear" type="button" class="secondary">Clear</button></div><p id="result" class="result" role="status">Draft: teacher review pending. Generate a proof to inspect the layout.</p></section><section id="proof" class="panel" hidden><h2>Word fronts · Draft</h2><p id="pages"></p><div id="page0" class="frontgrid"><div id="front0" class="front blank">Blank slot</div><div id="front1" class="front blank">Blank slot</div><div id="front2" class="front blank">Blank slot</div><div id="front3" class="front blank">Blank slot</div><div id="front4" class="front blank">Blank slot</div><div id="front5" class="front blank">Blank slot</div></div><div id="page1" class="frontgrid"><div id="front6" class="front blank">Blank slot</div><div id="front7" class="front blank">Blank slot</div><div id="front8" class="front blank">Blank slot</div><div id="front9" class="front blank">Blank slot</div><div id="front10" class="front blank">Blank slot</div><div id="front11" class="front blank">Blank slot</div></div></section><section id="teacher" class="panel" hidden><h2>Separate teacher sheet · Draft</h2><pre id="notes"></pre></section><footer>Keep any records you need in your own working files. This page makes no network requests and saves no responses.</footer></main><script>
(()=>{'use strict';const $=id=>document.getElementById(id);
let accepted=null;function invalidate(){accepted=null;$('proof').hidden=true;$('teacher').hidden=true;$('notes').textContent='';$('result').textContent='Records changed. Generate a fresh proof; teacher confirmation remains pending.';}function parse(){const a=JSON.parse($('records').value);if(!Array.isArray(a)||a.length<1||a.length>12)throw Error('Supply 1 to 12 records.');const seen=new Set();for(const r of a){if(typeof r.id!=='string'||!r.id.trim()||r.id.length>40||seen.has(r.id))throw Error('IDs must be nonempty, bounded and unique.');seen.add(r.id);if(typeof r.word!=='string'||! /^[A-Za-z']{1,20}$/.test(r.word)||!/[A-Za-z]/.test(r.word))throw Error('Words need 1–20 ASCII letters/apostrophes.');if(!Array.isArray(r.chunks)||!r.chunks.length||r.chunks.some(c=>typeof c!=='string'||!c)||r.chunks.join('')!==r.word)throw Error(r.id+': chunks must reconstruct the exact word.');if(['notes','source'].some(k=>typeof r[k]!=='string'||r[k].length>120))throw Error('Notes and source must be text up to 120 characters.');for(const k of ['spokenTarget','guidanceDate','confirmation'])if(r[k]!==undefined&&(typeof r[k]!=='string'||r[k].length>120))throw Error('Guidance fields must be text up to 120 characters.');if(r.labels!==undefined&&(!Array.isArray(r.labels)||r.labels.length!==r.chunks.length||r.labels.some(x=>!['Taught','Not yet taught','Unexpected','TO CONFIRM'].includes(x))))throw Error('Supply one recognized label per chunk, or leave labels unconfirmed.');}return a;}$('records').addEventListener('input',invalidate);$('generate').addEventListener('click',()=>{invalidate();try{accepted=parse();const pages=Math.ceil(accepted.length/6);for(let i=0;i<12;i++){$('front'+i).textContent=i<accepted.length?accepted[i].word+'\n'+accepted[i].id:'Blank slot';$('front'+i).className='front'+(i<accepted.length?'':' blank');}$('page0').hidden=false;$('page1').hidden=pages<2;$('pages').textContent=accepted.length+' fronts; '+pages+' planned six-slot group'+(pages===1?'':'s')+'. Printed pagination not verified.';$('proof').hidden=false;$('result').textContent='Structure valid. Draft: teacher review pending. No pronunciation or instructional mapping approved.';}catch(error){accepted=null;$('result').textContent='Cannot generate: '+error.message;}});$('reverse').addEventListener('click',()=>{try{const a=JSON.parse($('records').value);if(!Array.isArray(a))throw Error('Array required.');$('records').value=JSON.stringify(a.reverse(),null,2);invalidate();}catch(error){invalidate();$('result').textContent='Cannot reorder: '+error.message;}});$('reveal').addEventListener('click',()=>{if(!accepted){$('result').textContent='Generate a valid current proof before revealing its teacher sheet.';return;}$('notes').textContent=accepted.map(r=>r.id+' · '+r.word+'\nChunks: '+r.chunks.join(' / ')+'\nNotes: '+r.notes+'\nSource: '+r.source+'\nSpoken target: '+(r.spokenTarget||'TO CONFIRM')+'\nChunk labels: '+(r.labels?r.labels.join(' / '):'TO CONFIRM')+'\nGuidance date: '+(r.guidanceDate||'TO CONFIRM')+'\nSupplied confirmation: '+(r.confirmation||'TO CONFIRM')+' (not verified by this generator).').join('\n\n');$('teacher').hidden=false;});$('clear').addEventListener('click',()=>{$('records').value='';invalidate();$('result').textContent='Records and proof cleared.';});
})();
</script></body></html>