sldeditor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +117 -0
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/dist/OneLineEditor.d.ts +24 -0
- package/dist/OneLineEditor.d.ts.map +1 -0
- package/dist/canvas/AnnotationLayer.d.ts +18 -0
- package/dist/canvas/AnnotationLayer.d.ts.map +1 -0
- package/dist/canvas/BusHandles.d.ts +10 -0
- package/dist/canvas/BusHandles.d.ts.map +1 -0
- package/dist/canvas/BusLayer.d.ts +8 -0
- package/dist/canvas/BusLayer.d.ts.map +1 -0
- package/dist/canvas/BusbarPreview.d.ts +7 -0
- package/dist/canvas/BusbarPreview.d.ts.map +1 -0
- package/dist/canvas/CanvasSvg.d.ts +11 -0
- package/dist/canvas/CanvasSvg.d.ts.map +1 -0
- package/dist/canvas/ElementHoverLabel.d.ts +9 -0
- package/dist/canvas/ElementHoverLabel.d.ts.map +1 -0
- package/dist/canvas/ElementLayer.d.ts +17 -0
- package/dist/canvas/ElementLayer.d.ts.map +1 -0
- package/dist/canvas/FreeAnnotationLayer.d.ts +18 -0
- package/dist/canvas/FreeAnnotationLayer.d.ts.map +1 -0
- package/dist/canvas/MarqueeOverlay.d.ts +6 -0
- package/dist/canvas/MarqueeOverlay.d.ts.map +1 -0
- package/dist/canvas/PlaceGhost.d.ts +16 -0
- package/dist/canvas/PlaceGhost.d.ts.map +1 -0
- package/dist/canvas/SelectionOverlay.d.ts +7 -0
- package/dist/canvas/SelectionOverlay.d.ts.map +1 -0
- package/dist/canvas/TerminalLayer.d.ts +13 -0
- package/dist/canvas/TerminalLayer.d.ts.map +1 -0
- package/dist/canvas/WireLayer.d.ts +11 -0
- package/dist/canvas/WireLayer.d.ts.map +1 -0
- package/dist/canvas/WirePreview.d.ts +8 -0
- package/dist/canvas/WirePreview.d.ts.map +1 -0
- package/dist/canvas/drop-on-bus.d.ts +45 -0
- package/dist/canvas/drop-on-bus.d.ts.map +1 -0
- package/dist/canvas/fit-to-content.d.ts +22 -0
- package/dist/canvas/fit-to-content.d.ts.map +1 -0
- package/dist/canvas/grid.d.ts +14 -0
- package/dist/canvas/grid.d.ts.map +1 -0
- package/dist/canvas/hit-test.d.ts +14 -0
- package/dist/canvas/hit-test.d.ts.map +1 -0
- package/dist/canvas/hover-bus.d.ts +7 -0
- package/dist/canvas/hover-bus.d.ts.map +1 -0
- package/dist/canvas/index.d.ts +11 -0
- package/dist/canvas/index.d.ts.map +1 -0
- package/dist/canvas/marquee-bus.d.ts +17 -0
- package/dist/canvas/marquee-bus.d.ts.map +1 -0
- package/dist/canvas/resolve-wire-target.d.ts +4 -0
- package/dist/canvas/resolve-wire-target.d.ts.map +1 -0
- package/dist/canvas/synthetic-pointer-cancel.d.ts +12 -0
- package/dist/canvas/synthetic-pointer-cancel.d.ts.map +1 -0
- package/dist/canvas/tools/BusbarTool.d.ts +3 -0
- package/dist/canvas/tools/BusbarTool.d.ts.map +1 -0
- package/dist/canvas/tools/PanTool.d.ts +3 -0
- package/dist/canvas/tools/PanTool.d.ts.map +1 -0
- package/dist/canvas/tools/PlaceTool.d.ts +3 -0
- package/dist/canvas/tools/PlaceTool.d.ts.map +1 -0
- package/dist/canvas/tools/SelectTool.d.ts +3 -0
- package/dist/canvas/tools/SelectTool.d.ts.map +1 -0
- package/dist/canvas/tools/TextTool.d.ts +3 -0
- package/dist/canvas/tools/TextTool.d.ts.map +1 -0
- package/dist/canvas/tools/WireTool.d.ts +3 -0
- package/dist/canvas/tools/WireTool.d.ts.map +1 -0
- package/dist/canvas/tools/index.d.ts +4 -0
- package/dist/canvas/tools/index.d.ts.map +1 -0
- package/dist/canvas/tools/types.d.ts +25 -0
- package/dist/canvas/tools/types.d.ts.map +1 -0
- package/dist/canvas/touch.d.ts +20 -0
- package/dist/canvas/touch.d.ts.map +1 -0
- package/dist/canvas/transform-attr.d.ts +3 -0
- package/dist/canvas/transform-attr.d.ts.map +1 -0
- package/dist/canvas/useHoverHighlight.d.ts +3 -0
- package/dist/canvas/useHoverHighlight.d.ts.map +1 -0
- package/dist/canvas/useKeyboardShortcuts.d.ts +15 -0
- package/dist/canvas/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/canvas/useTools.d.ts +4 -0
- package/dist/canvas/useTools.d.ts.map +1 -0
- package/dist/canvas/useViewport.d.ts +18 -0
- package/dist/canvas/useViewport.d.ts.map +1 -0
- package/dist/canvas/viewport-bus.d.ts +4 -0
- package/dist/canvas/viewport-bus.d.ts.map +1 -0
- package/dist/canvas/wire-target-bus.d.ts +14 -0
- package/dist/canvas/wire-target-bus.d.ts.map +1 -0
- package/dist/canvas/zoom-bus.d.ts +11 -0
- package/dist/canvas/zoom-bus.d.ts.map +1 -0
- package/dist/compiler/auto-layout.d.ts +18 -0
- package/dist/compiler/auto-layout.d.ts.map +1 -0
- package/dist/compiler/auto-route.d.ts +10 -0
- package/dist/compiler/auto-route.d.ts.map +1 -0
- package/dist/compiler/compile.d.ts +4 -0
- package/dist/compiler/compile.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +6 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/internal-model.d.ts +73 -0
- package/dist/compiler/internal-model.d.ts.map +1 -0
- package/dist/compiler/library-index.d.ts +4 -0
- package/dist/compiler/library-index.d.ts.map +1 -0
- package/dist/compiler/transforms.d.ts +7 -0
- package/dist/compiler/transforms.d.ts.map +1 -0
- package/dist/compiler/union-find.d.ts +14 -0
- package/dist/compiler/union-find.d.ts.map +1 -0
- package/dist/components/ContextMenu.d.ts +26 -0
- package/dist/components/ContextMenu.d.ts.map +1 -0
- package/dist/components/ContextualToolbar.d.ts +12 -0
- package/dist/components/ContextualToolbar.d.ts.map +1 -0
- package/dist/components/EditorShell.d.ts +2 -0
- package/dist/components/EditorShell.d.ts.map +1 -0
- package/dist/components/ExportMenu.d.ts +8 -0
- package/dist/components/ExportMenu.d.ts.map +1 -0
- package/dist/components/FileMenu.d.ts +11 -0
- package/dist/components/FileMenu.d.ts.map +1 -0
- package/dist/components/FloatingToolbar.d.ts +2 -0
- package/dist/components/FloatingToolbar.d.ts.map +1 -0
- package/dist/components/LeftPanel.d.ts +2 -0
- package/dist/components/LeftPanel.d.ts.map +1 -0
- package/dist/components/LibraryPopover.d.ts +8 -0
- package/dist/components/LibraryPopover.d.ts.map +1 -0
- package/dist/components/OnboardingCard.d.ts +13 -0
- package/dist/components/OnboardingCard.d.ts.map +1 -0
- package/dist/components/PropertyPanel.d.ts +8 -0
- package/dist/components/PropertyPanel.d.ts.map +1 -0
- package/dist/components/RightPanel.d.ts +2 -0
- package/dist/components/RightPanel.d.ts.map +1 -0
- package/dist/components/ViewToolbar.d.ts +19 -0
- package/dist/components/ViewToolbar.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts +18 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/upward-popover.d.ts +8 -0
- package/dist/components/ui/upward-popover.d.ts.map +1 -0
- package/dist/element-library/index.d.ts +14 -0
- package/dist/element-library/index.d.ts.map +1 -0
- package/dist/hooks/editor-tier.d.ts +32 -0
- package/dist/hooks/editor-tier.d.ts.map +1 -0
- package/dist/hooks/use-editor-tier.d.ts +6 -0
- package/dist/hooks/use-editor-tier.d.ts.map +1 -0
- package/dist/hooks/use-onboarding.d.ts +15 -0
- package/dist/hooks/use-onboarding.d.ts.map +1 -0
- package/dist/hooks/use-panels.d.ts +16 -0
- package/dist/hooks/use-panels.d.ts.map +1 -0
- package/dist/hooks/use-theme.d.ts +24 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +14 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/library.d.ts +14 -0
- package/dist/i18n/library.d.ts.map +1 -0
- package/dist/i18n/messages.d.ts +348 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/export-dxf.d.ts +16 -0
- package/dist/lib/export-dxf.d.ts.map +1 -0
- package/dist/lib/export-image.d.ts +13 -0
- package/dist/lib/export-image.d.ts.map +1 -0
- package/dist/lib/file-io.d.ts +26 -0
- package/dist/lib/file-io.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/library.d.ts +115 -0
- package/dist/model/library.d.ts.map +1 -0
- package/dist/model/types.d.ts +78 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/sldeditor.cjs +193 -0
- package/dist/sldeditor.cjs.map +1 -0
- package/dist/sldeditor.js +11601 -0
- package/dist/sldeditor.js.map +1 -0
- package/dist/store/id-allocator.d.ts +11 -0
- package/dist/store/id-allocator.d.ts.map +1 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/store.d.ts +104 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +107 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { OneLineEditor } from './OneLineEditor';
|
|
2
|
+
export type { OneLineEditorProps } from './OneLineEditor';
|
|
3
|
+
export type { OneLineEditorProps as SldEditorProps } from './OneLineEditor';
|
|
4
|
+
export type { Bus, BusId, BusLayout, DiagramFile, DiagramMeta, DiagramVersion, Element, ElementId, LibraryEntry, LibraryLabelAnchor, LibraryParamField, LibrarySource, LibraryStateField, LibraryStretchable, LibraryTerminal, NodeId, Orientation, ParamValue, PinName, Placement, TerminalRef, Wire, WireEnd, WireId, } from './model';
|
|
5
|
+
export { compile, LIBRARY, getLibraryEntry, emptyInternalModel, resolvePlacement, transformPoint, transformOrientation, orientationVec, } from './compiler';
|
|
6
|
+
export type { BusGeometry, ConnectivityNode, Diagnostic, InternalModel, ResolvedBus, ResolvedElement, ResolvedPlacement, TerminalGeometry, WireRender, } from './compiler';
|
|
7
|
+
export { useEditorStore } from './store';
|
|
8
|
+
export type { EditorState } from './store';
|
|
9
|
+
export { newBusId, newElementId, wireIdFromEnds, } from './store/id-allocator';
|
|
10
|
+
export { useLocale } from './i18n';
|
|
11
|
+
export type { Locale } from './i18n';
|
|
12
|
+
export { applyTheme, getInitialTheme } from './hooks/use-theme';
|
|
13
|
+
export type { Theme } from './hooks/use-theme';
|
|
14
|
+
export { FileMenu } from './components/FileMenu';
|
|
15
|
+
export { ExportMenu } from './components/ExportMenu';
|
|
16
|
+
export { fitToContent, fitToContentSoon } from './canvas/fit-to-content';
|
|
17
|
+
export { buildExportSvg, downloadSvg, downloadPng } from './lib/export-image';
|
|
18
|
+
export { buildExportDxf, downloadDxf } from './lib/export-dxf';
|
|
19
|
+
export type { DxfExportOptions } from './lib/export-dxf';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,kBAAkB,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5E,YAAY,EACV,GAAG,EACH,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,EACP,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,IAAI,EACJ,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAC;AAIjB,OAAO,EACL,OAAO,EACP,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAMrC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAChE,YAAY,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAI/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKzE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InternalModel } from '../compiler';
|
|
2
|
+
import { LabelMode, TextAnnotation } from '../model';
|
|
3
|
+
export interface DxfExportOptions {
|
|
4
|
+
/** Used as the $PROJECTNAME header value when present. */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** Decimal places for coordinate output. Default 6. */
|
|
7
|
+
precision?: number;
|
|
8
|
+
/** Element label visibility. Mirrors `DiagramFile.meta.labelMode`. Default 'all'. */
|
|
9
|
+
labelMode?: LabelMode;
|
|
10
|
+
/** Free text annotations from `DiagramFile.annotations` — `InternalModel`
|
|
11
|
+
* doesn't carry them, so the caller passes them through. */
|
|
12
|
+
annotations?: TextAnnotation[];
|
|
13
|
+
}
|
|
14
|
+
export declare function buildExportDxf(model: InternalModel, opts?: DxfExportOptions): string;
|
|
15
|
+
export declare function downloadDxf(model: InternalModel, filename?: string, opts?: DxfExportOptions): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=export-dxf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-dxf.d.ts","sourceRoot":"","sources":["../../src/lib/export-dxf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,SAAS,EAGT,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;iEAC6D;IAC7D,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;CAChC;AAeD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,IAAI,GAAE,gBAAqB,GAC1B,MAAM,CAyER;AAED,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,SAAgB,EACxB,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InternalModel } from '../compiler';
|
|
2
|
+
export interface ExportOptions {
|
|
3
|
+
/** Title used as the suggested filename / SVG <title>. */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Background fill (`'transparent'` skips the rect). Default white. */
|
|
6
|
+
background?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildExportSvg(model: InternalModel, opts?: ExportOptions): string;
|
|
9
|
+
export declare function downloadSvg(model: InternalModel, filename?: string, opts?: ExportOptions): Promise<void>;
|
|
10
|
+
export declare function downloadPng(model: InternalModel, filename?: string, opts?: ExportOptions & {
|
|
11
|
+
scale?: number;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=export-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-image.d.ts","sourceRoot":"","sources":["../../src/lib/export-image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAYjE,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EACpB,IAAI,GAAE,aAAkB,GACvB,MAAM,CAwDR;AA0ED,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,SAAgB,EACxB,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,QAAQ,SAAgB,EACxB,IAAI,CAAC,EAAE,aAAa,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DiagramFile } from '../model';
|
|
2
|
+
/** Tracks the currently associated on-disk file across open / save calls. */
|
|
3
|
+
export interface FileSession {
|
|
4
|
+
/** Present only when the FS Access API is available; lets save() overwrite. */
|
|
5
|
+
handle?: FileSystemFileHandle;
|
|
6
|
+
/** Display name shown in the title bar / save dialog default. */
|
|
7
|
+
name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Pop the OS file picker and load a DiagramFile. Resolves to `null` when
|
|
11
|
+
* the user cancels.
|
|
12
|
+
*/
|
|
13
|
+
export declare function openDiagram(): Promise<{
|
|
14
|
+
diagram: DiagramFile;
|
|
15
|
+
session: FileSession;
|
|
16
|
+
} | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Save a DiagramFile to disk. With an existing handle and `saveAs=false`,
|
|
19
|
+
* overwrites in place; otherwise prompts for a destination (or downloads in
|
|
20
|
+
* browsers without FS Access). Resolves to the new session, or `null` if
|
|
21
|
+
* the user cancelled.
|
|
22
|
+
*/
|
|
23
|
+
export declare function saveDiagram(diagram: DiagramFile, session: FileSession | null, options?: {
|
|
24
|
+
saveAs?: boolean;
|
|
25
|
+
}): Promise<FileSession | null>;
|
|
26
|
+
//# sourceMappingURL=file-io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-io.d.ts","sourceRoot":"","sources":["../../src/lib/file-io.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;CACd;AAgCD;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC;IAC3C,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;CACtB,GAAG,IAAI,CAAC,CAsCR;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAmC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { AnnotationId, Bus, BusId, BusLayout, DiagramFile, DiagramMeta, DiagramVersion, Element, ElementId, LabelMode, NodeId, ParamValue, PinName, Placement, TerminalRef, TextAnnotation, Wire, WireEnd, WireId, } from './types';
|
|
2
|
+
export type { LibraryEntry, LibraryTerminal, LibraryStretchable, LibraryStateField, LibraryParamField, LibraryLabelAnchor, LibrarySource, Orientation, } from './library';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,GAAG,EACH,KAAK,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,EACP,SAAS,EACT,SAAS,EACT,MAAM,EACN,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,cAAc,EACd,IAAI,EACJ,OAAO,EACP,MAAM,GACP,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema for the element library: one JSON file per symbol under
|
|
3
|
+
* `src/element-library/`, e.g. `breaker.json`. Frontends auto-discover via
|
|
4
|
+
* `import.meta.glob('./*.json')`.
|
|
5
|
+
*
|
|
6
|
+
* `LibraryEntry.id` is the canonical value of `Element.kind` in DiagramFile.
|
|
7
|
+
*/
|
|
8
|
+
/** Cardinal direction a terminal faces; used by routing for the exit angle. */
|
|
9
|
+
export type Orientation = 'n' | 's' | 'e' | 'w';
|
|
10
|
+
/** Provenance of a library symbol. */
|
|
11
|
+
export type LibrarySource = {
|
|
12
|
+
kind: 'inline';
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'elmt';
|
|
15
|
+
path: string;
|
|
16
|
+
qetEnglishName?: string;
|
|
17
|
+
};
|
|
18
|
+
/** A connection point on a library element, in the element's local frame. */
|
|
19
|
+
export interface LibraryTerminal {
|
|
20
|
+
/** Pin name, unique within the element. e.g. "t1", "t_left". */
|
|
21
|
+
id: string;
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
orientation: Orientation;
|
|
25
|
+
}
|
|
26
|
+
/** Stretch behavior, e.g. for busbar segments. */
|
|
27
|
+
export interface LibraryStretchable {
|
|
28
|
+
axis: 'x' | 'y';
|
|
29
|
+
minLength: number;
|
|
30
|
+
/** Length at scale 1.0 along the stretch axis. */
|
|
31
|
+
naturalSpan: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* State flag declared by a library entry. State lives on `Element.state`
|
|
35
|
+
* (a flat record), not on per-kind shorthand fields, so adding a new kind
|
|
36
|
+
* does not require TypeScript changes.
|
|
37
|
+
*
|
|
38
|
+
* Example: a breaker entry declares `[{ name: 'open', type: 'boolean', default: false }]`,
|
|
39
|
+
* a fuse declares `[{ name: 'blown', type: 'boolean', default: false }]`.
|
|
40
|
+
*/
|
|
41
|
+
export interface LibraryStateField {
|
|
42
|
+
/** Field key on `Element.state`. */
|
|
43
|
+
name: string;
|
|
44
|
+
type: 'boolean' | 'number' | 'string';
|
|
45
|
+
default?: boolean | number | string;
|
|
46
|
+
/** Optional human label for property panels. */
|
|
47
|
+
label?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parameter schema declared by a library entry. Drives the property panel:
|
|
51
|
+
* declared keys render with their human label + unit; any extra keys present
|
|
52
|
+
* on `Element.params` (not in the schema) still render generically so JSON
|
|
53
|
+
* authors can add custom fields without library updates.
|
|
54
|
+
*/
|
|
55
|
+
export interface LibraryParamField {
|
|
56
|
+
/** Field key on `Element.params`. */
|
|
57
|
+
name: string;
|
|
58
|
+
type: 'boolean' | 'number' | 'string';
|
|
59
|
+
default?: boolean | number | string;
|
|
60
|
+
/** Human label (Chinese in v0). Falls back to `name` when omitted. */
|
|
61
|
+
label?: string;
|
|
62
|
+
/** Display-only unit suffix, e.g. "kV", "MVA", "Ω". */
|
|
63
|
+
unit?: string;
|
|
64
|
+
/** When true, the value (with unit) appears as a structural label on the
|
|
65
|
+
* canvas next to the symbol — see `AnnotationLayer`. Off by default. */
|
|
66
|
+
showOnCanvas?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Where a structural-label block (element ID + showOnCanvas params) anchors
|
|
70
|
+
* relative to the element's local frame. Used by `AnnotationLayer`.
|
|
71
|
+
*/
|
|
72
|
+
export interface LibraryLabelAnchor {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
/** SVG `text-anchor`; defaults to `'start'` when omitted. */
|
|
76
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* One symbol entry in the element library — the contents of a single
|
|
80
|
+
* `src/element-library/<id>.json` file.
|
|
81
|
+
*/
|
|
82
|
+
export interface LibraryEntry {
|
|
83
|
+
/** Library-scoped ID, kebab-case. Referenced by `Element.kind`. */
|
|
84
|
+
id: string;
|
|
85
|
+
/** Display name (Chinese in v0). */
|
|
86
|
+
name: string;
|
|
87
|
+
/** Palette grouping; consumers group entries by this for the side panel. */
|
|
88
|
+
category: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
/** SVG viewBox. The element's hotspot/origin is at local (0, 0). */
|
|
91
|
+
viewBox: string;
|
|
92
|
+
width: number;
|
|
93
|
+
height: number;
|
|
94
|
+
/** Inner SVG fragment, no `<svg>` wrapper. */
|
|
95
|
+
svg: string;
|
|
96
|
+
terminals: LibraryTerminal[];
|
|
97
|
+
stretchable?: LibraryStretchable;
|
|
98
|
+
/**
|
|
99
|
+
* State fields this kind accepts on `Element.state`. Omitted = no state.
|
|
100
|
+
* Used by the property panel and validators; not enforced at TS compile time.
|
|
101
|
+
*/
|
|
102
|
+
state?: LibraryStateField[];
|
|
103
|
+
/**
|
|
104
|
+
* Parameter fields this kind declares on `Element.params`. Used by the
|
|
105
|
+
* property panel to render labeled / unit-suffixed inputs. Not enforced
|
|
106
|
+
* at TS compile time. Extras (keys present on `Element.params` but not in
|
|
107
|
+
* this list) still render generically.
|
|
108
|
+
*/
|
|
109
|
+
params?: LibraryParamField[];
|
|
110
|
+
/** Anchor for the structural label block (ID + showOnCanvas params). When
|
|
111
|
+
* omitted, `AnnotationLayer` falls back to the right edge of the viewBox. */
|
|
112
|
+
label?: LibraryLabelAnchor;
|
|
113
|
+
source: LibrarySource;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../src/model/library.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEhD,sCAAsC;AACtC,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,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AAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC7B;kFAC8E;IAC9E,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;CACvB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { LibraryEntry } from './library';
|
|
2
|
+
export type DiagramVersion = '1';
|
|
3
|
+
export type ElementId = string;
|
|
4
|
+
export type PinName = string;
|
|
5
|
+
export type NodeId = string;
|
|
6
|
+
export type BusId = ElementId;
|
|
7
|
+
export type WireId = string;
|
|
8
|
+
/** "elementId.pinName" — dotted form for device pins. */
|
|
9
|
+
export type TerminalRef = `${ElementId}.${PinName}`;
|
|
10
|
+
/**
|
|
11
|
+
* Either a device terminal ("X.Y") or a bare bus id ("X"). Disambiguated by
|
|
12
|
+
* the presence of a `.` — bus ids are never dotted.
|
|
13
|
+
*/
|
|
14
|
+
export type WireEnd = TerminalRef | BusId;
|
|
15
|
+
export type ParamValue = number | string | boolean;
|
|
16
|
+
export type LabelMode = 'off' | 'id' | 'all';
|
|
17
|
+
export interface DiagramFile {
|
|
18
|
+
version: DiagramVersion;
|
|
19
|
+
meta?: DiagramMeta;
|
|
20
|
+
/** Devices only. Buses live in `buses`. */
|
|
21
|
+
elements: Element[];
|
|
22
|
+
/** Bus collection. Each bus is a hyperedge node, not an element. */
|
|
23
|
+
buses?: Bus[];
|
|
24
|
+
/** Binary line segments between two endpoints (terminal pin or bare bus id). */
|
|
25
|
+
wires?: Wire[];
|
|
26
|
+
/** Device placements only. Bus geometry lives in `Bus.layout`. */
|
|
27
|
+
layout?: Record<ElementId, Placement>;
|
|
28
|
+
annotations?: TextAnnotation[];
|
|
29
|
+
}
|
|
30
|
+
export interface DiagramMeta {
|
|
31
|
+
title?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
author?: string;
|
|
34
|
+
createdAt?: string;
|
|
35
|
+
updatedAt?: string;
|
|
36
|
+
labelMode?: LabelMode;
|
|
37
|
+
}
|
|
38
|
+
export interface Element {
|
|
39
|
+
id: ElementId;
|
|
40
|
+
/** LibraryEntry.id (see src/element-library/). */
|
|
41
|
+
kind: LibraryEntry['id'] | (string & {});
|
|
42
|
+
name?: string;
|
|
43
|
+
note?: string;
|
|
44
|
+
params?: Record<string, ParamValue>;
|
|
45
|
+
state?: Record<string, ParamValue>;
|
|
46
|
+
}
|
|
47
|
+
export interface Bus {
|
|
48
|
+
id: BusId;
|
|
49
|
+
name?: string;
|
|
50
|
+
note?: string;
|
|
51
|
+
params?: Record<string, ParamValue>;
|
|
52
|
+
/** If absent, auto-layout computes geometry. */
|
|
53
|
+
layout?: BusLayout;
|
|
54
|
+
}
|
|
55
|
+
export interface BusLayout {
|
|
56
|
+
at: [number, number];
|
|
57
|
+
span: number;
|
|
58
|
+
rot?: 0 | 90 | 180 | 270;
|
|
59
|
+
}
|
|
60
|
+
export interface Wire {
|
|
61
|
+
id: WireId;
|
|
62
|
+
ends: [WireEnd, WireEnd];
|
|
63
|
+
/** Optional manual route path. Absent → auto-route. */
|
|
64
|
+
path?: [number, number][];
|
|
65
|
+
}
|
|
66
|
+
export interface Placement {
|
|
67
|
+
at: [number, number];
|
|
68
|
+
rot?: 0 | 90 | 180 | 270;
|
|
69
|
+
mirror?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export type AnnotationId = string;
|
|
72
|
+
export interface TextAnnotation {
|
|
73
|
+
id: AnnotationId;
|
|
74
|
+
at: [number, number];
|
|
75
|
+
text: string;
|
|
76
|
+
fontSize?: number;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/model/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC;AACjC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAC/B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAC7B,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC;AAC9B,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,GAAG,SAAS,IAAI,OAAO,EAAE,CAAC;AACpD;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,KAAK,CAAC;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,2CAA2C;IAC3C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,oEAAoE;IACpE,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,gFAAgF;IAChF,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,c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