@fuzdev/fuz_app 0.171.0 → 0.173.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 (53) hide show
  1. package/dist/actions/CLAUDE.md +1 -1
  2. package/dist/actions/perform_action.d.ts +4 -3
  3. package/dist/actions/perform_action.d.ts.map +1 -1
  4. package/dist/actions/perform_action.js +21 -16
  5. package/dist/http/CLAUDE.md +5 -4
  6. package/dist/http/error_schemas.d.ts +11 -5
  7. package/dist/http/error_schemas.d.ts.map +1 -1
  8. package/dist/http/error_schemas.js +12 -6
  9. package/dist/http/host.d.ts +137 -0
  10. package/dist/http/host.d.ts.map +1 -0
  11. package/dist/http/host.js +203 -0
  12. package/dist/http/json_text.d.ts +4 -0
  13. package/dist/http/json_text.d.ts.map +1 -1
  14. package/dist/http/json_text.js +4 -0
  15. package/dist/http/origin.d.ts +9 -0
  16. package/dist/http/origin.d.ts.map +1 -1
  17. package/dist/http/origin.js +6 -2
  18. package/dist/http/origin_wildcard.d.ts +20 -5
  19. package/dist/http/origin_wildcard.d.ts.map +1 -1
  20. package/dist/http/origin_wildcard.js +22 -10
  21. package/dist/http/route_spec.d.ts.map +1 -1
  22. package/dist/http/route_spec.js +8 -2
  23. package/dist/http/schema_helpers.d.ts +21 -7
  24. package/dist/http/schema_helpers.d.ts.map +1 -1
  25. package/dist/http/schema_helpers.js +31 -13
  26. package/dist/server/app_server.d.ts +10 -0
  27. package/dist/server/app_server.d.ts.map +1 -1
  28. package/dist/server/app_server.js +14 -3
  29. package/dist/testing/CLAUDE.md +5 -6
  30. package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
  31. package/dist/testing/cross_backend/in_process_setup.d.ts.map +1 -1
  32. package/dist/testing/cross_backend/in_process_setup.js +2 -1
  33. package/dist/testing/cross_backend/origin_conformance.d.ts +62 -1
  34. package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
  35. package/dist/testing/cross_backend/origin_conformance.js +34 -5
  36. package/dist/testing/cross_backend/origin_conformance.json +330 -0
  37. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +6 -6
  38. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  39. package/dist/testing/cross_backend/rust_spine_consumer_surface.js +4 -15
  40. package/dist/testing/cross_backend/testing_origin_check.d.ts +16 -1
  41. package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -1
  42. package/dist/testing/cross_backend/testing_origin_check.js +12 -4
  43. package/dist/testing/cross_backend/testing_server_core.d.ts +2 -2
  44. package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
  45. package/dist/testing/cross_backend/testing_server_core.js +3 -3
  46. package/dist/testing/stubs.d.ts +11 -4
  47. package/dist/testing/stubs.d.ts.map +1 -1
  48. package/dist/testing/stubs.js +10 -5
  49. package/dist/ui/AppShell.svelte +1 -1
  50. package/dist/ui/PopoverButton.svelte +1 -1
  51. package/dist/ui/popover.svelte.d.ts +1 -1
  52. package/dist/ui/popover.svelte.js +1 -1
  53. package/package.json +8 -4
@@ -1 +1 @@
1
- {"version":3,"file":"testing_origin_check.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_origin_check.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAaN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAS3E,yEAAyE;AACzE,eAAO,MAAM,uBAAuB;;;;;;;IACnC,mEAAmE;;IAEnE,wEAAwE;;EAEvE,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACpC,OAAO,uBAAuB,KAC5B,wBAcF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;QApE5C,mEAAmE;;QAEnE,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8E3B,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAO,SACyC,CAAC"}
1
+ {"version":3,"file":"testing_origin_check.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_origin_check.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AAEH,OAAO,EAaN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAU3E,yEAAyE;AACzE,eAAO,MAAM,uBAAuB;;;;;;;;;IACnC,mEAAmE;;IAEnE,wEAAwE;;IAExE;;;OAGG;;EAEF,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE5E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWnC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE9E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACpC,OAAO,uBAAuB,KAC5B,wBAgBF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;QA5E5C,mEAAmE;;QAEnE,wEAAwE;;QAExE;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiF0C,CAAC;AAE/C,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,QAAO,SACyC,CAAC"}
@@ -14,13 +14,19 @@ import '../assert_dev_env.js';
14
14
  import { array, boolean, literal, min_value, nullable, number, object, optional, pipe, safe_integer, string, union } from '@fuzdev/fuz_schema/schema.ts';
15
15
  import { rpc_action } from '../../actions/action_types.js';
16
16
  import { AllowedOriginsErrorKind, parse_allowed_origins, should_allow_origin } from '../../http/origin.js';
17
+ import { allows_request_hosts } from '../../http/host.js';
17
18
  import { TESTING_ACTION_AUTH } from './spine_surface_constants.js';
18
19
  /** Input of `_testing_origin_check`, a `@fuzdev/fuz_schema` `object`. */
19
20
  export const TestingOriginCheckInput = object({
20
21
  /** An allowlist value, as `FUZ_ALLOWED_ORIGINS` would carry it. */
21
22
  patterns: string,
22
23
  /** One `Origin` header's value, or `null` for a request without one. */
23
- origin: nullable(string)
24
+ origin: nullable(string),
25
+ /**
26
+ * The request's `Host` header values (`[]` for none), checked by the host
27
+ * gate (`allows_request_hosts`); absent, the host gate isn't asked.
28
+ */
29
+ hosts: optional(array(string))
24
30
  });
25
31
  /**
26
32
  * Output of `_testing_origin_check`, a `@fuzdev/fuz_schema` `union`: the
@@ -40,7 +46,8 @@ export const TestingOriginCheckOutput = union([
40
46
  /**
41
47
  * Answer one `_testing_origin_check` input: parse `patterns` with
42
48
  * `parse_allowed_origins`, then run the request-level check for one `Origin`
43
- * carrying `origin` (`null` — no `Origin` — passes). The action handler and
49
+ * carrying `origin` (`null` — no `Origin` — passes), and with `hosts` the host
50
+ * gate's check of those `Host` values too. The action handler and
44
51
  * the conformance table's unit test both call this, so the table checks the
45
52
  * same function the wire serves.
46
53
  *
@@ -57,7 +64,8 @@ export const run_testing_origin_check = (input) => {
57
64
  }
58
65
  return {
59
66
  ok: true,
60
- allowed: input.origin === null || should_allow_origin(input.origin, parsed.origins)
67
+ allowed: (input.origin === null || should_allow_origin(input.origin, parsed.origins)) &&
68
+ (input.hosts === undefined || allows_request_hosts(input.hosts, parsed.origins))
61
69
  };
62
70
  };
63
71
  /**
@@ -84,7 +92,7 @@ export const testing_origin_check_action_spec = {
84
92
  output: TestingOriginCheckOutput,
85
93
  async: true,
86
94
  description: "Test-binary only — answer the origin allowlist's parse and request check for one " +
87
- '{patterns, origin} pair, for the cross-impl origin conformance table.'
95
+ '{patterns, origin, hosts?} input, for the cross-impl origin conformance table.'
88
96
  };
89
97
  /** Build the standalone `_testing_origin_check` action (see the spec doc). */
90
98
  export const create_testing_origin_check_action = () => rpc_action(testing_origin_check_action_spec, async (input) => run_testing_origin_check(input));
@@ -172,7 +172,7 @@ export interface StartTestingServerOptions {
172
172
  * interface IP — e.g. `--host 192.168.1.50` — would otherwise slip through.
173
173
  * Covers `localhost`, the IPv4 loopback `127.0.0.0/8`, and IPv6 `::1`.
174
174
  */
175
- export declare const is_loopback_host: (host: string) => boolean;
175
+ export declare const is_loopback_bind_host: (host: string) => boolean;
176
176
  /**
177
177
  * Boot a test-mode server using the supplied runtime adapter.
178
178
  *
@@ -181,7 +181,7 @@ export declare const is_loopback_host: (host: string) => boolean;
181
181
  * caller's no-domain (or domain) `StartTestingServerOptions.build_app`
182
182
  * and the runtime boundary is the `TestingServerAdapter`. Refuses any
183
183
  * non-loopback bind host (the test binary must stay on loopback — see
184
- * `is_loopback_host`).
184
+ * `is_loopback_bind_host`).
185
185
  */
186
186
  export declare const start_testing_server: (options: StartTestingServerOptions) => Promise<void>;
187
187
  //# sourceMappingURL=testing_server_core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing_server_core.d.ts","sourceRoot":"../src/lib/","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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AAI,CAkE3F,CAAC"}
@@ -10,7 +10,7 @@ import { write_daemon_info, read_daemon_info, is_daemon_running } from '../daemo
10
10
  * interface IP — e.g. `--host 192.168.1.50` — would otherwise slip through.
11
11
  * Covers `localhost`, the IPv4 loopback `127.0.0.0/8`, and IPv6 `::1`.
12
12
  */
13
- export const is_loopback_host = (host) => {
13
+ export const is_loopback_bind_host = (host) => {
14
14
  const h = host.replace(/^\[(.*)\]$/, '$1'); // unwrap an `[::1]`-style IPv6 literal
15
15
  return h === 'localhost' || h === '::1' || /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
16
16
  };
@@ -22,13 +22,13 @@ export const is_loopback_host = (host) => {
22
22
  * caller's no-domain (or domain) `StartTestingServerOptions.build_app`
23
23
  * and the runtime boundary is the `TestingServerAdapter`. Refuses any
24
24
  * non-loopback bind host (the test binary must stay on loopback — see
25
- * `is_loopback_host`).
25
+ * `is_loopback_bind_host`).
26
26
  */
27
27
  export const start_testing_server = async (options) => {
28
28
  const { adapter, daemon_name, host, port, app_version, build_app } = options;
29
29
  const log = options.log ?? new Logger(`[${daemon_name}]`);
30
30
  const { runtime } = adapter;
31
- if (!is_loopback_host(host)) {
31
+ if (!is_loopback_bind_host(host)) {
32
32
  log.error(`FATAL: binding to '${host}' exposes the test binary (which ships deterministic ` +
33
33
  `dev secrets) beyond loopback. Use --host localhost (default), 127.0.0.1, or ::1 instead.`);
34
34
  adapter.exit(1);
@@ -225,6 +225,12 @@ export interface CreateTestAppSurfaceSpecOptions {
225
225
  * read: the spec's handler here is a stub.
226
226
  */
227
227
  max_body_size?: number | null;
228
+ /**
229
+ * Symmetric with `AppServerOptions.host_gate` — `false` leaves out the host
230
+ * gate's spec, so the stub surface matches a server built without it.
231
+ * Defaults to `true`.
232
+ */
233
+ host_gate?: boolean;
228
234
  }
229
235
  /**
230
236
  * Create an `AppSurfaceSpec` for the standard testing suites.
@@ -244,9 +250,10 @@ export interface CreateTestAppSurfaceSpecOptions {
244
250
  * middleware's scope (`assert_endpoint_in_auth_scope`), of a route that
245
251
  * reads or mints a credential outside it
246
252
  * (`assert_credential_routes_in_auth_scope`), and of a
247
- * `transform_middleware` that doesn't keep the proxy and auth stack mounted
248
- * (`assert_middleware_stack_mounted`). The middleware list mirrors the real
249
- * one: a stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
253
+ * `transform_middleware` that doesn't keep the host gate, proxy and auth stack
254
+ * mounted (`assert_middleware_stack_mounted`). The middleware list mirrors the
255
+ * real one: the host gate's shape at `'*'` (unless `host_gate` is `false`), a
256
+ * stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
250
257
  * `daemon_token` when `options.daemon_token` is set). If
251
258
  * `create_app_server` changes how it wires routes, update this helper
252
259
  * to stay in sync (single source of truth for all consumers). The body
@@ -259,7 +266,7 @@ export interface CreateTestAppSurfaceSpecOptions {
259
266
  * credential, is outside `AUTH_MIDDLEWARE_PATH`, a
260
267
  * `ws_endpoints` spec declares no `allowed_origins` and no `allowed_origins`
261
268
  * option is given, or `transform_middleware` moves, drops, duplicates,
262
- * reorders, wraps, or replaces the stub proxy spec or a stub auth spec
269
+ * reorders, wraps, or replaces the stub host gate, proxy or auth spec
263
270
  */
264
271
  export declare const create_test_app_surface_spec: (options: CreateTestAppSurfaceSpecOptions) => AppSurfaceSpec;
265
272
  //# sourceMappingURL=stubs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stubs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/stubs.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,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AAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAC7F;;;;;;;;OAQG;IACH,YAAY,CAAC,EACZ,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,gBAAgB,KAAK,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5F;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/E;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC9C;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,+BAA+B,KACtC,cAkHF,CAAC"}
@@ -10,6 +10,7 @@ import './assert_dev_env.js';
10
10
  import { Logger } from '@fuzdev/fuz_util/log.ts';
11
11
  import { REST_FORBIDDEN_ORIGIN } from '../http/error_schemas.js';
12
12
  import { body_limit_middleware_shape } from '../http/body_limit_schema.js';
13
+ import { host_gate_middleware_shape } from '../http/host.js';
13
14
  import { create_realtime_closer } from '../actions/connection_closer.js';
14
15
  import { Db } from '../db/db.js';
15
16
  import { attach_route_handler, prefix_route_specs } from '../http/route_spec.js';
@@ -285,9 +286,10 @@ const assert_self_resolved_ws_origins = (endpoint) => {
285
286
  * middleware's scope (`assert_endpoint_in_auth_scope`), of a route that
286
287
  * reads or mints a credential outside it
287
288
  * (`assert_credential_routes_in_auth_scope`), and of a
288
- * `transform_middleware` that doesn't keep the proxy and auth stack mounted
289
- * (`assert_middleware_stack_mounted`). The middleware list mirrors the real
290
- * one: a stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
289
+ * `transform_middleware` that doesn't keep the host gate, proxy and auth stack
290
+ * mounted (`assert_middleware_stack_mounted`). The middleware list mirrors the
291
+ * real one: the host gate's shape at `'*'` (unless `host_gate` is `false`), a
292
+ * stub `trusted_proxy` spec at `'*'`, then the stub auth stack (with
291
293
  * `daemon_token` when `options.daemon_token` is set). If
292
294
  * `create_app_server` changes how it wires routes, update this helper
293
295
  * to stay in sync (single source of truth for all consumers). The body
@@ -300,7 +302,7 @@ const assert_self_resolved_ws_origins = (endpoint) => {
300
302
  * credential, is outside `AUTH_MIDDLEWARE_PATH`, a
301
303
  * `ws_endpoints` spec declares no `allowed_origins` and no `allowed_origins`
302
304
  * option is given, or `transform_middleware` moves, drops, duplicates,
303
- * reorders, wraps, or replaces the stub proxy spec or a stub auth spec
305
+ * reorders, wraps, or replaces the stub host gate, proxy or auth spec
304
306
  */
305
307
  export const create_test_app_surface_spec = (options) => {
306
308
  const ctx = create_stub_app_server_context(options.session_options);
@@ -372,8 +374,11 @@ export const create_test_app_surface_spec = (options) => {
372
374
  ];
373
375
  // refused like `create_app_server` refuses it
374
376
  assert_credential_routes_in_auth_scope(route_specs);
375
- // mirrors `create_app_server`'s `[proxy_spec, ...auth_middleware]`
377
+ // mirrors `create_app_server`'s `[host_spec, proxy_spec, ...auth_middleware]`
376
378
  const stack_specs = [
379
+ ...(options.host_gate === false
380
+ ? []
381
+ : [{ ...host_gate_middleware_shape, handler: create_stub_mw() }]),
377
382
  { name: 'trusted_proxy', path: '*', handler: create_stub_mw() },
378
383
  ...create_stub_api_middleware({
379
384
  include_daemon_token: options.daemon_token,
@@ -329,7 +329,7 @@
329
329
  {:else}
330
330
  <button
331
331
  type="button"
332
- class="app-shell-toggle position:fixed bottom:0 left:0 icon_button plain border-radius:0 border_top_right_radius_sm"
332
+ class="app-shell-toggle fixed bottom:0 left:0 icon_button plain border-radius:0 border_top_right_radius_sm"
333
333
  aria-label="sidebar"
334
334
  aria-keyshortcuts={keyboard_shortcut || undefined}
335
335
  aria-expanded={sidebar_state.show_sidebar}
@@ -104,7 +104,7 @@
104
104
  <!-- TODO these flex values fix some layout cases so that the container is laid out like the button, but this is a partial solution -->
105
105
  <div
106
106
  {...popover_container_attrs}
107
- class="position:relative {popover_container_attrs?.class}"
107
+ class="relative {popover_container_attrs?.class}"
108
108
  {@attach popover.container}
109
109
  >
110
110
  {#if button}
@@ -29,7 +29,7 @@
29
29
  * const popover = new Popover();
30
30
  * </script>
31
31
  *
32
- * <div class="position:relative" {@attach popover.container}>
32
+ * <div class="relative" {@attach popover.container}>
33
33
  * <button type="button" {@attach popover.trigger({position: 'bottom', align: 'center'})}>
34
34
  * toggle
35
35
  * </button>
@@ -29,7 +29,7 @@
29
29
  * const popover = new Popover();
30
30
  * </script>
31
31
  *
32
- * <div class="position:relative" {@attach popover.container}>
32
+ * <div class="relative" {@attach popover.container}>
33
33
  * <button type="button" {@attach popover.trigger({position: 'bottom', align: 'center'})}>
34
34
  * toggle
35
35
  * </button>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/fuz_app",
3
- "version": "0.171.0",
3
+ "version": "0.173.0",
4
4
  "description": "fullstack app library",
5
5
  "glyph": "🗝",
6
6
  "logo": "logo.svg",
@@ -36,8 +36,9 @@
36
36
  "peerDependencies": {
37
37
  "@electric-sql/pglite": ">=0.4",
38
38
  "@fuzdev/blake3-wasm": ">=0.2.0",
39
- "@fuzdev/fuz_css": ">=0.72.0",
39
+ "@fuzdev/fuz_css": ">=0.76.0",
40
40
  "@fuzdev/fuz_schema": "^0.5.6",
41
+ "@fuzdev/fuz_ui": ">=0.224.0",
41
42
  "@fuzdev/fuz_util": ">=0.79.0",
42
43
  "@fuzdev/pglet-wasm": ">=0.1.2",
43
44
  "@hono/bun": ">=1",
@@ -59,6 +60,9 @@
59
60
  "@fuzdev/fuz_css": {
60
61
  "optional": true
61
62
  },
63
+ "@fuzdev/fuz_ui": {
64
+ "optional": true
65
+ },
62
66
  "@fuzdev/pglet-wasm": {
63
67
  "optional": true
64
68
  },
@@ -94,9 +98,9 @@
94
98
  "@electric-sql/pglite": "^0.5.8",
95
99
  "@fuzdev/blake3-wasm": "^0.2.0",
96
100
  "@fuzdev/fuz_code": "^0.56.0",
97
- "@fuzdev/fuz_css": "^0.73.0",
101
+ "@fuzdev/fuz_css": "^0.76.1",
98
102
  "@fuzdev/fuz_schema": "^0.5.6",
99
- "@fuzdev/fuz_ui": "^0.222.1",
103
+ "@fuzdev/fuz_ui": "^0.224.0",
100
104
  "@fuzdev/fuz_util": "^0.79.1",
101
105
  "@fuzdev/gro": "^0.225.0",
102
106
  "@fuzdev/mdz": "^0.7.0",