circletone.mjs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import { NgClass } from '@angular/common';
  2. import * as i0 from '@angular/core';
  3. import { Component, ChangeDetectionStrategy, Input } from '@angular/core';
  4. class ButtonComponent {
  5. constructor() {
  6. this.text = '';
  7. this.type = 'default';
  8. this.size = 'base';
  9. this.variant = 'default';
  10. }
  11. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  12. 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 [ngClass]=\"{\n 'bg-primary': type === 'default' && variant === 'default',\n 'bg-on-primary': type === 'alternate' && variant === 'default',\n 'bg-yellow-400': type === 'warning' && variant === 'default',\n 'bg-red-400': type === 'error' && variant === 'default',\n 'bg-lime-600': type === 'success' && variant === 'default',\n 'border-primary': type === 'default' && variant === 'outline',\n 'border-on-primary': type === 'alternate' && variant === 'outline',\n 'border-yellow-400': type === 'warning' && variant === 'outline',\n 'border-red-400': type === 'error' && variant === 'outline',\n 'border-lime-600': type === 'success' && variant === 'outline',\n 'px-3 py-2 text-xs text-center': size === 'xs',\n 'px-3 py-2 text-sm text-center': size === 'sm',\n 'px-5 py-3 text-sm text-center': size === 'base',\n 'px-5 py-3 text-base text-center': size === 'lg',\n 'px-6 py-3.5 text-base text-center': size === 'xl'\n }\"\n class=\"rounded-md border-0 bg-transparent\">\n {{ text }}\n</button>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
  13. }
  14. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, decorators: [{
  15. type: Component,
  16. args: [{ selector: 'ct-button', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n [ngClass]=\"{\n 'bg-primary': type === 'default' && variant === 'default',\n 'bg-on-primary': type === 'alternate' && variant === 'default',\n 'bg-yellow-400': type === 'warning' && variant === 'default',\n 'bg-red-400': type === 'error' && variant === 'default',\n 'bg-lime-600': type === 'success' && variant === 'default',\n 'border-primary': type === 'default' && variant === 'outline',\n 'border-on-primary': type === 'alternate' && variant === 'outline',\n 'border-yellow-400': type === 'warning' && variant === 'outline',\n 'border-red-400': type === 'error' && variant === 'outline',\n 'border-lime-600': type === 'success' && variant === 'outline',\n 'px-3 py-2 text-xs text-center': size === 'xs',\n 'px-3 py-2 text-sm text-center': size === 'sm',\n 'px-5 py-3 text-sm text-center': size === 'base',\n 'px-5 py-3 text-base text-center': size === 'lg',\n 'px-6 py-3.5 text-base text-center': size === 'xl'\n }\"\n class=\"rounded-md border-0 bg-transparent\">\n {{ text }}\n</button>\n" }]
  17. }], propDecorators: { text: [{
  18. type: Input,
  19. args: [{ required: true }]
  20. }], type: [{
  21. type: Input
  22. }], size: [{
  23. type: Input
  24. }], variant: [{
  25. type: Input
  26. }] } });
  27. class IconComponent {
  28. constructor() {
  29. this.icon = '';
  30. this.iconClass = '';
  31. this.fill = 'currentColor';
  32. this.strokeWidth = 1.5;
  33. this.strokeColor = 'currentColor';
  34. this.size = '6';
  35. this.iconPath = '';
  36. }
  37. ngOnInit() {
  38. this.iconPath = this.getIconPath();
  39. this.strokeColor = this.getFormattedColor(this.strokeColor);
  40. this.fill = this.getFormattedColor(this.fill);
  41. }
  42. getFormattedColor(color) {
  43. if (color.startsWith('--')) {
  44. const rgbValue = getComputedStyle(document.documentElement).getPropertyValue(color).trim();
  45. return `rgb(${rgbValue})`;
  46. }
  47. return color;
  48. }
  49. getIconPath() {
  50. return `./icons.svg#${this.icon}`;
  51. }
  52. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  53. 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 }); }
  54. }
  55. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, decorators: [{
  56. type: Component,
  57. 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" }]
  58. }], propDecorators: { icon: [{
  59. type: Input
  60. }], iconClass: [{
  61. type: Input
  62. }], fill: [{
  63. type: Input
  64. }], strokeWidth: [{
  65. type: Input
  66. }], strokeColor: [{
  67. type: Input
  68. }], size: [{
  69. type: Input
  70. }] } });
  71. const tailwindPreset = {
  72. theme: {
  73. extend: {
  74. darkMode: 'class',
  75. fontFamily: {
  76. primary: 'var(--font-primary)',
  77. title: 'var(--font-title)',
  78. },
  79. colors: {
  80. primary: {
  81. DEFAULT: 'rgb(var(--primary) / <alpha-value>)',
  82. dark: 'rgb(var(--primary-dark) / <alpha-value>)',
  83. variation: 'rgb(var(--primary-variation) / <alpha-value>)',
  84. 'variation-dark': 'rgb(var(--primary-variation-dark) / <alpha-value>)',
  85. },
  86. secondary: {
  87. DEFAULT: 'rgb(var(--secondary) / <alpha-value>)',
  88. dark: 'rgb(var(--secondary-dark) / <alpha-value>)',
  89. },
  90. background: {
  91. DEFAULT: 'rgb(var(--background) / <alpha-value>)',
  92. dark: 'rgb(var(--background-dark) / <alpha-value>)',
  93. },
  94. surface: {
  95. DEFAULT: 'rgb(var(--surface) / <alpha-value>)',
  96. variation: 'rgb(var(--surface-variation) / <alpha-value>)',
  97. dark: 'rgb(var(--surface-dark) / <alpha-value>)',
  98. 'variation-dark': 'rgb(var(--surface-variation-dark) / <alpha-value>)',
  99. },
  100. accent: {
  101. DEFAULT: 'rgb(var(--accent) / <alpha-value>)',
  102. dark: 'rgb(var(--accent-dark) / <alpha-value>)',
  103. },
  104. on: {
  105. primary: 'rgb(var(--on-primary) / <alpha-value>)',
  106. 'primary-variation': 'rgb(var(--on-primary-variation) / <alpha-value>)',
  107. secondary: 'rgb(var(--on-secondary) / <alpha-value>)',
  108. 'secondary-variation': 'rgb(var(--on-secondary-variation) / <alpha-value>)',
  109. accent: 'rgb(var(--on-accent) / <alpha-value>)',
  110. background: 'rgb(var(--on-background) / <alpha-value>)',
  111. 'background-variation': 'rgb(var(--on-background-variation) / <alpha-value>)',
  112. surface: 'rgb(var(--on-surface) / <alpha-value>)',
  113. 'surface-variation': 'rgb(var(--on-surface-variation) / <alpha-value>)',
  114. 'primary-dark': 'rgb(var(--on-primary-dark) / <alpha-value>)',
  115. 'primary-variation-dark': 'rgb(var(--on-primary-variation-dark) / <alpha-value>)',
  116. 'secondary-dark': 'rgb(var(--on-secondary-dark) / <alpha-value>)',
  117. 'secondary-variation-dark': 'rgb(var(--on-secondary-variation-dark) / <alpha-value>)',
  118. 'accent-dark': 'rgb(var(--on-accent-dark) / <alpha-value>)',
  119. 'background-dark': 'rgb(var(--on-background-dark) / <alpha-value>)',
  120. 'background-variation-dark': 'rgb(var(--on-background-variation-dark) / <alpha-value>)',
  121. 'surface-dark': 'rgb(var(--on-surface-dark) / <alpha-value>)',
  122. 'surface-variation-dark': 'rgb(var(--on-surface-variation-dark) / <alpha-value>)',
  123. },
  124. },
  125. },
  126. },
  127. };
  128. /*
  129. * Public API Surface of circletone
  130. */
  131. /**
  132. * Generated bundle index. Do not edit.
  133. */
  134. export { ButtonComponent, IconComponent, tailwindPreset };
  135. //# sourceMappingURL=circletone.mjs.map