From d18e47a69a9048d5658405ce71073724a41ee193 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Tue, 17 Nov 2026 21:08:44 +0100 Subject: [PATCH 1/7] wall: chain Walls segments and support collinear wall transit --- packages/core/src/index.ts | 1 + .../src/systems/wall/wall-topology.test.ts | 11 +- .../core/src/systems/wall/wall-topology.ts | 6 +- .../src/components/editor/floorplan-panel.tsx | 29 ++- .../nodes/src/wall/tool-chaining.test.tsx | 232 ++++++++++++++++++ packages/nodes/src/wall/tool.tsx | 92 ++++--- 6 files changed, 321 insertions(+), 50 deletions(-) create mode 100644 packages/nodes/src/wall/tool-chaining.test.tsx diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 9894ae08a4..6cc90430d6 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1355,6 +1355,7 @@ export { type WallInsertionPlan, type WallJoinResult, type WallTopologyChanges, + wallSegmentsCoverSegment, } from './systems/wall/wall-topology' export { wallTrimPatch } from './systems/wall/wall-trim' export type { SceneGraph } from './utils/clone-scene-graph' diff --git a/packages/core/src/systems/wall/wall-topology.test.ts b/packages/core/src/systems/wall/wall-topology.test.ts index 4fcd54cabb..1862cecbfc 100644 --- a/packages/core/src/systems/wall/wall-topology.test.ts +++ b/packages/core/src/systems/wall/wall-topology.test.ts @@ -17,7 +17,7 @@ import { encodeTerrainField } from '../../lib/terrain-codec' import { applyHeightPatch, createTerrainField, flattenPatch } from '../../lib/terrain-field' import { type AnyNode, type AnyNodeId, DoorNode, WallNode, ZoneNode } from '../../schema' import { getWallArcData, getWallCurveFrameAt } from './wall-curve' -import { planWallInsertion, planWallSplitAtPoint } from './wall-topology' +import { planWallInsertion, planWallSplitAtPoint, wallSegmentsCoverSegment } from './wall-topology' const LEVEL_ID = 'level_topology' as AnyNodeId @@ -1123,4 +1123,13 @@ describe('a wall started in a corner block', () => { expect(result.plan.resolvedStart).toEqual([-0.5, 0]) expect(result.plan.changes.delete).toEqual(['wall_across']) }) + + test('wallSegmentsCoverSegment identifies collinear spans covered by existing walls', () => { + // across runs from [-3, 0] to [0, 0] + expect(wallSegmentsCoverSegment([-2, 0], [-1, 0], [across])).toBe(true) + expect(wallSegmentsCoverSegment([-3, 0], [-1.5, 0], [across])).toBe(true) + // perpendicular or extending beyond the host wall + expect(wallSegmentsCoverSegment([-1.5, 0], [-1.5, 2], [across])).toBe(false) + expect(wallSegmentsCoverSegment([-3, 0], [-4, 0], [across])).toBe(false) + }) }) diff --git a/packages/core/src/systems/wall/wall-topology.ts b/packages/core/src/systems/wall/wall-topology.ts index a7a867b866..f3204aae06 100644 --- a/packages/core/src/systems/wall/wall-topology.ts +++ b/packages/core/src/systems/wall/wall-topology.ts @@ -128,7 +128,11 @@ function collinearWallIntervals( return { intervals, length } } -function wallSegmentsCoverSegment(start: WallPlanPoint, end: WallPlanPoint, walls: WallNode[]) { +export function wallSegmentsCoverSegment( + start: WallPlanPoint, + end: WallPlanPoint, + walls: WallNode[], +): boolean { const collinear = collinearWallIntervals(start, end, walls) if (!collinear) return false const parameterTolerance = WALL_INTERSECTION_EPSILON / collinear.length diff --git a/packages/editor/src/components/editor/floorplan-panel.tsx b/packages/editor/src/components/editor/floorplan-panel.tsx index 429ec6279c..120e22019e 100644 --- a/packages/editor/src/components/editor/floorplan-panel.tsx +++ b/packages/editor/src/components/editor/floorplan-panel.tsx @@ -70,6 +70,7 @@ import { WindowNode as WindowNodeSchema, wallClosesRoom, wallRectangleCorners, + wallSegmentsCoverSegment, worldToFloorplanLocalPoint, } from '@pascal-app/core' import { useSegmentDraftChain, useWallSnapIndicator } from '@pascal-app/editor' @@ -10130,9 +10131,18 @@ export function FloorplanPanel({ ? (createdWall.end as WallPlanPoint) : (publishedNextStart ?? point) + const levelWalls = Object.values(useScene.getState().nodes).filter( + (node): node is WallNode => node?.type === 'wall' && node.parentId === levelId, + ) + const isTransit = + !createdWall && + getWallLineKind() !== 'invisible' && + wallSegmentsCoverSegment(draftStart, point, levelWalls) + if ( - !wallDraftIsRun() || - (wallChainFirstVertex && isWithinWallJoinSnapRadius(nextStart, wallChainFirstVertex)) + !isTransit && + wallChainFirstVertex && + isWithinWallJoinSnapRadius(nextStart, wallChainFirstVertex) ) { clearWallPlacementDraft() setCursorPoint(null) @@ -10144,9 +10154,6 @@ export function FloorplanPanel({ // segment seals a room against the wall network, or when its resolved // end tees into wall geometry outside the chain — continuing from a // T-junction only drafts on top of existing walls. - const levelWalls = Object.values(useScene.getState().nodes).filter( - (node): node is WallNode => node?.type === 'wall' && node.parentId === levelId, - ) if ( chainEndJoinsExistingWall( createdWall.end as WallPlanPoint, @@ -10159,11 +10166,17 @@ export function FloorplanPanel({ setCursorPoint(null) return } - } else if (!(viewIs2DOnly || publishedNextStart)) { + } else if (isTransit) { + // Collinear tracking: advance the draft origin along the host wall's + // centerline without creating a duplicate wall so the next branch T-joins cleanly. + if (viewIs2DOnly) sfxEmitter.emit('sfx:grid-snap') + } else if (viewIs2DOnly) { + return + } else if (!publishedNextStart) { // Split view: the 3D tool owns both the commit and the continuation // decision, and it clears the published chain start whenever it stops - // drafting (room close, T-junction, single). Mirror that here instead - // of chaining the 2D draft from a dead point. + // drafting (room close, T-junction). Mirror that here instead of + // chaining the 2D draft from a dead point. clearWallPlacementDraft() setCursorPoint(null) return diff --git a/packages/nodes/src/wall/tool-chaining.test.tsx b/packages/nodes/src/wall/tool-chaining.test.tsx new file mode 100644 index 0000000000..4331c76cdc --- /dev/null +++ b/packages/nodes/src/wall/tool-chaining.test.tsx @@ -0,0 +1,232 @@ +import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test' +import { + BuildingNode, + createSceneApi, + emitter, + findOpenWallEnds, + type GridEvent, + LevelNode, + useScene, + WallNode, +} from '@pascal-app/core' +import { + getWallDrawVariant, + PLACEMENT_TYPING_LENGTH_ANGLE, + RegistryToolProvider, + sceneLayout, + selectWallDrawVariant, + useEditor, + useFloorplanDraftPreview, + usePlacementTyping, +} from '@pascal-app/editor' +import { useViewer } from '@pascal-app/viewer' +import { Html } from '@react-three/drei' +import { useThree } from '@react-three/fiber' +import { act, create } from '@react-three/test-renderer' +import type { ReactNode } from 'react' +import WallTool from './tool' + +const building = BuildingNode.parse({ id: 'building_wall_chaining' }) +const level = LevelNode.parse({ id: 'level_wall_chaining', parentId: building.id }) + +let canvas: EventTarget | null = null +function CanvasProbe() { + canvas = useThree((state) => state.gl.domElement) + return null +} + +function grid(x: number, z: number, detail = 1): GridEvent { + return { + position: [x, 0, z], + localPosition: [x, 0, z], + nativeEvent: { target: canvas, button: 0, detail } as unknown as GridEvent['nativeEvent'], + } +} + +function levelWalls(): WallNode[] { + return Object.values(useScene.getState().nodes).filter( + (node): node is WallNode => node?.type === 'wall' && node.parentId === level.id, + ) +} + +function mountWallTool() { + return create( + false, + sceneApi: createSceneApi(), + selectNode: () => {}, + unit: 'metric', + }} + > + + + , + ) +} + +let savedScene: ReturnType +let savedEditor: ReturnType +let savedVariant: ReturnType +const DOM_GLOBALS = [ + 'window', + 'HTMLCanvasElement', + 'cancelAnimationFrame', + 'IS_REACT_ACT_ENVIRONMENT', +] as const +let savedGlobals: (PropertyDescriptor | undefined)[] = [] +let htmlLabels: ReturnType + +beforeEach(() => { + htmlLabels = spyOn(Html as unknown as { render: () => ReactNode }, 'render').mockImplementation( + () => null, + ) + savedGlobals = DOM_GLOBALS.map((key) => Object.getOwnPropertyDescriptor(globalThis, key)) + Object.defineProperties(globalThis, { + window: { configurable: true, value: new EventTarget() }, + HTMLCanvasElement: { configurable: true, value: class {} }, + cancelAnimationFrame: { configurable: true, value: () => {} }, + IS_REACT_ACT_ENVIRONMENT: { configurable: true, value: true }, + }) + savedScene = useScene.getState() + savedEditor = useEditor.getState() + useScene.setState({ + nodes: { + [building.id]: { ...building, children: [level.id] }, + [level.id]: level, + }, + rootNodeIds: [building.id], + dirtyNodes: new Set(), + readOnly: false, + }) + useViewer.getState().setSelection({ buildingId: building.id, levelId: level.id }) + useEditor.getState().setViewLayout(sceneLayout('3d')) + useEditor.getState().setSnappingMode('wall', 'grid') + useEditor.getState().setGridSnapStep(0.5) + useEditor.getState().armToolMode({ mode: 'build', tool: 'wall' }) + savedVariant = getWallDrawVariant() + selectWallDrawVariant('walls') + usePlacementTyping.getState().clear() +}) + +afterEach(() => { + htmlLabels.mockRestore() + usePlacementTyping.getState().clear() + selectWallDrawVariant(savedVariant) + DOM_GLOBALS.forEach((key, index) => { + const saved = savedGlobals[index] + if (saved) Object.defineProperty(globalThis, key, saved) + else delete (globalThis as Record)[key] + }) + useScene.setState(savedScene) + useEditor.setState(savedEditor) +}) + +test('Walls mode chains consecutive off-grid typed walls from exact resolved endpoints with zero open ends', async () => { + const renderer = await mountWallTool() + const draftStart = () => useFloorplanDraftPreview.getState().wallDraftStart + try { + // Start at [0, 0] in default 0.5m grid mode + await act(async () => emitter.emit('grid:click', grid(0, 0))) + expect(draftStart()).toEqual([0, 0]) + + // Wall 1: 3.2m along +X (off the 0.5m grid) + await act(async () => emitter.emit('grid:move', grid(4, 0))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('3.2') + }) + await act(async () => emitter.emit('grid:click', grid(4, 0))) + expect(draftStart()).toEqual([3.2, 0]) + + // Wall 2: 2.7m along +Z directly from [3.2, 0] (no manual re-click) + await act(async () => emitter.emit('grid:move', grid(3.2, 4))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('2.7') + }) + await act(async () => emitter.emit('grid:click', grid(3.2, 4))) + expect(draftStart()?.[0]).toBeCloseTo(3.2, 5) + expect(draftStart()?.[1]).toBeCloseTo(2.7, 5) + + // Wall 3: 3.2m along -X + await act(async () => emitter.emit('grid:move', grid(0, 2.7))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('3.2') + }) + await act(async () => emitter.emit('grid:click', grid(0, 2.7))) + expect(draftStart()?.[0]).toBeCloseTo(0, 5) + expect(draftStart()?.[1]).toBeCloseTo(2.7, 5) + + // Wall 4: 2.7m along -Z closing back to [0, 0] -> auto-stops cleanly + await act(async () => emitter.emit('grid:move', grid(0, 0))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('2.7') + }) + await act(async () => emitter.emit('grid:click', grid(0, 0))) + + expect(draftStart()).toBeNull() + expect(levelWalls()).toHaveLength(4) + expect(findOpenWallEnds(useScene.getState().nodes, level.id)).toEqual([]) + } finally { + await renderer.unmount() + } +}) + +test('collinear transit advances draft origin along an existing wall centerline so a branch T-joins cleanly', async () => { + const host = WallNode.parse({ + id: 'wall_host', + parentId: level.id, + start: [0, 0], + end: [6, 0], + }) + useScene.setState((state) => ({ + nodes: { + ...state.nodes, + [level.id]: { ...level, children: [host.id] }, + [host.id]: host, + }, + })) + + const renderer = await mountWallTool() + const draftStart = () => useFloorplanDraftPreview.getState().wallDraftStart + try { + // Start at the host wall's [0, 0] corner and track 2.3m along its centerline + await act(async () => emitter.emit('grid:click', grid(0, 0))) + await act(async () => emitter.emit('grid:move', grid(4, 0))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('2.3') + }) + await act(async () => emitter.emit('grid:click', grid(4, 0))) + + // No duplicate wall created; draft origin advanced to [2.3, 0] on the host centerline + expect(levelWalls()).toHaveLength(1) + expect(draftStart()?.[0]).toBeCloseTo(2.3, 5) + expect(draftStart()?.[1]).toBeCloseTo(0, 5) + + // Branch perpendicular 3m along +Z -> splits host wall and T-joins cleanly + await act(async () => emitter.emit('grid:move', grid(2.3, 4))) + await act(async () => { + usePlacementTyping.getState().begin({ labels: PLACEMENT_TYPING_LENGTH_ANGLE }) + usePlacementTyping.getState().append('3') + }) + await act(async () => emitter.emit('grid:click', grid(2.3, 4))) + + // Double-click finishes the open branch + await act(async () => emitter.emit('grid:click', grid(2.3, 3, 2))) + expect(draftStart()).toBeNull() + + // Host wall was split at [2.3, 0] and joined with the branch (3 wall segments total) + expect(levelWalls()).toHaveLength(3) + const joinableGaps = findOpenWallEnds(useScene.getState().nodes, level.id).filter( + (end) => end.candidate, + ) + expect(joinableGaps).toEqual([]) + } finally { + await renderer.unmount() + } +}) diff --git a/packages/nodes/src/wall/tool.tsx b/packages/nodes/src/wall/tool.tsx index 571c6f236f..a26320768c 100644 --- a/packages/nodes/src/wall/tool.tsx +++ b/packages/nodes/src/wall/tool.tsx @@ -19,6 +19,7 @@ import { type WallMiterData, type WallNode, wallClosesRoom, + wallSegmentsCoverSegment, } from '@pascal-app/core' import { addWallPolygonDraftCorner, @@ -1047,47 +1048,58 @@ const LineWallTool: React.FC = () => { flatConstructionBase: flatConstructionBase.current, }, ) - if (!createdWall) return - chainWallIds.current.push(createdWall.id) - // What was typed belongs to this segment; the next starts afresh. - usePlacementTyping.getState().clear() - // The run's next wall holds square to this one. - runReference = wallRunDirection(createdWall.start, createdWall.end) - - // The new segment is now a real node — make it an alignment target - // for the next segment, and drop the just-shown guide. - refreshAlignmentCandidates() - useAlignmentGuides.getState().clear() - useWallSnapIndicator.getState().clear() - - // Walls draws one wall per two clicks. - if (!wallDraftIsRun()) { - stopDrafting() - return - } - - const closedToChainStart = - chainFirstVertex.current && - isWithinWallJoinSnapRadius(createdWall.end, chainFirstVertex.current) - - // Auto-close also fires when the segment seals a room against the - // existing wall network (e.g. a bay closed onto the middle of another - // wall), not just when the chain loops back to its own start. Shares the - // room graph with auto slab/ceiling detection so the two never disagree. - // A resolved end that tees into wall geometry outside the chain also - // terminates even without an enclosed room — nobody continues drawing - // from a T-junction into an existing wall; a dead end in free space - // keeps the chain going. - const levelWalls = getCurrentLevelWalls() - if ( - closedToChainStart || - chainEndJoinsExistingWall(createdWall.end, levelWalls, chainWallIds.current) || - (createdWall.type === 'wall' && wallClosesRoom(levelWalls, createdWall)) - ) { - stopDrafting() - return + if (!createdWall) { + const levelWalls = getCurrentLevelWalls() + const startPt: WallPlanPoint = [startingPoint.current.x, startingPoint.current.z] + const isCollinearTransit = + getWallLineKind() !== 'invisible' && + wallSegmentsCoverSegment(startPt, snappedEnd, levelWalls) + if (!isCollinearTransit) return + // Tracking along an existing wall centerline advances the draft origin + // without duplicating the wall, so a subsequent branch T-joins cleanly. + nextStart = snappedEnd + runReference = wallRunDirection(startPt, snappedEnd) + usePlacementTyping.getState().clear() + useAlignmentGuides.getState().clear() + useWallSnapIndicator.getState().clear() + triggerSFX('sfx:grid-snap') + } else { + chainWallIds.current.push(createdWall.id) + // What was typed belongs to this segment; the next starts afresh. + usePlacementTyping.getState().clear() + // The run's next wall holds square to this one. + runReference = wallRunDirection(createdWall.start, createdWall.end) + + // The new segment is now a real node — make it an alignment target + // for the next segment, and drop the just-shown guide. + refreshAlignmentCandidates() + useAlignmentGuides.getState().clear() + useWallSnapIndicator.getState().clear() + + const closedToChainStart = + chainFirstVertex.current && + isWithinWallJoinSnapRadius(createdWall.end, chainFirstVertex.current) + + // Auto-close also fires when the segment seals a room against the + // existing wall network (e.g. a bay closed onto the middle of another + // wall), not just when the chain loops back to its own start. Shares the + // room graph with auto slab/ceiling detection so the two never disagree. + // A resolved end that tees into wall geometry outside the chain also + // terminates even without an enclosed room — nobody continues drawing + // from a T-junction into an existing wall; a dead end in free space + // keeps the chain going from the exact resolved endpoint so sequential + // walls stay joined even off-grid or with typed lengths. + const levelWalls = getCurrentLevelWalls() + if ( + closedToChainStart || + chainEndJoinsExistingWall(createdWall.end, levelWalls, chainWallIds.current) || + (createdWall.type === 'wall' && wallClosesRoom(levelWalls, createdWall)) + ) { + stopDrafting() + return + } + nextStart = createdWall.end } - nextStart = createdWall.end } // Publish the resolved chain start so the 2D floor-plan draft // chains its next segment from the same point (its own snap From 90bf22f241780f8ac99251b2f8a2c6a9c524b531 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Tue, 17 Nov 2026 22:02:06 +0100 Subject: [PATCH 2/7] fix(editor): gate 2D collinear transit check to 2D-only mode in split view --- .../src/components/editor/floorplan-panel.tsx | 73 ++++++++----------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/packages/editor/src/components/editor/floorplan-panel.tsx b/packages/editor/src/components/editor/floorplan-panel.tsx index 120e22019e..1a70e53a89 100644 --- a/packages/editor/src/components/editor/floorplan-panel.tsx +++ b/packages/editor/src/components/editor/floorplan-panel.tsx @@ -10131,52 +10131,43 @@ export function FloorplanPanel({ ? (createdWall.end as WallPlanPoint) : (publishedNextStart ?? point) - const levelWalls = Object.values(useScene.getState().nodes).filter( - (node): node is WallNode => node?.type === 'wall' && node.parentId === levelId, - ) - const isTransit = - !createdWall && - getWallLineKind() !== 'invisible' && - wallSegmentsCoverSegment(draftStart, point, levelWalls) - - if ( - !isTransit && - wallChainFirstVertex && - isWithinWallJoinSnapRadius(nextStart, wallChainFirstVertex) - ) { - clearWallPlacementDraft() - setCursorPoint(null) - return - } - - if (createdWall) { - // 2D-only committer: mirror the 3D tool's auto-close. Stop when the - // segment seals a room against the wall network, or when its resolved - // end tees into wall geometry outside the chain — continuing from a - // T-junction only drafts on top of existing walls. - if ( - chainEndJoinsExistingWall( - createdWall.end as WallPlanPoint, - levelWalls, - wallChainWallIdsRef.current, - ) || - (createdWall.type === 'wall' && wallClosesRoom(levelWalls, createdWall)) + if (viewIs2DOnly) { + const levelWalls = Object.values(useScene.getState().nodes).filter( + (node): node is WallNode => node?.type === 'wall' && node.parentId === levelId, + ) + if (createdWall) { + // 2D-only committer: mirror the 3D tool's auto-close. Stop when the + // segment closes back to the chain start, seals a room against the + // wall network, or tees into wall geometry outside the chain — + // continuing from a T-junction only drafts on top of existing walls. + if ( + (wallChainFirstVertex && isWithinWallJoinSnapRadius(nextStart, wallChainFirstVertex)) || + chainEndJoinsExistingWall( + createdWall.end as WallPlanPoint, + levelWalls, + wallChainWallIdsRef.current, + ) || + (createdWall.type === 'wall' && wallClosesRoom(levelWalls, createdWall)) + ) { + clearWallPlacementDraft() + setCursorPoint(null) + return + } + } else if ( + getWallLineKind() !== 'invisible' && + wallSegmentsCoverSegment(draftStart, point, levelWalls) ) { - clearWallPlacementDraft() - setCursorPoint(null) + // Collinear tracking: advance the draft origin along the host wall's + // centerline without creating a duplicate wall so the next branch T-joins cleanly. + sfxEmitter.emit('sfx:grid-snap') + } else { return } - } else if (isTransit) { - // Collinear tracking: advance the draft origin along the host wall's - // centerline without creating a duplicate wall so the next branch T-joins cleanly. - if (viewIs2DOnly) sfxEmitter.emit('sfx:grid-snap') - } else if (viewIs2DOnly) { - return } else if (!publishedNextStart) { // Split view: the 3D tool owns both the commit and the continuation - // decision, and it clears the published chain start whenever it stops - // drafting (room close, T-junction). Mirror that here instead of - // chaining the 2D draft from a dead point. + // decision (including collinear transit), and clears the published + // chain start whenever it stops drafting (room close, T-junction, + // loop close). Mirror that here instead of chaining from a dead point. clearWallPlacementDraft() setCursorPoint(null) return From 16c881b752a1119d6043cc698e74bb483bfd9285 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Tue, 17 Nov 2026 22:17:05 +0100 Subject: [PATCH 3/7] perf(editor): lazy-load 3D bootstrap, plugins, locales, exporters, and panels --- apps/editor/app/client-bootstrap.tsx | 39 +++--- apps/editor/app/import/import-client.tsx | 1 + apps/editor/app/layout.tsx | 17 ++- apps/editor/components/embed-viewer.tsx | 1 + apps/editor/components/scene-loader.tsx | 24 ++-- .../components/webxr-enabled-runtime.tsx | 37 +++++ apps/editor/components/webxr-feature-gate.tsx | 51 ++----- apps/editor/lib/bootstrap.ts | 132 +++++++++++------- apps/editor/lib/dev-locales.ts | 23 +-- apps/editor/package.json | 2 +- bun.lock | 89 ++++++------ package.json | 4 +- packages/editor/package.json | 1 + .../src/components/editor/export-manager.tsx | 52 ++++--- .../editor/src/components/editor/index.tsx | 86 ++++++++++-- packages/editor/src/i18n/lazy-locales.ts | 56 ++++++++ packages/editor/src/i18n/pseudo-locale.ts | 1 + patches/@react-three%2Fdrei@10.7.9.patch | 49 +++++++ 18 files changed, 459 insertions(+), 206 deletions(-) create mode 100644 apps/editor/components/webxr-enabled-runtime.tsx create mode 100644 packages/editor/src/i18n/lazy-locales.ts create mode 100644 patches/@react-three%2Fdrei@10.7.9.patch diff --git a/apps/editor/app/client-bootstrap.tsx b/apps/editor/app/client-bootstrap.tsx index ac33b9f387..e23c63336b 100644 --- a/apps/editor/app/client-bootstrap.tsx +++ b/apps/editor/app/client-bootstrap.tsx @@ -1,32 +1,35 @@ 'use client' -// Loads `@pascal-app/nodes`' built-in plugin into the node registry on the -// client. Mounted from `layout.tsx` so every page in the standalone -// editor gets the registry populated before its first `` / -// `` mounts — without this the registry is empty on the client -// (the server registers in its own module instance, which is unreachable -// from hydrated pages) and every `NodeRenderer` resolves to `null`. The -// `loaded` guard inside `../lib/bootstrap` keeps the side effect -// idempotent under HMR. -import '../lib/bootstrap' -import { createI18n, defaultI18n, PascalI18nProvider } from '@pascal-app/core' -import { registerBundledLocales } from '@pascal-app/editor/locales' +import { + type CompiledTranslationMessages, + createI18n, + defaultI18n, + PascalI18nProvider, + registerCompiledMessages, +} from '@pascal-app/core' +import { loadBundledLocale, registerEnglishLocale } from '@pascal-app/editor/locales/lazy' import { type ReactNode, useEffect, useMemo } from 'react' -import { registerDevLocales } from '@/lib/dev-locales' +import { loadDevLocale } from '@/lib/dev-locales' -registerBundledLocales() -registerDevLocales() +registerEnglishLocale() export function ClientBootstrap({ children, enableDevDiagnostics, + initialLocaleCatalog, locale, }: { children: ReactNode enableDevDiagnostics: boolean + initialLocaleCatalog?: { locale: string; messages: CompiledTranslationMessages } locale: string }) { - const i18n = useMemo(() => createI18n({ locale }), [locale]) + const i18n = useMemo(() => { + if (initialLocaleCatalog) { + registerCompiledMessages(initialLocaleCatalog.locale, '', initialLocaleCatalog.messages) + } + return createI18n({ locale }) + }, [initialLocaleCatalog, locale]) useEffect(() => { if (!enableDevDiagnostics) return @@ -42,7 +45,11 @@ export function ClientBootstrap({ }, [i18n]) useEffect(() => { - return defaultI18n.subscribeLocale((nextLocale) => i18n.setLocale(nextLocale)) + return defaultI18n.subscribeLocale((nextLocale) => { + void Promise.all([loadDevLocale(nextLocale), loadBundledLocale(nextLocale)]).finally(() => { + i18n.setLocale(nextLocale) + }) + }) }, [i18n]) return {children} diff --git a/apps/editor/app/import/import-client.tsx b/apps/editor/app/import/import-client.tsx index 102c836168..ba5f9a6b7a 100644 --- a/apps/editor/app/import/import-client.tsx +++ b/apps/editor/app/import/import-client.tsx @@ -1,5 +1,6 @@ 'use client' +import '@/lib/bootstrap' import { type ValidateBuildJsonResult, validateBuildJson } from '@pascal-app/core' import { useRouter } from 'next/navigation' import { useCallback, useEffect, useRef, useState } from 'react' diff --git a/apps/editor/app/layout.tsx b/apps/editor/app/layout.tsx index 6af66b7ac6..52af205220 100644 --- a/apps/editor/app/layout.tsx +++ b/apps/editor/app/layout.tsx @@ -1,16 +1,15 @@ -import { registerBundledLocales } from '@pascal-app/editor/locales' +import { loadBundledLocale, registerEnglishLocale } from '@pascal-app/editor/locales/lazy' import { Agentation } from 'agentation' import { GeistPixelSquare } from 'geist/font/pixel' import { Barlow } from 'next/font/google' import localFont from 'next/font/local' import { headers } from 'next/headers' -import { registerDevLocales } from '@/lib/dev-locales' +import { loadDevLocale } from '@/lib/dev-locales' import { PASCAL_LOCALE_HEADER, resolveUiLocale } from '@/lib/ui-locale' import { ClientBootstrap } from './client-bootstrap' import './globals.css' -registerBundledLocales() -registerDevLocales() +registerEnglishLocale() const geistSans = localFont({ src: './fonts/GeistVF.woff', @@ -36,6 +35,10 @@ export default async function RootLayout({ const enableDevDiagnostics = process.env.NODE_ENV === 'development' && process.env.PASCAL_DEV_DIAGNOSTICS === '1' const locale = resolveUiLocale((await headers()).get(PASCAL_LOCALE_HEADER)) + const loadedCatalog = + locale === 'en' ? null : ((await loadDevLocale(locale)) ?? (await loadBundledLocale(locale))) + const initialLocaleCatalog = + loadedCatalog && loadedCatalog.locale !== 'en' ? loadedCatalog : undefined return ( - + {children} {enableDevDiagnostics && } diff --git a/apps/editor/components/embed-viewer.tsx b/apps/editor/components/embed-viewer.tsx index e836ad0ada..39d2ba8d25 100644 --- a/apps/editor/components/embed-viewer.tsx +++ b/apps/editor/components/embed-viewer.tsx @@ -1,5 +1,6 @@ 'use client' +import '@/lib/bootstrap' import { initSpatialGridSync, useScene } from '@pascal-app/core' import { applySceneGraphToEditor, diff --git a/apps/editor/components/scene-loader.tsx b/apps/editor/components/scene-loader.tsx index ceaceeff57..dba9f68cf1 100644 --- a/apps/editor/components/scene-loader.tsx +++ b/apps/editor/components/scene-loader.tsx @@ -1,8 +1,8 @@ 'use client' -// Node registry bootstrap is loaded once at the root via -// `` in `app/layout.tsx` — no per-page side-effect -// import here. +// Populates the built-in node registry synchronously before `` mounts, +// scoped to 3D routes instead of the root layout so non-3D pages stay light. +import '@/lib/bootstrap' import { type MessageDescriptor, usePascalI18n } from '@pascal-app/core' import { applySceneGraphToEditor, @@ -11,11 +11,10 @@ import { type SceneGraph, type SidebarTab, } from '@pascal-app/editor' -import { PascalWebXRButton } from '@webxr/plugin/pascal-editor' import { Hammer, Layers, Package, Palette, Settings } from 'lucide-react' import Image from 'next/image' import { useRouter, useSearchParams } from 'next/navigation' -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react' import { PoolSectionBanner } from '@/components/pool-section-banner' import { countGraphNodes, isEmptyGraphOverwrite } from '@/lib/empty-graph-guard' import { useLocalArtifactStore } from '@/lib/local-artifact-store' @@ -32,6 +31,11 @@ import { PaintPanel } from './paint-panel' import { EditorViewerToolbarLeft, EditorViewerToolbarRight } from './viewer-toolbar' import { useWebXRFeature, useWebXRInstalled, WebXRFeatureRuntime } from './webxr-feature-gate' +const LazyPascalWebXRButton = lazy(async () => { + const mod = await import('@webxr/plugin/pascal-editor') + return { default: mod.PascalWebXRButton } +}) + export interface SceneMeta { id: string name: string @@ -421,10 +425,12 @@ function SceneEditor({ initialScene, meta: initialMeta }: SceneLoaderProps) { + + + ) : null } vrLabel="Enter VR" diff --git a/apps/editor/components/webxr-enabled-runtime.tsx b/apps/editor/components/webxr-enabled-runtime.tsx new file mode 100644 index 0000000000..92834b828d --- /dev/null +++ b/apps/editor/components/webxr-enabled-runtime.tsx @@ -0,0 +1,37 @@ +'use client' + +import { usePascalWebXR } from '@webxr/plugin/pascal-editor' +import { useEffect, useMemo } from 'react' +import { webXRWandBindings } from './webxr-wand-bindings' + +export type PascalWebXRFeature = ReturnType + +export default function EnabledWebXRFeature({ + onFeature, +}: { + onFeature: (feature: PascalWebXRFeature | null) => void +}) { + const feature = usePascalWebXR(webXRWandBindings) + // Keep the context stable when the plugin returns a new aggregate object. + // biome-ignore lint/correctness/useExhaustiveDependencies: stabilize on public feature fields + const stableFeature = useMemo( + () => feature, + [ + feature.enter, + feature.entering, + feature.error, + feature.exit, + feature.immersive, + feature.ready, + feature.runtime, + feature.session, + ], + ) + + useEffect(() => { + onFeature(stableFeature) + return () => onFeature(null) + }, [onFeature, stableFeature]) + + return null +} diff --git a/apps/editor/components/webxr-feature-gate.tsx b/apps/editor/components/webxr-feature-gate.tsx index aa30e9b1c2..cf5e16185a 100644 --- a/apps/editor/components/webxr-feature-gate.tsx +++ b/apps/editor/components/webxr-feature-gate.tsx @@ -1,52 +1,27 @@ 'use client' import { useScene } from '@pascal-app/editor' -import { WEBXR_PLUGIN_ID } from '@webxr/plugin' -import { usePascalWebXR } from '@webxr/plugin/pascal-editor' import { createContext, + lazy, type ReactNode, + Suspense, useCallback, useContext, - useEffect, - useMemo, useState, } from 'react' -import { webXRWandBindings } from './webxr-wand-bindings' +import type { PascalWebXRFeature } from './webxr-enabled-runtime' -export type PascalWebXRFeature = ReturnType +export type { PascalWebXRFeature } -const WebXRFeatureContext = createContext(null) +// Kept inline instead of importing from `@webxr/plugin` so the WebXR bundle +// (`@react-three/xr`, `iwer`, `@iwer/devui`) is never loaded unless the plugin +// is actually installed in the active scene. +const WEBXR_PLUGIN_ID = 'webxr:core' -function EnabledWebXRFeature({ - onFeature, -}: { - onFeature: (feature: PascalWebXRFeature | null) => void -}) { - const feature = usePascalWebXR(webXRWandBindings) - // Keep the context stable when the plugin returns a new aggregate object. - // biome-ignore lint/correctness/useExhaustiveDependencies: stabilize on public feature fields - const stableFeature = useMemo( - () => feature, - [ - feature.enter, - feature.entering, - feature.error, - feature.exit, - feature.immersive, - feature.ready, - feature.runtime, - feature.session, - ], - ) +const LazyEnabledWebXRFeature = lazy(() => import('./webxr-enabled-runtime')) - useEffect(() => { - onFeature(stableFeature) - return () => onFeature(null) - }, [onFeature, stableFeature]) - - return null -} +const WebXRFeatureContext = createContext(null) export function WebXRFeatureRuntime({ enabled, @@ -61,7 +36,11 @@ export function WebXRFeatureRuntime({ return ( {children} - {enabled ? : null} + {enabled ? ( + + + + ) : null} ) } diff --git a/apps/editor/lib/bootstrap.ts b/apps/editor/lib/bootstrap.ts index 8f30036fcd..d61cb80303 100644 --- a/apps/editor/lib/bootstrap.ts +++ b/apps/editor/lib/bootstrap.ts @@ -1,4 +1,3 @@ -import { mintHostPanel, mintPlugin } from '@mint/pascal-plugin' import { type AnyNodeDefinition, discoverPlugins, @@ -10,15 +9,7 @@ import { import { sdfChecksFromEnv, setSdfChecks } from '@pascal-app/core/usage-field' import { registerEditorHostPanel } from '@pascal-app/editor' import { builtinPlugin } from '@pascal-app/nodes' -import { bonesHostPanel, bonesPlugin } from '@pascal-app/plugin-bones' -import { - environmentHostPanel, - environmentPlugin, - environmentPresentation, -} from '@pascal-app/plugin-environment' -import { treesHostPanel, treesPlugin } from '@pascal-app/plugin-trees' import { configureViewer, registerViewerPresentation } from '@pascal-app/viewer' -import { webXRHostPanel, webXRPlugin } from '@webxr/plugin' configureViewer({ sfxBaseUrl: '/audios/sfx', @@ -36,6 +27,7 @@ setSdfChecks(sdfChecksFromEnv(process.env.NEXT_PUBLIC_PASCAL_SDF_CHECKS)) // reset on a hard reload but survive within a session. let builtinsLoaded = false let externalsKickedOff = false +let discoveryRegistered = false function isDev(): boolean { const env = (globalThis as { process?: { env?: Record } }).process @@ -52,8 +44,9 @@ function isDev(): boolean { * surfaced as a hydration error at the `` element and every * `NodeRenderer` resolving to `null` until later renders. * - * `discoverPlugins()` (which may hit the network for external packs) - * stays async and runs separately via `loadExternalPlugins()`. + * `discoverPlugins()` stays async and loads all external packs lazily via + * `loadExternalPlugins()` so heavy plugin packages (~190 MB in dev) do not + * block initial bundle parse, hydration, or first paint. */ function loadBuiltinsSync(): void { if (builtinsLoaded) return @@ -83,6 +76,67 @@ function loadBuiltinsSync(): void { } } +function registerExternalPluginLoaders(): void { + if (discoveryRegistered) return + discoveryRegistered = true + + extendPluginDiscovery(async () => { + const { treesHostPanel, treesPlugin } = await import('@pascal-app/plugin-trees') + registerEditorHostPanel(treesHostPanel) + return [treesPlugin] + }) + extendPluginDiscovery(async () => { + const { environmentHostPanel, environmentPlugin, environmentPresentation } = await import( + '@pascal-app/plugin-environment' + ) + registerEditorHostPanel(environmentHostPanel) + registerViewerPresentation(environmentPresentation) + return [environmentPlugin] + }) + extendPluginDiscovery(async () => { + const { bonesHostPanel, bonesPlugin } = await import('@pascal-app/plugin-bones') + // Opt-in: Bones ships uninstalled — users enable it per scene from the + // Plugins panel (engineering X-ray is a specialist view, not a default). + registerEditorHostPanel({ ...bonesHostPanel, defaultInstalled: false }) + return [bonesPlugin] + }) + extendPluginDiscovery(async () => { + const { mintHostPanel, mintPlugin } = await import('@mint/pascal-plugin') + registerEditorHostPanel(mintHostPanel) + return [mintPlugin] + }) + extendPluginDiscovery(async () => { + const { poolHostPanel, poolPlugin } = await import('@pascal-app/plugin-pool') + registerEditorHostPanel(poolHostPanel) + return [poolPlugin] + }) + extendPluginDiscovery(async () => { + const { landscapeHostPanel, landscapePlugin } = await import('@pascal-app/plugin-landscape') + registerEditorHostPanel(landscapeHostPanel) + return [landscapePlugin] + }) + extendPluginDiscovery(async () => { + const { bathSpaceHostPanel, bathSpacePlugin } = await import('@pascal-app/plugin-bath-space') + registerEditorHostPanel(bathSpaceHostPanel) + return [bathSpacePlugin] + }) + extendPluginDiscovery(async () => { + const { streetscapeHostPanel, streetscapePlugin } = await import( + '@pascal-app/plugin-streetscape' + ) + registerEditorHostPanel({ + ...streetscapeHostPanel, + creator: { name: 'Sudhir Yadav', url: 'https://github.com/sudhir9297' }, + }) + return [streetscapePlugin] + }) + extendPluginDiscovery(async () => { + const { webXRHostPanel, webXRPlugin } = await import('@webxr/plugin') + registerEditorHostPanel(webXRHostPanel) + return [webXRPlugin] + }) +} + /** * Phase 6 plugin discovery hook — runs once, asynchronously, after the * synchronous builtins are already registered. Apps that ship external @@ -101,45 +155,21 @@ export async function loadExternalPlugins(): Promise { } } -// Register the first-party example node plugin alongside any host-provided -// discovery source instead of replacing it. Its Nature rail panel is host UI, -// so it is registered separately from the core plugin manifest. -extendPluginDiscovery(async () => [treesPlugin]) -registerEditorHostPanel(treesHostPanel) -extendPluginDiscovery(async () => [environmentPlugin]) -registerEditorHostPanel(environmentHostPanel) -registerViewerPresentation(environmentPresentation) -extendPluginDiscovery(async () => [bonesPlugin]) -// Opt-in: Bones ships uninstalled — users enable it per scene from the -// Plugins panel (engineering X-ray is a specialist view, not a default). -registerEditorHostPanel({ ...bonesHostPanel, defaultInstalled: false }) -extendPluginDiscovery(async () => [mintPlugin]) -registerEditorHostPanel(mintHostPanel) -extendPluginDiscovery(async () => { - const { poolHostPanel, poolPlugin } = await import('@pascal-app/plugin-pool') - registerEditorHostPanel(poolHostPanel) - return [poolPlugin] -}) -extendPluginDiscovery(async () => { - const { landscapeHostPanel, landscapePlugin } = await import('@pascal-app/plugin-landscape') - registerEditorHostPanel(landscapeHostPanel) - return [landscapePlugin] -}) -extendPluginDiscovery(async () => { - const { bathSpaceHostPanel, bathSpacePlugin } = await import('@pascal-app/plugin-bath-space') - registerEditorHostPanel(bathSpaceHostPanel) - return [bathSpacePlugin] -}) -extendPluginDiscovery(async () => { - const { streetscapeHostPanel, streetscapePlugin } = await import('@pascal-app/plugin-streetscape') - registerEditorHostPanel({ - ...streetscapeHostPanel, - creator: { name: 'Sudhir Yadav', url: 'https://github.com/sudhir9297' }, - }) - return [streetscapePlugin] -}) -extendPluginDiscovery(async () => [webXRPlugin]) -registerEditorHostPanel(webXRHostPanel) +function scheduleExternalPluginsLoad(): void { + // External plugins only provide interactive 3D renderers and client panels; + // deferring discovery on the client keeps initial SSR, hydration, and canvas + // mount unblocked by heavy external plugin bundles. + if (typeof window === 'undefined') return + const run = () => { + void loadExternalPlugins() + } + if (typeof window.requestIdleCallback === 'function') { + window.requestIdleCallback(run, { timeout: 300 }) + } else { + window.setTimeout(run, 150) + } +} +registerExternalPluginLoaders() loadBuiltinsSync() -void loadExternalPlugins() +scheduleExternalPluginsLoad() diff --git a/apps/editor/lib/dev-locales.ts b/apps/editor/lib/dev-locales.ts index 10fe9716c9..cbe92b40f6 100644 --- a/apps/editor/lib/dev-locales.ts +++ b/apps/editor/lib/dev-locales.ts @@ -1,11 +1,18 @@ +import type { CompiledTranslationMessages } from '@pascal-app/core' + /** - * `en-XA` is a test locale. The require sits inside a `NODE_ENV` branch that - * bundlers drop from production builds, so its catalog never ships. + * `en-XA` is a test locale (~334 KB). Loading it dynamically inside a `NODE_ENV` + * branch keeps it out of production builds and avoids compiling/parsing it on + * normal dev page loads unless `?lang=en-XA` is actually requested. */ -export function registerDevLocales(): void { - if (process.env.NODE_ENV !== 'production') { - const { registerPseudoLocale } = - require('@pascal-app/editor/locales/pseudo') as typeof import('@pascal-app/editor/locales/pseudo') - registerPseudoLocale() - } +export async function loadDevLocale( + locale: string, +): Promise<{ locale: string; messages: CompiledTranslationMessages } | null> { + if (process.env.NODE_ENV === 'production') return null + if (locale.trim().toLowerCase() !== 'en-xa') return null + const { PSEUDO_LOCALE, pseudoLocaleMessages, registerPseudoLocale } = await import( + '@pascal-app/editor/locales/pseudo' + ) + registerPseudoLocale() + return { locale: PSEUDO_LOCALE, messages: pseudoLocaleMessages } } diff --git a/apps/editor/package.json b/apps/editor/package.json index 4482c6aaf6..a739d7e8b5 100644 --- a/apps/editor/package.json +++ b/apps/editor/package.json @@ -4,7 +4,7 @@ "type": "module", "private": true, "scripts": { - "dev": "dotenv -e ../../.env.local -e ../../.env.defaults -- next dev", + "dev": "NODE_OPTIONS=--disable-warning=ExperimentalWarning dotenv -e ../../.env.local -e ../../.env.defaults -- next dev", "build": "dotenv -e ../../.env.local -- next build", "start": "next start", "smoke": "bun scripts/smoke-production-server.ts", diff --git a/bun.lock b/bun.lock index 82d33990f3..6bb4c27834 100644 --- a/bun.lock +++ b/bun.lock @@ -407,6 +407,7 @@ "three-bvh-csg@0.0.18": "patches/three-bvh-csg@0.0.18.patch", "three@0.187.0": "patches/three@0.187.0.patch", "iwer@2.3.0": "patches/iwer@2.3.0.patch", + "@react-three/drei@10.7.9": "patches/@react-three%2Fdrei@10.7.9.patch", }, "overrides": { "@hono/node-server": "^2.1.6", @@ -480,13 +481,13 @@ "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.6.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-UkT9BECNOXSiW6SGddjyaRACy362Sc9n3vDaTFkccL0bC2gW7JzM16i4+JKPbEaDn1Sa+oETHV8KungnI/y40Q=="], - "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.6.5", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-H9cVMWBqW/lkFK9NHJdt0bpM2q7PacUDEjQoff9+m0dCV09H/jmBykfTCkbDthHf8+jCuWDJWiQFJ7bDkiGOcA=="], + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.6.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-H9cVMWBqW/lkFK9NHJdt0bpM2q7PacUDEjQoff9+m0dCV09H/jmBykfTCkbDthHf8+jCuWDJWiQFJ7bDkiGOcA=="], - "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.6.5", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-kfc3AePW1a0/d/gUpcIz95nf3Ce8YY2/xL0Fk3fLqAhKsotqUi6PN6BaVWss4p6ijWbiuacZ9NQ4NiQtpjbYpw=="], + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.6.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-kfc3AePW1a0/d/gUpcIz95nf3Ce8YY2/xL0Fk3fLqAhKsotqUi6PN6BaVWss4p6ijWbiuacZ9NQ4NiQtpjbYpw=="], - "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.6.5", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-e6/WMSN/+FhH+ZOoBevps/euxFQmv6BXqYNuTn1+ITR6O4XYFjHF5PeVSNZnjkgSYmvhcDkfepSX5lXczMijGA=="], + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.6.5", "", { "os": "linux", "cpu": "x64" }, "sha512-e6/WMSN/+FhH+ZOoBevps/euxFQmv6BXqYNuTn1+ITR6O4XYFjHF5PeVSNZnjkgSYmvhcDkfepSX5lXczMijGA=="], - "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.6.5", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-0mHVpLNt7/FugfZ2VPugUIEIiooWIyHGGJUqU9StxamBln9hz+maXRFIECU50jaf5/ZB93veGIViN5VKgw2AEA=="], + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.6.5", "", { "os": "linux", "cpu": "x64" }, "sha512-0mHVpLNt7/FugfZ2VPugUIEIiooWIyHGGJUqU9StxamBln9hz+maXRFIECU50jaf5/ZB93veGIViN5VKgw2AEA=="], "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.6.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-uBbfpdR/cH5up1iRJFGAPP97xKMzrgMs685CSrY7NM+Q4Unw7chY0o3JulEvJdmU6c6hGQxwqotMq7DDH0DzxA=="], @@ -736,13 +737,13 @@ "@lingui/native-tools-darwin-x64": ["@lingui/native-tools-darwin-x64@0.2.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-n4G3GLcHKw5R56UzkKNFnm1ju/9nxBtPE40g+U+sUL4XUo6tPMX4J8b4yIE1dXYY6i5g7jQJm9Kvr/lIxibzOg=="], - "@lingui/native-tools-linux-arm64-gnu": ["@lingui/native-tools-linux-arm64-gnu@0.2.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-vmb7cuTr/vyfn5kgyO/0JkCuru9r8DFAkgJLTUsbG12NL0ti/PN+lJeflplUFEcRiWZryvCJ6UFNtMw65WX9GQ=="], + "@lingui/native-tools-linux-arm64-gnu": ["@lingui/native-tools-linux-arm64-gnu@0.2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-vmb7cuTr/vyfn5kgyO/0JkCuru9r8DFAkgJLTUsbG12NL0ti/PN+lJeflplUFEcRiWZryvCJ6UFNtMw65WX9GQ=="], - "@lingui/native-tools-linux-arm64-musl": ["@lingui/native-tools-linux-arm64-musl@0.2.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-Y3gEixa7EFIozkFVMp2KKDWn5aGYzxCFPBgEB1EtVXHj+VyPewc/Oo7xvXORpqD9u4vZQzuOYQJh6G6UVL9wnQ=="], + "@lingui/native-tools-linux-arm64-musl": ["@lingui/native-tools-linux-arm64-musl@0.2.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y3gEixa7EFIozkFVMp2KKDWn5aGYzxCFPBgEB1EtVXHj+VyPewc/Oo7xvXORpqD9u4vZQzuOYQJh6G6UVL9wnQ=="], - "@lingui/native-tools-linux-x64-gnu": ["@lingui/native-tools-linux-x64-gnu@0.2.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-5gmB+mQt/DtenAm8KV2b2RihXZwce1SjF+E/lytQWGWfe/6JHl+kqBWOmrc3uhuB76xInyRw3ui4gDut5oAQYA=="], + "@lingui/native-tools-linux-x64-gnu": ["@lingui/native-tools-linux-x64-gnu@0.2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-5gmB+mQt/DtenAm8KV2b2RihXZwce1SjF+E/lytQWGWfe/6JHl+kqBWOmrc3uhuB76xInyRw3ui4gDut5oAQYA=="], - "@lingui/native-tools-linux-x64-musl": ["@lingui/native-tools-linux-x64-musl@0.2.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-Y6E+9ZgW5y+8OyzpEdCJc+waRhNHv2i0h4ulU6xX7/GOOPnb3QpmRvOd6aCXkg6HwOy5SNJ/Rm8drQRJKei6qg=="], + "@lingui/native-tools-linux-x64-musl": ["@lingui/native-tools-linux-x64-musl@0.2.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Y6E+9ZgW5y+8OyzpEdCJc+waRhNHv2i0h4ulU6xX7/GOOPnb3QpmRvOd6aCXkg6HwOy5SNJ/Rm8drQRJKei6qg=="], "@lingui/native-tools-win32-arm64-msvc": ["@lingui/native-tools-win32-arm64-msvc@0.2.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-I/XzCL7eZaT4BSDMVKc+FBhCGPxecf1E0aR2YQshz9KMwmuubOfpqBw6ZjEEaggvZWO8cg+G0FP3v8U01m3JvQ=="], @@ -794,13 +795,13 @@ "@next/swc-darwin-x64": ["@next/swc-darwin-x64@16.4.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-uWq4qkHapBDS1oFltWS4YxTb9pLHAtLNcpbuK6SmRsebLYZqpBML/j/C0op+50JYGTpZgVL/DWNt/6oWlamrrw=="], - "@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.4.5", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-FdRcyOx5u5P51mlAqLB9EXdd8jZO5fsdHtk4BAQSkqOywCsbTNN/rmw+jO7pnmjNdAtu2AG46NzbCL2FPDrrgw=="], + "@next/swc-linux-arm64-gnu": ["@next/swc-linux-arm64-gnu@16.4.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-FdRcyOx5u5P51mlAqLB9EXdd8jZO5fsdHtk4BAQSkqOywCsbTNN/rmw+jO7pnmjNdAtu2AG46NzbCL2FPDrrgw=="], - "@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.4.5", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-cyvmmgtRXR8aGVT86wi9Py53IlfyCx7P2fZxuAXAoTummDnhKtUyjrMeXfapqp4qgD+gT5RqyGD/VfA16jEK7Q=="], + "@next/swc-linux-arm64-musl": ["@next/swc-linux-arm64-musl@16.4.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-cyvmmgtRXR8aGVT86wi9Py53IlfyCx7P2fZxuAXAoTummDnhKtUyjrMeXfapqp4qgD+gT5RqyGD/VfA16jEK7Q=="], - "@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.4.5", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-hPc+Fl+N22DAvqZHq559NmamXboOX5Lu8I5Wl0DezfrhTk1Zz21NQeYoZDmNI/NjTcrdsVxM72Fzn2lI+Q+vAw=="], + "@next/swc-linux-x64-gnu": ["@next/swc-linux-x64-gnu@16.4.5", "", { "os": "linux", "cpu": "x64" }, "sha512-hPc+Fl+N22DAvqZHq559NmamXboOX5Lu8I5Wl0DezfrhTk1Zz21NQeYoZDmNI/NjTcrdsVxM72Fzn2lI+Q+vAw=="], - "@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.4.5", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-gbACYE8IP/jlprNTpiWXHb8N9CofOzpnEwH2SrIz1dUbiJf1FbDssDupCAPeP1Taxe8mgG20sGZamJI7KFOdZw=="], + "@next/swc-linux-x64-musl": ["@next/swc-linux-x64-musl@16.4.5", "", { "os": "linux", "cpu": "x64" }, "sha512-gbACYE8IP/jlprNTpiWXHb8N9CofOzpnEwH2SrIz1dUbiJf1FbDssDupCAPeP1Taxe8mgG20sGZamJI7KFOdZw=="], "@next/swc-win32-arm64-msvc": ["@next/swc-win32-arm64-msvc@16.4.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-+8gj++ZMo8H20Xh2ijjNqyFk5LPLw0AC4Fs4Tq/G94rjjQXhOjN4jgSWsWKPFsyY26hfIeemJIwKtMxOsp5GBA=="], @@ -850,21 +851,21 @@ "@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.148.0", "", { "os": "linux", "cpu": "arm" }, "sha512-58ZKDw0mQRbCNfrd2IDyV4o8T7enzGERJn41BH2tjrZVGyiKiFzcfDicuB7Zcpb/1xIOrObovr8Dja6lZi8dLw=="], - "@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.148.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-Fnu95O4eZ5i++GPvIzBEZ8y4ddTLR+D9paYa8JRaRk6ZK7nHQiWP5xtrhcPQsXqgat1d7sU/d5rbbI0p1FTHSQ=="], + "@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.148.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Fnu95O4eZ5i++GPvIzBEZ8y4ddTLR+D9paYa8JRaRk6ZK7nHQiWP5xtrhcPQsXqgat1d7sU/d5rbbI0p1FTHSQ=="], - "@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.148.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-3CQy/BMdx7N7H3qrcPxUL+a2CwUZodUcf6oq8iJuNZ9C6Ol1aq3mcWzsgySJ7CHFLvpX21ZDPp1r1X0QLbu/AQ=="], + "@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.148.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-3CQy/BMdx7N7H3qrcPxUL+a2CwUZodUcf6oq8iJuNZ9C6Ol1aq3mcWzsgySJ7CHFLvpX21ZDPp1r1X0QLbu/AQ=="], - "@oxc-parser/binding-linux-ppc64-gnu": ["@oxc-parser/binding-linux-ppc64-gnu@0.148.0", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-9LkaYvfiF8hMOw900csAvkf1oxE8XlmMeGowu5BcastSSwV8mKvKRMNU7HsV+ycyj1dQD8pX5qgOw8ja6SJacg=="], + "@oxc-parser/binding-linux-ppc64-gnu": ["@oxc-parser/binding-linux-ppc64-gnu@0.148.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-9LkaYvfiF8hMOw900csAvkf1oxE8XlmMeGowu5BcastSSwV8mKvKRMNU7HsV+ycyj1dQD8pX5qgOw8ja6SJacg=="], - "@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.148.0", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-2GBiM9h26dR4WJfhoMvnFMnFLf7m/kYs4UMqjvrOfQG4BV1nuTJDH22Zc2MQr3INZF7nSKYQ6xlhD3hQ7A6gug=="], + "@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.148.0", "", { "os": "linux", "cpu": "none" }, "sha512-2GBiM9h26dR4WJfhoMvnFMnFLf7m/kYs4UMqjvrOfQG4BV1nuTJDH22Zc2MQr3INZF7nSKYQ6xlhD3hQ7A6gug=="], - "@oxc-parser/binding-linux-riscv64-musl": ["@oxc-parser/binding-linux-riscv64-musl@0.148.0", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-uPqZexvKJmEgq4mAu36qe2xTfXZE7oyik1R7KtZ5tl8qKlq1U1fIqTFRUEBZqRGvforoTrGIpatRzcoPKO66RA=="], + "@oxc-parser/binding-linux-riscv64-musl": ["@oxc-parser/binding-linux-riscv64-musl@0.148.0", "", { "os": "linux", "cpu": "none" }, "sha512-uPqZexvKJmEgq4mAu36qe2xTfXZE7oyik1R7KtZ5tl8qKlq1U1fIqTFRUEBZqRGvforoTrGIpatRzcoPKO66RA=="], - "@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.148.0", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-9oUHvnTbp7ZraFsTC8PN6XhdhPSSxZumYvixWl7Smi353gEULvK6yV0sXNVrdFMHQeaDKFCi8TgDhNK7/A+Y+Q=="], + "@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.148.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-9oUHvnTbp7ZraFsTC8PN6XhdhPSSxZumYvixWl7Smi353gEULvK6yV0sXNVrdFMHQeaDKFCi8TgDhNK7/A+Y+Q=="], - "@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.148.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-2qhDSJwKzbSZzF7lDqqk8sr/yXsmwr3PeUa4/nazIF+zFAYz1gVPEfC34GQtGxzJUUmklaYAL63368LEfrMeyw=="], + "@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.148.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2qhDSJwKzbSZzF7lDqqk8sr/yXsmwr3PeUa4/nazIF+zFAYz1gVPEfC34GQtGxzJUUmklaYAL63368LEfrMeyw=="], - "@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.148.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-qQoPDZUFV0bh9xA09XydmkjMBpgc1ukJuhMvzQ9QeVmFaHTS9W5TE5CoLmSl3QQyUP9OuHO3x/WPZTIIZPWR3Q=="], + "@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.148.0", "", { "os": "linux", "cpu": "x64" }, "sha512-qQoPDZUFV0bh9xA09XydmkjMBpgc1ukJuhMvzQ9QeVmFaHTS9W5TE5CoLmSl3QQyUP9OuHO3x/WPZTIIZPWR3Q=="], "@oxc-parser/binding-openharmony-arm64": ["@oxc-parser/binding-openharmony-arm64@0.148.0", "", { "os": "none", "cpu": "arm64" }, "sha512-1UGbaQWEXUCLqAmaR5kwRDjx/R4S5LQKZkM9CHmaHkuKhriOF32aRLfS0jCRNE2yGQJLMEA1z9UucbBVqjXnDw=="], @@ -890,21 +891,21 @@ "@oxc-resolver/binding-linux-arm-musleabihf": ["@oxc-resolver/binding-linux-arm-musleabihf@11.24.2", "", { "os": "linux", "cpu": "arm" }, "sha512-bnHAak3ujYfH5pKk4NieFNbvYvernfoQDgwLddbZ3OtMYrem87/qjlA+u+aKG0oZcqSLGCful/6/CEA+aeAgaA=="], - "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.24.2", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA=="], + "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA=="], - "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.24.2", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw=="], + "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw=="], - "@oxc-resolver/binding-linux-ppc64-gnu": ["@oxc-resolver/binding-linux-ppc64-gnu@11.24.2", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA=="], + "@oxc-resolver/binding-linux-ppc64-gnu": ["@oxc-resolver/binding-linux-ppc64-gnu@11.24.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA=="], - "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.24.2", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw=="], + "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw=="], - "@oxc-resolver/binding-linux-riscv64-musl": ["@oxc-resolver/binding-linux-riscv64-musl@11.24.2", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w=="], + "@oxc-resolver/binding-linux-riscv64-musl": ["@oxc-resolver/binding-linux-riscv64-musl@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w=="], - "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.24.2", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ=="], + "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.24.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ=="], - "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.24.2", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg=="], + "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg=="], - "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.24.2", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw=="], + "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw=="], "@oxc-resolver/binding-openharmony-arm64": ["@oxc-resolver/binding-openharmony-arm64@11.24.2", "", { "os": "none", "cpu": "arm64" }, "sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg=="], @@ -928,21 +929,21 @@ "@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.81.0", "", { "os": "linux", "cpu": "arm" }, "sha512-u3vna8KdGplH4DRCW9K54D68fcMo7IxVrkCJWwXnIhwtBdnDnYrmzOUA/XjmBlPpcLsgw9Z5BNdY4za9+Dj+MQ=="], - "@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.81.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-3j9k+gsYsE7nv71GWotXsqsa2l9/aJenD7dVHNt/CBvsb0SgRjSMnHFeP59IXUAl1wvVFhqGl2wJNMwWU3UBlA=="], + "@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.81.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-3j9k+gsYsE7nv71GWotXsqsa2l9/aJenD7dVHNt/CBvsb0SgRjSMnHFeP59IXUAl1wvVFhqGl2wJNMwWU3UBlA=="], - "@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.81.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-k5iAp3dNxW0/uDCBY+WSm8jKB2szu7SkEQZdgRRpDXvuDd69vvDcqhB3A/pWCfCwXyenjNjFn9Td1fVoyAc+Yg=="], + "@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.81.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-k5iAp3dNxW0/uDCBY+WSm8jKB2szu7SkEQZdgRRpDXvuDd69vvDcqhB3A/pWCfCwXyenjNjFn9Td1fVoyAc+Yg=="], - "@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.81.0", "", { "os": "linux", "cpu": "ppc64", "libc": "glibc" }, "sha512-TFqLja3uYmVSte6nof9GWrex9Z8WgdZrNiLC6Te5rXGDqXB2y4j/26iFhwosXiAFqDhE9JJVuuCkDKLwptTn1g=="], + "@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.81.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-TFqLja3uYmVSte6nof9GWrex9Z8WgdZrNiLC6Te5rXGDqXB2y4j/26iFhwosXiAFqDhE9JJVuuCkDKLwptTn1g=="], - "@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.81.0", "", { "os": "linux", "cpu": "none", "libc": "glibc" }, "sha512-UEcySvGS0NOVo7h7n7CYyJL9+6gFAh7Zc/ToDXVScFvzHSTIxtzkMVU30rmQ6+nQ1LF+UdiRDdJajpDu+OylLg=="], + "@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.81.0", "", { "os": "linux", "cpu": "none" }, "sha512-UEcySvGS0NOVo7h7n7CYyJL9+6gFAh7Zc/ToDXVScFvzHSTIxtzkMVU30rmQ6+nQ1LF+UdiRDdJajpDu+OylLg=="], - "@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.81.0", "", { "os": "linux", "cpu": "none", "libc": "musl" }, "sha512-H+diDbhD00+wI1IRP8Kz88x/lat+DgtoBJzoTthS16xkTJGNaEkfb8gzmd1rzc/2uDQQMl7GNl+JFUacVeWxIA=="], + "@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.81.0", "", { "os": "linux", "cpu": "none" }, "sha512-H+diDbhD00+wI1IRP8Kz88x/lat+DgtoBJzoTthS16xkTJGNaEkfb8gzmd1rzc/2uDQQMl7GNl+JFUacVeWxIA=="], - "@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.81.0", "", { "os": "linux", "cpu": "s390x", "libc": "glibc" }, "sha512-8znJ/5TekjOKg1j1Acho4PJMdiAHLtlcXuWEiipOhAMV6rQcXdmDdXCbheyDczN6TjBwiNfjcP81k4AthrKRzw=="], + "@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.81.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-8znJ/5TekjOKg1j1Acho4PJMdiAHLtlcXuWEiipOhAMV6rQcXdmDdXCbheyDczN6TjBwiNfjcP81k4AthrKRzw=="], - "@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.81.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-Q2Wj70yFsvn5QjlmifFzbj4H+kJy53bwqc41o1fzoM7MpLV1NIbhg/LpWXRfC6KOkSAdUx1Wd8VJsdPmhp/HRA=="], + "@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.81.0", "", { "os": "linux", "cpu": "x64" }, "sha512-Q2Wj70yFsvn5QjlmifFzbj4H+kJy53bwqc41o1fzoM7MpLV1NIbhg/LpWXRfC6KOkSAdUx1Wd8VJsdPmhp/HRA=="], - "@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.81.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-cPInHp/ddEe5qkyK2IiyQ8Q3Mp2oLLEhhsGgTK2oZx4L6+llGam1H1yBvJZ7qHfOXj8N3hxBS8sj4tO+gtFlIg=="], + "@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.81.0", "", { "os": "linux", "cpu": "x64" }, "sha512-cPInHp/ddEe5qkyK2IiyQ8Q3Mp2oLLEhhsGgTK2oZx4L6+llGam1H1yBvJZ7qHfOXj8N3hxBS8sj4tO+gtFlIg=="], "@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.81.0", "", { "os": "none", "cpu": "arm64" }, "sha512-0CQxSX4ajqm07AHBf5U33qQzXKdd7wtq/oTL/7vpY6RNNuxrRi8W4bqUV1Jyu/vj+9KmxQyDhxfeVX1nQL6kfg=="], @@ -1130,13 +1131,13 @@ "@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/oxide-linux-arm-gnueabihf@4.3.4", "", { "os": "linux", "cpu": "arm" }, "sha512-3aih/sRxzeYfi2Bkh+bGYNf2YU9Llamb2mpA7BNF1obYzdgEeWDAMQzK6BSwzLhs/eTdOaSur92qrGfchagUtQ=="], - "@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-ktJSrPGQou4OqL88rDEx5CkeM9BjzrwZvYo8u7B7VL1zkBa2XBm351o4MQrek95qikb2M++26Y7w7vbH6Mgl8g=="], + "@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.3.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-ktJSrPGQou4OqL88rDEx5CkeM9BjzrwZvYo8u7B7VL1zkBa2XBm351o4MQrek95qikb2M++26Y7w7vbH6Mgl8g=="], - "@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.3.4", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-rt3hjUxT7utAtcB+df6wHyaXDyxhE7Zd1x7L/nvB5Jb2qBb8dZwFUoWqeRja1BaF5OlSqkKSjBmVXj9OsevmCQ=="], + "@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.3.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-rt3hjUxT7utAtcB+df6wHyaXDyxhE7Zd1x7L/nvB5Jb2qBb8dZwFUoWqeRja1BaF5OlSqkKSjBmVXj9OsevmCQ=="], - "@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.3.4", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-XE3jO2yOOWjttpeGvpwf3/b274NMi3QapQSAI/EzsgrmYNan1Tw8dXT9JQkN7K0OgvuqiC8mcCyNvGzEkpVJPQ=="], + "@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.3.4", "", { "os": "linux", "cpu": "x64" }, "sha512-XE3jO2yOOWjttpeGvpwf3/b274NMi3QapQSAI/EzsgrmYNan1Tw8dXT9JQkN7K0OgvuqiC8mcCyNvGzEkpVJPQ=="], - "@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.3.4", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-PaAZ2FjJaZk9SQLYtKIfQWiFm/xtl7pX2MKPgCzn0mS/VU54yu+vP457AJdB2XFLxU3gO2abLCt8N7Lg4EbKNg=="], + "@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.3.4", "", { "os": "linux", "cpu": "x64" }, "sha512-PaAZ2FjJaZk9SQLYtKIfQWiFm/xtl7pX2MKPgCzn0mS/VU54yu+vP457AJdB2XFLxU3gO2abLCt8N7Lg4EbKNg=="], "@tailwindcss/oxide-wasm32-wasi": ["@tailwindcss/oxide-wasm32-wasi@4.3.4", "", { "dependencies": { "@emnapi/core": "^1.11.3", "@emnapi/runtime": "^1.11.3", "@emnapi/wasi-threads": "^1.2.3", "@napi-rs/wasm-runtime": "^1.2.2", "@tybys/wasm-util": "^0.10.3", "tslib": "^2.8.1" } }, "sha512-bjO9WmoM687p8AoCIyw1DUqzpAs4JICLvNmIPxIWDmhw8IOsdubtWQLShyJmISnDKtRy1BBApHVOUl6sNFQQJA=="], @@ -1848,13 +1849,13 @@ "lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.33.0", "", { "os": "linux", "cpu": "arm" }, "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ=="], - "lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.33.0", "", { "os": "linux", "cpu": "arm64", "libc": "glibc" }, "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg=="], + "lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg=="], - "lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.33.0", "", { "os": "linux", "cpu": "arm64", "libc": "musl" }, "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ=="], + "lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.33.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ=="], - "lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.33.0", "", { "os": "linux", "cpu": "x64", "libc": "glibc" }, "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg=="], + "lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg=="], - "lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.33.0", "", { "os": "linux", "cpu": "x64", "libc": "musl" }, "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw=="], + "lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.33.0", "", { "os": "linux", "cpu": "x64" }, "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw=="], "lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.33.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA=="], diff --git a/package.json b/package.json index dd0033f5eb..874a36d098 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "build": "turbo run build", "dev": "dotenv -e ./.env -e ./.env.defaults -- turbo run dev --env-mode=loose", + "dev:fast": "NODE_OPTIONS=--disable-warning=ExperimentalWarning dotenv -e ./.env -e ./.env.defaults -- bun --cwd apps/editor dev", "lint": "biome lint", "lints": "bun run lint", "lint:fix": "biome lint --write", @@ -90,6 +91,7 @@ "patchedDependencies": { "iwer@2.3.0": "patches/iwer@2.3.0.patch", "three-bvh-csg@0.0.18": "patches/three-bvh-csg@0.0.18.patch", - "three@0.187.0": "patches/three@0.187.0.patch" + "three@0.187.0": "patches/three@0.187.0.patch", + "@react-three/drei@10.7.9": "patches/@react-three%2Fdrei@10.7.9.patch" } } diff --git a/packages/editor/package.json b/packages/editor/package.json index d383b20a50..3dae30ea30 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -8,6 +8,7 @@ ".": "./src/index.tsx", "./catalog": "./src/components/ui/item-catalog/catalog-items.tsx", "./locales": "./src/i18n/locales.ts", + "./locales/lazy": "./src/i18n/lazy-locales.ts", "./locales/pseudo": "./src/i18n/pseudo-locale.ts", "./procedural-items": "./src/components/procedural-items/inspector.tsx", "./distribution": "./src/components/tools/distribution/distribution-public.ts" diff --git a/packages/editor/src/components/editor/export-manager.tsx b/packages/editor/src/components/editor/export-manager.tsx index 74d837c929..e5778a39aa 100644 --- a/packages/editor/src/components/editor/export-manager.tsx +++ b/packages/editor/src/components/editor/export-manager.tsx @@ -5,29 +5,9 @@ import { disposeObject3DResources, snapLevelsToTruePositions, useViewer } from ' import { useThree } from '@react-three/fiber' import { useEffect } from 'react' import * as THREE from 'three' -import { OBJExporter } from 'three/examples/jsm/exporters/OBJExporter.js' -import { STLExporter } from 'three/examples/jsm/exporters/STLExporter.js' import { downloadProjectFile } from '../../lib/download-project-file' -import { - exportSceneToGlb, - prepareSceneForExport, - waitForExportGeometry, -} from '../../lib/glb-export' -import { exportPreparedSceneToIfc, ifcFileName } from '../../lib/ifc-export' -import { exportSceneLevelsForPrint } from '../../lib/level-print-export' import type { ModelExport, ModelExportArtifact } from '../../lib/model-export' -import { - expandInstancedMeshes, - fixReflectedMeshWinding, - freezeDeformedMeshes, -} from '../../lib/portable-export' -import { exportSceneToPrint3mf } from '../../lib/print-3mf' -import { filterPreparedSceneForPrintContent } from '../../lib/print-content-scope' -import { exportSceneToPrintStl, mergePrintExportDiagnostics } from '../../lib/print-export' -import { applySemanticPrintFeatureThickness } from '../../lib/print-feature-thickness' -import { compileSemanticPrintShellWithManifold } from '../../lib/print-shell-compiler-manifold-worker' import { getSavedSceneDocument } from '../../lib/scene' -import { exportSceneToUsdz } from '../../lib/usdz-export' import useEditor from '../../store/use-editor' // prepareSceneForExport neutralises container meshes (door/window hitbox roots, @@ -72,6 +52,12 @@ export function ExportManager() { const date = new Date().toISOString().split('T')[0] + // Load heavy format exporters dynamically so IFC, GLB, USDZ, STL, OBJ, + // 3MF, and Manifold print compilers are never bundled on editor startup. + const { exportSceneToGlb, prepareSceneForExport, waitForExportGeometry } = await import( + '../../lib/glb-export' + ) + // Signal export so instanced kinds (trees/flowers/grass) swap their // invisible proxy for real, exportable geometry, then wait for the // commit before cloning the scene graph (same dance as BakeExporter — @@ -92,6 +78,7 @@ export function ExportManager() { } if (format === 'usdz') { + const { exportSceneToUsdz } = await import('../../lib/usdz-export') const warnings: string[] = [] const data = await exportSceneToUsdz(sceneGroup, nodes, { ...options, @@ -122,9 +109,14 @@ export function ExportManager() { const printContent = options.printContent ?? 'structure' const isPrintFormat = format === 'print-stl' || format === 'print-3mf' if (isPrintFormat) { + const { filterPreparedSceneForPrintContent } = await import( + '../../lib/print-content-scope' + ) exportScene = filterPreparedSceneForPrintContent(exportScene, nodes, printContent) } if (!isPrintFormat) { + const { expandInstancedMeshes, fixReflectedMeshWinding, freezeDeformedMeshes } = + await import('../../lib/portable-export') expandInstancedMeshes(exportScene) exportScene.updateMatrixWorld(true) freezeDeformedMeshes(exportScene) @@ -133,6 +125,11 @@ export function ExportManager() { ensurePositionAttributes(exportScene) if (isPrintFormat) { + const [{ compileSemanticPrintShellWithManifold }, { exportSceneLevelsForPrint }] = + await Promise.all([ + import('../../lib/print-shell-compiler-manifold-worker'), + import('../../lib/level-print-export'), + ]) const printFormat = format === 'print-3mf' ? '3mf' : 'stl' const scale = options.printScale ?? 100 const compileShells = printContent === 'structure' @@ -170,6 +167,13 @@ export function ExportManager() { ? await compileSemanticPrintShellWithManifold(exportScene, nodes) : null try { + const [ + { exportSceneToPrintStl, mergePrintExportDiagnostics }, + { applySemanticPrintFeatureThickness }, + ] = await Promise.all([ + import('../../lib/print-export'), + import('../../lib/print-feature-thickness'), + ]) const printSource = compiled ? (compiled.scene ?? new THREE.Group()) : exportScene const printOptions = { scale, @@ -178,7 +182,10 @@ export function ExportManager() { } const output = printFormat === '3mf' - ? exportSceneToPrint3mf(printSource, printOptions) + ? (await import('../../lib/print-3mf')).exportSceneToPrint3mf( + printSource, + printOptions, + ) : exportSceneToPrintStl(printSource, printOptions) let report = compiled ? mergePrintExportDiagnostics( @@ -211,6 +218,7 @@ export function ExportManager() { } if (format === 'stl') { + const { STLExporter } = await import('three/examples/jsm/exporters/STLExporter.js') const exporter = new STLExporter() const result = exporter.parse(exportScene, { binary: true }) const blob = new Blob([result], { type: 'model/stl' }) @@ -218,6 +226,7 @@ export function ExportManager() { } if (format === 'ifc') { + const { exportPreparedSceneToIfc, ifcFileName } = await import('../../lib/ifc-export') const { data, warnings } = exportPreparedSceneToIfc(exportScene, nodes, { collections, projectName: options.projectName, @@ -235,6 +244,7 @@ export function ExportManager() { } if (format === 'obj') { + const { OBJExporter } = await import('three/examples/jsm/exporters/OBJExporter.js') const exporter = new OBJExporter() const result = exporter.parse(exportScene) const blob = new Blob([result], { type: 'model/obj' }) diff --git a/packages/editor/src/components/editor/index.tsx b/packages/editor/src/components/editor/index.tsx index d1b77a194e..272236c834 100644 --- a/packages/editor/src/components/editor/index.tsx +++ b/packages/editor/src/components/editor/index.tsx @@ -50,10 +50,12 @@ import { } from '@pascal-app/viewer/ui' import { type CSSProperties, + lazy, memo, Profiler, type ProfilerOnRenderCallback, type ReactNode, + Suspense, useCallback, useEffect, useLayoutEffect, @@ -129,11 +131,9 @@ import { DeleteConfirmationDialog } from './delete-confirmation-dialog' import { EditorLayoutV2 } from './editor-layout-v2' import { ExportManager } from './export-manager' import { FenceTangentLines3D } from './fence-tangent-lines-3d' -import { FirstPersonControls, FirstPersonOverlay } from './first-person-controls' import { FloatingActionMenu } from './floating-action-menu' import { FloatingBuildingActionMenu } from './floating-building-action-menu' import { FloorplanModeCoordinator } from './floorplan-mode-coordinator' -import { FloorplanPanel } from './floorplan-panel' import { FollowPascal } from './follow-pascal' import { FootprintHeightHandle } from './footprint-height-handle' import { Grid } from './grid' @@ -143,12 +143,10 @@ import { GroupSelectionBox3D } from './group-selection-box-3d' import { EditorHandleHitPriority } from './handles/handle-hit-priority' import { NodeArrowHandles } from './node-arrow-handles' import { QuickMeasurementHud } from './quick-measurement-hud' -import { RiserDiagramPanel } from './riser-diagram-panel' import { RoomLabels3D } from './room-labels' import { SelectionManager } from './selection-manager' import { SiteEdgeLabels } from './site-edge-labels' import { SlabHoleHighlights } from './slab-hole-highlights' -import { SnapshotCaptureOverlay } from './snapshot-capture-overlay' import { type SnapshotCameraData, ThumbnailGenerator } from './thumbnail-generator' import { VectorEdgeExtractor } from './vector-edge-extractor' import { HostView } from './views/host-view' @@ -159,6 +157,41 @@ import { WallMoveSideHandles } from './wall-move-side-handles' import { WallOpeningHighlights } from './wall-opening-highlights' import { WallRegionHandles } from './wall-region-handles' +const LazyFloorplanPanel = lazy(async () => { + const mod = await import('./floorplan-panel') + return { default: mod.FloorplanPanel } +}) + +const LazyFirstPersonControls = lazy(async () => { + const mod = await import('./first-person-controls') + return { default: mod.FirstPersonControls } +}) + +const LazyFirstPersonOverlay = lazy(async () => { + const mod = await import('./first-person-controls') + return { default: mod.FirstPersonOverlay } +}) + +const LazyRiserDiagramPanel = lazy(async () => { + const mod = await import('./riser-diagram-panel') + return { default: mod.RiserDiagramPanel } +}) + +const LazySnapshotCaptureOverlay = lazy(async () => { + const mod = await import('./snapshot-capture-overlay') + return { default: mod.SnapshotCaptureOverlay } +}) + +function LazyRiserDiagramGate() { + const isOpen = useEditor((s) => s.isRiserOpen) + if (!isOpen) return null + return ( + + + + ) +} + const CAMERA_CONTROLS_HINT_DISMISSED_STORAGE_KEY = 'editor-camera-controls-hint-dismissed:v1' const PREVIEW_STAGE_SWITCHER_POSITION = 'top-28 right-4 left-auto translate-x-0 md:top-4 md:right-auto md:left-1/2 md:-translate-x-1/2' @@ -993,7 +1026,11 @@ const ViewerSceneContent = memo(function ViewerSceneContent({ {!(isLoading || isFirstPersonMode) && } {!(isLoading || noEditing) && } - {isFirstPersonMode && } + {isFirstPersonMode && ( + + + + )} {isCaptureMode && !isXRMode && } {!isXRMode && } {!isXRMode && } @@ -1368,7 +1405,12 @@ const ViewerCanvas = memo(function ViewerCanvas({ style={paneStyle(pane2d)} >
- + + +
{isSceneDataLoading && loadingOverlay} @@ -1522,7 +1564,9 @@ function PreviewStage({ return (
{isFirstPersonMode ? ( - useEditor.getState().setFirstPersonMode(false)} /> + + useEditor.getState().setFirstPersonMode(false)} /> + ) : ( - {isFirstPersonMode && } + {isFirstPersonMode && ( + + + + )} @@ -2099,12 +2147,18 @@ function EditorContent({ owns the framing chrome — the walkthrough HUD would both clutter the frame and offer a second, conflicting exit. */} {isFirstPersonMode && !isCaptureMode && ( - useEditor.getState().setFirstPersonMode(false)} - /> + + useEditor.getState().setFirstPersonMode(false)} + /> + )} {viewerBanner} - {projectId ? : null} + {projectId && isCaptureMode ? ( + + + + ) : null} } renderTabContent={renderTabContent} @@ -2173,9 +2227,13 @@ function EditorContent({ inspector={} reserveBottomMenu={actionMenuPlacement !== 'top' || isMobile} /> - + {isFirstPersonMode && ( - useEditor.getState().setFirstPersonMode(false)} /> + + useEditor.getState().setFirstPersonMode(false)} + /> + )} diff --git a/packages/editor/src/i18n/lazy-locales.ts b/packages/editor/src/i18n/lazy-locales.ts new file mode 100644 index 0000000000..66462a3aa1 --- /dev/null +++ b/packages/editor/src/i18n/lazy-locales.ts @@ -0,0 +1,56 @@ +import { type CompiledTranslationMessages, registerCompiledMessages } from '@pascal-app/core' +import type { BundledLocale } from './locales' +import { messages as en } from './locales/en/messages' + +const loadedLocales = new Set() + +function resolveBundledLocale(locale: string): BundledLocale | null { + const normalized = locale.trim().toLowerCase() + if (normalized === 'en-xa') return null + if (!normalized || normalized === 'en' || normalized.startsWith('en-')) return 'en' + if (normalized === 'es' || normalized.startsWith('es-')) return 'es' + if (normalized === 'fr' || normalized.startsWith('fr-')) return 'fr' + if (normalized === 'ja' || normalized.startsWith('ja-')) return 'ja' + if (normalized === 'zh-cn' || normalized === 'zh-hans' || normalized === 'zh') return 'zh-CN' + return null +} + +export function registerEnglishLocale(): void { + if (loadedLocales.has('en')) return + loadedLocales.add('en') + registerCompiledMessages('en', '', en) +} + +export async function loadBundledLocale( + locale: string, +): Promise<{ locale: BundledLocale; messages: CompiledTranslationMessages } | null> { + const target = resolveBundledLocale(locale) + if (!target) return null + if (target === 'en') { + registerEnglishLocale() + return { locale: 'en', messages: en } + } + + let messages: CompiledTranslationMessages + switch (target) { + case 'es': + messages = (await import('./locales/es/messages')).messages + break + case 'fr': + messages = (await import('./locales/fr/messages')).messages + break + case 'ja': + messages = (await import('./locales/ja/messages')).messages + break + case 'zh-CN': + messages = (await import('./locales/zh-CN/messages')).messages + break + } + + if (!loadedLocales.has(target)) { + loadedLocales.add(target) + registerCompiledMessages(target, '', messages) + } + + return { locale: target, messages } +} diff --git a/packages/editor/src/i18n/pseudo-locale.ts b/packages/editor/src/i18n/pseudo-locale.ts index 64dfb4d682..be43fd1c0a 100644 --- a/packages/editor/src/i18n/pseudo-locale.ts +++ b/packages/editor/src/i18n/pseudo-locale.ts @@ -2,6 +2,7 @@ import { registerCompiledMessages } from '@pascal-app/core' import { messages } from './locales/en-XA/messages' export const PSEUDO_LOCALE = 'en-XA' +export { messages as pseudoLocaleMessages } let registered = false diff --git a/patches/@react-three%2Fdrei@10.7.9.patch b/patches/@react-three%2Fdrei@10.7.9.patch new file mode 100644 index 0000000000..f662f85eb5 --- /dev/null +++ b/patches/@react-three%2Fdrei@10.7.9.patch @@ -0,0 +1,49 @@ +diff --git a/node_modules/@react-three/drei/.bun-tag-8c743fa635519adc b/.bun-tag-8c743fa635519adc +new file mode 100644 +index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 +diff --git a/web/Html.cjs.js b/web/Html.cjs.js +index 7250449db39008210e5bc45eccc4e7903a53c58a..49086aebfe839928aaec59de56a685493ce9f52c 100644 +--- a/web/Html.cjs.js ++++ b/web/Html.cjs.js +@@ -1 +1 @@ +-"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("react-dom/client"),n=require("three"),o=require("@react-three/fiber");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=i(e),c=s(t),l=s(r);const u=new n.Vector3,d=new n.Vector3,m=new n.Vector3,f=new n.Vector2;function h(e,t,r){const n=u.setFromMatrixPosition(e.matrixWorld);n.project(t);const o=r.width/2,i=r.height/2;return[n.x*o+o,-n.y*i+i]}const p=e=>Math.abs(e)<1e-10?0:e;function x(e,t,r=""){let n="matrix3d(";for(let r=0;16!==r;r++)n+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+n}const v=(y=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>x(e,y));var y;const g=(e,t)=>{return x(e,[1/(r=t),1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1],"translate(-50%,-50%)");var r};const M=c.forwardRef((({children:e,eps:t=.001,style:r,className:i,prepend:s,center:x,fullscreen:y,portal:M,distanceFactor:b,sprite:P=!1,transform:w=!1,occlude:E,onOcclude:W,castShadow:S,receiveShadow:$,material:j,geometry:z,zIndexRange:O=[16777271,0],calculatePosition:R=h,as:F="div",wrapperClass:C,pointerEvents:T="auto",...I},A)=>{const{gl:k,camera:H,scene:N,size:V,raycaster:_,events:q,viewport:L}=o.useThree(),[D]=c.useState((()=>document.createElement(F))),G=c.useRef(null),Z=c.useRef(null),B=c.useRef(0),J=c.useRef([0,0]),K=c.useRef(null),Q=c.useRef(null),U=(null==M?void 0:M.current)||q.connected||k.domElement.parentNode,X=c.useRef(null),Y=c.useRef(!1),ee=c.useMemo((()=>E&&"blending"!==E||Array.isArray(E)&&E.length&&function(e){return e&&"object"==typeof e&&"current"in e}(E[0])),[E]);c.useLayoutEffect((()=>{const e=k.domElement;E&&"blending"===E?(e.style.zIndex=`${Math.floor(O[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)}),[E]),c.useLayoutEffect((()=>{if(Z.current){const e=G.current=l.createRoot(D);if(N.updateMatrixWorld(),w)D.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const e=R(Z.current,H,V);D.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return U&&(s?U.prepend(D):U.appendChild(D)),()=>{U&&U.removeChild(D),e.unmount()}}}),[U,w]),c.useLayoutEffect((()=>{C&&(D.className=C)}),[C]);const te=c.useMemo((()=>w?{position:"absolute",top:0,left:0,width:V.width,height:V.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...y&&{top:-V.height/2,left:-V.width/2,width:V.width,height:V.height},...r}),[r,x,y,V,w]),re=c.useMemo((()=>({position:"absolute",pointerEvents:T})),[T]);c.useLayoutEffect((()=>{var t,n;(Y.current=!1,w)?null==(t=G.current)||t.render(c.createElement("div",{ref:K,style:te},c.createElement("div",{ref:Q,style:re},c.createElement("div",{ref:A,className:i,style:r,children:e})))):null==(n=G.current)||n.render(c.createElement("div",{ref:A,style:te,className:i,children:e}))}));const ne=c.useRef(!0);o.useFrame((e=>{if(Z.current){H.updateMatrixWorld(),Z.current.updateWorldMatrix(!0,!1);const e=w?J.current:R(Z.current,H,V);if(w||Math.abs(B.current-H.zoom)>t||Math.abs(J.current[0]-e[0])>t||Math.abs(J.current[1]-e[1])>t){const t=function(e,t){const r=u.setFromMatrixPosition(e.matrixWorld),n=d.setFromMatrixPosition(t.matrixWorld),o=r.sub(n),i=t.getWorldDirection(m);return o.angleTo(i)>Math.PI/2}(Z.current,H);let r=!1;ee&&(Array.isArray(E)?r=E.map((e=>e.current)):"blending"!==E&&(r=[N]));const o=ne.current;if(r){const e=function(e,t,r,n){const o=u.setFromMatrixPosition(e.matrixWorld),i=o.clone();i.project(t),f.set(i.x,i.y),r.setFromCamera(f,t);const s=r.intersectObjects(n,!0);if(s.length){const e=s[0].distance;return o.distanceTo(r.ray.origin)({vertexShader:w?void 0:'\n /*\n This shader is from the THREE\'s SpriteMaterial.\n We need to turn the backing plane into a Sprite\n (make it always face the camera) if "transfrom"\n is false.\n */\n #include \n\n void main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n // This is somewhat arbitrary, but it seems to work well\n // Need to figure out how to derive this dynamically if it even matters\n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n }\n ',fragmentShader:"\n void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n "})),[w]);return c.createElement("group",a.default({},I,{ref:Z}),E&&!ee&&c.createElement("mesh",{castShadow:S,receiveShadow:$,ref:X},z||c.createElement("planeGeometry",null),j||c.createElement("shaderMaterial",{side:n.DoubleSide,vertexShader:oe.vertexShader,fragmentShader:oe.fragmentShader})))}));exports.Html=M; ++"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),r=require("react-dom/client"),n=require("three"),o=require("@react-three/fiber");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=i(e),c=s(t),l=s(r);const u=new n.Vector3,d=new n.Vector3,m=new n.Vector3,f=new n.Vector2;function h(e,t,r){const n=u.setFromMatrixPosition(e.matrixWorld);n.project(t);const o=r.width/2,i=r.height/2;return[n.x*o+o,-n.y*i+i]}const p=e=>Math.abs(e)<1e-10?0:e;function x(e,t,r=""){let n="matrix3d(";for(let r=0;16!==r;r++)n+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+n}const v=(y=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>x(e,y));var y;const g=(e,t)=>{return x(e,[1/(r=t),1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1],"translate(-50%,-50%)");var r};const M=c.forwardRef((({children:e,eps:t=.001,style:r,className:i,prepend:s,center:x,fullscreen:y,portal:M,distanceFactor:b,sprite:P=!1,transform:w=!1,occlude:E,onOcclude:W,castShadow:S,receiveShadow:$,material:j,geometry:z,zIndexRange:O=[16777271,0],calculatePosition:R=h,as:F="div",wrapperClass:C,pointerEvents:T="auto",...I},A)=>{const{gl:k,camera:H,scene:N,size:V,raycaster:_,events:q,viewport:L}=o.useThree(),[D]=c.useState((()=>document.createElement(F))),G=c.useRef(null),_up=c.useRef(!1),Z=c.useRef(null),B=c.useRef(0),J=c.useRef([0,0]),K=c.useRef(null),Q=c.useRef(null),U=(null==M?void 0:M.current)||q.connected||k.domElement.parentNode,X=c.useRef(null),Y=c.useRef(!1),ee=c.useMemo((()=>E&&"blending"!==E||Array.isArray(E)&&E.length&&function(e){return e&&"object"==typeof e&&"current"in e}(E[0])),[E]);c.useLayoutEffect((()=>{const e=k.domElement;E&&"blending"===E?(e.style.zIndex=`${Math.floor(O[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)}),[E]),c.useLayoutEffect((()=>{if(Z.current){_up.current=!1;const e=G.current||(G.current=l.createRoot(D));if(N.updateMatrixWorld(),w)D.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const e=R(Z.current,H,V);D.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return U&&(s?U.prepend(D):U.appendChild(D)),()=>{U&&D.parentNode===U&&U.removeChild(D),_up.current=!0,queueMicrotask((()=>{_up.current&&G.current===e&&(G.current=null,e.unmount())}))}}}),[U,w]),c.useLayoutEffect((()=>{C&&(D.className=C)}),[C]);const te=c.useMemo((()=>w?{position:"absolute",top:0,left:0,width:V.width,height:V.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...y&&{top:-V.height/2,left:-V.width/2,width:V.width,height:V.height},...r}),[r,x,y,V,w]),re=c.useMemo((()=>({position:"absolute",pointerEvents:T})),[T]);c.useLayoutEffect((()=>{var t,n;(Y.current=!1,w)?null==(t=G.current)||t.render(c.createElement("div",{ref:K,style:te},c.createElement("div",{ref:Q,style:re},c.createElement("div",{ref:A,className:i,style:r,children:e})))):null==(n=G.current)||n.render(c.createElement("div",{ref:A,style:te,className:i,children:e}))}));const ne=c.useRef(!0);o.useFrame((e=>{if(Z.current){H.updateMatrixWorld(),Z.current.updateWorldMatrix(!0,!1);const e=w?J.current:R(Z.current,H,V);if(w||Math.abs(B.current-H.zoom)>t||Math.abs(J.current[0]-e[0])>t||Math.abs(J.current[1]-e[1])>t){const t=function(e,t){const r=u.setFromMatrixPosition(e.matrixWorld),n=d.setFromMatrixPosition(t.matrixWorld),o=r.sub(n),i=t.getWorldDirection(m);return o.angleTo(i)>Math.PI/2}(Z.current,H);let r=!1;ee&&(Array.isArray(E)?r=E.map((e=>e.current)):"blending"!==E&&(r=[N]));const o=ne.current;if(r){const e=function(e,t,r,n){const o=u.setFromMatrixPosition(e.matrixWorld),i=o.clone();i.project(t),f.set(i.x,i.y),r.setFromCamera(f,t);const s=r.intersectObjects(n,!0);if(s.length){const e=s[0].distance;return o.distanceTo(r.ray.origin)({vertexShader:w?void 0:'\n /*\n This shader is from the THREE\'s SpriteMaterial.\n We need to turn the backing plane into a Sprite\n (make it always face the camera) if "transfrom"\n is false.\n */\n #include \n\n void main() {\n vec2 center = vec2(0., 1.);\n float rotation = 0.0;\n\n // This is somewhat arbitrary, but it seems to work well\n // Need to figure out how to derive this dynamically if it even matters\n float size = 0.03;\n\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n }\n ',fragmentShader:"\n void main() {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n "})),[w]);return c.createElement("group",a.default({},I,{ref:Z}),E&&!ee&&c.createElement("mesh",{castShadow:S,receiveShadow:$,ref:X},z||c.createElement("planeGeometry",null),j||c.createElement("shaderMaterial",{side:n.DoubleSide,vertexShader:oe.vertexShader,fragmentShader:oe.fragmentShader})))}));exports.Html=M; +diff --git a/web/Html.js b/web/Html.js +index 81d68b7f4e9893a7d0b436a398bb38883d333374..caacb439c265a92c1737e3253f45b75bddae1e41 100644 +--- a/web/Html.js ++++ b/web/Html.js +@@ -114,6 +114,7 @@ const Html = /* @__PURE__ */React.forwardRef(({ + } = useThree(); + const [el] = React.useState(() => document.createElement(as)); + const root = React.useRef(null); ++ const unmountPending = React.useRef(false); + const group = React.useRef(null); + const oldZoom = React.useRef(0); + const oldPosition = React.useRef([0, 0]); +@@ -140,7 +141,8 @@ const Html = /* @__PURE__ */React.forwardRef(({ + }, [occlude]); + React.useLayoutEffect(() => { + if (group.current) { +- const currentRoot = root.current = ReactDOM.createRoot(el); ++ unmountPending.current = false; ++ const currentRoot = root.current || (root.current = ReactDOM.createRoot(el)); + scene.updateMatrixWorld(); + if (transform) { + el.style.cssText = `position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;`; +@@ -152,8 +154,14 @@ const Html = /* @__PURE__ */React.forwardRef(({ + if (prepend) target.prepend(el);else target.appendChild(el); + } + return () => { +- if (target) target.removeChild(el); +- currentRoot.unmount(); ++ if (target && el.parentNode === target) target.removeChild(el); ++ unmountPending.current = true; ++ queueMicrotask(() => { ++ if (unmountPending.current && root.current === currentRoot) { ++ root.current = null; ++ currentRoot.unmount(); ++ } ++ }); + }; + } + }, [target, transform]); From d3009a674579d74c22a031f445df0ad6536b0816 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Wed, 18 Nov 2026 08:45:13 +0100 Subject: [PATCH 4/7] fix(editor,nodes): resolve Bugbot split-view sync, lazy floorplan adoption, and first-person UI issues --- .../src/components/editor/floorplan-panel.tsx | 9 ++-- .../editor/src/components/editor/index.tsx | 41 ++++------------- .../nodes/src/wall/tool-chaining.test.tsx | 44 +++++++++++++++++++ packages/nodes/src/wall/tool.tsx | 2 + 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/packages/editor/src/components/editor/floorplan-panel.tsx b/packages/editor/src/components/editor/floorplan-panel.tsx index 1a70e53a89..a6562568c3 100644 --- a/packages/editor/src/components/editor/floorplan-panel.tsx +++ b/packages/editor/src/components/editor/floorplan-panel.tsx @@ -5146,14 +5146,17 @@ export function FloorplanPanel({ // subscription stays dormant there. useEffect(() => { if (!(mode === 'build' && tool === 'wall')) return - return useSegmentDraftChain.subscribe((state, previousState) => { - const next = state.wall - if (next === previousState.wall) return + const adopt = (next: WallPlanPoint | null) => { if (!next) return setDraftStart((current) => current && current[0] === next[0] && current[1] === next[1] ? current : next, ) setWallChainFirstVertex((current) => current ?? next) + } + adopt(useSegmentDraftChain.getState().wall) + return useSegmentDraftChain.subscribe((state, previousState) => { + if (state.wall === previousState.wall) return + adopt(state.wall) }) }, [mode, tool]) // Direction of the run's last wall (a pulled run's source first): the next diff --git a/packages/editor/src/components/editor/index.tsx b/packages/editor/src/components/editor/index.tsx index 272236c834..421b106071 100644 --- a/packages/editor/src/components/editor/index.tsx +++ b/packages/editor/src/components/editor/index.tsx @@ -131,6 +131,7 @@ import { DeleteConfirmationDialog } from './delete-confirmation-dialog' import { EditorLayoutV2 } from './editor-layout-v2' import { ExportManager } from './export-manager' import { FenceTangentLines3D } from './fence-tangent-lines-3d' +import { FirstPersonControls, FirstPersonOverlay } from './first-person-controls' import { FloatingActionMenu } from './floating-action-menu' import { FloatingBuildingActionMenu } from './floating-building-action-menu' import { FloorplanModeCoordinator } from './floorplan-mode-coordinator' @@ -162,16 +163,6 @@ const LazyFloorplanPanel = lazy(async () => { return { default: mod.FloorplanPanel } }) -const LazyFirstPersonControls = lazy(async () => { - const mod = await import('./first-person-controls') - return { default: mod.FirstPersonControls } -}) - -const LazyFirstPersonOverlay = lazy(async () => { - const mod = await import('./first-person-controls') - return { default: mod.FirstPersonOverlay } -}) - const LazyRiserDiagramPanel = lazy(async () => { const mod = await import('./riser-diagram-panel') return { default: mod.RiserDiagramPanel } @@ -1026,11 +1017,7 @@ const ViewerSceneContent = memo(function ViewerSceneContent({ {!(isLoading || isFirstPersonMode) && } {!(isLoading || noEditing) && } - {isFirstPersonMode && ( - - - - )} + {isFirstPersonMode && } {isCaptureMode && !isXRMode && } {!isXRMode && } {!isXRMode && } @@ -1564,9 +1551,7 @@ function PreviewStage({ return (
{isFirstPersonMode ? ( - - useEditor.getState().setFirstPersonMode(false)} /> - + useEditor.getState().setFirstPersonMode(false)} /> ) : ( - {isFirstPersonMode && ( - - - - )} + {isFirstPersonMode && } @@ -2147,11 +2128,9 @@ function EditorContent({ owns the framing chrome — the walkthrough HUD would both clutter the frame and offer a second, conflicting exit. */} {isFirstPersonMode && !isCaptureMode && ( - - useEditor.getState().setFirstPersonMode(false)} - /> - + useEditor.getState().setFirstPersonMode(false)} + /> )} {viewerBanner} {projectId && isCaptureMode ? ( @@ -2229,11 +2208,7 @@ function EditorContent({ /> {isFirstPersonMode && ( - - useEditor.getState().setFirstPersonMode(false)} - /> - + useEditor.getState().setFirstPersonMode(false)} /> )} diff --git a/packages/nodes/src/wall/tool-chaining.test.tsx b/packages/nodes/src/wall/tool-chaining.test.tsx index 4331c76cdc..e29856a169 100644 --- a/packages/nodes/src/wall/tool-chaining.test.tsx +++ b/packages/nodes/src/wall/tool-chaining.test.tsx @@ -18,6 +18,7 @@ import { useEditor, useFloorplanDraftPreview, usePlacementTyping, + useSegmentDraftChain, } from '@pascal-app/editor' import { useViewer } from '@pascal-app/viewer' import { Html } from '@react-three/drei' @@ -230,3 +231,46 @@ test('collinear transit advances draft origin along an existing wall centerline await renderer.unmount() } }) + +test('first click publishes chain start so a refused first commit keeps split-view synced until cancel', async () => { + // Two very closely spaced parallel walls trigger a sliver refusal on a crossing draft + const wallA = WallNode.parse({ + id: 'wall_sliver_a', + parentId: level.id, + start: [1, -2], + end: [1, 2], + }) + const wallB = WallNode.parse({ + id: 'wall_sliver_b', + parentId: level.id, + start: [1.005, -2], + end: [1.005, 2], + }) + useScene.setState((state) => ({ + nodes: { + ...state.nodes, + [level.id]: { ...level, children: [wallA.id, wallB.id] }, + [wallA.id]: wallA, + [wallB.id]: wallB, + }, + })) + + const renderer = await mountWallTool() + try { + await act(async () => emitter.emit('grid:click', grid(0, 0))) + expect(useSegmentDraftChain.getState().wall).toEqual([0, 0]) + + // Attempt a crossing that planWallInsertion refuses (not collinear transit) + await act(async () => emitter.emit('grid:click', grid(3, 0))) + expect(levelWalls()).toHaveLength(2) + // Chain start remains published while 3D stays drafting so split-view 2D does not tear down + expect(useSegmentDraftChain.getState().wall).toEqual([0, 0]) + expect(useFloorplanDraftPreview.getState().wallDraftStart).toEqual([0, 0]) + + // Canceling clears the published chain start + await act(async () => emitter.emit('tool:cancel')) + expect(useSegmentDraftChain.getState().wall).toBeNull() + } finally { + await renderer.unmount() + } +}) diff --git a/packages/nodes/src/wall/tool.tsx b/packages/nodes/src/wall/tool.tsx index a26320768c..fa51bcfeec 100644 --- a/packages/nodes/src/wall/tool.tsx +++ b/packages/nodes/src/wall/tool.tsx @@ -743,6 +743,7 @@ const LineWallTool: React.FC = () => { const draftPreview = useFloorplanDraftPreview.getState() draftPreview.setWallDraftStart(run.start) draftPreview.setWallDraftEnd(run.start) + useSegmentDraftChain.getState().setChainStart('wall', [run.start[0], run.start[1]]) cursorRef.current?.position.copy(startingPoint.current) if (wallPreviewRef.current) wallPreviewRef.current.visible = false setDraftMeasurement(null) @@ -950,6 +951,7 @@ const LineWallTool: React.FC = () => { const draftPreview = useFloorplanDraftPreview.getState() draftPreview.setWallDraftStart(snappedStart) draftPreview.setWallDraftEnd(snappedStart) + useSegmentDraftChain.getState().setChainStart('wall', [snappedStart[0], snappedStart[1]]) setAxisGuide({ origin: snappedStart, endOrigin: null, From a9c697a0ec5cdc8be93e2adce41384ea533bf143 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Wed, 18 Nov 2026 09:10:53 +0100 Subject: [PATCH 5/7] fix(editor,nodes): handle split-view refusal outcome and harden client locale bootstrap --- apps/editor/app/client-bootstrap.tsx | 34 +++++++++++++------ .../src/components/editor/floorplan-panel.tsx | 6 +++- .../src/store/use-segment-draft-chain.ts | 20 +++++++++-- .../nodes/src/wall/tool-chaining.test.tsx | 8 +++-- packages/nodes/src/wall/tool.tsx | 10 ++++-- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/apps/editor/app/client-bootstrap.tsx b/apps/editor/app/client-bootstrap.tsx index e23c63336b..2dea21faed 100644 --- a/apps/editor/app/client-bootstrap.tsx +++ b/apps/editor/app/client-bootstrap.tsx @@ -13,6 +13,8 @@ import { loadDevLocale } from '@/lib/dev-locales' registerEnglishLocale() +const registeredInitialLocales = new Set() + export function ClientBootstrap({ children, enableDevDiagnostics, @@ -24,12 +26,12 @@ export function ClientBootstrap({ initialLocaleCatalog?: { locale: string; messages: CompiledTranslationMessages } locale: string }) { - const i18n = useMemo(() => { - if (initialLocaleCatalog) { - registerCompiledMessages(initialLocaleCatalog.locale, '', initialLocaleCatalog.messages) - } - return createI18n({ locale }) - }, [initialLocaleCatalog, locale]) + if (initialLocaleCatalog && !registeredInitialLocales.has(initialLocaleCatalog.locale)) { + registeredInitialLocales.add(initialLocaleCatalog.locale) + registerCompiledMessages(initialLocaleCatalog.locale, '', initialLocaleCatalog.messages) + } + + const i18n = useMemo(() => createI18n({ locale }), [locale]) useEffect(() => { if (!enableDevDiagnostics) return @@ -45,11 +47,23 @@ export function ClientBootstrap({ }, [i18n]) useEffect(() => { - return defaultI18n.subscribeLocale((nextLocale) => { - void Promise.all([loadDevLocale(nextLocale), loadBundledLocale(nextLocale)]).finally(() => { - i18n.setLocale(nextLocale) - }) + let cancelled = false + let latestRequestId = 0 + const unsubscribe = defaultI18n.subscribeLocale((nextLocale) => { + const requestId = ++latestRequestId + Promise.all([loadDevLocale(nextLocale), loadBundledLocale(nextLocale)]) + .then(() => { + if (cancelled || requestId !== latestRequestId) return + i18n.setLocale(nextLocale) + }) + .catch(() => { + // Keep the active locale when catalog loading fails. + }) }) + return () => { + cancelled = true + unsubscribe() + } }, [i18n]) return {children} diff --git a/packages/editor/src/components/editor/floorplan-panel.tsx b/packages/editor/src/components/editor/floorplan-panel.tsx index a6562568c3..c09e4d238e 100644 --- a/packages/editor/src/components/editor/floorplan-panel.tsx +++ b/packages/editor/src/components/editor/floorplan-panel.tsx @@ -10129,7 +10129,7 @@ export function FloorplanPanel({ // have corner-snapped or split-adjusted): the wall we just made in // 2D-only, otherwise the 3D tool's published chain start. Both views // then draft from the same start. - const publishedNextStart = useSegmentDraftChain.getState().wall + const { wall: publishedNextStart, wallOutcome } = useSegmentDraftChain.getState() const nextStart: WallPlanPoint = createdWall ? (createdWall.end as WallPlanPoint) : (publishedNextStart ?? point) @@ -10174,6 +10174,10 @@ export function FloorplanPanel({ clearWallPlacementDraft() setCursorPoint(null) return + } else if (wallOutcome === 'refused') { + // Split view: 3D refused this click without stopping the chain, so keep + // the current 2D draft, run reference, and typed fields intact. + return } wallRunReferenceRef.current = placedDirection diff --git a/packages/editor/src/store/use-segment-draft-chain.ts b/packages/editor/src/store/use-segment-draft-chain.ts index b578f0cad6..af4243a24c 100644 --- a/packages/editor/src/store/use-segment-draft-chain.ts +++ b/packages/editor/src/store/use-segment-draft-chain.ts @@ -10,19 +10,35 @@ import { create } from 'zustand' import type { WallPlanPoint } from '../components/tools/wall/wall-snap-geometry' type SegmentKind = 'wall' | 'fence' +export type SegmentDraftChainOutcome = 'idle' | 'active' | 'refused' type SegmentDraftChainState = { wall: WallPlanPoint | null fence: WallPlanPoint | null + wallOutcome: SegmentDraftChainOutcome + fenceOutcome: SegmentDraftChainOutcome setChainStart(kind: SegmentKind, point: WallPlanPoint | null): void + markRefused(kind: SegmentKind): void clear(kind: SegmentKind): void } const useSegmentDraftChain = create((set) => ({ wall: null, fence: null, - setChainStart: (kind, point) => set({ [kind]: point }), - clear: (kind) => set({ [kind]: null }), + wallOutcome: 'idle', + fenceOutcome: 'idle', + setChainStart: (kind, point) => + set( + kind === 'wall' + ? { wall: point, wallOutcome: point ? 'active' : 'idle' } + : { fence: point, fenceOutcome: point ? 'active' : 'idle' }, + ), + markRefused: (kind) => + set(kind === 'wall' ? { wallOutcome: 'refused' } : { fenceOutcome: 'refused' }), + clear: (kind) => + set( + kind === 'wall' ? { wall: null, wallOutcome: 'idle' } : { fence: null, fenceOutcome: 'idle' }, + ), })) export default useSegmentDraftChain diff --git a/packages/nodes/src/wall/tool-chaining.test.tsx b/packages/nodes/src/wall/tool-chaining.test.tsx index e29856a169..1d546c3a43 100644 --- a/packages/nodes/src/wall/tool-chaining.test.tsx +++ b/packages/nodes/src/wall/tool-chaining.test.tsx @@ -259,17 +259,21 @@ test('first click publishes chain start so a refused first commit keeps split-vi try { await act(async () => emitter.emit('grid:click', grid(0, 0))) expect(useSegmentDraftChain.getState().wall).toEqual([0, 0]) + expect(useSegmentDraftChain.getState().wallOutcome).toBe('active') // Attempt a crossing that planWallInsertion refuses (not collinear transit) await act(async () => emitter.emit('grid:click', grid(3, 0))) expect(levelWalls()).toHaveLength(2) - // Chain start remains published while 3D stays drafting so split-view 2D does not tear down + // Chain start remains published with outcome 'refused' so split-view 2D neither + // tears down nor clears typed fields / run reference expect(useSegmentDraftChain.getState().wall).toEqual([0, 0]) + expect(useSegmentDraftChain.getState().wallOutcome).toBe('refused') expect(useFloorplanDraftPreview.getState().wallDraftStart).toEqual([0, 0]) - // Canceling clears the published chain start + // Canceling clears the published chain start and resets outcome await act(async () => emitter.emit('tool:cancel')) expect(useSegmentDraftChain.getState().wall).toBeNull() + expect(useSegmentDraftChain.getState().wallOutcome).toBe('idle') } finally { await renderer.unmount() } diff --git a/packages/nodes/src/wall/tool.tsx b/packages/nodes/src/wall/tool.tsx index fa51bcfeec..aa3c4434dd 100644 --- a/packages/nodes/src/wall/tool.tsx +++ b/packages/nodes/src/wall/tool.tsx @@ -1001,7 +1001,10 @@ const LineWallTool: React.FC = () => { )) const dx = snappedEnd[0] - startingPoint.current.x const dz = snappedEnd[1] - startingPoint.current.z - if (dx * dx + dz * dz < 0.01 * 0.01) return + if (dx * dx + dz * dz < 0.01 * 0.01) { + useSegmentDraftChain.getState().markRefused('wall') + return + } // A ground(terrain)-hosted chain keeps its frozen construction plane; // any other chain re-resolves the aimed surface per commit so a later // segment can still elect the slab it visibly crosses instead of @@ -1056,7 +1059,10 @@ const LineWallTool: React.FC = () => { const isCollinearTransit = getWallLineKind() !== 'invisible' && wallSegmentsCoverSegment(startPt, snappedEnd, levelWalls) - if (!isCollinearTransit) return + if (!isCollinearTransit) { + useSegmentDraftChain.getState().markRefused('wall') + return + } // Tracking along an existing wall centerline advances the draft origin // without duplicating the wall, so a subsequent branch T-joins cleanly. nextStart = snappedEnd From 29e2d898fb95529fecd8b325d760fa7854a681d5 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Thu, 19 Nov 2026 15:21:48 +0100 Subject: [PATCH 6/7] fix(editor,core): advance 2D transit origin and isolate lazy plugin chunk failures --- apps/editor/lib/bootstrap.ts | 52 +++++++++++++++---- packages/core/src/registry/registry.test.ts | 19 +++++++ packages/core/src/registry/registry.ts | 10 +++- .../src/components/editor/floorplan-panel.tsx | 20 +++---- 4 files changed, 80 insertions(+), 21 deletions(-) diff --git a/apps/editor/lib/bootstrap.ts b/apps/editor/lib/bootstrap.ts index d61cb80303..81677ae0da 100644 --- a/apps/editor/lib/bootstrap.ts +++ b/apps/editor/lib/bootstrap.ts @@ -4,6 +4,7 @@ import { extendPluginDiscovery, loadPlugin, nodeRegistry, + type Plugin, registerNode, } from '@pascal-app/core' import { sdfChecksFromEnv, setSdfChecks } from '@pascal-app/core/usage-field' @@ -76,16 +77,30 @@ function loadBuiltinsSync(): void { } } +function registerLazyPlugin(loader: () => Promise): void { + extendPluginDiscovery(async () => { + try { + const res = await loader() + return (Array.isArray(res) ? res : []) as Plugin[] + } catch (err) { + if (isDev() && typeof console !== 'undefined') { + console.warn('[pascal:plugin-loader] failed to load external plugin chunk:', err) + } + return [] + } + }) +} + function registerExternalPluginLoaders(): void { if (discoveryRegistered) return discoveryRegistered = true - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { treesHostPanel, treesPlugin } = await import('@pascal-app/plugin-trees') registerEditorHostPanel(treesHostPanel) return [treesPlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { environmentHostPanel, environmentPlugin, environmentPresentation } = await import( '@pascal-app/plugin-environment' ) @@ -93,34 +108,34 @@ function registerExternalPluginLoaders(): void { registerViewerPresentation(environmentPresentation) return [environmentPlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { bonesHostPanel, bonesPlugin } = await import('@pascal-app/plugin-bones') // Opt-in: Bones ships uninstalled — users enable it per scene from the // Plugins panel (engineering X-ray is a specialist view, not a default). registerEditorHostPanel({ ...bonesHostPanel, defaultInstalled: false }) return [bonesPlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { mintHostPanel, mintPlugin } = await import('@mint/pascal-plugin') registerEditorHostPanel(mintHostPanel) return [mintPlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { poolHostPanel, poolPlugin } = await import('@pascal-app/plugin-pool') registerEditorHostPanel(poolHostPanel) return [poolPlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { landscapeHostPanel, landscapePlugin } = await import('@pascal-app/plugin-landscape') registerEditorHostPanel(landscapeHostPanel) return [landscapePlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { bathSpaceHostPanel, bathSpacePlugin } = await import('@pascal-app/plugin-bath-space') registerEditorHostPanel(bathSpaceHostPanel) return [bathSpacePlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { streetscapeHostPanel, streetscapePlugin } = await import( '@pascal-app/plugin-streetscape' ) @@ -130,7 +145,7 @@ function registerExternalPluginLoaders(): void { }) return [streetscapePlugin] }) - extendPluginDiscovery(async () => { + registerLazyPlugin(async () => { const { webXRHostPanel, webXRPlugin } = await import('@webxr/plugin') registerEditorHostPanel(webXRHostPanel) return [webXRPlugin] @@ -146,9 +161,24 @@ function registerExternalPluginLoaders(): void { export async function loadExternalPlugins(): Promise { if (externalsKickedOff) return externalsKickedOff = true - const externals = await discoverPlugins() + let externals: Plugin[] = [] + try { + externals = await discoverPlugins() + } catch (err) { + externalsKickedOff = false + if (isDev() && typeof console !== 'undefined') { + console.warn('[pascal:registry] discoverPlugins failed:', err) + } + return + } for (const plugin of externals) { - await loadPlugin(plugin) + try { + await loadPlugin(plugin) + } catch (err) { + if (isDev() && typeof console !== 'undefined') { + console.warn(`[pascal:registry] failed to load plugin "${plugin?.id}":`, err) + } + } } if (isDev() && externals.length > 0 && typeof console !== 'undefined') { console.info(`[pascal:registry] + ${externals.length} discovered plugin(s)`) diff --git a/packages/core/src/registry/registry.test.ts b/packages/core/src/registry/registry.test.ts index 351b16e5ad..de2ab3baf8 100644 --- a/packages/core/src/registry/registry.test.ts +++ b/packages/core/src/registry/registry.test.ts @@ -1,6 +1,8 @@ import { beforeEach, describe, expect, test } from 'bun:test' import { z } from 'zod' import { + discoverPlugins, + extendPluginDiscovery, getHostRefFields, getInspectorExtensions, getNodePluginId, @@ -14,6 +16,7 @@ import { loadPlugin, nodeRegistry, registerNode, + setPluginDiscovery, } from './registry' import type { AnyNodeDefinition, InspectorExtension, Plugin } from './types' @@ -507,3 +510,19 @@ describe('inspector extensions', () => { expect(getInspectorExtensions('wall')).toEqual([]) }) }) + +describe('discoverPlugins and extendPluginDiscovery', () => { + test('combines discoveries and survives an individual discovery failure', async () => { + const pluginA = { id: 'test:plugin-a', apiVersion: 1 } as Plugin + const pluginB = { id: 'test:plugin-b', apiVersion: 1 } as Plugin + + setPluginDiscovery(async () => [pluginA]) + extendPluginDiscovery(async () => { + throw new Error('network failed chunk') + }) + extendPluginDiscovery(async () => [pluginB]) + + const discovered = await discoverPlugins() + expect(discovered).toEqual([pluginA, pluginB]) + }) +}) diff --git a/packages/core/src/registry/registry.ts b/packages/core/src/registry/registry.ts index 42a82448b3..e091cead09 100644 --- a/packages/core/src/registry/registry.ts +++ b/packages/core/src/registry/registry.ts @@ -494,7 +494,15 @@ export function setPluginDiscovery(fn: PluginDiscovery): void { export function extendPluginDiscovery(fn: PluginDiscovery): void { const previous = pluginDiscovery pluginDiscovery = async () => { - const [base, extra] = await Promise.all([previous(), fn()]) + const [baseResult, extraResult] = await Promise.allSettled([previous(), fn()]) + const base = baseResult.status === 'fulfilled' ? baseResult.value : [] + const extra = extraResult.status === 'fulfilled' ? extraResult.value : [] + if (baseResult.status === 'rejected' && isDevMode()) { + console.warn('[registry] previous plugin discovery failed:', baseResult.reason) + } + if (extraResult.status === 'rejected' && isDevMode()) { + console.warn('[registry] extended plugin discovery failed:', extraResult.reason) + } return [...base, ...extra] } } diff --git a/packages/editor/src/components/editor/floorplan-panel.tsx b/packages/editor/src/components/editor/floorplan-panel.tsx index c09e4d238e..99e1600ac7 100644 --- a/packages/editor/src/components/editor/floorplan-panel.tsx +++ b/packages/editor/src/components/editor/floorplan-panel.tsx @@ -10073,6 +10073,7 @@ export function FloorplanPanel({ setWallChainFirstVertex(point) setDraftEnd(point) setCursorPoint(point) + useSegmentDraftChain.getState().setChainStart('wall', point) return } @@ -10127,18 +10128,19 @@ export function FloorplanPanel({ // Chain the next segment from the resolved commit endpoint (it may // have corner-snapped or split-adjusted): the wall we just made in - // 2D-only, otherwise the 3D tool's published chain start. Both views - // then draft from the same start. + // Split view: the 3D tool owns both the commit and the continuation + // decision (including collinear transit), and clears the published + // chain start whenever it stops drafting (room close, T-junction, + // loop close). Mirror that here instead of chaining from a dead point. const { wall: publishedNextStart, wallOutcome } = useSegmentDraftChain.getState() - const nextStart: WallPlanPoint = createdWall - ? (createdWall.end as WallPlanPoint) - : (publishedNextStart ?? point) + let nextStart: WallPlanPoint if (viewIs2DOnly) { const levelWalls = Object.values(useScene.getState().nodes).filter( (node): node is WallNode => node?.type === 'wall' && node.parentId === levelId, ) if (createdWall) { + nextStart = createdWall.end as WallPlanPoint // 2D-only committer: mirror the 3D tool's auto-close. Stop when the // segment closes back to the chain start, seals a room against the // wall network, or tees into wall geometry outside the chain — @@ -10163,14 +10165,12 @@ export function FloorplanPanel({ // Collinear tracking: advance the draft origin along the host wall's // centerline without creating a duplicate wall so the next branch T-joins cleanly. sfxEmitter.emit('sfx:grid-snap') + nextStart = point } else { return } + useSegmentDraftChain.getState().setChainStart('wall', nextStart) } else if (!publishedNextStart) { - // Split view: the 3D tool owns both the commit and the continuation - // decision (including collinear transit), and clears the published - // chain start whenever it stops drafting (room close, T-junction, - // loop close). Mirror that here instead of chaining from a dead point. clearWallPlacementDraft() setCursorPoint(null) return @@ -10178,6 +10178,8 @@ export function FloorplanPanel({ // Split view: 3D refused this click without stopping the chain, so keep // the current 2D draft, run reference, and typed fields intact. return + } else { + nextStart = createdWall ? (createdWall.end as WallPlanPoint) : publishedNextStart } wallRunReferenceRef.current = placedDirection From 8f78bdfe14c9cb49bd3f34b00098837acb38dc37 Mon Sep 17 00:00:00 2001 From: saadmooh Date: Thu, 19 Nov 2026 17:13:07 +0100 Subject: [PATCH 7/7] fix(editor): support canonical Simplified Chinese aliases in lazy locale resolution --- packages/editor/src/i18n/lazy-locales.ts | 53 ++++++++++++++++++++++-- packages/editor/src/i18n/locales.test.ts | 14 +++++++ 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/i18n/lazy-locales.ts b/packages/editor/src/i18n/lazy-locales.ts index 66462a3aa1..29f3a9f67c 100644 --- a/packages/editor/src/i18n/lazy-locales.ts +++ b/packages/editor/src/i18n/lazy-locales.ts @@ -4,14 +4,59 @@ import { messages as en } from './locales/en/messages' const loadedLocales = new Set() -function resolveBundledLocale(locale: string): BundledLocale | null { - const normalized = locale.trim().toLowerCase() +export function resolveBundledLocale(locale: string): BundledLocale | null { + const trimmed = locale.trim() + if (!trimmed) return 'en' + const normalized = trimmed.replace(/_/g, '-').toLowerCase() if (normalized === 'en-xa') return null - if (!normalized || normalized === 'en' || normalized.startsWith('en-')) return 'en' + if (normalized === 'en' || normalized.startsWith('en-')) return 'en' if (normalized === 'es' || normalized.startsWith('es-')) return 'es' if (normalized === 'fr' || normalized.startsWith('fr-')) return 'fr' if (normalized === 'ja' || normalized.startsWith('ja-')) return 'ja' - if (normalized === 'zh-cn' || normalized === 'zh-hans' || normalized === 'zh') return 'zh-CN' + + // Traditional Chinese / non-simplified variants must not resolve to Simplified Chinese + if ( + normalized === 'zh-hant' || + normalized.startsWith('zh-hant-') || + normalized === 'zh-tw' || + normalized === 'zh-hk' || + normalized === 'zh-mo' + ) { + return null + } + + if ( + normalized === 'zh' || + normalized === 'zh-cn' || + normalized === 'zh-sg' || + normalized.startsWith('zh-hans') + ) { + return 'zh-CN' + } + + try { + const parsed = new Intl.Locale(trimmed) + if (parsed.language === 'zh') { + if ( + parsed.script === 'Hant' || + parsed.region === 'TW' || + parsed.region === 'HK' || + parsed.region === 'MO' + ) { + return null + } + if ( + parsed.script === 'Hans' || + parsed.region === 'CN' || + (!parsed.script && !parsed.region) + ) { + return 'zh-CN' + } + } + } catch { + // Ignore invalid locale tag + } + return null } diff --git a/packages/editor/src/i18n/locales.test.ts b/packages/editor/src/i18n/locales.test.ts index e0e9c620ab..c1ac226908 100644 --- a/packages/editor/src/i18n/locales.test.ts +++ b/packages/editor/src/i18n/locales.test.ts @@ -38,6 +38,20 @@ test('Simplified Chinese aliases use zh-CN without affecting Traditional Chinese expect(translate('viewer.display.title', 'Display settings')).toBe('Display settings') }) +test('lazy loaded bundled locales resolve and load Simplified Chinese aliases', async () => { + const { loadBundledLocale, resolveBundledLocale } = await import('./lazy-locales') + + expect(resolveBundledLocale('zh-Hans-CN')).toBe('zh-CN') + expect(resolveBundledLocale('zh-hans-cn')).toBe('zh-CN') + expect(resolveBundledLocale('zh-Hans')).toBe('zh-CN') + expect(resolveBundledLocale('zh-Hant')).toBeNull() + expect(resolveBundledLocale('zh-TW')).toBeNull() + + const loaded = await loadBundledLocale('zh-Hans-CN') + expect(loaded).not.toBeNull() + expect(loaded?.locale).toBe('zh-CN') +}) + test('generated stored level names localize while authored names remain unchanged', () => { registerBundledLocales() const french = createI18n({ locale: 'fr' })