@edubeam/plot 0.3.0 → 0.3.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/CHANGELOG.md +23 -0
- package/dist/core/scene.d.ts +25 -1
- package/dist/core/structure.d.ts +15 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +987 -810
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@edubeam/plot` are listed here. The project follows [Semantic Versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## 0.3.1 (2026-11-21)
|
|
6
|
+
|
|
7
|
+
- Every diagram has an undrawn `hitArea` path covering it, whatever its fill, tagged with its member, so an app
|
|
8
|
+
can treat the pointer over a diagram as over its member.
|
|
9
|
+
- A member's name along a vertical member reads upward, as the diagrams' values do; it read downward.
|
|
10
|
+
- A member's name stays at its member's middle across a diagram's line, moving only for another label.
|
|
11
|
+
- A power of ten in a label (`1.63·10⁻³`) is written as a real superscript, smaller and raised, in plain digits,
|
|
12
|
+
in the component and in `.svg` files alike; `textRuns` splits a label so an app can do the same.
|
|
13
|
+
- `displacementMarker` marks the largest displacement: a dot on the deformed shape and a dashed line to it from
|
|
14
|
+
where that point was. Its value may stand anywhere round the dot, and is placed after every maximum.
|
|
15
|
+
- `extremeOrdinates` draws the ordinate of a diagram's maximum inside a member (the largest moment under a
|
|
16
|
+
distributed load). A maximum's value stays at its tip across other diagrams' lines.
|
|
17
|
+
- A scene item's `requires` names the label it goes with: left out for want of room, the label takes its marks
|
|
18
|
+
with it, so no dot or ordinate points at a value that is not there.
|
|
19
|
+
- `loadNumberFormat`: the loads' values in a format of their own, so given data can drop the zeros results keep
|
|
20
|
+
(10 kN, not 10.00 kN).
|
|
21
|
+
- A point force's value tries other places round its arrow before giving up, and given data with no free place
|
|
22
|
+
takes the place that covers the fewest labels, instead of overlapping at its first.
|
|
23
|
+
- Among given data's labels of equal rank, the one with the fewest places is placed first.
|
|
24
|
+
- `keptGroups`: a label with no free place takes the place that covers the fewest labels already kept, rather
|
|
25
|
+
than always its first.
|
|
26
|
+
- A nodal load naming a node that is not in the model is left out by `modelFromSolver` instead of throwing.
|
|
27
|
+
|
|
5
28
|
## 0.3.0 (2026-11-20)
|
|
6
29
|
|
|
7
30
|
- **Drawing for an editor**: the options the EduBeam app's new renderer draws with, all off by default.
|
package/dist/core/scene.d.ts
CHANGED
|
@@ -54,6 +54,11 @@ interface SceneBase {
|
|
|
54
54
|
* `node:<id>`, or a load's own `source`. Items of nothing in particular (dimensions) have none.
|
|
55
55
|
*/
|
|
56
56
|
readonly entity?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Drawn only when this label is: a mark that points at a value (a maximum's ordinate, the largest
|
|
59
|
+
* displacement's dot) goes with the value when there is no room for it, rather than point at nothing.
|
|
60
|
+
*/
|
|
61
|
+
readonly requires?: SceneText;
|
|
57
62
|
}
|
|
58
63
|
export interface ScenePath extends SceneBase {
|
|
59
64
|
readonly kind: 'path';
|
|
@@ -146,6 +151,22 @@ export interface Transform {
|
|
|
146
151
|
}
|
|
147
152
|
export declare const project: (t: Transform, a: Anchor) => [number, number];
|
|
148
153
|
export declare const textWidth: (text: string, size: number) => number;
|
|
154
|
+
/** A superscript's size, and how far it rises above the baseline, as shares of its text's size */
|
|
155
|
+
export declare const SUP_SCALE = 0.75;
|
|
156
|
+
export declare const SUP_RISE = 0.38;
|
|
157
|
+
/** A piece of a label: written on the line, or raised as a superscript and smaller */
|
|
158
|
+
export interface TextRun {
|
|
159
|
+
readonly text: string;
|
|
160
|
+
/** The size it is written at, px, where it is not the label's own */
|
|
161
|
+
readonly size?: number;
|
|
162
|
+
/** How far it moves the baseline, px: up into a superscript, back down after it */
|
|
163
|
+
readonly dy?: number;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A label's text in runs, its superscript characters (a power of ten, `1.71·10⁻³`) as a real
|
|
167
|
+
* superscript: plain digits, smaller and raised, rather than the font's tiny superscript glyphs.
|
|
168
|
+
*/
|
|
169
|
+
export declare const textRuns: (text: string, size: number) => TextRun[];
|
|
149
170
|
/** A subscript's size, as a share of its text's */
|
|
150
171
|
export declare const SUB_SCALE = 0.75;
|
|
151
172
|
/** How far a subscript drops below the baseline, as a share of its text's size */
|
|
@@ -276,7 +297,10 @@ export interface ResolveOptions {
|
|
|
276
297
|
* internal forces' values may lie over a band's side).
|
|
277
298
|
*/
|
|
278
299
|
readonly yieldingGroups?: ReadonlySet<string>;
|
|
279
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* Groups whose labels are never left out: with no free place, at the place that covers the least
|
|
302
|
+
* of the labels already kept (its first place among equals).
|
|
303
|
+
*/
|
|
280
304
|
readonly keptGroups?: ReadonlySet<string>;
|
|
281
305
|
}
|
|
282
306
|
export declare const placeLabels: (items: readonly SceneItem[], t: Transform, options: ResolveOptions) => Map<SceneText, SceneText>;
|
package/dist/core/structure.d.ts
CHANGED
|
@@ -69,6 +69,11 @@ export interface StructureSceneOptions {
|
|
|
69
69
|
readonly sideBySide?: boolean;
|
|
70
70
|
readonly units: Units;
|
|
71
71
|
readonly numberFormat?: Intl.NumberFormat;
|
|
72
|
+
/**
|
|
73
|
+
* Writes the loads' values, which are given rather than worked out: an editor may leave off the
|
|
74
|
+
* zeros its results keep (10 kN, not 10.00 kN). `numberFormat` when left out.
|
|
75
|
+
*/
|
|
76
|
+
readonly loadNumberFormat?: Intl.NumberFormat;
|
|
72
77
|
/**
|
|
73
78
|
* Writes a displacement, given in display units. Displacements are orders of magnitude smaller
|
|
74
79
|
* than the forces, so an editor writes them its own way (a power of ten where `numberFormat`'s
|
|
@@ -98,6 +103,16 @@ export interface StructureSceneOptions {
|
|
|
98
103
|
readonly diagramFill?: 'hatch' | 'solid' | 'none';
|
|
99
104
|
/** Write each piece's polynomial degree inside the diagram: 0°, 1°, 2°, 3°. */
|
|
100
105
|
readonly showDegrees?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Marks where the structure moves most, as a student marks w_max: a dot on the deformed shape,
|
|
108
|
+
* and a dashed line to it from where that point was.
|
|
109
|
+
*/
|
|
110
|
+
readonly displacementMarker?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* A diagram's extremes inside a member (the largest moment under a distributed load) get their
|
|
113
|
+
* ordinate drawn, from the member to the tip, as a student marks a maximum.
|
|
114
|
+
*/
|
|
115
|
+
readonly extremeOrdinates?: boolean;
|
|
101
116
|
/** Support symbols' size, as a multiple of the preset's (the editor's support size setting). */
|
|
102
117
|
readonly supportScale?: number;
|
|
103
118
|
/** The plot's font size, px: labels in a tight spot may step down from it to 10 px. */
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export * from './core/polynomial.js';
|
|
|
12
12
|
export * from './core/units.js';
|
|
13
13
|
export { supportKind, supportPlacement, supportGlyph, glyphReach, type SupportKind, type SupportPlacement, type GlyphPart, } from './core/supports.js';
|
|
14
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, type SymbolSizes, tipPlacements, } from './core/structure.js';
|
|
15
|
-
export { fitScene, placeLabels, resolveScene, mergePaths, 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';
|
|
15
|
+
export { fitScene, placeLabels, resolveScene, mergePaths, sceneBounds, textRuns, type TextRun, 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
16
|
export { readMember, readoutAt, readoutMarks, formatReadout, placeReadoutTags, type ReadoutTag, type Readout, type ReadoutMark, type ReadoutQuantity, type SidedValue, } from './core/readout.js';
|
|
17
17
|
export { beamLine, lineDiagram, lineModel, pointLoadAt, rowOutline, rowOrdinates, rowRange, rowPeaks, rowBreaks, type BeamLine, type LineMember, type RowPeak, type StackRow, } from './core/stack.js';
|