@magmonium/one 0.4.80 → 0.4.81

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmonium/one",
3
- "version": "0.4.80",
3
+ "version": "0.4.81",
4
4
  "description": "Magmonium One — Angular design-system primitives for mm Apps",
5
5
  "author": "magmonium",
6
6
  "license": "MIT",
@@ -6228,6 +6228,22 @@ type SectionChartConfig = Config & {
6228
6228
  navigator?: boolean;
6229
6229
  measure?: boolean;
6230
6230
  };
6231
+ /**
6232
+ * How a SectionChartSeries is drawn. `line` on time or categories; `column`
6233
+ * puts the whole chart on a category axis (GLOSSARY.md SectionChart).
6234
+ */
6235
+ type SectionChartMark = 'line' | 'column';
6236
+ /**
6237
+ * Which plot a SectionChartSeries is drawn in on a category axis: the main
6238
+ * plot, or the short strip beneath it that shares its categories — a measure
6239
+ * in other units (a margin beside money) without a second y-axis.
6240
+ */
6241
+ type SectionChartPanel = 'main' | 'strip';
6242
+ /** One series' values per category, in the order its rows arrived. */
6243
+ type SectionChartCategories = {
6244
+ x: string[];
6245
+ y: number[];
6246
+ };
6231
6247
  /** One series' points as the chart reads them: times ascending, one value each. */
6232
6248
  type SectionChartPoints = {
6233
6249
  t: number[];
@@ -6266,6 +6282,12 @@ declare const SECTION_CHART_PALETTE: {
6266
6282
  */
6267
6283
  interface SectionChartMember {
6268
6284
  readonly points: Signal<SectionChartPoints>;
6285
+ /** The same rows read onto a category axis, drawn once any series is a column. */
6286
+ readonly categories: Signal<SectionChartCategories>;
6287
+ readonly mark: Signal<SectionChartMark>;
6288
+ readonly panel: Signal<SectionChartPanel>;
6289
+ /** Whether the values are a % of another member (`per`), not amounts. */
6290
+ readonly ratio: Signal<boolean>;
6269
6291
  readonly label: Signal<string>;
6270
6292
  readonly noTranslate: Signal<boolean>;
6271
6293
  readonly params: Signal<Record<string, string> | undefined>;
@@ -6298,6 +6320,17 @@ declare const SECTION_CHART_CONTEXT: InjectionToken<SectionChartContext>;
6298
6320
  type Line = SectionChartLine & {
6299
6321
  member?: SectionChartMember;
6300
6322
  };
6323
+ type CategorySeries = {
6324
+ member?: SectionChartMember;
6325
+ color: string;
6326
+ label: string;
6327
+ noTranslate: boolean;
6328
+ params?: Record<string, string>;
6329
+ mark: SectionChartMark;
6330
+ panel: SectionChartPanel;
6331
+ ratio: boolean;
6332
+ values: (number | null)[];
6333
+ };
6301
6334
  type Plotted = {
6302
6335
  line: Line;
6303
6336
  shown: number[];
@@ -6325,6 +6358,11 @@ type Plotted = {
6325
6358
  *
6326
6359
  * On the Canvas, series holding no data draw a sample, so a chart dropped
6327
6360
  * before its binding exists is still something the author can see and select.
6361
+ *
6362
+ * One `mark="column"` series puts the chart on a category axis instead: `x`
6363
+ * is a label in row order, every series keeps its own values on an axis that
6364
+ * holds zero, and `panel="strip"` series draw in a short plot beneath on
6365
+ * their own scale — no presets, window, navigator or measure there.
6328
6366
  */
6329
6367
  export declare class SectionChartComponent extends ConfigComponent<SectionChartConfig> {
6330
6368
  subFolder: "section_charts";
@@ -6392,6 +6430,73 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6392
6430
  * leave, so a line never repaints because another one changed.
6393
6431
  */
6394
6432
  private readonly painted;
6433
+ /**
6434
+ * Whether any series is a column: the chart then reads every series onto a
6435
+ * category axis, where `x` is a label and each series keeps its own values.
6436
+ */
6437
+ protected readonly categorical: import("@angular/core").Signal<boolean>;
6438
+ /**
6439
+ * The category axis and every series on it, null where a series holds no
6440
+ * value for a category. On the Canvas, series with no data draw a sample.
6441
+ */
6442
+ protected readonly categoryData: import("@angular/core").Signal<{
6443
+ categories: string[];
6444
+ series: CategorySeries[];
6445
+ }>;
6446
+ private readonly hasStrip;
6447
+ /** The svg's height: the chart's, plus the strip when one is drawn. */
6448
+ protected readonly svgHeight: import("@angular/core").Signal<number>;
6449
+ /** The x centre of a category's band. */
6450
+ private readonly bandCentre;
6451
+ /**
6452
+ * The main plot's value axis. Columns stand on zero, so zero is always on
6453
+ * it; a series that is a % of another reads in %.
6454
+ */
6455
+ private readonly categoryExtent;
6456
+ private readonly categorySy;
6457
+ /** Everything a category axis draws besides the grid and its labels. */
6458
+ protected readonly categoryView: import("@angular/core").Signal<{
6459
+ columns: {
6460
+ d: string;
6461
+ color: string;
6462
+ }[];
6463
+ labels: {
6464
+ x: number;
6465
+ y: number;
6466
+ text: string;
6467
+ }[];
6468
+ lines: {
6469
+ d: string;
6470
+ color: string;
6471
+ endX: number;
6472
+ endY: number;
6473
+ }[];
6474
+ strip: {
6475
+ top: number;
6476
+ bottom: number;
6477
+ ticks: {
6478
+ y: number;
6479
+ label: string;
6480
+ }[];
6481
+ lines: {
6482
+ d: string;
6483
+ color: string;
6484
+ dots: {
6485
+ text: string;
6486
+ cx: number;
6487
+ cy: number;
6488
+ v: number;
6489
+ }[];
6490
+ }[];
6491
+ } | null;
6492
+ } | null>;
6493
+ /**
6494
+ * The strip beneath the main plot: its series as lines on their own scale,
6495
+ * every point labelled — a strip holds few points and exists to be read.
6496
+ */
6497
+ private readonly stripView;
6498
+ /** Where the category crosshair stands, as a category index. New data clears it. */
6499
+ protected readonly categoryIndex: import("@angular/core").WritableSignal<number | null>;
6395
6500
  /** Every series as read: its points beside the colour it draws in. */
6396
6501
  protected readonly lines: import("@angular/core").Signal<Line[]>;
6397
6502
  /** The first and last time any series holds. */
@@ -6494,7 +6599,37 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6494
6599
  x: number;
6495
6600
  };
6496
6601
  } | null>;
6602
+ /**
6603
+ * On a category axis a legend row reads the latest category's change from
6604
+ * the one before — the year-on-year a reader asks first — in % for amounts
6605
+ * and in percentage points for a series that is itself a %.
6606
+ */
6607
+ private readonly categoryLegendRows;
6608
+ /** A series' change at category `i` from the nearest category before it holding a value. */
6609
+ private readonly categoryChange;
6610
+ /** The crosshair on a category axis: the category's band, every series' value in it. */
6611
+ private readonly categoryHover;
6497
6612
  protected readonly hover: import("@angular/core").Signal<{
6613
+ x: number;
6614
+ title: string;
6615
+ rows: {
6616
+ color: string;
6617
+ label: string;
6618
+ noTranslate: boolean;
6619
+ params: Record<string, string> | undefined;
6620
+ v: number;
6621
+ value: string;
6622
+ sub: string;
6623
+ cx: number | null;
6624
+ cy: number | null;
6625
+ }[];
6626
+ flip: boolean;
6627
+ band: {
6628
+ x: number;
6629
+ width: number;
6630
+ bottom: number;
6631
+ };
6632
+ } | {
6498
6633
  x: number;
6499
6634
  title: string;
6500
6635
  rows: {
@@ -6509,6 +6644,7 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6509
6644
  cy: number;
6510
6645
  }[];
6511
6646
  flip: boolean;
6647
+ band: null;
6512
6648
  } | null>;
6513
6649
  /** Where the navigator puts a time, over all the data rather than the window. */
6514
6650
  private readonly navScale;
@@ -6580,6 +6716,8 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6580
6716
  /** Release keeps the band; a press that went nowhere was a click, and clears it. */
6581
6717
  protected readonly onPlotUp: () => void;
6582
6718
  protected readonly clearHover: () => void;
6719
+ /** The category crosshair on the keyboard: ← → a category, Home End, Esc. */
6720
+ private readonly onCategoryKeydown;
6583
6721
  /**
6584
6722
  * The crosshair on the keyboard: ← → step a point, Shift ten, Home End, Esc.
6585
6723
  * With measuring on, Enter anchors a measure at the crosshair, the arrows
@@ -6588,6 +6726,12 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6588
6726
  protected readonly onKeydown: (event: KeyboardEvent) => void;
6589
6727
  /** A change as read out: arrow, signed %, and which way it went. */
6590
6728
  private readonly signedChange;
6729
+ /** A change in percentage points: arrow, signed points, `pp`. */
6730
+ private readonly signedPoints;
6731
+ private readonly pointsFormat;
6732
+ private readonly levelFormat;
6733
+ /** A value as a label reads it: compact for an amount, a level % for a ratio. */
6734
+ private readonly formatShort;
6591
6735
  private readonly percentFormats;
6592
6736
  private readonly formatPercent;
6593
6737
  static ɵfac: i0.ɵɵFactoryDeclaration<SectionChartComponent, never>;
@@ -6671,7 +6815,24 @@ export declare class SectionChartSeriesComponent {
6671
6815
  * gave this series when it arrived, and keeps it while siblings come and go.
6672
6816
  */
6673
6817
  readonly color: import("@angular/core").InputSignal<string | undefined>;
6818
+ /**
6819
+ * `column` draws a column per category and puts the whole chart on a
6820
+ * category axis, where `x` is read as a label rather than a time.
6821
+ */
6822
+ readonly mark: import("@angular/core").InputSignal<SectionChartMark>;
6823
+ /**
6824
+ * A member to divide by: the series draws `y` as a % of it — `y="profit"
6825
+ * per="revenue"` is a margin — so a ratio binds with no reshaping either.
6826
+ */
6827
+ readonly per: import("@angular/core").InputSignal<string | undefined>;
6828
+ /**
6829
+ * On a category axis, `strip` draws this series in the short plot beneath
6830
+ * the main one, on its own scale — never a second y-axis on one plot.
6831
+ */
6832
+ readonly panel: import("@angular/core").InputSignal<SectionChartPanel>;
6674
6833
  readonly points: Signal<import("@magmonium/one").SectionChartPoints>;
6834
+ readonly categories: Signal<import("@magmonium/one").SectionChartCategories>;
6835
+ private readonly ratio;
6675
6836
  /** The legend row the chart worked out for this series; none outside one. */
6676
6837
  protected readonly row: Signal<SectionChartLegendRow | undefined>;
6677
6838
  constructor();
@@ -6712,6 +6873,21 @@ export declare class SectionChartSeriesComponent {
6712
6873
  "required": false;
6713
6874
  "isSignal": true;
6714
6875
  };
6876
+ "mark": {
6877
+ "alias": "mark";
6878
+ "required": false;
6879
+ "isSignal": true;
6880
+ };
6881
+ "per": {
6882
+ "alias": "per";
6883
+ "required": false;
6884
+ "isSignal": true;
6885
+ };
6886
+ "panel": {
6887
+ "alias": "panel";
6888
+ "required": false;
6889
+ "isSignal": true;
6890
+ };
6715
6891
  }, {}, never, never, true, never>;
6716
6892
  }
6717
6893
  /**
@@ -6725,8 +6901,29 @@ declare const toChartTime: (value: unknown) => number | null;
6725
6901
  * row's time and `y` the member holding its value. A positional row — a tuple
6726
6902
  * — is read the same way, its places named `0`, `1` and so on. Rows with no
6727
6903
  * time or no finite value drop; what is left comes back time-ascending.
6904
+ * `per`, when set, names a member to divide by: the value read is `y` as a %
6905
+ * of it, and a row whose `per` is zero or missing drops.
6906
+ */
6907
+ export declare const readChartPoints: (rows: readonly unknown[] | null | undefined, x: string, y: string, per?: string) => SectionChartPoints;
6908
+ /**
6909
+ * Reads one series onto a category axis: `x` names the member holding each
6910
+ * row's category, read as text as it stands — a year `"2022"` is a label, not
6911
+ * 2022 ms after 1970. Rows keep the order they arrived in, since a category
6912
+ * has no order of its own; a row with no category or no finite value drops,
6913
+ * and `per` divides as for `readChartPoints`.
6914
+ */
6915
+ declare const readChartCategories: (rows: readonly unknown[] | null | undefined, x: string, y: string, per?: string) => SectionChartCategories;
6916
+ /**
6917
+ * Every category any series holds, in the order they are first met: the first
6918
+ * series' own, then whatever a later one adds.
6728
6919
  */
6729
- export declare const readChartPoints: (rows: readonly unknown[] | null | undefined, x: string, y: string) => SectionChartPoints;
6920
+ declare const mergeCategories: (series: readonly SectionChartCategories[]) => string[];
6921
+ /**
6922
+ * A column from the baseline `y0` to its value at `y1`: square at the
6923
+ * baseline, rounded at the data end — the top for a positive value, the
6924
+ * bottom for a negative one. The radius never exceeds half the column.
6925
+ */
6926
+ declare const columnPath: (x: number, width: number, y0: number, y1: number, radius?: number) => string;
6730
6927
  /** The first index whose time is not before `x`. */
6731
6928
  declare const lowerBound: (times: readonly number[], x: number) => number;
6732
6929
  /** The index whose time is closest to `x`; the earlier one on a tie. */
@@ -6811,6 +7008,12 @@ declare const smoothPath: (t: readonly number[], y: readonly number[], sx: (t: n
6811
7008
  * moves, each series drifting its own way so a comparison reads as one.
6812
7009
  */
6813
7010
  declare const sampleChartPoints: (index: number, end?: number) => SectionChartPoints;
7011
+ /**
7012
+ * The categories a SectionChart draws on the Canvas when its series are on a
7013
+ * category axis and hold no data: five years, each series a smaller share of
7014
+ * the one before it so columns and a strip both read as themselves.
7015
+ */
7016
+ declare const sampleChartCategories: (index: number) => SectionChartCategories;
6814
7017
  type TabGroup = Config & {
6815
7018
  tabs: Button[];
6816
7019
  activeTabId?: string;
@@ -18623,4 +18826,4 @@ export declare const toggleUid: (audience: Audience, uid: string) => Audience;
18623
18826
  export declare const toggleGroup: (audience: Audience, groupId: string) => Audience;
18624
18827
  /** How many Users and Groups an Audience names. */
18625
18828
  export declare const pickCount: (audience: Audience) => number;
18626
- export type { Accordion, AccordionGroup, AccordionVariant, AppCardData, AppCardInputs, AppCardVariant, AppLogoTone, AppLogoVariant, AppManifest, AppTileData, AssetOption, Audience, AudienceLevel, AudienceMember, AudiencePicker, AuthResult, Badge, BadgeCount, BadgePosition, BadgeVariant, Button, ButtonGroup, CellChangeEvent, CellClickEvent, ColBreakpoint, ColSpan, ColorPallet, ColumnDef, Comment, CommentItem, Config, ContextMenu, ContextMenuEvent, Cursor, CustomIcon, DragListReorder, Draggable, DraggableState, FileUploadConfig, FileUploadEvent, FilterGroupContext, FilterGroupMember, FilterOption, FilterPanel, FilterPanelIo, FilterRangeMode, FilterSelectionMap, FilterValue, FilterVariant, FilteredTreeGrid, FlatTreeGridRow, FlexAlign, FlexAlignSelf, FlexConfig, FlexDirection, FlexItemConfig, FlexJustify, FlexVariant, GridAlignX, GridAlignY, GroupActionEvent, GroupDropEvent, GroupKind, GroupMenuEvent, Header, HeaderLevel, HeatSwatchRadius, Icon, KeyValueVariant, LabelSegment, LadderLevel, LadderLevels, LadderSignal, ListConfig, ListContext, ListItem, ListOrientation, ListVariant, MenuItem, MoneySystem, NavCountConfig, NavInstanceConfig, NavMenuConfig, NavRowsConfig, NavVisibilityConfig, NavVisibleAnswer, NavWidgetConfig, NavWidgetEntry, NavWidgetMap, OverlayWidgetLoader, OverlayWidgetMap, PageChangeEvent, Pagination, PaginationWindow, PriceLadderMarkKind, PriceLadderRule, PriceLadderTone, PriceLadderVariant, ResolvedUserTab, RowDropEvent, ScoreBand, ScoreSetVariant, SearchChangeEvent, SectionAccordion, SectionAccordionGroup, SectionAccordionGroupContext, SectionAccordionRef, SectionButtonGroupConfig, SectionChartConfig, SectionChartPoints, SectionChartScale, SectionChartWindow, SectionFilterGroupConfig, SectionHero, SectionHeroVariant, SectionTableAlign, SectionTableColumn, SectionTableConfig, SectionTableDataType, SectionTableSort, SectionTableVariant, SectionToggleItem, SectionToggleItemContext, SelectionAction, SelectionActionEvent, SelectionChangeEvent, SelectorConfig, SharingClient, SharingGroup, SocketMessage, Sort, SortChange, SortChangeEvent, SortOption, SortOrder, SourceAudience, SpacingInward, SqueezeMode, StatAlign, StatCornerEdge, StatCornerPosition, StatCornerSide, StatSurface, StatVariant, TabGroup, TableConfig, TableFilterCondition, TableFilterDef, TableGroup, TextOrNumberInput, Timeline, TimelineItem, TreeGridCellClickEvent, TreeGridLoadChildrenEvent, TreeGridRow, TreeGridRowSelectEvent, TreeGridToggleEvent, User };
18829
+ export type { Accordion, AccordionGroup, AccordionVariant, AppCardData, AppCardInputs, AppCardVariant, AppLogoTone, AppLogoVariant, AppManifest, AppTileData, AssetOption, Audience, AudienceLevel, AudienceMember, AudiencePicker, AuthResult, Badge, BadgeCount, BadgePosition, BadgeVariant, Button, ButtonGroup, CellChangeEvent, CellClickEvent, ColBreakpoint, ColSpan, ColorPallet, ColumnDef, Comment, CommentItem, Config, ContextMenu, ContextMenuEvent, Cursor, CustomIcon, DragListReorder, Draggable, DraggableState, FileUploadConfig, FileUploadEvent, FilterGroupContext, FilterGroupMember, FilterOption, FilterPanel, FilterPanelIo, FilterRangeMode, FilterSelectionMap, FilterValue, FilterVariant, FilteredTreeGrid, FlatTreeGridRow, FlexAlign, FlexAlignSelf, FlexConfig, FlexDirection, FlexItemConfig, FlexJustify, FlexVariant, GridAlignX, GridAlignY, GroupActionEvent, GroupDropEvent, GroupKind, GroupMenuEvent, Header, HeaderLevel, HeatSwatchRadius, Icon, KeyValueVariant, LabelSegment, LadderLevel, LadderLevels, LadderSignal, ListConfig, ListContext, ListItem, ListOrientation, ListVariant, MenuItem, MoneySystem, NavCountConfig, NavInstanceConfig, NavMenuConfig, NavRowsConfig, NavVisibilityConfig, NavVisibleAnswer, NavWidgetConfig, NavWidgetEntry, NavWidgetMap, OverlayWidgetLoader, OverlayWidgetMap, PageChangeEvent, Pagination, PaginationWindow, PriceLadderMarkKind, PriceLadderRule, PriceLadderTone, PriceLadderVariant, ResolvedUserTab, RowDropEvent, ScoreBand, ScoreSetVariant, SearchChangeEvent, SectionAccordion, SectionAccordionGroup, SectionAccordionGroupContext, SectionAccordionRef, SectionButtonGroupConfig, SectionChartCategories, SectionChartConfig, SectionChartMark, SectionChartPanel, SectionChartPoints, SectionChartScale, SectionChartWindow, SectionFilterGroupConfig, SectionHero, SectionHeroVariant, SectionTableAlign, SectionTableColumn, SectionTableConfig, SectionTableDataType, SectionTableSort, SectionTableVariant, SectionToggleItem, SectionToggleItemContext, SelectionAction, SelectionActionEvent, SelectionChangeEvent, SelectorConfig, SharingClient, SharingGroup, SocketMessage, Sort, SortChange, SortChangeEvent, SortOption, SortOrder, SourceAudience, SpacingInward, SqueezeMode, StatAlign, StatCornerEdge, StatCornerPosition, StatCornerSide, StatSurface, StatVariant, TabGroup, TableConfig, TableFilterCondition, TableFilterDef, TableGroup, TextOrNumberInput, Timeline, TimelineItem, TreeGridCellClickEvent, TreeGridLoadChildrenEvent, TreeGridRow, TreeGridRowSelectEvent, TreeGridToggleEvent, User };