@lgtm-hq/turbo-themes 0.12.16

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.
Files changed (184) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +231 -0
  3. package/assets/css/adapters/bulma.css +26 -0
  4. package/assets/css/themes/bulma-dark.css +90 -0
  5. package/assets/css/themes/bulma-light.css +90 -0
  6. package/assets/css/themes/catppuccin-frappe.css +58 -0
  7. package/assets/css/themes/catppuccin-latte.css +58 -0
  8. package/assets/css/themes/catppuccin-macchiato.css +58 -0
  9. package/assets/css/themes/catppuccin-mocha.css +58 -0
  10. package/assets/css/themes/dracula.css +90 -0
  11. package/assets/css/themes/github-dark.css +58 -0
  12. package/assets/css/themes/github-light.css +58 -0
  13. package/assets/css/turbo-core.css +92 -0
  14. package/dist/adapters/bootstrap/_utilities.scss +178 -0
  15. package/dist/adapters/bootstrap/_variables.scss +99 -0
  16. package/dist/adapters/tailwind/colors.js +133 -0
  17. package/dist/adapters/tailwind/preset.js +136 -0
  18. package/dist/index.d.ts +12 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +14 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/themes/bulma.d.ts +31 -0
  23. package/dist/themes/bulma.d.ts.map +1 -0
  24. package/dist/themes/bulma.js +160 -0
  25. package/dist/themes/bulma.js.map +1 -0
  26. package/dist/themes/css.d.ts +4 -0
  27. package/dist/themes/css.d.ts.map +1 -0
  28. package/dist/themes/css.js +617 -0
  29. package/dist/themes/css.js.map +1 -0
  30. package/dist/themes/packs/bulma.d.ts +12 -0
  31. package/dist/themes/packs/bulma.d.ts.map +1 -0
  32. package/dist/themes/packs/bulma.js +285 -0
  33. package/dist/themes/packs/bulma.js.map +1 -0
  34. package/dist/themes/packs/catppuccin.synced.d.ts +3 -0
  35. package/dist/themes/packs/catppuccin.synced.d.ts.map +1 -0
  36. package/dist/themes/packs/catppuccin.synced.js +340 -0
  37. package/dist/themes/packs/catppuccin.synced.js.map +1 -0
  38. package/dist/themes/packs/dracula.d.ts +8 -0
  39. package/dist/themes/packs/dracula.d.ts.map +1 -0
  40. package/dist/themes/packs/dracula.js +145 -0
  41. package/dist/themes/packs/dracula.js.map +1 -0
  42. package/dist/themes/packs/github.synced.d.ts +10 -0
  43. package/dist/themes/packs/github.synced.d.ts.map +1 -0
  44. package/dist/themes/packs/github.synced.js +281 -0
  45. package/dist/themes/packs/github.synced.js.map +1 -0
  46. package/dist/themes/registry.d.ts +3 -0
  47. package/dist/themes/registry.d.ts.map +1 -0
  48. package/dist/themes/registry.js +16 -0
  49. package/dist/themes/registry.js.map +1 -0
  50. package/dist/themes/types.d.ts +172 -0
  51. package/dist/themes/types.d.ts.map +1 -0
  52. package/dist/themes/types.js +4 -0
  53. package/dist/themes/types.js.map +1 -0
  54. package/dist/tokens/index.d.ts +8 -0
  55. package/dist/tokens/index.d.ts.map +1 -0
  56. package/dist/tokens/index.js +9 -0
  57. package/dist/tokens/index.js.map +1 -0
  58. package/dist/tokens/style-dictionary/bulma-dark.json +410 -0
  59. package/dist/tokens/style-dictionary/bulma-light.json +410 -0
  60. package/dist/tokens/style-dictionary/catppuccin-frappe.json +264 -0
  61. package/dist/tokens/style-dictionary/catppuccin-latte.json +264 -0
  62. package/dist/tokens/style-dictionary/catppuccin-macchiato.json +264 -0
  63. package/dist/tokens/style-dictionary/catppuccin-mocha.json +264 -0
  64. package/dist/tokens/style-dictionary/dracula.json +409 -0
  65. package/dist/tokens/style-dictionary/github-dark.json +264 -0
  66. package/dist/tokens/style-dictionary/github-light.json +264 -0
  67. package/dist/tokens/style-dictionary/themes.json +2526 -0
  68. package/dist/tokens/style-dictionary/tokens.json +1050 -0
  69. package/dist/tokens/tokens-typed.json +218 -0
  70. package/package.json +180 -0
  71. package/packages/adapters/bulma/dist/bulma-adapter.css +153 -0
  72. package/packages/adapters/bulma/dist/index.d.ts +60 -0
  73. package/packages/adapters/bulma/dist/index.d.ts.map +1 -0
  74. package/packages/adapters/bulma/dist/index.js +343 -0
  75. package/packages/adapters/bulma/dist/index.js.map +1 -0
  76. package/packages/adapters/tailwind/dist/colors.d.ts +32 -0
  77. package/packages/adapters/tailwind/dist/colors.d.ts.map +1 -0
  78. package/packages/adapters/tailwind/dist/colors.js +133 -0
  79. package/packages/adapters/tailwind/dist/colors.js.map +1 -0
  80. package/packages/adapters/tailwind/dist/preset.d.ts +117 -0
  81. package/packages/adapters/tailwind/dist/preset.d.ts.map +1 -0
  82. package/packages/adapters/tailwind/dist/preset.js +136 -0
  83. package/packages/adapters/tailwind/dist/preset.js.map +1 -0
  84. package/packages/adapters/tailwind/dist/tsconfig.tsbuildinfo +1 -0
  85. package/packages/css/dist/base.d.ts +27 -0
  86. package/packages/css/dist/base.d.ts.map +1 -0
  87. package/packages/css/dist/base.js +277 -0
  88. package/packages/css/dist/base.js.map +1 -0
  89. package/packages/css/dist/components/buttons.css +141 -0
  90. package/packages/css/dist/components/cards.css +157 -0
  91. package/packages/css/dist/components/forms.css +109 -0
  92. package/packages/css/dist/components/navigation.css +175 -0
  93. package/packages/css/dist/components/notifications.css +192 -0
  94. package/packages/css/dist/components/progress.css +113 -0
  95. package/packages/css/dist/components/sidebar.css +537 -0
  96. package/packages/css/dist/components/tables.css +157 -0
  97. package/packages/css/dist/components/tabs.css +106 -0
  98. package/packages/css/dist/components/tags.css +121 -0
  99. package/packages/css/dist/generator.d.ts +60 -0
  100. package/packages/css/dist/generator.d.ts.map +1 -0
  101. package/packages/css/dist/generator.js +267 -0
  102. package/packages/css/dist/generator.js.map +1 -0
  103. package/packages/css/dist/index.d.ts +13 -0
  104. package/packages/css/dist/index.d.ts.map +1 -0
  105. package/packages/css/dist/index.js +16 -0
  106. package/packages/css/dist/index.js.map +1 -0
  107. package/packages/css/dist/syntax.d.ts +29 -0
  108. package/packages/css/dist/syntax.d.ts.map +1 -0
  109. package/packages/css/dist/syntax.js +341 -0
  110. package/packages/css/dist/syntax.js.map +1 -0
  111. package/packages/css/dist/themes/bulma-dark.css +86 -0
  112. package/packages/css/dist/themes/bulma-light.css +86 -0
  113. package/packages/css/dist/themes/catppuccin-frappe.css +61 -0
  114. package/packages/css/dist/themes/catppuccin-latte.css +61 -0
  115. package/packages/css/dist/themes/catppuccin-macchiato.css +61 -0
  116. package/packages/css/dist/themes/catppuccin-mocha.css +61 -0
  117. package/packages/css/dist/themes/dracula.css +85 -0
  118. package/packages/css/dist/themes/github-dark.css +61 -0
  119. package/packages/css/dist/themes/github-light.css +61 -0
  120. package/packages/css/dist/turbo-base.css +246 -0
  121. package/packages/css/dist/turbo-components.css +1833 -0
  122. package/packages/css/dist/turbo-core.css +92 -0
  123. package/packages/css/dist/turbo-syntax.css +242 -0
  124. package/packages/css/dist/turbo.css +727 -0
  125. package/packages/theme-selector/dist/accessibility.d.ts +8 -0
  126. package/packages/theme-selector/dist/accessibility.d.ts.map +1 -0
  127. package/packages/theme-selector/dist/accessibility.js +19 -0
  128. package/packages/theme-selector/dist/accessibility.js.map +1 -0
  129. package/packages/theme-selector/dist/apply-theme.d.ts +12 -0
  130. package/packages/theme-selector/dist/apply-theme.d.ts.map +1 -0
  131. package/packages/theme-selector/dist/apply-theme.js +60 -0
  132. package/packages/theme-selector/dist/apply-theme.js.map +1 -0
  133. package/packages/theme-selector/dist/constants.d.ts +28 -0
  134. package/packages/theme-selector/dist/constants.d.ts.map +1 -0
  135. package/packages/theme-selector/dist/constants.js +29 -0
  136. package/packages/theme-selector/dist/constants.js.map +1 -0
  137. package/packages/theme-selector/dist/dropdown/events.d.ts +9 -0
  138. package/packages/theme-selector/dist/dropdown/events.d.ts.map +1 -0
  139. package/packages/theme-selector/dist/dropdown/events.js +120 -0
  140. package/packages/theme-selector/dist/dropdown/events.js.map +1 -0
  141. package/packages/theme-selector/dist/dropdown/helpers.d.ts +12 -0
  142. package/packages/theme-selector/dist/dropdown/helpers.d.ts.map +1 -0
  143. package/packages/theme-selector/dist/dropdown/helpers.js +25 -0
  144. package/packages/theme-selector/dist/dropdown/helpers.js.map +1 -0
  145. package/packages/theme-selector/dist/dropdown/state.d.ts +26 -0
  146. package/packages/theme-selector/dist/dropdown/state.d.ts.map +1 -0
  147. package/packages/theme-selector/dist/dropdown/state.js +50 -0
  148. package/packages/theme-selector/dist/dropdown/state.js.map +1 -0
  149. package/packages/theme-selector/dist/dropdown/ui.d.ts +46 -0
  150. package/packages/theme-selector/dist/dropdown/ui.d.ts.map +1 -0
  151. package/packages/theme-selector/dist/dropdown/ui.js +179 -0
  152. package/packages/theme-selector/dist/dropdown/ui.js.map +1 -0
  153. package/packages/theme-selector/dist/errors.d.ts +59 -0
  154. package/packages/theme-selector/dist/errors.d.ts.map +1 -0
  155. package/packages/theme-selector/dist/errors.js +127 -0
  156. package/packages/theme-selector/dist/errors.js.map +1 -0
  157. package/packages/theme-selector/dist/index.d.ts +25 -0
  158. package/packages/theme-selector/dist/index.d.ts.map +1 -0
  159. package/packages/theme-selector/dist/index.js +114 -0
  160. package/packages/theme-selector/dist/index.js.map +1 -0
  161. package/packages/theme-selector/dist/navbar.d.ts +13 -0
  162. package/packages/theme-selector/dist/navbar.d.ts.map +1 -0
  163. package/packages/theme-selector/dist/navbar.js +75 -0
  164. package/packages/theme-selector/dist/navbar.js.map +1 -0
  165. package/packages/theme-selector/dist/storage.d.ts +32 -0
  166. package/packages/theme-selector/dist/storage.d.ts.map +1 -0
  167. package/packages/theme-selector/dist/storage.js +100 -0
  168. package/packages/theme-selector/dist/storage.js.map +1 -0
  169. package/packages/theme-selector/dist/theme-loader.d.ts +37 -0
  170. package/packages/theme-selector/dist/theme-loader.d.ts.map +1 -0
  171. package/packages/theme-selector/dist/theme-loader.js +142 -0
  172. package/packages/theme-selector/dist/theme-loader.js.map +1 -0
  173. package/packages/theme-selector/dist/theme-mapper.d.ts +25 -0
  174. package/packages/theme-selector/dist/theme-mapper.d.ts.map +1 -0
  175. package/packages/theme-selector/dist/theme-mapper.js +99 -0
  176. package/packages/theme-selector/dist/theme-mapper.js.map +1 -0
  177. package/packages/theme-selector/dist/theme-resolver.d.ts +50 -0
  178. package/packages/theme-selector/dist/theme-resolver.d.ts.map +1 -0
  179. package/packages/theme-selector/dist/theme-resolver.js +84 -0
  180. package/packages/theme-selector/dist/theme-resolver.js.map +1 -0
  181. package/packages/theme-selector/dist/types.d.ts +7 -0
  182. package/packages/theme-selector/dist/types.d.ts.map +1 -0
  183. package/packages/theme-selector/dist/types.js +6 -0
  184. package/packages/theme-selector/dist/types.js.map +1 -0
@@ -0,0 +1,157 @@
1
+ /* ==========================================================================
2
+ Turbo Themes - Tables
3
+ ========================================================================== */
4
+
5
+ .table {
6
+ width: 100%;
7
+
8
+ /* Use separate + spacing:0 to allow border-radius while removing cell gaps */
9
+ border-collapse: separate;
10
+ border-spacing: 0;
11
+ background: var(--turbo-bg-surface);
12
+ border-radius: var(--radius-lg);
13
+ overflow: hidden;
14
+ box-shadow: var(--shadow-sm);
15
+ }
16
+
17
+ .table thead {
18
+ background: var(--turbo-bg-overlay);
19
+ }
20
+
21
+ .table th {
22
+ padding: var(--space-md) var(--space-lg);
23
+ text-align: left;
24
+ font-weight: 600;
25
+ color: var(--turbo-text-primary);
26
+ border-bottom: 2px solid var(--turbo-border-default);
27
+ }
28
+
29
+ .table td {
30
+ padding: var(--space-md) var(--space-lg);
31
+ border-bottom: 1px solid var(--turbo-border-default);
32
+ color: var(--turbo-text-secondary);
33
+ }
34
+
35
+ .table tr:last-child td {
36
+ border-bottom: none;
37
+ }
38
+
39
+ .table tbody tr {
40
+ transition: background-color var(--transition-fast);
41
+ }
42
+
43
+ .table tbody tr:hover {
44
+ background: color-mix(in srgb, var(--turbo-brand-primary) 5%, transparent);
45
+ }
46
+
47
+ /* Table header color variants */
48
+ .table-header-primary thead {
49
+ background: color-mix(
50
+ in srgb,
51
+ var(--turbo-brand-primary) 15%,
52
+ var(--turbo-bg-surface)
53
+ );
54
+ }
55
+
56
+ .table-header-primary th {
57
+ color: var(--turbo-brand-primary);
58
+ border-bottom-color: var(--turbo-brand-primary);
59
+ }
60
+
61
+ .table-header-info thead {
62
+ background: color-mix(in srgb, var(--turbo-state-info) 15%, var(--turbo-bg-surface));
63
+ }
64
+
65
+ .table-header-info th {
66
+ color: var(--turbo-state-info);
67
+ border-bottom-color: var(--turbo-state-info);
68
+ }
69
+
70
+ .table-header-success thead {
71
+ background: color-mix(
72
+ in srgb,
73
+ var(--turbo-state-success) 15%,
74
+ var(--turbo-bg-surface)
75
+ );
76
+ }
77
+
78
+ .table-header-success th {
79
+ color: var(--turbo-state-success);
80
+ border-bottom-color: var(--turbo-state-success);
81
+ }
82
+
83
+ .table-header-warning thead {
84
+ background: color-mix(
85
+ in srgb,
86
+ var(--turbo-state-warning) 15%,
87
+ var(--turbo-bg-surface)
88
+ );
89
+ }
90
+
91
+ .table-header-warning th {
92
+ color: var(--turbo-state-warning);
93
+ border-bottom-color: var(--turbo-state-warning);
94
+ }
95
+
96
+ .table-header-danger thead {
97
+ background: color-mix(
98
+ in srgb,
99
+ var(--turbo-state-danger) 15%,
100
+ var(--turbo-bg-surface)
101
+ );
102
+ }
103
+
104
+ .table-header-danger th {
105
+ color: var(--turbo-state-danger);
106
+ border-bottom-color: var(--turbo-state-danger);
107
+ }
108
+
109
+ /* Striped table */
110
+ .table-striped tbody tr:nth-child(odd) {
111
+ background: color-mix(in srgb, var(--turbo-bg-overlay) 50%, transparent);
112
+ }
113
+
114
+ .table-striped tbody tr:nth-child(even) {
115
+ background: transparent;
116
+ }
117
+
118
+ /* Accent striped table */
119
+ .table-striped-accent tbody tr:nth-child(odd) {
120
+ background: color-mix(in srgb, var(--turbo-brand-primary) 5%, transparent);
121
+ }
122
+
123
+ .table-striped-accent tbody tr:nth-child(even) {
124
+ background: transparent;
125
+ }
126
+
127
+ .table-striped-accent tbody tr:hover {
128
+ background: color-mix(in srgb, var(--turbo-brand-primary) 10%, transparent);
129
+ }
130
+
131
+ /* Bordered table - use single-direction borders to avoid doubling with border-collapse: separate */
132
+ .table-bordered {
133
+ border: 1px solid var(--turbo-border-default);
134
+ }
135
+
136
+ .table-bordered th,
137
+ .table-bordered td {
138
+ border-bottom: 1px solid var(--turbo-border-default);
139
+ border-right: 1px solid var(--turbo-border-default);
140
+ }
141
+
142
+ /* Remove right border from last column */
143
+ .table-bordered th:last-child,
144
+ .table-bordered td:last-child {
145
+ border-right: none;
146
+ }
147
+
148
+ /* Remove bottom border from last row (already handled by .table tr:last-child td) */
149
+ .table-bordered tr:last-child td {
150
+ border-bottom: none;
151
+ }
152
+
153
+ /* Compact table */
154
+ .table-compact th,
155
+ .table-compact td {
156
+ padding: var(--space-sm) var(--space-md);
157
+ }
@@ -0,0 +1,106 @@
1
+ /* ==========================================================================
2
+ Turbo Themes - Tabs
3
+ ========================================================================== */
4
+
5
+ .tabs {
6
+ display: flex;
7
+ gap: var(--space-xs);
8
+ border-bottom: 2px solid var(--turbo-border-default);
9
+ margin-bottom: var(--space-lg);
10
+ }
11
+
12
+ .tab {
13
+ padding: var(--space-md) var(--space-lg);
14
+ font-weight: 500;
15
+ color: var(--turbo-text-secondary);
16
+ background: none;
17
+ border: none;
18
+ border-bottom: 2px solid transparent;
19
+ margin-bottom: -2px;
20
+ cursor: pointer;
21
+ transition: all var(--transition-fast);
22
+ }
23
+
24
+ .tab:hover:not(:disabled) {
25
+ color: var(--turbo-text-primary);
26
+ }
27
+
28
+ .tab:focus-visible {
29
+ outline: 2px solid var(--turbo-brand-primary);
30
+ outline-offset: 2px;
31
+ }
32
+
33
+ .tab.active {
34
+ color: var(--turbo-brand-primary);
35
+ border-bottom-color: var(--turbo-brand-primary);
36
+ }
37
+
38
+ .tab:disabled {
39
+ opacity: 0.5;
40
+ cursor: not-allowed;
41
+ }
42
+
43
+ /* Tab content panels */
44
+ .tab-content {
45
+ display: none;
46
+ }
47
+
48
+ .tab-content.active {
49
+ display: block;
50
+ }
51
+
52
+ /* Boxed tabs variant */
53
+ .tabs-boxed {
54
+ border-bottom: none;
55
+ background: var(--turbo-bg-overlay);
56
+ border-radius: var(--radius-lg);
57
+ padding: var(--space-xs);
58
+ }
59
+
60
+ .tabs-boxed .tab {
61
+ border-bottom: none;
62
+ border-radius: var(--radius-md);
63
+ margin-bottom: 0;
64
+ }
65
+
66
+ .tabs-boxed .tab.active {
67
+ background: var(--turbo-bg-surface);
68
+ color: var(--turbo-brand-primary);
69
+ box-shadow: var(--shadow-sm);
70
+ }
71
+
72
+ /* Pills tabs variant */
73
+ .tabs-pills {
74
+ border-bottom: none;
75
+ gap: var(--space-sm);
76
+ }
77
+
78
+ .tabs-pills .tab {
79
+ border-bottom: none;
80
+ border-radius: var(--radius-full);
81
+ margin-bottom: 0;
82
+ }
83
+
84
+ .tabs-pills .tab.active {
85
+ background: var(--turbo-brand-primary);
86
+ color: var(--turbo-text-inverse);
87
+ }
88
+
89
+ /* Vertical tabs */
90
+ .tabs-vertical {
91
+ flex-direction: column;
92
+ border-bottom: none;
93
+ border-right: 2px solid var(--turbo-border-default);
94
+ }
95
+
96
+ .tabs-vertical .tab {
97
+ border-bottom: none;
98
+ border-right: 2px solid transparent;
99
+ margin-bottom: 0;
100
+ margin-right: -2px;
101
+ text-align: left;
102
+ }
103
+
104
+ .tabs-vertical .tab.active {
105
+ border-right-color: var(--turbo-brand-primary);
106
+ }
@@ -0,0 +1,121 @@
1
+ /* ==========================================================================
2
+ Turbo Themes - Tags / Badges
3
+ ========================================================================== */
4
+
5
+ .tag {
6
+ display: inline-flex;
7
+ align-items: center;
8
+ padding: var(--space-xs) var(--space-md);
9
+ font-size: 0.8125rem;
10
+ font-weight: 500;
11
+ color: var(--turbo-text-primary);
12
+ background: var(--turbo-bg-overlay);
13
+ border-radius: var(--radius-full);
14
+ transition: all var(--transition-fast);
15
+ }
16
+
17
+ /* Color variants */
18
+ .tag-primary {
19
+ color: var(--turbo-text-inverse);
20
+ background: var(--turbo-brand-primary);
21
+ }
22
+
23
+ .tag-secondary {
24
+ color: var(--turbo-text-primary);
25
+ background: var(--turbo-bg-surface);
26
+ border: 1px solid var(--turbo-border-default);
27
+ }
28
+
29
+ .tag-success {
30
+ color: var(--turbo-bg-base);
31
+ background: var(--turbo-state-success);
32
+ }
33
+
34
+ .tag-warning {
35
+ color: var(--turbo-bg-base);
36
+ background: var(--turbo-state-warning);
37
+ }
38
+
39
+ .tag-danger {
40
+ color: var(--turbo-bg-base);
41
+ background: var(--turbo-state-danger);
42
+ }
43
+
44
+ .tag-info {
45
+ color: var(--turbo-bg-base);
46
+ background: var(--turbo-state-info);
47
+ }
48
+
49
+ /* Outline variants */
50
+ .tag-outline {
51
+ background: transparent;
52
+ border: 1px solid var(--turbo-border-default);
53
+ color: var(--turbo-text-primary);
54
+ }
55
+
56
+ .tag-outline-primary {
57
+ background: transparent;
58
+ border: 1px solid var(--turbo-brand-primary);
59
+ color: var(--turbo-brand-primary);
60
+ }
61
+
62
+ .tag-outline-success {
63
+ background: transparent;
64
+ border: 1px solid var(--turbo-state-success);
65
+ color: var(--turbo-state-success);
66
+ }
67
+
68
+ .tag-outline-warning {
69
+ background: transparent;
70
+ border: 1px solid var(--turbo-state-warning);
71
+ color: var(--turbo-state-warning);
72
+ }
73
+
74
+ .tag-outline-danger {
75
+ background: transparent;
76
+ border: 1px solid var(--turbo-state-danger);
77
+ color: var(--turbo-state-danger);
78
+ }
79
+
80
+ .tag-outline-info {
81
+ background: transparent;
82
+ border: 1px solid var(--turbo-state-info);
83
+ color: var(--turbo-state-info);
84
+ }
85
+
86
+ /* Size variants */
87
+ .tag-sm {
88
+ padding: calc(var(--space-xs) / 2) var(--space-sm);
89
+ font-size: 0.75rem;
90
+ }
91
+
92
+ .tag-lg {
93
+ padding: var(--space-sm) var(--space-lg);
94
+ font-size: 0.9375rem;
95
+ }
96
+
97
+ /* Tag group */
98
+ .tag-group {
99
+ display: flex;
100
+ flex-wrap: wrap;
101
+ gap: var(--space-sm);
102
+ }
103
+
104
+ /* Removable tag */
105
+ .tag-remove {
106
+ margin-left: var(--space-xs);
107
+ cursor: pointer;
108
+ opacity: 0.7;
109
+ transition: opacity var(--transition-fast);
110
+ border-radius: var(--radius-sm);
111
+ }
112
+
113
+ .tag-remove:hover {
114
+ opacity: 1;
115
+ }
116
+
117
+ .tag-remove:focus-visible {
118
+ outline: 2px solid var(--turbo-brand-primary);
119
+ outline-offset: 1px;
120
+ opacity: 1;
121
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * CSS Custom Properties generator for Turbo Themes.
3
+ *
4
+ * Generates framework-agnostic CSS variables from theme tokens.
5
+ * This is the primary output format for platform-agnostic theming.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import type { ThemeFlavor, ThemeTokens } from '@lgtm-hq/turbo-themes-core';
10
+ import { CSS_VAR_PREFIX } from '@lgtm-hq/turbo-themes-core/css/mappings';
11
+ /**
12
+ * Generates CSS custom property declarations from theme tokens.
13
+ * Uses centralized mapping configuration for consistency.
14
+ *
15
+ * @param tokens - The theme tokens to convert
16
+ * @returns Array of CSS variable declaration lines
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const lines = generateCssVarsFromTokens(theme.tokens);
21
+ * // [' --turbo-bg-base: #1e1e2e;', ' --turbo-bg-surface: #313244;', ...]
22
+ * ```
23
+ */
24
+ export declare function generateCssVarsFromTokens(tokens: ThemeTokens): string[];
25
+ /**
26
+ * Generates a complete CSS file for a single theme flavor.
27
+ *
28
+ * @param flavor - The theme flavor to generate CSS for
29
+ * @returns Complete CSS string with data-theme selector
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const css = generateThemeCss(catppuccinMocha);
34
+ * // [data-theme="catppuccin-mocha"] { --turbo-bg-base: #1e1e2e; ... }
35
+ * ```
36
+ */
37
+ export declare function generateThemeCss(flavor: ThemeFlavor): string;
38
+ /**
39
+ * Generates the core CSS file with default variable values.
40
+ *
41
+ * @param defaultFlavor - The theme flavor to use as defaults
42
+ * @returns CSS string with :root selector
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const coreCss = generateCoreCss(catppuccinMocha);
47
+ * // :root { --turbo-bg-base: #1e1e2e; ... }
48
+ * ```
49
+ */
50
+ export declare function generateCoreCss(defaultFlavor: ThemeFlavor): string;
51
+ /**
52
+ * Generates a combined CSS file with all themes.
53
+ *
54
+ * @param flavors - Array of all theme flavors
55
+ * @param defaultFlavorId - ID of the theme to use as :root defaults
56
+ * @returns Complete CSS string with core and all theme selectors
57
+ */
58
+ export declare function generateCombinedCss(flavors: readonly ThemeFlavor[], defaultFlavorId?: string): string;
59
+ export { CSS_VAR_PREFIX };
60
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI3E,OAAO,EAEL,cAAc,EAEf,MAAM,yCAAyC,CAAC;AA0DjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAgGvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAe5D;AA2CD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,WAAW,GAAG,MAAM,CAGlE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,eAAe,GAAE,MAA2B,GAC3C,MAAM,CAUR;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,267 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * CSS Custom Properties generator for Turbo Themes.
4
+ *
5
+ * Generates framework-agnostic CSS variables from theme tokens.
6
+ * This is the primary output format for platform-agnostic theming.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import { generateSyntaxVarsFromTokens } from './syntax.js';
11
+ // Import centralized mappings from config
12
+ import { CORE_MAPPINGS, CSS_VAR_PREFIX, OPTIONAL_GROUPS, } from '@lgtm-hq/turbo-themes-core/css/mappings';
13
+ /**
14
+ * Resolves a dot-separated path to a value in the tokens object.
15
+ *
16
+ * @param tokens - The tokens object to traverse
17
+ * @param path - Dot-separated path (e.g., 'background.base')
18
+ * @returns The resolved value or undefined if path doesn't exist
19
+ */
20
+ function resolveTokenPath(tokens, path) {
21
+ const parts = path.split('.');
22
+ let current = tokens;
23
+ for (const part of parts) {
24
+ if (current === null || current === undefined || typeof current !== 'object') {
25
+ return undefined;
26
+ }
27
+ current = current[part];
28
+ }
29
+ return typeof current === 'string' ? current : undefined;
30
+ }
31
+ /**
32
+ * Trusted font provider domains for web font imports.
33
+ * Only HTTPS URLs from these domains are allowed to prevent CSS injection.
34
+ */
35
+ const TRUSTED_FONT_DOMAINS = [
36
+ 'fonts.googleapis.com',
37
+ 'fonts.gstatic.com',
38
+ 'use.typekit.net',
39
+ 'fonts.bunny.net',
40
+ 'rsms.me', // Inter font
41
+ 'fonts.cdnfonts.com',
42
+ 'github.githubassets.com', // GitHub themes
43
+ ];
44
+ /**
45
+ * Validates that a web font URL is safe to include in CSS.
46
+ * Only allows HTTPS URLs from trusted font provider domains.
47
+ *
48
+ * @param url - The URL to validate
49
+ * @returns true if the URL is from a trusted font provider
50
+ */
51
+ function isValidFontUrl(url) {
52
+ try {
53
+ const parsed = new URL(url);
54
+ if (parsed.protocol !== 'https:') {
55
+ return false;
56
+ }
57
+ return TRUSTED_FONT_DOMAINS.some((domain) => parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`));
58
+ }
59
+ catch {
60
+ return false;
61
+ }
62
+ }
63
+ /**
64
+ * Generates CSS custom property declarations from theme tokens.
65
+ * Uses centralized mapping configuration for consistency.
66
+ *
67
+ * @param tokens - The theme tokens to convert
68
+ * @returns Array of CSS variable declaration lines
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const lines = generateCssVarsFromTokens(theme.tokens);
73
+ * // [' --turbo-bg-base: #1e1e2e;', ' --turbo-bg-surface: #313244;', ...]
74
+ * ```
75
+ */
76
+ export function generateCssVarsFromTokens(tokens) {
77
+ const lines = [];
78
+ const prefix = CSS_VAR_PREFIX;
79
+ const add = (name, value) => {
80
+ lines.push(` --${prefix}-${name}: ${value};`);
81
+ };
82
+ // Apply core mappings from centralized config
83
+ for (const mapping of CORE_MAPPINGS) {
84
+ // Extract variable name from cssVar (remove prefix if present)
85
+ const varName = mapping.cssVar.startsWith('--')
86
+ ? mapping.cssVar.slice(2) // Remove leading --
87
+ : mapping.cssVar;
88
+ let value = resolveTokenPath(tokens, mapping.tokenPath);
89
+ // Try fallback if primary path didn't resolve
90
+ if (value === undefined && mapping.fallbackPath) {
91
+ value = resolveTokenPath(tokens, mapping.fallbackPath);
92
+ }
93
+ if (value !== undefined) {
94
+ add(varName, value);
95
+ }
96
+ }
97
+ // Optional token groups
98
+ const optionalGroups = OPTIONAL_GROUPS;
99
+ // Spacing tokens (if available)
100
+ if (tokens.spacing && optionalGroups.spacing) {
101
+ const { properties } = optionalGroups.spacing;
102
+ for (const prop of properties) {
103
+ const value = tokens.spacing[prop];
104
+ if (value) {
105
+ add(`${optionalGroups.spacing.prefix}-${prop}`, value);
106
+ }
107
+ }
108
+ }
109
+ // Elevation tokens (if available)
110
+ if (tokens.elevation && optionalGroups.elevation) {
111
+ const { properties } = optionalGroups.elevation;
112
+ for (const prop of properties) {
113
+ const value = tokens.elevation[prop];
114
+ if (value) {
115
+ add(`${optionalGroups.elevation.prefix}-${prop}`, value);
116
+ }
117
+ }
118
+ }
119
+ // Animation tokens (if available) - uses custom mappings
120
+ if (tokens.animation && optionalGroups.animation?.mappings) {
121
+ for (const mapping of optionalGroups.animation.mappings) {
122
+ const value = resolveTokenPath(tokens, mapping.tokenPath);
123
+ if (value) {
124
+ add(`${optionalGroups.animation.prefix}-${mapping.cssVar}`, value);
125
+ }
126
+ }
127
+ }
128
+ // Opacity tokens (if available)
129
+ if (tokens.opacity && optionalGroups.opacity) {
130
+ const { properties } = optionalGroups.opacity;
131
+ for (const prop of properties) {
132
+ const value = tokens.opacity[prop];
133
+ if (value !== undefined) {
134
+ add(`${optionalGroups.opacity.prefix}-${prop}`, String(value));
135
+ }
136
+ }
137
+ }
138
+ // Component tokens (if available)
139
+ if (tokens.components) {
140
+ const { components } = tokens;
141
+ if (components.card) {
142
+ if (components.card.bg)
143
+ add('card-bg', components.card.bg);
144
+ if (components.card.border)
145
+ add('card-border', components.card.border);
146
+ }
147
+ if (components.modal) {
148
+ if (components.modal.bg)
149
+ add('modal-bg', components.modal.bg);
150
+ if (components.modal.cardBg)
151
+ add('modal-card-bg', components.modal.cardBg);
152
+ }
153
+ if (components.dropdown) {
154
+ if (components.dropdown.bg)
155
+ add('dropdown-bg', components.dropdown.bg);
156
+ if (components.dropdown.border)
157
+ add('dropdown-border', components.dropdown.border);
158
+ if (components.dropdown.itemHoverBg)
159
+ add('dropdown-item-hover', components.dropdown.itemHoverBg);
160
+ }
161
+ }
162
+ // Syntax highlighting tokens
163
+ const syntaxLines = generateSyntaxVarsFromTokens(tokens);
164
+ lines.push(...syntaxLines);
165
+ return lines;
166
+ }
167
+ /**
168
+ * Generates a complete CSS file for a single theme flavor.
169
+ *
170
+ * @param flavor - The theme flavor to generate CSS for
171
+ * @returns Complete CSS string with data-theme selector
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const css = generateThemeCss(catppuccinMocha);
176
+ * // [data-theme="catppuccin-mocha"] { --turbo-bg-base: #1e1e2e; ... }
177
+ * ```
178
+ */
179
+ export function generateThemeCss(flavor) {
180
+ const vars = generateCssVarsFromTokens(flavor.tokens);
181
+ const webFonts = flavor.tokens.typography?.webFonts ?? [];
182
+ const fontImports = webFonts
183
+ .filter(isValidFontUrl)
184
+ .map((url) => `@import url('${url}');`)
185
+ .join('\n');
186
+ const colorScheme = flavor.appearance === 'dark' ? 'dark' : 'light';
187
+ const cssContent = `[data-theme="${flavor.id}"] {
188
+ ${vars.join('\n')}
189
+ color-scheme: ${colorScheme};
190
+ }`;
191
+ return fontImports ? `${fontImports}\n\n${cssContent}\n` : `${cssContent}\n`;
192
+ }
193
+ /**
194
+ * Design system tokens that are theme-agnostic.
195
+ * These provide spacing, shadows, radius, and transitions for components.
196
+ */
197
+ const DESIGN_SYSTEM_TOKENS = `
198
+ /* Spacing */
199
+ --space-xs: 0.25rem;
200
+ --space-sm: 0.5rem;
201
+ --space-md: 1rem;
202
+ --space-lg: 1.5rem;
203
+ --space-xl: 2rem;
204
+ --space-2xl: 3rem;
205
+ --space-3xl: 4rem;
206
+ --space-4xl: 6rem;
207
+
208
+ /* Border Radius */
209
+ --radius-sm: 0.5rem;
210
+ --radius-md: 0.75rem;
211
+ --radius-lg: 1rem;
212
+ --radius-xl: 1.5rem;
213
+ --radius-2xl: 2rem;
214
+ --radius-full: 9999px;
215
+
216
+ /* Shadows */
217
+ --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
218
+ --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
219
+ --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
220
+ --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.04);
221
+ --shadow-glow: 0 0 30px color-mix(in srgb, var(--turbo-brand-primary) 30%, transparent);
222
+ --shadow-glow-sm: 0 0 15px color-mix(in srgb, var(--turbo-brand-primary) 20%, transparent);
223
+
224
+ /* Transitions */
225
+ --transition-fast: 120ms ease-out;
226
+ --transition-normal: 200ms ease-out;
227
+ --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
228
+
229
+ /* Gradients (theme-aware) */
230
+ --gradient-primary: linear-gradient(135deg, var(--turbo-brand-primary), var(--turbo-state-info));
231
+ --gradient-surface: linear-gradient(180deg, var(--turbo-bg-surface), var(--turbo-bg-base));
232
+ `;
233
+ /**
234
+ * Generates the core CSS file with default variable values.
235
+ *
236
+ * @param defaultFlavor - The theme flavor to use as defaults
237
+ * @returns CSS string with :root selector
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * const coreCss = generateCoreCss(catppuccinMocha);
242
+ * // :root { --turbo-bg-base: #1e1e2e; ... }
243
+ * ```
244
+ */
245
+ export function generateCoreCss(defaultFlavor) {
246
+ const vars = generateCssVarsFromTokens(defaultFlavor.tokens);
247
+ return `:root {\n${vars.join('\n')}\n${DESIGN_SYSTEM_TOKENS}}\n`;
248
+ }
249
+ /**
250
+ * Generates a combined CSS file with all themes.
251
+ *
252
+ * @param flavors - Array of all theme flavors
253
+ * @param defaultFlavorId - ID of the theme to use as :root defaults
254
+ * @returns Complete CSS string with core and all theme selectors
255
+ */
256
+ export function generateCombinedCss(flavors, defaultFlavorId = 'catppuccin-mocha') {
257
+ const defaultFlavor = flavors.find((f) => f.id === defaultFlavorId) || flavors[0];
258
+ if (!defaultFlavor) {
259
+ throw new Error('No flavors provided');
260
+ }
261
+ const coreCss = generateCoreCss(defaultFlavor);
262
+ const themeCss = flavors.map((flavor) => generateThemeCss(flavor)).join('\n');
263
+ return `/* Turbo Themes - Pure CSS Custom Properties */\n/* Generated automatically - do not edit */\n\n${coreCss}\n${themeCss}`;
264
+ }
265
+ // Re-export the prefix for external use
266
+ export { CSS_VAR_PREFIX };
267
+ //# sourceMappingURL=generator.js.map