@nanahoshi/mona-ui 0.26.3 → 0.27.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.
@@ -71,6 +71,33 @@ export class CircularProgressBarSizesExampleComponent {
71
71
  </div>
72
72
  ```
73
73
 
74
+ ### Round and flat ends
75
+
76
+ The arc's ends are round by default. `lineCap="flat"` cuts them straight instead. Both cover the same part of the ring, so 72% reads the same either way.
77
+
78
+ `line-cap-example.component.ts`
79
+
80
+ ```typescript
81
+ import { Component } from "@angular/core";
82
+ import { CircularProgressBarComponent } from "@nanahoshi/mona-ui/circular-progress-bar";
83
+
84
+ @Component({
85
+ selector: "app-circular-progress-bar-line-cap-example",
86
+ imports: [CircularProgressBarComponent],
87
+ templateUrl: "./line-cap-example.component.html"
88
+ })
89
+ export class CircularProgressBarLineCapExampleComponent {}
90
+ ```
91
+
92
+ `line-cap-example.component.html`
93
+
94
+ ```html
95
+ <div class="flex flex-wrap items-center gap-6">
96
+ <mona-circular-progress-bar aria-label="Quiz score" [size]="120" [thickness]="12" [value]="72"></mona-circular-progress-bar>
97
+ <mona-circular-progress-bar aria-label="Course progress" lineCap="flat" [size]="120" [thickness]="12" [value]="72"></mona-circular-progress-bar>
98
+ </div>
99
+ ```
100
+
74
101
  ### Indeterminate
75
102
 
76
103
  Use it when the completion percentage is unknown. Set `aria-valuetext` so screen readers announce a state.
@@ -161,6 +188,10 @@ The `size` input controls the outer dimension of the SVG in pixels. Both width a
161
188
 
162
189
  `thickness` controls the stroke width of both the track and the progress arc in pixels. The stroke fits inside `size`, so increasing it reduces the effective radius. The default of `6` suits most sizes; reduce it for small sizes or increase it for bold indicators.
163
190
 
191
+ ### Line cap
192
+
193
+ `lineCap` sets the shape of the arc's ends: `"round"` (the default) rounds them, `"flat"` cuts them straight. A round end reaches half the `thickness` past where the arc ends, so the component shortens the arc by that much at each end to keep it within the value. An empty ring draws nothing either way, and a sliver of progress draws a dot as wide as the stroke.
194
+
164
195
  ### Color
165
196
 
166
197
  When `color` is empty the arc color falls back to `var(--color-primary)`. The track (the full circle behind the arc) always uses the `var(--color-surface-muted)` design token.
@@ -243,6 +274,7 @@ Everything below is imported from `@nanahoshi/mona-ui/circular-progress-bar`.
243
274
  | `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
244
275
  | `indeterminate` | `boolean` | `false` | Activates indeterminate mode when the completion value is unknown. ARIA value attributes are removed. |
245
276
  | `labelVisible` | `boolean` | `true` | Controls label visibility in determinate mode. Has no effect in indeterminate mode, where the label is always hidden. |
277
+ | `lineCap` | `CircularProgressBarLineCap` | `"round"` | Shape of the arc's two ends. `"round"` draws rounded ends that stay within the value's span, so the arc covers the same part of the ring as `"flat"`, which cuts them straight. An empty ring draws nothing either way. |
246
278
  | `max` | `number` | `100` | Upper bound of the value range. Must be greater than `min`; otherwise the bar reports no values and a warning is logged in development. |
247
279
  | `min` | `number` | `0` | Lower bound of the value range. |
248
280
  | `size` | `number` | `100` | Diameter of the indicator in pixels. Controls both width and height of the host element. |
@@ -276,6 +308,12 @@ when `indeterminate` is `true`.
276
308
  | `min` | `number` |
277
309
  | `percent` | `number` |
278
310
 
311
+ #### `CircularProgressBarLineCap`
312
+
313
+ ```typescript
314
+ type CircularProgressBarLineCap = "flat" | "round";
315
+ ```
316
+
279
317
  #### `Action`
280
318
 
281
319
  From `@nanahoshi/mona-ui/common`.
@@ -35,7 +35,7 @@ const circularProgressBarBaseThemeVariants = cva(`
35
35
  [&_svg]:h-full [&_svg]:w-full
36
36
  [&_svg_circle]:origin-center
37
37
  [&_svg_circle]:-rotate-90
38
- [&_svg_circle]:transition-[stroke-dashoffset,stroke]
38
+ [&_svg_circle]:transition-[stroke-dashoffset,stroke-dasharray,stroke]
39
39
  [&_svg_circle]:duration-(--mona-motion-fast)
40
40
  [&_svg_circle]:ease-in
41
41
  [&_svg_circle]:data-[stroke-trail='true']:stroke-surface-muted
@@ -50,6 +50,8 @@ const circularProgressBarBaseThemeVariants = cva(`
50
50
  }
51
51
  });
52
52
 
53
+ /** The share of the ring the spinning arc covers in indeterminate mode. */
54
+ const INDETERMINATE_ARC_FRACTION = 1 - 1 / 1.42;
53
55
  class CircularProgressBarComponent {
54
56
  #i18n;
55
57
  constructor() {
@@ -90,6 +92,31 @@ class CircularProgressBarComponent {
90
92
  ...(ngDevMode ? [{ debugName: "progress" }] : /* istanbul ignore next */ []));
91
93
  this.radius = computed(() => Math.max(0, this.size() / 2 - this.thickness() / 2), /* @ts-ignore */
92
94
  ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
95
+ this.stroke = computed(() => {
96
+ const circumference = this.circumference();
97
+ const fraction = this.indeterminate()
98
+ ? INDETERMINATE_ARC_FRACTION
99
+ : Math.min(Math.max(this.progress(), 0), 100) / 100;
100
+ if (this.lineCap() === "flat") {
101
+ return { dashArray: `${circumference}`, dashOffset: circumference * (1 - fraction), lineCap: "butt" };
102
+ }
103
+ if (fraction <= 0) {
104
+ // A zero-length dash still paints its round caps as a dot, so an empty ring drops them.
105
+ return { dashArray: `0 ${circumference}`, dashOffset: 0, lineCap: "butt" };
106
+ }
107
+ if (fraction >= 1) {
108
+ return { dashArray: `${circumference} ${circumference}`, dashOffset: 0, lineCap: "round" };
109
+ }
110
+ // Each round cap reaches half the thickness past its end of the dash. Shortening the dash by the thickness and
111
+ // starting it half a thickness in keeps the painted arc between the start of the ring and the value.
112
+ const thickness = Math.min(this.thickness(), circumference * fraction);
113
+ return {
114
+ dashArray: `${circumference * fraction - thickness} ${circumference}`,
115
+ dashOffset: -thickness / 2,
116
+ lineCap: "round"
117
+ };
118
+ }, /* @ts-ignore */
119
+ ...(ngDevMode ? [{ debugName: "stroke" }] : /* istanbul ignore next */ []));
93
120
  this.strokeColor = computed(() => {
94
121
  if (typeof this.color() === "string") {
95
122
  return this.color() || "var(--mona-indicator-color, var(--color-primary))";
@@ -98,12 +125,6 @@ class CircularProgressBarComponent {
98
125
  return colorize(this.progress());
99
126
  }, /* @ts-ignore */
100
127
  ...(ngDevMode ? [{ debugName: "strokeColor" }] : /* istanbul ignore next */ []));
101
- this.strokeDashOffset = computed(() => {
102
- const progress = Math.min(Math.max(this.progress(), 0), 100);
103
- const dashOffset = this.circumference() * (1 - progress / 100);
104
- return this.indeterminate() ? this.circumference() / 1.42 : dashOffset;
105
- }, /* @ts-ignore */
106
- ...(ngDevMode ? [{ debugName: "strokeDashOffset" }] : /* istanbul ignore next */ []));
107
128
  /**
108
129
  * @description Enables CSS transitions on stroke and color changes.
109
130
  * Set to `false` when updating `value` at a high frequency.
@@ -152,6 +173,13 @@ class CircularProgressBarComponent {
152
173
  */
153
174
  this.labelVisible = input(true, /* @ts-ignore */
154
175
  ...(ngDevMode ? [{ debugName: "labelVisible" }] : /* istanbul ignore next */ []));
176
+ /**
177
+ * @description Shape of the arc's two ends. `"round"` draws rounded ends that stay within the value's span, so the
178
+ * arc covers the same part of the ring as `"flat"`, which cuts them straight. An empty ring draws nothing either way.
179
+ * @default "round"
180
+ */
181
+ this.lineCap = input("round", /* @ts-ignore */
182
+ ...(ngDevMode ? [{ debugName: "lineCap" }] : /* istanbul ignore next */ []));
155
183
  /**
156
184
  * @description Upper bound of the value range. Must be greater than `min`; otherwise the bar reports no values and a
157
185
  * warning is logged in development.
@@ -198,7 +226,7 @@ class CircularProgressBarComponent {
198
226
  }
199
227
  }
200
228
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CircularProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
201
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CircularProgressBarComponent, isStandalone: true, selector: "mona-circular-progress-bar", inputs: { animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaValueText: { classPropertyName: "ariaValueText", publicName: "aria-valuetext", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, labelVisible: { classPropertyName: "labelVisible", publicName: "labelVisible", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "class": "baseClasses()", "attr.aria-label": "ariaLabel() || messages().label", "attr.aria-valuemin": "ariaRange()?.min", "attr.aria-valuemax": "ariaRange()?.max", "attr.aria-valuenow": "ariaRange()?.now", "attr.aria-valuetext": "ariaValueText() || null", "attr.aria-disabled": "disabled() || null", "attr.data-disabled": "disabled()", "style.width": "pixelSize()", "style.height": "pixelSize()" } }, queries: [{ propertyName: "labelTemplate", first: true, predicate: CircularProgressBarLabelTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<svg>\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.data-stroke-trail]=\"true\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\" />\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.stroke]=\"strokeColor()\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-dashoffset]=\"strokeDashOffset()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\"\n [class.indeterminate]=\"indeterminate()\" />\n</svg>\n@if (!indeterminate() && labelVisible()) {\n <div class=\"mona-circular-progress-bar-label\">\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\n </ng-container>\n } @else {\n {{ formattedProgress() }}\n }\n </div>\n}\n", styles: [".indeterminate{animation:rotate 2s linear infinite}@keyframes rotate{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}@keyframes fade{50%{opacity:.4}}@media(prefers-reduced-motion:reduce){.indeterminate{animation:fade 2s ease-in-out infinite}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
229
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CircularProgressBarComponent, isStandalone: true, selector: "mona-circular-progress-bar", inputs: { animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaValueText: { classPropertyName: "ariaValueText", publicName: "aria-valuetext", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, labelVisible: { classPropertyName: "labelVisible", publicName: "labelVisible", isSignal: true, isRequired: false, transformFunction: null }, lineCap: { classPropertyName: "lineCap", publicName: "lineCap", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "class": "baseClasses()", "attr.aria-label": "ariaLabel() || messages().label", "attr.aria-valuemin": "ariaRange()?.min", "attr.aria-valuemax": "ariaRange()?.max", "attr.aria-valuenow": "ariaRange()?.now", "attr.aria-valuetext": "ariaValueText() || null", "attr.aria-disabled": "disabled() || null", "attr.data-disabled": "disabled()", "style.width": "pixelSize()", "style.height": "pixelSize()" } }, queries: [{ propertyName: "labelTemplate", first: true, predicate: CircularProgressBarLabelTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<svg>\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.data-stroke-trail]=\"true\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\" />\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.stroke]=\"strokeColor()\"\n [attr.stroke-dasharray]=\"stroke().dashArray\"\n [attr.stroke-dashoffset]=\"stroke().dashOffset\"\n [attr.stroke-linecap]=\"stroke().lineCap\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\"\n [class.indeterminate]=\"indeterminate()\" />\n</svg>\n@if (!indeterminate() && labelVisible()) {\n <div class=\"mona-circular-progress-bar-label\">\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\n </ng-container>\n } @else {\n {{ formattedProgress() }}\n }\n </div>\n}\n", styles: [".indeterminate{animation:rotate 2s linear infinite}@keyframes rotate{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}@keyframes fade{50%{opacity:.4}}@media(prefers-reduced-motion:reduce){.indeterminate{animation:fade 2s ease-in-out infinite}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
202
230
  }
203
231
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CircularProgressBarComponent, decorators: [{
204
232
  type: Component,
@@ -214,8 +242,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
214
242
  role: "progressbar",
215
243
  "[style.width]": "pixelSize()",
216
244
  "[style.height]": "pixelSize()"
217
- }, template: "<svg>\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.data-stroke-trail]=\"true\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\" />\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.stroke]=\"strokeColor()\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-dashoffset]=\"strokeDashOffset()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\"\n [class.indeterminate]=\"indeterminate()\" />\n</svg>\n@if (!indeterminate() && labelVisible()) {\n <div class=\"mona-circular-progress-bar-label\">\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\n </ng-container>\n } @else {\n {{ formattedProgress() }}\n }\n </div>\n}\n", styles: [".indeterminate{animation:rotate 2s linear infinite}@keyframes rotate{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}@keyframes fade{50%{opacity:.4}}@media(prefers-reduced-motion:reduce){.indeterminate{animation:fade 2s ease-in-out infinite}}\n"] }]
218
- }], ctorParameters: () => [], propDecorators: { labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CircularProgressBarLabelTemplateDirective), { isSignal: true }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaValueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-valuetext", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], labelVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVisible", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
245
+ }, template: "<svg>\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.data-stroke-trail]=\"true\"\n [attr.stroke-dasharray]=\"circumference()\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\" />\n <circle\n [attr.cx]=\"center().x\"\n [attr.cy]=\"center().y\"\n [attr.r]=\"radius()\"\n [attr.stroke]=\"strokeColor()\"\n [attr.stroke-dasharray]=\"stroke().dashArray\"\n [attr.stroke-dashoffset]=\"stroke().dashOffset\"\n [attr.stroke-linecap]=\"stroke().lineCap\"\n [attr.stroke-width]=\"thickness()\"\n fill=\"transparent\"\n [class.indeterminate]=\"indeterminate()\" />\n</svg>\n@if (!indeterminate() && labelVisible()) {\n <div class=\"mona-circular-progress-bar-label\">\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()?.templateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: value(), min: min(), max: max(), percent: progress() }\">\n </ng-container>\n } @else {\n {{ formattedProgress() }}\n }\n </div>\n}\n", styles: [".indeterminate{animation:rotate 2s linear infinite}@keyframes rotate{0%{transform:rotate(0)}50%{transform:rotate(180deg)}to{transform:rotate(360deg)}}@keyframes fade{50%{opacity:.4}}@media(prefers-reduced-motion:reduce){.indeterminate{animation:fade 2s ease-in-out infinite}}\n"] }]
246
+ }], ctorParameters: () => [], propDecorators: { labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CircularProgressBarLabelTemplateDirective), { isSignal: true }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaValueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-valuetext", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], labelVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVisible", required: false }] }], lineCap: [{ type: i0.Input, args: [{ isSignal: true, alias: "lineCap", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
219
247
 
220
248
  /*
221
249
  * Public API Surface of @nanahoshi/mona-ui/circular-progress-bar
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanahoshi/mona-ui",
3
- "version": "0.26.3",
3
+ "version": "0.27.0",
4
4
  "description": "A very light Angular UI framework",
5
5
  "author": "Nanahoshi",
6
6
  "repository": {
@@ -24,6 +24,8 @@ declare class CircularProgressBarLabelTemplateDirective {
24
24
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CircularProgressBarLabelTemplateDirective, "ng-template[monaCircularProgressBarLabelTemplate]", never, {}, {}, never, never, true, never>;
25
25
  }
26
26
 
27
+ type CircularProgressBarLineCap = "flat" | "round";
28
+
27
29
  declare const circularProgressBarBaseThemeVariants: (props?: ({
28
30
  disabled?: boolean | null | undefined;
29
31
  } & class_variance_authority_types.ClassProp) | undefined) => string;
@@ -31,6 +33,12 @@ type CircularProgressBarBaseVariantProps = VariantProps<typeof circularProgressB
31
33
  type CircularProgressBarBaseVariantInput = VariantInputs<CircularProgressBarBaseVariantProps>;
32
34
  type CircularProgressBarVariantInput = CircularProgressBarBaseVariantInput;
33
35
 
36
+ interface CircularProgressBarStroke {
37
+ readonly dashArray: string;
38
+ readonly dashOffset: number;
39
+ /** The SVG `stroke-linecap` value. */
40
+ readonly lineCap: "butt" | "round";
41
+ }
34
42
  declare class CircularProgressBarComponent implements CircularProgressBarVariantInput {
35
43
  #private;
36
44
  protected readonly ariaRange: _angular_core.Signal<_nanahoshi_mona_ui_common.ProgressRange | null>;
@@ -46,8 +54,8 @@ declare class CircularProgressBarComponent implements CircularProgressBarVariant
46
54
  protected readonly pixelSize: _angular_core.Signal<string>;
47
55
  protected readonly progress: _angular_core.Signal<number>;
48
56
  protected readonly radius: _angular_core.Signal<number>;
57
+ protected readonly stroke: _angular_core.Signal<CircularProgressBarStroke>;
49
58
  protected readonly strokeColor: _angular_core.Signal<string | Action<number, string>>;
50
- protected readonly strokeDashOffset: _angular_core.Signal<number>;
51
59
  /**
52
60
  * @description Enables CSS transitions on stroke and color changes.
53
61
  * Set to `false` when updating `value` at a high frequency.
@@ -91,6 +99,12 @@ declare class CircularProgressBarComponent implements CircularProgressBarVariant
91
99
  * @default true
92
100
  */
93
101
  readonly labelVisible: _angular_core.InputSignal<boolean>;
102
+ /**
103
+ * @description Shape of the arc's two ends. `"round"` draws rounded ends that stay within the value's span, so the
104
+ * arc covers the same part of the ring as `"flat"`, which cuts them straight. An empty ring draws nothing either way.
105
+ * @default "round"
106
+ */
107
+ readonly lineCap: _angular_core.InputSignal<CircularProgressBarLineCap>;
94
108
  /**
95
109
  * @description Upper bound of the value range. Must be greater than `min`; otherwise the bar reports no values and a
96
110
  * warning is logged in development.
@@ -125,8 +139,8 @@ declare class CircularProgressBarComponent implements CircularProgressBarVariant
125
139
  readonly value: _angular_core.InputSignal<number>;
126
140
  constructor();
127
141
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CircularProgressBarComponent, never>;
128
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CircularProgressBarComponent, "mona-circular-progress-bar", never, { "animate": { "alias": "animate"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaValueText": { "alias": "aria-valuetext"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "labelVisible": { "alias": "labelVisible"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "thickness": { "alias": "thickness"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, {}, ["labelTemplate"], never, true, never>;
142
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CircularProgressBarComponent, "mona-circular-progress-bar", never, { "animate": { "alias": "animate"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaValueText": { "alias": "aria-valuetext"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "labelVisible": { "alias": "labelVisible"; "required": false; "isSignal": true; }; "lineCap": { "alias": "lineCap"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "thickness": { "alias": "thickness"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, {}, ["labelTemplate"], never, true, never>;
129
143
  }
130
144
 
131
145
  export { CircularProgressBarComponent, CircularProgressBarLabelTemplateDirective };
132
- export type { LabelTemplateContext };
146
+ export type { CircularProgressBarLineCap, LabelTemplateContext };