@uni-design-system/uni-angular 10.3.0 → 10.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uni-design-system/uni-angular",
3
- "version": "10.3.0",
3
+ "version": "10.4.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "@angular/core": "^21.2.0",
23
23
  "@angular/forms": "^21.2.0",
24
24
  "@emotion/css": "^11.0.0",
25
- "@uni-design-system/uni-core": "^10.3.0"
25
+ "@uni-design-system/uni-core": "^10.4.0"
26
26
  },
27
27
  "module": "fesm2022/uni-design-system-uni-angular.mjs",
28
28
  "typings": "types/uni-design-system-uni-angular.d.ts",
@@ -875,6 +875,16 @@ var BaseMotion = {
875
875
  easing: "ease"
876
876
  }
877
877
  };
878
+ /**
879
+ * The one wash every modal surface lays over the page it covers. Dialog and
880
+ * drawer both point at `scrim` by name, so a theme redresses them together —
881
+ * before this they owned a `backdrop` blob each and had drifted apart, the
882
+ * dialog washing the page white and blurred while the drawer dimmed it dark.
883
+ */
884
+ var BaseBackdrops = { scrim: {
885
+ background: "rgba(255, 255, 255, 0.6)",
886
+ backdropFilter: "blur(2px)"
887
+ } };
878
888
  var BaseRadii = {
879
889
  none: "none",
880
890
  xxs: "4px",
@@ -967,9 +977,10 @@ var buildComponents = (c) => ({
967
977
  divider: "light",
968
978
  elevation: "menu",
969
979
  padding: "md",
970
- backdrop: { background: "rgba(0, 0, 0, 0.4)" },
980
+ backdrop: "scrim",
971
981
  scrim: true,
972
- background: "solid"
982
+ background: "solid",
983
+ motion: "panel"
973
984
  } },
974
985
  drawerHeader: { options: {
975
986
  color: void 0,
@@ -1084,17 +1095,18 @@ var buildComponents = (c) => ({
1084
1095
  color: "primary-surface",
1085
1096
  border: "quaternary",
1086
1097
  padding: "sm",
1098
+ bodyPadding: void 0,
1099
+ inset: "lg",
1087
1100
  elevation: "dialog",
1088
- backdrop: {
1089
- background: "rgba(255, 255, 255, 0.6)",
1090
- backdropFilter: "blur(2px)"
1091
- }
1101
+ backdrop: "scrim",
1102
+ motion: "panel"
1092
1103
  } },
1093
1104
  dialogButtons: { options: {
1094
1105
  gap: "md",
1095
1106
  padding: "md",
1096
1107
  paddingBottom: "lg",
1097
1108
  justifyContent: "center",
1109
+ divider: void 0,
1098
1110
  confirmButtonVariant: "primary",
1099
1111
  cancelButtonVariant: "warn",
1100
1112
  buttonSize: "lg",
@@ -1107,6 +1119,7 @@ var buildComponents = (c) => ({
1107
1119
  height: 48,
1108
1120
  textRole: "title-large",
1109
1121
  textAlign: "center",
1122
+ divider: void 0,
1110
1123
  closeButtonIcon: "close",
1111
1124
  closeButtonSize: "md"
1112
1125
  } },
@@ -1777,7 +1790,7 @@ var deepMerge = (base, override) => {
1777
1790
  for (const [key, value] of Object.entries(override)) out[key] = isRecord$1(value) && isRecord$1(out[key]) ? deepMerge(out[key], value) : value;
1778
1791
  return out;
1779
1792
  };
1780
- var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, typography, borders, thicknesses, spacing, components }) => ({
1793
+ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows = BaseShadows, motion, backdrops, typography, borders, thicknesses, spacing, components }) => ({
1781
1794
  id,
1782
1795
  name,
1783
1796
  colors,
@@ -1793,6 +1806,10 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1793
1806
  ...BaseMotion,
1794
1807
  ...motion
1795
1808
  },
1809
+ backdrops: {
1810
+ ...BaseBackdrops,
1811
+ ...backdrops
1812
+ },
1796
1813
  thicknesses: {
1797
1814
  ...BaseThicknesses,
1798
1815
  ...thicknesses
@@ -2183,7 +2200,7 @@ var UniThemes = {
2183
2200
  Object.keys(UniThemes)[0];
2184
2201
  //#endregion
2185
2202
  //#region package.json
2186
- var version = "10.3.0";
2203
+ var version = "10.4.0";
2187
2204
  //#endregion
2188
2205
  //#region schematics-src/ng-add/transforms.ts
2189
2206
  var addDependencies = (packageJsonText, deps) => {
@@ -1,7 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal, InjectionToken, ElementRef, TemplateRef, OnInit, OnDestroy, AfterViewInit } from '@angular/core';
3
3
  import * as _uni_design_system_uni_core from '@uni-design-system/uni-core';
4
- import { IconName, Variant, ContainerColorToken, PaletteConfig, GenerateColorsConfig, Radii, UniTheme, ComponentName, ComponentTheme, MotionToken, ThemeName, ThemeParseResult, TextRole, ContentColorToken, Size, NullableSize, Thickness, NullableStyleExpression, ColorKey, ColorToken, Typeface, Radius, Motion, OptionalSize, Border, Shadow, ZIndexableElements, OptionalAlignSelf, OptionalAlignItems, OptionalAlignContent, OptionalJustifyContent, OptionalDisplay, OptionalPosition, OptionalOverflow, OptionalFlexDirection, OptionalTextAlign, OptionalWrap, TextColor, TagTone, Elevation, RadiiSize, JustifyContent, StyleExpression, Orientation, CssLength, ColorScheme, ColorCategory, ThemeShape, ContrastCheck, Colors, GenerationInput } from '@uni-design-system/uni-core';
4
+ import { IconName, Variant, ContainerColorToken, PaletteConfig, GenerateColorsConfig, Radii, UniTheme, ComponentName, ComponentTheme, MotionToken, StyleExpression, ThemeName, ThemeParseResult, TextRole, ContentColorToken, Size, NullableSize, Thickness, NullableStyleExpression, ColorKey, ColorToken, Typeface, Radius, Motion, Backdrop, OptionalSize, Border, Shadow, ZIndexableElements, OptionalAlignSelf, OptionalAlignItems, OptionalAlignContent, OptionalJustifyContent, OptionalDisplay, OptionalPosition, OptionalOverflow, OptionalFlexDirection, OptionalTextAlign, OptionalWrap, TextColor, TagTone, Elevation, RadiiSize, JustifyContent, Orientation, CssLength, ColorScheme, ColorCategory, ThemeShape, ContrastCheck, Colors, GenerationInput } from '@uni-design-system/uni-core';
5
5
  import { FormCheckboxControl, FormValueControl } from '@angular/forms/signals';
6
6
  import * as _uni_design_system_uni_angular from '@uni-design-system/uni-angular';
7
7
  import { CSSObject } from '@emotion/css/create-instance';
@@ -1019,6 +1019,8 @@ declare class ThemeService {
1019
1019
  shadows: Signal<Partial<Record<string, string>>>;
1020
1020
  icons: Signal<_uni_design_system_uni_core.Icons>;
1021
1021
  motions: Signal<Partial<Record<string, MotionToken>>>;
1022
+ /** Same story as `motions`: a JSON theme may predate the backdrops scale. */
1023
+ backdrops: Signal<Partial<Record<string, StyleExpression>>>;
1022
1024
  constructor();
1023
1025
  /**
1024
1026
  * Activate a registered theme. Returns false — touching nothing, persisting
@@ -1066,7 +1068,7 @@ declare class ThemeService {
1066
1068
  selectedThemeKey: _angular_core.WritableSignal<string>;
1067
1069
  textClass: (textRole: TextRole, textColor?: ContentColorToken) => string;
1068
1070
  componentStyle: (componentName: ComponentName, variant: Variant, size: Size) => Signal<{
1069
- [x: string]: string | number | _uni_design_system_uni_core.StyleExpression;
1071
+ [x: string]: string | number | StyleExpression;
1070
1072
  }>;
1071
1073
  /**
1072
1074
  * The active variant's roles from a component's `variantOptions` map — the
@@ -1111,7 +1113,7 @@ declare class ThemeService {
1111
1113
  colorPair: (token?: ContainerColorToken, colorVariant?: boolean) => NullableStyleExpression;
1112
1114
  backgroundColor: (token?: ColorKey) => NullableStyleExpression;
1113
1115
  backgroundImage: (url?: string) => NullableStyleExpression;
1114
- getContainerColors: (color: Variant, useVariant?: boolean) => _uni_design_system_uni_core.StyleExpression;
1116
+ getContainerColors: (color: Variant, useVariant?: boolean) => StyleExpression;
1115
1117
  /**
1116
1118
  * The shared keyboard-focus indicator's styles (WCAG 2.4.7), without a
1117
1119
  * selector — for controls that key the ring off their own state selector
@@ -1154,6 +1156,16 @@ declare class ThemeService {
1154
1156
  * token that isn't there — still animates rather than snapping.
1155
1157
  */
1156
1158
  motion(token: Motion | undefined): MotionToken;
1159
+ private readonly warnedBackdrops;
1160
+ /**
1161
+ * Resolves a named backdrop primitive — the wash a modal surface lays over
1162
+ * the page — so every such surface dims it the same way.
1163
+ *
1164
+ * A raw style object passes straight through: that is the shape the dialog's
1165
+ * and drawer's `backdrop` options took before the scale existed, and a
1166
+ * consumer theme that still states one keeps working.
1167
+ */
1168
+ backdrop(token: Backdrop | StyleExpression | undefined): NullableStyleExpression;
1157
1169
  radius(size: Radius | undefined): NullableStyleExpression;
1158
1170
  getRadiusLeft(size: Radius | undefined): NullableStyleExpression;
1159
1171
  getRadiusRight(size: Radius | undefined): NullableStyleExpression;
@@ -4196,6 +4208,8 @@ interface UniDialogButtonsOptions {
4196
4208
  /** Bottom padding, as a spacing token. */
4197
4209
  paddingBottom?: NullableSize;
4198
4210
  justifyContent?: JustifyContent;
4211
+ /** Border drawn above the pinned row, separating it from the scrolling body. */
4212
+ divider?: Border;
4199
4213
  confirmButtonVariant?: Variant;
4200
4214
  cancelButtonVariant?: Variant;
4201
4215
  /** Size passed to both buttons. */
@@ -4228,6 +4242,8 @@ declare class UniDialogButtonsComponent extends BaseComponent<UniDialogButtonsOp
4228
4242
  protected justifyContentValue: _angular_core.Signal<JustifyContent>;
4229
4243
  protected gapValue: _angular_core.Signal<NullableSize>;
4230
4244
  protected buttonSize: _angular_core.Signal<Size>;
4245
+ /** A pinned row, sized by its content rather than by the body beside it. */
4246
+ protected readonly hostClass: _angular_core.Signal<string>;
4231
4247
  protected readonly className: _angular_core.Signal<string>;
4232
4248
  closeDialog(): void;
4233
4249
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UniDialogButtonsComponent, never>;
@@ -4243,6 +4259,8 @@ interface UniDialogHeaderOptions {
4243
4259
  textRole: TextRole;
4244
4260
  textColor?: ContentColorToken;
4245
4261
  textAlign?: 'left' | 'center' | 'right';
4262
+ /** Border drawn under the pinned header, separating it from the scrolling body. */
4263
+ divider?: Border;
4246
4264
  closeButtonIcon?: IconName;
4247
4265
  closeButtonSymbol?: string;
4248
4266
  closeButtonSize?: Size;
@@ -4254,8 +4272,13 @@ declare class UniDialogHeaderComponent extends BaseComponent<UniDialogHeaderOpti
4254
4272
  protected readonly titleId: string;
4255
4273
  constructor();
4256
4274
  closeDialog(): void;
4275
+ /**
4276
+ * A pinned row: it is a flex child of the dialog and must not be sized by
4277
+ * the scrolling body beside it.
4278
+ */
4279
+ protected readonly className: _angular_core.Signal<string>;
4257
4280
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UniDialogHeaderComponent, never>;
4258
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<UniDialogHeaderComponent, "[uni-dialog-header]", never, {}, {}, never, ["*"], true, never>;
4281
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UniDialogHeaderComponent, "[uni-dialog-header], [dialog-header]", never, {}, {}, never, ["*"], true, never>;
4259
4282
  }
4260
4283
 
4261
4284
  interface UniDialogOptions {
@@ -4263,10 +4286,51 @@ interface UniDialogOptions {
4263
4286
  borderRadius: Radius;
4264
4287
  color: ContainerColorToken;
4265
4288
  elevation: Elevation;
4266
- backdrop: StyleExpression;
4289
+ /**
4290
+ * Name of a `backdrops` primitive — the wash laid over the page behind the
4291
+ * dialog. Shared with the drawer, so one token dresses both. A raw style
4292
+ * object is still accepted for themes that stated one before the scale.
4293
+ */
4294
+ backdrop: Backdrop | StyleExpression;
4295
+ /**
4296
+ * Insets the whole surface: the pinned header, the scrolling body and the
4297
+ * pinned buttons all sit inside it. Safe on a surface that never scrolls —
4298
+ * the dialog is `overflow: clip` and only its body row scrolls.
4299
+ */
4267
4300
  padding?: NullableSize;
4301
+ /**
4302
+ * Padding on the scrolling body row alone. Distinct from `padding`, which
4303
+ * insets all three rows.
4304
+ */
4305
+ bodyPadding?: NullableSize;
4306
+ /**
4307
+ * Timing for the open and close fade, panel and scrim together. The same
4308
+ * token the drawer points at, so the two surfaces arrive and leave alike.
4309
+ */
4310
+ motion?: Motion;
4311
+ /**
4312
+ * Minimum gap between the surface and the viewport edge. The dialog is
4313
+ * content-sized up to `calc(100dvh - 2 x inset)` and scrolls its body from
4314
+ * there.
4315
+ */
4316
+ inset?: NullableSize;
4268
4317
  }
4269
4318
 
4319
+ /**
4320
+ * Modal dialog on the native `<dialog>` element, laid out as three rows:
4321
+ * an optional `[dialog-header]`, the projected body, an optional
4322
+ * `[dialog-buttons]`.
4323
+ *
4324
+ * **The surface is never the scroll container.** It is a flex column that is
4325
+ * `overflow: clip` on both axes; the header and buttons pin while only the
4326
+ * body row scrolls. Unlike the drawer, which is deliberately viewport-tall,
4327
+ * the dialog stays content-sized: it has no `height`, and grows until it hits
4328
+ * `calc(100dvh - 2 x inset)` — the point at which the body starts to scroll.
4329
+ *
4330
+ * The theme's `padding` insets all three rows (which is what makes the default
4331
+ * header read as a pill floating inside the surface); `bodyPadding` pads the
4332
+ * scrolling row alone.
4333
+ */
4270
4334
  declare class UniDialogComponent extends BaseComponent<UniDialogOptions> {
4271
4335
  private elem;
4272
4336
  /** Two-way bindable open state: [(show)]. */
@@ -4287,9 +4351,22 @@ declare class UniDialogComponent extends BaseComponent<UniDialogOptions> {
4287
4351
  readonly hasTitle: _angular_core.WritableSignal<boolean>;
4288
4352
  /** Emits true once opened and false once the closing animation finishes. */
4289
4353
  showing: _angular_core.OutputEmitterRef<boolean>;
4354
+ protected readonly headerTemplate: _angular_core.Signal<TemplateRef<unknown>>;
4355
+ protected readonly bodyTemplate: _angular_core.Signal<TemplateRef<unknown>>;
4356
+ protected readonly footerTemplate: _angular_core.Signal<TemplateRef<unknown>>;
4290
4357
  constructor();
4291
4358
  private get _dialog();
4359
+ /**
4360
+ * One timing for the whole move, panel and scrim together — the same `panel`
4361
+ * token the drawer's slide reads, so the two surfaces no longer disagree
4362
+ * about how long arriving takes.
4363
+ */
4364
+ private readonly motion;
4365
+ /** The gap the surface keeps from the viewport edge before its body scrolls. */
4366
+ private readonly inset;
4292
4367
  protected readonly className: _angular_core.Signal<string>;
4368
+ /** The only scrolling row, and the only one `bodyPadding` touches. */
4369
+ protected readonly bodyClass: _angular_core.Signal<string>;
4293
4370
  protected backdropClick(event: Event): void;
4294
4371
  /**
4295
4372
  * Escape fires the native 'cancel' event, which would close the dialog
@@ -4298,13 +4375,19 @@ declare class UniDialogComponent extends BaseComponent<UniDialogOptions> {
4298
4375
  */
4299
4376
  protected escapeCancel(event: Event): void;
4300
4377
  protected closingAnimation(e: AnimationEvent): void;
4378
+ /**
4379
+ * Doubled selector (`.css-x.css-x`) so these win over the icon button's own
4380
+ * class, which sets `position: relative` and is emitted after this one.
4381
+ * Without it the close never leaves the flow — it used to sit inline at the
4382
+ * top of the surface, and under the flex column it would take a whole row.
4383
+ */
4301
4384
  closeButton: string;
4302
4385
  private dialogFadeIn;
4303
4386
  private dialogFadeOut;
4304
4387
  open(): void;
4305
4388
  close(): void;
4306
4389
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UniDialogComponent, never>;
4307
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<UniDialogComponent, "dialog[uni-dialog]", never, { "show": { "alias": "show"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "initialFocus": { "alias": "initialFocus"; "required": false; "isSignal": true; }; "defaultCloseButton": { "alias": "defaultCloseButton"; "required": false; "isSignal": true; }; }, { "show": "showChange"; "showing": "showing"; }, never, ["*"], true, never>;
4390
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UniDialogComponent, "dialog[uni-dialog]", never, { "show": { "alias": "show"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "initialFocus": { "alias": "initialFocus"; "required": false; "isSignal": true; }; "defaultCloseButton": { "alias": "defaultCloseButton"; "required": false; "isSignal": true; }; }, { "show": "showChange"; "showing": "showing"; }, never, ["[uni-dialog-header], [dialog-header]", "[uni-dialog-buttons], [dialog-buttons]", "*"], true, never>;
4308
4391
  }
4309
4392
 
4310
4393
  declare class UniDividerComponent {
@@ -4472,8 +4555,12 @@ interface UniDrawerOptions {
4472
4555
  * unpadded so that header and footer rows can pin flush to its edges.
4473
4556
  */
4474
4557
  padding?: OptionalSize;
4475
- /** Backdrop styling for the overlay mode. Ignored when `scrim` is false. */
4476
- backdrop?: StyleExpression;
4558
+ /**
4559
+ * Name of a `backdrops` primitive — the wash laid over the page behind the
4560
+ * overlay. The same token the dialog points at, so one theme entry dresses
4561
+ * both. A raw style object is still accepted. Ignored when `scrim` is false.
4562
+ */
4563
+ backdrop?: Backdrop | StyleExpression;
4477
4564
  /**
4478
4565
  * Whether the overlay mode dims the page behind it. False leaves
4479
4566
  * `::backdrop` transparent — the drawer still traps focus and is still
@@ -4482,6 +4569,12 @@ interface UniDrawerOptions {
4482
4569
  scrim?: boolean;
4483
4570
  /** Surface treatment of the panel. */
4484
4571
  background?: DrawerBackground;
4572
+ /**
4573
+ * Timing for everything the panel does: the overlay's slide, its scrim's
4574
+ * fade, and the side panel's width transition. One token for all three, so
4575
+ * the scrim can never drift out of step with the panel it dims.
4576
+ */
4577
+ motion?: Motion;
4485
4578
  }
4486
4579
 
4487
4580
  /**
@@ -4581,6 +4674,15 @@ declare class UniDrawerComponent extends BaseComponent<UniDrawerOptions> {
4581
4674
  private readonly edge;
4582
4675
  private readonly slideIn;
4583
4676
  private readonly slideOut;
4677
+ /** The scrim's own fade, so the dimming arrives and leaves with the panel. */
4678
+ private readonly scrimIn;
4679
+ private readonly scrimOut;
4680
+ /**
4681
+ * One timing for everything the panel does. The scrim used to snap in and
4682
+ * out around a panel that took 250ms to slide, because `::backdrop` had a
4683
+ * background and no animation at all.
4684
+ */
4685
+ private readonly motion;
4584
4686
  /** Input wins over the theme option; the literal is the last-resort default. */
4585
4687
  private readonly panelWidth;
4586
4688
  private readonly showScrim;