@fuzdev/fuz_app 0.1.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 (457) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/dist/actions/action_bridge.d.ts +65 -0
  4. package/dist/actions/action_bridge.d.ts.map +1 -0
  5. package/dist/actions/action_bridge.js +76 -0
  6. package/dist/actions/action_codegen.d.ts +97 -0
  7. package/dist/actions/action_codegen.d.ts.map +1 -0
  8. package/dist/actions/action_codegen.js +280 -0
  9. package/dist/actions/action_registry.d.ts +35 -0
  10. package/dist/actions/action_registry.d.ts.map +1 -0
  11. package/dist/actions/action_registry.js +83 -0
  12. package/dist/actions/action_spec.d.ts +169 -0
  13. package/dist/actions/action_spec.d.ts.map +1 -0
  14. package/dist/actions/action_spec.js +76 -0
  15. package/dist/auth/account_queries.d.ts +96 -0
  16. package/dist/auth/account_queries.d.ts.map +1 -0
  17. package/dist/auth/account_queries.js +172 -0
  18. package/dist/auth/account_routes.d.ts +86 -0
  19. package/dist/auth/account_routes.d.ts.map +1 -0
  20. package/dist/auth/account_routes.js +406 -0
  21. package/dist/auth/account_schema.d.ts +192 -0
  22. package/dist/auth/account_schema.d.ts.map +1 -0
  23. package/dist/auth/account_schema.js +105 -0
  24. package/dist/auth/admin_routes.d.ts +29 -0
  25. package/dist/auth/admin_routes.d.ts.map +1 -0
  26. package/dist/auth/admin_routes.js +193 -0
  27. package/dist/auth/api_token.d.ts +33 -0
  28. package/dist/auth/api_token.d.ts.map +1 -0
  29. package/dist/auth/api_token.js +36 -0
  30. package/dist/auth/api_token_queries.d.ts +80 -0
  31. package/dist/auth/api_token_queries.d.ts.map +1 -0
  32. package/dist/auth/api_token_queries.js +116 -0
  33. package/dist/auth/app_settings_queries.d.ts +33 -0
  34. package/dist/auth/app_settings_queries.d.ts.map +1 -0
  35. package/dist/auth/app_settings_queries.js +51 -0
  36. package/dist/auth/app_settings_routes.d.ts +27 -0
  37. package/dist/auth/app_settings_routes.d.ts.map +1 -0
  38. package/dist/auth/app_settings_routes.js +66 -0
  39. package/dist/auth/app_settings_schema.d.ts +35 -0
  40. package/dist/auth/app_settings_schema.d.ts.map +1 -0
  41. package/dist/auth/app_settings_schema.js +22 -0
  42. package/dist/auth/audit_log_queries.d.ts +90 -0
  43. package/dist/auth/audit_log_queries.d.ts.map +1 -0
  44. package/dist/auth/audit_log_queries.js +205 -0
  45. package/dist/auth/audit_log_routes.d.ts +33 -0
  46. package/dist/auth/audit_log_routes.d.ts.map +1 -0
  47. package/dist/auth/audit_log_routes.js +106 -0
  48. package/dist/auth/audit_log_schema.d.ts +259 -0
  49. package/dist/auth/audit_log_schema.d.ts.map +1 -0
  50. package/dist/auth/audit_log_schema.js +123 -0
  51. package/dist/auth/bearer_auth.d.ts +32 -0
  52. package/dist/auth/bearer_auth.d.ts.map +1 -0
  53. package/dist/auth/bearer_auth.js +90 -0
  54. package/dist/auth/bootstrap_account.d.ts +82 -0
  55. package/dist/auth/bootstrap_account.d.ts.map +1 -0
  56. package/dist/auth/bootstrap_account.js +97 -0
  57. package/dist/auth/bootstrap_routes.d.ts +74 -0
  58. package/dist/auth/bootstrap_routes.d.ts.map +1 -0
  59. package/dist/auth/bootstrap_routes.js +154 -0
  60. package/dist/auth/daemon_token.d.ts +49 -0
  61. package/dist/auth/daemon_token.d.ts.map +1 -0
  62. package/dist/auth/daemon_token.js +49 -0
  63. package/dist/auth/daemon_token_middleware.d.ts +93 -0
  64. package/dist/auth/daemon_token_middleware.d.ts.map +1 -0
  65. package/dist/auth/daemon_token_middleware.js +167 -0
  66. package/dist/auth/ddl.d.ts +27 -0
  67. package/dist/auth/ddl.d.ts.map +1 -0
  68. package/dist/auth/ddl.js +111 -0
  69. package/dist/auth/deps.d.ts +52 -0
  70. package/dist/auth/deps.d.ts.map +1 -0
  71. package/dist/auth/deps.js +10 -0
  72. package/dist/auth/invite_queries.d.ts +68 -0
  73. package/dist/auth/invite_queries.d.ts.map +1 -0
  74. package/dist/auth/invite_queries.js +105 -0
  75. package/dist/auth/invite_routes.d.ts +18 -0
  76. package/dist/auth/invite_routes.d.ts.map +1 -0
  77. package/dist/auth/invite_routes.js +129 -0
  78. package/dist/auth/invite_schema.d.ts +51 -0
  79. package/dist/auth/invite_schema.d.ts.map +1 -0
  80. package/dist/auth/invite_schema.js +25 -0
  81. package/dist/auth/keyring.d.ts +87 -0
  82. package/dist/auth/keyring.d.ts.map +1 -0
  83. package/dist/auth/keyring.js +142 -0
  84. package/dist/auth/middleware.d.ts +40 -0
  85. package/dist/auth/middleware.d.ts.map +1 -0
  86. package/dist/auth/middleware.js +64 -0
  87. package/dist/auth/migrations.d.ts +42 -0
  88. package/dist/auth/migrations.d.ts.map +1 -0
  89. package/dist/auth/migrations.js +79 -0
  90. package/dist/auth/password.d.ts +39 -0
  91. package/dist/auth/password.d.ts.map +1 -0
  92. package/dist/auth/password.js +25 -0
  93. package/dist/auth/password_argon2.d.ts +43 -0
  94. package/dist/auth/password_argon2.d.ts.map +1 -0
  95. package/dist/auth/password_argon2.js +76 -0
  96. package/dist/auth/permit_queries.d.ts +72 -0
  97. package/dist/auth/permit_queries.d.ts.map +1 -0
  98. package/dist/auth/permit_queries.js +116 -0
  99. package/dist/auth/request_context.d.ts +114 -0
  100. package/dist/auth/request_context.d.ts.map +1 -0
  101. package/dist/auth/request_context.js +176 -0
  102. package/dist/auth/require_keeper.d.ts +20 -0
  103. package/dist/auth/require_keeper.d.ts.map +1 -0
  104. package/dist/auth/require_keeper.js +35 -0
  105. package/dist/auth/role_schema.d.ts +69 -0
  106. package/dist/auth/role_schema.d.ts.map +1 -0
  107. package/dist/auth/role_schema.js +70 -0
  108. package/dist/auth/route_guards.d.ts +21 -0
  109. package/dist/auth/route_guards.d.ts.map +1 -0
  110. package/dist/auth/route_guards.js +32 -0
  111. package/dist/auth/session_cookie.d.ts +158 -0
  112. package/dist/auth/session_cookie.d.ts.map +1 -0
  113. package/dist/auth/session_cookie.js +135 -0
  114. package/dist/auth/session_lifecycle.d.ts +35 -0
  115. package/dist/auth/session_lifecycle.d.ts.map +1 -0
  116. package/dist/auth/session_lifecycle.js +27 -0
  117. package/dist/auth/session_middleware.d.ts +33 -0
  118. package/dist/auth/session_middleware.d.ts.map +1 -0
  119. package/dist/auth/session_middleware.js +62 -0
  120. package/dist/auth/session_queries.d.ts +135 -0
  121. package/dist/auth/session_queries.d.ts.map +1 -0
  122. package/dist/auth/session_queries.js +186 -0
  123. package/dist/auth/signup_routes.d.ts +32 -0
  124. package/dist/auth/signup_routes.d.ts.map +1 -0
  125. package/dist/auth/signup_routes.js +150 -0
  126. package/dist/cli/args.d.ts +48 -0
  127. package/dist/cli/args.d.ts.map +1 -0
  128. package/dist/cli/args.js +76 -0
  129. package/dist/cli/config.d.ts +48 -0
  130. package/dist/cli/config.d.ts.map +1 -0
  131. package/dist/cli/config.js +77 -0
  132. package/dist/cli/daemon.d.ts +82 -0
  133. package/dist/cli/daemon.d.ts.map +1 -0
  134. package/dist/cli/daemon.js +149 -0
  135. package/dist/cli/help.d.ts +85 -0
  136. package/dist/cli/help.d.ts.map +1 -0
  137. package/dist/cli/help.js +138 -0
  138. package/dist/cli/logger.d.ts +46 -0
  139. package/dist/cli/logger.d.ts.map +1 -0
  140. package/dist/cli/logger.js +48 -0
  141. package/dist/cli/util.d.ts +36 -0
  142. package/dist/cli/util.d.ts.map +1 -0
  143. package/dist/cli/util.js +50 -0
  144. package/dist/crypto.d.ts +13 -0
  145. package/dist/crypto.d.ts.map +1 -0
  146. package/dist/crypto.js +19 -0
  147. package/dist/db/assert_row.d.ts +18 -0
  148. package/dist/db/assert_row.d.ts.map +1 -0
  149. package/dist/db/assert_row.js +24 -0
  150. package/dist/db/create_db.d.ts +38 -0
  151. package/dist/db/create_db.d.ts.map +1 -0
  152. package/dist/db/create_db.js +57 -0
  153. package/dist/db/db.d.ts +97 -0
  154. package/dist/db/db.d.ts.map +1 -0
  155. package/dist/db/db.js +76 -0
  156. package/dist/db/db_pg.d.ts +21 -0
  157. package/dist/db/db_pg.d.ts.map +1 -0
  158. package/dist/db/db_pg.js +45 -0
  159. package/dist/db/db_pglite.d.ts +21 -0
  160. package/dist/db/db_pglite.d.ts.map +1 -0
  161. package/dist/db/db_pglite.js +28 -0
  162. package/dist/db/migrate.d.ts +67 -0
  163. package/dist/db/migrate.d.ts.map +1 -0
  164. package/dist/db/migrate.js +118 -0
  165. package/dist/db/pg_error.d.ts +16 -0
  166. package/dist/db/pg_error.d.ts.map +1 -0
  167. package/dist/db/pg_error.js +15 -0
  168. package/dist/db/query_deps.d.ts +14 -0
  169. package/dist/db/query_deps.d.ts.map +1 -0
  170. package/dist/db/query_deps.js +9 -0
  171. package/dist/db/sql_identifier.d.ts +27 -0
  172. package/dist/db/sql_identifier.d.ts.map +1 -0
  173. package/dist/db/sql_identifier.js +31 -0
  174. package/dist/db/status.d.ts +62 -0
  175. package/dist/db/status.d.ts.map +1 -0
  176. package/dist/db/status.js +116 -0
  177. package/dist/dev/setup.d.ts +159 -0
  178. package/dist/dev/setup.d.ts.map +1 -0
  179. package/dist/dev/setup.js +265 -0
  180. package/dist/env/dotenv.d.ts +25 -0
  181. package/dist/env/dotenv.d.ts.map +1 -0
  182. package/dist/env/dotenv.js +52 -0
  183. package/dist/env/load.d.ts +52 -0
  184. package/dist/env/load.d.ts.map +1 -0
  185. package/dist/env/load.js +79 -0
  186. package/dist/env/mask.d.ts +19 -0
  187. package/dist/env/mask.d.ts.map +1 -0
  188. package/dist/env/mask.js +26 -0
  189. package/dist/env/resolve.d.ts +126 -0
  190. package/dist/env/resolve.d.ts.map +1 -0
  191. package/dist/env/resolve.js +200 -0
  192. package/dist/hono_context.d.ts +48 -0
  193. package/dist/hono_context.d.ts.map +1 -0
  194. package/dist/hono_context.js +22 -0
  195. package/dist/http/common_routes.d.ts +52 -0
  196. package/dist/http/common_routes.d.ts.map +1 -0
  197. package/dist/http/common_routes.js +65 -0
  198. package/dist/http/db_routes.d.ts +57 -0
  199. package/dist/http/db_routes.d.ts.map +1 -0
  200. package/dist/http/db_routes.js +176 -0
  201. package/dist/http/error_schemas.d.ts +169 -0
  202. package/dist/http/error_schemas.d.ts.map +1 -0
  203. package/dist/http/error_schemas.js +178 -0
  204. package/dist/http/middleware_spec.d.ts +19 -0
  205. package/dist/http/middleware_spec.d.ts.map +1 -0
  206. package/dist/http/middleware_spec.js +9 -0
  207. package/dist/http/origin.d.ts +57 -0
  208. package/dist/http/origin.d.ts.map +1 -0
  209. package/dist/http/origin.js +207 -0
  210. package/dist/http/proxy.d.ts +112 -0
  211. package/dist/http/proxy.d.ts.map +1 -0
  212. package/dist/http/proxy.js +240 -0
  213. package/dist/http/route_spec.d.ts +197 -0
  214. package/dist/http/route_spec.d.ts.map +1 -0
  215. package/dist/http/route_spec.js +243 -0
  216. package/dist/http/schema_helpers.d.ts +64 -0
  217. package/dist/http/schema_helpers.d.ts.map +1 -0
  218. package/dist/http/schema_helpers.js +90 -0
  219. package/dist/http/surface.d.ts +132 -0
  220. package/dist/http/surface.d.ts.map +1 -0
  221. package/dist/http/surface.js +156 -0
  222. package/dist/http/surface_query.d.ts +77 -0
  223. package/dist/http/surface_query.d.ts.map +1 -0
  224. package/dist/http/surface_query.js +86 -0
  225. package/dist/rate_limiter.d.ts +94 -0
  226. package/dist/rate_limiter.d.ts.map +1 -0
  227. package/dist/rate_limiter.js +156 -0
  228. package/dist/realtime/sse.d.ts +80 -0
  229. package/dist/realtime/sse.d.ts.map +1 -0
  230. package/dist/realtime/sse.js +109 -0
  231. package/dist/realtime/sse_auth_guard.d.ts +93 -0
  232. package/dist/realtime/sse_auth_guard.d.ts.map +1 -0
  233. package/dist/realtime/sse_auth_guard.js +111 -0
  234. package/dist/realtime/subscriber_registry.d.ts +85 -0
  235. package/dist/realtime/subscriber_registry.d.ts.map +1 -0
  236. package/dist/realtime/subscriber_registry.js +108 -0
  237. package/dist/runtime/deno.d.ts +21 -0
  238. package/dist/runtime/deno.d.ts.map +1 -0
  239. package/dist/runtime/deno.js +83 -0
  240. package/dist/runtime/deps.d.ts +113 -0
  241. package/dist/runtime/deps.d.ts.map +1 -0
  242. package/dist/runtime/deps.js +10 -0
  243. package/dist/runtime/fs.d.ts +15 -0
  244. package/dist/runtime/fs.d.ts.map +1 -0
  245. package/dist/runtime/fs.js +17 -0
  246. package/dist/runtime/mock.d.ts +81 -0
  247. package/dist/runtime/mock.d.ts.map +1 -0
  248. package/dist/runtime/mock.js +195 -0
  249. package/dist/runtime/node.d.ts +17 -0
  250. package/dist/runtime/node.d.ts.map +1 -0
  251. package/dist/runtime/node.js +117 -0
  252. package/dist/schema_meta.d.ts +16 -0
  253. package/dist/schema_meta.d.ts.map +1 -0
  254. package/dist/schema_meta.js +9 -0
  255. package/dist/sensitivity.d.ts +15 -0
  256. package/dist/sensitivity.d.ts.map +1 -0
  257. package/dist/sensitivity.js +9 -0
  258. package/dist/server/app_backend.d.ts +74 -0
  259. package/dist/server/app_backend.d.ts.map +1 -0
  260. package/dist/server/app_backend.js +39 -0
  261. package/dist/server/app_server.d.ts +201 -0
  262. package/dist/server/app_server.d.ts.map +1 -0
  263. package/dist/server/app_server.js +266 -0
  264. package/dist/server/env.d.ts +68 -0
  265. package/dist/server/env.d.ts.map +1 -0
  266. package/dist/server/env.js +95 -0
  267. package/dist/server/startup.d.ts +22 -0
  268. package/dist/server/startup.d.ts.map +1 -0
  269. package/dist/server/startup.js +48 -0
  270. package/dist/server/static.d.ts +39 -0
  271. package/dist/server/static.d.ts.map +1 -0
  272. package/dist/server/static.js +38 -0
  273. package/dist/server/validate_nginx.d.ts +34 -0
  274. package/dist/server/validate_nginx.d.ts.map +1 -0
  275. package/dist/server/validate_nginx.js +118 -0
  276. package/dist/testing/CLAUDE.md +3 -0
  277. package/dist/testing/admin_integration.d.ts +45 -0
  278. package/dist/testing/admin_integration.d.ts.map +1 -0
  279. package/dist/testing/admin_integration.js +840 -0
  280. package/dist/testing/adversarial_404.d.ts +15 -0
  281. package/dist/testing/adversarial_404.d.ts.map +1 -0
  282. package/dist/testing/adversarial_404.js +118 -0
  283. package/dist/testing/adversarial_headers.d.ts +36 -0
  284. package/dist/testing/adversarial_headers.d.ts.map +1 -0
  285. package/dist/testing/adversarial_headers.js +128 -0
  286. package/dist/testing/adversarial_input.d.ts +56 -0
  287. package/dist/testing/adversarial_input.d.ts.map +1 -0
  288. package/dist/testing/adversarial_input.js +494 -0
  289. package/dist/testing/app_server.d.ts +169 -0
  290. package/dist/testing/app_server.d.ts.map +1 -0
  291. package/dist/testing/app_server.js +240 -0
  292. package/dist/testing/assert_dev_env.d.ts +10 -0
  293. package/dist/testing/assert_dev_env.d.ts.map +1 -0
  294. package/dist/testing/assert_dev_env.js +13 -0
  295. package/dist/testing/assertions.d.ts +61 -0
  296. package/dist/testing/assertions.d.ts.map +1 -0
  297. package/dist/testing/assertions.js +96 -0
  298. package/dist/testing/attack_surface.d.ts +63 -0
  299. package/dist/testing/attack_surface.d.ts.map +1 -0
  300. package/dist/testing/attack_surface.js +224 -0
  301. package/dist/testing/audit_completeness.d.ts +29 -0
  302. package/dist/testing/audit_completeness.d.ts.map +1 -0
  303. package/dist/testing/audit_completeness.js +410 -0
  304. package/dist/testing/auth_apps.d.ts +55 -0
  305. package/dist/testing/auth_apps.d.ts.map +1 -0
  306. package/dist/testing/auth_apps.js +122 -0
  307. package/dist/testing/data_exposure.d.ts +62 -0
  308. package/dist/testing/data_exposure.d.ts.map +1 -0
  309. package/dist/testing/data_exposure.js +297 -0
  310. package/dist/testing/db.d.ts +111 -0
  311. package/dist/testing/db.d.ts.map +1 -0
  312. package/dist/testing/db.js +258 -0
  313. package/dist/testing/entities.d.ts +21 -0
  314. package/dist/testing/entities.d.ts.map +1 -0
  315. package/dist/testing/entities.js +42 -0
  316. package/dist/testing/error_coverage.d.ts +78 -0
  317. package/dist/testing/error_coverage.d.ts.map +1 -0
  318. package/dist/testing/error_coverage.js +135 -0
  319. package/dist/testing/integration.d.ts +37 -0
  320. package/dist/testing/integration.d.ts.map +1 -0
  321. package/dist/testing/integration.js +1139 -0
  322. package/dist/testing/integration_helpers.d.ts +107 -0
  323. package/dist/testing/integration_helpers.d.ts.map +1 -0
  324. package/dist/testing/integration_helpers.js +246 -0
  325. package/dist/testing/middleware.d.ts +125 -0
  326. package/dist/testing/middleware.d.ts.map +1 -0
  327. package/dist/testing/middleware.js +210 -0
  328. package/dist/testing/rate_limiting.d.ts +43 -0
  329. package/dist/testing/rate_limiting.d.ts.map +1 -0
  330. package/dist/testing/rate_limiting.js +216 -0
  331. package/dist/testing/round_trip.d.ts +37 -0
  332. package/dist/testing/round_trip.d.ts.map +1 -0
  333. package/dist/testing/round_trip.js +128 -0
  334. package/dist/testing/schema_generators.d.ts +33 -0
  335. package/dist/testing/schema_generators.d.ts.map +1 -0
  336. package/dist/testing/schema_generators.js +137 -0
  337. package/dist/testing/standard.d.ts +49 -0
  338. package/dist/testing/standard.d.ts.map +1 -0
  339. package/dist/testing/standard.js +16 -0
  340. package/dist/testing/stubs.d.ts +96 -0
  341. package/dist/testing/stubs.d.ts.map +1 -0
  342. package/dist/testing/stubs.js +192 -0
  343. package/dist/testing/surface_invariants.d.ts +189 -0
  344. package/dist/testing/surface_invariants.d.ts.map +1 -0
  345. package/dist/testing/surface_invariants.js +450 -0
  346. package/dist/ui/AccountSessions.svelte +75 -0
  347. package/dist/ui/AccountSessions.svelte.d.ts +19 -0
  348. package/dist/ui/AccountSessions.svelte.d.ts.map +1 -0
  349. package/dist/ui/AdminAccounts.svelte +107 -0
  350. package/dist/ui/AdminAccounts.svelte.d.ts +19 -0
  351. package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -0
  352. package/dist/ui/AdminAuditLog.svelte +144 -0
  353. package/dist/ui/AdminAuditLog.svelte.d.ts +4 -0
  354. package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -0
  355. package/dist/ui/AdminInvites.svelte +142 -0
  356. package/dist/ui/AdminInvites.svelte.d.ts +4 -0
  357. package/dist/ui/AdminInvites.svelte.d.ts.map +1 -0
  358. package/dist/ui/AdminOverview.svelte +337 -0
  359. package/dist/ui/AdminOverview.svelte.d.ts +4 -0
  360. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -0
  361. package/dist/ui/AdminPermitHistory.svelte +61 -0
  362. package/dist/ui/AdminPermitHistory.svelte.d.ts +19 -0
  363. package/dist/ui/AdminPermitHistory.svelte.d.ts.map +1 -0
  364. package/dist/ui/AdminSessions.svelte +85 -0
  365. package/dist/ui/AdminSessions.svelte.d.ts +19 -0
  366. package/dist/ui/AdminSessions.svelte.d.ts.map +1 -0
  367. package/dist/ui/AdminSettings.svelte +32 -0
  368. package/dist/ui/AdminSettings.svelte.d.ts +19 -0
  369. package/dist/ui/AdminSettings.svelte.d.ts.map +1 -0
  370. package/dist/ui/AdminSurface.svelte +42 -0
  371. package/dist/ui/AdminSurface.svelte.d.ts +4 -0
  372. package/dist/ui/AdminSurface.svelte.d.ts.map +1 -0
  373. package/dist/ui/AppShell.svelte +93 -0
  374. package/dist/ui/AppShell.svelte.d.ts +20 -0
  375. package/dist/ui/AppShell.svelte.d.ts.map +1 -0
  376. package/dist/ui/BootstrapForm.svelte +105 -0
  377. package/dist/ui/BootstrapForm.svelte.d.ts +4 -0
  378. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -0
  379. package/dist/ui/ColumnLayout.svelte +46 -0
  380. package/dist/ui/ColumnLayout.svelte.d.ts +11 -0
  381. package/dist/ui/ColumnLayout.svelte.d.ts.map +1 -0
  382. package/dist/ui/ConfirmButton.svelte +125 -0
  383. package/dist/ui/ConfirmButton.svelte.d.ts +54 -0
  384. package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -0
  385. package/dist/ui/Datatable.svelte +185 -0
  386. package/dist/ui/Datatable.svelte.d.ts +35 -0
  387. package/dist/ui/Datatable.svelte.d.ts.map +1 -0
  388. package/dist/ui/LoginForm.svelte +82 -0
  389. package/dist/ui/LoginForm.svelte.d.ts +8 -0
  390. package/dist/ui/LoginForm.svelte.d.ts.map +1 -0
  391. package/dist/ui/LogoutButton.svelte +36 -0
  392. package/dist/ui/LogoutButton.svelte.d.ts +10 -0
  393. package/dist/ui/LogoutButton.svelte.d.ts.map +1 -0
  394. package/dist/ui/MenuLink.svelte +35 -0
  395. package/dist/ui/MenuLink.svelte.d.ts +12 -0
  396. package/dist/ui/MenuLink.svelte.d.ts.map +1 -0
  397. package/dist/ui/OpenSignupToggle.svelte +36 -0
  398. package/dist/ui/OpenSignupToggle.svelte.d.ts +19 -0
  399. package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -0
  400. package/dist/ui/PopoverButton.svelte +136 -0
  401. package/dist/ui/PopoverButton.svelte.d.ts +63 -0
  402. package/dist/ui/PopoverButton.svelte.d.ts.map +1 -0
  403. package/dist/ui/SignupForm.svelte +117 -0
  404. package/dist/ui/SignupForm.svelte.d.ts +7 -0
  405. package/dist/ui/SignupForm.svelte.d.ts.map +1 -0
  406. package/dist/ui/SurfaceExplorer.svelte +287 -0
  407. package/dist/ui/SurfaceExplorer.svelte.d.ts +8 -0
  408. package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -0
  409. package/dist/ui/account_sessions_state.svelte.d.ts +15 -0
  410. package/dist/ui/account_sessions_state.svelte.d.ts.map +1 -0
  411. package/dist/ui/account_sessions_state.svelte.js +45 -0
  412. package/dist/ui/admin_accounts_state.svelte.d.ts +19 -0
  413. package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -0
  414. package/dist/ui/admin_accounts_state.svelte.js +65 -0
  415. package/dist/ui/admin_invites_state.svelte.d.ts +19 -0
  416. package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -0
  417. package/dist/ui/admin_invites_state.svelte.js +71 -0
  418. package/dist/ui/admin_sessions_state.svelte.d.ts +18 -0
  419. package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -0
  420. package/dist/ui/admin_sessions_state.svelte.js +62 -0
  421. package/dist/ui/app_settings_state.svelte.d.ts +14 -0
  422. package/dist/ui/app_settings_state.svelte.d.ts.map +1 -0
  423. package/dist/ui/app_settings_state.svelte.js +44 -0
  424. package/dist/ui/audit_log_state.svelte.d.ts +40 -0
  425. package/dist/ui/audit_log_state.svelte.d.ts.map +1 -0
  426. package/dist/ui/audit_log_state.svelte.js +153 -0
  427. package/dist/ui/auth_state.svelte.d.ts +85 -0
  428. package/dist/ui/auth_state.svelte.d.ts.map +1 -0
  429. package/dist/ui/auth_state.svelte.js +238 -0
  430. package/dist/ui/datatable.d.ts +25 -0
  431. package/dist/ui/datatable.d.ts.map +1 -0
  432. package/dist/ui/datatable.js +9 -0
  433. package/dist/ui/enter_advance.d.ts +13 -0
  434. package/dist/ui/enter_advance.d.ts.map +1 -0
  435. package/dist/ui/enter_advance.js +30 -0
  436. package/dist/ui/loadable.svelte.d.ts +55 -0
  437. package/dist/ui/loadable.svelte.d.ts.map +1 -0
  438. package/dist/ui/loadable.svelte.js +75 -0
  439. package/dist/ui/popover.svelte.d.ts +137 -0
  440. package/dist/ui/popover.svelte.d.ts.map +1 -0
  441. package/dist/ui/popover.svelte.js +288 -0
  442. package/dist/ui/position_helpers.d.ts +27 -0
  443. package/dist/ui/position_helpers.d.ts.map +1 -0
  444. package/dist/ui/position_helpers.js +81 -0
  445. package/dist/ui/sidebar_state.svelte.d.ts +30 -0
  446. package/dist/ui/sidebar_state.svelte.d.ts.map +1 -0
  447. package/dist/ui/sidebar_state.svelte.js +39 -0
  448. package/dist/ui/table_state.svelte.d.ts +63 -0
  449. package/dist/ui/table_state.svelte.d.ts.map +1 -0
  450. package/dist/ui/table_state.svelte.js +117 -0
  451. package/dist/ui/ui_fetch.d.ts +29 -0
  452. package/dist/ui/ui_fetch.d.ts.map +1 -0
  453. package/dist/ui/ui_fetch.js +37 -0
  454. package/dist/ui/ui_format.d.ts +63 -0
  455. package/dist/ui/ui_format.d.ts.map +1 -0
  456. package/dist/ui/ui_format.js +196 -0
  457. package/package.json +121 -0
@@ -0,0 +1,93 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+ import {is_editable, swallow} from '@fuzdev/fuz_util/dom.js';
5
+
6
+ import {SidebarState, sidebar_state_context} from './sidebar_state.svelte.js';
7
+
8
+ const {
9
+ children,
10
+ sidebar,
11
+ sidebar_width = 180,
12
+ sidebar_state: sidebar_state_prop,
13
+ keyboard_shortcut = false,
14
+ show_toggle = true,
15
+ toggle_button,
16
+ ...rest
17
+ }: SvelteHTMLElements['div'] & {
18
+ children: Snippet;
19
+ sidebar: Snippet;
20
+ sidebar_width?: number;
21
+ sidebar_state?: SidebarState;
22
+ keyboard_shortcut?: string | false;
23
+ show_toggle?: boolean;
24
+ toggle_button?: Snippet<[{title: string; show_sidebar: boolean; toggle: () => void}]>;
25
+ } = $props();
26
+
27
+ const get_sidebar_state = sidebar_state_context.set(
28
+ () => sidebar_state_prop ?? new SidebarState(),
29
+ );
30
+ const sidebar_state = $derived(get_sidebar_state());
31
+
32
+ const sidebar_width_px = $derived(sidebar_state.show_sidebar ? sidebar_width : 0);
33
+
34
+ const button_title = $derived(
35
+ (sidebar_state.show_sidebar ? 'hide sidebar' : 'show sidebar') +
36
+ (keyboard_shortcut ? ` [${keyboard_shortcut}]` : ''),
37
+ );
38
+ </script>
39
+
40
+ <svelte:window
41
+ onkeydowncapture={(e) => {
42
+ if (keyboard_shortcut && e.key === keyboard_shortcut && !is_editable(e.target)) {
43
+ sidebar_state.toggle_sidebar();
44
+ swallow(e);
45
+ }
46
+ }}
47
+ />
48
+
49
+ <div {...rest} style:--sidebar_width="{sidebar_width_px}px">
50
+ <div class="content" style:padding-left="var(--sidebar_width)">
51
+ {@render children()}
52
+ </div>
53
+ <div class="sidebar" style:width="var(--sidebar_width)">
54
+ {@render sidebar()}
55
+ </div>
56
+ {#if show_toggle}
57
+ {#if toggle_button}
58
+ {@render toggle_button({
59
+ title: button_title,
60
+ show_sidebar: sidebar_state.show_sidebar,
61
+ toggle: () => sidebar_state.toggle_sidebar(),
62
+ })}
63
+ {:else}
64
+ <button
65
+ type="button"
66
+ class="position:fixed bottom:0 left:0 icon_button plain border-radius:0 border_top_right_radius_sm"
67
+ aria-label={button_title}
68
+ title={button_title}
69
+ onclick={() => sidebar_state.toggle_sidebar()}
70
+ >
71
+ {sidebar_state.show_sidebar ? '\u2190' : '\u2192'}
72
+ </button>
73
+ {/if}
74
+ {/if}
75
+ </div>
76
+
77
+ <style>
78
+ .sidebar {
79
+ position: fixed;
80
+ top: 0;
81
+ left: 0;
82
+ height: 100%;
83
+ overflow: auto;
84
+ scrollbar-width: thin;
85
+ background: var(--sidebar_bg, var(--shade_05));
86
+ }
87
+
88
+ .content {
89
+ display: flex;
90
+ flex-direction: column;
91
+ min-height: 100vh;
92
+ }
93
+ </style>
@@ -0,0 +1,20 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { SvelteHTMLElements } from 'svelte/elements';
3
+ import { SidebarState } from './sidebar_state.svelte.js';
4
+ type $$ComponentProps = SvelteHTMLElements['div'] & {
5
+ children: Snippet;
6
+ sidebar: Snippet;
7
+ sidebar_width?: number;
8
+ sidebar_state?: SidebarState;
9
+ keyboard_shortcut?: string | false;
10
+ show_toggle?: boolean;
11
+ toggle_button?: Snippet<[{
12
+ title: string;
13
+ show_sidebar: boolean;
14
+ toggle: () => void;
15
+ }]>;
16
+ };
17
+ declare const AppShell: import("svelte").Component<$$ComponentProps, {}, "">;
18
+ type AppShell = ReturnType<typeof AppShell>;
19
+ export default AppShell;
20
+ //# sourceMappingURL=AppShell.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppShell.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/AppShell.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAC,YAAY,EAAwB,MAAM,2BAA2B,CAAC;AAE7E,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG;IACpD,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,IAAI,CAAA;KAAC,CAAC,CAAC,CAAC;CACtF,CAAC;AAiEH,QAAA,MAAM,QAAQ,sDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,105 @@
1
+ <script lang="ts">
2
+ import PendingButton from '@fuzdev/fuz_ui/PendingButton.svelte';
3
+ import {autofocus} from '@fuzdev/fuz_ui/autofocus.svelte.js';
4
+
5
+ import {Username} from '../auth/account_schema.js';
6
+ import {PASSWORD_LENGTH_MIN} from '../auth/password.js';
7
+ import {auth_state_context} from './auth_state.svelte.js';
8
+ import {enter_advance} from './enter_advance.js';
9
+
10
+ const auth_state = auth_state_context.get();
11
+
12
+ let token = $state('');
13
+ let username = $state('');
14
+ let password = $state('');
15
+ let password_confirm = $state('');
16
+
17
+ const username_valid = $derived(Username.safeParse(username).success);
18
+ const passwords_match = $derived(password === password_confirm);
19
+ const can_submit = $derived(
20
+ token.trim() &&
21
+ username.trim() &&
22
+ username_valid &&
23
+ password.length >= PASSWORD_LENGTH_MIN &&
24
+ passwords_match,
25
+ );
26
+
27
+ const handle_bootstrap = async (): Promise<void> => {
28
+ if (!can_submit) return;
29
+ await auth_state.bootstrap(token.trim(), username.trim(), password);
30
+ };
31
+ </script>
32
+
33
+ <form
34
+ class="width_atmost_md"
35
+ oninput={() => {
36
+ auth_state.verify_error = null;
37
+ }}
38
+ onsubmit={(e) => {
39
+ e.preventDefault();
40
+ void handle_bootstrap();
41
+ }}
42
+ {@attach enter_advance()}
43
+ >
44
+ <label class="display:block mb_sm">
45
+ <span class="text_50 font_size_sm">bootstrap token</span>
46
+ <input
47
+ type="password"
48
+ bind:value={token}
49
+ placeholder="paste token"
50
+ disabled={auth_state.verifying}
51
+ {@attach autofocus()}
52
+ />
53
+ </label>
54
+ <label class="display:block mb_sm">
55
+ <span class="text_50 font_size_sm">username</span>
56
+ <input
57
+ type="text"
58
+ bind:value={username}
59
+ placeholder="admin"
60
+ autocomplete="username"
61
+ disabled={auth_state.verifying}
62
+ />
63
+ </label>
64
+ {#if username && !username_valid}
65
+ <p class="color_c_50 font_size_sm mt_0 mb_xs">
66
+ 3-39 chars, starts with a letter, ends with letter/number, middle allows dash/underscore
67
+ </p>
68
+ {/if}
69
+ <label class="display:block mb_sm">
70
+ <span class="text_50 font_size_sm">password (min {PASSWORD_LENGTH_MIN} characters)</span>
71
+ <input
72
+ type="password"
73
+ bind:value={password}
74
+ placeholder="password"
75
+ autocomplete="new-password"
76
+ disabled={auth_state.verifying}
77
+ />
78
+ </label>
79
+ <label class="display:block mb_sm">
80
+ <span class="text_50 font_size_sm">confirm password</span>
81
+ <input
82
+ type="password"
83
+ bind:value={password_confirm}
84
+ placeholder="confirm password"
85
+ autocomplete="new-password"
86
+ disabled={auth_state.verifying}
87
+ />
88
+ </label>
89
+ {#if password && password_confirm && !passwords_match}
90
+ <p class="color_c_50 font_size_sm mt_0 mb_xs">passwords do not match</p>
91
+ {/if}
92
+ <div class="row gap_sm">
93
+ <PendingButton
94
+ pending={auth_state.verifying}
95
+ disabled={!can_submit}
96
+ onclick={handle_bootstrap}
97
+ class={auth_state.verify_error ? 'color_c' : ''}
98
+ >
99
+ create account
100
+ </PendingButton>
101
+ </div>
102
+ {#if auth_state.verify_error}
103
+ <p class="color_c_50 font_size_sm mt_xs mb_0">{auth_state.verify_error}</p>
104
+ {/if}
105
+ </form>
@@ -0,0 +1,4 @@
1
+ declare const BootstrapForm: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type BootstrapForm = ReturnType<typeof BootstrapForm>;
3
+ export default BootstrapForm;
4
+ //# sourceMappingURL=BootstrapForm.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BootstrapForm.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/BootstrapForm.svelte"],"names":[],"mappings":"AAqFA,QAAA,MAAM,aAAa,2DAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ const {
6
+ aside,
7
+ children,
8
+ column_width = '280px',
9
+ class: class_name = '',
10
+ ...rest
11
+ }: SvelteHTMLElements['div'] & {
12
+ aside: Snippet;
13
+ children: Snippet;
14
+ column_width?: string;
15
+ } = $props();
16
+ </script>
17
+
18
+ <div class="column_layout {class_name}" style:--column_width={column_width} {...rest}>
19
+ <aside class="column_fixed unstyled">
20
+ {@render aside()}
21
+ </aside>
22
+ <div class="column_fluid">
23
+ {@render children()}
24
+ </div>
25
+ </div>
26
+
27
+ <style>
28
+ .column_layout {
29
+ display: flex;
30
+ height: 100%;
31
+ }
32
+
33
+ .column_fixed {
34
+ width: var(--column_width, 280px);
35
+ min-width: var(--column_width, 280px);
36
+ height: 100%;
37
+ overflow: auto;
38
+ }
39
+
40
+ .column_fluid {
41
+ flex: 1;
42
+ height: 100%;
43
+ min-width: 0;
44
+ overflow: auto;
45
+ }
46
+ </style>
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { SvelteHTMLElements } from 'svelte/elements';
3
+ type $$ComponentProps = SvelteHTMLElements['div'] & {
4
+ aside: Snippet;
5
+ children: Snippet;
6
+ column_width?: string;
7
+ };
8
+ declare const ColumnLayout: import("svelte").Component<$$ComponentProps, {}, "">;
9
+ type ColumnLayout = ReturnType<typeof ColumnLayout>;
10
+ export default ColumnLayout;
11
+ //# sourceMappingURL=ColumnLayout.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnLayout.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ColumnLayout.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEvD,KAAK,gBAAgB,GAAI,kBAAkB,CAAC,KAAK,CAAC,GAAG;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AA2BH,QAAA,MAAM,YAAY,sDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,125 @@
1
+ <script lang="ts">
2
+ /**
3
+ * Confirmation popover wrapping `PopoverButton`.
4
+ *
5
+ * Clicking the trigger opens a popover with a confirm button.
6
+ * On confirm, calls `onconfirm` and hides the popover (controlled
7
+ * by `hide_on_confirm`). Defaults to `position="left"`.
8
+ *
9
+ * Snippets (`children`, `popover_content`, `popover_button_content`)
10
+ * receive both the `Popover` instance and a `confirm` callback.
11
+ *
12
+ * @example
13
+ * ```svelte
14
+ * <ConfirmButton
15
+ * onconfirm={() => delete_item(item.id)}
16
+ * title="delete item"
17
+ * disabled={deleting}
18
+ * >
19
+ * {#snippet children(_popover, _confirm)}
20
+ * {deleting ? 'deleting…' : 'delete'}
21
+ * {/snippet}
22
+ * </ConfirmButton>
23
+ * ```
24
+ *
25
+ * @example
26
+ * ```svelte
27
+ * <!-- custom confirm button content -->
28
+ * <ConfirmButton onconfirm={handle_revoke} class="icon_button plain" title="revoke">
29
+ * revoke
30
+ * {#snippet popover_button_content()}revoke{/snippet}
31
+ * </ConfirmButton>
32
+ * ```
33
+ *
34
+ * @module
35
+ */
36
+
37
+ import type {SvelteHTMLElements} from 'svelte/elements';
38
+ import type {ComponentProps, Snippet} from 'svelte';
39
+ import type {OmitStrict} from '@fuzdev/fuz_util/types.js';
40
+ import Glyph from '@fuzdev/fuz_ui/Glyph.svelte';
41
+
42
+ import PopoverButton from './PopoverButton.svelte';
43
+ import type {Popover} from './popover.svelte.js';
44
+
45
+ const GLYPH_REMOVE = '🗙';
46
+
47
+ const {
48
+ onconfirm,
49
+ popover_button_attrs,
50
+ hide_on_confirm = true,
51
+ position = 'left',
52
+ popover_content: popover_content_prop,
53
+ popover_button_content,
54
+ button,
55
+ children,
56
+ ...rest
57
+ }: OmitStrict<ComponentProps<typeof PopoverButton>, 'popover_content' | 'children'> &
58
+ OmitStrict<SvelteHTMLElements['button'], 'children'> & {
59
+ onconfirm: (popover: Popover) => void;
60
+ popover_button_attrs?: SvelteHTMLElements['button'] | undefined;
61
+ hide_on_confirm?: boolean | undefined;
62
+ /** Unlike on `PopoverButton` this is optional and has a `confirm` arg */
63
+ popover_content?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
64
+ /** Content for the popover button */
65
+ popover_button_content?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
66
+ /** Unlike on `PopoverButton` this has a `confirm` arg */
67
+ children?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
68
+ } = $props();
69
+
70
+ // TODO @many type union instead of this pattern?
71
+ $effect(() => {
72
+ if (popover_content_prop && popover_button_attrs) {
73
+ console.error(
74
+ 'ConfirmButton has both popover_content and popover_attrs defined - popover_content takes precedence',
75
+ );
76
+ }
77
+ if (popover_content_prop && popover_button_content) {
78
+ console.error(
79
+ 'ConfirmButton has both popover_content and popover_button_content defined - popover_content takes precedence',
80
+ );
81
+ }
82
+ });
83
+
84
+ const confirm = (popover: Popover): void => {
85
+ if (hide_on_confirm) popover.hide();
86
+ onconfirm(popover);
87
+ };
88
+ </script>
89
+
90
+ <!-- TODO the `as any` silences a type problem caused by the complex props -->
91
+ <PopoverButton
92
+ {position}
93
+ {button}
94
+ {...rest as any}
95
+ children={button ? undefined : children_default}
96
+ >
97
+ {#snippet popover_content(popover)}
98
+ {#if popover_content_prop}
99
+ {@render popover_content_prop(popover, () => confirm(popover))}
100
+ {:else}
101
+ <button
102
+ type="button"
103
+ class="color_c bg_100"
104
+ class:icon_button={!popover_button_content}
105
+ onclick={() => confirm(popover)}
106
+ title="confirm {rest.title || ''}"
107
+ {...popover_button_attrs}
108
+ >
109
+ {#if popover_button_content}
110
+ {@render popover_button_content(popover, () => confirm(popover))}
111
+ {:else}
112
+ <Glyph glyph={GLYPH_REMOVE} />
113
+ {/if}
114
+ </button>
115
+ {/if}
116
+ {/snippet}
117
+ </PopoverButton>
118
+
119
+ {#snippet children_default(popover: Popover)}
120
+ {#if children}
121
+ {@render children(popover, () => confirm(popover))}
122
+ {:else}
123
+ <Glyph glyph={GLYPH_REMOVE} />
124
+ {/if}
125
+ {/snippet}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Confirmation popover wrapping `PopoverButton`.
3
+ *
4
+ * Clicking the trigger opens a popover with a confirm button.
5
+ * On confirm, calls `onconfirm` and hides the popover (controlled
6
+ * by `hide_on_confirm`). Defaults to `position="left"`.
7
+ *
8
+ * Snippets (`children`, `popover_content`, `popover_button_content`)
9
+ * receive both the `Popover` instance and a `confirm` callback.
10
+ *
11
+ * @example
12
+ * ```svelte
13
+ * <ConfirmButton
14
+ * onconfirm={() => delete_item(item.id)}
15
+ * title="delete item"
16
+ * disabled={deleting}
17
+ * >
18
+ * {#snippet children(_popover, _confirm)}
19
+ * {deleting ? 'deleting…' : 'delete'}
20
+ * {/snippet}
21
+ * </ConfirmButton>
22
+ * ```
23
+ *
24
+ * @example
25
+ * ```svelte
26
+ * <!-- custom confirm button content -->
27
+ * <ConfirmButton onconfirm={handle_revoke} class="icon_button plain" title="revoke">
28
+ * revoke
29
+ * {#snippet popover_button_content()}revoke{/snippet}
30
+ * </ConfirmButton>
31
+ * ```
32
+ *
33
+ * @module
34
+ */
35
+ import type { SvelteHTMLElements } from 'svelte/elements';
36
+ import type { ComponentProps, Snippet } from 'svelte';
37
+ import type { OmitStrict } from '@fuzdev/fuz_util/types.js';
38
+ import PopoverButton from './PopoverButton.svelte';
39
+ import type { Popover } from './popover.svelte.js';
40
+ type $$ComponentProps = OmitStrict<ComponentProps<typeof PopoverButton>, 'popover_content' | 'children'> & OmitStrict<SvelteHTMLElements['button'], 'children'> & {
41
+ onconfirm: (popover: Popover) => void;
42
+ popover_button_attrs?: SvelteHTMLElements['button'] | undefined;
43
+ hide_on_confirm?: boolean | undefined;
44
+ /** Unlike on `PopoverButton` this is optional and has a `confirm` arg */
45
+ popover_content?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
46
+ /** Content for the popover button */
47
+ popover_button_content?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
48
+ /** Unlike on `PopoverButton` this has a `confirm` arg */
49
+ children?: Snippet<[popover: Popover, confirm: () => void]> | undefined;
50
+ };
51
+ declare const ConfirmButton: import("svelte").Component<$$ComponentProps, {}, "">;
52
+ type ConfirmButton = ReturnType<typeof ConfirmButton>;
53
+ export default ConfirmButton;
54
+ //# sourceMappingURL=ConfirmButton.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmButton.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/ConfirmButton.svelte"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCI;AACJ,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AACpD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAG1D,OAAO,aAAa,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAEhD,KAAK,gBAAgB,GAAI,UAAU,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,iBAAiB,GAAG,UAAU,CAAC,GACxG,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IACtD,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAChE,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,yEAAyE;IACzE,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IAC/E,qCAAqC;IACrC,sBAAsB,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;IACtF,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;CACxE,CAAC;AAyEJ,QAAA,MAAM,aAAa,sDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,185 @@
1
+ <script lang="ts" generics="T extends Record<string, any> = Record<string, any>">
2
+ import type {Snippet} from 'svelte';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ import {
6
+ DATATABLE_COLUMN_WIDTH_DEFAULT,
7
+ DATATABLE_MIN_COLUMN_WIDTH,
8
+ type DatatableColumn,
9
+ } from './datatable.js';
10
+ import {format_value} from './ui_format.js';
11
+
12
+ const {
13
+ columns,
14
+ rows,
15
+ row_key = 'id' as string & keyof T, // eslint-disable-line @typescript-eslint/no-duplicate-type-constituents
16
+ height,
17
+ header,
18
+ cell,
19
+ empty,
20
+ ...rest
21
+ }: SvelteHTMLElements['div'] & {
22
+ columns: Array<DatatableColumn<T>>;
23
+ rows: Array<T>;
24
+ row_key?: string & keyof T; // eslint-disable-line @typescript-eslint/no-duplicate-type-constituents
25
+ height?: string;
26
+ header?: Snippet<[column: DatatableColumn<T>]>;
27
+ cell?: Snippet<[column: DatatableColumn<T>, row: T, value: T[keyof T]]>;
28
+ empty?: Snippet;
29
+ } = $props();
30
+
31
+ // column widths — base from column defs, resize deltas layered on top
32
+ const resize_deltas: Record<string, number> = $state({});
33
+
34
+ const column_widths: Array<number> = $derived(
35
+ columns.map((c) => {
36
+ const base = c.width ?? DATATABLE_COLUMN_WIDTH_DEFAULT;
37
+ return Math.max(
38
+ c.min_width ?? DATATABLE_MIN_COLUMN_WIDTH,
39
+ base + (resize_deltas[c.key] ?? 0),
40
+ );
41
+ }),
42
+ );
43
+
44
+ const grid_template_columns = $derived(column_widths.map((w) => `${w}px`).join(' '));
45
+
46
+ // column resize
47
+ let resize_col_index: number | null = $state(null);
48
+ let resize_start_x = $state(0);
49
+ let resize_start_width = $state(0);
50
+
51
+ const handle_resize_start = (e: PointerEvent, index: number): void => {
52
+ e.preventDefault();
53
+ resize_col_index = index;
54
+ resize_start_x = e.clientX;
55
+ resize_start_width = column_widths[index]!;
56
+ (e.target as HTMLElement).setPointerCapture(e.pointerId);
57
+ };
58
+
59
+ const handle_resize_move = (e: PointerEvent): void => {
60
+ if (resize_col_index === null) return;
61
+ const column = columns[resize_col_index]!;
62
+ const base = column.width ?? DATATABLE_COLUMN_WIDTH_DEFAULT;
63
+ const desired = resize_start_width + (e.clientX - resize_start_x);
64
+ resize_deltas[column.key] = desired - base;
65
+ };
66
+
67
+ const handle_resize_end = (): void => {
68
+ resize_col_index = null;
69
+ };
70
+ </script>
71
+
72
+ <div
73
+ {...rest}
74
+ class="datatable {rest.class}"
75
+ style:height
76
+ style:grid-template-columns={grid_template_columns}
77
+ role="grid"
78
+ aria-rowcount={rows.length + 1}
79
+ >
80
+ <!-- sticky header -->
81
+ <div class="datatable_header" role="row" aria-rowindex={1}>
82
+ {#each columns as column, i (column.key)}
83
+ <div class="datatable_header_cell" role="columnheader">
84
+ {#if header}
85
+ {@render header(column)}
86
+ {:else}
87
+ {column.label}
88
+ {/if}
89
+ <div
90
+ class="datatable_resize_handle"
91
+ role="separator"
92
+ onpointerdown={(e) => handle_resize_start(e, i)}
93
+ onpointermove={handle_resize_move}
94
+ onpointerup={handle_resize_end}
95
+ ></div>
96
+ </div>
97
+ {/each}
98
+ </div>
99
+
100
+ {#if rows.length === 0}
101
+ <div class="datatable_empty">
102
+ {#if empty}
103
+ {@render empty()}
104
+ {:else}
105
+ <span class="text_50">no data</span>
106
+ {/if}
107
+ </div>
108
+ {:else}
109
+ {#each rows as row, i (row[row_key] ?? i)}
110
+ <div class="datatable_row" role="row" aria-rowindex={i + 2}>
111
+ {#each columns as column (column.key)}
112
+ <div class="datatable_cell" role="gridcell">
113
+ {#if cell}
114
+ {@render cell(column, row, row[column.key])}
115
+ {:else if column.format}
116
+ {column.format(row[column.key], row as any)}
117
+ {:else}
118
+ {format_value(row[column.key])}
119
+ {/if}
120
+ </div>
121
+ {/each}
122
+ </div>
123
+ {/each}
124
+ {/if}
125
+ </div>
126
+
127
+ <style>
128
+ .datatable {
129
+ display: grid;
130
+ align-content: start;
131
+ overflow: auto;
132
+ }
133
+
134
+ .datatable_header {
135
+ display: grid;
136
+ grid-column: 1 / -1;
137
+ grid-template-columns: subgrid;
138
+ position: sticky;
139
+ top: 0;
140
+ z-index: 1;
141
+ background: var(--bg, Canvas);
142
+ border-bottom: var(--border_width, 1px) solid var(--border_color);
143
+ }
144
+
145
+ .datatable_header_cell {
146
+ position: relative;
147
+ display: flex;
148
+ align-items: center;
149
+ padding: var(--space_xs);
150
+ font-weight: 600;
151
+ }
152
+
153
+ .datatable_resize_handle {
154
+ position: absolute;
155
+ top: 0;
156
+ right: 0;
157
+ width: 6px;
158
+ height: 100%;
159
+ cursor: col-resize;
160
+ }
161
+
162
+ .datatable_resize_handle:hover {
163
+ background: var(--color_a_5);
164
+ }
165
+
166
+ .datatable_row {
167
+ display: grid;
168
+ grid-column: 1 / -1;
169
+ grid-template-columns: subgrid;
170
+ align-items: start;
171
+ min-width: 0; /* override grid auto minimum to respect column widths */
172
+ border-bottom: var(--border_width, 1px) solid var(--border_color);
173
+ }
174
+
175
+ .datatable_cell {
176
+ padding: var(--space_xs);
177
+ min-width: 0; /* override grid auto minimum to respect column widths */
178
+ overflow-wrap: break-word;
179
+ }
180
+
181
+ .datatable_empty {
182
+ grid-column: 1 / -1;
183
+ padding: var(--space_lg);
184
+ }
185
+ </style>