easel-canvas 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ :root{--bg: #ebeae6;--panel: #ffffff;--panel-2: #f6f5f2;--hover: #efeee9;--pressed: #e4e3dd;--line: #dddcd6;--line-strong: #8a8982;--text: #111111;--muted: #5c5c58;--accent: #b84608;--accent-weak: #fbeadf;--accent-text: #ffffff;--select: #1f5fd6;--select-weak: #dfe8fb;--select-text: #ffffff;--ok: #1e7a4c;--warn: #b42318;--sticky: #fff1a8;--shadow-1: 0 1px 2px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .06);--shadow-2: 0 8px 28px rgba(0, 0, 0, .16), 0 0 0 1px rgba(0, 0, 0, .06);--r-sm: 4px;--r: 8px;--r-lg: 12px;color-scheme:light;font-family:Pretendard Variable,Pretendard,-apple-system,Apple SD Gothic Neo,Noto Sans KR,sans-serif;font-size:13px;line-height:1.4;color:var(--text)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg: #1a1a19;--panel: #242423;--panel-2: #2b2b2a;--hover: #31312f;--pressed: #3a3a38;--line: #3a3a37;--line-strong: #7a7a73;--text: #f3f3f0;--muted: #a9a9a3;--accent: #f07a3a;--accent-weak: #44291a;--accent-text: #111111;--select: #6f9df5;--select-weak: #1e2b47;--select-text: #111111;--ok: #5cc28e;--warn: #ff8a7a;--sticky: #e9d97a;--shadow-2: 0 8px 28px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);color-scheme:dark}}:root[data-theme=dark]{--bg: #1a1a19;--panel: #242423;--panel-2: #2b2b2a;--hover: #31312f;--pressed: #3a3a38;--line: #3a3a37;--line-strong: #7a7a73;--text: #f3f3f0;--muted: #a9a9a3;--accent: #f07a3a;--accent-weak: #44291a;--accent-text: #111111;--select: #6f9df5;--select-weak: #1e2b47;--select-text: #111111;--ok: #5cc28e;--warn: #ff8a7a;--sticky: #e9d97a;--shadow-2: 0 8px 28px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);color-scheme:dark}*{box-sizing:border-box}html,body,#root{margin:0;height:100%;overflow:hidden;background:var(--bg)}button,select,input,textarea{font:inherit;color:inherit}button{height:32px;padding:0 12px;border:1px solid var(--line);border-radius:var(--r);background:var(--panel);color:var(--text);cursor:pointer;display:inline-flex;align-items:center;gap:4px;transition:background-color 80ms,border-color 80ms}button:hover:not(:disabled){background:var(--hover);border-color:var(--line-strong)}button:active:not(:disabled){background:var(--pressed)}button:disabled{opacity:.4;cursor:default}button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text);font-weight:600}button.primary:hover:not(:disabled){background:var(--accent);filter:brightness(.94);border-color:var(--accent)}button.danger.primary{background:var(--warn);border-color:var(--warn);color:#fff}:focus-visible{outline:2px solid var(--accent);outline-offset:1px}select,input[type=text],input:not([type]),input[inputmode]{height:28px;border:1px solid var(--line-strong);border-radius:var(--r-sm);background:var(--panel);padding:0 8px}kbd{font:11px/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--muted);padding:2px 4px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--panel-2)}.muted{color:var(--muted)}.icon-btn{width:32px;height:32px;padding:0;justify-content:center;border-color:transparent;background:transparent;flex:none}.icon-btn.sm{width:24px;height:24px;border-radius:var(--r-sm)}.icon-btn.on{background:var(--accent-weak);color:var(--accent);border-color:transparent}.icon-btn.on:hover:not(:disabled){background:var(--accent-weak);border-color:transparent}.icon-btn.danger:hover:not(:disabled){color:var(--warn)}.glyph{font-size:18px;line-height:1}.loading{height:100%;display:flex;gap:8px;align-items:center;justify-content:center;color:var(--muted)}.spinner{width:16px;height:16px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.toolbar{min-height:48px;flex:none;display:flex;align-items:center;gap:8px;padding:4px 8px;flex-wrap:wrap;background:var(--panel);border-bottom:1px solid var(--line);z-index:10}.tb-zone{display:flex;align-items:center;gap:8px;min-width:0}.tb-left,.tb-right{flex:none}.toolbar .icon-btn{color:var(--muted)}.toolbar .icon-btn:hover:not(:disabled),.toolbar .icon-btn.on{color:var(--text)}.toolbar .icon-btn.on{background:var(--pressed)}.toolbar .tool-group[role=radiogroup] .icon-btn.on{background:var(--accent-weak);color:var(--accent)}.tb-right .icon-btn{color:var(--muted)}.tb-right .icon-btn.on{background:var(--pressed);color:var(--text)}.tb-center{flex:1 1 0;min-width:0;justify-content:center;overflow:hidden}.tb-center>*{min-width:0}.app-title{flex:0 1 auto}.tb-label{white-space:nowrap}.tb-shapes-compact,.tb-tools-compact{display:none;width:auto;padding:0 4px;gap:0}@media(max-width:1100px){.tb-label{display:none}.new-board{padding:0 4px}}@media(max-width:900px){.tool-group.tb-shapes-full{display:none}.tb-shapes-compact{display:inline-flex}}@media(max-width:480px){.tool-group.tb-tools-full,.tb-shapes-compact{display:none}.tb-tools-compact{display:inline-flex}.new-board span{display:none}}.menu-check{width:16px;display:inline-flex;color:var(--accent);visibility:hidden}.menu-check.on{visibility:visible}.app-title{font-size:13px;font-weight:500;color:var(--muted);margin-right:4px;white-space:nowrap;max-width:200px;overflow:hidden;text-overflow:ellipsis}.tool-group{display:flex;align-items:center;gap:2px;padding:0 4px;border-left:1px solid var(--line)}.tool-group:first-of-type{border-left:0}.spacer{flex:1}.zoom{min-width:56px;justify-content:center;border-color:transparent;background:transparent;font-variant-numeric:tabular-nums;color:var(--muted);padding:0 4px}.warn{color:var(--warn);white-space:nowrap;display:inline-flex;align-items:center;gap:4px}.editing-chip{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 4px 0 12px;border-radius:16px;background:var(--select-weak);color:var(--select);font-weight:600;white-space:nowrap}.editing-chip .icon-btn{color:var(--select)}.main{flex:1;display:flex;min-height:0}.canvas-wrap{position:relative;flex:1;min-width:0;display:flex}.canvas{position:relative;flex:1;overflow:hidden;cursor:default;touch-action:none}.canvas.tool-hand,.pan-capture{cursor:grab}.canvas.tool-board{cursor:crosshair}.canvas.tool-title,.canvas.tool-sticky{cursor:copy}.pan-capture{position:absolute;top:0;right:0;bottom:0;left:0;z-index:50}.world{position:absolute;left:0;top:0;transform-origin:0 0}.guide{position:absolute;background:var(--select);pointer-events:none;z-index:5}.marquee{position:absolute;border:solid var(--select);background:color-mix(in srgb,var(--select) 8%,transparent);pointer-events:none}.draft-board{position:absolute;border:dashed var(--select);background:color-mix(in srgb,var(--panel) 70%,transparent);pointer-events:none}.canvas-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;gap:12px;color:var(--muted);pointer-events:none}.canvas-empty p{margin:0;font-size:15px}.canvas-empty button{pointer-events:auto}.board{position:absolute}.board-label{position:absolute;left:0;bottom:100%;transform-origin:0 100%;display:flex;align-items:center;gap:4px;height:28px;padding:0 0 4px;white-space:nowrap;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--muted)}.board.selected .board-label{color:var(--select)}.board-title{font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis}.board-label.tiny .board-title,.board-label.tiny .board-file,.board-label.tiny .dot{display:none}.board.selected .board-title{color:var(--select)}.board-file{overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0;font-size:12px;opacity:0;transition:opacity 80ms}.board:hover .board-file,.board.selected .board-file,.board.editing .board-file{opacity:1}.board-btns{display:flex;gap:2px;margin-left:auto;flex:none;opacity:0;transition:opacity 80ms}.board:hover .board-btns,.board.selected .board-btns,.board.editing .board-btns{opacity:1}.board-btns .icon-btn{background:var(--panel);border-color:var(--line)}.dot{width:8px;height:8px;border-radius:50%;background:var(--ok);flex:none}.board-frame{position:absolute;top:0;right:0;bottom:0;left:0;background:#fff;overflow:hidden;box-shadow:var(--shadow-1)}.board.frameless .board-frame{box-shadow:none;background:transparent}.board:hover:not(.selected) .board-frame{box-shadow:0 0 0 2px var(--line-strong)}.board.selected .board-frame{box-shadow:0 0 0 3px var(--select)}.board:not(.editing):not(.playing) .board-frame{cursor:grab}.board.selected:not(.editing):not(.playing) .board-frame{cursor:move}.board.editing .board-frame{box-shadow:0 0 0 4px var(--select),0 0 0 10px var(--select-weak)}.canvas.editing .board:not(.editing),.canvas.editing .shape,.canvas.editing .note{opacity:.35;transition:opacity .16s}.canvas.editing .board.editing{z-index:5}.board-btns .edit-pill{width:auto;padding:0 6px;gap:4px}.board-btns .edit-pill-label{font-size:11px;font-weight:600}.board.selected .board-btns .edit-pill{background:var(--select);border-color:var(--select);color:var(--select-text)}.board.editing .board-btns .edit-pill{background:var(--select-weak);border-color:transparent;color:var(--select)}.board-frame iframe{width:100%;height:100%;border:0;display:block;background:#fff}.board-placeholder,.board-missing{width:100%;height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;color:#5c5c58;background:#f7f6f3;word-break:keep-all}.board-missing{color:#b42318}.board-resize{position:absolute;border:solid var(--select);background:var(--panel);border-radius:2px;cursor:nwse-resize}.note{position:absolute;cursor:grab;-webkit-user-select:none;user-select:none}.note-title .note-text{font-size:72px;font-weight:700;line-height:1.1;letter-spacing:-.02em;white-space:pre-wrap;color:var(--text)}.note-sticky{background:var(--sticky);color:#111;padding:16px 20px;box-shadow:0 2px 6px #0000001f;display:flex;flex-direction:column}.note-sticky .note-text{flex:1;min-height:0;overflow:auto}.note-title{overflow:visible;width:max-content}.note-sticky .note-text{font-size:22px;line-height:1.45;white-space:pre-wrap}.note.selected{outline:3px solid var(--select);outline-offset:6px}.note-text[contenteditable=true]{cursor:text;-webkit-user-select:text;user-select:text;outline:none}.note-del{position:absolute;right:-16px;top:-16px;border-radius:16px;transform-origin:100% 0;background:var(--panel);border-color:var(--line)}.left{width:240px;flex:none;display:flex;flex-direction:column;background:var(--panel);border-right:1px solid var(--line);min-height:0}.left ul{list-style:none;margin:0;padding:0 4px}.left-pages{flex:none;max-height:40%;overflow-y:auto;padding-bottom:8px;border-bottom:1px solid var(--line)}.left-boards{flex:1;min-height:0;display:flex;flex-direction:column}.board-list{flex:1;overflow-y:auto;padding-bottom:8px!important}.sec-head{display:flex;align-items:center;justify-content:space-between;height:40px;padding:0 8px 0 12px;font-weight:600;font-size:12px;color:var(--muted)}.left .row{width:100%;height:32px;border:0;background:transparent;border-radius:var(--r-sm);padding:0 8px;gap:8px;text-align:left;color:var(--text)}.left .row:hover{background:var(--hover)}.left .row.on{background:var(--accent-weak);color:var(--accent);font-weight:600}.row-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.left .row.two-line{height:40px}.row.two-line .row-text{display:flex;flex-direction:column;line-height:1.25}.row-title,.row-file{overflow:hidden;text-overflow:ellipsis}.row-file{font-size:11px;color:var(--muted);font-weight:400}.left .row.on .row-file{color:var(--accent)}.row-count{color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums}.left .group-head{height:28px;margin-top:4px;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}.left .group-head:hover{background:var(--hover)}.left .group-head .chev{transition:transform .12s;flex:none}.left .group-more{opacity:0;flex:none}.left .group-head:hover .group-more,.left .group-more:focus-visible{opacity:1}.left .group.open .group-head .chev{transform:rotate(90deg)}.warn-icon{color:var(--warn);flex:none}.search{display:flex;align-items:center;gap:8px;margin:0 8px 8px;padding:0 8px;height:32px;border:1px solid var(--line);border-radius:var(--r);color:var(--muted);background:var(--panel-2)}.search:focus-within{border-color:var(--accent)}.search input{flex:1;min-width:0;border:0;background:transparent;height:30px;padding:0;outline:none;color:var(--text)}.left .empty{margin:0;padding:4px 12px 12px;color:var(--muted);font-size:12px;word-break:keep-all}.minimap{position:absolute;left:12px;bottom:12px;width:200px;height:130px;background:var(--panel);border-radius:var(--r);box-shadow:var(--shadow-2);cursor:pointer;overflow:hidden;z-index:6}.minimap svg{display:block}.mm-board{fill:var(--line-strong)}.minimap.many .mm-board{opacity:.35}.mm-sel{fill:var(--select)}.mm-view{fill:color-mix(in srgb,var(--select) 10%,transparent);stroke:var(--select);stroke-width:1.5}.right{width:340px;flex:none;display:flex;flex-direction:column;min-height:0;background:var(--panel);border-left:1px solid var(--line)}.right-tabs{display:flex;gap:4px;padding:8px 8px 0;border-bottom:1px solid var(--line);flex:none}.right-tabs button{height:32px;border:0;border-radius:var(--r-sm) var(--r-sm) 0 0;background:transparent;color:var(--muted);font-weight:600;box-shadow:inset 0 -2px 0 transparent}.right-tabs button.on{color:var(--text);box-shadow:inset 0 -2px 0 var(--accent);background:transparent}.right-tabs kbd{margin-left:4px}.inspector{flex:1;min-height:0;overflow-y:auto;padding:12px 16px}.inspector section{padding-bottom:16px;margin-bottom:16px;border-bottom:1px solid var(--line);display:flex;flex-direction:column;gap:8px}.inspector h3{margin:0;font-size:13px;word-break:break-all}.inspector .muted{margin:0}.inspector .small{font-size:11px;word-break:break-all}.inspector .warn{margin:0;white-space:normal}.inspector textarea{width:100%;min-height:56px;resize:vertical;border:1px solid var(--line-strong);border-radius:var(--r-sm);padding:8px;background:var(--panel)}.inspector .sec-head{padding:0;height:24px}.agent-pick{display:inline-flex;align-items:center;gap:6px}.agent-name{font-weight:600}.icon-btn.sm.new-chat{width:auto;padding:0 8px;gap:4px;font-size:12px;white-space:nowrap}.shot-link{margin-left:auto;color:var(--muted)}.inspector section.collapsible{gap:0;padding-bottom:8px;margin-bottom:8px}.collapsible-head{display:flex;align-items:center;min-height:32px}.collapsible-toggle{flex:1;min-width:0;height:32px;padding:0 4px 0 0;margin:0 0 0 -4px;border-color:transparent;background:transparent;justify-content:flex-start;gap:6px;font-weight:600;font-size:13px;color:var(--text)}.collapsible-toggle:hover:not(:disabled){background:var(--hover);border-color:transparent}.collapsible-toggle .chev{color:var(--muted);transition:transform .12s;flex:none;margin-left:4px}.collapsible.open .collapsible-toggle .chev{transform:rotate(90deg)}.collapsible-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.collapsible-count{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--panel-2);border:1px solid var(--line);color:var(--muted);font-size:11px;font-weight:600;display:inline-flex;align-items:center;justify-content:center}.collapsible-body{display:flex;flex-direction:column;gap:8px;padding-top:4px}.collapsible-body>section.board-opts{padding-bottom:0;margin-bottom:0;border-bottom:0}.collapsible-body>section.board-opts>.sec-head>span:first-child{display:none}.collapsible-body>section.board-opts>.sec-head{height:auto;min-height:0;justify-content:flex-end}.sel-name{font-size:13px}.sel-label{color:var(--muted)}.sel-tech{font-size:11px;color:var(--muted);word-break:break-all}.sel-tech code{font-size:11px}.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.sel{display:flex;flex-direction:column;gap:8px}.sel code{background:var(--panel-2);padding:1px 4px;border-radius:var(--r-sm)}.sel-text{color:var(--muted)}.comments{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}.comments li{display:flex;flex-direction:column;gap:2px}.comments li.resolved{opacity:.55}.c-head{display:flex;gap:8px;align-items:baseline}button.link{border:0;background:none;padding:0;height:auto;color:var(--accent);cursor:pointer;align-self:flex-start}button.link:hover:not(:disabled){background:none;text-decoration:underline}.board-opts .title-btn{height:auto;min-height:32px;justify-content:space-between;border-color:transparent;background:transparent;padding:4px 8px;margin:0 -8px;text-align:left;font-size:15px}.board-opts .title-btn strong{overflow-wrap:anywhere}.board-opts .file-btn{font-size:12px;color:var(--muted)}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}.num{display:flex;align-items:center;height:28px;border:1px solid var(--line);border-radius:var(--r-sm);overflow:hidden;background:var(--panel)}.num:focus-within{border-color:var(--accent)}.num span{width:44px;flex:none;padding-left:8px;color:var(--muted);font-size:12px}.num input{flex:1;min-width:0;border:0;height:26px;outline:none;background:transparent;font-variant-numeric:tabular-nums;padding:0 8px 0 0}.check{display:flex;align-items:center;gap:8px;min-height:28px;cursor:pointer}.check input{width:16px;height:16px;accent-color:var(--accent);margin:0}.field-row{display:grid;grid-template-columns:56px 1fr;align-items:center;gap:8px;color:var(--muted)}.btn-row{display:flex;gap:4px}.btn-row .icon-btn{border-color:var(--line)}.board-opts .btn-row .icon-btn.danger{margin-left:auto}.props .field{display:grid;grid-template-columns:76px 1fr;align-items:center;gap:4px 8px}.props .field span:first-child{color:var(--muted)}.props .field input,.props .field select{width:100%;height:28px;border:1px solid var(--line);border-radius:var(--r-sm);padding:0 8px;background:var(--panel)}.swatches{grid-column:2;display:flex;gap:4px}.swatch{width:20px;height:20px;padding:0;border-radius:var(--r-sm);border:1px solid var(--line)}.swatch.on{outline:2px solid var(--accent);outline-offset:1px}.layer-tree,.layer-tree ul{list-style:none;margin:0;padding:0}.layer{display:flex;align-items:center;gap:4px;height:24px;border-radius:var(--r-sm);cursor:pointer;white-space:nowrap;overflow:hidden}.layer:hover{background:var(--hover)}.layer.on{background:var(--select-weak)}.layer.over{box-shadow:inset 0 2px 0 var(--select)}.layer code{font-size:12px}.layer .muted{font-size:11px}.layer-text{color:var(--muted);overflow:hidden;text-overflow:ellipsis;font-size:12px}.twisty{width:16px;height:16px;padding:0;border:0;background:none;font-size:10px;flex:none}.overlay{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none}.box{position:absolute;pointer-events:none}.box.hover{outline:1px solid var(--select);background:color-mix(in srgb,var(--select) 6%,transparent)}.box.sel{outline:2px solid var(--select)}.box.marquee-el{outline:1px solid var(--select);background:color-mix(in srgb,var(--select) 8%,transparent)}.pin{position:absolute;width:24px;height:24px;border-radius:12px 12px 12px 2px;background:var(--accent);color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;transform-origin:0 100%;box-shadow:0 1px 4px #0000004d}.play,.focus{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;background:#111111c7;display:flex;flex-direction:column;align-items:center}.play-bar,.focus-bar{width:100%;height:48px;flex:none;display:flex;align-items:center;gap:8px;padding:0 12px;background:var(--panel);border-bottom:1px solid var(--line)}.play-frame{flex:1;margin:16px 0;border:0;border-radius:var(--r-lg);background:#fff;box-shadow:var(--shadow-2)}.focus{background:var(--bg)}.focus-stage{flex:1;width:100%;min-height:0;display:flex;align-items:center;justify-content:center;padding:24px}.focus-stage.fill{padding:0}.focus-frame{overflow:hidden;background:#fff;box-shadow:var(--shadow-2);flex:none}.focus-frame iframe{border:0;display:block;background:#fff}.focus-fill{width:100%;height:100%;border:0;background:#fff}.menu{position:fixed;z-index:300;min-width:220px;padding:4px;background:var(--panel);border-radius:var(--r);box-shadow:var(--shadow-2);outline:none;display:flex;flex-direction:column}.menu-title{padding:8px 8px 4px;font-size:12px;color:var(--muted);max-width:280px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.menu-sep{height:1px;background:var(--line);margin:4px 0}.menu-item{height:32px;border:0;background:transparent;border-radius:var(--r-sm);padding:0 8px;gap:8px;text-align:left}.menu-item.active:not(:disabled),.menu-item:hover:not(:disabled){background:var(--hover)}.menu-item.danger{color:var(--warn)}.menu-icon{width:16px;display:inline-flex;color:var(--muted)}.menu-item.danger .menu-icon{color:var(--warn)}.menu-label{flex:1}.menu-item kbd{border:0;background:none;padding:0}.toasts{position:fixed;left:50%;bottom:24px;transform:translate(-50%);z-index:400;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}.toast{pointer-events:auto;display:flex;align-items:center;gap:8px;min-height:40px;padding:4px 4px 4px 16px;background:#111;color:#f3f3f0;border-radius:var(--r);box-shadow:var(--shadow-2);animation:toast-in .16s ease-out}.toast:not(:has(.toast-action)){padding-right:16px}.toast.ok svg{color:#7fd6a8}.toast.error{background:#7a1a10}.toast-action{height:32px;background:transparent;border-color:transparent;color:#ffb48a;font-weight:600}.toast-action:hover:not(:disabled){background:#ffffff1a;border-color:transparent}@keyframes toast-in{0%{opacity:0;transform:translateY(8px)}}.dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:350;background:#1116;display:flex;align-items:center;justify-content:center}.dialog{width:400px;max-width:calc(100vw - 32px);background:var(--panel);border-radius:var(--r-lg);box-shadow:var(--shadow-2);padding:20px;display:flex;flex-direction:column;gap:12px}.dialog h2{margin:0;font-size:16px}.dialog p{margin:0;color:var(--muted);word-break:keep-all}.dialog-field{display:flex;flex-direction:column;gap:4px;color:var(--muted);font-size:12px}.dialog-field input{height:36px;font-size:14px;color:var(--text);border-radius:var(--r)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.inspector-empty ul{margin:12px 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px;font-size:12px}.main{position:relative}@media(max-width:1000px){.left,.right{position:absolute;top:0;bottom:0;z-index:20;box-shadow:var(--shadow-2)}.left{left:0}.right{right:0;width:min(340px,calc(100vw - 48px))}.right:has(.inspector-empty){display:none}.drawer-backdrop{position:absolute;top:0;right:0;bottom:0;left:0;z-index:19;background:#00000040}.right-close{margin-left:auto;align-self:center}}@media(max-width:640px){.zoom,.tb-right .tool-group>[aria-label="Fit all"]{display:none}.app-title{max-width:120px}}@media(max-width:1000px),(max-height:640px){.minimap{transform:scale(.6);transform-origin:0 100%}.toolbar .warn{display:none}}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.small{font-size:12px}.new-board{height:32px;gap:4px;padding:0 8px;border-color:transparent;background:transparent;font-weight:600}.err-chip{height:32px;border-color:transparent;background:color-mix(in srgb,var(--warn) 12%,transparent);color:var(--warn);font-weight:600}.err-chip:hover:not(:disabled){background:color-mix(in srgb,var(--warn) 18%,transparent);border-color:transparent}button.danger{color:var(--warn)}.chat{flex:1;min-height:0;display:flex;flex-direction:column}.chat-head{display:flex;flex-direction:column;gap:4px;padding:8px 12px 4px;border-bottom:1px solid var(--line);flex:none;min-width:0}.chat-head-row{display:flex;align-items:center;gap:4px;min-width:0}.chat-head-row.sub{height:28px}.chat-head .new-chat{flex:none}.chat-head .agent-pick{position:relative;min-width:0;flex:none}.agent-btn{height:32px;padding:0 8px;gap:6px;font-weight:600;max-width:168px}.agent-btn .agent-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-btn svg{color:var(--muted);flex:none}.dot{width:8px;height:8px;border-radius:4px;flex:none;background:var(--line-strong)}.dot.ready{background:var(--ok)}.dot.signin,.dot.missing{background:var(--warn)}.agent-menu{position:absolute;top:36px;left:0;width:280px}.agent-status{margin-left:auto;display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}.agent-status.ready{color:var(--ok);font-weight:600}.agent-status.signin,.agent-status.missing{color:var(--warn);font-weight:600}.menu-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:4px;padding:8px 8px 4px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}.menu-foot button.link{font-size:12px;align-self:center}.model-field{flex:1;min-width:0;height:32px;padding:0 8px;border:1px solid var(--line);border-radius:var(--r);background:var(--panel);font-size:12px}.model-field:focus{border-color:var(--accent);outline:none}.chat-list{flex:1;min-height:0;overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:16px}.chat-empty{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center;color:var(--muted);padding:24px 8px;word-break:keep-all}.chat-empty p{margin:0;line-height:1.6}.chat-suggest{display:flex;flex-direction:column;gap:8px;width:100%}.chat-suggest button{justify-content:flex-start;height:auto;min-height:32px;padding:8px 12px;text-align:left;color:var(--text)}.msg{display:flex;flex-direction:column;gap:8px}.msg.user{align-items:flex-end}.msg .bubble{max-width:90%;padding:8px 12px;border-radius:var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg);background:var(--accent-weak);color:var(--text);white-space:pre-wrap;word-break:break-word}.msg-head{display:flex;align-items:center;gap:8px}.ai-text{white-space:pre-wrap;line-height:1.6;word-break:break-word}.ai-tool{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--muted);padding:4px 8px;border-radius:var(--r-sm);background:var(--panel-2);min-width:0}.ai-tool code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ai-error{display:flex;gap:4px;align-items:flex-start;color:var(--warn);white-space:pre-wrap;font-size:12px}.ai-error svg{flex:none;margin-top:1px}.ai-error code,.remedy code{color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:var(--r-sm);padding:0 4px;white-space:nowrap}.ai-fail{display:flex;flex-direction:column;gap:8px}.ai-fail .ai-error{font-size:13px;line-height:1.5}.ai-details{font-size:12px}.ai-details summary{cursor:pointer;color:var(--muted);width:max-content}.ai-details-bar{display:flex;justify-content:flex-end;padding:4px 0}.ai-details pre{margin:0;padding:8px;max-height:200px;overflow:auto;border-radius:var(--r-sm);background:var(--panel-2);border:1px solid var(--line);font-size:11px;white-space:pre-wrap;word-break:break-word}.ai-fail>.muted.small{margin:0}.remedy{flex:none;margin:0 12px 8px;padding:8px 12px;border-radius:var(--r);background:color-mix(in srgb,var(--warn) 8%,var(--panel));border:1px solid color-mix(in srgb,var(--warn) 35%,var(--line));display:flex;gap:8px;align-items:flex-start}.remedy>svg{color:var(--warn);flex:none;margin-top:2px}.remedy p{margin:0 0 8px;font-size:12px;line-height:1.5}.remedy .btn-row button,.ai-fail .btn-row button{height:28px;padding:0 10px;font-size:12px}.send-why{display:flex;align-items:center;justify-content:flex-end;gap:4px;margin:0;color:var(--warn);font-size:12px;font-weight:600}.send-why svg{flex:none}.restored{font-size:11px}.chips{display:flex;flex-wrap:wrap;gap:4px}.chip{display:inline-flex;align-items:center;max-width:100%;height:24px;border-radius:12px;background:var(--panel-2);border:1px solid var(--line);font-size:12px;overflow:hidden}.msg .chip{padding:0 8px}.chip.off{opacity:.55;text-decoration:line-through}.chip-main{height:22px;border:0;background:transparent;padding:0 8px;gap:4px;font-size:12px;min-width:0}.chip-main span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}.chip-main:disabled{opacity:1;cursor:default}.chip-x{width:22px;height:22px;padding:0;border:0;background:transparent;justify-content:center}.composer{flex:none;border-top:1px solid var(--line);padding:8px 12px 12px;display:flex;flex-direction:column;gap:8px}.composer textarea{width:100%;resize:none;border:1px solid var(--line-strong);border-radius:var(--r);padding:8px 12px;background:var(--panel);line-height:1.5}.composer textarea:focus{border-color:var(--accent);outline:none}.composer-bar{display:flex;align-items:center;gap:4px}.url-row input{width:100%;height:32px}.variants select{height:28px}.chat-wrap{flex:1;min-height:0;display:flex;flex-direction:column}.chat-wrap[hidden]{display:none}.el-move{position:absolute;width:24px;height:20px;padding:0;justify-content:center;border-radius:var(--r-sm) var(--r-sm) 0 0;border:0;background:var(--select);color:#fff;transform-origin:0 100%;pointer-events:auto;cursor:grab}.el-move:hover:not(:disabled){background:var(--select);filter:brightness(.94)}.el-resize{position:absolute;background:var(--panel);border:solid var(--select);border-radius:2px;pointer-events:auto}.el-resize.e{cursor:ew-resize}.el-resize.s{cursor:ns-resize}.el-resize.se{cursor:nwse-resize}.drag-ghost{position:absolute;outline:2px dashed var(--select);background:color-mix(in srgb,var(--select) 8%,transparent);pointer-events:none}.drop-line{position:absolute;background:var(--select);pointer-events:none;border-radius:1px}.align-row{display:flex;gap:2px}.align-row .icon-btn{border-color:var(--line);width:32px;height:32px}.left-tabs{display:flex;gap:4px;padding:8px 8px 0;border-bottom:1px solid var(--line);flex:none}.left-tabs button{height:32px;border:0;border-radius:var(--r-sm) var(--r-sm) 0 0;background:transparent;color:var(--muted);font-weight:600}.left-tabs button.on{color:var(--text);box-shadow:inset 0 -2px 0 var(--accent)}.assets{flex:1;min-height:0;overflow-y:auto;padding:8px;display:flex;flex-direction:column;gap:8px;border-radius:var(--r)}.assets.over{outline:2px dashed var(--accent);outline-offset:-4px}.upload{display:flex;align-items:center;justify-content:center;gap:4px;min-height:40px;border:1px dashed var(--line-strong);border-radius:var(--r);color:var(--muted);cursor:pointer;font-size:12px;padding:4px 8px;text-align:center}.upload:hover{background:var(--hover)}.asset-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}.asset{width:100%;height:auto;padding:4px;flex-direction:column;align-items:stretch;gap:4px;border-radius:var(--r)}.asset img,.asset-font{width:100%;aspect-ratio:1;object-fit:cover;border-radius:var(--r-sm);background:var(--panel-2);display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700}.asset-name{font-size:11px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.dialog.wide{width:640px;max-height:calc(100vh - 64px)}.dialog.wide .assets{max-height:60vh}.left .assets .empty{padding:4px}.shape{position:absolute;cursor:grab}.shape.selected{outline:2px solid var(--select);outline-offset:4px}.shape-resize,.note-resize{position:absolute;border:solid var(--select);background:var(--panel);border-radius:2px;cursor:nwse-resize}.shape-drawer{position:absolute;top:0;right:0;bottom:0;left:0;z-index:8;cursor:crosshair;touch-action:none}.swatch.none{background:linear-gradient(135deg,transparent 45%,var(--warn) 45%,var(--warn) 55%,transparent 55%),var(--panel)}.layout-guides{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:2}.lg-track{position:absolute}.lg-grid{position:absolute;top:0;right:0;bottom:0;left:0}.guide-row{display:flex;flex-direction:column;gap:8px;padding:8px;border:1px solid var(--line);border-radius:var(--r)}.guide-head{display:flex;align-items:center;gap:8px}.guide-head input[type=color]{width:24px;height:24px;padding:0;border:1px solid var(--line);border-radius:var(--r-sm);background:none}.span2{grid-column:1 / -1}.left .row[draggable=true]{cursor:grab}.left .row.drop-before{box-shadow:inset 0 2px 0 var(--select)}.right[hidden]{display:none}.tokens{flex:1;min-height:0;overflow-y:auto;padding:0 12px 16px;display:flex;flex-direction:column;gap:8px}.tokens .sec-head{padding:0}.theme-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}.theme-row select,.theme-row input{width:100%;min-width:0}.tok-colors{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.tok-colors li{display:grid;grid-template-columns:28px 1fr auto 24px;gap:8px;align-items:center}.tok-colors input[type=color]{width:28px;height:28px;padding:0;border:1px solid var(--line);border-radius:var(--r-sm);background:none}.tok-colors input:not([type]){min-width:0}.tok-colors code{font-size:11px;color:var(--muted)}.tok-list{grid-template-columns:72px 1fr}.tok-list input{min-width:0;width:100%}.check-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.check-item{width:100%;height:auto;min-height:32px;padding:4px 8px;border:0;background:transparent;gap:8px;text-align:left;align-items:flex-start;color:var(--text);font-size:12px}.check-item svg{color:var(--warn);flex:none;margin-top:2px}.check-item span{flex:1;min-width:0}.check-item code{color:var(--muted);font-size:11px;flex:none}.ok-line{display:flex;align-items:center;gap:4px;margin:0;color:var(--ok);font-size:12px}.tc-off{display:flex;gap:8px;align-items:flex-start;padding:8px;border-radius:var(--r);background:var(--panel-2);border:1px solid var(--line);font-size:12px}.tc-off svg{color:var(--muted);flex:none;margin-top:1px}.tc-off strong{display:block;font-weight:600}.inspector .tc-off p{margin:4px 0 0;word-break:normal}.tw-num{display:flex;gap:8px;align-items:center}.tw-num input{flex:1}.tok-warn{color:var(--warn);cursor:help}.ratio{grid-column:2;font-size:11px;font-weight:600}.ratio.ok{color:var(--ok)}.ratio.mid{color:#9a6700}.ratio.bad{color:var(--warn)}.chips-row{grid-column:2;display:flex;flex-wrap:wrap;gap:4px}.tchip{height:24px;min-width:32px;padding:0 6px;font-size:11px;justify-content:center;border-radius:12px}.tchip.on{background:var(--accent-weak);color:var(--accent);border-color:var(--accent)}.replies{list-style:none;margin:4px 0 0 12px;padding:0 0 0 8px;border-left:2px solid var(--line);display:flex;flex-direction:column;gap:8px}.reply-box{display:flex;flex-direction:column;gap:4px;margin-top:4px}.theme-pick select{height:32px;max-width:160px}.board-placeholder{position:relative;overflow:hidden}.board-placeholder span{position:relative}.board-thumb{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:cover;object-position:top;opacity:0;transition:opacity .16s}.board-thumb.loaded{opacity:1}.board-thumb.loaded+span{display:none}.board-placeholder.loading{background:linear-gradient(180deg,#f7f6f3,#efede8)}.board-placeholder.far{background:repeating-linear-gradient(135deg,#f7f6f3 0,#f7f6f3 14px,#efede8 14px,#efede8 16px);color:#8a8982}.board-placeholder.far .ph-title:after{content:attr(data-hint);display:block;font-size:.75em;font-weight:400;margin-top:.4em}.ph-bar{position:absolute;left:0;bottom:0;width:100%;background:var(--accent-weak);overflow:hidden}.ph-bar:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;width:35%;background:var(--accent);animation:ph-slide 1.2s ease-in-out infinite}.board-thumb.loaded~.ph-bar{display:none}@keyframes ph-slide{0%{transform:translate(-100%)}to{transform:translate(300%)}}@media(prefers-reduced-motion:reduce){.ph-bar:after{animation:none;width:100%;opacity:.4}}.board.playing .board-frame{box-shadow:0 0 0 4px var(--ok)}.playing-badge{position:absolute;right:8px;top:8px;transform-origin:100% 0;background:var(--ok);color:#fff;font-size:12px;font-weight:700;padding:4px 8px;border-radius:12px;pointer-events:none}.layer-tree:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:var(--r-sm)}.layer-tree:focus .layer.kbd-focus{box-shadow:inset 0 0 0 1px var(--select)}.num span{width:auto;min-width:44px;padding-right:8px;white-space:nowrap}.guides-editor .sec-head .icon-btn.sm{width:auto;padding:0 6px;white-space:nowrap}.guides-editor .sec-head{gap:8px}.new-board{white-space:nowrap}.ask-ai{height:32px;padding:0 12px;gap:6px;border-radius:16px;border-color:transparent;background:var(--accent);color:var(--accent-text);font-weight:600;white-space:nowrap}.ask-ai:hover:not(:disabled){background:var(--accent);filter:brightness(.94);border-color:transparent}.ask-ai.on{background:var(--accent-weak);color:var(--accent)}.ask-ai.on:hover:not(:disabled){background:var(--accent-weak);filter:none}.ask-ai-label{white-space:nowrap}@media(max-width:760px){.ask-ai-label{display:none}.ask-ai{width:32px;padding:0;border-radius:16px}}.ask-ai-cta{align-self:flex-start;gap:6px;margin:8px 0 16px}.empty-lead{margin:0 0 8px;font-size:14px;font-weight:600;color:var(--text)}.first-run{position:absolute;left:50%;top:44px;transform:translate(-50%);z-index:30;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;gap:6px 20px;max-width:calc(100% - 32px);padding:10px 16px;border-radius:var(--r-lg);background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow-2);pointer-events:none;opacity:1}@keyframes hint-in{0%{opacity:0;transform:translate(-50%,-6px)}}.first-run{animation:hint-in .2s ease-out}.first-run-line{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text)}.first-run-line svg{color:var(--accent)}@media(max-width:1000px){.first-run{z-index:15}}
package/dist/index.html CHANGED
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Easel</title>
7
7
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css" />
8
- <script type="module" crossorigin src="/_app/assets/index-O7RiYHEC.js"></script>
9
- <link rel="stylesheet" crossorigin href="/_app/assets/index-DbJY7lxA.css">
8
+ <script type="module" crossorigin src="/_app/assets/index-DXUYTbPc.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/_app/assets/index-lfQlW-DC.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easel-canvas",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Easel: an HTML design canvas for AI agents. Shows screens/*.html as boards and edits the source directly, with Claude Code / Codex via MCP",
5
5
  "license": "MIT",
6
6
  "author": "Hyun Park",
package/server/board.mjs CHANGED
@@ -4,16 +4,32 @@ import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
5
 
6
6
  import { formatBoard } from "./boardFormat.mjs";
7
- import { writeAtomic } from "./fsutil.mjs";
7
+ import { htmlTitle, projectName, writeAtomic } from "./fsutil.mjs";
8
8
 
9
9
  const DEFAULT_SIZE = { w: 390, h: 844 };
10
10
  const GAP_X = 80;
11
11
  const GAP_Y = 120;
12
12
 
13
+ /**
14
+ * order lists each board exactly once: duplicates and names missing from boards are dropped, boards missing from order
15
+ * are appended. Hand edits and agents writing board.json can leave a file twice, which renders two boards with one key.
16
+ * The next save writes the cleaned list back.
17
+ */
18
+ export function normalizeOrder(order, boards) {
19
+ const out = [...new Set((Array.isArray(order) ? order : []).filter((f) => typeof f === "string" && Object.hasOwn(boards, f)))];
20
+ const seen = new Set(out);
21
+ for (const f of Object.keys(boards)) if (!seen.has(f)) out.push(f);
22
+ return out;
23
+ }
24
+
13
25
  export function createBoardStore(dir) {
14
26
  const boardPath = path.join(dir, "board.json");
15
27
  const screensDir = path.join(dir, "screens");
16
28
 
29
+ // Canvas name: the project folder. Older versions stored the design folder's name ("design") as the title, so that counts as unset
30
+ const name = projectName(dir);
31
+ const titleOf = (t) => (!t || (t === path.basename(dir) && t !== name) ? name : t);
32
+
17
33
  async function readBoard() {
18
34
  try {
19
35
  const raw = await fs.readFile(boardPath, "utf8");
@@ -21,14 +37,14 @@ export function createBoardStore(dir) {
21
37
  return {
22
38
  ...b,
23
39
  version: 1,
24
- title: b.title ?? path.basename(dir),
40
+ title: titleOf(b.title),
25
41
  pages: b.pages ?? [],
26
42
  boards: b.boards ?? {},
27
- order: b.order ?? Object.keys(b.boards ?? {}),
43
+ order: normalizeOrder(b.order, b.boards ?? {}),
28
44
  notes: b.notes ?? {},
29
45
  };
30
46
  } catch (e) {
31
- if (e.code === "ENOENT") return { version: 1, title: path.basename(dir), pages: [], boards: {}, order: [], notes: {} };
47
+ if (e.code === "ENOENT") return { version: 1, title: name, pages: [], boards: {}, order: [], notes: {} };
32
48
  throw e;
33
49
  }
34
50
  }
@@ -65,17 +81,13 @@ export function createBoardStore(dir) {
65
81
  return out.sort();
66
82
  }
67
83
 
68
- /** <meta name="board-size" content="390x844"> → {w,h} */
69
- async function readBoardSize(file) {
70
- try {
71
- const html = await fs.readFile(path.join(screensDir, file), "utf8");
72
- const m = html.match(/<meta\s+name=["']board-size["']\s+content=["'](\d+)\s*[x×]\s*(\d+)["']/i);
73
- if (m) return { w: Number(m[1]), h: Number(m[2]) };
74
- } catch {
75
- /* unreadable: use the default size */
76
- }
77
- return { ...DEFAULT_SIZE };
84
+ /** <meta name="board-size" content="390x844"> → {w,h}, plus the file's <title> (null when missing) */
85
+ async function readBoardInfo(file) {
86
+ const html = await fs.readFile(path.join(screensDir, file), "utf8").catch(() => ""); // unreadable: default size, no title
87
+ const m = html.match(/<meta\s+name=["']board-size["']\s+content=["'](\d+)\s*[x×]\s*(\d+)["']/i);
88
+ return { size: m ? { w: Number(m[1]), h: Number(m[2]) } : { ...DEFAULT_SIZE }, title: htmlTitle(html) };
78
89
  }
90
+ const readBoardSize = async (file) => (await readBoardInfo(file)).size;
79
91
 
80
92
  /** Row for new screens: right of the last auto-placed board, otherwise below everything + 120 */
81
93
  function placeNew(board, size) {
@@ -109,9 +121,9 @@ export function createBoardStore(dir) {
109
121
  let changed = false;
110
122
  for (const f of files) {
111
123
  if (board.boards[f]) continue;
112
- const size = await readBoardSize(f);
113
- board.boards[f] = { ...placeNew(board, size), title: f.replace(/\.html$/, ""), autoPlaced: true };
114
- board.order.push(f);
124
+ const { size, title } = await readBoardInfo(f);
125
+ board.boards[f] = { ...placeNew(board, size), title: title ?? f.replace(/\.html$/, ""), autoPlaced: true };
126
+ if (!board.order.includes(f)) board.order.push(f);
115
127
  changed = true;
116
128
  }
117
129
  if (changed) await writeBoard(board);
package/server/boards.mjs CHANGED
@@ -10,8 +10,8 @@ import { readBody, safeJoin, sendJson } from "./index.mjs";
10
10
  const read = (p) => fs.readFile(p, "utf8").catch(() => null);
11
11
  const FILE_RE = /^[a-z0-9][a-z0-9._-]*\.html$/i;
12
12
 
13
- const FONT = `@font-face{font-family:"Pretendard Variable";font-weight:45 920;font-style:normal;font-display:swap;src:url(https://cdn.jsdelivr.net/npm/pretendard@1.3.9/dist/web/variable/woff2/PretendardVariable.woff2) format("woff2-variations")}
14
- body{margin:0;color-scheme:light;font-family:"Pretendard Variable",Pretendard,-apple-system,"Apple SD Gothic Neo","Noto Sans KR",sans-serif;color:#111111;background:#FFFFFF;-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums}`;
13
+ // System font stack only: no web font download, nothing language- or brand-specific
14
+ const BASE_CSS = `body{margin:0;color-scheme:light;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#111111;background:#FFFFFF;-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums}`;
15
15
 
16
16
  /** New board templates. The size is written both in the board-size meta and on the outermost div */
17
17
  export const TEMPLATES = {
@@ -21,9 +21,10 @@ export const TEMPLATES = {
21
21
  doc: { label: "Document", w: 800, h: 1000 },
22
22
  };
23
23
 
24
- export function newBoardHtml({ title, w, h, template = "blank" }) {
24
+ export function newBoardHtml({ title, w, h, template = "blank", brand = "" }) {
25
25
  const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;");
26
26
  const t = esc(title);
27
+ const name = esc(brand || "Title");
27
28
  const bodies = {
28
29
  blank: `<div style="width:${w}px;min-height:${h}px;box-sizing:border-box;padding:20px;display:flex;flex-direction:column;gap:16px">
29
30
  </div>`,
@@ -41,7 +42,7 @@ export function newBoardHtml({ title, w, h, template = "blank" }) {
41
42
  </div>`,
42
43
  desktop: `<div style="width:${w}px;min-height:${h}px;box-sizing:border-box;background:#FFFFFF;display:flex;flex-direction:column">
43
44
  <header style="height:64px;display:flex;align-items:center;gap:24px;padding:0 40px;border-bottom:1px solid #E8E8E6;flex:none">
44
- <strong style="font-size:20px">farmclub</strong>
45
+ <strong style="font-size:20px">${name}</strong>
45
46
  </header>
46
47
  <main style="flex:1;max-width:1120px;width:100%;margin:0 auto;padding:40px;box-sizing:border-box;display:flex;flex-direction:column;gap:24px">
47
48
  <h1 style="margin:0;font-size:40px;font-weight:700;letter-spacing:-0.02em">${t}</h1>
@@ -53,14 +54,14 @@ export function newBoardHtml({ title, w, h, template = "blank" }) {
53
54
  </div>`,
54
55
  };
55
56
  return `<!doctype html>
56
- <html lang="ko">
57
+ <html lang="en">
57
58
  <head>
58
59
  <meta charset="utf-8">
59
60
  <meta name="viewport" content="width=device-width, initial-scale=1">
60
61
  <meta name="board-size" content="${w}x${h}">
61
62
  <title>${t}</title>
62
63
  <style>
63
- ${FONT}
64
+ ${BASE_CSS}
64
65
  </style>
65
66
  </head>
66
67
  <body>
@@ -177,7 +178,7 @@ export function boardRoutes() {
177
178
  const h = Math.max(40, Math.min(8000, Math.round(b.h ?? TEMPLATES[tpl].h)));
178
179
  const wanted = b.file && FILE_RE.test(b.file) ? b.file : `${tpl === "blank" ? "board" : tpl}.html`;
179
180
  const title = b.title || (tpl === "blank" ? wanted.replace(/\.html$/, "") : TEMPLATES[tpl].label);
180
- const html = b.html ?? newBoardHtml({ title, w, h, template: tpl });
181
+ const html = b.html ?? newBoardHtml({ title, w, h, template: tpl, brand: (await ctx.store.readBoard()).title });
181
182
  const [file] = await createBoards(ctx, [{ file: wanted, html, x: b.x, y: b.y, w, h, title, page: b.page }], `Create board ${wanted}`);
182
183
  sendJson(res, 200, { file });
183
184
  },
package/server/chat.mjs CHANGED
@@ -6,23 +6,99 @@ import fs from "node:fs/promises";
6
6
  import path from "node:path";
7
7
 
8
8
  import { createBoards } from "./boards.mjs";
9
+ import { rootOf } from "./fsutil.mjs";
9
10
  import { readBody, sendJson } from "./index.mjs";
10
- import { readTokens } from "./tokens.mjs";
11
+ import { NO_TOKENS_NOTE, readTokens } from "./tokens.mjs";
12
+
13
+ export const AGENT_LABEL = { claude: "Claude Code", codex: "Codex" };
14
+ const LOGIN_CMD = { claude: "claude auth login", codex: "codex login" };
15
+ const fakeAgents = () => (process.env.DESIGN_CANVAS_AGENT_CMD ? JSON.parse(process.env.DESIGN_CANVAS_AGENT_CMD) : {});
16
+
17
+ /** Model names passed to --model / -m: aliases or full ids only (they reach a shell on Windows) */
18
+ export const validModel = (m) => (typeof m === "string" && /^[\w.:/[\]-]{1,100}$/.test(m.trim()) ? m.trim() : "");
11
19
 
12
20
  /** Agent launch command. Tests override it with DESIGN_CANVAS_AGENT_CMD='{"claude":["node","fake.mjs"]}' */
13
- function agentCommand(agent, { prompt, resume, root, images }) {
14
- const override = process.env.DESIGN_CANVAS_AGENT_CMD ? JSON.parse(process.env.DESIGN_CANVAS_AGENT_CMD)[agent] : null;
21
+ export function agentCommand(agent, { prompt, resume, root, images = [], model = "" }) {
22
+ const override = fakeAgents()[agent];
15
23
  if (override) return { cmd: override[0], args: [...override.slice(1), prompt] };
16
24
  if (agent === "codex") {
17
- const common = ["--json", "--skip-git-repo-check", "-s", "workspace-write", ...images.flatMap((i) => ["-i", i])];
25
+ const common = ["--json", "--skip-git-repo-check", "-s", "workspace-write", ...(model ? ["-m", model] : []), ...images.flatMap((i) => ["-i", i])];
18
26
  return resume ? { cmd: "codex", args: ["exec", "resume", resume, ...common, prompt] } : { cmd: "codex", args: ["exec", ...common, "-C", root, prompt] };
19
27
  }
20
28
  return {
21
29
  cmd: "claude",
22
- args: ["-p", prompt, "--output-format", "stream-json", "--verbose", "--include-partial-messages", "--permission-mode", "acceptEdits", "--allowedTools", "mcp__easel", "mcp__design-canvas", ...(resume ? ["--resume", resume] : [])],
30
+ args: ["-p", prompt, "--output-format", "stream-json", "--verbose", "--include-partial-messages", "--permission-mode", "acceptEdits", "--allowedTools", "mcp__easel", "mcp__design-canvas", ...(model ? ["--model", model] : []), ...(resume ? ["--resume", resume] : [])],
23
31
  };
24
32
  }
25
33
 
34
+ /** Runs a short command; null when it cannot start or takes longer than ms */
35
+ function runQuick(cmd, args, ms = 5000) {
36
+ return new Promise((resolve) => {
37
+ const win = process.platform === "win32";
38
+ let out = "";
39
+ let p;
40
+ try {
41
+ p = spawn(cmd, win ? args.map(winQuote) : args, { shell: win, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
42
+ } catch {
43
+ return resolve(null);
44
+ }
45
+ const done = (v) => {
46
+ clearTimeout(t);
47
+ resolve(v);
48
+ };
49
+ const t = setTimeout(() => {
50
+ p.kill();
51
+ done(null);
52
+ }, ms);
53
+ p.stdout.on("data", (d) => (out += d));
54
+ p.stderr.on("data", (d) => (out += d));
55
+ p.on("error", () => done(null));
56
+ p.on("close", (code) => done({ code, out }));
57
+ });
58
+ }
59
+
60
+ /** Output of `claude auth status` / `codex login status` → ready | signin | unknown */
61
+ export function readiness(agent, r) {
62
+ if (!r) return "unknown";
63
+ if (agent === "codex") return r.code === 0 && /Logged in/.test(r.out) ? "ready" : "signin";
64
+ try {
65
+ const j = JSON.parse(r.out.slice(r.out.indexOf("{"), r.out.lastIndexOf("}") + 1));
66
+ return j.loggedIn === true ? "ready" : j.loggedIn === false ? "signin" : "unknown";
67
+ } catch {
68
+ return "unknown";
69
+ }
70
+ }
71
+
72
+ const which = (c) => new Promise((r) => spawn(process.platform === "win32" ? "where" : "which", [c], { windowsHide: true }).on("close", (code) => r(code === 0)).on("error", () => r(false)));
73
+
74
+ /** Whether an agent can run now: missing (not on PATH), signin, ready, unknown (status check failed or timed out) */
75
+ export async function agentStatus(agent) {
76
+ if (fakeAgents()[agent]) return "ready";
77
+ if (!(await which(agent))) return "missing";
78
+ return readiness(agent, await runQuick(agent, agent === "codex" ? ["login", "status"] : ["auth", "status"]));
79
+ }
80
+
81
+ /** Known causes of a failed run → { cause, text }: one plain sentence with the next step. The raw output goes under Details */
82
+ export function classifyFailure({ agent, cmd = agent, text = "", code = null, signal = null, enoent = false, model = "" }) {
83
+ const label = AGENT_LABEL[agent] ?? agent;
84
+ const t = String(text ?? "");
85
+ if (enoent || /command not found|is not recognized as an internal or external command/i.test(t)) return { cause: "missing", text: `${cmd} command not found. Install it, then Check again.` };
86
+ if (/usage limit|usage_limit_reached|rate limit/i.test(t)) {
87
+ const at = /try again at\s+(.+?)(?:\.(?=\s|"|$)|"|\n|$)/i.exec(t)?.[1]?.trim();
88
+ return { cause: "limit", text: `${label} hit its usage limit. Try again ${at ? `after ${at}` : "later"}, or switch agent.` };
89
+ }
90
+ if (/model/i.test(t) && /not supported|not found|unknown|invalid|does not exist|not available/i.test(t)) {
91
+ const name = model || /model\W{0,3}["'`]([^"'`\s]+)["'`]/i.exec(t)?.[1] || "";
92
+ return { cause: "model", text: `${name ? `Model "${name}"` : "This model"} is not available to this account. Pick another model, or the CLI default.` };
93
+ }
94
+ if (/not logged in|please run \/login|authenticat|\blog ?in\b/i.test(t)) return { cause: "signin", text: `${label} is not signed in. Run \`${LOGIN_CMD[agent] ?? `${cmd} login`}\`, then Retry.` };
95
+ if ((code != null && code !== 0) || signal) return { cause: "crash", text: `${label} stopped unexpectedly (exit ${code ?? signal}). Retry; if it repeats, copy Details into an issue.` };
96
+ return { cause: "other", text: t.trim().split("\n")[0] || "Failed" };
97
+ }
98
+
99
+ /** Tools that only read (anything else may have changed files) */
100
+ const READ_ONLY = /^(Read|Glob|Grep|LS|WebFetch|WebSearch|TodoWrite|Task|ToolSearch)$|(^|__)(list_|read_|get_|check_|screenshot)/;
101
+
26
102
  const short = (v, n = 120) => {
27
103
  const s = typeof v === "string" ? v : JSON.stringify(v ?? "");
28
104
  return s.length > n ? s.slice(0, n) + "…" : s;
@@ -68,9 +144,6 @@ export function parseLine(agent, line, st) {
68
144
  /** Windows shell argument: wrap in double quotes and double any inner double quotes */
69
145
  export const winQuote = (a) => (/^[\w./:=-]+$/.test(a) ? a : `"${String(a).replace(/"/g, '""')}"`);
70
146
 
71
- /** Repo root: two levels up for docs/design, otherwise (temp folders in tests) the folder itself */
72
- const rootOf = (dir) => (dir.endsWith(path.join("docs", "design")) ? path.resolve(dir, "../..") : dir);
73
-
74
147
  /** Context block */
75
148
  export async function buildPrompt(ctx, body, state) {
76
149
  const { board } = await ctx.store.syncBoard();
@@ -107,10 +180,10 @@ export async function buildPrompt(ctx, body, state) {
107
180
  if (body.variants?.files?.length) {
108
181
  lines.push(`- Make ${body.variants.files.length} distinct variants of "${body.variants.base}". Copies have already been created side by side: ${body.variants.files.map((f) => `${rel0 ? rel0 + "/" : ""}screens/${f}`).join(", ")}. Take each file in a different direction, and use place_board to retitle each one like "Variant 1: summary". Do not modify the original.`);
109
182
  }
110
- // Design tokens from the design folder (tokens.json, or the built-in defaults)
183
+ // Design tokens from tokens.json. Without one the AI gets no default palette, only "keep to the file's styles"
111
184
  const tk = await readTokens(ctx.dir);
112
185
  const palette = Object.entries(tk.themes?.[tk.active] ?? {}).map(([n, v]) => `${n} ${v}`).join(", ");
113
- const tokenRule = `Use the design tokens (theme "${tk.active}"${tk.registered ? "" : ", defaults"}): colors ${palette}; font sizes ${tk.fontSizes.join("/")}px; radii ${tk.radii.join("/")}px; spacing in multiples of 4; font ${tk.fontFamily}. Check with check_tokens if available.`;
186
+ const tokenRule = tk.registered ? `Use the design tokens (theme "${tk.active}"): colors ${palette}; font sizes ${tk.fontSizes.join("/")}px; radii ${tk.radii.join("/")}px; spacing in multiples of 4; font ${tk.fontFamily}. Check with check_tokens if available.` : NO_TOKENS_NOTE;
114
187
  lines.push(
115
188
  `Rules: Only edit design files inside ${rel}/screens. Change only what is asked and leave everything else as is. New screens must include <meta name="board-size" content="390x844">; after creating one, use place_board to set its name and position. ${tokenRule}`,
116
189
  "",
@@ -170,7 +243,8 @@ export function chatRoutes({ getSelection } = {}) {
170
243
  } else body.variants = undefined;
171
244
  const prompt = await buildPrompt(ctx, body, state);
172
245
  const images = (body.attach?.refs ?? []).filter((r) => r.kind === "image").map((r) => path.join(ctx.dir, r.value));
173
- const { cmd, args } = agentCommand(agent, { prompt, resume: body.resume, root: rootOf(ctx.dir), images });
246
+ const model = validModel(body.model);
247
+ const { cmd, args } = agentCommand(agent, { prompt, resume: body.resume, root: rootOf(ctx.dir), images, model });
174
248
  const id = `r${Date.now().toString(36)}`;
175
249
  let proc;
176
250
  try {
@@ -184,11 +258,22 @@ export function chatRoutes({ getSelection } = {}) {
184
258
  runs.set(id, run);
185
259
  // Show tool paths relative to the project (agents report absolute, sometimes symlink-resolved, paths)
186
260
  const roots = [rootOf(ctx.dir), await fs.realpath(rootOf(ctx.dir)).catch(() => null)].filter(Boolean).map((r) => r + path.sep).sort((a, b) => b.length - a.length); // longest first: /private/var/… before /var/…
261
+ // What a failure is classified from, and shown under Details: error events, non-JSON output, stderr (never the prompt)
262
+ const seen = [];
187
263
  const emit = (ev) => {
188
264
  if (typeof ev.detail === "string") for (const r of roots) ev.detail = ev.detail.split(r).join("");
265
+ if (ev.kind === "tool" && !READ_ONLY.test(ev.name)) run.changed = true;
266
+ if ((ev.kind === "error" && !ev.cause) || ev.kind === "log") seen.push(ev.text);
189
267
  run.events.push(ev);
190
268
  ctx.broadcast({ type: "chat", id, ev });
191
269
  };
270
+ const fail = ({ code = null, signal = null, enoent = false, message = "" }) => {
271
+ const all = [...seen, err, message].join("\n").trim();
272
+ const c = classifyFailure({ agent, cmd, text: all, code, signal, enoent, model });
273
+ const shown = `$ ${cmd} ${args.filter((a) => a !== prompt).join(" ")}`.trim();
274
+ const raw = [shown, ...all.split("\n").slice(-20), code != null || signal ? `Exit code ${code ?? signal}` : ""].filter(Boolean).join("\n");
275
+ emit({ kind: "error", text: c.text, cause: c.cause, raw, changed: !!run.changed });
276
+ };
192
277
  emit({ kind: "start", agent, prompt, variants: body.variants?.files });
193
278
  const st = {};
194
279
  let buf = "";
@@ -205,14 +290,14 @@ export function chatRoutes({ getSelection } = {}) {
205
290
  proc.stderr.on("data", (d) => (err += d).length > 4000 && (err = err.slice(-4000)));
206
291
  proc.on("error", (e) => {
207
292
  run.status = "error";
208
- emit({ kind: "error", text: e.code === "ENOENT" ? `${cmd} command not found. Install it and sign in.` : e.message });
293
+ fail({ enoent: e.code === "ENOENT", message: e.message });
209
294
  emit({ kind: "end", status: "error" });
210
295
  });
211
296
  proc.on("close", (code, signal) => {
212
297
  if (run.status === "error") return;
213
298
  if (buf.trim()) for (const ev of parseLine(agent, buf, st)) emit(ev);
214
299
  run.status = run.cancelled ? "cancelled" : code === 0 ? "done" : "error";
215
- if (run.status === "error") emit({ kind: "error", text: err.trim().split("\n").slice(-3).join("\n") || `Exit code ${code ?? signal}` });
300
+ if (run.status === "error") fail({ code, signal });
216
301
  emit({ kind: "end", status: run.status });
217
302
  });
218
303
  sendJson(res, 200, { id, variants: body.variants?.files ?? [] });
@@ -236,13 +321,13 @@ export function chatRoutes({ getSelection } = {}) {
236
321
  },
237
322
  ],
238
323
  ["GET", "/api/chat", async (req, res, url) => sendJson(res, 200, { events: runs.get(url.searchParams.get("id"))?.events ?? [] })],
324
+ // Readiness per agent, checked on every call (the app asks when the AI tab opens and on Check again)
239
325
  [
240
326
  "GET",
241
327
  "/api/agents",
242
328
  async (req, res) => {
243
- const which = (c) => new Promise((r) => spawn(process.platform === "win32" ? "where" : "which", [c], { windowsHide: true }).on("close", (code) => r(code === 0)).on("error", () => r(false)));
244
- const fake = process.env.DESIGN_CANVAS_AGENT_CMD ? Object.keys(JSON.parse(process.env.DESIGN_CANVAS_AGENT_CMD)) : [];
245
- sendJson(res, 200, { agents: [{ id: "claude", label: "Claude Code", ok: fake.includes("claude") || (await which("claude")) }, { id: "codex", label: "Codex", ok: fake.includes("codex") || (await which("codex")) }] });
329
+ const agents = await Promise.all(["claude", "codex"].map(async (id) => ({ id, label: AGENT_LABEL[id], status: await agentStatus(id) })));
330
+ sendJson(res, 200, { agents: agents.map((a) => ({ ...a, ok: a.status !== "missing" })) });
246
331
  },
247
332
  ],
248
333
  // Upload references: stored in docs/design/.refs/ (kept out of the repo by .gitignore)
package/server/edit.mjs CHANGED
@@ -16,8 +16,8 @@ const splice = (html, start, end, text) => html.slice(0, start) + text + html.sl
16
16
  /** Finds the target element and checks its hash. A mismatch means someone else or an AI edited the file in the meantime */
17
17
  function target(html, path, hash) {
18
18
  const info = inspect(html, path);
19
- if (!info) throw new EditError(409, "Element not found (the file changed, select again)");
20
- if (hash && info.hash !== hash) throw new EditError(409, "The file changed, select again");
19
+ if (!info) throw new EditError(409, "That element is gone. Someone changed the file first; select it again");
20
+ if (hash && info.hash !== hash) throw new EditError(409, "Someone changed this file first. Select the element again");
21
21
  return info;
22
22
  }
23
23
 
package/server/fsutil.mjs CHANGED
@@ -31,5 +31,22 @@ async function renameRetry(from, to, tries = 6) {
31
31
  }
32
32
  }
33
33
 
34
+ /** Repo root: two levels up for docs/design, otherwise (temp folders in tests) the folder itself */
35
+ export const rootOf = (dir) => (dir.endsWith(path.join("docs", "design")) ? path.resolve(dir, "../..") : dir);
36
+
37
+ /** Canvas name: the project folder (relay for /x/relay/docs/design), else the design folder's own name */
38
+ export const projectName = (dir) => path.basename(rootOf(dir));
39
+
40
+ /** <title> of an HTML file, trimmed and unescaped; null when missing or empty */
41
+ export function htmlTitle(html) {
42
+ const m = /<title[^>]*>([\s\S]*?)<\/title>/i.exec(String(html ?? ""));
43
+ const t = m?.[1]
44
+ .replace(/<[^>]*>/g, "")
45
+ .replace(/&(amp|lt|gt|quot|#39|apos|nbsp);/g, (_, e) => ({ amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'", apos: "'", nbsp: " " })[e])
46
+ .replace(/\s+/g, " ")
47
+ .trim();
48
+ return t ? t.slice(0, 120) : null;
49
+ }
50
+
34
51
  /** OS path (\\ or /) → / path for URLs and board.json */
35
52
  export const toPosix = (rel, sep = path.sep) => rel.split(sep).join("/");
package/server/index.mjs CHANGED
@@ -4,6 +4,7 @@ import fs from "node:fs/promises";
4
4
  import { createReadStream, existsSync } from "node:fs";
5
5
  import http from "node:http";
6
6
  import path from "node:path";
7
+ import chokidar from "chokidar";
7
8
  import { WebSocketServer } from "ws";
8
9
 
9
10
  import { TOOL_ROOT } from "./args.mjs";
@@ -118,7 +119,7 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [] })
118
119
  }
119
120
  if (!existsSync(path.join(distDir, "index.html"))) throw new Error("No app build found (running with npm start creates it)");
120
121
 
121
- const LOCKED = /^\/api\/(board|boards\/|history\/|edit|undo|redo|place|notes|pages)/;
122
+ const LOCKED = /^\/api\/(board|boards\/|history\/|edit|undo|redo|place|notes|pages|comments)/;
122
123
  const routes = [
123
124
  ["GET", "/api/health", async (req, res) => sendJson(res, 200, { ok: true, dir })],
124
125
  [
@@ -145,7 +146,7 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [] })
145
146
  }
146
147
  },
147
148
  ],
148
- // Requests that change boards/files run one at a time via store.exclusive (so they never overlap auto-placement)
149
+ // Requests that change boards/files/comments run one at a time via store.exclusive (so they never overlap auto-placement or lose a read-modify-write)
149
150
  ...extraRoutes.map((r) => [r[0], r[1], (req, res, url) => (r[0] !== "GET" && LOCKED.test(r[1]) ? store.exclusive(() => r[2](req, res, url, ctx)) : r[2](req, res, url, ctx))]),
150
151
  ];
151
152
 
@@ -195,6 +196,12 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [] })
195
196
  const data = JSON.stringify(msg);
196
197
  for (const c of wss.clients) if (c.readyState === 1) c.send(data);
197
198
  };
199
+ // Working from source: when a new app build lands in dist/, open tabs reload themselves
200
+ let appWatcher = null;
201
+ if (dev && existsSync(path.join(TOOL_ROOT, "app"))) {
202
+ appWatcher = chokidar.watch(path.join(distDir, "index.html"), { ignoreInitial: true, awaitWriteFinish: { stabilityThreshold: 300 } });
203
+ appWatcher.on("all", () => ctx.broadcast({ type: "app-changed" }));
204
+ }
198
205
 
199
206
  await new Promise((resolve, reject) => {
200
207
  server.once("error", reject);
@@ -206,6 +213,7 @@ export async function createServer({ dir, port, dev = true, extraRoutes = [] })
206
213
  server,
207
214
  url: `http://localhost:${port}`,
208
215
  async close() {
216
+ await appWatcher?.close();
209
217
  for (const c of wss.clients) c.terminate();
210
218
  wss.close();
211
219
  await new Promise((r) => server.close(r));