@nuraly/lumenjs 0.1.4 → 0.3.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.
Files changed (96) hide show
  1. package/README.md +48 -7
  2. package/dist/auth/native-auth.d.ts +9 -0
  3. package/dist/auth/native-auth.js +49 -2
  4. package/dist/auth/routes/login.js +24 -1
  5. package/dist/auth/routes/totp.d.ts +22 -0
  6. package/dist/auth/routes/totp.js +232 -0
  7. package/dist/auth/routes.js +14 -0
  8. package/dist/auth/token.js +2 -2
  9. package/dist/build/build-markdown.d.ts +15 -0
  10. package/dist/build/build-markdown.js +90 -0
  11. package/dist/build/build-server.d.ts +2 -1
  12. package/dist/build/build-server.js +12 -4
  13. package/dist/build/build.js +46 -5
  14. package/dist/build/scan.d.ts +1 -0
  15. package/dist/build/scan.js +2 -1
  16. package/dist/build/serve-static.js +2 -1
  17. package/dist/build/serve.js +131 -11
  18. package/dist/dev-server/config.js +18 -1
  19. package/dist/dev-server/index-html.d.ts +1 -0
  20. package/dist/dev-server/index-html.js +4 -1
  21. package/dist/dev-server/plugins/vite-plugin-llms.js +1 -0
  22. package/dist/dev-server/plugins/vite-plugin-loaders.d.ts +4 -3
  23. package/dist/dev-server/plugins/vite-plugin-loaders.js +4 -3
  24. package/dist/dev-server/plugins/vite-plugin-routes.js +3 -2
  25. package/dist/dev-server/plugins/vite-plugin-virtual-modules.js +34 -6
  26. package/dist/dev-server/server.js +146 -88
  27. package/dist/dev-server/ssr-render.js +10 -2
  28. package/dist/editor/ai/backend.js +11 -2
  29. package/dist/editor/ai/deepseek-client.d.ts +7 -0
  30. package/dist/editor/ai/deepseek-client.js +113 -0
  31. package/dist/editor/ai/opencode-client.d.ts +1 -1
  32. package/dist/editor/ai/opencode-client.js +21 -47
  33. package/dist/editor/ai/types.d.ts +1 -1
  34. package/dist/editor/ai/types.js +2 -2
  35. package/dist/editor/ai-chat-panel.js +27 -1
  36. package/dist/editor/editor-bridge.js +2 -1
  37. package/dist/editor/overlay-hmr.js +2 -1
  38. package/dist/llms/generate.d.ts +15 -1
  39. package/dist/llms/generate.js +54 -44
  40. package/dist/runtime/app-shell.d.ts +1 -1
  41. package/dist/runtime/app-shell.js +1 -0
  42. package/dist/runtime/communication.d.ts +65 -36
  43. package/dist/runtime/communication.js +117 -57
  44. package/dist/runtime/island.d.ts +16 -0
  45. package/dist/runtime/island.js +80 -0
  46. package/dist/runtime/router-hydration.js +9 -2
  47. package/dist/runtime/router.d.ts +3 -1
  48. package/dist/runtime/router.js +51 -3
  49. package/dist/runtime/webrtc.d.ts +44 -0
  50. package/dist/runtime/webrtc.js +263 -13
  51. package/dist/shared/dom-shims.js +4 -2
  52. package/dist/shared/html-to-markdown.d.ts +6 -0
  53. package/dist/shared/html-to-markdown.js +73 -0
  54. package/dist/shared/types.d.ts +1 -0
  55. package/dist/storage/adapters/s3.js +6 -3
  56. package/package.json +33 -7
  57. package/templates/blog/pages/index.ts +3 -3
  58. package/templates/blog/pages/posts/[slug].ts +17 -6
  59. package/templates/blog/pages/tag/[tag].ts +6 -6
  60. package/templates/dashboard/pages/index.ts +7 -7
  61. package/templates/default/pages/index.ts +3 -3
  62. package/templates/social/api/posts/[id].ts +0 -14
  63. package/templates/social/api/posts.ts +0 -11
  64. package/templates/social/api/profile/[username].ts +0 -10
  65. package/templates/social/api/upload.ts +0 -19
  66. package/templates/social/data/migrations/001_init.sql +0 -78
  67. package/templates/social/data/migrations/002_add_image_url.sql +0 -1
  68. package/templates/social/data/migrations/003_auth.sql +0 -7
  69. package/templates/social/docs/architecture.md +0 -76
  70. package/templates/social/docs/components.md +0 -100
  71. package/templates/social/docs/data.md +0 -89
  72. package/templates/social/docs/pages.md +0 -96
  73. package/templates/social/docs/theming.md +0 -52
  74. package/templates/social/lib/media.ts +0 -130
  75. package/templates/social/lumenjs.auth.ts +0 -21
  76. package/templates/social/lumenjs.config.ts +0 -3
  77. package/templates/social/package.json +0 -5
  78. package/templates/social/pages/_layout.ts +0 -239
  79. package/templates/social/pages/apps/[id].ts +0 -173
  80. package/templates/social/pages/apps/index.ts +0 -116
  81. package/templates/social/pages/auth/login.ts +0 -92
  82. package/templates/social/pages/bookmarks.ts +0 -57
  83. package/templates/social/pages/explore.ts +0 -73
  84. package/templates/social/pages/index.ts +0 -351
  85. package/templates/social/pages/messages.ts +0 -298
  86. package/templates/social/pages/new.ts +0 -77
  87. package/templates/social/pages/notifications.ts +0 -73
  88. package/templates/social/pages/post/[id].ts +0 -124
  89. package/templates/social/pages/profile/[username].ts +0 -100
  90. package/templates/social/pages/settings/accessibility.ts +0 -153
  91. package/templates/social/pages/settings/account.ts +0 -260
  92. package/templates/social/pages/settings/help.ts +0 -141
  93. package/templates/social/pages/settings/language.ts +0 -103
  94. package/templates/social/pages/settings/privacy.ts +0 -183
  95. package/templates/social/pages/settings/security.ts +0 -133
  96. package/templates/social/pages/settings.ts +0 -185
@@ -1,185 +0,0 @@
1
- import { LitElement, html, css } from 'lit';
2
-
3
- const svg = {
4
- user: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`,
5
- lock: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>`,
6
- bell: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 01-3.46 0"/></svg>`,
7
- eye: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>`,
8
- palette: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="8" r="1.5" fill="currentColor"/><circle cx="8" cy="12" r="1.5" fill="currentColor"/><circle cx="16" cy="12" r="1.5" fill="currentColor"/><circle cx="12" cy="16" r="1.5" fill="currentColor"/></svg>`,
9
- globe: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"/></svg>`,
10
- shield: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg>`,
11
- help: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>`,
12
- logout: html`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" y1="12" x2="9" y2="12"/></svg>`,
13
- chevron: html`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>`,
14
- };
15
-
16
- export async function loader() {
17
- return {
18
- profile: {
19
- display_name: 'Aymen Labidi',
20
- username: 'aymen',
21
- email: 'aymen@nuraly.io',
22
- avatar: 'https://avatars.githubusercontent.com/u/3775924?v=4',
23
- },
24
- };
25
- }
26
-
27
- export class PageSettings extends LitElement {
28
- static properties = { loaderData: { type: Object }, _dark: { state: true } };
29
- loaderData: any = {};
30
- _dark: boolean = typeof localStorage !== 'undefined' && localStorage.getItem('theme') === 'dark';
31
-
32
- static styles = css`
33
- :host { display: block; }
34
- .card { background: var(--bg); border-radius: 6px; border: 1px solid var(--border); overflow: hidden; margin-bottom: 12px; }
35
- h2 { font-size: 20px; font-weight: 700; padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border-light); }
36
-
37
- /* Profile card */
38
- .profile-card { display: flex; gap: 14px; padding: 20px; align-items: center; }
39
- .profile-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
40
- .profile-info { flex: 1; }
41
- .profile-name { font-size: 16px; font-weight: 700; }
42
- .profile-email { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
43
- .profile-handle { font-size: 13px; color: var(--text-secondary); }
44
- .edit-btn { padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text); }
45
- .edit-btn:hover { background: var(--bg-secondary); }
46
-
47
- /* Menu items */
48
- .menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14px; text-decoration: none; }
49
- .menu-item:last-child { border-bottom: none; }
50
- .menu-item:hover { background: var(--bg-secondary); }
51
- .menu-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; }
52
- .menu-body { flex: 1; }
53
- .menu-label { font-weight: 600; }
54
- .menu-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
55
- .menu-chevron { color: var(--text-tertiary); }
56
- .menu-item.danger { color: #e53935; }
57
- .menu-item.danger .menu-icon { background: #fef2f2; color: #e53935; }
58
-
59
- /* Toggle */
60
- .toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
61
- .toggle-row:last-child { border-bottom: none; }
62
- .toggle-label { font-size: 14px; font-weight: 500; }
63
- .toggle-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
64
- .toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
65
- .toggle input { opacity: 0; width: 0; height: 0; }
66
- .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: 0.2s; }
67
- .toggle-slider:before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: var(--bg); border-radius: 50%; transition: 0.2s; }
68
- .toggle input:checked + .toggle-slider { background: var(--accent); }
69
- .toggle input:checked + .toggle-slider:before { transform: translateX(18px); }
70
-
71
- .section-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; padding: 12px 20px 6px; }
72
- `;
73
-
74
- render() {
75
- const profile = this.loaderData.profile || {};
76
- return html`
77
- <div class="card">
78
- <h2>Settings</h2>
79
- <div class="profile-card">
80
- <img class="profile-avatar" src="${profile.avatar}" alt="">
81
- <div class="profile-info">
82
- <div class="profile-name">${profile.display_name}</div>
83
- <div class="profile-handle">@${profile.username}</div>
84
- <div class="profile-email">${profile.email}</div>
85
- </div>
86
- <a class="edit-btn" href="/settings/account">Edit profile</a>
87
- </div>
88
- </div>
89
-
90
- <div class="card">
91
- <div class="section-title">Account</div>
92
- <a class="menu-item" href="/settings/account">
93
- <div class="menu-icon">${svg.user}</div>
94
- <div class="menu-body">
95
- <div class="menu-label">Account information</div>
96
- <div class="menu-desc">Username, email, phone number</div>
97
- </div>
98
- <span class="menu-chevron">${svg.chevron}</span>
99
- </a>
100
- <a class="menu-item" href="/settings/security">
101
- <div class="menu-icon">${svg.lock}</div>
102
- <div class="menu-body">
103
- <div class="menu-label">Password and security</div>
104
- <div class="menu-desc">Password, two-factor authentication</div>
105
- </div>
106
- <span class="menu-chevron">${svg.chevron}</span>
107
- </a>
108
- <a class="menu-item" href="/settings/privacy">
109
- <div class="menu-icon">${svg.shield}</div>
110
- <div class="menu-body">
111
- <div class="menu-label">Privacy and safety</div>
112
- <div class="menu-desc">Control who can see your content</div>
113
- </div>
114
- <span class="menu-chevron">${svg.chevron}</span>
115
- </a>
116
- </div>
117
-
118
- <div class="card">
119
- <div class="section-title">Preferences</div>
120
- <div class="toggle-row">
121
- <div>
122
- <div class="toggle-label">Dark mode</div>
123
- <div class="toggle-desc">Switch between light and dark theme</div>
124
- </div>
125
- <label class="toggle"><input type="checkbox" .checked=${this._dark} @change=${(e: Event) => { this._dark = (e.target as HTMLInputElement).checked; (window as any).__nk_toggle_theme?.(this._dark); }}><span class="toggle-slider"></span></label>
126
- </div>
127
- <div class="toggle-row">
128
- <div>
129
- <div class="toggle-label">Push notifications</div>
130
- <div class="toggle-desc">Receive push notifications on this device</div>
131
- </div>
132
- <label class="toggle"><input type="checkbox" checked><span class="toggle-slider"></span></label>
133
- </div>
134
- <div class="toggle-row">
135
- <div>
136
- <div class="toggle-label">Email notifications</div>
137
- <div class="toggle-desc">Receive email about activity and updates</div>
138
- </div>
139
- <label class="toggle"><input type="checkbox" checked><span class="toggle-slider"></span></label>
140
- </div>
141
- <div class="toggle-row">
142
- <div>
143
- <div class="toggle-label">Sound effects</div>
144
- <div class="toggle-desc">Play sounds for notifications and messages</div>
145
- </div>
146
- <label class="toggle"><input type="checkbox"><span class="toggle-slider"></span></label>
147
- </div>
148
- </div>
149
-
150
- <div class="card">
151
- <div class="section-title">More</div>
152
- <a class="menu-item" href="/settings/accessibility">
153
- <div class="menu-icon">${svg.eye}</div>
154
- <div class="menu-body">
155
- <div class="menu-label">Accessibility</div>
156
- <div class="menu-desc">Font size, color contrast, motion</div>
157
- </div>
158
- <span class="menu-chevron">${svg.chevron}</span>
159
- </a>
160
- <a class="menu-item" href="/settings/language">
161
- <div class="menu-icon">${svg.globe}</div>
162
- <div class="menu-body">
163
- <div class="menu-label">Language</div>
164
- <div class="menu-desc">English</div>
165
- </div>
166
- <span class="menu-chevron">${svg.chevron}</span>
167
- </a>
168
- <a class="menu-item" href="/settings/help">
169
- <div class="menu-icon">${svg.help}</div>
170
- <div class="menu-body">
171
- <div class="menu-label">Help center</div>
172
- </div>
173
- <span class="menu-chevron">${svg.chevron}</span>
174
- </a>
175
- <div class="menu-item danger">
176
- <div class="menu-icon">${svg.logout}</div>
177
- <div class="menu-body">
178
- <div class="menu-label">Log out</div>
179
- </div>
180
- <span class="menu-chevron">${svg.chevron}</span>
181
- </div>
182
- </div>
183
- `;
184
- }
185
- }