domma-js 0.3.1-alpha → 0.7.0-alpha

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 (39) hide show
  1. package/README.md +33 -30
  2. package/assets/types/config.d.ts +127 -0
  3. package/assets/types/dates.d.ts +209 -0
  4. package/assets/types/dom.d.ts +448 -0
  5. package/assets/types/elements.d.ts +606 -0
  6. package/assets/types/http.d.ts +97 -0
  7. package/assets/types/icons.d.ts +147 -0
  8. package/assets/types/index.d.ts +197 -0
  9. package/assets/types/models.d.ts +188 -0
  10. package/assets/types/storage.d.ts +93 -0
  11. package/assets/types/tables.d.ts +327 -0
  12. package/assets/types/theme.d.ts +136 -0
  13. package/assets/types/utils.d.ts +675 -0
  14. package/bin/domma-cli.js +144 -0
  15. package/package.json +12 -5
  16. package/public/dist/bundles/domma-complete.css +2316 -170
  17. package/public/dist/bundles/domma-data-focused.css +2686 -321
  18. package/public/dist/bundles/domma-essentials.css +2686 -321
  19. package/public/dist/bundles/domma-full.css +2686 -321
  20. package/public/dist/bundles/domma-grayve.css +13839 -0
  21. package/public/dist/bundles/domma-minimal.css +1591 -9
  22. package/public/dist/domma-syntax.min.js +8 -0
  23. package/public/dist/domma.css +1586 -4
  24. package/public/dist/domma.esm.js +4 -4
  25. package/public/dist/domma.min.js +4 -4
  26. package/public/dist/elements.css +368 -17
  27. package/public/dist/grid.css +3 -3
  28. package/public/dist/syntax.css +3 -3
  29. package/public/dist/themes/domma-themes.css +216 -3
  30. package/public/dist/themes/grayve.css +213 -0
  31. package/templates/kickstart/about/index.html +241 -0
  32. package/templates/kickstart/assets/logo/placeholder.svg +6 -0
  33. package/templates/kickstart/blog/index.html +227 -0
  34. package/templates/kickstart/contact/index.html +218 -0
  35. package/templates/kickstart/css/custom.css +121 -0
  36. package/templates/kickstart/docs/index.html +310 -0
  37. package/templates/kickstart/domma.config.json +47 -0
  38. package/templates/kickstart/index.html +170 -0
  39. package/templates/kickstart/js/app.js +161 -0
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync} from 'fs';
4
+ import {dirname, join, relative} from 'path';
5
+ import {fileURLToPath} from 'url';
6
+ import * as readline from 'readline/promises';
7
+ import {stdin as input, stdout as output} from 'process';
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+
12
+ const THEMES = [
13
+ 'charcoal-dark',
14
+ 'ocean-dark',
15
+ 'forest-dark',
16
+ 'sunset-light',
17
+ 'silver-light',
18
+ 'ocean-light',
19
+ 'forest-light',
20
+ 'sunset-dark',
21
+ 'royal-dark',
22
+ 'lemon-light'
23
+ ];
24
+
25
+ // Parse command-line arguments
26
+ const args = process.argv.slice(2);
27
+ const quickMode = args.includes('--quick');
28
+
29
+ // ASCII Art Banner
30
+ console.log(`
31
+ ╔═══════════════════════════════════════╗
32
+ ║ ║
33
+ ║ Welcome to Domma CLI! ║
34
+ ║ ║
35
+ ╚═══════════════════════════════════════╝
36
+
37
+ Let's set up your project.
38
+ `);
39
+
40
+ async function main() {
41
+ let projectName = 'my-app';
42
+ let theme = 'charcoal-dark';
43
+ let includeThemeSelector = false;
44
+
45
+ if (!quickMode) {
46
+ const rl = readline.createInterface({input, output});
47
+
48
+ // Prompt for project name
49
+ const nameAnswer = await rl.question(` Project name: (${projectName}) `);
50
+ if (nameAnswer.trim()) projectName = nameAnswer.trim();
51
+
52
+ // Prompt for theme
53
+ console.log(`\n Choose a theme:`);
54
+ THEMES.forEach((t, i) => {
55
+ const marker = i === 0 ? '❯' : ' ';
56
+ const tag = i === 0 ? '(default)' : '';
57
+ console.log(` ${marker} ${t} ${tag}`);
58
+ });
59
+
60
+ const themeAnswer = await rl.question(`\n Enter theme name or number (1-${THEMES.length}): `);
61
+ const themeInput = themeAnswer.trim();
62
+ if (themeInput) {
63
+ const themeIndex = parseInt(themeInput) - 1;
64
+ if (Number.isInteger(themeIndex) && themeIndex >= 0 && themeIndex < THEMES.length) {
65
+ theme = THEMES[themeIndex];
66
+ } else if (THEMES.includes(themeInput)) {
67
+ theme = themeInput;
68
+ }
69
+ }
70
+
71
+ // Prompt for theme selector
72
+ const selectorAnswer = await rl.question(`\n Include theme selector? (y/N): `);
73
+ includeThemeSelector = selectorAnswer.trim().toLowerCase() === 'y';
74
+
75
+ rl.close();
76
+ console.log('');
77
+ }
78
+
79
+ // Find templates directory
80
+ const templatesDir = join(__dirname, '..', 'templates', 'kickstart');
81
+
82
+ if (!existsSync(templatesDir)) {
83
+ console.error(`\n ✗ Error: Templates directory not found at ${templatesDir}`);
84
+ process.exit(1);
85
+ }
86
+
87
+ // Create project structure
88
+ console.log(` Creating project structure...\n`);
89
+
90
+ const currentYear = new Date().getFullYear();
91
+ const vars = {
92
+ '{{projectName}}': projectName,
93
+ '{{year}}': currentYear.toString(),
94
+ '{{theme}}': theme,
95
+ '{{includeThemeSelector}}': includeThemeSelector.toString()
96
+ };
97
+
98
+ // Copy all templates with variable substitution
99
+ copyTemplatesRecursive(templatesDir, process.cwd(), vars);
100
+
101
+ console.log(`\n ✓ Done! Your project "${projectName}" is ready.\n`);
102
+ console.log(` Next steps:`);
103
+ console.log(` 1. Open index.html in your browser`);
104
+ console.log(` 2. Edit domma.config.json to customise`);
105
+ console.log(` 3. Read the docs: https://github.com/dcbw-it/domma\n`);
106
+ }
107
+
108
+ /**
109
+ * Recursively copy templates with variable substitution
110
+ */
111
+ function copyTemplatesRecursive(srcDir, destDir, vars) {
112
+ const items = readdirSync(srcDir);
113
+
114
+ for (const item of items) {
115
+ const srcPath = join(srcDir, item);
116
+ const destPath = join(destDir, item);
117
+ const stat = statSync(srcPath);
118
+
119
+ if (stat.isDirectory()) {
120
+ // Create directory if it doesn't exist
121
+ if (!existsSync(destPath)) {
122
+ mkdirSync(destPath, {recursive: true});
123
+ }
124
+ copyTemplatesRecursive(srcPath, destPath, vars);
125
+ } else {
126
+ // Copy file with variable substitution
127
+ let content = readFileSync(srcPath, 'utf-8');
128
+
129
+ // Replace all variables
130
+ for (const [key, value] of Object.entries(vars)) {
131
+ content = content.replaceAll(key, value);
132
+ }
133
+
134
+ writeFileSync(destPath, content, 'utf-8');
135
+ const relPath = relative(process.cwd(), destPath);
136
+ console.log(` ✓ Created ${relPath}`);
137
+ }
138
+ }
139
+ }
140
+
141
+ main().catch((error) => {
142
+ console.error(`\n ✗ Error: ${error.message}`);
143
+ process.exit(1);
144
+ });
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "domma-js",
3
- "version": "0.3.1-alpha",
3
+ "version": "0.7.0-alpha",
4
4
  "description": "Dynamic Object Manipulation & Modeling API - A complete front-end toolkit.",
5
5
  "main": "public/dist/domma.min.js",
6
6
  "module": "public/dist/domma.esm.js",
7
7
  "types": "assets/types/index.d.ts",
8
+ "bin": {
9
+ "domma": "./bin/domma-cli.js"
10
+ },
8
11
  "files": [
12
+ "bin/",
13
+ "templates/",
9
14
  "public/dist/domma.min.js",
10
15
  "public/dist/domma.esm.js",
11
16
  "public/dist/domma.css",
@@ -13,6 +18,7 @@
13
18
  "public/dist/elements.css",
14
19
  "public/dist/grid.css",
15
20
  "public/dist/syntax.css",
21
+ "public/dist/domma-syntax.min.js",
16
22
  "public/dist/themes/",
17
23
  "assets/types/",
18
24
  "LICENSE",
@@ -24,22 +30,22 @@
24
30
  },
25
31
  "type": "module",
26
32
  "scripts": {
27
- "dev": "NODE_ENV=development npm run generate:bundles && rollup -c && node scripts/build-info.js && npm run build:metadata && npm run build:css && npm run build:miniapps && live-server public --port=3001 --open=/index.html",
28
- "build": "npm run generate:bundles && rollup -c && node scripts/build-info.js && npm run build:metadata && npm run build:css && npm run build:css-bundles && npm run build:archives && npm run build:kickstart && npm run build:miniapps",
33
+ "dev": "NODE_ENV=development npm run generate:bundles && rollup -c && node scripts/build-info.js && npm run build:metadata && npm run copy:themes && npm run build:css && npm run build:miniapps && live-server public --port=3001 --open=/index.html",
34
+ "build": "npm run generate:bundles && rollup -c && node scripts/build-info.js && npm run build:metadata && npm run copy:themes && npm run build:css && npm run build:css-bundles && npm run build:archives && npm run build:kickstart && npm run build:miniapps",
29
35
  "build:js": "rollup -c",
30
36
  "build:css": "node scripts/build-css.js",
31
37
  "build:css-bundles": "node scripts/build-css-bundles.js",
32
38
  "build:archives": "node scripts/build-archives.js",
33
39
  "build:info": "node scripts/build-info.js",
34
40
  "build:metadata": "node scripts/copy-metadata.js",
41
+ "copy:themes": "node scripts/copy-theme-css.js",
35
42
  "build:kickstart": "npm run build:js && npm run build:info && node scripts/build-kickstart-zip.js",
36
43
  "build:miniapps": "node scripts/build-miniapp.js && node scripts/copy-miniapps.js",
37
44
  "build:miniapp:garage": "node scripts/build-miniapp.js garage",
38
45
  "generate:bundles": "node scripts/generate-bundles.js",
39
46
  "test:vitest": "vitest",
40
47
  "test": "vitest",
41
- "cypress:run": "cypress run",
42
- "showcase": "live-server public --port=3001 --open=/showcase/index.html"
48
+ "cypress:run": "cypress run"
43
49
  },
44
50
  "keywords": [
45
51
  "dom",
@@ -59,6 +65,7 @@
59
65
  "dotenv": "^17.2.3",
60
66
  "jsdom": "^24.1.0",
61
67
  "live-server": "^1.2.0",
68
+ "puppeteer": "^24.34.0",
62
69
  "rollup": "^4.28.0",
63
70
  "rollup-plugin-obfuscator": "^1.1.0",
64
71
  "vitest": "^4.0.16"