@magmonium/one 0.4.80 → 0.4.82

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.82",
4
4
  "description": "Magmonium One — Angular design-system primitives for mm Apps",
5
5
  "author": "magmonium",
6
6
  "license": "MIT",
@@ -1368,6 +1368,14 @@ export declare function existsInMap(id: string | undefined, map: Record<string,
1368
1368
  * map is absent too.
1369
1369
  */
1370
1370
  export declare function notExistsInMap(id: string | undefined, map: Record<string, unknown> | undefined): boolean;
1371
+ /**
1372
+ * The map with `data` held under `id` — the OneFunction an OutcomeTransform
1373
+ * lands one row into a keyed StateProperty with (ADR 0205): `loadCoin(id)`
1374
+ * answers one coin, and `coinsById[id]` is where it goes. Every other entry the
1375
+ * map held is kept. While the id or the data is missing the map is answered
1376
+ * unchanged, so a landing with nothing to place never clears the store.
1377
+ */
1378
+ export declare function setInMap<T>(id: string | undefined, data: T | undefined, map: Record<string, T> | undefined): Record<string, T>;
1371
1379
  export declare function createMap<T extends object>(elems: T[], key?: keyof T | 'id', elemMap?: Record<string, T>): Record<string, T>;
1372
1380
  /**
1373
1381
  * `value` as a member of `values` — a string enum's object — or `undefined`
@@ -6228,6 +6236,22 @@ type SectionChartConfig = Config & {
6228
6236
  navigator?: boolean;
6229
6237
  measure?: boolean;
6230
6238
  };
6239
+ /**
6240
+ * How a SectionChartSeries is drawn. `line` on time or categories; `column`
6241
+ * puts the whole chart on a category axis (GLOSSARY.md SectionChart).
6242
+ */
6243
+ type SectionChartMark = 'line' | 'column';
6244
+ /**
6245
+ * Which plot a SectionChartSeries is drawn in on a category axis: the main
6246
+ * plot, or the short strip beneath it that shares its categories — a measure
6247
+ * in other units (a margin beside money) without a second y-axis.
6248
+ */
6249
+ type SectionChartPanel = 'main' | 'strip';
6250
+ /** One series' values per category, in the order its rows arrived. */
6251
+ type SectionChartCategories = {
6252
+ x: string[];
6253
+ y: number[];
6254
+ };
6231
6255
  /** One series' points as the chart reads them: times ascending, one value each. */
6232
6256
  type SectionChartPoints = {
6233
6257
  t: number[];
@@ -6266,6 +6290,12 @@ declare const SECTION_CHART_PALETTE: {
6266
6290
  */
6267
6291
  interface SectionChartMember {
6268
6292
  readonly points: Signal<SectionChartPoints>;
6293
+ /** The same rows read onto a category axis, drawn once any series is a column. */
6294
+ readonly categories: Signal<SectionChartCategories>;
6295
+ readonly mark: Signal<SectionChartMark>;
6296
+ readonly panel: Signal<SectionChartPanel>;
6297
+ /** Whether the values are a % of another member (`per`), not amounts. */
6298
+ readonly ratio: Signal<boolean>;
6269
6299
  readonly label: Signal<string>;
6270
6300
  readonly noTranslate: Signal<boolean>;
6271
6301
  readonly params: Signal<Record<string, string> | undefined>;
@@ -6298,6 +6328,17 @@ declare const SECTION_CHART_CONTEXT: InjectionToken<SectionChartContext>;
6298
6328
  type Line = SectionChartLine & {
6299
6329
  member?: SectionChartMember;
6300
6330
  };
6331
+ type CategorySeries = {
6332
+ member?: SectionChartMember;
6333
+ color: string;
6334
+ label: string;
6335
+ noTranslate: boolean;
6336
+ params?: Record<string, string>;
6337
+ mark: SectionChartMark;
6338
+ panel: SectionChartPanel;
6339
+ ratio: boolean;
6340
+ values: (number | null)[];
6341
+ };
6301
6342
  type Plotted = {
6302
6343
  line: Line;
6303
6344
  shown: number[];
@@ -6325,6 +6366,11 @@ type Plotted = {
6325
6366
  *
6326
6367
  * On the Canvas, series holding no data draw a sample, so a chart dropped
6327
6368
  * before its binding exists is still something the author can see and select.
6369
+ *
6370
+ * One `mark="column"` series puts the chart on a category axis instead: `x`
6371
+ * is a label in row order, every series keeps its own values on an axis that
6372
+ * holds zero, and `panel="strip"` series draw in a short plot beneath on
6373
+ * their own scale — no presets, window, navigator or measure there.
6328
6374
  */
6329
6375
  export declare class SectionChartComponent extends ConfigComponent<SectionChartConfig> {
6330
6376
  subFolder: "section_charts";
@@ -6392,6 +6438,73 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6392
6438
  * leave, so a line never repaints because another one changed.
6393
6439
  */
6394
6440
  private readonly painted;
6441
+ /**
6442
+ * Whether any series is a column: the chart then reads every series onto a
6443
+ * category axis, where `x` is a label and each series keeps its own values.
6444
+ */
6445
+ protected readonly categorical: import("@angular/core").Signal<boolean>;
6446
+ /**
6447
+ * The category axis and every series on it, null where a series holds no
6448
+ * value for a category. On the Canvas, series with no data draw a sample.
6449
+ */
6450
+ protected readonly categoryData: import("@angular/core").Signal<{
6451
+ categories: string[];
6452
+ series: CategorySeries[];
6453
+ }>;
6454
+ private readonly hasStrip;
6455
+ /** The svg's height: the chart's, plus the strip when one is drawn. */
6456
+ protected readonly svgHeight: import("@angular/core").Signal<number>;
6457
+ /** The x centre of a category's band. */
6458
+ private readonly bandCentre;
6459
+ /**
6460
+ * The main plot's value axis. Columns stand on zero, so zero is always on
6461
+ * it; a series that is a % of another reads in %.
6462
+ */
6463
+ private readonly categoryExtent;
6464
+ private readonly categorySy;
6465
+ /** Everything a category axis draws besides the grid and its labels. */
6466
+ protected readonly categoryView: import("@angular/core").Signal<{
6467
+ columns: {
6468
+ d: string;
6469
+ color: string;
6470
+ }[];
6471
+ labels: {
6472
+ x: number;
6473
+ y: number;
6474
+ text: string;
6475
+ }[];
6476
+ lines: {
6477
+ d: string;
6478
+ color: string;
6479
+ endX: number;
6480
+ endY: number;
6481
+ }[];
6482
+ strip: {
6483
+ top: number;
6484
+ bottom: number;
6485
+ ticks: {
6486
+ y: number;
6487
+ label: string;
6488
+ }[];
6489
+ lines: {
6490
+ d: string;
6491
+ color: string;
6492
+ dots: {
6493
+ text: string;
6494
+ cx: number;
6495
+ cy: number;
6496
+ v: number;
6497
+ }[];
6498
+ }[];
6499
+ } | null;
6500
+ } | null>;
6501
+ /**
6502
+ * The strip beneath the main plot: its series as lines on their own scale,
6503
+ * every point labelled — a strip holds few points and exists to be read.
6504
+ */
6505
+ private readonly stripView;
6506
+ /** Where the category crosshair stands, as a category index. New data clears it. */
6507
+ protected readonly categoryIndex: import("@angular/core").WritableSignal<number | null>;
6395
6508
  /** Every series as read: its points beside the colour it draws in. */
6396
6509
  protected readonly lines: import("@angular/core").Signal<Line[]>;
6397
6510
  /** The first and last time any series holds. */
@@ -6494,7 +6607,37 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6494
6607
  x: number;
6495
6608
  };
6496
6609
  } | null>;
6610
+ /**
6611
+ * On a category axis a legend row reads the latest category's change from
6612
+ * the one before — the year-on-year a reader asks first — in % for amounts
6613
+ * and in percentage points for a series that is itself a %.
6614
+ */
6615
+ private readonly categoryLegendRows;
6616
+ /** A series' change at category `i` from the nearest category before it holding a value. */
6617
+ private readonly categoryChange;
6618
+ /** The crosshair on a category axis: the category's band, every series' value in it. */
6619
+ private readonly categoryHover;
6497
6620
  protected readonly hover: import("@angular/core").Signal<{
6621
+ x: number;
6622
+ title: string;
6623
+ rows: {
6624
+ color: string;
6625
+ label: string;
6626
+ noTranslate: boolean;
6627
+ params: Record<string, string> | undefined;
6628
+ v: number;
6629
+ value: string;
6630
+ sub: string;
6631
+ cx: number | null;
6632
+ cy: number | null;
6633
+ }[];
6634
+ flip: boolean;
6635
+ band: {
6636
+ x: number;
6637
+ width: number;
6638
+ bottom: number;
6639
+ };
6640
+ } | {
6498
6641
  x: number;
6499
6642
  title: string;
6500
6643
  rows: {
@@ -6509,6 +6652,7 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6509
6652
  cy: number;
6510
6653
  }[];
6511
6654
  flip: boolean;
6655
+ band: null;
6512
6656
  } | null>;
6513
6657
  /** Where the navigator puts a time, over all the data rather than the window. */
6514
6658
  private readonly navScale;
@@ -6580,6 +6724,8 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6580
6724
  /** Release keeps the band; a press that went nowhere was a click, and clears it. */
6581
6725
  protected readonly onPlotUp: () => void;
6582
6726
  protected readonly clearHover: () => void;
6727
+ /** The category crosshair on the keyboard: ← → a category, Home End, Esc. */
6728
+ private readonly onCategoryKeydown;
6583
6729
  /**
6584
6730
  * The crosshair on the keyboard: ← → step a point, Shift ten, Home End, Esc.
6585
6731
  * With measuring on, Enter anchors a measure at the crosshair, the arrows
@@ -6588,6 +6734,12 @@ export declare class SectionChartComponent extends ConfigComponent<SectionChartC
6588
6734
  protected readonly onKeydown: (event: KeyboardEvent) => void;
6589
6735
  /** A change as read out: arrow, signed %, and which way it went. */
6590
6736
  private readonly signedChange;
6737
+ /** A change in percentage points: arrow, signed points, `pp`. */
6738
+ private readonly signedPoints;
6739
+ private readonly pointsFormat;
6740
+ private readonly levelFormat;
6741
+ /** A value as a label reads it: compact for an amount, a level % for a ratio. */
6742
+ private readonly formatShort;
6591
6743
  private readonly percentFormats;
6592
6744
  private readonly formatPercent;
6593
6745
  static ɵfac: i0.ɵɵFactoryDeclaration<SectionChartComponent, never>;
@@ -6671,7 +6823,24 @@ export declare class SectionChartSeriesComponent {
6671
6823
  * gave this series when it arrived, and keeps it while siblings come and go.
6672
6824
  */
6673
6825
  readonly color: import("@angular/core").InputSignal<string | undefined>;
6826
+ /**
6827
+ * `column` draws a column per category and puts the whole chart on a
6828
+ * category axis, where `x` is read as a label rather than a time.
6829
+ */
6830
+ readonly mark: import("@angular/core").InputSignal<SectionChartMark>;
6831
+ /**
6832
+ * A member to divide by: the series draws `y` as a % of it — `y="profit"
6833
+ * per="revenue"` is a margin — so a ratio binds with no reshaping either.
6834
+ */
6835
+ readonly per: import("@angular/core").InputSignal<string | undefined>;
6836
+ /**
6837
+ * On a category axis, `strip` draws this series in the short plot beneath
6838
+ * the main one, on its own scale — never a second y-axis on one plot.
6839
+ */
6840
+ readonly panel: import("@angular/core").InputSignal<SectionChartPanel>;
6674
6841
  readonly points: Signal<import("@magmonium/one").SectionChartPoints>;
6842
+ readonly categories: Signal<import("@magmonium/one").SectionChartCategories>;
6843
+ private readonly ratio;
6675
6844
  /** The legend row the chart worked out for this series; none outside one. */
6676
6845
  protected readonly row: Signal<SectionChartLegendRow | undefined>;
6677
6846
  constructor();
@@ -6712,6 +6881,21 @@ export declare class SectionChartSeriesComponent {
6712
6881
  "required": false;
6713
6882
  "isSignal": true;
6714
6883
  };
6884
+ "mark": {
6885
+ "alias": "mark";
6886
+ "required": false;
6887
+ "isSignal": true;
6888
+ };
6889
+ "per": {
6890
+ "alias": "per";
6891
+ "required": false;
6892
+ "isSignal": true;
6893
+ };
6894
+ "panel": {
6895
+ "alias": "panel";
6896
+ "required": false;
6897
+ "isSignal": true;
6898
+ };
6715
6899
  }, {}, never, never, true, never>;
6716
6900
  }
6717
6901
  /**
@@ -6725,8 +6909,29 @@ declare const toChartTime: (value: unknown) => number | null;
6725
6909
  * row's time and `y` the member holding its value. A positional row — a tuple
6726
6910
  * — is read the same way, its places named `0`, `1` and so on. Rows with no
6727
6911
  * time or no finite value drop; what is left comes back time-ascending.
6912
+ * `per`, when set, names a member to divide by: the value read is `y` as a %
6913
+ * of it, and a row whose `per` is zero or missing drops.
6914
+ */
6915
+ export declare const readChartPoints: (rows: readonly unknown[] | null | undefined, x: string, y: string, per?: string) => SectionChartPoints;
6916
+ /**
6917
+ * Reads one series onto a category axis: `x` names the member holding each
6918
+ * row's category, read as text as it stands — a year `"2022"` is a label, not
6919
+ * 2022 ms after 1970. Rows keep the order they arrived in, since a category
6920
+ * has no order of its own; a row with no category or no finite value drops,
6921
+ * and `per` divides as for `readChartPoints`.
6922
+ */
6923
+ declare const readChartCategories: (rows: readonly unknown[] | null | undefined, x: string, y: string, per?: string) => SectionChartCategories;
6924
+ /**
6925
+ * Every category any series holds, in the order they are first met: the first
6926
+ * series' own, then whatever a later one adds.
6728
6927
  */
6729
- export declare const readChartPoints: (rows: readonly unknown[] | null | undefined, x: string, y: string) => SectionChartPoints;
6928
+ declare const mergeCategories: (series: readonly SectionChartCategories[]) => string[];
6929
+ /**
6930
+ * A column from the baseline `y0` to its value at `y1`: square at the
6931
+ * baseline, rounded at the data end — the top for a positive value, the
6932
+ * bottom for a negative one. The radius never exceeds half the column.
6933
+ */
6934
+ declare const columnPath: (x: number, width: number, y0: number, y1: number, radius?: number) => string;
6730
6935
  /** The first index whose time is not before `x`. */
6731
6936
  declare const lowerBound: (times: readonly number[], x: number) => number;
6732
6937
  /** The index whose time is closest to `x`; the earlier one on a tie. */
@@ -6811,6 +7016,12 @@ declare const smoothPath: (t: readonly number[], y: readonly number[], sx: (t: n
6811
7016
  * moves, each series drifting its own way so a comparison reads as one.
6812
7017
  */
6813
7018
  declare const sampleChartPoints: (index: number, end?: number) => SectionChartPoints;
7019
+ /**
7020
+ * The categories a SectionChart draws on the Canvas when its series are on a
7021
+ * category axis and hold no data: five years, each series a smaller share of
7022
+ * the one before it so columns and a strip both read as themselves.
7023
+ */
7024
+ declare const sampleChartCategories: (index: number) => SectionChartCategories;
6814
7025
  type TabGroup = Config & {
6815
7026
  tabs: Button[];
6816
7027
  activeTabId?: string;
@@ -18623,4 +18834,4 @@ export declare const toggleUid: (audience: Audience, uid: string) => Audience;
18623
18834
  export declare const toggleGroup: (audience: Audience, groupId: string) => Audience;
18624
18835
  /** How many Users and Groups an Audience names. */
18625
18836
  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 };
18837
+ 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 };