ks-web-comp-nav 1.3.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.
- package/LICENSE +21 -0
- package/README.md +61 -0
- package/bin/cli.js +9 -0
- package/bin/commands/nav.js +75 -0
- package/bin/commands/steps/announce.js +3 -0
- package/bin/commands/steps/checks.js +21 -0
- package/bin/commands/steps/createProject.js +7 -0
- package/bin/commands/steps/getLatestVersion.js +25 -0
- package/bin/commands/steps/locateDestination.js +5 -0
- package/bin/commands/steps/locateSource copy.js +32 -0
- package/bin/commands/steps/locateSource.js +19 -0
- package/bin/commands/steps/resolveFolderName.js +18 -0
- package/bin/commands/template/v1/BuildMenuItem/buildMenuItem.js +31 -0
- package/bin/commands/template/v1/BuildMenuItem/createAnchor.js +29 -0
- package/bin/commands/template/v1/BuildMenuItem/createLi.js +5 -0
- package/bin/commands/template/v1/BuildNav/buildBrand.js +14 -0
- package/bin/commands/template/v1/BuildNav/buildHamburger.js +20 -0
- package/bin/commands/template/v1/BuildNav/buildMenu.js +14 -0
- package/bin/commands/template/v1/BuildNav/buildNav.js +25 -0
- package/bin/commands/template/v1/BuildNav/buildWrapper.js +29 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/createAnchor.js +15 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/createIcon.js +27 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/createLabel.js +9 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/createLi.js +5 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/icons.js +54 -0
- package/bin/commands/template/v1/WebComponents/v2/menuItem/index.js +64 -0
- package/bin/commands/template/v1/WebComponents/v2/nav/index.js +55 -0
- package/bin/commands/template/v1/WebComponents/v3/menuItem/createAnchor.js +15 -0
- package/bin/commands/template/v1/WebComponents/v3/menuItem/createIcon.js +27 -0
- package/bin/commands/template/v1/WebComponents/v3/menuItem/icons.js +54 -0
- package/bin/commands/template/v1/WebComponents/v3/menuItem/index.js +61 -0
- package/bin/commands/template/v1/WebComponents/v3/nav/index.js +119 -0
- package/bin/commands/template/v1/WebComponents/v4/menuItem/createAnchor.js +15 -0
- package/bin/commands/template/v1/WebComponents/v4/menuItem/createIcon.js +27 -0
- package/bin/commands/template/v1/WebComponents/v4/menuItem/icons.js +54 -0
- package/bin/commands/template/v1/WebComponents/v4/menuItem/index.js +61 -0
- package/bin/commands/template/v1/WebComponents/v4/nav/index.js +154 -0
- package/bin/commands/template/v1/WebComponents/v5/menuItem/createAnchor.js +15 -0
- package/bin/commands/template/v1/WebComponents/v5/menuItem/createIcon.js +27 -0
- package/bin/commands/template/v1/WebComponents/v5/menuItem/icons.js +54 -0
- package/bin/commands/template/v1/WebComponents/v5/menuItem/index.js +61 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/composeNavigationStory.js +55 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createBrandTitle.js +11 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createMenuList.js +10 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createMenuToggleButton.js +14 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createNavigationBar.js +9 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createNavigationRow.js +9 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/createNavigationWrapper.js +9 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/index.js +22 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/readAttributeOrDefault.js +9 -0
- package/bin/commands/template/v1/WebComponents/v5/nav/readNavStoryFromElement.js +46 -0
- package/bin/commands/template/v1/WebComponents/v6/menuItem/createAnchor.js +15 -0
- package/bin/commands/template/v1/WebComponents/v6/menuItem/createIcon.js +27 -0
- package/bin/commands/template/v1/WebComponents/v6/menuItem/icons.js +54 -0
- package/bin/commands/template/v1/WebComponents/v6/menuItem/index.js +61 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/composeNavigationStory.js +54 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createBrandTitle.js +11 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createMenuList.js +10 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createMenuToggleButton.js +14 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createNavigationBar.js +9 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createNavigationRow.js +9 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/createNavigationWrapper.js +9 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/index.js +31 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/navDefaults.js +15 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/navUsage.js +45 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/readAttributeOrDefault.js +9 -0
- package/bin/commands/template/v1/WebComponents/v6/nav/readNavStoryFromElement.js +42 -0
- package/bin/commands/template/v1/initHeader.js +61 -0
- package/bin/commands/template/v2/composeNavigationStory.js +54 -0
- package/bin/commands/template/v2/createBrandTitle.js +11 -0
- package/bin/commands/template/v2/createMenuList.js +10 -0
- package/bin/commands/template/v2/createMenuToggleButton.js +14 -0
- package/bin/commands/template/v2/createNavigationBar.js +9 -0
- package/bin/commands/template/v2/createNavigationRow.js +9 -0
- package/bin/commands/template/v2/createNavigationWrapper.js +9 -0
- package/bin/commands/template/v2/index.js +31 -0
- package/bin/commands/template/v2/navDefaults.js +15 -0
- package/bin/commands/template/v2/navUsage.js +45 -0
- package/bin/commands/template/v2/readAttributeOrDefault.js +9 -0
- package/bin/commands/template/v2/readNavStoryFromElement.js +42 -0
- package/bin/commands/template/v3/composeNavigationStory.js +54 -0
- package/bin/commands/template/v3/createBrandTitle.js +11 -0
- package/bin/commands/template/v3/createMenuList.js +10 -0
- package/bin/commands/template/v3/createMenuToggleButton.js +14 -0
- package/bin/commands/template/v3/createNavigationBar.js +9 -0
- package/bin/commands/template/v3/createNavigationRow.js +9 -0
- package/bin/commands/template/v3/createNavigationWrapper.js +9 -0
- package/bin/commands/template/v3/index.js +34 -0
- package/bin/commands/template/v3/navDefaults.js +15 -0
- package/bin/commands/template/v3/navUsage.js +45 -0
- package/bin/commands/template/v3/readAttributeOrDefault.js +9 -0
- package/bin/commands/template/v3/readNavStoryFromElement.js +42 -0
- package/bin/core/parseInput.js +8 -0
- package/bin/core/resolveCommand.js +16 -0
- package/bin/core/showUsage.js +46 -0
- package/bin/start.js +20 -0
- package/index.js +16 -0
- package/package.json +43 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import navDefaults from "./navDefaults.js";
|
|
2
|
+
|
|
3
|
+
const navUsage = {
|
|
4
|
+
tagName: "ks-nav",
|
|
5
|
+
attributes: {
|
|
6
|
+
title: {
|
|
7
|
+
name: "ks-title",
|
|
8
|
+
defaultValue: "KeshavSoft"
|
|
9
|
+
},
|
|
10
|
+
titleId: {
|
|
11
|
+
name: "ks-title-id",
|
|
12
|
+
defaultValue: "titlehtmlId"
|
|
13
|
+
},
|
|
14
|
+
navClass: {
|
|
15
|
+
name: "ks-nav-class",
|
|
16
|
+
defaultValue: navDefaults.navClass
|
|
17
|
+
},
|
|
18
|
+
outerClass: {
|
|
19
|
+
name: "ks-outer-class",
|
|
20
|
+
defaultValue: navDefaults.outerClass
|
|
21
|
+
},
|
|
22
|
+
innerClass: {
|
|
23
|
+
name: "ks-inner-class",
|
|
24
|
+
defaultValue: navDefaults.innerClass
|
|
25
|
+
},
|
|
26
|
+
brandClass: {
|
|
27
|
+
name: "ks-brand-class",
|
|
28
|
+
defaultValue: navDefaults.brandClass
|
|
29
|
+
},
|
|
30
|
+
menuClass: {
|
|
31
|
+
name: "ks-menu-class",
|
|
32
|
+
defaultValue: navDefaults.menuClass
|
|
33
|
+
},
|
|
34
|
+
menuExtraClass: {
|
|
35
|
+
name: "ks-ul-class",
|
|
36
|
+
defaultValue: ""
|
|
37
|
+
},
|
|
38
|
+
buttonClass: {
|
|
39
|
+
name: "ks-button-class",
|
|
40
|
+
defaultValue: navDefaults.buttonClass
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default navUsage;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import navDefaults from "./navDefaults.js";
|
|
2
|
+
import readAttributeOrDefault from "./readAttributeOrDefault.js";
|
|
3
|
+
|
|
4
|
+
const readNavStoryFromElement = ({ inElement }) => {
|
|
5
|
+
return {
|
|
6
|
+
navClass: readAttributeOrDefault({
|
|
7
|
+
inElement,
|
|
8
|
+
inName: "ks-nav-class",
|
|
9
|
+
inDefaultValue: navDefaults.navClass
|
|
10
|
+
}),
|
|
11
|
+
outerClass: readAttributeOrDefault({
|
|
12
|
+
inElement,
|
|
13
|
+
inName: "ks-outer-class",
|
|
14
|
+
inDefaultValue: navDefaults.outerClass
|
|
15
|
+
}),
|
|
16
|
+
innerClass: readAttributeOrDefault({
|
|
17
|
+
inElement,
|
|
18
|
+
inName: "ks-inner-class",
|
|
19
|
+
inDefaultValue: navDefaults.innerClass
|
|
20
|
+
}),
|
|
21
|
+
titleId: inElement.getAttribute("ks-title-id"),
|
|
22
|
+
title: inElement.getAttribute("ks-title"),
|
|
23
|
+
brandClass: readAttributeOrDefault({
|
|
24
|
+
inElement,
|
|
25
|
+
inName: "ks-brand-class",
|
|
26
|
+
inDefaultValue: navDefaults.brandClass
|
|
27
|
+
}),
|
|
28
|
+
menuClass: readAttributeOrDefault({
|
|
29
|
+
inElement,
|
|
30
|
+
inName: "ks-menu-class",
|
|
31
|
+
inDefaultValue: navDefaults.menuClass
|
|
32
|
+
}),
|
|
33
|
+
menuExtraClass: inElement.getAttribute("ks-ul-class"),
|
|
34
|
+
buttonClass: readAttributeOrDefault({
|
|
35
|
+
inElement,
|
|
36
|
+
inName: "ks-button-class",
|
|
37
|
+
inDefaultValue: navDefaults.buttonClass
|
|
38
|
+
})
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default readNavStoryFromElement;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
const files = fs.readdirSync(new URL("../commands/", import.meta.url));
|
|
4
|
+
|
|
5
|
+
const entries = await Promise.all(
|
|
6
|
+
files.filter(f => f.endsWith(".js"))
|
|
7
|
+
.map(async f => [f.replace(".js", ""), (await import(`../commands/${f}`)).default])
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const map = Object.fromEntries(entries);
|
|
11
|
+
|
|
12
|
+
const resolveCommand = (cmd) => {
|
|
13
|
+
return map[cmd] || null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default resolveCommand;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
JSON CRUD UI CLI – Entry Flow
|
|
3
|
+
|
|
4
|
+
1. Read user input from terminal (parseInput)
|
|
5
|
+
2. If no command → show usage
|
|
6
|
+
3. If help flags → show usage
|
|
7
|
+
4. Resolve command dynamically
|
|
8
|
+
5. If command not found → show usage
|
|
9
|
+
6. Validate command requirements
|
|
10
|
+
7. Execute command
|
|
11
|
+
|
|
12
|
+
Goal:
|
|
13
|
+
- Zero confusion for user
|
|
14
|
+
- Single source of truth (showUsage)
|
|
15
|
+
- Self-validating commands
|
|
16
|
+
- Easy to extend (drop-in command architecture)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export default function showUsage(version) {
|
|
20
|
+
const g = "\x1b[32m";
|
|
21
|
+
const y = "\x1b[33m";
|
|
22
|
+
const c = "\x1b[36m";
|
|
23
|
+
const gray = "\x1b[90m";
|
|
24
|
+
const r = "\x1b[0m";
|
|
25
|
+
|
|
26
|
+
console.log(`
|
|
27
|
+
${c}🚀 tailwind-header-dom v${version}${r}
|
|
28
|
+
|
|
29
|
+
${y}Usage:${r}
|
|
30
|
+
${g}npx tailwind-header-dom ${r} <command>
|
|
31
|
+
|
|
32
|
+
${y}Commands:${r}
|
|
33
|
+
${g}Header${r} Builds header structure
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
${y}Examples:${r}
|
|
37
|
+
${gray}npx tailwind-header-dom header${r}
|
|
38
|
+
|
|
39
|
+
${y}Architecture:${r}
|
|
40
|
+
${gray}commands are auto-loaded dynamically${r}
|
|
41
|
+
${gray}each command validates required files${r}
|
|
42
|
+
|
|
43
|
+
${y}Tip:${r}
|
|
44
|
+
${gray}Run init first before feature commands${r}
|
|
45
|
+
`);
|
|
46
|
+
}
|
package/bin/start.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import parseInput from "./core/parseInput.js";
|
|
2
|
+
import showUsage from './core/showUsage.js';
|
|
3
|
+
|
|
4
|
+
import commandToRun from "./commands/nav.js";
|
|
5
|
+
|
|
6
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
7
|
+
|
|
8
|
+
const version = pkg.version;
|
|
9
|
+
|
|
10
|
+
const run = async () => {
|
|
11
|
+
const input = parseInput();
|
|
12
|
+
|
|
13
|
+
if (input.action === "--help" || input.action === "-h" || input.action === "help") return showUsage(version);
|
|
14
|
+
|
|
15
|
+
await commandToRun({
|
|
16
|
+
folderName: input.folderName
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default run;
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import getLatestVersion from "./bin/commands/steps/getLatestVersion.js";
|
|
2
|
+
|
|
3
|
+
const load = async (cmd) => {
|
|
4
|
+
const v = getLatestVersion;
|
|
5
|
+
console.log("v : ", v);
|
|
6
|
+
|
|
7
|
+
// return (await import(`./bin/commands/template/${v}/index.js`));
|
|
8
|
+
const navDefaults = (await import(`./bin/commands/template/${v}/navDefaults.js`)).default;
|
|
9
|
+
const navUsage = (await import(`./bin/commands/template/${v}/navUsage.js`)).default;
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
navDefaults, navUsage
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default load;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ks-web-comp-nav",
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "CLI to scaffold projects using templates",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"tailwind",
|
|
7
|
+
"tailwindcss",
|
|
8
|
+
"todo",
|
|
9
|
+
"tailwind-todo",
|
|
10
|
+
"boilerplate",
|
|
11
|
+
"scaffold",
|
|
12
|
+
"starter",
|
|
13
|
+
"template",
|
|
14
|
+
"cli"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build:header": "vite build --config vite.header.config.js"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"vite": "^8.0.14"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./index.js"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"ks-web-comp-nav": "./bin/cli.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin/",
|
|
31
|
+
"index.js",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"homepage": "https://keshavsoft.github.io/ks-web-comp-nav/",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/keshavsoft/ks-web-comp-nav.git"
|
|
39
|
+
},
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/keshavsoft/ks-web-comp-nav/issues"
|
|
42
|
+
}
|
|
43
|
+
}
|