shru-design-system 0.1.5 → 0.1.6

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.
@@ -54,8 +54,20 @@
54
54
  var xhr = new XMLHttpRequest();
55
55
  xhr.open('GET', path, false);
56
56
  xhr.send(null);
57
+
58
+ // 404 means file doesn't exist - return null
59
+ if (xhr.status === 404) {
60
+ return null;
61
+ }
62
+
57
63
  if (xhr.status === 200 || xhr.status === 0) {
58
- return JSON.parse(xhr.responseText);
64
+ var contentType = xhr.getResponseHeader('content-type');
65
+ // Check if response is actually JSON (not HTML error page)
66
+ if (contentType && contentType.includes('application/json')) {
67
+ return JSON.parse(xhr.responseText);
68
+ }
69
+ // If not JSON (likely HTML error page), return null
70
+ return null;
59
71
  }
60
72
  } catch (e) {}
61
73
  return null;
@@ -170,24 +182,26 @@
170
182
  }
171
183
 
172
184
  function mapToTailwindVars(cssVars) {
185
+ // Start with all generated variables - they're all valid CSS variables
173
186
  var mapped = {};
174
187
  for (var key in cssVars) mapped[key] = cssVars[key];
175
- if (cssVars['--radius-button']) mapped['--radius'] = cssVars['--radius-button'];
176
- if (cssVars['--radius-card']) mapped['--radius-lg'] = cssVars['--radius-card'];
177
- if (cssVars['--font-body']) mapped['--font-sans'] = cssVars['--font-body'];
178
- if (cssVars['--spacing-base']) {
188
+
189
+ // Only add convenience mappings for Tailwind's expected variable names
190
+ if (cssVars['--radius-button'] && !cssVars['--radius']) {
191
+ mapped['--radius'] = cssVars['--radius-button'];
192
+ }
193
+ if (cssVars['--radius-card'] && !cssVars['--radius-lg']) {
194
+ mapped['--radius-lg'] = cssVars['--radius-card'];
195
+ }
196
+ if (cssVars['--font-body'] && !cssVars['--font-sans']) {
197
+ mapped['--font-sans'] = cssVars['--font-body'];
198
+ }
199
+ if (cssVars['--spacing-base'] && !cssVars['--spacing']) {
179
200
  mapped['--spacing'] = cssVars['--spacing-base'];
180
- } else if (cssVars['--spacing-component-md']) {
201
+ } else if (cssVars['--spacing-component-md'] && !cssVars['--spacing']) {
181
202
  mapped['--spacing'] = cssVars['--spacing-component-md'];
182
203
  }
183
- if (cssVars['--spacing-component-xs']) mapped['--spacing-component-xs'] = cssVars['--spacing-component-xs'];
184
- if (cssVars['--spacing-component-sm']) mapped['--spacing-component-sm'] = cssVars['--spacing-component-sm'];
185
- if (cssVars['--spacing-component-md']) mapped['--spacing-component-md'] = cssVars['--spacing-component-md'];
186
- if (cssVars['--spacing-component-lg']) mapped['--spacing-component-lg'] = cssVars['--spacing-component-lg'];
187
- if (cssVars['--spacing-component-xl']) mapped['--spacing-component-xl'] = cssVars['--spacing-component-xl'];
188
- if (cssVars['--duration-fast']) mapped['--duration-fast'] = cssVars['--duration-fast'];
189
- if (cssVars['--duration-normal']) mapped['--duration-normal'] = cssVars['--duration-normal'];
190
- if (cssVars['--duration-slow']) mapped['--duration-slow'] = cssVars['--duration-slow'];
204
+
191
205
  return mapped;
192
206
  }
193
207