Kern/Huelle Phase A.2: React/Tauri-Teile aus plan/ nach views/plan, RichTextEditor nach editors; PickKind in den Kern

This commit is contained in:
karim committed 2026-10-27 19:26:22 +01:00
1 parent cb79c13753
commit b00bef0959
26 files changed
+106 -72

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Verschiebt TS-Module (git mv) und schreibt alle relativen Imports im Projekt um.
Aufruf: scripts/move-modules.py alt1=neu1 alt2=neu2 … (Pfade mit Endung, relativ zum Repo)
Importe werden über den aufgelösten Zielpfad (ohne Endung) erkannt — auch aus den verschobenen
Dateien selbst und aus Testdateien."""
import re, glob, os, subprocess, sys
moves = dict(a.split('=') for a in sys.argv[1:])
strip = lambda p: re.sub(r'\.(tsx?|test\.tsx?)$', '', p)
base_moves = {strip(o): strip(n) for o, n in moves.items()}
old_loc = {n: o for o, n in moves.items()} # neuer Pfad -> alter Pfad
for o, n in moves.items():
os.makedirs(os.path.dirname(n), exist_ok=True)
subprocess.check_call(['git', 'mv', o, n])
def rel(frm, to):
r = os.path.relpath(to, os.path.dirname(frm))
return r if r.startswith('.') else './' + r
spec_re = re.compile(r'((?:from|import)\s*\(?\s*["\'])(\.[^"\']*)(["\'])')
for f in glob.glob('src/**/*.ts*', recursive=True) + glob.glob('scripts/*.ts') + glob.glob('scripts/*.mjs'):
s = open(f).read()
where_old = old_loc.get(f, f) # Auflösung relativ zum ALTEN Ort der Datei
def fix(m):
spec = m.group(2)
target = os.path.normpath(os.path.join(os.path.dirname(where_old), spec))
new_target = base_moves.get(target, target)
if new_target == target and where_old == f:
return m.group(0)
return m.group(1) + rel(f, new_target) + m.group(3)
n = spec_re.sub(fix, s)
if n != s:
open(f, 'w').write(n)
+1 -1
View File
@@ -55,7 +55,7 @@ import { isTauriRuntime, PROJECT_TEMPLATE_EXT } from "./io/projectFile";
import { stepTextToImportedMeshes } from "./io/stepImport";
import { applyClashMarkers, runClashCheck } from "./analysis/clash";
import { checkForUpdate } from "./update/checkForUpdate";
import type { PlanViewHandle } from "./plan/PlanView";
import type { PlanViewHandle } from "./views/plan/PlanView";
import type { DisplayResolver } from "./viewport/Viewport3D";
import {
neighbor3dVertex,
@@ -8,7 +8,7 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { t } from "../i18n";
import { docToHtml } from "./renderHtml";
import { docToHtml } from "../text/renderHtml";
import { Dropdown } from "../ui/Dropdown";
import {
applyMark,
@@ -21,14 +21,14 @@ import {
normalizeDoc,
serialize,
toggleMark,
} from "./richText";
} from "../text/richText";
import type {
BoolMark,
Marks,
RichTextDoc,
TextRange,
TextStylePreset,
} from "./richText";
} from "../text/richText";
// ── Props ────────────────────────────────────────────────────────────────────
+4 -1
View File
@@ -5,7 +5,10 @@
import type { Project } from "../model/types";
import { flattenCategories } from "../model/types";
import type { PickKind } from "./PlanView";
/** Art eines auswählbaren Objekts an einer Klickstelle (Reihenfolge = Standard-Priorität). */
export type PickKind =
| "section" | "opening" | "wall" | "column" | "drawing" | "solid"
| "ceiling" | "stair" | "room" | "roof" | "context";
type WithCategory = { id: string; categoryCode?: string };
+1 -1
View File
@@ -17,7 +17,7 @@ import type { DraftShape, SnapResult, SnapSettings, ToolDraft, ToolMods } from "
import { applyAngleConstraint, computeSnap } from "../tools/snapping";
import { useCommandTabShortcut } from "./useKeyboardShortcuts";
import { sheetOwnerOutlines } from "../tools/sheetSnapGeometry";
import type { BodyTarget } from "../plan/PlanView";
import type { BodyTarget } from "../views/plan/PlanView";
import type { CommandLineHandle } from "../ui/CommandLine";
import type { CommandEngine } from "../commands/engine";
+1 -1
View File
@@ -8,7 +8,7 @@
import type { Project, Vec2 } from "../model/types";
import type { CategoryDisplayResolver } from "../plan/generatePlan";
import type { DisplayResolver } from "../viewport/Viewport3D";
import type { PlanSelection, MarqueeSelection } from "../plan/PlanView";
import type { PlanSelection, MarqueeSelection } from "../views/plan/PlanView";
import type { Pick3dHit } from "../viewport/Wasm3DViewport";
import type { RichTextDoc } from "../text/richText";
import { plainText } from "../text/richText";
+1 -1
View File
@@ -14,7 +14,7 @@ import { resolvePenColor } from "../model/penSets";
import type { ToolId } from "../tools/types";
import type { ViewType } from "../model/viewTypes";
import type { TransformSelection } from "../tools/transform";
import type { PlanViewHandle } from "../plan/PlanView";
import type { PlanViewHandle } from "../views/plan/PlanView";
import type { PanelHostValue } from "../panels/host";
import type { Selection } from "./selectionInfo";
import type { EngineView } from "../commands/engine";
+1 -1
View File
@@ -22,7 +22,7 @@ import type {
WallType,
WindowType,
} from "../model/types";
import type { PlanViewHandle } from "../plan/PlanView";
import type { PlanViewHandle } from "../views/plan/PlanView";
import type { NotifyKind } from "./notifySlice";
/**
+1 -1
View File
@@ -41,7 +41,7 @@ import { addRecentProject, removeRecentProject } from "./recentProjects";
import { emptyProject, sampleProject } from "../model/sampleProject";
import { flattenCategories } from "../model/types";
import type { ContextObject, Drawing2D, Project, Vec2 } from "../model/types";
import type { PlanViewHandle } from "../plan/PlanView";
import type { PlanViewHandle } from "../views/plan/PlanView";
/** Umriss (bbox) aller Drawing2D-Geometrien in Modell-Metern (null = leer). */
function drawingsBBox(
+1 -1
View File
@@ -57,7 +57,7 @@ import {
type RectMm,
type SheetTransform,
} from "./layoutSheetMath";
import { RichTextEditor } from "../text/RichTextEditor";
import { RichTextEditor } from "../editors/RichTextEditor";
import { docFromText } from "../text/richText";
import { wrapDocToLines, type SvgLine } from "../text/renderHtml";
import { contentFontBaselineFromTop, TEXT_LINE_HEIGHT_MULT } from "../text/fontMetrics";
+1 -1
View File
@@ -6,7 +6,7 @@
import { useState } from "react";
import { t } from "../i18n";
import { RichTextEditor } from "../text/RichTextEditor";
import { RichTextEditor } from "../editors/RichTextEditor";
import type { RichTextDoc } from "../text/richText";
export interface TextEditorDialogProps {
@@ -5,6 +5,7 @@
// Polygon wird ein eigenes <pattern> in <defs> definiert, damit Maßstab/Winkel/
// Farbe variieren können.
import type { PickKind } from "../../plan/pickLabels";
import {
forwardRef,
useEffect,
@@ -14,22 +15,22 @@ import {
useState,
} from "react";
import type { ComponentProps, CSSProperties } from "react";
import type { HatchRender, Plan, PlanImage, Primitive } from "./generatePlan";
import { materializeGreyed, materializeUnderlay, type UnderlayGroup } from "./generatePlan";
import type { Drawing2D, EdgeGrip, Vec2 } from "../model/types";
import { t } from "../i18n";
import type { ToolHandlers, ToolId, ToolMods } from "../tools/types";
import type { HudFieldsState } from "../tools/hudFormat";
import type { RichTextDoc } from "../text/richText";
import { docFromText } from "../text/richText";
import { contentFontBaselineFromTop, TEXT_LINE_HEIGHT_MULT } from "../text/fontMetrics";
import { textFrameCorners } from "../text/textFrame";
import { RichTextEditor } from "../text/RichTextEditor";
import type { HatchRender, Plan, PlanImage, Primitive } from "../../plan/generatePlan";
import { materializeGreyed, materializeUnderlay, type UnderlayGroup } from "../../plan/generatePlan";
import type { Drawing2D, EdgeGrip, Vec2 } from "../../model/types";
import { t } from "../../i18n";
import type { ToolHandlers, ToolId, ToolMods } from "../../tools/types";
import type { HudFieldsState } from "../../tools/hudFormat";
import type { RichTextDoc } from "../../text/richText";
import { docFromText } from "../../text/richText";
import { contentFontBaselineFromTop, TEXT_LINE_HEIGHT_MULT } from "../../text/fontMetrics";
import { textFrameCorners } from "../../text/textFrame";
import { RichTextEditor } from "../../editors/RichTextEditor";
import { useNativeAvailable, useNativePlanRenderer } from "./useNativePlanRenderer";
import { isGpuText } from "./nativeText";
import { isGpuText } from "../../plan/nativeText";
import { LiveMeet, LiveValue, createMeetStore, createValueStore } from "./planView/liveMeet";
import { useWasmPlanRenderer } from "./useWasmPlanRenderer";
import { DEFAULT_MARQUEE_COLOR, DEFAULT_SNAP_COLOR } from "../theme/accents";
import { DEFAULT_MARQUEE_COLOR, DEFAULT_SNAP_COLOR } from "../../theme/accents";
import {
type ViewBox,
PX_PER_M,
@@ -49,7 +50,7 @@ import {
marqueeHitCeilings,
marqueeHitRooms,
marqueeHitStairs,
} from "./planView/geometry";
} from "../../plan/planView/geometry";
import {
polyUsesPattern,
HatchPattern,
@@ -61,25 +62,25 @@ import {
import { DraftOverlay } from "./planView/overlays";
import { PlanRulers } from "./planView/PlanRulers";
import { PlanGrid } from "./planView/PlanGrid";
import { expandRegion, indexedInRegion, regionContains, type Bounds } from "./planView/cullPrimitives";
import { buildSegmentIndex, nearestSegment, pointSegDist, segmentsNear } from "./planView/segmentIndex";
import { buildOwnerIndex, ownedBy, type OwnerField, type OwnerIndex } from "./planView/ownerIndex";
import { expandRegion, indexedInRegion, regionContains, type Bounds } from "../../plan/planView/cullPrimitives";
import { buildSegmentIndex, nearestSegment, pointSegDist, segmentsNear } from "../../plan/planView/segmentIndex";
import { buildOwnerIndex, ownedBy, type OwnerField, type OwnerIndex } from "../../plan/planView/ownerIndex";
import {
buildDrawingIndex,
drawingsWithinDistance,
marqueeHitUnderlay,
nearestInDrawings,
type DrawingIndex,
} from "./planView/underlayAccess";
import { endBusyAfterPaint } from "../state/busyStore";
import { createCursorStore, useCursorValue, type CursorStore } from "../state/cursorStore";
} from "../../plan/planView/underlayAccess";
import { endBusyAfterPaint } from "../../state/busyStore";
import { createCursorStore, useCursorValue, type CursorStore } from "../../state/cursorStore";
/**
* Feld-Status der Befehlszeile fürs Cursor-HUD (Tab-Feld-Zyklus §2.7) — Typ
* lebt in `tools/hudFormat.ts` (dort auch von der 3D-Ansicht genutzt);
* hier nur re-exportiert (bestehende Importe aus `./PlanView` bleiben gültig).
*/
export type { HudFieldsState } from "../tools/hudFormat";
export type { HudFieldsState } from "../../tools/hudFormat";
// Viewport-Culling (s. `cullPrimitives.ts`): erst ab dieser Primitiv-Anzahl
// aktiv — normale Projekte liegen weit darunter und bleiben unverändert.
@@ -203,10 +204,6 @@ export interface PlanViewHandle {
confirmEdgeEdit: () => void;
}
/** Art eines auswählbaren Objekts an einer Klickstelle (Reihenfolge = Standard-Priorität). */
export type PickKind =
| "section" | "opening" | "wall" | "column" | "drawing" | "solid"
| "ceiling" | "stair" | "room" | "roof" | "context";
const PICK_ORDER: readonly PickKind[] = [
"section", "opening", "wall", "column", "drawing", "solid",
File renamed without changes.
File renamed without changes.
@@ -8,7 +8,7 @@
* Frame wandert danach nur noch der Ausschnitt.
*/
import type { BufferGl, GpuGeometry } from './glPlanTypes';
import type { BufferGl, GpuGeometry } from '../../plan/glPlan/glPlanTypes';
export type NativeInvoke = (cmd: string, args?: unknown, options?: unknown) => Promise<unknown>;
@@ -9,11 +9,11 @@
// Tauri an `window.__TAURI_INTERNALS__`; Fehler beim Invoke werden still
// geschluckt (console.debug), damit die App nie daran scheitert.
import type { Plan } from "./generatePlan";
import { materializeGreyed, materializeUnderlay } from "./generatePlan";
import type { Project } from "../model/types";
import { planToRenderScene } from "./toRenderScene";
import { projectToModel3d, TRUCK_MESH_READY_EVENT } from "./toWalls3d";
import type { Plan } from "../../plan/generatePlan";
import { materializeGreyed, materializeUnderlay } from "../../plan/generatePlan";
import type { Project } from "../../model/types";
import { planToRenderScene } from "../../plan/toRenderScene";
import { projectToModel3d, TRUCK_MESH_READY_EVENT } from "../../plan/toWalls3d";
/** Sammel-Fenster: Modelländerungen werden gebündelt gepusht (nicht je Frame). */
const DEBOUNCE_MS = 200;
@@ -6,7 +6,7 @@
// (`ZOOM_MIN`/`ZOOM_MAX` in PlanView.tsx) auf ≤ ~Bildschirmbreite/64px
// begrenzt, unabhängig davon, wie weit heraus- oder hereingezoomt ist.
import { PX_PER_M } from "./geometry";
import { PX_PER_M } from "../../../plan/planView/geometry";
import { rulerStep } from "./PlanRulers";
export function PlanGrid({
@@ -1,7 +1,7 @@
// Lineale oben + links (Vectorworks-Stil) am Rand der Plan-Ansicht.
import type { Vec2 } from "../../model/types";
import { PX_PER_M } from "./geometry";
import type { Vec2 } from "../../../model/types";
import { PX_PER_M } from "../../../plan/planView/geometry";
/**
* Schrittweite (Meter) fürs Lineal: 1/2/5·10^n, sodass Major-Ticks ≥ ~64 px
File renamed without changes.
@@ -2,9 +2,9 @@
// Winkel-Führungslinie, Snap-Marker. Reine Darstellung, bekommt `toScreen` +
// Massstab-Parameter als Props gereicht.
import type { Vec2 } from "../../model/types";
import type { SnapResult, ToolDraft } from "../../tools/types";
import { hudSegments, type HudFieldsState } from "../../tools/hudFormat";
import type { Vec2 } from "../../../model/types";
import type { SnapResult, ToolDraft } from "../../../tools/types";
import { hudSegments, type HudFieldsState } from "../../../tools/hudFormat";
/**
* Zeichnet die Werkzeug-Vorschau: Vorschau-Formen (gestrichelte Akzentlinien /
@@ -11,7 +11,7 @@
import { describe, expect, it } from "vitest";
import { polyUsesPattern } from "./primitives";
import type { HatchRender } from "../generatePlan/shared";
import type { HatchRender } from "../../../plan/generatePlan/shared";
function hatch(over: Partial<HatchRender> = {}): HatchRender {
return {
@@ -3,14 +3,14 @@
// Renderer. Bekommt `toScreen`/Massstab-Parameter gereicht, kein eigener
// Zugriff auf PlanView-internen State.
import type { HatchRender, Primitive } from "../generatePlan";
import { NO_HATCH } from "../generatePlan/shared";
import { docToLines, wrapDocToLines, type SvgLine } from "../../text/renderHtml";
import type { Vec2 } from "../../model/types";
import { quantizePen } from "../../export/sceneToPrintSvg";
import { buildRandomHatchRuns, zigzagPoints, motifPoints, DASH_MM_TO_M } from "../glPlan/glPlanHatch";
import { dashHasDot } from "../../geometry/lineSegments";
import { HAIRLINE_PX, PX_PER_M, mmToPx, printStrokeVb, visibleEdgeRuns } from "./geometry";
import type { HatchRender, Primitive } from "../../../plan/generatePlan";
import { NO_HATCH } from "../../../plan/generatePlan/shared";
import { docToLines, wrapDocToLines, type SvgLine } from "../../../text/renderHtml";
import type { Vec2 } from "../../../model/types";
import { quantizePen } from "../../../export/sceneToPrintSvg";
import { buildRandomHatchRuns, zigzagPoints, motifPoints, DASH_MM_TO_M } from "../../../plan/glPlan/glPlanHatch";
import { dashHasDot } from "../../../geometry/lineSegments";
import { HAIRLINE_PX, PX_PER_M, mmToPx, printStrokeVb, visibleEdgeRuns } from "../../../plan/planView/geometry";
/** Basis-Kachelmaß (viewBox-Einheiten) einer Bild-Schraffur bei scaleX/scaleY = 1. */
const IMG_TILE_VB = 40;
@@ -9,14 +9,14 @@
*/
import { useCallback, useEffect, useRef, useState } from 'react';
import type { Plan } from './generatePlan';
import { GpuChunkCache } from './glPlan/glPlanChunks';
import { compilePrimitivesToGpu } from './glPlan/glPlanCompile';
import type { GpuGeometry, ViewBox } from './glPlan/glPlanTypes';
import type { Primitive } from './generatePlan';
import { NativeGl, type NativeInvoke } from './glPlan/nativeGl';
import type { Plan } from '../../plan/generatePlan';
import { GpuChunkCache } from '../../plan/glPlan/glPlanChunks';
import { compilePrimitivesToGpu } from '../../plan/glPlan/glPlanCompile';
import type { GpuGeometry, ViewBox } from '../../plan/glPlan/glPlanTypes';
import type { Primitive } from '../../plan/generatePlan';
import { NativeGl, type NativeInvoke } from './nativeGl';
import { readCssColor } from './cssColor';
import { NativeTextSync } from './nativeText';
import { NativeTextSync } from '../../plan/nativeText';
/** Läuft die App in einer Tauri-Webview? */
const isTauri = (): boolean => typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window;
@@ -13,8 +13,8 @@
*/
import { useCallback, useEffect, useRef, useState } from "react";
import type { Plan } from "./generatePlan";
import { planToRenderScene } from "./toRenderScene";
import type { Plan } from "../../plan/generatePlan";
import { planToRenderScene } from "../../plan/toRenderScene";
interface ViewBox {
x: number;
@@ -43,7 +43,7 @@ let enginePromise: Promise<any> | null = null;
function loadEngine(): Promise<any> {
if (!enginePromise) {
enginePromise = (async () => {
const mod: any = await import("../engine/pkg/render2d.js");
const mod: any = await import("../../engine/pkg/render2d.js");
await mod.default(); // lädt render2d_bg.wasm
return mod;
})();
+4 -4
View File
@@ -20,7 +20,7 @@ import type {
Wall,
} from "../model/types";
import { categoryNameForPick } from "../plan/pickLabels";
import type { PickKind } from "../plan/PlanView";
import type { PickKind } from "../plan/pickLabels";
import { generatePlan, generateSectionPlan, generateVisibleLevelsPlan } from "../plan/generatePlan";
import type { CategoryDisplayResolver, Plan, Primitive } from "../plan/generatePlan";
import type { RichTextDoc } from "../text/richText";
@@ -31,10 +31,10 @@ import { crossKindOverlayAllowed, planUnderlayPrimitives } from "../plan/planUnd
import { sectionOpeningPrimitives } from "../plan/sectionOpenings";
import { levelMarkerPrimitives, levelMarksEnabled } from "../plan/levelMarkers";
import { setSheetOwnerOutlines, setSheetSnapSegments, snapSegmentsFromPrimitives } from "../tools/sheetSnapGeometry";
import { pushNativeScene, pushNativeWalls } from "../plan/nativeSync";
import { pushNativeScene, pushNativeWalls } from "./plan/nativeSync";
import { selectionHighlightLines } from "../plan/toWalls3d";
import { applyGroupDimmingToPlan } from "../state/groupActions";
import { PlanView } from "../plan/PlanView";
import { PlanView } from "./plan/PlanView";
import type {
GripHandlers,
GroupableHit,
@@ -42,7 +42,7 @@ import type {
MarqueeSelection,
PlanSelection,
PlanViewHandle,
} from "../plan/PlanView";
} from "./plan/PlanView";
import { Viewport3D } from "../viewport/Viewport3D";
import type { DisplayResolver } from "../viewport/Viewport3D";
import type { Pick3dHit } from "../viewport/Wasm3DViewport";