@area8975/ui 0.2.2-dev.47 → 0.2.2-dev.49

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": "@area8975/ui",
3
- "version": "0.2.2-dev.47",
3
+ "version": "0.2.2-dev.49",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^22.0.0",
6
6
  "@angular/core": "^22.0.0",
@@ -8,6 +8,10 @@
8
8
  "@ng-icons/core": "^35.0.1",
9
9
  "@ng-icons/heroicons": "^35.0.1",
10
10
  "@tailwindcss/forms": "^0.5.11",
11
+ "@tiptap/core": "^3.32.2",
12
+ "@tiptap/extensions": "^3.32.2",
13
+ "@tiptap/pm": "^3.32.2",
14
+ "@tiptap/starter-kit": "^3.32.2",
11
15
  "apexcharts": "^4.7.0",
12
16
  "preline": "^4.2.0",
13
17
  "rxjs": "~7.8.0",
@@ -1,6 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { ElementRef, EnvironmentProviders, InjectionToken, OnDestroy, OnInit, Provider, Signal, TemplateRef, WritableSignal } from "@angular/core";
3
3
  import ApexCharts$1 from "apexcharts";
4
+ import { ChainedCommands, Editor } from "@tiptap/core";
4
5
  import { Placement } from "@floating-ui/dom";
5
6
  import { Observable } from "rxjs";
6
7
  import { IconType } from "@ng-icons/core";
@@ -1156,7 +1157,22 @@ export declare class UiFieldComponent {
1156
1157
  readonly for: import("@angular/core").InputSignal<string>;
1157
1158
  readonly hintId: import("@angular/core").InputSignal<string>;
1158
1159
  readonly errorId: import("@angular/core").InputSignal<string>;
1160
+ /**
1161
+ * The label's id, `${for}-label`. Controls that a `<label for>` can't
1162
+ * reach (e.g. `ui-rich-text-editor`) point `aria-labelledby` at it.
1163
+ */
1164
+ readonly labelId: import("@angular/core").Signal<string>;
1165
+ private readonly document;
1159
1166
  protected get forAttr(): string | null;
1167
+ protected get labelIdAttr(): string | null;
1168
+ /**
1169
+ * A label click is passed on to its control as a click, which opens a
1170
+ * `ui-select` or `ui-datepicker` rather than just focusing it, and does
1171
+ * nothing at all for controls a label can't target (a contenteditable,
1172
+ * a `role="button"` div). So apart from checkboxes and radios, where the
1173
+ * click is the point, the label just focuses its control.
1174
+ */
1175
+ protected onClick(event: MouseEvent): void;
1160
1176
  protected get hintAttr(): string | null;
1161
1177
  protected get errorAttr(): string | null;
1162
1178
  static ɵfac: i0.ɵɵFactoryDeclaration<UiFieldComponent, never>;
@@ -1486,6 +1502,169 @@ export declare class UiRadioComponent<ValueType = unknown> {
1486
1502
  "validationState": "validationStateChange";
1487
1503
  }, never, never, true, never>;
1488
1504
  }
1505
+ /**
1506
+ * Every tool the editor's toolbar can show. Leaving a formatting tool out of
1507
+ * `tools` also turns that formatting off - its shortcut stops working and
1508
+ * pasted content loses it - so the value only ever holds what the toolbar offers.
1509
+ * `undo` and `redo` only control the buttons; history and its shortcuts are always on.
1510
+ */
1511
+ export declare const RichTextTools: readonly ["bold", "italic", "underline", "strike", "code", "heading1", "heading2", "heading3", "bulletList", "orderedList", "blockquote", "codeBlock", "horizontalRule", "link", "undo", "redo"];
1512
+ /** @see {@link RichTextTools} */
1513
+ export type RichTextTool = typeof RichTextTools[number];
1514
+ /** The toolbar's groups, in order, with a divider drawn between each. */
1515
+ export declare const RichTextToolGroups: readonly (readonly RichTextTool[])[];
1516
+ /** true is valid, false is invalid, null is not yet validated. */
1517
+ export type RichTextEditorValidation = boolean | null;
1518
+ interface ToolDefinition {
1519
+ label: string;
1520
+ icon: string;
1521
+ /** Whether the tool is "on" at the cursor. Tools without it aren't toggles. */
1522
+ active?: (editor: Editor) => boolean;
1523
+ run: (chain: ChainedCommands) => ChainedCommands;
1524
+ }
1525
+ /**
1526
+ * A WYSIWYG editor whose value is an HTML string, with a toolbar of formatting tools.
1527
+ */
1528
+ export declare class UiRichTextEditorComponent {
1529
+ /** The content as HTML. An empty editor is `''`. */
1530
+ readonly value: import("@angular/core").ModelSignal<string>;
1531
+ readonly classes: import("@angular/core").InputSignal<string>;
1532
+ /** Which toolbar tools to show, and so which formatting is allowed. @see {@link RichTextTools} */
1533
+ readonly tools: import("@angular/core").InputSignal<readonly ("blockquote" | "code" | "link" | "strike" | "bold" | "italic" | "underline" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "codeBlock" | "horizontalRule" | "undo" | "redo")[]>;
1534
+ readonly id: import("@angular/core").InputSignal<string>;
1535
+ readonly placeholder: import("@angular/core").InputSignal<string>;
1536
+ readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
1537
+ readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
1538
+ readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
1539
+ /** true/false shows valid/invalid styling. null means not validated yet. */
1540
+ readonly validationState: import("@angular/core").ModelSignal<RichTextEditorValidation>;
1541
+ readonly spellcheck: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
1542
+ readonly ariaLabel: import("@angular/core").InputSignal<string>;
1543
+ readonly describedBy: import("@angular/core").InputSignal<string>;
1544
+ /**
1545
+ * Ids of the elements that name the editor. Defaults to the label of the
1546
+ * `ui-field` it sits in, when that field's `for` is this editor's `id` -
1547
+ * a `<label for>` can't name a contenteditable on its own.
1548
+ */
1549
+ readonly labelledBy: import("@angular/core").InputSignal<string>;
1550
+ readonly focused: import("@angular/core").OutputEmitterRef<FocusEvent>;
1551
+ readonly blurred: import("@angular/core").OutputEmitterRef<FocusEvent>;
1552
+ private readonly injector;
1553
+ private readonly field;
1554
+ private readonly host;
1555
+ private readonly content;
1556
+ private readonly editor;
1557
+ /** Bumped on every editor transaction, so toolbar state re-reads the editor. */
1558
+ private readonly revision;
1559
+ /** The HTML the editor last held, to tell our own updates from outside ones. */
1560
+ private lastHtml;
1561
+ protected readonly contentId: string;
1562
+ protected readonly linkInputId: string;
1563
+ protected readonly linkOpen: import("@angular/core").WritableSignal<boolean>;
1564
+ protected readonly linkHref: import("@angular/core").WritableSignal<string>;
1565
+ /** Index of the toolbar button that takes the toolbar's single tab stop. */
1566
+ protected readonly focusIndex: import("@angular/core").WritableSignal<number>;
1567
+ private readonly resolvedLabelledBy;
1568
+ protected readonly editable: import("@angular/core").Signal<boolean>;
1569
+ protected readonly toolGroups: import("@angular/core").Signal<("blockquote" | "code" | "link" | "strike" | "bold" | "italic" | "underline" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "codeBlock" | "horizontalRule" | "undo" | "redo")[][]>;
1570
+ protected readonly flatTools: import("@angular/core").Signal<("blockquote" | "code" | "link" | "strike" | "bold" | "italic" | "underline" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "codeBlock" | "horizontalRule" | "undo" | "redo")[]>;
1571
+ protected readonly showToolbar: import("@angular/core").Signal<boolean>;
1572
+ /** Per tool: whether it's on at the cursor, and whether it can run right now. */
1573
+ protected readonly toolState: import("@angular/core").Signal<Record<"blockquote" | "code" | "link" | "strike" | "bold" | "italic" | "underline" | "heading1" | "heading2" | "heading3" | "bulletList" | "orderedList" | "codeBlock" | "horizontalRule" | "undo" | "redo", {
1574
+ active: boolean;
1575
+ enabled: boolean;
1576
+ }>>;
1577
+ protected readonly generatedClasses: import("@angular/core").Signal<string>;
1578
+ /** Attributes for the contenteditable element, which Tiptap renders. */
1579
+ private readonly contentAttributes;
1580
+ /** Each tool left out of `tools` switches its extension off. */
1581
+ private readonly extensions;
1582
+ constructor();
1583
+ protected toolDefinition(tool: RichTextTool): ToolDefinition;
1584
+ protected readonly runTool: (tool: RichTextTool) => void;
1585
+ /** Arrow keys move between toolbar buttons, so the toolbar is one tab stop. */
1586
+ protected readonly onToolbarKeydown: (event: KeyboardEvent) => void;
1587
+ protected readonly openLink: () => void;
1588
+ protected readonly applyLink: () => void;
1589
+ protected readonly removeLink: () => void;
1590
+ protected readonly closeLink: () => void;
1591
+ protected readonly onLinkKeydown: (event: KeyboardEvent) => void;
1592
+ private createEditor;
1593
+ private htmlOf;
1594
+ static ɵfac: i0.ɵɵFactoryDeclaration<UiRichTextEditorComponent, never>;
1595
+ static ɵcmp: i0.ɵɵComponentDeclaration<UiRichTextEditorComponent, "ui-rich-text-editor", never, {
1596
+ "value": {
1597
+ "alias": "value";
1598
+ "required": true;
1599
+ "isSignal": true;
1600
+ };
1601
+ "classes": {
1602
+ "alias": "classes";
1603
+ "required": false;
1604
+ "isSignal": true;
1605
+ };
1606
+ "tools": {
1607
+ "alias": "tools";
1608
+ "required": false;
1609
+ "isSignal": true;
1610
+ };
1611
+ "id": {
1612
+ "alias": "id";
1613
+ "required": false;
1614
+ "isSignal": true;
1615
+ };
1616
+ "placeholder": {
1617
+ "alias": "placeholder";
1618
+ "required": false;
1619
+ "isSignal": true;
1620
+ };
1621
+ "required": {
1622
+ "alias": "required";
1623
+ "required": false;
1624
+ "isSignal": true;
1625
+ };
1626
+ "disabled": {
1627
+ "alias": "disabled";
1628
+ "required": false;
1629
+ "isSignal": true;
1630
+ };
1631
+ "readonly": {
1632
+ "alias": "readonly";
1633
+ "required": false;
1634
+ "isSignal": true;
1635
+ };
1636
+ "validationState": {
1637
+ "alias": "validationState";
1638
+ "required": false;
1639
+ "isSignal": true;
1640
+ };
1641
+ "spellcheck": {
1642
+ "alias": "spellcheck";
1643
+ "required": false;
1644
+ "isSignal": true;
1645
+ };
1646
+ "ariaLabel": {
1647
+ "alias": "ariaLabel";
1648
+ "required": false;
1649
+ "isSignal": true;
1650
+ };
1651
+ "describedBy": {
1652
+ "alias": "describedBy";
1653
+ "required": false;
1654
+ "isSignal": true;
1655
+ };
1656
+ "labelledBy": {
1657
+ "alias": "labelledBy";
1658
+ "required": false;
1659
+ "isSignal": true;
1660
+ };
1661
+ }, {
1662
+ "value": "valueChange";
1663
+ "validationState": "validationStateChange";
1664
+ "focused": "focused";
1665
+ "blurred": "blurred";
1666
+ }, never, never, true, never>;
1667
+ }
1489
1668
  /** Defines if and when a `ui-overlay` should close when the user clicks. */
1490
1669
  export type UiOverlayCloseBehaviour = 'none' | 'whenClickOutside' | 'whenClickAnywhere';
1491
1670
  export interface UiOverlayOptions {
@@ -1935,10 +2114,13 @@ export type AlertAppearance = typeof AlertAppearances[number];
1935
2114
  export declare class UiAvatarComponent {
1936
2115
  readonly name: import("@angular/core").InputSignal<string>;
1937
2116
  readonly src: import("@angular/core").InputSignal<string | null>;
1938
- readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg">;
2117
+ readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xl">;
2118
+ /** Fill behind the initials, any CSS colour. The initials' ink is picked to read on six digit hex, anything else gets dark ink. */
2119
+ readonly colour: import("@angular/core").InputSignal<string | null>;
1939
2120
  private readonly failedSrc;
1940
2121
  protected readonly showImage: import("@angular/core").Signal<boolean>;
1941
2122
  protected readonly initials: import("@angular/core").Signal<string>;
2123
+ protected readonly ink: import("@angular/core").Signal<string | null>;
1942
2124
  readonly generatedClasses: import("@angular/core").Signal<string>;
1943
2125
  protected imageFailed(): void;
1944
2126
  static ɵfac: i0.ɵɵFactoryDeclaration<UiAvatarComponent, never>;
@@ -1958,15 +2140,20 @@ export declare class UiAvatarComponent {
1958
2140
  "required": false;
1959
2141
  "isSignal": true;
1960
2142
  };
2143
+ "colour": {
2144
+ "alias": "colour";
2145
+ "required": false;
2146
+ "isSignal": true;
2147
+ };
1961
2148
  }, {}, never, never, true, never>;
1962
2149
  }
1963
- export declare const AvatarSizes: readonly ["sm", "md", "lg"];
2150
+ export declare const AvatarSizes: readonly ["sm", "md", "lg", "xl"];
1964
2151
  /** @see {@link AvatarSizes} */
1965
2152
  export type AvatarSize = typeof AvatarSizes[number];
1966
2153
  export declare class UiBadgeComponent {
1967
2154
  readonly appearance: import("@angular/core").InputSignal<"solid" | "outline" | "soft">;
1968
2155
  readonly intent: import("@angular/core").InputSignal<"primary" | "secondary" | "success" | "warning" | "danger">;
1969
- readonly size: import("@angular/core").InputSignal<"xs" | "sm" | "md" | "lg">;
2156
+ readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg" | "xs">;
1970
2157
  readonly generatedClasses: import("@angular/core").Signal<string>;
1971
2158
  static ɵfac: i0.ɵɵFactoryDeclaration<UiBadgeComponent, never>;
1972
2159
  static ɵcmp: i0.ɵɵComponentDeclaration<UiBadgeComponent, "ui-badge", never, {
@@ -2001,7 +2188,7 @@ export declare class UiButtonComponent {
2001
2188
  readonly intent: import("@angular/core").InputSignal<"none" | "primary" | "secondary" | "success" | "warning" | "danger">;
2002
2189
  readonly size: import("@angular/core").InputSignal<"sm" | "md" | "lg">;
2003
2190
  readonly classes: import("@angular/core").InputSignal<string>;
2004
- readonly type: import("@angular/core").InputSignal<"button" | "reset" | "submit">;
2191
+ readonly type: import("@angular/core").InputSignal<"button" | "submit" | "reset">;
2005
2192
  readonly ariaLabel: import("@angular/core").InputSignal<string>;
2006
2193
  readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
2007
2194
  readonly loading: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
@@ -2137,6 +2324,20 @@ export interface CalendarDay {
2137
2324
  isInRange: boolean;
2138
2325
  isRangeStart: boolean;
2139
2326
  isRangeEnd: boolean;
2327
+ /** Extra classes from the calendar's `dayClass`. */
2328
+ className: string;
2329
+ }
2330
+ /** The month a calendar shows, for loading what its days need. */
2331
+ export interface CalendarView {
2332
+ /** First of the month, e.g. "2026-11-01". */
2333
+ month: IsoDate;
2334
+ /** First and last day in the grid, including days from the months either side. */
2335
+ start: IsoDate;
2336
+ end: IsoDate;
2337
+ }
2338
+ export interface CalendarDayContext {
2339
+ $implicit: IsoDate;
2340
+ day: CalendarDay;
2140
2341
  }
2141
2342
  /** A local date and time ISO string, e.g. "2026-09-29T14:30". */
2142
2343
  export type IsoDateTime = string;
@@ -2148,6 +2349,15 @@ export interface DateRange {
2148
2349
  start: IsoDate | null;
2149
2350
  end: IsoDate | null;
2150
2351
  }
2352
+ /**
2353
+ * Draws each day's content in place of its number:
2354
+ * `<ng-template uiCalendarDay let-date let-day="day">`.
2355
+ */
2356
+ export declare class UiCalendarDayDirective {
2357
+ readonly template: TemplateRef<CalendarDayContext>;
2358
+ static ɵfac: i0.ɵɵFactoryDeclaration<UiCalendarDayDirective, never>;
2359
+ static ɵdir: i0.ɵɵDirectiveDeclaration<UiCalendarDayDirective, "ng-template[uiCalendarDay]", never, {}, {}, never, never, true, never>;
2360
+ }
2151
2361
  export declare class UiCalendarComponent {
2152
2362
  private readonly host;
2153
2363
  private readonly injector;
@@ -2161,6 +2371,15 @@ export declare class UiCalendarComponent {
2161
2371
  readonly isDateDisabled: import("@angular/core").InputSignal<(date: IsoDate) => boolean>;
2162
2372
  readonly weekStart: import("@angular/core").InputSignal<0 | 1>;
2163
2373
  readonly locale: import("@angular/core").InputSignal<string>;
2374
+ /** Classes for a day, e.g. a tint. Signals it reads update the grid. */
2375
+ readonly dayClass: import("@angular/core").InputSignal<(date: IsoDate) => string>;
2376
+ /** Leaves picked days unmarked, for when a click does something other than pick. */
2377
+ readonly hideSelection: import("@angular/core").InputSignal<boolean>;
2378
+ /** Every click on an available day, even one that's already picked. */
2379
+ readonly dayClick: import("@angular/core").OutputEmitterRef<string>;
2380
+ /** The month in view, on first render and whenever it changes. */
2381
+ readonly monthChange: import("@angular/core").OutputEmitterRef<CalendarView>;
2382
+ protected readonly dayTemplate: import("@angular/core").Signal<UiCalendarDayDirective | undefined>;
2164
2383
  protected readonly today: string;
2165
2384
  private readonly anchorDate;
2166
2385
  private readonly activeDate;
@@ -2173,11 +2392,13 @@ export declare class UiCalendarComponent {
2173
2392
  protected readonly yearSource: import("@angular/core").Signal<SelectLocalDataSource<number>>;
2174
2393
  protected readonly displayMonth: (month: number) => string;
2175
2394
  protected readonly days: import("@angular/core").Signal<CalendarDay[]>;
2395
+ private readonly view;
2176
2396
  private readonly rangeBounds;
2177
2397
  /** Only one day is tabbable, arrow keys move between the rest. */
2178
2398
  protected readonly tabbableDate: import("@angular/core").Signal<string>;
2179
2399
  protected readonly canGoBack: import("@angular/core").Signal<boolean>;
2180
2400
  protected readonly canGoForward: import("@angular/core").Signal<boolean>;
2401
+ constructor();
2181
2402
  /** Moves focus onto the active day, e.g. when a datepicker opens. */
2182
2403
  focusActiveDate(): void;
2183
2404
  protected showMonth(offset: number): void;
@@ -2228,10 +2449,22 @@ export declare class UiCalendarComponent {
2228
2449
  "required": false;
2229
2450
  "isSignal": true;
2230
2451
  };
2452
+ "dayClass": {
2453
+ "alias": "dayClass";
2454
+ "required": false;
2455
+ "isSignal": true;
2456
+ };
2457
+ "hideSelection": {
2458
+ "alias": "hideSelection";
2459
+ "required": false;
2460
+ "isSignal": true;
2461
+ };
2231
2462
  }, {
2232
2463
  "value": "valueChange";
2233
2464
  "range": "rangeChange";
2234
- }, never, never, true, never>;
2465
+ "dayClick": "dayClick";
2466
+ "monthChange": "monthChange";
2467
+ }, ["dayTemplate"], never, true, never>;
2235
2468
  }
2236
2469
  export declare class UiCardComponent {
2237
2470
  readonly radius: import("@angular/core").InputSignal<"none" | "sm" | "md" | "lg" | "xl">;