json-crud-ui-components 1.1.1 → 1.2.1

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 (53) hide show
  1. package/bin/v2/commands/buildHeader/template/v1/buildHeader.js +68 -0
  2. package/bin/v2/commands/buildHeader.js +20 -0
  3. package/bin/v2/commands/htmlIdClick/steps/resolveFolderName.js +17 -0
  4. package/bin/v2/commands/init/steps/announce.js +3 -0
  5. package/bin/v2/commands/init/steps/createProject.js +7 -0
  6. package/bin/v2/commands/init/steps/locateDestination.js +5 -0
  7. package/bin/v2/commands/init/steps/locateSource.js +32 -0
  8. package/package.json +1 -1
  9. /package/bin/{v1 → v2}/commands/addListeners/steps/announce.js +0 -0
  10. /package/bin/{v1 → v2}/commands/addListeners/steps/createProject.js +0 -0
  11. /package/bin/{v1 → v2}/commands/addListeners/steps/locateDestination.js +0 -0
  12. /package/bin/{v1 → v2}/commands/addListeners/steps/locateSource.js +0 -0
  13. /package/bin/{v1 → v2}/commands/addListeners/steps/resolveFolderName.js +0 -0
  14. /package/bin/{v1 → v2}/commands/addListeners/template/v1/AddListeners/start.js +0 -0
  15. /package/bin/{v1 → v2}/commands/addListeners/template/v2/start.js +0 -0
  16. /package/bin/{v1 → v2}/commands/addListeners.js +0 -0
  17. /package/bin/{v1/commands/htmlIdClick → v2/commands/buildHeader}/steps/announce.js +0 -0
  18. /package/bin/{v1/commands/htmlIdClick → v2/commands/buildHeader}/steps/createProject.js +0 -0
  19. /package/bin/{v1/commands/htmlIdClick → v2/commands/buildHeader}/steps/locateDestination.js +0 -0
  20. /package/bin/{v1/commands/htmlIdClick → v2/commands/buildHeader}/steps/locateSource.js +0 -0
  21. /package/bin/{v1/commands/htmlIdClick → v2/commands/buildHeader}/steps/resolveFolderName.js +0 -0
  22. /package/bin/{v1/commands/init → v2/commands/htmlIdClick}/steps/announce.js +0 -0
  23. /package/bin/{v1/commands/init → v2/commands/htmlIdClick}/steps/createProject.js +0 -0
  24. /package/bin/{v1/commands/init → v2/commands/htmlIdClick}/steps/locateDestination.js +0 -0
  25. /package/bin/{v1/commands/init → v2/commands/htmlIdClick}/steps/locateSource.js +0 -0
  26. /package/bin/{v1 → v2}/commands/htmlIdClick/template/v1/clickFunc.js +0 -0
  27. /package/bin/{v1 → v2}/commands/htmlIdClick/template/v1/start.js +0 -0
  28. /package/bin/{v1 → v2}/commands/htmlIdClick.js +0 -0
  29. /package/bin/{v1 → v2}/commands/init/steps/resolveFolderName.js +0 -0
  30. /package/bin/{v1 → v2}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  31. /package/bin/{v1 → v2}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  32. /package/bin/{v1 → v2}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  33. /package/bin/{v1 → v2}/commands/init/template/v1/Index/FormLoad/DomContentLoaded/start.js +0 -0
  34. /package/bin/{v1 → v2}/commands/init/template/v1/Index/FormLoad/start.js +0 -0
  35. /package/bin/{v1 → v2}/commands/init/template/v1/Index/start.js +0 -0
  36. /package/bin/{v1 → v2}/commands/init/template/v2/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  37. /package/bin/{v1 → v2}/commands/init/template/v2/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  38. /package/bin/{v1 → v2}/commands/init/template/v2/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  39. /package/bin/{v1 → v2}/commands/init/template/v2/FormLoad/DomContentLoaded/start.js +0 -0
  40. /package/bin/{v1 → v2}/commands/init/template/v2/FormLoad/start.js +0 -0
  41. /package/bin/{v1 → v2}/commands/init/template/v2/start.js +0 -0
  42. /package/bin/{v1 → v2}/commands/init/template/v3/FormLoad/DomContentLoaded/buildHeader.js +0 -0
  43. /package/bin/{v1 → v2}/commands/init/template/v3/FormLoad/DomContentLoaded/buildMenuItem.js +0 -0
  44. /package/bin/{v1 → v2}/commands/init/template/v3/FormLoad/DomContentLoaded/runAfterDomLoad.js +0 -0
  45. /package/bin/{v1 → v2}/commands/init/template/v3/FormLoad/DomContentLoaded/start.js +0 -0
  46. /package/bin/{v1 → v2}/commands/init/template/v3/FormLoad/start.js +0 -0
  47. /package/bin/{v1 → v2}/commands/init/template/v3/headers.json +0 -0
  48. /package/bin/{v1 → v2}/commands/init/template/v3/start.js +0 -0
  49. /package/bin/{v1 → v2}/commands/init.js +0 -0
  50. /package/bin/{v1 → v2}/core/parseInput.js +0 -0
  51. /package/bin/{v1 → v2}/core/resolveCommand.js +0 -0
  52. /package/bin/{v1 → v2}/core/showUsage.js +0 -0
  53. /package/bin/{v1 → v2}/start.js +0 -0
@@ -0,0 +1,68 @@
1
+ import { initHeader } from "../../../../../../header/v5/initHeader.js";
2
+
3
+ const buildHeader = async () => {
4
+ const headerConfig = {
5
+ items: [
6
+ {
7
+ text: "Ledgers",
8
+ id: "LedgersHtmlId",
9
+ icon: [
10
+ "M4 6h16",
11
+ "M4 10h16",
12
+ "M4 14h10",
13
+ "M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
14
+ ]
15
+ },
16
+ {
17
+ text: "StockItems",
18
+ id: "StockItemsHtmlId",
19
+ icon: [
20
+ "M3 7l9 4 9-4",
21
+ "M3 7l9-4 9 4",
22
+ "M3 7v10l9 4 9-4V7",
23
+ "M12 11v10"
24
+ ]
25
+ },
26
+ {
27
+ text: "Transactions",
28
+ id: "1",
29
+ icon: [
30
+
31
+ "M6 2h9l5 5v15a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z",
32
+ "M14 2v6h6",
33
+ "M8 12h8",
34
+ "M8 16h8"
35
+ ],
36
+ href: "../../Transactions/V7/Create/index.html"
37
+ },
38
+ {
39
+ text: "FromTally",
40
+ id: "ImportHtmlId",
41
+ icon: [
42
+ "M4 6h16",
43
+ "M4 10h16",
44
+ "M4 14h10",
45
+ "M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
46
+ ]
47
+ }
48
+ ]
49
+ };
50
+
51
+ await initHeader(headerConfig);
52
+ // await callKSHeader(headerConfig);
53
+ };
54
+
55
+ const callKSHeader = async (config) => {
56
+ if (window.KSHeader?.initHeader) {
57
+ console.log("table loaded from window.KSTable");
58
+
59
+ return window.KSHeader.initHeader(config); // extension or CDN
60
+ } else {
61
+ // const { initTableOnly } = await import("../../../../../../../../KSTableAi/V28/entry.js"); // local
62
+ const { initTableOnly } = await import("https://keshavsoft.github.io/KsJsTableAi/Public/kstable.js"); // local
63
+
64
+ return initTableOnly(config);
65
+ };
66
+ };
67
+
68
+ export default buildHeader;
@@ -0,0 +1,20 @@
1
+ import { locateSource } from "./buildHeader/steps/locateSource.js";
2
+ import { locateDestination } from "./buildHeader/steps/locateDestination.js";
3
+
4
+ import { createProject } from "./buildHeader/steps/createProject.js";
5
+ import { announce } from "./buildHeader/steps/announce.js";
6
+
7
+ import resolveFolderName from "./buildHeader/steps/resolveFolderName.js";
8
+
9
+ export default ({ folderName = "", toPath = process.cwd(), inAnnounce = true }) => {
10
+ const resolvedFolderName = resolveFolderName({
11
+ name: folderName
12
+ });
13
+
14
+ const source = locateSource();
15
+ const destination = locateDestination({ inResolvedFolderName: resolvedFolderName });
16
+
17
+ createProject({ source, destination });
18
+
19
+ if (inAnnounce) announce({ inResolvedFolderName: resolvedFolderName });
20
+ };
@@ -0,0 +1,17 @@
1
+ import fs from "fs";
2
+
3
+ export default function resolveFolderName({ name, inType = "basic" }) {
4
+ const defaultFolerName = "AddListeners";
5
+
6
+ // case 1: force new → timestamp
7
+ if (name === null) {
8
+ name = defaultFolerName;
9
+ };
10
+
11
+ // case 2: user provided → strict
12
+ if (fs.existsSync(name)) {
13
+ throw new Error(`Folder already exists: ${name}`);
14
+ };
15
+
16
+ return name;
17
+ };
@@ -0,0 +1,3 @@
1
+ export const announce = ({ inResolvedFolderName }) => {
2
+ console.log(`[keshavsoft] Project created: ${inResolvedFolderName}`);
3
+ };
@@ -0,0 +1,7 @@
1
+ import fs from "fs";
2
+
3
+ export const createProject = ({ source, destination }) => {
4
+ fs.mkdirSync(destination, { recursive: true });
5
+
6
+ fs.cpSync(source, destination, { recursive: true });
7
+ };
@@ -0,0 +1,5 @@
1
+ import path from "path";
2
+
3
+ export const locateDestination = ({ inResolvedFolderName }) => {
4
+ return path.join(process.cwd(), inResolvedFolderName);
5
+ };
@@ -0,0 +1,32 @@
1
+ import fs from "fs";
2
+
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ const templatePath = path.join(
10
+ __dirname,
11
+ "..",
12
+ "template"
13
+ );
14
+
15
+ const versions = fs
16
+ .readdirSync(templatePath)
17
+ .filter(item => item.startsWith("v"));
18
+
19
+ const highestVersion =
20
+ versions.sort().at(-1);
21
+
22
+ const sourceVersion =
23
+ highestVersion;
24
+
25
+ export const locateSource = () => {
26
+ return path.join(
27
+ __dirname,
28
+ "..",
29
+ "template",
30
+ sourceVersion
31
+ );
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-crud-ui-components",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "working on ui for our json crud using modules",
5
5
  "keywords": [
6
6
  "cli",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes