juxscript 1.0.20 → 1.0.21

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 (76) hide show
  1. package/bin/cli.js +121 -72
  2. package/lib/components/alert.ts +143 -92
  3. package/lib/components/badge.ts +93 -94
  4. package/lib/components/base/BaseComponent.ts +397 -0
  5. package/lib/components/base/FormInput.ts +322 -0
  6. package/lib/components/button.ts +40 -131
  7. package/lib/components/card.ts +57 -79
  8. package/lib/components/charts/areachart.ts +315 -0
  9. package/lib/components/charts/barchart.ts +421 -0
  10. package/lib/components/charts/doughnutchart.ts +263 -0
  11. package/lib/components/charts/lib/BaseChart.ts +402 -0
  12. package/lib/components/{chart-types.ts → charts/lib/chart-types.ts} +1 -1
  13. package/lib/components/{chart-utils.ts → charts/lib/chart-utils.ts} +1 -1
  14. package/lib/components/{chart.ts → charts/lib/chart.ts} +3 -3
  15. package/lib/components/checkbox.ts +255 -204
  16. package/lib/components/code.ts +31 -78
  17. package/lib/components/container.ts +113 -130
  18. package/lib/components/data.ts +37 -5
  19. package/lib/components/datepicker.ts +180 -147
  20. package/lib/components/dialog.ts +218 -221
  21. package/lib/components/divider.ts +63 -87
  22. package/lib/components/docs-data.json +498 -2404
  23. package/lib/components/dropdown.ts +191 -236
  24. package/lib/components/element.ts +196 -145
  25. package/lib/components/fileupload.ts +253 -167
  26. package/lib/components/guard.ts +92 -0
  27. package/lib/components/heading.ts +31 -97
  28. package/lib/components/helpers.ts +13 -6
  29. package/lib/components/hero.ts +51 -114
  30. package/lib/components/icon.ts +33 -120
  31. package/lib/components/icons.ts +2 -1
  32. package/lib/components/include.ts +76 -3
  33. package/lib/components/input.ts +155 -407
  34. package/lib/components/kpicard.ts +16 -16
  35. package/lib/components/list.ts +358 -261
  36. package/lib/components/loading.ts +142 -211
  37. package/lib/components/menu.ts +63 -152
  38. package/lib/components/modal.ts +42 -129
  39. package/lib/components/nav.ts +79 -101
  40. package/lib/components/paragraph.ts +38 -102
  41. package/lib/components/progress.ts +108 -166
  42. package/lib/components/radio.ts +283 -234
  43. package/lib/components/script.ts +19 -87
  44. package/lib/components/select.ts +189 -199
  45. package/lib/components/sidebar.ts +110 -141
  46. package/lib/components/style.ts +19 -82
  47. package/lib/components/switch.ts +254 -183
  48. package/lib/components/table.ts +1078 -208
  49. package/lib/components/tabs.ts +42 -106
  50. package/lib/components/theme-toggle.ts +73 -165
  51. package/lib/components/tooltip.ts +85 -316
  52. package/lib/components/write.ts +108 -127
  53. package/lib/jux.ts +67 -41
  54. package/machinery/build.js +466 -0
  55. package/machinery/compiler.js +354 -105
  56. package/machinery/server.js +23 -100
  57. package/machinery/watcher.js +153 -130
  58. package/package.json +1 -1
  59. package/presets/base.css +1166 -0
  60. package/presets/notion.css +2 -1975
  61. package/lib/adapters/base-adapter.js +0 -35
  62. package/lib/adapters/index.js +0 -33
  63. package/lib/adapters/mysql-adapter.js +0 -65
  64. package/lib/adapters/postgres-adapter.js +0 -70
  65. package/lib/adapters/sqlite-adapter.js +0 -56
  66. package/lib/components/areachart.ts +0 -1128
  67. package/lib/components/areachartsmooth.ts +0 -1380
  68. package/lib/components/barchart.ts +0 -1322
  69. package/lib/components/doughnutchart.ts +0 -1259
  70. package/lib/components/footer.ts +0 -165
  71. package/lib/components/header.ts +0 -187
  72. package/lib/components/layout.ts +0 -239
  73. package/lib/components/main.ts +0 -137
  74. package/lib/layouts/default.jux +0 -8
  75. package/lib/layouts/figma.jux +0 -0
  76. /package/lib/{themes → components/charts/lib}/charts.js +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  notionTheme,
8
8
  chalkTheme,
9
9
  mintTheme
10
- } from '../themes/charts.js';
10
+ } from './charts/lib/charts.js';
11
11
 
12
12
  /**
13
13
  * KPI card options
@@ -67,7 +67,7 @@ export class KPICard {
67
67
  private _id: string;
68
68
  private _element?: HTMLElement;
69
69
  private _container?: string;
70
-
70
+
71
71
  public state: KPICardState = {
72
72
  title: 'KPI',
73
73
  value: 0,
@@ -94,7 +94,7 @@ export class KPICard {
94
94
 
95
95
  constructor(id: string, options: KPICardOptions = {}) {
96
96
  this._id = id;
97
-
97
+
98
98
  // Apply options
99
99
  if (options.title !== undefined) this.state.title = options.title;
100
100
  if (options.value !== undefined) this.state.value = options.value;
@@ -254,7 +254,7 @@ export class KPICard {
254
254
 
255
255
  private _updateCard(): void {
256
256
  if (!this._container) return;
257
-
257
+
258
258
  const element = document.querySelector(this._container);
259
259
  if (!element) return;
260
260
 
@@ -269,7 +269,7 @@ export class KPICard {
269
269
 
270
270
  private _loadThemeFont(): void {
271
271
  const themeConfig = this._getThemeConfig();
272
-
272
+
273
273
  if (themeConfig.font && !document.querySelector(`link[href="${themeConfig.font}"]`)) {
274
274
  const link = document.createElement('link');
275
275
  link.rel = 'stylesheet';
@@ -303,7 +303,7 @@ export class KPICard {
303
303
  wrapper.style.opacity = '0';
304
304
  wrapper.style.transform = 'translateY(20px)';
305
305
  wrapper.style.transition = `opacity ${animationDuration}ms ease-out, transform ${animationDuration}ms ease-out`;
306
-
306
+
307
307
  requestAnimationFrame(() => {
308
308
  setTimeout(() => {
309
309
  wrapper.style.opacity = '1';
@@ -342,7 +342,7 @@ export class KPICard {
342
342
  const titleEl = document.createElement('div');
343
343
  titleEl.className = 'jux-kpicard-title';
344
344
  titleEl.textContent = title;
345
-
345
+
346
346
  // Smart color selection based on theme
347
347
  let titleColor = '#6b7280'; // default light mode
348
348
  if (styleMode === 'gradient') {
@@ -350,7 +350,7 @@ export class KPICard {
350
350
  } else if (styleMode === 'glass') {
351
351
  titleColor = 'rgba(31, 41, 55, 0.9)'; // dark text for glass effect
352
352
  }
353
-
353
+
354
354
  titleEl.style.cssText = `
355
355
  font-size: ${16 * scaleFactor}px;
356
356
  font-weight: 500;
@@ -372,7 +372,7 @@ export class KPICard {
372
372
  const valueEl = document.createElement('div');
373
373
  valueEl.className = 'jux-kpicard-value';
374
374
  valueEl.textContent = `${prefix}${value}${suffix}`;
375
-
375
+
376
376
  // Smart color selection for value
377
377
  let valueColor = '#1f2937'; // default dark
378
378
  if (styleMode === 'gradient') {
@@ -380,7 +380,7 @@ export class KPICard {
380
380
  } else if (styleMode === 'glass') {
381
381
  valueColor = '#111827'; // very dark for glass
382
382
  }
383
-
383
+
384
384
  valueEl.style.cssText = `
385
385
  font-size: ${56 * scaleFactor}px;
386
386
  font-weight: 800;
@@ -394,7 +394,7 @@ export class KPICard {
394
394
  valueEl.style.opacity = '0';
395
395
  valueEl.style.transform = 'scale(0.8)';
396
396
  valueEl.style.transition = `opacity ${animationDuration}ms ease-out ${animationDuration / 2}ms, transform ${animationDuration}ms cubic-bezier(0.34, 1.56, 0.64, 1) ${animationDuration / 2}ms`;
397
-
397
+
398
398
  requestAnimationFrame(() => {
399
399
  setTimeout(() => {
400
400
  valueEl.style.opacity = '1';
@@ -423,7 +423,7 @@ export class KPICard {
423
423
  // Delta text with smart coloring
424
424
  const deltaText = document.createElement('span');
425
425
  deltaText.textContent = `${delta > 0 ? '+' : ''}${delta}%`;
426
-
426
+
427
427
  let deltaColor;
428
428
  if (styleMode === 'gradient') {
429
429
  deltaColor = delta > 0 ? 'rgba(255, 255, 255, 0.95)' : 'rgba(255, 200, 200, 0.95)';
@@ -432,7 +432,7 @@ export class KPICard {
432
432
  } else {
433
433
  deltaColor = delta > 0 ? '#10b981' : '#ef4444';
434
434
  }
435
-
435
+
436
436
  deltaText.style.cssText = `
437
437
  font-size: ${18 * scaleFactor}px;
438
438
  font-weight: 700;
@@ -444,7 +444,7 @@ export class KPICard {
444
444
  deltaContainer.style.opacity = '0';
445
445
  deltaContainer.style.transform = 'translateX(-10px)';
446
446
  deltaContainer.style.transition = `opacity ${animationDuration}ms ease-out ${animationDuration}ms, transform ${animationDuration}ms ease-out ${animationDuration}ms`;
447
-
447
+
448
448
  requestAnimationFrame(() => {
449
449
  setTimeout(() => {
450
450
  deltaContainer.style.opacity = '1';
@@ -473,7 +473,7 @@ export class KPICard {
473
473
  svg.setAttribute('fill', 'none');
474
474
  svg.style.flexShrink = '0';
475
475
 
476
- const color = isGradientMode
476
+ const color = isGradientMode
477
477
  ? (isUp ? 'rgba(255, 255, 255, 0.9)' : 'rgba(255, 200, 200, 0.9)')
478
478
  : (isUp ? '#10b981' : '#ef4444');
479
479
 
@@ -542,7 +542,7 @@ export class KPICard {
542
542
 
543
543
  private _getThemeConfig() {
544
544
  const { theme } = this.state;
545
-
545
+
546
546
  switch (theme) {
547
547
  case 'google':
548
548
  return googleTheme;