@edubeam/plot 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Support symbols. Each restrained DOF combination has one symbol, drawn in screen pixels in a frame
3
+ * where +y points to the ground, then turned to suit the node: by a rotated support's axes, and away
4
+ * from the members that meet there.
5
+ */
6
+ import type { Fixity, PlotModel, PlotNode } from './model.js';
7
+ export type SupportKind =
8
+ /** Dx, Dz and Ry held: a clamp. */
9
+ 'fixed'
10
+ /** Dx and Dz held. */
11
+ | 'pin'
12
+ /** One translation held: Dz (rolls along x) or Dx (rolls along z). */
13
+ | 'roller'
14
+ /** One translation and the rotation held: slides along the free axis between two rails. */
15
+ | 'slider'
16
+ /** Only the rotation held. */
17
+ | 'rotation' | 'none';
18
+ export declare const supportKind: (f: Fixity) => SupportKind;
19
+ export type Point = readonly [number, number];
20
+ export interface GlyphPart {
21
+ readonly points: readonly Point[];
22
+ readonly closed?: boolean;
23
+ /** `bold` for the line the structure bears on, `thin` for hatching. */
24
+ readonly weight: 'thin' | 'regular' | 'bold';
25
+ /** Painted with the background, so the member does not show through a triangle. */
26
+ readonly fill?: 'paper';
27
+ }
28
+ export declare const supportGlyph: (kind: SupportKind) => readonly GlyphPart[];
29
+ export interface SupportPlacement {
30
+ readonly node: string;
31
+ readonly kind: SupportKind;
32
+ /** Clockwise turn of the glyph on screen, degrees. */
33
+ readonly rotation: number;
34
+ }
35
+ /** Sum of unit vectors from the node along each member that meets it. */
36
+ export declare const memberDirections: (model: PlotModel, node: PlotNode) => {
37
+ x: number;
38
+ z: number;
39
+ count: number;
40
+ };
41
+ /** The glyph's ground direction, (0, 1) turned by `rotation` degrees clockwise. */
42
+ export declare const groundDirection: (rotation: number) => {
43
+ x: number;
44
+ z: number;
45
+ };
46
+ export declare const supportPlacement: (model: PlotModel, node: PlotNode) => SupportPlacement;
47
+ /** An angle in (−180, 180]. */
48
+ export declare const normalizeDegrees: (deg: number) => number;
49
+ /** How far the turned glyph reaches from the node along the unit direction (x, z), in px. */
50
+ export declare const glyphReach: (kind: SupportKind, rotation: number, x: number, z: number) => number;
@@ -0,0 +1,50 @@
1
+ import type { PlotModel } from './model.js';
2
+ import { type Tone } from './scene.js';
3
+ import { type PlotLayer, type ReactionLabels, type ResultLabelMode, type TemperatureSymbols } from './structure.js';
4
+ import { type Units } from './units.js';
5
+ /** Concrete colours for a file that has no page around it: the EduBeam app's, on white. */
6
+ export declare const PRINT_COLORS: Readonly<Record<Tone | 'paper', string>>;
7
+ export interface StructureSvgOptions {
8
+ /** Layers to draw. Default: members, supports, loads, reactions and the result `StructurePlot` picks. */
9
+ readonly layers?: readonly PlotLayer[];
10
+ /**
11
+ * Layers to make room for besides `layers`, as `StructurePlot`'s `reserve`: give every stage of a
12
+ * build-up the last stage's layers, and the files line up when laid over each other (Beamer overlays).
13
+ */
14
+ readonly reserve?: readonly PlotLayer[];
15
+ /** Label styles to make room for besides `resultLabelMode`. */
16
+ readonly reserveLabelModes?: readonly ResultLabelMode[];
17
+ /** Reaction label styles to make room for besides `reactionLabels`, so a sheet and its key line up. */
18
+ readonly reserveReactionLabels?: readonly ReactionLabels[];
19
+ /** Width of the drawing, px (the SVG's user units). Default 640. */
20
+ readonly width?: number;
21
+ /** Fixed height, px; by default the height follows the drawing, up to `maxHeight`. */
22
+ readonly height?: number;
23
+ readonly maxHeight?: number;
24
+ readonly padding?: number;
25
+ readonly fontSize?: number;
26
+ /** Any font stack the program opening the file knows. */
27
+ readonly fontFamily?: string;
28
+ readonly compact?: boolean;
29
+ readonly units?: Partial<Units>;
30
+ readonly numberFormat?: Intl.NumberFormat;
31
+ /** The temperature load's symbols, `ΔT` and `ΔTb − ΔTt` unless given */
32
+ readonly temperatureSymbols?: TemperatureSymbols;
33
+ readonly colors?: Partial<Record<Tone | 'paper', string>>;
34
+ readonly diagramSize?: number;
35
+ readonly deformedSize?: number;
36
+ readonly momentOnTensionSide?: boolean;
37
+ readonly resultLabelMode?: ResultLabelMode;
38
+ /** `names` draws the reactions as an exercise's unknowns, as `StructurePlot`'s `reactionLabels`. */
39
+ readonly reactionLabels?: ReactionLabels;
40
+ /** Paint the background in `paper`; off leaves it transparent. Default on. */
41
+ readonly background?: boolean;
42
+ /** Accessible name, written as the SVG's `<title>`. */
43
+ readonly title?: string;
44
+ }
45
+ /**
46
+ * The plot of a model as the text of a standalone `.svg` file, laid out as `StructurePlot` lays it
47
+ * out. Labels carry their halo as a separate text drawn underneath, for programs that ignore
48
+ * `paint-order`.
49
+ */
50
+ export declare const structureSvg: (model: PlotModel, options?: StructureSvgOptions) => string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Display units. Values stay SI everywhere else; a unit only says how to show one.
3
+ */
4
+ export interface Unit {
5
+ readonly symbol: string;
6
+ /** Display value = SI value × scale (N → kN is 1e-3). */
7
+ readonly scale: number;
8
+ }
9
+ export interface Units {
10
+ readonly force: Unit;
11
+ readonly moment: Unit;
12
+ readonly distributed: Unit;
13
+ readonly length: Unit;
14
+ readonly displacement: Unit;
15
+ readonly rotation: Unit;
16
+ readonly temperature: Unit;
17
+ }
18
+ export type UnitKind = keyof Units;
19
+ export declare const SI_UNITS: Units;
20
+ /** kN, kNm and mm: what structural engineering courses read. The default. */
21
+ export declare const KN_UNITS: Units;
22
+ export declare const resolveUnits: (units?: Partial<Units>) => Units;
23
+ /** One decimal, as the website's figures write their values. */
24
+ export declare const DEFAULT_NUMBER_FORMAT: Intl.NumberFormat;
25
+ /**
26
+ * The number alone, with a true minus sign, and no "-0" for a value that rounds to zero.
27
+ */
28
+ export declare const formatNumber: (value: number, format?: Intl.NumberFormat) => string;
29
+ /** "36 kN": the SI value in the given unit. A narrow no-break space keeps the two together. */
30
+ export declare const formatQuantity: (si: number, unit: Unit, format?: Intl.NumberFormat) => string;
@@ -0,0 +1,17 @@
1
+ export { default as StructurePlot } from './components/StructurePlot.vue.js';
2
+ export { default as DiagramStack } from './components/DiagramStack.vue.js';
3
+ export { DEFAULT_COLORS, PLOT_CSS, toneVars, type PlotColors } from './components/theme.js';
4
+ export type { DiagramStackEmits, DiagramStackProps, StackReadout, StructurePlotEmits, StructurePlotProps, } from './components/types.js';
5
+ export { EduBeamPlot } from './plugin.js';
6
+ export { DEFAULT_PLOT_TEXTS, PLOT_TEXTS, usePlotTexts, type PlotTexts } from './components/texts.js';
7
+ export { modelFromSolver, type FromSolverOptions } from './core/fromSolver.js';
8
+ export { layoutStructure, alternativeResultGroups, type StructureLayout } from './core/layout.js';
9
+ export { structureSvg, PRINT_COLORS, type StructureSvgOptions } from './core/svg.js';
10
+ export * from './core/model.js';
11
+ export * from './core/polynomial.js';
12
+ export * from './core/units.js';
13
+ export { supportKind, supportPlacement, supportGlyph, glyphReach, type SupportKind, type SupportPlacement, type GlyphPart, } from './core/supports.js';
14
+ export { buildStructureScene, defaultResultLayer, diagramScales, diagramSide, isBarStructure, memberFrames, HATCH_SPACING_PX, DEFAULT_TEMPERATURE_SYMBOLS, PLOT_LAYERS, RESULT_LAYERS, type PlotLayer, type TemperatureSymbols, type ReactionLabels, type ResultLabelMode, type ResultLayer, type StructureSceneOptions, tipPlacements, } from './core/structure.js';
15
+ export { fitScene, placeLabels, resolveScene, sceneBounds, project, type Anchor, type Fit, type FitBox, type SceneItem, type ResolvedScene, type ResolvedPath, type ResolvedText, type ResolvedCircle, type ResolveOptions, type SceneText, type Bounds, type TextPlacement, type Transform, type Tone, } from './core/scene.js';
16
+ export { readMember, readoutAt, readoutMarks, formatReadout, type Readout, type ReadoutMark, type ReadoutQuantity, type SidedValue, } from './core/readout.js';
17
+ export { beamLine, lineDiagram, lineModel, pointLoadAt, rowOutline, rowOrdinates, rowRange, rowPeaks, rowBreaks, type BeamLine, type LineMember, type RowPeak, type StackRow, } from './core/stack.js';