quar 1.1.0
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/LICENSE +0 -0
- package/README.md +93 -0
- package/index.js +64 -0
- package/package.json +23 -0
- package/public/assets/icon.png +0 -0
- package/public/scripts/insertTab.js +103 -0
- package/public/scripts/keyboardCommands.js +16 -0
- package/public/scripts/main.js +327 -0
- package/public/scripts/popup.js +26 -0
- package/public/styles/insertTab.css +57 -0
- package/public/styles/popup.css +71 -0
- package/public/styles/style.css +341 -0
- package/public/styles/variables.css +9 -0
- package/server.js +239 -0
- package/utils/loadModels.js +25 -0
- package/views/base.zare +16 -0
- package/views/components/insertTab.zare +8 -0
- package/views/components/popup.zare +12 -0
- package/views/pages/index.zare +55 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
import { pathToFileURL } from "url";
|
|
6
|
+
|
|
7
|
+
export default (modelPath) => {
|
|
8
|
+
if (!fs.existsSync(modelPath)) {
|
|
9
|
+
console.log(
|
|
10
|
+
chalk.red.bold('[ERROR]') +
|
|
11
|
+
' The specified model path does not exist:\n ' +
|
|
12
|
+
chalk.gray(modelPath)
|
|
13
|
+
);
|
|
14
|
+
console.log('Tip: Check the path or create the folder first.');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
fs.readdirSync(modelPath).forEach(async (file) => {
|
|
19
|
+
if (file.endsWith('.js')) {
|
|
20
|
+
const filePath = path.join(modelPath, file);
|
|
21
|
+
const moduleUrl = pathToFileURL(filePath);
|
|
22
|
+
await import(moduleUrl.href);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
package/views/base.zare
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import keyboardShortcutsJs "/scripts/keyboardCommands"
|
|
2
|
+
|
|
3
|
+
serve (
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="UTF-8"/>
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
9
|
+
<title>Quar Studio</title>
|
|
10
|
+
<link rel="shortcut icon" href="/assets/icon.png" type="image/x-icon"/>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
@(slot)
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
16
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
link popupCss "/styles/popup"
|
|
2
|
+
import popupJs "/scripts/popup"
|
|
3
|
+
|
|
4
|
+
serve (
|
|
5
|
+
<div class="popup-overlay" id="popup">
|
|
6
|
+
<div class="popup-box" id="popupBox">
|
|
7
|
+
<h2 id="popupTitle">Title</h2>
|
|
8
|
+
<p id="popupMessage">Message goes here.</p>
|
|
9
|
+
<button class="close-btn" onclick="closePopup()">Close</button>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
as Base import "../base.zare"
|
|
2
|
+
|
|
3
|
+
as Popup import "../components/popup.zare"
|
|
4
|
+
as InsertTab import "../components/insertTab.zare"\
|
|
5
|
+
|
|
6
|
+
link styleCss "/styles/style"
|
|
7
|
+
import mainJs "/scripts/main"
|
|
8
|
+
|
|
9
|
+
serve (
|
|
10
|
+
<Base>
|
|
11
|
+
<div class="sidebar">
|
|
12
|
+
<div class="sidebar-header">All Models <button onclick="refreshSideBar()" class="btn">⭮</button></div>
|
|
13
|
+
<div class="model-wrapper">
|
|
14
|
+
@each (models:model) {
|
|
15
|
+
<div class="model" onclick="openModel('@(model.name)')">@(model.name)<span id="@(model.name)-doc-count">@(model.count)</span></div>
|
|
16
|
+
}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="main">
|
|
21
|
+
<div class="tabs" id="tabs">
|
|
22
|
+
<div class="tab" id="tab-quar-studio"><img src="/assets/icon.png" alt="uv dex icon" width="24px"/></div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="operations">
|
|
25
|
+
<button class="refreshModel btn" onclick="loadDocuments()">⭮</button>
|
|
26
|
+
<div class="limit-wrapper">
|
|
27
|
+
<div class="text">Limit</div><div class="limit-div">
|
|
28
|
+
<select name="limit" id="limit" onchange="loadDocuments()">
|
|
29
|
+
<option value="10">10</option>
|
|
30
|
+
<option value="25">25</option>
|
|
31
|
+
<option value="50">50</option>
|
|
32
|
+
<option value="100" selected>100</option>
|
|
33
|
+
</select>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="count-wrapper">
|
|
37
|
+
<div class="text">Count</div>
|
|
38
|
+
<div class="count-div" id="document-count">0</div>
|
|
39
|
+
</div>
|
|
40
|
+
<button class="btn" id="previous-page" onclick="gotoPreviousPage()">Previous</button>
|
|
41
|
+
<div class="page-wrapper" id="page" data-page="1">
|
|
42
|
+
<div class="text">Page</div>
|
|
43
|
+
<div class="page-div" id="page-value">1</div>
|
|
44
|
+
</div>
|
|
45
|
+
<button class="btn" id="next-page" onclick="gotoNextPage()">Next</button>
|
|
46
|
+
<button class="btn" onclick="toggleInsertTab()">Add Record</button>
|
|
47
|
+
<button class="btn" onclick="deleteAllDocs()">🗑</button>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="content" id="content"></div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<Popup/>
|
|
53
|
+
<InsertTab />
|
|
54
|
+
</Base>
|
|
55
|
+
)
|