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. const tailwindPreset = {
  5. theme: {
  6. extend: {
  7. darkMode: 'class',
  8. fontFamily: {
  9. primary: 'var(--font-primary)',
  10. title: 'var(--font-title)',
  11. },
  12. colors: {
  13. primary: {
  14. DEFAULT: 'rgb(var(--primary) / <alpha-value>)',
  15. dark: 'rgb(var(--priamry-dark) / <alpha-value>)',
  16. variation: 'rgb(var(--primary-variation) / <alpha-value>)',
  17. 'variation-dark': 'rgb(var(--primary-variation-dark) / <alpha-value>)',
  18. },
  19. secondary: {
  20. DEFAULT: 'rgb(var(--secondary) / <alpha-value>)',
  21. dark: 'rgb(var(--secondary-dark) / <alpha-value>)',
  22. },
  23. background: {
  24. DEFAULT: 'rgb(var(--background) / <alpha-value>)',
  25. dark: 'rgb(var(--background-dark) / <alpha-value>)',
  26. },
  27. surface: {
  28. DEFAULT: 'rgb(var(--surface) / <alpha-value>)',
  29. variation: 'rgb(var(--surface-variation) / <alpha-value>)',
  30. dark: 'rgb(var(--surface-dark) / <alpha-value>)',
  31. 'variation-dark': 'rgb(var(--surface-variation-dark) / <alpha-value>)',
  32. },
  33. accent: {
  34. DEFAULT: 'rgb(var(--accent) / <alpha-value>)',
  35. dark: 'rgb(var(--accent-dark) / <alpha-value>)',
  36. },
  37. on: {
  38. primary: 'rgb(var(--on-primary) / <alpha-value>)',
  39. 'primary-variation': 'rgb(var(--on-primary-variation) / <alpha-value>)',
  40. secondary: 'rgb(var(--on-secondary) / <alpha-value>)',
  41. 'secondary-variation': 'rgb(var(--on-secondary-variation) / <alpha-value>)',
  42. accent: 'rgb(var(--on-accent) / <alpha-value>)',
  43. background: 'rgb(var(--on-background) / <alpha-value>)',
  44. 'background-variation': 'rgb(var(--on-background-variation) / <alpha-value>)',
  45. surface: 'rgb(var(--on-surface) / <alpha-value>)',
  46. 'surface-variation': 'rgb(var(--on-surface-variation) / <alpha-value>)',
  47. 'primary-dark': 'rgb(var(--on-primary-dark) / <alpha-value>)',
  48. 'primary-variation-dark': 'rgb(var(--on-primary-variation-dark) / <alpha-value>)',
  49. 'secondary-dark': 'rgb(var(--on-secondary-dark) / <alpha-value>)',
  50. 'secondary-variation-dark': 'rgb(var(--on-secondary-variation-dark) / <alpha-value>)',
  51. 'accent-dark': 'rgb(var(--on-accent-dark) / <alpha-value>)',
  52. 'background-dark': 'rgb(var(--on-background-dark) / <alpha-value>)',
  53. 'background-variation-dark': 'rgb(var(--on-background-variation-dark) / <alpha-value>)',
  54. 'surface-dark': 'rgb(var(--on-surface-dark) / <alpha-value>)',
  55. 'surface-variation-dark': 'rgb(var(--on-surface-variation-dark) / <alpha-value>)',
  56. },
  57. },
  58. },
  59. },
  60. };
  61. class ButtonComponent {
  62. constructor() {
  63. this.text = '';
  64. this.type = 'default';
  65. this.size = 'base';
  66. this.variant = 'default';
  67. }
  68. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  69. 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 }); }
  70. }
  71. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: ButtonComponent, decorators: [{
  72. type: Component,
  73. 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" }]
  74. }], propDecorators: { text: [{
  75. type: Input,
  76. args: [{ required: true }]
  77. }], type: [{
  78. type: Input
  79. }], size: [{
  80. type: Input
  81. }], variant: [{
  82. type: Input
  83. }] } });
  84. class IconComponent {
  85. constructor() {
  86. this.icon = '';
  87. this.iconClass = '';
  88. this.fill = 'currentColor';
  89. this.strokeWidth = 1.5;
  90. this.strokeColor = 'currentColor';
  91. this.size = '6';
  92. this.iconPath = '';
  93. }
  94. ngOnInit() {
  95. this.iconPath = this.getIconPath();
  96. this.strokeColor = this.getFormattedColor(this.strokeColor);
  97. this.fill = this.getFormattedColor(this.fill);
  98. }
  99. getFormattedColor(color) {
  100. if (color.startsWith('--')) {
  101. const rgbValue = getComputedStyle(document.documentElement).getPropertyValue(color).trim();
  102. return `rgb(${rgbValue})`;
  103. }
  104. return color;
  105. }
  106. getIconPath() {
  107. return ` assets/images/icons.svg#${this.icon}`;
  108. }
  109. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
  110. 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 }); }
  111. }
  112. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: IconComponent, decorators: [{
  113. type: Component,
  114. 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" }]
  115. }], propDecorators: { icon: [{
  116. type: Input
  117. }], iconClass: [{
  118. type: Input
  119. }], fill: [{
  120. type: Input
  121. }], strokeWidth: [{
  122. type: Input
  123. }], strokeColor: [{
  124. type: Input
  125. }], size: [{
  126. type: Input
  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