domma-js 0.13.9 → 0.13.10

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 (29) hide show
  1. package/package.json +1 -1
  2. package/templates/kickstart/frontend/config/footer.json +21 -0
  3. package/templates/kickstart/frontend/config/navbar.json +36 -0
  4. package/templates/kickstart/frontend/js/app.js +78 -45
  5. package/templates/kickstart/frontend/pages/about/index.html +3 -3
  6. package/templates/kickstart/frontend/pages/blog/index.html +3 -3
  7. package/templates/kickstart/frontend/pages/contact/index.html +3 -3
  8. package/templates/kickstart/frontend/pages/cookies/index.html +3 -3
  9. package/templates/kickstart/frontend/pages/docs/index.html +3 -3
  10. package/templates/kickstart/frontend/pages/index.html +3 -3
  11. package/templates/kickstart/frontend/pages/privacy/index.html +3 -3
  12. package/templates/kickstart/frontend/pages/terms/index.html +3 -3
  13. package/templates/kickstart/frontend/layouts/config/footer-public.json +0 -25
  14. package/templates/kickstart/frontend/layouts/config/nav-public.json +0 -30
  15. package/templates/kickstart/frontend/layouts/config/presets.json +0 -27
  16. package/templates/kickstart/frontend/layouts/js/layout.js +0 -1240
  17. package/templates/kickstart/frontend/layouts/js/modules/auth-modal.js +0 -384
  18. package/templates/kickstart/frontend/layouts/js/modules/consent.js +0 -136
  19. package/templates/kickstart/frontend/layouts/js/modules/detector.js +0 -130
  20. package/templates/kickstart/frontend/layouts/js/modules/features.js +0 -163
  21. package/templates/kickstart/frontend/layouts/js/modules/path-resolver.js +0 -113
  22. package/templates/kickstart/frontend/layouts/js/modules/sidebar.js +0 -139
  23. package/templates/kickstart/frontend/layouts/js/modules/snow.js +0 -1467
  24. package/templates/kickstart/frontend/layouts/js/modules/template-loader.js +0 -84
  25. package/templates/kickstart/frontend/layouts/templates/footer.html +0 -6
  26. package/templates/kickstart/frontend/layouts/templates/navbar-simple.html +0 -10
  27. package/templates/kickstart/frontend/layouts/templates/navbar.html +0 -1
  28. package/templates/kickstart/frontend/layouts/templates/snow-toggle.html +0 -18
  29. package/templates/kickstart/frontend/layouts/templates/variant-selector.html +0 -49
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-js",
3
- "version": "0.13.9",
3
+ "version": "0.13.10",
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",
@@ -0,0 +1,21 @@
1
+ {
2
+ "copyright": "© {{year}} {{projectName}}. All rights reserved.",
3
+ "links": [
4
+ {
5
+ "text": "Privacy Policy",
6
+ "url": "pages/privacy/index.html"
7
+ },
8
+ {
9
+ "text": "Cookie Policy",
10
+ "url": "pages/cookies/index.html"
11
+ },
12
+ {
13
+ "text": "Terms of Service",
14
+ "url": "pages/terms/index.html"
15
+ },
16
+ {
17
+ "text": "Contact Us",
18
+ "url": "pages/contact/index.html"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "brand": {
3
+ "text": "{{projectName}}",
4
+ "url": "pages/index.html"
5
+ },
6
+ "items": [
7
+ {
8
+ "text": "Home",
9
+ "url": "pages/index.html",
10
+ "page": "home"
11
+ },
12
+ {
13
+ "text": "About",
14
+ "url": "pages/about/index.html",
15
+ "page": "about"
16
+ },
17
+ {
18
+ "text": "Blog",
19
+ "url": "pages/blog/index.html",
20
+ "page": "blog"
21
+ },
22
+ {
23
+ "text": "Docs",
24
+ "url": "pages/docs/index.html",
25
+ "page": "docs"
26
+ },
27
+ {
28
+ "text": "Contact",
29
+ "url": "pages/contact/index.html",
30
+ "page": "contact"
31
+ }
32
+ ],
33
+ "variant": "dark",
34
+ "position": "sticky",
35
+ "collapsible": true
36
+ }
@@ -1,54 +1,91 @@
1
1
  /**
2
2
  * Domma Kickstart Application
3
- * Simple initialization for navbar, footer, theme, and features
3
+ * Configuration-driven initialization using JSON configs
4
4
  */
5
5
 
6
6
  $(() => {
7
7
  console.log('[App] Initializing...');
8
8
 
9
- // Simple navbar initialization
10
- const initNavbar = () => {
11
- Domma.elements.navbar('#main-navbar', {
12
- brand: {
13
- text: '{{projectName}}',
14
- url: './'
15
- },
16
- items: [
17
- { text: 'Home', url: './', active: true },
18
- { text: 'About', url: 'about/' },
19
- { text: 'Contact', url: 'contact/' },
20
- { text: 'Blog', url: 'blog/' },
21
- { text: 'Docs', url: 'docs/' }
22
- ],
23
- variant: 'dark',
24
- position: 'sticky',
25
- collapsible: true
26
- });
27
- console.log('[App] Navbar initialized');
28
- };
9
+ // Calculate path prefix based on current page location
10
+ const currentPath = window.location.pathname;
11
+ const currentDir = currentPath.substring(0, currentPath.lastIndexOf('/'));
12
+ const depth = (currentDir.match(/\//g) || []).length;
13
+ const prefix = '../'.repeat(depth);
29
14
 
30
- // Simple footer initialization
31
- const initFooter = () => {
32
- const $footer = $('.page-footer');
33
- if ($footer.length) {
34
- const footerHTML = `
35
- <div class="container py-4">
36
- <div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
37
- <p class="mb-0 text-secondary">© {{year}} {{projectName}}. All rights reserved.</p>
38
- <nav class="d-flex gap-3">
39
- <a href="privacy/" class="text-secondary">Privacy Policy</a>
40
- <a href="cookies/" class="text-secondary">Cookie Policy</a>
41
- <a href="terms/" class="text-secondary">Terms of Service</a>
42
- <a href="contact/" class="text-secondary">Contact Us</a>
43
- </nav>
44
- </div>
45
- </div>
46
- `;
47
- $footer.html(footerHTML);
48
- console.log('[App] Footer initialized');
15
+ console.log('[App] Path:', currentPath, 'Depth:', depth, 'Prefix:', prefix);
16
+
17
+ // Helper to adjust URLs in config based on page depth
18
+ const adjustUrls = (config) => {
19
+ const adjusted = _.cloneDeep(config);
20
+
21
+ if (adjusted.brand?.url) {
22
+ adjusted.brand.url = prefix + adjusted.brand.url;
23
+ }
24
+
25
+ if (adjusted.items) {
26
+ adjusted.items = adjusted.items.map(item => ({
27
+ ...item,
28
+ url: prefix + item.url
29
+ }));
30
+ }
31
+
32
+ if (adjusted.links) {
33
+ adjusted.links = adjusted.links.map(link => ({
34
+ ...link,
35
+ url: prefix + link.url
36
+ }));
49
37
  }
38
+
39
+ return adjusted;
50
40
  };
51
41
 
42
+ // Load navbar config and initialize
43
+ fetch(prefix + 'config/navbar.json')
44
+ .then(response => {
45
+ if (!response.ok) throw new Error(`Failed to load navbar.json: ${response.status}`);
46
+ return response.json();
47
+ })
48
+ .then(config => {
49
+ const navConfig = adjustUrls(config);
50
+ console.log('[App] Navbar config:', navConfig);
51
+ Domma.elements.navbar('#main-navbar', navConfig);
52
+ console.log('[App] Navbar initialized');
53
+ })
54
+ .catch(error => {
55
+ console.error('[App] Navbar error:', error);
56
+ });
57
+
58
+ // Load footer config and initialize
59
+ fetch(prefix + 'config/footer.json')
60
+ .then(response => {
61
+ if (!response.ok) throw new Error(`Failed to load footer.json: ${response.status}`);
62
+ return response.json();
63
+ })
64
+ .then(config => {
65
+ const footerConfig = adjustUrls(config);
66
+ const $footer = $('.page-footer');
67
+
68
+ if ($footer.length) {
69
+ const footerHTML = `
70
+ <div class="container py-4">
71
+ <div class="d-flex justify-content-between align-items-center flex-wrap gap-3">
72
+ <p class="mb-0 text-secondary">${footerConfig.copyright}</p>
73
+ <nav class="d-flex gap-3">
74
+ ${footerConfig.links.map(link =>
75
+ `<a href="${link.url}" class="text-secondary">${link.text}</a>`
76
+ ).join('')}
77
+ </nav>
78
+ </div>
79
+ </div>
80
+ `;
81
+ $footer.html(footerHTML);
82
+ console.log('[App] Footer initialized');
83
+ }
84
+ })
85
+ .catch(error => {
86
+ console.error('[App] Footer error:', error);
87
+ });
88
+
52
89
  // Initialize theme
53
90
  if (Domma.theme) {
54
91
  Domma.theme.init({
@@ -56,13 +93,9 @@ $(() => {
56
93
  persist: true,
57
94
  autoDetect: false
58
95
  });
59
- console.log('[App] Theme initialized: {{theme}}');
96
+ console.log('[App] Theme initialized');
60
97
  }
61
98
 
62
- // Initialize components
63
- initNavbar();
64
- initFooter();
65
-
66
99
  // Scan for icons
67
100
  if (Domma.icons) {
68
101
  Domma.icons.scan();
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -223,8 +223,8 @@
223
223
  <!-- Domma JavaScript -->
224
224
  <script src="../../dist/domma/domma.min.js"></script>
225
225
 
226
- <!-- Layout System -->
227
- <script src="../../layouts/js/layout.js"></script>
226
+ <!-- App Initialization -->
227
+ <script src="../../js/app.js"></script>
228
228
  <!-- Page-specific Initialization -->
229
229
  <script src="about.js"></script>
230
230
  </body>
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -216,8 +216,8 @@
216
216
  <!-- Domma JavaScript -->
217
217
  <script src="../../dist/domma/domma.min.js"></script>
218
218
 
219
- <!-- Layout System -->
220
- <script src="../../layouts/js/layout.js"></script>
219
+ <!-- App Initialization -->
220
+ <script src="../../js/app.js"></script>
221
221
  <!-- Page-specific Initialization -->
222
222
  <script src="blog.js"></script>
223
223
  </body>
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -192,8 +192,8 @@
192
192
  <!-- Domma JavaScript -->
193
193
  <script src="../../dist/domma/domma.min.js"></script>
194
194
 
195
- <!-- Layout System -->
196
- <script src="../../layouts/js/layout.js"></script>
195
+ <!-- App Initialization -->
196
+ <script src="../../js/app.js"></script>
197
197
 
198
198
  <!-- Form Handling -->
199
199
  <!-- Page-specific Initialization -->
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -378,8 +378,8 @@
378
378
  <!-- Domma JavaScript -->
379
379
  <script src="../../dist/domma/domma.min.js"></script>
380
380
 
381
- <!-- Layout System -->
382
- <script src="../../layouts/js/layout.js"></script>
381
+ <!-- Global App Initialization -->
382
+ <script src="../../js/app.js"></script>
383
383
 
384
384
  <!-- Page-specific Initialization -->
385
385
  <script src="cookies.js"></script>
@@ -42,7 +42,7 @@
42
42
  }
43
43
  </style>
44
44
  </head>
45
- <body class="dm-theme-{{theme}}" data-layout="public">
45
+ <body class="dm-theme-{{theme}}">
46
46
  <!-- Navigation -->
47
47
  <nav id="main-navbar"></nav>
48
48
 
@@ -290,8 +290,8 @@ Domma.theme.get(); // 'ocean-dark'</code></pre>
290
290
  <script src="../../dist/domma/domma.min.js"></script>
291
291
  <script src="../../dist/domma/domma-syntax.min.js"></script>
292
292
 
293
- <!-- Layout System -->
294
- <script src="../../layouts/js/layout.js"></script>
293
+ <!-- App Initialization -->
294
+ <script src="../../js/app.js"></script>
295
295
 
296
296
  <!-- Page-specific scripts -->
297
297
  <!-- Page-specific Initialization -->
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../css/custom.css">
16
16
  </head>
17
- <body class="dm-cloaked dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-cloaked dm-theme-{{theme}}">
18
18
  <!-- Navigation (initialized by app.js) -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -145,8 +145,8 @@
145
145
  <!-- Domma JavaScript -->
146
146
  <script src="../dist/domma/domma.min.js"></script>
147
147
 
148
- <!-- Layout System -->
149
- <script src="../layouts/js/layout.js"></script>
148
+ <!-- Global App Initialization -->
149
+ <script src="../js/app.js"></script>
150
150
 
151
151
  <!-- Page-specific Initialization -->
152
152
  <script src="index.js"></script>
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -271,8 +271,8 @@
271
271
  <!-- Domma JavaScript -->
272
272
  <script src="../../dist/domma/domma.min.js"></script>
273
273
 
274
- <!-- Layout System -->
275
- <script src="../../layouts/js/layout.js"></script>
274
+ <!-- Global App Initialization -->
275
+ <script src="../../js/app.js"></script>
276
276
 
277
277
  <!-- Page-specific Initialization -->
278
278
  <script src="privacy.js"></script>
@@ -14,7 +14,7 @@
14
14
  <!-- Custom CSS -->
15
15
  <link rel="stylesheet" href="../../css/custom.css">
16
16
  </head>
17
- <body class="dm-theme-{{theme}}" data-layout="public">
17
+ <body class="dm-theme-{{theme}}">
18
18
  <!-- Navigation -->
19
19
  <nav id="main-navbar"></nav>
20
20
 
@@ -366,8 +366,8 @@
366
366
  <!-- Domma JavaScript -->
367
367
  <script src="../../dist/domma/domma.min.js"></script>
368
368
 
369
- <!-- Layout System -->
370
- <script src="../../layouts/js/layout.js"></script>
369
+ <!-- Global App Initialization -->
370
+ <script src="../../js/app.js"></script>
371
371
 
372
372
  <!-- Page-specific Initialization -->
373
373
  <script src="terms.js"></script>
@@ -1,25 +0,0 @@
1
- {
2
- "class": "page-footer",
3
- "layout": "nav",
4
- "content": {
5
- "left": "© {{year}} {{projectName}}. All rights reserved.",
6
- "nav": [
7
- {
8
- "text": "Privacy Policy",
9
- "url": "privacy/index.html"
10
- },
11
- {
12
- "text": "Cookie Policy",
13
- "url": "cookies/index.html"
14
- },
15
- {
16
- "text": "Terms of Service",
17
- "url": "terms/index.html"
18
- },
19
- {
20
- "text": "Contact Us",
21
- "url": "contact/index.html"
22
- }
23
- ]
24
- }
25
- }
@@ -1,30 +0,0 @@
1
- {
2
- "type": "flat",
3
- "items": [
4
- {
5
- "text": "Home",
6
- "url": "index.html",
7
- "page": "home"
8
- },
9
- {
10
- "text": "About",
11
- "url": "about/index.html",
12
- "page": "about"
13
- },
14
- {
15
- "text": "Blog",
16
- "url": "blog/index.html",
17
- "page": "blog"
18
- },
19
- {
20
- "text": "Docs",
21
- "url": "docs/index.html",
22
- "page": "docs"
23
- },
24
- {
25
- "text": "Contact",
26
- "url": "contact/index.html",
27
- "page": "contact"
28
- }
29
- ]
30
- }
@@ -1,27 +0,0 @@
1
- {
2
- "public": {
3
- "navbar": {
4
- "type": "flat",
5
- "brand": {
6
- "text": "{{projectName}}",
7
- "url": "index.html"
8
- },
9
- "items": "nav-public",
10
- "variant": "dark",
11
- "position": "sticky",
12
- "collapsible": true
13
- },
14
- "footer": "footer-public",
15
- "sidebar": {
16
- "enabled": false
17
- },
18
- "theme": {
19
- "toggle": false,
20
- "variantSelector": false
21
- },
22
- "snow": {
23
- "toggle": false
24
- },
25
- "features": ["back-to-top", "icon-scan"]
26
- }
27
- }