juxscript 1.0.19 → 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.
- package/bin/cli.js +121 -72
- package/lib/components/alert.ts +212 -165
- package/lib/components/badge.ts +93 -103
- package/lib/components/base/BaseComponent.ts +397 -0
- package/lib/components/base/FormInput.ts +322 -0
- package/lib/components/button.ts +63 -122
- package/lib/components/card.ts +109 -155
- package/lib/components/charts/areachart.ts +315 -0
- package/lib/components/charts/barchart.ts +421 -0
- package/lib/components/charts/doughnutchart.ts +263 -0
- package/lib/components/charts/lib/BaseChart.ts +402 -0
- package/lib/components/charts/lib/chart-types.ts +159 -0
- package/lib/components/charts/lib/chart-utils.ts +160 -0
- package/lib/components/charts/lib/chart.ts +707 -0
- package/lib/components/checkbox.ts +264 -127
- package/lib/components/code.ts +75 -108
- package/lib/components/container.ts +113 -130
- package/lib/components/data.ts +37 -5
- package/lib/components/datepicker.ts +195 -147
- package/lib/components/dialog.ts +187 -157
- package/lib/components/divider.ts +85 -191
- package/lib/components/docs-data.json +544 -2027
- package/lib/components/dropdown.ts +178 -136
- package/lib/components/element.ts +227 -171
- package/lib/components/fileupload.ts +285 -228
- package/lib/components/guard.ts +92 -0
- package/lib/components/heading.ts +46 -69
- package/lib/components/helpers.ts +13 -6
- package/lib/components/hero.ts +107 -95
- package/lib/components/icon.ts +160 -0
- package/lib/components/icons.ts +175 -0
- package/lib/components/include.ts +153 -5
- package/lib/components/input.ts +174 -374
- package/lib/components/kpicard.ts +16 -16
- package/lib/components/list.ts +378 -240
- package/lib/components/loading.ts +142 -211
- package/lib/components/menu.ts +103 -97
- package/lib/components/modal.ts +138 -144
- package/lib/components/nav.ts +169 -90
- package/lib/components/paragraph.ts +49 -150
- package/lib/components/progress.ts +118 -200
- package/lib/components/radio.ts +297 -149
- package/lib/components/script.ts +19 -87
- package/lib/components/select.ts +184 -186
- package/lib/components/sidebar.ts +152 -140
- package/lib/components/style.ts +19 -82
- package/lib/components/switch.ts +258 -188
- package/lib/components/table.ts +1117 -170
- package/lib/components/tabs.ts +162 -145
- package/lib/components/theme-toggle.ts +108 -169
- package/lib/components/tooltip.ts +86 -157
- package/lib/components/write.ts +108 -127
- package/lib/jux.ts +86 -41
- package/machinery/build.js +466 -0
- package/machinery/compiler.js +354 -105
- package/machinery/server.js +23 -100
- package/machinery/watcher.js +153 -130
- package/package.json +1 -2
- package/presets/base.css +1166 -0
- package/presets/notion.css +2 -1975
- package/lib/adapters/base-adapter.js +0 -35
- package/lib/adapters/index.js +0 -33
- package/lib/adapters/mysql-adapter.js +0 -65
- package/lib/adapters/postgres-adapter.js +0 -70
- package/lib/adapters/sqlite-adapter.js +0 -56
- package/lib/components/areachart.ts +0 -1246
- package/lib/components/areachartsmooth.ts +0 -1380
- package/lib/components/barchart.ts +0 -1250
- package/lib/components/chart.ts +0 -127
- package/lib/components/doughnutchart.ts +0 -1191
- package/lib/components/footer.ts +0 -165
- package/lib/components/header.ts +0 -187
- package/lib/components/layout.ts +0 -239
- package/lib/components/main.ts +0 -137
- package/lib/layouts/default.jux +0 -8
- package/lib/layouts/figma.jux +0 -0
- /package/lib/{themes → components/charts/lib}/charts.js +0 -0
package/lib/components/chart.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { getOrCreateContainer } from './helpers.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Chart component options
|
|
5
|
-
*/
|
|
6
|
-
export interface ChartOptions {
|
|
7
|
-
type?: 'bar' | 'line' | 'pie' | 'doughnut';
|
|
8
|
-
data?: any;
|
|
9
|
-
options?: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Chart component state
|
|
14
|
-
*/
|
|
15
|
-
type ChartState = {
|
|
16
|
-
type: string;
|
|
17
|
-
data: any;
|
|
18
|
-
options: any;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Chart component - placeholder for chart integration
|
|
23
|
-
*
|
|
24
|
-
* Usage:
|
|
25
|
-
* const chart = jux.chart('myChart', {
|
|
26
|
-
* type: 'bar',
|
|
27
|
-
* data: {
|
|
28
|
-
* labels: ['A', 'B', 'C'],
|
|
29
|
-
* datasets: [{ data: [10, 20, 30] }]
|
|
30
|
-
* }
|
|
31
|
-
* });
|
|
32
|
-
* chart.render();
|
|
33
|
-
*/
|
|
34
|
-
export class Chart {
|
|
35
|
-
state: ChartState;
|
|
36
|
-
container: HTMLElement | null = null;
|
|
37
|
-
_id: string;
|
|
38
|
-
id: string;
|
|
39
|
-
|
|
40
|
-
constructor(id: string, options: ChartOptions = {}) {
|
|
41
|
-
this._id = id;
|
|
42
|
-
this.id = id;
|
|
43
|
-
|
|
44
|
-
this.state = {
|
|
45
|
-
type: options.type ?? 'bar',
|
|
46
|
-
data: options.data ?? {},
|
|
47
|
-
options: options.options ?? {}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* -------------------------
|
|
52
|
-
* Fluent API
|
|
53
|
-
* ------------------------- */
|
|
54
|
-
|
|
55
|
-
type(value: string): this {
|
|
56
|
-
this.state.type = value;
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
data(value: any): this {
|
|
61
|
-
this.state.data = value;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
options(value: any): this {
|
|
66
|
-
this.state.options = value;
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/* -------------------------
|
|
71
|
-
* Render
|
|
72
|
-
* ------------------------- */
|
|
73
|
-
|
|
74
|
-
render(targetId?: string): this {
|
|
75
|
-
let container: HTMLElement;
|
|
76
|
-
|
|
77
|
-
if (targetId) {
|
|
78
|
-
const target = document.querySelector(targetId);
|
|
79
|
-
if (!target || !(target instanceof HTMLElement)) {
|
|
80
|
-
throw new Error(`Chart: Target element "${targetId}" not found`);
|
|
81
|
-
}
|
|
82
|
-
container = target;
|
|
83
|
-
} else {
|
|
84
|
-
container = getOrCreateContainer(this._id);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this.container = container;
|
|
88
|
-
const { type, data } = this.state;
|
|
89
|
-
|
|
90
|
-
const canvas = document.createElement('canvas');
|
|
91
|
-
canvas.id = this._id;
|
|
92
|
-
canvas.className = 'jux-chart';
|
|
93
|
-
|
|
94
|
-
// Placeholder rendering (would integrate with Chart.js or similar)
|
|
95
|
-
const placeholder = document.createElement('div');
|
|
96
|
-
placeholder.className = 'jux-chart-placeholder';
|
|
97
|
-
placeholder.textContent = `Chart (${type}) - Integration pending`;
|
|
98
|
-
placeholder.style.cssText = 'padding: 2rem; border: 2px dashed var(--border-color); text-align: center;';
|
|
99
|
-
|
|
100
|
-
container.appendChild(placeholder);
|
|
101
|
-
container.appendChild(canvas);
|
|
102
|
-
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Render to another Jux component's container
|
|
108
|
-
*/
|
|
109
|
-
renderTo(juxComponent: any): this {
|
|
110
|
-
if (!juxComponent || typeof juxComponent !== 'object') {
|
|
111
|
-
throw new Error('Chart.renderTo: Invalid component - not an object');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (!juxComponent._id || typeof juxComponent._id !== 'string') {
|
|
115
|
-
throw new Error('Chart.renderTo: Invalid component - missing _id (not a Jux component)');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return this.render(`#${juxComponent._id}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Factory helper
|
|
124
|
-
*/
|
|
125
|
-
export function chart(id: string, options: ChartOptions = {}): Chart {
|
|
126
|
-
return new Chart(id, options);
|
|
127
|
-
}
|