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.
- package/bin/cli.js +121 -72
- package/lib/components/alert.ts +143 -92
- package/lib/components/badge.ts +93 -94
- package/lib/components/base/BaseComponent.ts +397 -0
- package/lib/components/base/FormInput.ts +322 -0
- package/lib/components/button.ts +40 -131
- package/lib/components/card.ts +57 -79
- 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/{chart-types.ts → charts/lib/chart-types.ts} +1 -1
- package/lib/components/{chart-utils.ts → charts/lib/chart-utils.ts} +1 -1
- package/lib/components/{chart.ts → charts/lib/chart.ts} +3 -3
- package/lib/components/checkbox.ts +255 -204
- package/lib/components/code.ts +31 -78
- package/lib/components/container.ts +113 -130
- package/lib/components/data.ts +37 -5
- package/lib/components/datepicker.ts +180 -147
- package/lib/components/dialog.ts +218 -221
- package/lib/components/divider.ts +63 -87
- package/lib/components/docs-data.json +498 -2404
- package/lib/components/dropdown.ts +191 -236
- package/lib/components/element.ts +196 -145
- package/lib/components/fileupload.ts +253 -167
- package/lib/components/guard.ts +92 -0
- package/lib/components/heading.ts +31 -97
- package/lib/components/helpers.ts +13 -6
- package/lib/components/hero.ts +51 -114
- package/lib/components/icon.ts +33 -120
- package/lib/components/icons.ts +2 -1
- package/lib/components/include.ts +76 -3
- package/lib/components/input.ts +155 -407
- package/lib/components/kpicard.ts +16 -16
- package/lib/components/list.ts +358 -261
- package/lib/components/loading.ts +142 -211
- package/lib/components/menu.ts +63 -152
- package/lib/components/modal.ts +42 -129
- package/lib/components/nav.ts +79 -101
- package/lib/components/paragraph.ts +38 -102
- package/lib/components/progress.ts +108 -166
- package/lib/components/radio.ts +283 -234
- package/lib/components/script.ts +19 -87
- package/lib/components/select.ts +189 -199
- package/lib/components/sidebar.ts +110 -141
- package/lib/components/style.ts +19 -82
- package/lib/components/switch.ts +254 -183
- package/lib/components/table.ts +1078 -208
- package/lib/components/tabs.ts +42 -106
- package/lib/components/theme-toggle.ts +73 -165
- package/lib/components/tooltip.ts +85 -316
- package/lib/components/write.ts +108 -127
- package/lib/jux.ts +67 -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 -1
- 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 -1128
- package/lib/components/areachartsmooth.ts +0 -1380
- package/lib/components/barchart.ts +0 -1322
- package/lib/components/doughnutchart.ts +0 -1259
- 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
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base adapter interface that all database adapters must implement
|
|
3
|
-
*/
|
|
4
|
-
class BaseAdapter {
|
|
5
|
-
constructor(config) {
|
|
6
|
-
this.config = config;
|
|
7
|
-
this.connection = null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async connect() {
|
|
11
|
-
throw new Error('connect() must be implemented');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async disconnect() {
|
|
15
|
-
throw new Error('disconnect() must be implemented');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async query(sql, params = []) {
|
|
19
|
-
throw new Error('query() must be implemented');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async execute(sql, params = []) {
|
|
23
|
-
throw new Error('execute() must be implemented');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async transaction(callback) {
|
|
27
|
-
throw new Error('transaction() must be implemented');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
escape(value) {
|
|
31
|
-
throw new Error('escape() must be implemented');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = { BaseAdapter };
|
package/lib/adapters/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const { SQLiteAdapter } = require('./sqlite-adapter');
|
|
2
|
-
const { MySQLAdapter } = require('./mysql-adapter');
|
|
3
|
-
const { PostgresAdapter } = require('./postgres-adapter');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Adapter factory - creates the appropriate adapter based on config
|
|
7
|
-
*/
|
|
8
|
-
function createAdapter(type, config) {
|
|
9
|
-
switch (type.toLowerCase()) {
|
|
10
|
-
case 'sqlite':
|
|
11
|
-
case 'sqlite3':
|
|
12
|
-
return new SQLiteAdapter(config);
|
|
13
|
-
|
|
14
|
-
case 'mysql':
|
|
15
|
-
case 'mariadb':
|
|
16
|
-
return new MySQLAdapter(config);
|
|
17
|
-
|
|
18
|
-
case 'postgres':
|
|
19
|
-
case 'postgresql':
|
|
20
|
-
case 'pg':
|
|
21
|
-
return new PostgresAdapter(config);
|
|
22
|
-
|
|
23
|
-
default:
|
|
24
|
-
throw new Error(`Unsupported database type: ${type}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = {
|
|
29
|
-
createAdapter,
|
|
30
|
-
SQLiteAdapter,
|
|
31
|
-
MySQLAdapter,
|
|
32
|
-
PostgresAdapter
|
|
33
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const { BaseAdapter } = require('./base-adapter');
|
|
2
|
-
const mysql = require('mysql2/promise');
|
|
3
|
-
|
|
4
|
-
class MySQLAdapter extends BaseAdapter {
|
|
5
|
-
async connect() {
|
|
6
|
-
this.connection = await mysql.createConnection({
|
|
7
|
-
host: this.config.host || 'localhost',
|
|
8
|
-
port: this.config.port || 3306,
|
|
9
|
-
user: this.config.user,
|
|
10
|
-
password: this.config.password,
|
|
11
|
-
database: this.config.database
|
|
12
|
-
});
|
|
13
|
-
return this.connection;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async disconnect() {
|
|
17
|
-
if (this.connection) {
|
|
18
|
-
await this.connection.end();
|
|
19
|
-
this.connection = null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async query(sql, params = []) {
|
|
24
|
-
if (!this.connection) await this.connect();
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const [rows] = await this.connection.execute(sql, params);
|
|
28
|
-
return { data: rows, rowCount: rows.length };
|
|
29
|
-
} catch (error) {
|
|
30
|
-
throw new Error(`MySQL query error: ${error.message}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async execute(sql, params = []) {
|
|
35
|
-
if (!this.connection) await this.connect();
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const [result] = await this.connection.execute(sql, params);
|
|
39
|
-
return {
|
|
40
|
-
rowCount: result.affectedRows,
|
|
41
|
-
lastInsertId: result.insertId
|
|
42
|
-
};
|
|
43
|
-
} catch (error) {
|
|
44
|
-
throw new Error(`MySQL execute error: ${error.message}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async transaction(callback) {
|
|
49
|
-
await this.connection.beginTransaction();
|
|
50
|
-
try {
|
|
51
|
-
const result = await callback(this);
|
|
52
|
-
await this.connection.commit();
|
|
53
|
-
return result;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
await this.connection.rollback();
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
escape(value) {
|
|
61
|
-
return mysql.escape(value);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
module.exports = { MySQLAdapter };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const { BaseAdapter } = require('./base-adapter');
|
|
2
|
-
const { Pool } = require('pg');
|
|
3
|
-
|
|
4
|
-
class PostgresAdapter extends BaseAdapter {
|
|
5
|
-
async connect() {
|
|
6
|
-
this.connection = new Pool({
|
|
7
|
-
host: this.config.host || 'localhost',
|
|
8
|
-
port: this.config.port || 5432,
|
|
9
|
-
user: this.config.user,
|
|
10
|
-
password: this.config.password,
|
|
11
|
-
database: this.config.database
|
|
12
|
-
});
|
|
13
|
-
return this.connection;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async disconnect() {
|
|
17
|
-
if (this.connection) {
|
|
18
|
-
await this.connection.end();
|
|
19
|
-
this.connection = null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async query(sql, params = []) {
|
|
24
|
-
if (!this.connection) await this.connect();
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const result = await this.connection.query(sql, params);
|
|
28
|
-
return { data: result.rows, rowCount: result.rowCount };
|
|
29
|
-
} catch (error) {
|
|
30
|
-
throw new Error(`Postgres query error: ${error.message}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async execute(sql, params = []) {
|
|
35
|
-
if (!this.connection) await this.connect();
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const result = await this.connection.query(sql, params);
|
|
39
|
-
return {
|
|
40
|
-
rowCount: result.rowCount,
|
|
41
|
-
lastInsertId: result.rows[0]?.id
|
|
42
|
-
};
|
|
43
|
-
} catch (error) {
|
|
44
|
-
throw new Error(`Postgres execute error: ${error.message}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async transaction(callback) {
|
|
49
|
-
const client = await this.connection.connect();
|
|
50
|
-
try {
|
|
51
|
-
await client.query('BEGIN');
|
|
52
|
-
const result = await callback(this);
|
|
53
|
-
await client.query('COMMIT');
|
|
54
|
-
return result;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
await client.query('ROLLBACK');
|
|
57
|
-
throw error;
|
|
58
|
-
} finally {
|
|
59
|
-
client.release();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
escape(value) {
|
|
64
|
-
if (value === null) return 'NULL';
|
|
65
|
-
if (typeof value === 'number') return value.toString();
|
|
66
|
-
return `'${value.toString().replace(/'/g, "''")}'`;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports = { PostgresAdapter };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const { BaseAdapter } = require('./base-adapter');
|
|
2
|
-
const Database = require('better-sqlite3');
|
|
3
|
-
|
|
4
|
-
class SQLiteAdapter extends BaseAdapter {
|
|
5
|
-
async connect() {
|
|
6
|
-
this.connection = new Database(this.config.database || ':memory:');
|
|
7
|
-
return this.connection;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async disconnect() {
|
|
11
|
-
if (this.connection) {
|
|
12
|
-
this.connection.close();
|
|
13
|
-
this.connection = null;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async query(sql, params = []) {
|
|
18
|
-
if (!this.connection) await this.connect();
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
const stmt = this.connection.prepare(sql);
|
|
22
|
-
const rows = stmt.all(...params);
|
|
23
|
-
return { data: rows, rowCount: rows.length };
|
|
24
|
-
} catch (error) {
|
|
25
|
-
throw new Error(`SQLite query error: ${error.message}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async execute(sql, params = []) {
|
|
30
|
-
if (!this.connection) await this.connect();
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const stmt = this.connection.prepare(sql);
|
|
34
|
-
const result = stmt.run(...params);
|
|
35
|
-
return {
|
|
36
|
-
rowCount: result.changes,
|
|
37
|
-
lastInsertId: result.lastInsertRowid
|
|
38
|
-
};
|
|
39
|
-
} catch (error) {
|
|
40
|
-
throw new Error(`SQLite execute error: ${error.message}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async transaction(callback) {
|
|
45
|
-
const transaction = this.connection.transaction(callback);
|
|
46
|
-
return transaction();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
escape(value) {
|
|
50
|
-
if (value === null) return 'NULL';
|
|
51
|
-
if (typeof value === 'number') return value.toString();
|
|
52
|
-
return `'${value.toString().replace(/'/g, "''")}'`;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = { SQLiteAdapter };
|