Skip to content

Move viewer stylesheets out of the host modules into .css files - #113

Merged
Frotty merged 2 commits into
refactor/texture-thumbnail-transportfrom
refactor/objmod-css-asset
Sep 5, 2026
Merged

Move viewer stylesheets out of the host modules into .css files#113
Frotty merged 2 commits into
refactor/texture-thumbnail-transportfrom
refactor/objmod-css-asset

Conversation

@Frotty

@Frotty Frotty commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Stacked on #112. Fourth slice of the audit list: the start of moving webview presentation out of the host TypeScript.

  • src/webview/objModEditor/objModEditor.css (1,380 lines), src/webview/mpqViewer.css and src/webview/mapData.css replace template literals in objModPreview.ts, mpqViewer.ts and mapDataPreview.ts.
  • A webpack asset/source rule inlines them into the host bundle; e2e/harness/tsLoader.js does the same for tests, and src/types/assets.d.ts types the imports.
  • The object editor's two runtime values (--wc3-tip-width from wurst.objModTooltipWidth, and the optional tooltip @font-face) are injected as a trailing rule after the stylesheet.
  • The extracted stylesheet text is byte-identical to what the template literals produced (verified by unescaping the old literal and diffing).

objModPreview.ts shrinks from 4,214 to 2,840 lines; mapDataPreview.ts and mpqViewer.ts lose their style blocks. The inline webview scripts are the next step and are not part of this PR.

Validation

  • tsc (real siblings and CI mocks), npm run lint, npm test: clean.
  • npm run compile-web: bundles build and contain the inlined CSS.
  • npm run test:e2e: same result set as master apart from the two known flaky object-editor specs.

The object editor's ~1,380 lines of CSS, the MPQ viewer's and the shared
map-data page styles were template literals inside TypeScript host modules,
where nothing could lint or format them. They now live as real stylesheets
under src/webview/, inlined into the host bundle by a webpack asset/source
rule (and by the test loader), with the two runtime values the object editor
needs (--wc3-tip-width and the optional tooltip @font-face) injected as a
trailing rule. The extracted text is byte-identical to what the template
literals produced.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T15:58:22.233903Z ded5012 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty

Frotty commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: ded501285b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit 70809f8 into refactor/texture-thumbnail-transport Sep 5, 2026
1 check passed
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