@nuraly/lumenjs 0.1.3 → 0.2.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 (306) hide show
  1. package/README.md +62 -282
  2. package/dist/auth/config.d.ts +23 -0
  3. package/dist/auth/config.js +115 -0
  4. package/dist/auth/guard.d.ts +12 -0
  5. package/dist/auth/guard.js +28 -0
  6. package/dist/auth/index.d.ts +3 -0
  7. package/dist/auth/index.js +1 -0
  8. package/dist/auth/middleware.d.ts +23 -0
  9. package/dist/auth/middleware.js +89 -0
  10. package/dist/auth/native-auth.d.ts +82 -0
  11. package/dist/auth/native-auth.js +340 -0
  12. package/dist/auth/oidc-client.d.ts +17 -0
  13. package/dist/auth/oidc-client.js +123 -0
  14. package/dist/auth/providers/google.d.ts +23 -0
  15. package/dist/auth/providers/google.js +25 -0
  16. package/dist/auth/providers/index.d.ts +2 -0
  17. package/dist/auth/providers/index.js +1 -0
  18. package/dist/auth/routes/login.d.ts +8 -0
  19. package/dist/auth/routes/login.js +121 -0
  20. package/dist/auth/routes/logout.d.ts +4 -0
  21. package/dist/auth/routes/logout.js +79 -0
  22. package/dist/auth/routes/oidc-callback.d.ts +3 -0
  23. package/dist/auth/routes/oidc-callback.js +70 -0
  24. package/dist/auth/routes/password.d.ts +5 -0
  25. package/dist/auth/routes/password.js +149 -0
  26. package/dist/auth/routes/signup.d.ts +3 -0
  27. package/dist/auth/routes/signup.js +81 -0
  28. package/dist/auth/routes/token.d.ts +4 -0
  29. package/dist/auth/routes/token.js +70 -0
  30. package/dist/auth/routes/totp.d.ts +22 -0
  31. package/dist/auth/routes/totp.js +232 -0
  32. package/dist/auth/routes/utils.d.ts +7 -0
  33. package/dist/auth/routes/utils.js +35 -0
  34. package/dist/auth/routes/verify.d.ts +3 -0
  35. package/dist/auth/routes/verify.js +26 -0
  36. package/dist/auth/routes.d.ts +8 -0
  37. package/dist/auth/routes.js +124 -0
  38. package/dist/auth/session.d.ts +8 -0
  39. package/dist/auth/session.js +54 -0
  40. package/dist/auth/token.d.ts +33 -0
  41. package/dist/auth/token.js +90 -0
  42. package/dist/auth/types.d.ts +156 -0
  43. package/dist/auth/types.js +2 -0
  44. package/dist/build/build-client.d.ts +15 -0
  45. package/dist/build/build-client.js +45 -0
  46. package/dist/build/build-prerender.d.ts +11 -0
  47. package/dist/build/build-prerender.js +159 -0
  48. package/dist/build/build-server.d.ts +18 -0
  49. package/dist/build/build-server.js +107 -0
  50. package/dist/build/build.js +60 -123
  51. package/dist/build/scan.d.ts +18 -0
  52. package/dist/build/scan.js +77 -6
  53. package/dist/build/serve-api.js +8 -2
  54. package/dist/build/serve-loaders.d.ts +4 -4
  55. package/dist/build/serve-loaders.js +26 -18
  56. package/dist/build/serve-ssr.js +38 -11
  57. package/dist/build/serve-static.js +3 -3
  58. package/dist/build/serve.js +341 -18
  59. package/dist/cli.js +37 -6
  60. package/dist/communication/encryption.d.ts +35 -0
  61. package/dist/communication/encryption.js +90 -0
  62. package/dist/communication/handlers/context.d.ts +27 -0
  63. package/dist/communication/handlers/context.js +1 -0
  64. package/dist/communication/handlers/conversation.d.ts +24 -0
  65. package/dist/communication/handlers/conversation.js +113 -0
  66. package/dist/communication/handlers/file-upload.d.ts +17 -0
  67. package/dist/communication/handlers/file-upload.js +62 -0
  68. package/dist/communication/handlers/messaging.d.ts +30 -0
  69. package/dist/communication/handlers/messaging.js +237 -0
  70. package/dist/communication/handlers/presence.d.ts +15 -0
  71. package/dist/communication/handlers/presence.js +76 -0
  72. package/dist/communication/handlers.d.ts +5 -0
  73. package/dist/communication/handlers.js +5 -0
  74. package/dist/communication/index.d.ts +9 -0
  75. package/dist/communication/index.js +7 -0
  76. package/dist/communication/link-preview.d.ts +18 -0
  77. package/dist/communication/link-preview.js +115 -0
  78. package/dist/communication/schema.d.ts +10 -0
  79. package/dist/communication/schema.js +101 -0
  80. package/dist/communication/server.d.ts +86 -0
  81. package/dist/communication/server.js +212 -0
  82. package/dist/communication/signaling.d.ts +43 -0
  83. package/dist/communication/signaling.js +271 -0
  84. package/dist/communication/store.d.ts +71 -0
  85. package/dist/communication/store.js +289 -0
  86. package/dist/communication/types.d.ts +454 -0
  87. package/dist/communication/types.js +1 -0
  88. package/dist/create.d.ts +1 -0
  89. package/dist/create.js +55 -0
  90. package/dist/db/auto-migrate.d.ts +3 -0
  91. package/dist/db/auto-migrate.js +100 -0
  92. package/dist/db/client.d.ts +3 -0
  93. package/dist/db/client.js +18 -0
  94. package/dist/db/index.d.ts +17 -13
  95. package/dist/db/index.js +205 -26
  96. package/dist/db/seed.d.ts +12 -0
  97. package/dist/db/seed.js +88 -0
  98. package/dist/db/table.d.ts +10 -0
  99. package/dist/db/table.js +12 -0
  100. package/dist/dev-server/config.d.ts +11 -0
  101. package/dist/dev-server/config.js +40 -20
  102. package/dist/dev-server/index-html.d.ts +4 -0
  103. package/dist/dev-server/index-html.js +21 -6
  104. package/dist/dev-server/nuralyui-aliases.d.ts +0 -4
  105. package/dist/dev-server/nuralyui-aliases.js +115 -94
  106. package/dist/dev-server/plugins/vite-plugin-api-routes.js +29 -5
  107. package/dist/dev-server/plugins/vite-plugin-auth.d.ts +6 -0
  108. package/dist/dev-server/plugins/vite-plugin-auth.js +223 -0
  109. package/dist/dev-server/plugins/vite-plugin-auto-define.d.ts +16 -0
  110. package/dist/dev-server/plugins/vite-plugin-auto-define.js +111 -0
  111. package/dist/dev-server/plugins/vite-plugin-communication.d.ts +6 -0
  112. package/dist/dev-server/plugins/vite-plugin-communication.js +205 -0
  113. package/dist/dev-server/plugins/vite-plugin-editor-api.d.ts +6 -0
  114. package/dist/dev-server/plugins/vite-plugin-editor-api.js +318 -0
  115. package/dist/dev-server/plugins/vite-plugin-i18n.js +69 -2
  116. package/dist/dev-server/plugins/vite-plugin-lit-dedup.d.ts +6 -0
  117. package/dist/dev-server/plugins/vite-plugin-lit-dedup.js +78 -34
  118. package/dist/dev-server/plugins/vite-plugin-lit-hmr.js +44 -2
  119. package/dist/dev-server/plugins/vite-plugin-llms.d.ts +2 -0
  120. package/dist/dev-server/plugins/vite-plugin-llms.js +92 -0
  121. package/dist/dev-server/plugins/vite-plugin-loaders.js +146 -13
  122. package/dist/dev-server/plugins/vite-plugin-routes.js +16 -5
  123. package/dist/dev-server/plugins/vite-plugin-socketio.d.ts +2 -0
  124. package/dist/dev-server/plugins/vite-plugin-socketio.js +51 -0
  125. package/dist/dev-server/plugins/vite-plugin-source-annotator.d.ts +2 -0
  126. package/dist/dev-server/plugins/vite-plugin-source-annotator.js +26 -3
  127. package/dist/dev-server/plugins/vite-plugin-storage.d.ts +10 -0
  128. package/dist/dev-server/plugins/vite-plugin-storage.js +126 -0
  129. package/dist/dev-server/plugins/vite-plugin-virtual-modules.js +140 -3
  130. package/dist/dev-server/server.js +242 -70
  131. package/dist/dev-server/ssr-render.d.ts +2 -1
  132. package/dist/dev-server/ssr-render.js +117 -50
  133. package/dist/editor/ai/backend.d.ts +20 -0
  134. package/dist/editor/ai/backend.js +113 -0
  135. package/dist/editor/ai/claude-code-client.d.ts +20 -0
  136. package/dist/editor/ai/claude-code-client.js +145 -0
  137. package/dist/editor/ai/deepseek-client.d.ts +7 -0
  138. package/dist/editor/ai/deepseek-client.js +113 -0
  139. package/dist/editor/ai/opencode-client.d.ts +14 -0
  140. package/dist/editor/ai/opencode-client.js +99 -0
  141. package/dist/editor/ai/snapshot-store.d.ts +22 -0
  142. package/dist/editor/ai/snapshot-store.js +35 -0
  143. package/dist/editor/ai/types.d.ts +30 -0
  144. package/dist/editor/ai/types.js +136 -0
  145. package/dist/editor/ai-chat-panel.d.ts +13 -0
  146. package/dist/editor/ai-chat-panel.js +613 -0
  147. package/dist/editor/ai-markdown.d.ts +10 -0
  148. package/dist/editor/ai-markdown.js +70 -0
  149. package/dist/editor/ai-project-panel.d.ts +11 -0
  150. package/dist/editor/ai-project-panel.js +332 -0
  151. package/dist/editor/ast-modification.d.ts +11 -0
  152. package/dist/editor/ast-modification.js +1 -0
  153. package/dist/editor/ast-service.d.ts +30 -0
  154. package/dist/editor/ast-service.js +180 -0
  155. package/dist/editor/css-rules.d.ts +54 -0
  156. package/dist/editor/css-rules.js +423 -0
  157. package/dist/editor/editor-api-client.d.ts +51 -0
  158. package/dist/editor/editor-api-client.js +162 -0
  159. package/dist/editor/editor-bridge.d.ts +1 -0
  160. package/dist/editor/editor-bridge.js +18 -8
  161. package/dist/editor/editor-toolbar.d.ts +14 -0
  162. package/dist/editor/editor-toolbar.js +115 -0
  163. package/dist/editor/file-editor.d.ts +9 -0
  164. package/dist/editor/file-editor.js +236 -0
  165. package/dist/editor/file-service.d.ts +16 -0
  166. package/dist/editor/file-service.js +52 -0
  167. package/dist/editor/i18n-key-gen.d.ts +1 -0
  168. package/dist/editor/i18n-key-gen.js +7 -0
  169. package/dist/editor/inline-text-edit.d.ts +5 -0
  170. package/dist/editor/inline-text-edit.js +173 -92
  171. package/dist/editor/overlay-events.d.ts +5 -0
  172. package/dist/editor/overlay-events.js +364 -0
  173. package/dist/editor/overlay-hmr.d.ts +2 -0
  174. package/dist/editor/overlay-hmr.js +76 -0
  175. package/dist/editor/overlay-selection.d.ts +29 -0
  176. package/dist/editor/overlay-selection.js +148 -0
  177. package/dist/editor/overlay-utils.d.ts +12 -0
  178. package/dist/editor/overlay-utils.js +59 -0
  179. package/dist/editor/properties-panel-persist.d.ts +14 -0
  180. package/dist/editor/properties-panel-persist.js +70 -0
  181. package/dist/editor/properties-panel-rows.d.ts +10 -0
  182. package/dist/editor/properties-panel-rows.js +349 -0
  183. package/dist/editor/properties-panel-styles.d.ts +4 -0
  184. package/dist/editor/properties-panel-styles.js +174 -0
  185. package/dist/editor/properties-panel.d.ts +4 -0
  186. package/dist/editor/properties-panel.js +148 -0
  187. package/dist/editor/property-registry.d.ts +16 -0
  188. package/dist/editor/property-registry.js +303 -0
  189. package/dist/editor/standalone-file-panel.d.ts +0 -0
  190. package/dist/editor/standalone-file-panel.js +1 -0
  191. package/dist/editor/standalone-overlay-dom.d.ts +0 -0
  192. package/dist/editor/standalone-overlay-dom.js +1 -0
  193. package/dist/editor/standalone-overlay-styles.d.ts +0 -0
  194. package/dist/editor/standalone-overlay-styles.js +1 -0
  195. package/dist/editor/standalone-overlay.d.ts +1 -0
  196. package/dist/editor/standalone-overlay.js +76 -0
  197. package/dist/editor/syntax-highlighter.d.ts +4 -0
  198. package/dist/editor/syntax-highlighter.js +81 -0
  199. package/dist/editor/text-toolbar.d.ts +11 -0
  200. package/dist/editor/text-toolbar.js +327 -0
  201. package/dist/editor/toolbar-styles.d.ts +4 -0
  202. package/dist/editor/toolbar-styles.js +198 -0
  203. package/dist/email/index.d.ts +32 -0
  204. package/dist/email/index.js +154 -0
  205. package/dist/email/providers/resend.d.ts +2 -0
  206. package/dist/email/providers/resend.js +24 -0
  207. package/dist/email/providers/sendgrid.d.ts +2 -0
  208. package/dist/email/providers/sendgrid.js +31 -0
  209. package/dist/email/providers/smtp.d.ts +13 -0
  210. package/dist/email/providers/smtp.js +125 -0
  211. package/dist/email/template-engine.d.ts +18 -0
  212. package/dist/email/template-engine.js +116 -0
  213. package/dist/email/templates/base.d.ts +9 -0
  214. package/dist/email/templates/base.js +65 -0
  215. package/dist/email/templates/password-reset.d.ts +5 -0
  216. package/dist/email/templates/password-reset.js +15 -0
  217. package/dist/email/templates/verify-email.d.ts +5 -0
  218. package/dist/email/templates/verify-email.js +15 -0
  219. package/dist/email/templates/welcome.d.ts +5 -0
  220. package/dist/email/templates/welcome.js +13 -0
  221. package/dist/email/types.d.ts +49 -0
  222. package/dist/email/types.js +1 -0
  223. package/dist/llms/generate.d.ts +46 -0
  224. package/dist/llms/generate.js +185 -0
  225. package/dist/permissions/guard.d.ts +28 -0
  226. package/dist/permissions/guard.js +30 -0
  227. package/dist/permissions/index.d.ts +6 -0
  228. package/dist/permissions/index.js +3 -0
  229. package/dist/permissions/service.d.ts +80 -0
  230. package/dist/permissions/service.js +210 -0
  231. package/dist/permissions/tables.d.ts +5 -0
  232. package/dist/permissions/tables.js +68 -0
  233. package/dist/permissions/types.d.ts +33 -0
  234. package/dist/permissions/types.js +1 -0
  235. package/dist/runtime/app-shell.d.ts +1 -1
  236. package/dist/runtime/app-shell.js +164 -0
  237. package/dist/runtime/auth.d.ts +10 -0
  238. package/dist/runtime/auth.js +30 -0
  239. package/dist/runtime/communication.d.ts +137 -0
  240. package/dist/runtime/communication.js +228 -0
  241. package/dist/runtime/error-boundary.d.ts +23 -0
  242. package/dist/runtime/error-boundary.js +120 -0
  243. package/dist/runtime/i18n.d.ts +6 -1
  244. package/dist/runtime/i18n.js +42 -21
  245. package/dist/runtime/island.d.ts +16 -0
  246. package/dist/runtime/island.js +80 -0
  247. package/dist/runtime/router-data.d.ts +3 -0
  248. package/dist/runtime/router-data.js +102 -17
  249. package/dist/runtime/router-hydration.js +34 -2
  250. package/dist/runtime/router.d.ts +19 -2
  251. package/dist/runtime/router.js +237 -43
  252. package/dist/runtime/socket-client.d.ts +2 -0
  253. package/dist/runtime/socket-client.js +30 -0
  254. package/dist/runtime/webrtc.d.ts +91 -0
  255. package/dist/runtime/webrtc.js +428 -0
  256. package/dist/shared/dom-shims.js +4 -2
  257. package/dist/shared/graceful-shutdown.d.ts +8 -0
  258. package/dist/shared/graceful-shutdown.js +36 -0
  259. package/dist/shared/health.d.ts +8 -0
  260. package/dist/shared/health.js +25 -0
  261. package/dist/shared/llms-txt.d.ts +31 -0
  262. package/dist/shared/llms-txt.js +85 -0
  263. package/dist/shared/logger.d.ts +32 -0
  264. package/dist/shared/logger.js +93 -0
  265. package/dist/shared/meta.d.ts +27 -0
  266. package/dist/shared/meta.js +71 -0
  267. package/dist/shared/middleware-runner.d.ts +9 -0
  268. package/dist/shared/middleware-runner.js +29 -0
  269. package/dist/shared/rate-limit.d.ts +18 -0
  270. package/dist/shared/rate-limit.js +71 -0
  271. package/dist/shared/request-id.d.ts +5 -0
  272. package/dist/shared/request-id.js +18 -0
  273. package/dist/shared/route-matching.js +16 -1
  274. package/dist/shared/security-headers.d.ts +18 -0
  275. package/dist/shared/security-headers.js +38 -0
  276. package/dist/shared/socket-io-setup.d.ts +11 -0
  277. package/dist/shared/socket-io-setup.js +51 -0
  278. package/dist/shared/types.d.ts +15 -0
  279. package/dist/shared/utils.d.ts +33 -7
  280. package/dist/shared/utils.js +164 -27
  281. package/dist/storage/adapters/local.d.ts +44 -0
  282. package/dist/storage/adapters/local.js +85 -0
  283. package/dist/storage/adapters/s3.d.ts +32 -0
  284. package/dist/storage/adapters/s3.js +119 -0
  285. package/dist/storage/adapters/types.d.ts +53 -0
  286. package/dist/storage/adapters/types.js +1 -0
  287. package/dist/storage/index.d.ts +76 -0
  288. package/dist/storage/index.js +83 -0
  289. package/package.json +45 -7
  290. package/templates/blog/api/posts.ts +4 -18
  291. package/templates/blog/data/migrations/001_init.sql +6 -5
  292. package/templates/blog/lumenjs.config.ts +3 -0
  293. package/templates/blog/package.json +14 -0
  294. package/templates/blog/pages/_layout.ts +25 -0
  295. package/templates/blog/pages/index.ts +48 -22
  296. package/templates/blog/pages/posts/[slug].ts +45 -20
  297. package/templates/blog/pages/tag/[tag].ts +44 -0
  298. package/templates/dashboard/api/stats.ts +8 -5
  299. package/templates/dashboard/lumenjs.config.ts +3 -0
  300. package/templates/dashboard/package.json +14 -0
  301. package/templates/dashboard/pages/_layout.ts +25 -0
  302. package/templates/dashboard/pages/index.ts +54 -23
  303. package/templates/dashboard/pages/settings/index.ts +29 -0
  304. package/templates/default/lumenjs.config.ts +3 -0
  305. package/templates/default/package.json +14 -0
  306. package/templates/default/pages/index.ts +24 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Property Registry — static enum registry + runtime property discovery
3
+ * for the right-side properties panel.
4
+ */
5
+ export interface PropertyInfo {
6
+ name: string;
7
+ attrName: string;
8
+ type: 'Boolean' | 'String' | 'Number' | 'Array' | 'Object';
9
+ value: unknown;
10
+ enumValues?: string[];
11
+ }
12
+ /**
13
+ * Discover editable properties for any HTML element.
14
+ * Three-tier: Lit custom elements → unknown custom elements → standard HTML.
15
+ */
16
+ export declare function discoverProperties(element: HTMLElement): PropertyInfo[];
@@ -0,0 +1,303 @@
1
+ /**
2
+ * Property Registry — static enum registry + runtime property discovery
3
+ * for the right-side properties panel.
4
+ */
5
+ /** Enum values for nr-* components, extracted from *.types.ts files */
6
+ const PROPERTY_ENUMS = {
7
+ 'nr-button': {
8
+ type: ['primary', 'secondary', 'danger', 'ghost', 'default'],
9
+ size: ['small', 'medium', 'large'],
10
+ shape: ['default', 'circle', 'round'],
11
+ iconPosition: ['left', 'right'],
12
+ },
13
+ 'nr-input': {
14
+ state: ['default', 'error', 'warning', 'success'],
15
+ size: ['large', 'medium', 'small'],
16
+ variant: ['outlined', 'filled', 'borderless', 'underlined'],
17
+ type: ['password', 'text', 'number', 'email', 'url', 'tel', 'search', 'calendar'],
18
+ },
19
+ 'nr-select': {
20
+ state: ['error', 'warning', 'success'],
21
+ type: ['default', 'inline', 'button', 'slot'],
22
+ status: ['default', 'warning', 'error', 'success'],
23
+ size: ['small', 'medium', 'large'],
24
+ direction: ['horizontal', 'vertical'],
25
+ variant: ['default', 'solid', 'outline', 'borderless'],
26
+ placement: ['bottom', 'top', 'auto'],
27
+ searchMode: ['none', 'starts-with', 'contains', 'fuzzy'],
28
+ },
29
+ 'nr-card': {
30
+ size: ['small', 'default', 'large'],
31
+ },
32
+ 'nr-tabs': {
33
+ orientation: ['horizontal', 'vertical'],
34
+ align: ['right', 'left', 'center', 'stretch'],
35
+ size: ['small', 'medium', 'large'],
36
+ type: ['default', 'card', 'line', 'bordered'],
37
+ },
38
+ 'nr-alert': {
39
+ type: ['success', 'info', 'warning', 'error'],
40
+ },
41
+ 'nr-tag': {
42
+ color: ['magenta', 'red', 'volcano', 'orange', 'gold', 'lime', 'green', 'cyan', 'blue', 'geekblue', 'purple'],
43
+ size: ['default', 'small'],
44
+ },
45
+ 'nr-badge': {
46
+ status: ['success', 'processing', 'default', 'error', 'warning'],
47
+ size: ['default', 'small'],
48
+ color: ['pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime'],
49
+ ribbonPlacement: ['start', 'end'],
50
+ },
51
+ 'nr-checkbox': {
52
+ size: ['small', 'medium', 'large'],
53
+ },
54
+ 'nr-radio': {
55
+ size: ['small', 'medium', 'large'],
56
+ },
57
+ 'nr-radio-group': {
58
+ state: ['error', 'warning'],
59
+ direction: ['horizontal', 'vertical'],
60
+ position: ['left', 'right'],
61
+ type: ['default', 'button', 'slot', 'button-slot'],
62
+ size: ['small', 'medium', 'large'],
63
+ variant: ['default', 'solid'],
64
+ },
65
+ 'nr-divider': {
66
+ type: ['horizontal', 'vertical'],
67
+ orientation: ['start', 'center', 'end'],
68
+ variant: ['solid', 'dashed', 'dotted'],
69
+ size: ['small', 'middle', 'large'],
70
+ },
71
+ 'nr-label': {
72
+ size: ['small', 'medium', 'large'],
73
+ variant: ['default', 'secondary', 'success', 'warning', 'error'],
74
+ },
75
+ 'nr-icon': {
76
+ type: ['solid', 'regular'],
77
+ },
78
+ 'nr-image': {
79
+ fit: ['none', 'fill', 'contain', 'cover', 'scale-down'],
80
+ placeholder: ['default', 'custom'],
81
+ },
82
+ 'nr-video': {
83
+ controls: ['show', 'hide', 'hover'],
84
+ preload: ['none', 'metadata', 'auto'],
85
+ },
86
+ 'nr-dropdown': {
87
+ placement: ['bottom', 'top', 'bottom-start', 'bottom-end', 'top-start', 'top-end', 'auto'],
88
+ trigger: ['click', 'hover', 'focus', 'manual'],
89
+ size: ['small', 'medium', 'large'],
90
+ animation: ['none', 'fade', 'slide', 'scale'],
91
+ },
92
+ 'nr-menu': {
93
+ size: ['small', 'medium', 'large'],
94
+ iconPosition: ['left', 'right'],
95
+ },
96
+ 'nr-breadcrumb': {
97
+ separator: ['/', '>', '›', '-', '•'],
98
+ },
99
+ 'nr-modal': {
100
+ size: ['small', 'medium', 'large', 'xl'],
101
+ position: ['center', 'top', 'bottom'],
102
+ animation: ['fade', 'zoom', 'slide-up', 'slide-down', 'none'],
103
+ backdrop: ['static', 'closable', 'none'],
104
+ },
105
+ 'nr-popconfirm': {
106
+ placement: ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'right', 'right-start', 'right-end'],
107
+ trigger: ['click', 'hover', 'focus'],
108
+ buttonType: ['primary', 'secondary', 'danger', 'default'],
109
+ icon: ['exclamation-circle', 'question-circle', 'info-circle', 'close-circle', 'check-circle'],
110
+ },
111
+ 'nr-toast': {
112
+ type: ['default', 'success', 'error', 'warning', 'info'],
113
+ position: ['top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center'],
114
+ animation: ['fade', 'slide', 'bounce'],
115
+ },
116
+ 'nr-skeleton': {
117
+ shape: ['circle', 'square', 'round', 'default'],
118
+ size: ['small', 'default', 'large'],
119
+ elementType: ['avatar', 'button', 'input', 'image'],
120
+ },
121
+ 'nr-timeline': {
122
+ mode: ['left', 'right', 'alternate'],
123
+ color: ['blue', 'red', 'green', 'gray'],
124
+ position: ['left', 'right'],
125
+ },
126
+ 'nr-table': {
127
+ filterType: ['text', 'select', 'number', 'date'],
128
+ selectionMode: ['single', 'multiple'],
129
+ size: ['small', 'normal', 'large'],
130
+ },
131
+ 'nr-form': {
132
+ validationState: ['pristine', 'pending', 'valid', 'invalid', 'submitted'],
133
+ submissionState: ['idle', 'submitting', 'success', 'error'],
134
+ },
135
+ 'nr-flex': {
136
+ direction: ['row', 'row-reverse', 'column', 'column-reverse'],
137
+ wrap: ['nowrap', 'wrap', 'wrap-reverse'],
138
+ justify: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly'],
139
+ align: ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
140
+ gap: ['small', 'medium', 'large'],
141
+ },
142
+ 'nr-grid': {
143
+ breakpoint: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
144
+ align: ['top', 'middle', 'bottom', 'stretch'],
145
+ justify: ['start', 'end', 'center', 'space-around', 'space-between', 'space-evenly'],
146
+ },
147
+ 'nr-layout': {
148
+ breakpoint: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
149
+ siderTheme: ['light', 'dark'],
150
+ },
151
+ 'nr-panel': {
152
+ mode: ['panel', 'window', 'minimized', 'embedded'],
153
+ size: ['small', 'medium', 'large', 'custom'],
154
+ position: ['left', 'right', 'bottom', 'top'],
155
+ maximizePosition: ['center', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right'],
156
+ },
157
+ 'nr-container': {
158
+ layout: ['fluid', 'boxed', 'fixed'],
159
+ direction: ['row', 'column'],
160
+ size: ['sm', 'md', 'lg', 'xl', 'full'],
161
+ padding: ['none', 'sm', 'md', 'lg'],
162
+ justify: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly'],
163
+ align: ['flex-start', 'flex-end', 'center', 'baseline', 'stretch'],
164
+ },
165
+ 'nr-slider-input': {
166
+ size: ['small', 'medium', 'large'],
167
+ variant: ['default', 'primary', 'success', 'warning', 'error'],
168
+ },
169
+ 'nr-datepicker': {
170
+ state: ['error', 'warning', 'success'],
171
+ mode: ['day', 'month', 'year', 'decade'],
172
+ type: ['single', 'range', 'multiple'],
173
+ size: ['small', 'medium', 'large'],
174
+ variant: ['default', 'outlined', 'filled'],
175
+ format: ['YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY', 'DD/MM/YY', 'DD MMMM YYYY', 'DD MMM YYYY'],
176
+ placement: ['bottom', 'top', 'auto'],
177
+ },
178
+ 'nr-timepicker': {
179
+ timeFormat: ['24h', '12h'],
180
+ mode: ['hours', 'minutes', 'seconds'],
181
+ size: ['small', 'medium', 'large'],
182
+ variant: ['default', 'outlined', 'filled'],
183
+ state: ['default', 'error', 'warning', 'success'],
184
+ placement: ['bottom', 'top', 'auto'],
185
+ },
186
+ 'nr-colorpicker': {
187
+ size: ['default', 'small', 'large'],
188
+ trigger: ['click', 'hover', 'manual'],
189
+ placement: ['top', 'bottom', 'auto'],
190
+ animation: ['none', 'fade', 'slide', 'scale'],
191
+ format: ['hex', 'rgb', 'rgba', 'hsl', 'hsla'],
192
+ },
193
+ 'nr-textarea': {
194
+ state: ['default', 'error', 'warning', 'success'],
195
+ size: ['large', 'medium', 'small'],
196
+ variant: ['outlined', 'filled', 'borderless', 'underlined'],
197
+ resize: ['none', 'vertical', 'horizontal', 'both'],
198
+ },
199
+ 'nr-iconpicker': {
200
+ size: ['small', 'medium', 'large'],
201
+ placement: ['auto', 'top', 'bottom', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left', 'right'],
202
+ trigger: ['click', 'hover', 'manual'],
203
+ iconType: ['solid', 'regular', 'brands'],
204
+ },
205
+ 'nr-file-upload': {
206
+ size: ['small', 'medium', 'large'],
207
+ },
208
+ };
209
+ /** HTML attribute enum values for standard elements */
210
+ const HTML_ATTR_ENUMS = {
211
+ target: ['_self', '_blank', '_parent', '_top'],
212
+ type: ['text', 'password', 'email', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime-local', 'month', 'week', 'color', 'file', 'range', 'hidden', 'checkbox', 'radio', 'submit', 'reset', 'button'],
213
+ loading: ['lazy', 'eager'],
214
+ decoding: ['sync', 'async', 'auto'],
215
+ crossorigin: ['anonymous', 'use-credentials'],
216
+ referrerpolicy: ['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url'],
217
+ autocomplete: ['on', 'off'],
218
+ dir: ['ltr', 'rtl', 'auto'],
219
+ draggable: ['true', 'false'],
220
+ contenteditable: ['true', 'false'],
221
+ inputmode: ['none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url'],
222
+ wrap: ['hard', 'soft'],
223
+ method: ['get', 'post', 'dialog'],
224
+ enctype: ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'],
225
+ rel: ['noopener', 'noreferrer', 'nofollow', 'external', 'stylesheet', 'icon'],
226
+ };
227
+ /** Properties to hide from the panel */
228
+ const HIDDEN_PROPS = new Set([
229
+ 'currentTheme', 'requiredComponents', 'styles', 'renderOptions',
230
+ 'shadowRootOptions', 'elementStyles', 'properties', 'localizeDir',
231
+ 'isUpdatePending', 'hasUpdated', 'updateComplete',
232
+ ]);
233
+ /**
234
+ * Discover editable properties for any HTML element.
235
+ * Three-tier: Lit custom elements → unknown custom elements → standard HTML.
236
+ */
237
+ export function discoverProperties(element) {
238
+ const tag = element.tagName.toLowerCase();
239
+ const isCustom = tag.includes('-');
240
+ if (isCustom) {
241
+ // Try Lit element discovery via elementProperties
242
+ const ctor = customElements.get(tag);
243
+ if (ctor?.elementProperties) {
244
+ return discoverLitProperties(element, tag, ctor.elementProperties);
245
+ }
246
+ }
247
+ // Fallback: read DOM attributes (for unknown custom elements and standard HTML)
248
+ return discoverDomAttributes(element, tag);
249
+ }
250
+ function discoverLitProperties(element, tag, propMap) {
251
+ const props = [];
252
+ const enumMap = PROPERTY_ENUMS[tag];
253
+ for (const [name, declaration] of propMap) {
254
+ // Skip internal state
255
+ if (declaration.state === true)
256
+ continue;
257
+ // Skip hidden / private
258
+ if (HIDDEN_PROPS.has(name) || name.startsWith('_') || name.startsWith('__'))
259
+ continue;
260
+ const typeCtor = declaration.type;
261
+ let type = 'String';
262
+ if (typeCtor === Boolean)
263
+ type = 'Boolean';
264
+ else if (typeCtor === Number)
265
+ type = 'Number';
266
+ else if (typeCtor === Array)
267
+ type = 'Array';
268
+ else if (typeCtor === Object)
269
+ type = 'Object';
270
+ // Resolve attribute name (Lit may use a custom attribute name)
271
+ let attrName = declaration.attribute;
272
+ if (attrName === undefined || attrName === true) {
273
+ // Default: lowercase prop name
274
+ attrName = name.toLowerCase();
275
+ }
276
+ else if (attrName === false) {
277
+ // Not reflected — still show but use prop name as attr
278
+ attrName = name.toLowerCase();
279
+ }
280
+ const value = element[name];
281
+ const enumValues = enumMap?.[name];
282
+ props.push({ name, attrName, type, value, enumValues });
283
+ }
284
+ return props;
285
+ }
286
+ function discoverDomAttributes(element, tag) {
287
+ const props = [];
288
+ for (const attr of Array.from(element.attributes)) {
289
+ if (attr.name.startsWith('data-nk-'))
290
+ continue;
291
+ if (attr.name === 'class' || attr.name === 'style')
292
+ continue;
293
+ const enumValues = HTML_ATTR_ENUMS[attr.name];
294
+ props.push({
295
+ name: attr.name,
296
+ attrName: attr.name,
297
+ type: 'String',
298
+ value: attr.value,
299
+ enumValues,
300
+ });
301
+ }
302
+ return props;
303
+ }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ export declare function initStandaloneEditor(): void;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Standalone Editor Overlay — provides a visual editing UI when editor mode
3
+ * runs outside an iframe (direct browsing, not embedded in Studio).
4
+ *
5
+ * Features:
6
+ * - Hover highlight box around annotated elements (mouse)
7
+ * - Tap / click to select element (shows source info in toolbar)
8
+ * - Double-tap / double-click text to inline edit (delegates to inline-text-edit.ts)
9
+ * - Floating toolbar at top with selected element info
10
+ * - File tree panel to browse/edit project files
11
+ * - Full touch support for mobile/tablet
12
+ *
13
+ * This file is now a slim orchestrator that delegates to:
14
+ * - overlay-selection.ts — selection state & logic
15
+ * - overlay-events.ts — mouse, touch, toolbar, keyboard, scroll/resize handlers
16
+ * - overlay-hmr.ts — HMR re-selection & WebSocket listener
17
+ */
18
+ import { startAnnotator } from './element-annotator.js';
19
+ import { setupInlineTextEdit } from './inline-text-edit.js';
20
+ import { createPropertiesPanel } from './properties-panel.js';
21
+ import { createAiChatPanel } from './ai-chat-panel.js';
22
+ import { createAiProjectPanel } from './ai-project-panel.js';
23
+ import { createOverlay } from './overlay-utils.js';
24
+ import { createTextToolbar, setupTextToolbarHandlers, setTextToolbarSelectedElement, } from './text-toolbar.js';
25
+ import { createToolbar, createFilePanel, setMode, initToolbarRefs, } from './editor-toolbar.js';
26
+ import { selectedElementRef, deselect, setHoverOverlay, setSelectOverlay, } from './overlay-selection.js';
27
+ import { setupMouseEvents, setupTouchEvents, setupToolbarHandlers, setupKeyboardHandlers, setupScrollResize, } from './overlay-events.js';
28
+ import { setupHmrListener } from './overlay-hmr.js';
29
+ let initialized = false;
30
+ export function initStandaloneEditor() {
31
+ if (initialized)
32
+ return;
33
+ initialized = true;
34
+ // Clean up any stale elements from HMR
35
+ document.getElementById('nk-editor-toolbar')?.remove();
36
+ document.getElementById('nk-file-panel')?.remove();
37
+ document.getElementById('nk-file-editor')?.remove();
38
+ document.getElementById('nk-text-toolbar')?.remove();
39
+ document.getElementById('nk-props-panel')?.remove();
40
+ document.getElementById('nk-ai-chat')?.remove();
41
+ document.getElementById('nk-ai-project')?.remove();
42
+ // Create overlays and store them in selection module
43
+ const hoverOverlay = createOverlay('#7c3aed', 'dashed');
44
+ const selectOverlay = createOverlay('#3b82f6', 'solid');
45
+ setHoverOverlay(hoverOverlay);
46
+ setSelectOverlay(selectOverlay);
47
+ // Initialize toolbar refs before creating toolbar
48
+ initToolbarRefs({ selectOverlay, selectedElement: selectedElementRef, deselect });
49
+ setTextToolbarSelectedElement(selectedElementRef);
50
+ // Create UI elements
51
+ const toolbar = createToolbar();
52
+ const filePanel = createFilePanel();
53
+ createTextToolbar();
54
+ setupTextToolbarHandlers();
55
+ createPropertiesPanel();
56
+ createAiChatPanel();
57
+ createAiProjectPanel();
58
+ // Restore saved editor mode
59
+ try {
60
+ const saved = localStorage.getItem('nk-editor-mode');
61
+ if (saved === 'preview')
62
+ setMode(false);
63
+ }
64
+ catch { }
65
+ // Start annotator (assigns data-nk-id to custom elements)
66
+ startAnnotator();
67
+ // Setup inline text editing (double-click + double-tap handled inside)
68
+ setupInlineTextEdit();
69
+ // Wire up all event handlers
70
+ setupMouseEvents();
71
+ setupTouchEvents();
72
+ setupToolbarHandlers(toolbar, filePanel);
73
+ setupKeyboardHandlers(toolbar);
74
+ setupScrollResize();
75
+ setupHmrListener();
76
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Lightweight syntax highlighter for CodeJar.
3
+ */
4
+ export declare function highlightCode(el: HTMLElement): void;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Lightweight syntax highlighter for CodeJar.
3
+ */
4
+ const KW = new Set([
5
+ 'async', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger',
6
+ 'default', 'delete', 'do', 'else', 'enum', 'export', 'extends', 'finally', 'for',
7
+ 'from', 'function', 'if', 'implements', 'import', 'in', 'instanceof', 'interface',
8
+ 'let', 'new', 'of', 'return', 'static', 'super', 'switch', 'this', 'throw', 'try',
9
+ 'type', 'typeof', 'var', 'void', 'while', 'with', 'yield',
10
+ ]);
11
+ const LIT = new Set(['true', 'false', 'null', 'undefined', 'NaN', 'Infinity']);
12
+ function esc(s) {
13
+ return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
14
+ }
15
+ export function highlightCode(el) {
16
+ const src = el.textContent || '';
17
+ let out = '', i = 0;
18
+ while (i < src.length) {
19
+ // Line comment
20
+ if (src[i] === '/' && src[i + 1] === '/') {
21
+ const e = src.indexOf('\n', i);
22
+ const end = e === -1 ? src.length : e;
23
+ out += `<span class="nk-hl-c">${esc(src.slice(i, end))}</span>`;
24
+ i = end;
25
+ continue;
26
+ }
27
+ // Block comment
28
+ if (src[i] === '/' && src[i + 1] === '*') {
29
+ const e = src.indexOf('*/', i + 2);
30
+ const end = e === -1 ? src.length : e + 2;
31
+ out += `<span class="nk-hl-c">${esc(src.slice(i, end))}</span>`;
32
+ i = end;
33
+ continue;
34
+ }
35
+ // String
36
+ if (src[i] === '"' || src[i] === "'" || src[i] === '`') {
37
+ const q = src[i];
38
+ let j = i + 1;
39
+ while (j < src.length) {
40
+ if (src[j] === '\\') {
41
+ j += 2;
42
+ continue;
43
+ }
44
+ if (src[j] === q) {
45
+ j++;
46
+ break;
47
+ }
48
+ if (q !== '`' && src[j] === '\n')
49
+ break;
50
+ j++;
51
+ }
52
+ out += `<span class="nk-hl-s">${esc(src.slice(i, j))}</span>`;
53
+ i = j;
54
+ continue;
55
+ }
56
+ // Word (keyword / literal / identifier)
57
+ if (/[a-zA-Z_$]/.test(src[i])) {
58
+ let j = i;
59
+ while (j < src.length && /[\w$]/.test(src[j]))
60
+ j++;
61
+ const w = src.slice(i, j);
62
+ out += KW.has(w) ? `<span class="nk-hl-k">${w}</span>`
63
+ : LIT.has(w) ? `<span class="nk-hl-l">${w}</span>`
64
+ : esc(w);
65
+ i = j;
66
+ continue;
67
+ }
68
+ // Number
69
+ if (/\d/.test(src[i])) {
70
+ let j = i;
71
+ while (j < src.length && /[\d.xXa-fA-FeEnb_]/.test(src[j]))
72
+ j++;
73
+ out += `<span class="nk-hl-n">${esc(src.slice(i, j))}</span>`;
74
+ i = j;
75
+ continue;
76
+ }
77
+ out += esc(src[i]);
78
+ i++;
79
+ }
80
+ el.innerHTML = out;
81
+ }
@@ -0,0 +1,11 @@
1
+ declare const TEXT_TAGS: Set<string>;
2
+ export declare function setTextToolbarSelectedElement(ref: {
3
+ current: HTMLElement | null;
4
+ }): void;
5
+ export declare function getTextToolbar(): HTMLDivElement;
6
+ export { TEXT_TAGS };
7
+ export declare function createTextToolbar(): HTMLDivElement;
8
+ export declare function positionTextToolbar(el: HTMLElement): void;
9
+ export declare function hideTextToolbar(): void;
10
+ export declare function setupTextToolbarHandlers(): void;
11
+ export declare function showTextToolbarForElement(el: HTMLElement): void;