feat(sw): integrated improvement 0.2.0 (popup content, header open, tool buttons)

SW package 0.2.0 integrated improvement (Task A, steps 1-8). All new props are
optional; existing SW Stories are pixel-identical to the previous build (28/28).

- Build reproducibility: dist text normalized to LF, dist/build-info.json
  (commit, dirty, tool versions, no timestamp), packages/sw/.gitattributes
  (eol=lf). LF checkouts give identical dist and tarball.
- SWHeader: documentOpenPlacement ("menu" default | "header": Open right of
  the logo in the existing document-button look, reusing onDocumentOpen and
  documentOpenLabel, no duplicate Open in the dropdown), leading slot,
  hiddenControls sub-items documentNew / documentOpen / layerFreeze /
  layerLock. Open moves into More on measured overflow (with hysteresis).
- showNew / showOpen (SWHeaderDocumentTitle), showFreeze / showLock (layer
  menu, field, property window list).
- SWToolButton (text / pill / document) and SWToolGroup (radio selection),
  reusing the existing toggle, pill and file-name looks.
- SWPopup / SWPopupSection / SWPopupRow on the shared property window frame;
  SWHeaderPropertyPanel gains children, title, autoFocus and optional
  selection / properties / groups. Escape stack for several popups.
- Field dropdowns inside a popup use the shared fixed overlay
  (useSWFixedDropdownPosition), so the scrolling body no longer clips them.
- AI guide, examples E/F, README, Storybook (SW/Header/Options, SW/Tool,
  SW/Popup) and verification record docs/sw/sw-integrated-improvement-2026-10-19.md.
- Regression scripts rescoped for the intended changes (unused-removal 81/81,
  overview 52/54 with the two pre-existing historical assertions).

Known limitation (unresolved): tools / leading content (incl. SWToolGroup)
does not move into More. With a wide tool bar the configured fields shrink
instead; in Example F the document name and layer field reach 0px at 390px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shkim4andClaude Opus 5.5 committed 2026-10-19 14:49:19 +09:00
1 parent 5faa1f1ffe
commit 55179b4577
138 files changed
+17194 -162

No files matched your search

+30
View File
@@ -55,3 +55,33 @@ async function finishDeclarations(directory) {
}
}
await finishDeclarations(output)
// Reproducibility: the same source and the same locked tools give byte-identical dist on any path or
// checkout. Sources are copied as written (styles.css keeps sw.css bytes), so CRLF checkouts
// (core.autocrlf=true) would change the output; every emitted text file is normalized to LF.
async function normalizeLineEndings(directory) {
for (const entry of await readdir(directory, { withFileTypes: true })) {
const file = path.join(directory, entry.name)
if (entry.isDirectory()) await normalizeLineEndings(file)
else if (/\.(js|css|d\.ts|json)$/.test(entry.name)) {
const text = await readFile(file, "utf8")
if (text.includes("\r")) await writeFile(file, text.replace(/\r\n?/g, "\n"))
}
}
}
await normalizeLineEndings(output)
// Provenance without timestamps: source commit (SW_BUILD_COMMIT overrides; "unknown" outside git),
// whether packages/sw had uncommitted changes, and the locked build tool versions.
const git = args => { try { return execFileSync("git", args, { cwd: packageRoot, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim() } catch { return null } }
const toolVersion = name => { try { return JSON.parse(execFileSync(process.execPath, ["-p", `JSON.stringify(require("${name}/package.json").version)`], { cwd: packageRoot, encoding: "utf8" })) } catch { return null } }
const commit = process.env.SW_BUILD_COMMIT ?? git(["rev-parse", "HEAD"]) ?? "unknown"
// With SW_BUILD_COMMIT the caller vouches for the source; dirty is then unknown (null), never a guess.
const status = process.env.SW_BUILD_COMMIT ? null : git(["status", "--porcelain", "--", "."])
await writeFile(path.join(output, "build-info.json"), JSON.stringify({
name: manifest.name,
version: manifest.version,
commit,
dirty: status === null ? null : status.length > 0,
tools: { vite: toolVersion("vite"), rolldown: toolVersion("rolldown"), typescript: toolVersion("typescript") },
}, null, 2) + "\n")