Skip to content

refactor: View.vue を分ける(ミニエディタ・表の描画・選択・ダウンロード) - #190

Merged
isamu merged 1 commit into
mainfrom
refactor/split-view
Oct 21, 2026
Merged

isamu merged 1 commit into
mainfrom
refactor/split-view

Conversation

@isamu

@isamu isamu commented Oct 21, 2026

Copy link
Copy Markdown
Member

Summary

Splits View.vue, which scoria flags as god-file (over 500 lines). Code is moved as it was; behaviour does not change.

New files under src/vue/:

  • useMiniEditor.ts: the mini editor's state, opening, saving, closing and arrow-key moves. It takes the View's editableData, activeSheetIndex and persistSheets.
  • useRenderedTable.ts: calculating the active sheet and rendering it as an HTML table (renderedHtml). It takes resolvedSheets, activeSheetIndex, customFunctions and locale. The engine instance also moves here, still one per View.
  • editorSelection.ts: while the JSON editor is open, selects a clicked cell's JSON in the editor and scrolls it into view.
  • excelDownload.ts: the .xlsx download.
  • sheetRows.ts: normalizeSheetData, which reads the editor JSON's rows.

The file-backed load and save (fetchSheets, persistSheets, following the file, saves that were refused) stay in View.vue.

Items to Confirm

  • The look and behaviour do not change. The old (origin/main) and new demos were driven in Chromium (playwright-core) through the same steps, and the results compared.
    • Steps, for each sample:
      • load it;
      • click several cells and move with the arrow keys;
      • save a string, then a formula with a format, in the mini editor, then close it;
      • with the JSON editor open, click cells;
      • download as Excel.
    • Compared: the View's DOM; the result data the demo shows (emit("updateResult")); the textarea's selection range and scroll position; the value and check state of each input; the downloaded file's name and the contents of its sheets.
    • All snapshots identical; no console errors.
  • Computed styles were also compared across the states, as in chore: View.vue の style ブロックを Tailwind に置き換える #187. The only differences were two values caught mid-transition (0.2s): the ✕ button's background on hover and an input's border on focus.
  • Beyond moving code: plainCellText and isEditableTarget captured nothing, so they move to module scope.
  • Not exercised: the file-backed load and save need a host runtime the demo does not have. That code was not moved here.
  • yarn lint, yarn typecheck, yarn build, yarn test and yarn test:engine pass. oxlint reports nothing.

User Prompt

🤖 Generated with Claude Code

work in GUIChatPluginSpreadsheet

…tion, Excel download

useMiniEditor.ts holds the mini editor's state, opening, saving, closing and arrow-key moves;
useRenderedTable.ts the active sheet calculated and rendered as HTML; editorSelection.ts selecting a
cell's JSON in the editor; excelDownload.ts the .xlsx download; sheetRows.ts the rows the editors
read. Code moved as it was, with the View's refs passed in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@isamu

isamu commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

CODEX VERDICT: LGTM

  • No outstanding correctness, security, compatibility, consistency, i18n, or View-state-preservation concerns.
  • Read PR head 899588bdf30c00d2fd19cd459767b7ca34083672; every hunk of git diff origin/main...HEAD was reviewed.
  • Verification: yarn typecheck passed; yarn test:engine passed (2,216/2,216). npx vitest run --configLoader runner could not collect because the existing vite.config.ts evaluates __dirname as undefined under this runner; no PR file changes that config.
Axis Result
correctness and edge cases none
security (injection / path traversal / code evaluation) none
tests: does a test go red if the new behaviour breaks none; the supplied Chromium probe covers the main moved flows, while malformed/empty normalization, invalid JSON/error branches, and file-backed host flows are not exercised
API / schema / wire / on-disk compatibility none
consistency with the rest of the codebase none
i18n lockstep (src/lang has 8 locales) none; no locale strings or locale files changed
TIER C: View behavior preservation with state moved into composables and setup ordering none
move fidelity: openMiniEditor, closeMiniEditor, saveMiniEditor, handleKeyboardNavigation, calculateFormulas, renderedHtml, editor-selection branch, downloadExcel, normalizeSheetData none; compared with origin/main:src/vue/View.vue, including the requested ref substitutions
setup order and hoisting none; useMiniEditor is after activeSheetIndex, before reads of miniEditorOpen, and persistSheets is a function declaration
reactivity of values passed in none; download reads sheets/title at click time and selection reads the current editable JSON at click time
supplied behavior/style verification no moved entry point is missed by the exercised happy paths; the probe does miss the edge/error/file-backed branches listed above, and the computed-style probe does not test moved logic

FINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have.

@isamu
isamu merged commit 3aeef74 into main Oct 21, 2026
17 checks passed
@isamu
isamu deleted the refactor/split-view branch October 21, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant