kreftjs 0.0.6-beta → 0.0.7-beta
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/README.md +1 -1
- package/bin/build.js +1 -1
- package/bin/no-auth.js +3 -1
- package/docs/README.md +2 -1
- package/kreftjs.d.ts +1 -1
- package/kreftjs.js +2 -2
- package/package.json +1 -1
- package/templates/app/README.md +1 -1
- package/templates/app/_env.example +2 -0
- package/templates/app/frontend/errors/ErrorMonitor.kreftjs +5 -3
- package/templates/app/frontend/kreftjs.d.ts +1 -1
- package/templates/app/frontend/kreftjs.js +2 -2
- package/templates/app/frontend/layouts/app.kreftjs +7 -1
- package/templates/app/frontend/pages/Dashboard.kreftjs +4 -2
- package/templates/app/frontend/pages/Home.kreftjs +8 -7
- package/templates/errors/ErrorMonitor.kreftjs +5 -3
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ Views are escaped, logins use HttpOnly cookies with CSRF protection, passwords u
|
|
|
75
75
|
|
|
76
76
|
## Migrating from Som.js
|
|
77
77
|
|
|
78
|
-
Kreft is Som.js under a new name: the package is `kreftjs` (version 0.0.
|
|
78
|
+
Kreft is Som.js under a new name: the package is `kreftjs` (version 0.0.7-beta), the command is `kreft` (`kreftjs` works too), the global is `Kreftjs` and component files end in `.kreftjs`. The old names keep working, so an existing project runs without edits. New files and everything the tools write use the new names. Move over when it suits you. (`kreft` was an earlier spelling of the new name; it is accepted in the same places.)
|
|
79
79
|
|
|
80
80
|
| Som.js | Kreft | Still works? |
|
|
81
81
|
|---|---|---|
|
package/bin/build.js
CHANGED
|
@@ -31,7 +31,7 @@ const deps = require('./deps.js');
|
|
|
31
31
|
// component files: .kreftjs, or .kreft / .som in an older project
|
|
32
32
|
const isComp = (f) => /\.(?:kreftjs|kreft|som)$/i.test(f);
|
|
33
33
|
const SERVER_DIRS = new Set();
|
|
34
|
-
const SKIP = new Set(['node_modules', '.git', '.vscode', '.idea', 'package.json', 'package-lock.json', '.DS_Store']);
|
|
34
|
+
const SKIP = new Set(['node_modules', 'dist', 'dist-electron', '.git', '.vscode', '.idea', 'package.json', 'package-lock.json', '.DS_Store']);
|
|
35
35
|
|
|
36
36
|
module.exports = function build(args) {
|
|
37
37
|
let folder = null, out = null, base = null, prerender = null, urlsFile = null, htaccess = true;
|
package/bin/no-auth.js
CHANGED
|
@@ -75,6 +75,8 @@ Route.prefix('/tests').name('tests.').group(() => {
|
|
|
75
75
|
`;
|
|
76
76
|
|
|
77
77
|
const LAYOUT = (todos) => `<!-- The default layout: a slim bar and the page. Every route without .layout(…) uses it (see index.html). -->
|
|
78
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
79
|
+
|
|
78
80
|
<view>
|
|
79
81
|
<header>
|
|
80
82
|
<kreft-link to="/" class="brand"><span class="mark" aria-hidden="true"></span>{env.PUBLIC_APP_NAME || 'My app'}</kreft-link>
|
|
@@ -83,7 +85,7 @@ const LAYOUT = (todos) => `<!-- The default layout: a slim bar and the page. Eve
|
|
|
83
85
|
<kreft-link to="/todos" exact-class="here">Todos</kreft-link>` : ''}
|
|
84
86
|
<kreft-link to="/error-monitor" exact-class="here">Error monitor</kreft-link>
|
|
85
87
|
<kreft-link to="/tests" exact-class="here">Tests</kreft-link>
|
|
86
|
-
<
|
|
88
|
+
<a href={docs + '/docs'} target="_blank" rel="noopener">Docs</a>
|
|
87
89
|
<button type="button" class="theme" @click="theme.toggle()" aria-label="Toggle theme" title="Toggle theme">
|
|
88
90
|
<span k-if="theme.dark">☀</span><span k-else>🌙</span>
|
|
89
91
|
</button>
|
package/docs/README.md
CHANGED
|
@@ -82,7 +82,7 @@ npx kreftjs dev
|
|
|
82
82
|
### Check that it works
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
kreft --version # for example 0.0.
|
|
85
|
+
kreft --version # for example 0.0.7-beta
|
|
86
86
|
kreft about # Kreft and Node.js versions, this project's settings and drivers
|
|
87
87
|
kreft list # every command your version has
|
|
88
88
|
```
|
|
@@ -2267,6 +2267,7 @@ Set these in `.env` (never commit it). Variables that start with `PUBLIC_` are c
|
|
|
2267
2267
|
| `LOGIN_MAX_FAILURES`, `LOGIN_WINDOW_SECONDS` | 10, 900 | Wrong passwords per account before a lockout. |
|
|
2268
2268
|
| `TWO_FACTOR_MAX_FAILURES` | 8 | Wrong two-factor codes per account before a lockout. |
|
|
2269
2269
|
| `PUBLIC_SESSION_TIMEOUT`, `PUBLIC_SESSION_WARNING` | 15, 2 | Minutes of page inactivity before sign-out, and the warning before it. |
|
|
2270
|
+
| `PUBLIC_DOCS_URL` | `http://kreftjs.com` | Where the "Documentation" links of a new app's pages go. Change it to `https://…` or to your own site. |
|
|
2270
2271
|
|
|
2271
2272
|
### Network and tools
|
|
2272
2273
|
|
package/kreftjs.d.ts
CHANGED
package/kreftjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Kreft v0.0.
|
|
2
|
+
* Kreft v0.0.7-beta — reactive by nature
|
|
3
3
|
* The .kreftjs component language (state · derive · action · when · watch · on),
|
|
4
4
|
* { } views with k-if / k-each / k-model, components, slots, router, stores,
|
|
5
5
|
* share / receive, event bus and a template engine.
|
|
@@ -5032,7 +5032,7 @@
|
|
|
5032
5032
|
stores, storeLog, busLog,
|
|
5033
5033
|
};
|
|
5034
5034
|
|
|
5035
|
-
const VERSION = '0.0.
|
|
5035
|
+
const VERSION = '0.0.7-beta';
|
|
5036
5036
|
const Kreftjs = {
|
|
5037
5037
|
version: VERSION,
|
|
5038
5038
|
// PUBLIC_ values from .env (kreft dev and kreft build put them here); never secrets
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kreftjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7-beta",
|
|
4
4
|
"description": "A tiny reactive framework with its own component language (.kreftjs files): router with nested routes, stores, saved data, animations, an API client, hot reload, DevTools and a template engine.",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"main": "kreftjs.js",
|
package/templates/app/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Your project cleanly isolates client-side UI (`frontend/`) from server-side busi
|
|
|
28
28
|
│ ├── pages/ # Route views (Home, Dashboard, Users, Profile, auth/*)
|
|
29
29
|
│ ├── components/ # Reusable widgets (Field.kreftjs, StatCard.kreftjs, profile/*)
|
|
30
30
|
│ ├── errors/ # Custom HTTP error views (404.kreftjs, 500.kreftjs, ErrorMonitor.kreftjs)
|
|
31
|
-
│ ├── docs/ # Built-in documentation (
|
|
31
|
+
│ ├── docs/ # Built-in copy of the documentation (at /docs); the pages link to PUBLIC_DOCS_URL, http://kreftjs.com
|
|
32
32
|
│ └── ui.css # Design system tokens & component styles
|
|
33
33
|
│
|
|
34
34
|
├── backend/ # Private server engine (never exposed or built into dist/)
|
|
@@ -11,6 +11,8 @@ APP_URL=http://localhost:8000
|
|
|
11
11
|
# Only values that start with PUBLIC_ also reach the browser: {env.PUBLIC_APP_NAME} in any .kreftjs file.
|
|
12
12
|
# Never put a password or a secret key in a PUBLIC_ value.
|
|
13
13
|
PUBLIC_APP_NAME="${APP_NAME}"
|
|
14
|
+
# Where the "Documentation" links of the pages go
|
|
15
|
+
PUBLIC_DOCS_URL="http://kreftjs.com"
|
|
14
16
|
|
|
15
17
|
# The database: sqlite:file.db, mysql://user:password@host:3306/name or postgres://user:password@host:5432/name
|
|
16
18
|
DATABASE_URL=sqlite:backend/database/app.db
|
|
@@ -82,6 +82,8 @@ action copyReport() {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
86
|
+
|
|
85
87
|
<view>
|
|
86
88
|
<div class="kreft-inspector">
|
|
87
89
|
<!-- Header Card -->
|
|
@@ -90,11 +92,11 @@ action copyReport() {
|
|
|
90
92
|
<div class="badges">
|
|
91
93
|
<span class="badge danger-badge">HTTP {status}</span>
|
|
92
94
|
<span class="badge solid">{currentTitle}</span>
|
|
93
|
-
<span class="badge">Kreft {Kreftjs.version || '0.0.
|
|
95
|
+
<span class="badge">Kreft {Kreftjs.version || '0.0.7-beta'}</span>
|
|
94
96
|
</div>
|
|
95
97
|
<div class="actions">
|
|
96
98
|
<button class="sm" @click={copyReport}>{copied ? 'Copied Markdown' : 'Copy Report'}</button>
|
|
97
|
-
<
|
|
99
|
+
<a href={docs + '/docs'} class="btn sm ghost" target="_blank" rel="noopener">Docs</a>
|
|
98
100
|
</div>
|
|
99
101
|
</div>
|
|
100
102
|
|
|
@@ -187,7 +189,7 @@ action copyReport() {
|
|
|
187
189
|
<h3>Kreft Runtime</h3>
|
|
188
190
|
<table>
|
|
189
191
|
<tbody>
|
|
190
|
-
<tr><th>Engine</th><td><code>Kreft v{Kreftjs.version || '0.0.
|
|
192
|
+
<tr><th>Engine</th><td><code>Kreft v{Kreftjs.version || '0.0.7-beta'}</code></td></tr>
|
|
191
193
|
<tr><th>Sanitizer</th><td><code>Active (cleanHtml / SafeHtml)</code></td></tr>
|
|
192
194
|
<tr><th>Environment</th><td><code>development (APP_DEBUG=true)</code></td></tr>
|
|
193
195
|
</tbody>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Kreft v0.0.
|
|
2
|
+
* Kreft v0.0.7-beta — reactive by nature
|
|
3
3
|
* The .kreftjs component language (state · derive · action · when · watch · on),
|
|
4
4
|
* { } views with k-if / k-each / k-model, components, slots, router, stores,
|
|
5
5
|
* share / receive, event bus and a template engine.
|
|
@@ -5032,7 +5032,7 @@
|
|
|
5032
5032
|
stores, storeLog, busLog,
|
|
5033
5033
|
};
|
|
5034
5034
|
|
|
5035
|
-
const VERSION = '0.0.
|
|
5035
|
+
const VERSION = '0.0.7-beta';
|
|
5036
5036
|
const Kreftjs = {
|
|
5037
5037
|
version: VERSION,
|
|
5038
5038
|
// PUBLIC_ values from .env (kreft dev and kreft build put them here); never secrets
|
|
@@ -11,6 +11,7 @@ state remainingMinutes = 5
|
|
|
11
11
|
state inactivityTimer = null
|
|
12
12
|
|
|
13
13
|
// SVG vector icon paths (24x24)
|
|
14
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
14
15
|
state icons = {
|
|
15
16
|
dashboard: 'M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z',
|
|
16
17
|
users: 'M16 19v-1a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v1M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7M21 19v-1a4 4 0 0 0-3-3.87M15.5 3.13a3.5 3.5 0 0 1 0 6.75',
|
|
@@ -33,7 +34,7 @@ state navGroups = [
|
|
|
33
34
|
{ label: 'Platform', links: [
|
|
34
35
|
{ to: 'welcome', label: 'Showcase', icon: 'showcase' },
|
|
35
36
|
{ to: 'error-monitor', label: 'Error Monitor', icon: 'panel' },
|
|
36
|
-
{
|
|
37
|
+
{ docs: '/docs', label: 'Documentation', icon: 'docs' },
|
|
37
38
|
{ to: 'tests.index', label: 'Test Suite', icon: 'tests' },
|
|
38
39
|
] },
|
|
39
40
|
]
|
|
@@ -130,7 +131,12 @@ action extendSession() {
|
|
|
130
131
|
<ul class="nav-list">
|
|
131
132
|
{for link in group.links}
|
|
132
133
|
<li>
|
|
134
|
+
<a k-if="link.docs" href={docs + link.docs} target="_blank" rel="noopener" title={collapsed ? link.label : null} class="nav-item">
|
|
135
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" class="nav-icon"><path d={icons[link.icon] || icons.panel}></path></svg>
|
|
136
|
+
<span class="nav-label">{link.label}</span>
|
|
137
|
+
</a>
|
|
133
138
|
<kreft-link
|
|
139
|
+
k-else
|
|
134
140
|
to={link.to}
|
|
135
141
|
exact-class={link.exact ? 'active-link' : 'kreft-link-exact'}
|
|
136
142
|
active-class={link.exact ? 'kreft-link-active' : 'active-link'}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
load stats = api.get('/api/admin/stats')
|
|
6
6
|
load board = api.get('/api/dashboard')
|
|
7
7
|
|
|
8
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
9
|
+
|
|
8
10
|
<view>
|
|
9
11
|
<div class="dashboard-page">
|
|
10
12
|
<div class="dashboard-header">
|
|
@@ -110,7 +112,7 @@ load board = api.get('/api/dashboard')
|
|
|
110
112
|
<div class="info-list">
|
|
111
113
|
<div class="info-item">
|
|
112
114
|
<span class="info-label">Framework Engine</span>
|
|
113
|
-
<span class="info-value">Kreft {Kreftjs.version || '0.0.
|
|
115
|
+
<span class="info-value">Kreft {Kreftjs.version || '0.0.7-beta'}</span>
|
|
114
116
|
</div>
|
|
115
117
|
<div class="info-item">
|
|
116
118
|
<span class="info-label">Active Database</span>
|
|
@@ -128,7 +130,7 @@ load board = api.get('/api/dashboard')
|
|
|
128
130
|
|
|
129
131
|
<div class="quick-nav-group">
|
|
130
132
|
<kreft-link to="/profile" class="btn secondary sm w-full">Edit Profile Settings</kreft-link>
|
|
131
|
-
<
|
|
133
|
+
<a href={docs + '/docs'} class="btn ghost sm w-full" target="_blank" rel="noopener">API Documentation</a>
|
|
132
134
|
<kreft-link to="/welcome" class="btn ghost sm w-full">Landing Page Showcase</kreft-link>
|
|
133
135
|
</div>
|
|
134
136
|
</section>
|
|
@@ -6,6 +6,7 @@ state count = 0
|
|
|
6
6
|
state copied = false
|
|
7
7
|
derive double = count * 2
|
|
8
8
|
|
|
9
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
9
10
|
state words = [
|
|
10
11
|
{ word: 'state', says: 'a value that can change', to: '/docs#components-and-the-kreftjs-file' },
|
|
11
12
|
{ word: 'saved', says: 'a value kept after a reload', to: '/docs#saving-data-in-the-browser' },
|
|
@@ -49,7 +50,7 @@ action copy() {
|
|
|
49
50
|
<header class="site-bar">
|
|
50
51
|
<kreft-link to="/" class="site-brand"><span class="site-mark" aria-hidden="true"></span>{env.PUBLIC_APP_NAME || 'Kreft'}</kreft-link>
|
|
51
52
|
<nav class="site-nav">
|
|
52
|
-
<
|
|
53
|
+
<a href={docs + '/docs'} target="_blank" rel="noopener">Documentation</a>
|
|
53
54
|
<kreft-link k-if="$store.auth.user" to="/dashboard">Dashboard</kreft-link>
|
|
54
55
|
<kreft-link k-if="!$store.auth.user" to="/login">Log in</kreft-link>
|
|
55
56
|
<kreft-link k-if="!$store.auth.user" to="/register" class="site-cta">Sign up</kreft-link>
|
|
@@ -77,10 +78,10 @@ action copy() {
|
|
|
77
78
|
|
|
78
79
|
<!-- CTA Buttons -->
|
|
79
80
|
<div class="cta-actions">
|
|
80
|
-
<
|
|
81
|
+
<a href={docs + '/docs'} class="pill-btn primary" target="_blank" rel="noopener">Read the docs</a>
|
|
81
82
|
<kreft-link k-if="$store.auth.user" to="/dashboard" class="pill-btn ghost">Open dashboard</kreft-link>
|
|
82
83
|
<kreft-link k-if="!$store.auth.user" to="/register" class="pill-btn ghost">Sign up</kreft-link>
|
|
83
|
-
<
|
|
84
|
+
<a href={docs + '/docs#your-first-app'} class="pill-btn ghost" target="_blank" rel="noopener">Quick start</a>
|
|
84
85
|
</div>
|
|
85
86
|
|
|
86
87
|
<!-- Badges Row -->
|
|
@@ -177,7 +178,7 @@ action copy() {
|
|
|
177
178
|
<h2>The whole language fits on one screen</h2>
|
|
178
179
|
<dl>
|
|
179
180
|
{for w in words key w.word}
|
|
180
|
-
<div><dt><
|
|
181
|
+
<div><dt><a href={docs + w.to} target="_blank" rel="noopener">{w.word}</a></dt><dd>{w.says}</dd></div>
|
|
181
182
|
{/for}
|
|
182
183
|
</dl>
|
|
183
184
|
</section>
|
|
@@ -186,7 +187,7 @@ action copy() {
|
|
|
186
187
|
<h2>Also in the box</h2>
|
|
187
188
|
<ul>
|
|
188
189
|
{for p in parts key p.title}
|
|
189
|
-
<li><
|
|
190
|
+
<li><a href={docs + p.to} target="_blank" rel="noopener"><strong>{p.title}</strong><span>{p.text}</span></a></li>
|
|
190
191
|
{/for}
|
|
191
192
|
</ul>
|
|
192
193
|
</section>
|
|
@@ -197,12 +198,12 @@ action copy() {
|
|
|
197
198
|
<code>kreft new my-app --db sqlite</code>
|
|
198
199
|
<button class="sm" @click={copy} aria-label="Copy the command">{copied ? 'Copied' : 'Copy'}</button>
|
|
199
200
|
</div>
|
|
200
|
-
<p>Then <code>cd my-app</code> and <code>npm run dev</code>. Coming from Vue? The <
|
|
201
|
+
<p>Then <code>cd my-app</code> and <code>npm run dev</code>. Coming from Vue? The <a href={docs + '/docs'} target="_blank" rel="noopener">docs</a> have a table with the Kreft name for every Vue feature.</p>
|
|
201
202
|
</section>
|
|
202
203
|
|
|
203
204
|
<footer class="site-foot">
|
|
204
205
|
<span>Kreft {Kreftjs.version}</span>
|
|
205
|
-
<
|
|
206
|
+
<a href={docs + '/docs'} target="_blank" rel="noopener">Docs</a>
|
|
206
207
|
<kreft-link to="/error-monitor">Error monitor</kreft-link>
|
|
207
208
|
</footer>
|
|
208
209
|
</div>
|
|
@@ -79,6 +79,8 @@ action copyReport() {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
state docs = (Kreftjs.env.PUBLIC_DOCS_URL || 'http://kreftjs.com').replace(/\/+$/, '') // where "Documentation" links go: PUBLIC_DOCS_URL in .env
|
|
83
|
+
|
|
82
84
|
<view>
|
|
83
85
|
<div class="error-monitor-wrapper">
|
|
84
86
|
<!-- Top Navigation Bar -->
|
|
@@ -99,10 +101,10 @@ action copyReport() {
|
|
|
99
101
|
</div>
|
|
100
102
|
|
|
101
103
|
<div class="nav-meta">
|
|
102
|
-
<
|
|
104
|
+
<a href={docs + '/docs'} class="nav-link-docs" target="_blank" rel="noopener">
|
|
103
105
|
<span class="tab-icon">📖</span>
|
|
104
106
|
<span>DOCS</span>
|
|
105
|
-
</
|
|
107
|
+
</a>
|
|
106
108
|
<button class="btn-copy-report" @click={copyReport}>
|
|
107
109
|
{copiedToast ? '✓ Copied' : 'Copy Report'}
|
|
108
110
|
</button>
|
|
@@ -116,7 +118,7 @@ action copyReport() {
|
|
|
116
118
|
<div class="hero-badges">
|
|
117
119
|
<span class="badge-exception">{currentTitle}</span>
|
|
118
120
|
<span class="badge-env">Node.js {typeof process !== 'undefined' ? process.version : 'v22.0.0'}</span>
|
|
119
|
-
<span class="badge-env">Kreft v0.0.
|
|
121
|
+
<span class="badge-env">Kreft v0.0.7-beta</span>
|
|
120
122
|
</div>
|
|
121
123
|
<h1 class="hero-error-message">{currentMessage}</h1>
|
|
122
124
|
</div>
|