circletone.mjs 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { NgClass } from '@angular/common';
  2. import * as i0 from '@angular/core';
  3. import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
  4. class IconComponent {
  5. constructor() {
  6. this.icon = '';
  7. this.iconClass = '';
  8. this.fill = 'currentColor';
  9. this.strokeWidth = 1.5;
  10. this.strokeColor = 'currentColor';
  11. this.size = '6';
  12. this.iconPath = '';
  13. }
  14. ngOnInit() {
  15. this.iconPath = '';
  16. this.strokeColor = this.getFormattedColor(this.strokeColor);
  17. this.fill = this.getFormattedColor(this.fill);
  18. }
  19. getFormattedColor(color) {
  20. if (color.startsWith('--')) {
  21. const rgbValue = getComputedStyle(document.documentElement).getPropertyValue(color).trim();
  22. return `rgb(${rgbValue})`;
  23. }
  24. return color;
  25. }
  26. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  27. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: IconComponent, isStandalone: true, selector: "ct-icon", inputs: { icon: "icon", iconClass: "iconClass", fill: "fill", strokeWidth: "strokeWidth", strokeColor: "strokeColor", size: "size" }, ngImport: i0, template: "<svg\n [ngClass]=\"iconClass\"\n [attr.fill]=\"fill\"\n [attr.stroke-width]=\"strokeWidth\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex size-full\">\n <use [attr.xlink:href]=\"iconPath\"></use>\n</svg>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  28. }
  29. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, decorators: [{
  30. type: Component,
  31. args: [{ selector: 'ct-icon', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg\n [ngClass]=\"iconClass\"\n [attr.fill]=\"fill\"\n [attr.stroke-width]=\"strokeWidth\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex size-full\">\n <use [attr.xlink:href]=\"iconPath\"></use>\n</svg>\n" }]
  32. }], propDecorators: { icon: [{
  33. type: Input
  34. }], iconClass: [{
  35. type: Input
  36. }], fill: [{
  37. type: Input
  38. }], strokeWidth: [{
  39. type: Input
  40. }], strokeColor: [{
  41. type: Input
  42. }], size: [{
  43. type: Input
  44. }] } });
  45. class ButtonComponent {
  46. constructor() {
  47. this.text = '';
  48. this.type = 'default';
  49. this.size = 'base';
  50. this.variant = 'default';
  51. }
  52. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  53. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: ButtonComponent, isStandalone: true, selector: "ct-button", inputs: { text: "text", type: "type", size: "size", variant: "variant" }, ngImport: i0, template: "<button\n class=\"rounded-md px-4 py-2\"\n [class.bg-primary]=\"type === 'default'\"\n [class.bg-on-primary]=\"type === 'alternate'\"\n [class.bg-yellow-400]=\"type === 'warning'\"\n [class.bg-red-400]=\"type === 'error'\"\n [class.bg-lime-600]=\"type === 'success'\">\n {{ text }}\n</button>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  54. }
  55. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, decorators: [{
  56. type: Component,
  57. args: [{ selector: 'ct-button', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n class=\"rounded-md px-4 py-2\"\n [class.bg-primary]=\"type === 'default'\"\n [class.bg-on-primary]=\"type === 'alternate'\"\n [class.bg-yellow-400]=\"type === 'warning'\"\n [class.bg-red-400]=\"type === 'error'\"\n [class.bg-lime-600]=\"type === 'success'\">\n {{ text }}\n</button>\n" }]
  58. }], propDecorators: { text: [{
  59. type: Input,
  60. args: [{ required: true }]
  61. }], type: [{
  62. type: Input
  63. }], size: [{
  64. type: Input
  65. }], variant: [{
  66. type: Input
  67. }] } });
  68. /*
  69. * Public API Surface of circletone
  70. */
  71. /**
  72. * Generated bundle index. Do not edit.
  73. */
  74. export { ButtonComponent, IconComponent };
  75. //# sourceMappingURL=circletone.mjs.map