Repository navigation
[examples] Chore: Replace node-state-style with the dev-examples version - #8647
Conversation
Since 0.45.0 was released, the DOMImportExtension-based node-state-style example no longer needs to live in dev-examples (which builds against the workspace source). Move its code and dependencies into the standalone examples/node-state-style, which builds against the published 0.45.0 packages, and remove the dev-examples copy. - Bring over App.tsx, ToolbarPlugin.tsx, and styleState.ts (the extension/signal-based toolbar and the DOMImportExtension-based style import), dropping the dev- prefix from the internal extension names. - Prefer the dev-examples dependency versions (shiki 4, lucide-react 1.17, vite 8, typescript 6, @vitejs/plugin-react 6, cross-env 10, rollup 4.61); keep the lexical packages pinned to the published 0.45.0. - Keep the standalone examples vite/tsconfig setup (vite.config.ts + vite.config.monorepo.ts, self-contained tsconfig.json) since the example is no longer part of the workspace. - Mention the DOMImportExtension in the README, and drop the dev-examples/node-state-style entry from pnpm-lock.yaml. https://claude.ai/code/session_01WcomYn34ahRPbwSWgQAcQ3
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
potatowagon
left a comment
There was a problem hiding this comment.
Review: [examples] Chore — Replace node-state-style with the dev-examples version
Assessment: ✅ Safe to land
What this does
Removes the duplicate dev-examples/node-state-style directory (which was linked against workspace source) and consolidates everything into the published examples/node-state-style version. The examples version is upgraded to use the new Extension API patterns.
What I verified
-
No functional regression — the example is self-contained and not imported by any core package. Removing the dev-examples copy has zero risk of breaking library consumers.
-
Extension API migration is correct — The
ToolbarPluginnow uses a properToolbarExtensionwith signal-based state (batch(),signal(),useExtensionSignalValue) instead of ReactuseState+ imperative command listeners. ThecanUndo/canRedosignals are sourced directly fromHistoryExtension(no moreCAN_UNDO_COMMAND/CAN_REDO_COMMANDlisteners). This is architecturally cleaner and avoids stale-closure issues. -
DOMImportExtension migration — Replaces the legacy
constructStyleImportMap(which monkey-patchedTextNode.importDOM()) with a declarativedefineImportRuleusingsel.any().attr('style', /\\S/). The logic is equivalent (filters IGNORE_STYLES, applies styleMapping to TextNodes), just expressed through the new pipeline. -
$exportDOM improvements — The
pre-wrapcleanup now usesremoveProperty+ strips empty style attrs, which is more robust across browsers/JSDOM than the previoussetProperty(null)approach. -
Dependency bumps are reasonable — shiki ^3→^4, lucide-react ^0.503→^1.17, vite ^7→^8, typescript ^5→^6, rollup 4.52→4.61. All major bumps but this is an example that's rebuilt from scratch by users anyway.
-
pnpm-lock.yaml — the dev-examples entry is cleanly removed from the lockfile.
-
CI — All core tests, unit tests, browser tests, integration tests, and nearly all e2e tests pass (3 pending webkit/firefox jobs still running, no failures).
No concerns. Clean consolidation, well-scoped, no risk to library consumers.
— via Navi (Tater Thoughts Bobblehead) on behalf of potatowagon
Description
Since 0.45.0 was released, the DOMImportExtension-based node-state-style example no longer needs to live in dev-examples (which builds against the workspace source). Move its code and dependencies into the standalone examples/node-state-style, which builds against the published 0.45.0 packages, and remove the dev-examples copy.