{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"course-notes","type":"registry:component","title":"Course Notes","description":"Save short dated class notes by course and topic in this browser.","author":"Notion Arena","categories":["docs"],"tags":["widget","free","course notes","lecture notes","class","student","offline"],"meta":{"kind":"widget","tier":"free","version":"1.0.0","updatedAt":"2026-10-11","notionPlan":"Free","emoji":"🗒️","delivery":["embed","html-block","download"],"capabilities":{"interactive":true,"offlineSafe":true,"persistsLocally":true,"writesToNotion":false,"needsNetwork":false},"embedUrl":"https://notionarena.vercel.app/embed/course-notes","fileUrl":"https://notionarena.vercel.app/widgets/course-notes.html","downloadUrl":"https://notionarena.vercel.app/api/widget/course-notes","height":390,"minHeight":290,"maxHeight":560,"params":[{"key":"label","label":"Widget title","type":"text","default":"Course notes"},{"key":"accent","label":"Accent","type":"color","default":"#2383e2"},{"key":"theme","label":"Theme","type":"select","default":"auto","options":[{"value":"auto","label":"Match Notion"},{"value":"light","label":"Light"},{"value":"dark","label":"Dark"}]}]},"files":[{"path":"widgets/course-notes.html","type":"registry:file","target":"notion/widgets/course-notes.html","content":"<!doctype html>\n<html lang=\"en\" data-theme=\"auto\">\n<head><meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" /><title>Course Notes</title>\n<style>\n:root{--bg:#fff;--fg:#37352f;--muted:#6b6a68;--surface:#f7f7f5;--border:#e9e9e7;--accent:#2383e2;--accent-ink:#fff;--accent-text:var(--accent);--danger:#c24136}\nhtml[data-theme=\"dark\"]{--bg:#191919;--fg:#e6e6e4;--muted:#9b9a97;--surface:#252525;--border:#343434;--danger:#ff7369}@media(prefers-color-scheme:dark){html[data-theme=\"auto\"]{--bg:#191919;--fg:#e6e6e4;--muted:#9b9a97;--surface:#252525;--border:#343434;--danger:#ff7369}}\n*{box-sizing:border-box}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}html,body{margin:0;height:100%}body{overflow:hidden;background:var(--bg);color:var(--fg);font-family:ui-sans-serif,-apple-system,BlinkMacSystemFont,\"Segoe UI\",Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased}.wrap{height:100%;min-height:280px;display:flex;flex-direction:column;gap:8px;padding:13px;overflow:auto}.head{display:flex;align-items:center;justify-content:space-between;gap:8px}.kicker{font-size:9px;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);font-weight:650}.title{margin-top:2px;font-size:14px;font-weight:650}.count{text-align:right;color:var(--muted);font-size:9px}.count b{display:block;color:var(--accent-text);font-size:12px}.form{display:grid;grid-template-columns:minmax(0,1fr) 120px;gap:5px}.form input,.form textarea{width:100%;min-width:0;border:1px solid var(--border);border-radius:7px;background:var(--surface);color:var(--fg);padding:5px 7px;font:inherit;font-size:9px}.form input{height:30px}.form textarea{min-height:48px;resize:vertical;line-height:1.4}.form input:focus-visible,.form textarea:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.form .topic{grid-column:1/2}.form .note{grid-column:1/3}.form button{grid-column:2;height:29px;border:1px solid var(--accent);border-radius:7px;background:var(--accent);color:var(--accent-ink);font:inherit;font-size:9px;padding:4px 8px;cursor:pointer}.list{display:flex;flex:1;min-height:55px;flex-direction:column;gap:5px;overflow:auto}.entry{padding:7px 8px;border:1px solid var(--border);border-radius:8px;background:var(--surface)}.entry-head{display:flex;justify-content:space-between;gap:7px}.topic-text{min-width:0;overflow-wrap:anywhere;font-size:10px;font-weight:650}.date{color:var(--accent-text);font-size:8.5px;white-space:nowrap}.course{margin-top:2px;color:var(--muted);font-size:8.5px}.body-text{margin-top:5px;overflow-wrap:anywhere;white-space:pre-wrap;color:var(--fg);font-size:9px;line-height:1.4}.remove{float:right;width:22px;height:22px;margin:2px 0 0 6px;border:1px solid var(--border);border-radius:6px;background:var(--bg);color:var(--muted);cursor:pointer}.remove:hover{border-color:var(--danger);color:var(--danger)}.empty{text-align:center;padding:12px;color:var(--muted);font-size:10px}.foot{display:flex;align-items:center;justify-content:space-between;gap:8px}.status,.warning{color:var(--muted);font-size:9px;line-height:1.35}.clear{min-height:26px;border:1px solid var(--border);border-radius:7px;background:var(--surface);color:var(--fg);font:inherit;font-size:9px;padding:4px 7px;cursor:pointer}@media(max-width:340px){.wrap{padding:10px}.form{grid-template-columns:minmax(0,1fr) 96px}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}\n</style></head>\n<body><main class=\"wrap\"><header class=\"head\"><div><div class=\"kicker\">Personal class notes</div><div class=\"title\" id=\"title\">Course notes</div></div><div class=\"count\"><b id=\"count\">0</b>notes</div></header>\n<form class=\"form\" id=\"form\"><label class=\"sr-only\" for=\"course\">Course</label><input id=\"course\" maxlength=\"48\" placeholder=\"Course or class\" required /><label class=\"sr-only\" for=\"date\">Note date</label><input id=\"date\" type=\"date\" required /><label class=\"sr-only\" for=\"topic\">Topic</label><input class=\"topic\" id=\"topic\" maxlength=\"64\" placeholder=\"Topic or lecture\" required /><label class=\"sr-only\" for=\"note\">Note</label><textarea class=\"note\" id=\"note\" maxlength=\"1400\" placeholder=\"Write a short note...\" required></textarea><button type=\"submit\">Save note</button></form>\n<section class=\"list\" id=\"list\" aria-label=\"Saved course notes\"></section><footer class=\"foot\"><span class=\"status\" id=\"status\" aria-live=\"polite\">Notes stay in this browser; no class sync.</span><button class=\"clear\" id=\"clear\" type=\"button\">Clear notes</button></footer><div class=\"warning\">Local browser storage is not encrypted. Avoid sensitive details.</div></main>\n<script>\n(function(){var cfgEl=document.getElementById('bk-config'),base={};try{base=cfgEl?JSON.parse(cfgEl.textContent||'{}'):{};}catch(e){}var q=new URLSearchParams(location.search),c={};for(var k in base)c[k]=base[k];q.forEach(function(v,k){c[k]=v;});function safeColor(v,d){return /^#[0-9a-f]{6}$/i.test(String(v||''))?String(v):d;}function rgb(h){var s=h.slice(1);return[0,2,4].map(function(i){return parseInt(s.slice(i,i+2),16);});}function lum(a){return a.map(function(v){v/=255;return v<=.04045?v/12.92:Math.pow((v+.055)/1.055,2.4);}).reduce(function(s,v,i){return s+v*[.2126,.7152,.0722][i];},0);}function contrast(a,b){var x=lum(a),y=lum(b);return(Math.max(x,y)+.05)/(Math.min(x,y)+.05);}function ink(h){var a=rgb(h);return contrast(a,[255,255,255])>=contrast(a,[0,0,0])?'#fff':'#000';}function textColor(h){var dark=theme==='dark'||(theme==='auto'&&window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches),bg=rgb(dark?'#252525':'#f7f7f5'),a=rgb(h),to=dark?[255,255,255]:[0,0,0];if(contrast(a,bg)>=4.5)return h;for(var t=.02;t<=1;t+=.02){var m=a.map(function(v,i){return Math.round(v+(to[i]-v)*t);});if(contrast(m,bg)>=4.5)return'#'+m.map(function(v){return v.toString(16).padStart(2,'0');}).join('');}return dark?'#fff':'#191919';}var theme=['auto','light','dark'].indexOf(String(c.theme||'auto'))>=0?String(c.theme||'auto'):'auto',ACCENT=safeColor(c.accent,'#2383e2'),LABEL=String(c.label||'Course notes').slice(0,48),KEY='notion-arena.course-notes.v1',items=[];function setText(){document.documentElement.style.setProperty('--accent-text',textColor(ACCENT));}document.documentElement.setAttribute('data-theme',theme);document.documentElement.style.setProperty('--accent',ACCENT);document.documentElement.style.setProperty('--accent-ink',ink(ACCENT));setText();if(theme==='auto'&&window.matchMedia){var mq=window.matchMedia('(prefers-color-scheme: dark)');if(mq.addEventListener)mq.addEventListener('change',setText);else if(mq.addListener)mq.addListener(setText);}document.getElementById('title').textContent=LABEL;document.title=LABEL;function dayKey(){var d=new Date();return new Date(d.getTime()-d.getTimezoneOffset()*60000).toISOString().slice(0,10);}var date=document.getElementById('date');date.value=dayKey();try{var a=JSON.parse(localStorage.getItem(KEY)||'[]');if(Array.isArray(a))items=a.filter(function(x){return x&&typeof x.course==='string'&&typeof x.note==='string';}).slice(0,100);}catch(e){}var list=document.getElementById('list'),status=document.getElementById('status');function save(msg){try{localStorage.setItem(KEY,JSON.stringify(items));status.textContent=msg||'Notes stay in this browser; no class sync.';}catch(e){status.textContent='Storage is unavailable in this browser session.';}}function render(){list.textContent='';document.getElementById('count').textContent=String(items.length);if(!items.length){var empty=document.createElement('div');empty.className='empty';empty.textContent='Save a topic note to start your course notebook.';list.appendChild(empty);return;}items.slice().sort(function(a,b){return String(b.date||'').localeCompare(String(a.date||''));}).forEach(function(item){var row=document.createElement('article');row.className='entry';var head=document.createElement('div');head.className='entry-head';var topic=document.createElement('span');topic.className='topic-text';topic.textContent=item.topic||'Course note';var day=document.createElement('span');day.className='date';day.textContent=item.date||'';var course=document.createElement('div');course.className='course';course.textContent=item.course;var body=document.createElement('div');body.className='body-text';body.textContent=item.note;var remove=document.createElement('button');remove.className='remove';remove.type='button';remove.textContent='×';remove.setAttribute('aria-label','Remove note: '+(item.topic||item.course));remove.addEventListener('click',function(){items.splice(items.indexOf(item),1);save();render();});head.append(topic,day);row.append(head,course,body,remove);list.appendChild(row);});}document.getElementById('form').addEventListener('submit',function(e){e.preventDefault();var course=document.getElementById('course').value.trim().slice(0,48),topic=document.getElementById('topic').value.trim().slice(0,64),note=document.getElementById('note').value.trim().slice(0,1400),day=date.value;if(!course||!topic||!note||!/^\\d{4}-\\d{2}-\\d{2}$/.test(day))return;if(items.length>=100){status.textContent='Course note limit reached.';return;}items.push({course:course,topic:topic,note:note,date:day});document.getElementById('topic').value='';document.getElementById('note').value='';save();render();document.getElementById('topic').focus();});document.getElementById('clear').addEventListener('click',function(){items=[];save('Course notes cleared.');render();});render();})();\n</script></body></html>\n"}]}