asjs-express 1.4.1 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asjs-express",
3
- "version": "1.4.1",
3
+ "version": "1.6.0",
4
4
  "description": "Lightweight Express view engine with EJS-like templates, layouts, async page rendering, form enhancement, and a built-in client router.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -8,8 +8,15 @@ const asjs = setupAsjs(app, {
8
8
  rootDir: __dirname,
9
9
  defaultLayout: 'layouts/main',
10
10
  navItems: [
11
- { href: '/', label: 'Home', activeMode: 'exact' }
11
+ { href: '/', label: 'Home', activeMode: 'exact' },
12
+ { href: '/about', label: 'About', activeMode: 'exact' }
12
13
  ],
14
+ brand: {
15
+ href: '/',
16
+ mark: '__APP_INITIALS__',
17
+ name: '__APP_TITLE__',
18
+ tagline: 'Built with ASJS + Express'
19
+ },
13
20
  transitions: 'fade',
14
21
  prefetch: true,
15
22
  loadingBar: true
@@ -17,13 +24,45 @@ const asjs = setupAsjs(app, {
17
24
 
18
25
  app.get('/', asjs.page('home', {
19
26
  title: '__APP_TITLE__',
20
- headline: '__APP_TITLE__ is ready.',
21
- description: 'Header, router, loading bar, and SPA-ready page transitions are already connected.',
22
- nextStep: 'Add a second route whenever you need it. ASJS will keep the same internal navigation flow.'
27
+ headline: 'Welcome to __APP_TITLE__',
28
+ description: 'A starter built with ASJS and Express. SPA navigation, smooth transitions, and server-rendered pages are ready out of the box.',
29
+ features: [
30
+ {
31
+ label: 'SPA Navigation',
32
+ text: 'Pages swap without a full reload. The header and layout stay in place while only the content changes.'
33
+ },
34
+ {
35
+ label: 'Server Rendering',
36
+ text: 'Each page is fully rendered on the server before it reaches the browser. Route data is prepared in the callback.'
37
+ },
38
+ {
39
+ label: 'Zero Build Step',
40
+ text: 'No bundler, no compiler. Write EJS-style templates and run with Node. It just works.'
41
+ }
42
+ ]
43
+ }));
44
+
45
+ app.get('/about', asjs.page('about', {
46
+ title: 'About — __APP_TITLE__',
47
+ headline: 'About __APP_TITLE__',
48
+ description: 'Built with ASJS on top of Express. Layouts, async page models, client-side transitions, and a loading bar — without a front-end build step.',
49
+ facts: [
50
+ { label: 'Engine', value: 'ASJS __ASJS_VERSION__' },
51
+ { label: 'Framework', value: 'Express' },
52
+ { label: 'Rendering', value: 'Server-first' },
53
+ { label: 'Templates', value: 'EJS syntax' }
54
+ ],
55
+ capabilities: [
56
+ 'Shared layouts with a consistent header and navigation across all pages',
57
+ 'SPA navigation with smooth page transitions and a top loading bar',
58
+ 'Async route callbacks that prepare data before the HTML is rendered',
59
+ 'Form progressive enhancement with server-side validation',
60
+ 'Plugin and hook API for attaching middleware and shared services'
61
+ ]
23
62
  }));
24
63
 
25
64
  app.use(asjs.errors());
26
65
 
27
66
  app.listen(port, () => {
28
- console.log(`__APP_TITLE__ running at http://localhost:${port}`);
67
+ console.log('__APP_TITLE__ running at http://localhost:' + port);
29
68
  });
@@ -0,0 +1,27 @@
1
+ <div class="page-intro">
2
+ <span class="section-label">About</span>
3
+ <h1><%= headline %></h1>
4
+ <p><%= description %></p>
5
+ </div>
6
+
7
+ <div class="render-summary-grid render-summary-grid--wide">
8
+ <% facts.forEach(function(fact) { %>
9
+ <div class="render-item">
10
+ <span><%= fact.label %></span>
11
+ <strong><%= fact.value %></strong>
12
+ </div>
13
+ <% }) %>
14
+ </div>
15
+
16
+ <div class="section-card">
17
+ <span class="section-label">Capabilities</span>
18
+ <h2>What ASJS provides</h2>
19
+ <ul class="check-list">
20
+ <% capabilities.forEach(function(cap) { %>
21
+ <li><%= cap %></li>
22
+ <% }) %>
23
+ </ul>
24
+ <div class="hero-actions" style="margin-top: 24px;">
25
+ <a href="/" class="button button-primary" data-asjs-transition="fade">Back to home</a>
26
+ </div>
27
+ </div>
@@ -1,5 +1,32 @@
1
- <section style="max-width: 720px; margin: 40px auto; padding: 24px;">
1
+ <div class="page-intro">
2
+ <span class="section-label">Starter</span>
2
3
  <h1><%= headline %></h1>
3
4
  <p><%= description %></p>
4
- <p><%= nextStep %></p>
5
- </section>
5
+ <div class="hero-actions">
6
+ <a href="/about" class="button button-primary" data-asjs-transition="fade">Learn more</a>
7
+ </div>
8
+ </div>
9
+
10
+ <div class="section-card">
11
+ <span class="section-label">What's included</span>
12
+ <h2>Built-in from the start</h2>
13
+ <div class="card-grid" style="margin-top: 16px;">
14
+ <% features.forEach(function(feature) { %>
15
+ <div class="info-card">
16
+ <h3><%= feature.label %></h3>
17
+ <p><%= feature.text %></p>
18
+ </div>
19
+ <% }) %>
20
+ </div>
21
+ </div>
22
+
23
+ <div class="section-card code-panel">
24
+ <span class="section-label">Quick start</span>
25
+ <h2>Add a new page in three lines</h2>
26
+ <p>Open <code>app.js</code> and add a route. ASJS handles the layout, navigation state, and transitions automatically.</p>
27
+ <pre class="code-block">app.get('/new-page', asjs.page('new-page', {
28
+ title: 'New page',
29
+ headline: 'Hello from a new page'
30
+ }));</pre>
31
+ <p style="margin-top: 14px;">Then create <code>views/new-page.asjs</code> with your HTML. The layout, header, and navigation are inherited.</p>
32
+ </div>
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -8,9 +8,15 @@
8
8
  </head>
9
9
  <body<%- asjs.bodyAttrs() %>>
10
10
  <%- asjs.progressMarkup() %>
11
- <%- asjs.header() %>
12
- <main class="view-frame"<%- asjs.viewAttrs() %>>
13
- <%- body %>
14
- </main>
11
+ <div class="page-shell">
12
+ <%- asjs.header() %>
13
+ <main class="view-frame"<%- asjs.viewAttrs() %>>
14
+ <%- body %>
15
+ </main>
16
+ <footer class="footer">
17
+ <span>Built with <strong>ASJS __ASJS_VERSION__</strong> + Express</span>
18
+ <span>&copy; __YEAR__ __APP_TITLE__</span>
19
+ </footer>
20
+ </div>
15
21
  </body>
16
22
  </html>