brumate 0.4.0 → 0.4.2

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 (62) hide show
  1. package/dist/{boot-DLlRmD9z.d.ts → boot-D3NjfyUX.d.ts} +2 -2
  2. package/dist/cli.js +2 -2
  3. package/dist/{client-BvDsC6Qr.js → client-Cwr2AfP4.js} +133 -35
  4. package/dist/client-Cwr2AfP4.js.map +1 -0
  5. package/dist/{client-DBwL2wKQ.d.ts → client-DNva05jp.d.ts} +20 -7
  6. package/dist/{defer-CKWZLv2K.js → defer-CxjvJXD_.js} +2 -2
  7. package/dist/{defer-CKWZLv2K.js.map → defer-CxjvJXD_.js.map} +1 -1
  8. package/dist/{devtools-4uTPwR_v.js → devtools-BdB_9WB8.js} +4 -4
  9. package/dist/{devtools-4uTPwR_v.js.map → devtools-BdB_9WB8.js.map} +1 -1
  10. package/dist/{devtools-panel-Be9pxYgv.js → devtools-panel-Bp6LE4nM.js} +2 -2
  11. package/dist/{devtools-panel-Be9pxYgv.js.map → devtools-panel-Bp6LE4nM.js.map} +1 -1
  12. package/dist/{files-WW4RlajL.js → files-BzVNgGOL.js} +2 -2
  13. package/dist/{files-WW4RlajL.js.map → files-BzVNgGOL.js.map} +1 -1
  14. package/dist/{html-BtKRyi7g.js → html-t1JpkODI.js} +15 -7
  15. package/dist/html-t1JpkODI.js.map +1 -0
  16. package/dist/index.d.ts +7 -1
  17. package/dist/index.js +1 -1
  18. package/dist/{inspect-Y6y4uNZp.js → inspect-DaZtoKgg.js} +290 -70
  19. package/dist/inspect-DaZtoKgg.js.map +1 -0
  20. package/dist/{loader-BjKGJzLN.js → loader-BX8uIUav.js} +2 -2
  21. package/dist/{loader-BjKGJzLN.js.map → loader-BX8uIUav.js.map} +1 -1
  22. package/dist/produce-CLABZ8k2.d.ts +11 -0
  23. package/dist/{produce-B7X9ori9.js → produce-DS-dQaUX.js} +5 -3
  24. package/dist/produce-DS-dQaUX.js.map +1 -0
  25. package/dist/{rpc-Q-XkLwFh.js → rpc-t5M5dqs9.js} +3 -3
  26. package/dist/{rpc-Q-XkLwFh.js.map → rpc-t5M5dqs9.js.map} +1 -1
  27. package/dist/runtime/client.d.ts +4 -4
  28. package/dist/runtime/client.js +4 -4
  29. package/dist/runtime/devtools.d.ts +2 -2
  30. package/dist/runtime/devtools.js +1 -1
  31. package/dist/runtime/hot.d.ts +1 -1
  32. package/dist/runtime/html.d.ts +2 -2
  33. package/dist/runtime/html.js +1 -1
  34. package/dist/runtime/loader.d.ts +2 -2
  35. package/dist/runtime/loader.js +2 -2
  36. package/dist/runtime/server.d.ts +3 -3
  37. package/dist/runtime/server.js +3 -3
  38. package/dist/runtime/static-loader.d.ts +2 -2
  39. package/dist/runtime/static-loader.js +1 -1
  40. package/dist/runtime/testing.d.ts +2 -2
  41. package/dist/runtime/testing.js +2 -2
  42. package/dist/{server-BvPIg9pT.d.ts → server-BXMH3Z9T.d.ts} +23 -3
  43. package/dist/{server-DjyOVJtJ.js → server-C6c-GXF4.js} +54 -16
  44. package/dist/server-C6c-GXF4.js.map +1 -0
  45. package/dist/shared-CzbnWkVA.d.ts +255 -0
  46. package/dist/{static-loader-BGgdp_Y5.d.ts → static-loader-BiUaZaag.d.ts} +2 -2
  47. package/dist/{static-loader-BZR17hSw.js → static-loader-CqQRu-p9.js} +4 -3
  48. package/dist/{static-loader-BZR17hSw.js.map → static-loader-CqQRu-p9.js.map} +1 -1
  49. package/dist/{stream-BP5AVmg5.js → stream-CqhuQJwK.js} +4 -4
  50. package/dist/stream-CqhuQJwK.js.map +1 -0
  51. package/dist/vite.d.ts +1 -1
  52. package/dist/vite.js +72 -12
  53. package/dist/vite.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/client-BvDsC6Qr.js.map +0 -1
  56. package/dist/html-BtKRyi7g.js.map +0 -1
  57. package/dist/html-Bw9Qwu6F.d.ts +0 -107
  58. package/dist/inspect-Y6y4uNZp.js.map +0 -1
  59. package/dist/produce-B7X9ori9.js.map +0 -1
  60. package/dist/produce-DIgHBVwL.d.ts +0 -148
  61. package/dist/server-DjyOVJtJ.js.map +0 -1
  62. package/dist/stream-BP5AVmg5.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { n as closesParagraph, r as firstTag } from "./nesting-DA5vJw9X.js";
2
2
  import { n as MODIFIERS } from "./events-LgLdp1R7.js";
3
- import { C as styleElement, S as spread$1, _ as onAttribute, d as escapeAttribute, f as handlerEntry, h as isRaw, n as VOID_ELEMENTS, p as insertValue, r as actionAttributes, s as bindEntry, u as escape, x as rawHTML, y as ownValue } from "./html-BtKRyi7g.js";
3
+ import { C as spread$1, S as rawHTML, b as ownValue, d as escapeAttribute, f as handlerEntry, g as isRaw, n as VOID_ELEMENTS, p as insertValue, r as actionAttributes, s as bindEntry, u as escape, v as onAttribute, w as styleElement } from "./html-t1JpkODI.js";
4
4
  import { n as deleteCookie, o as setCookie, r as getCookies } from "./cookies-Cnbf4w-S.js";
5
- import { a as plugins, c as functionReferences, i as callPlugins, o as serialOptions, r as toChunkStream, s as syncPlugins, t as STREAM_TYPE } from "./stream-BP5AVmg5.js";
6
- import { a as ElementReference, b as parseId, c as PARTS, d as SlotReference, f as addEntryHandlers, g as isSlotReference, i as ChildrenReference, l as PropPromise, m as isBinding, n as Binding, o as FunctionReference, p as isAsyncIterable, r as CHILDREN_REF, s as MemoError } from "./produce-B7X9ori9.js";
5
+ import { a as plugins, c as functionReferences, i as callPlugins, o as serialOptions, r as toChunkStream, s as syncPlugins, t as STREAM_TYPE } from "./stream-CqhuQJwK.js";
6
+ import { a as ElementReference, b as parseId, c as PARTS, d as SlotReference, f as addEntryHandlers, g as isSlotReference, i as ChildrenReference, l as PropPromise, m as isBinding, n as Binding, o as FunctionReference, p as isAsyncIterable, r as CHILDREN_REF, s as MemoError } from "./produce-DS-dQaUX.js";
7
7
  import { n as serverSecrets } from "./secrets-BxagsJxJ.js";
8
8
  import "./context-CTiSzQRc.js";
9
9
  import { a as applyIntent, d as formatPath, f as getAt, m as groupIssues, r as INTENT, u as formValues, v as parseIntent, y as parsePath } from "./forms-nXK7-Lv_.js";
@@ -1322,6 +1322,8 @@ var Context = class Context {
1322
1322
  /** The scope that the render used last, since it uses one a few times in a row. */
1323
1323
  last;
1324
1324
  root;
1325
+ /** The keys of the signals that a visible `$client` waits for. See `near`. */
1326
+ waited;
1325
1327
  /** The ID spaces of the blocks that the render is in, from the outside in. */
1326
1328
  spaces;
1327
1329
  baseId;
@@ -1747,14 +1749,21 @@ var Context = class Context {
1747
1749
  * writes in the browser go to the parent's slots.
1748
1750
  */
1749
1751
  bindings(scope, props, slots) {
1752
+ this.bound(scope, props, slots);
1750
1753
  for (const [name, slot] of Object.entries(slots)) {
1751
1754
  const value = props[name];
1752
- if (isBinding(value)) {
1753
- const record = this.entry(scope).record;
1754
- (record.b ??= {})[slot] = value.target;
1755
- const written = record.s?.[slot];
1756
- if (written instanceof ElementReference && isSlotReference(value.target)) this.forward(value.target, written);
1757
- }
1755
+ const written = this.entry(scope).record.s?.[slot];
1756
+ if (isBinding(value) && written instanceof ElementReference && isSlotReference(value.target)) this.forward(value.target, written);
1757
+ }
1758
+ }
1759
+ /**
1760
+ * Records where the bound props write, before the component renders its markup, so an element
1761
+ * that it forwards can name the signal at the end of the bindings. See `refKey`.
1762
+ */
1763
+ bound(scope, props, slots) {
1764
+ for (const [name, slot] of Object.entries(slots)) {
1765
+ const value = props[name];
1766
+ if (isBinding(value)) (this.entry(scope).record.b ??= {})[slot] = value.target;
1758
1767
  }
1759
1768
  }
1760
1769
  /**
@@ -1767,6 +1776,10 @@ var Context = class Context {
1767
1776
  entry.record.i = value;
1768
1777
  if (source) entry.source = source;
1769
1778
  }
1779
+ /** Records the scope where the template with the scope `template` was called. */
1780
+ call(template, at) {
1781
+ this.record(template).l = at;
1782
+ }
1770
1783
  /** Records the scope of a child component at an anchor of its parent. */
1771
1784
  link(scope, anchor, child) {
1772
1785
  const record = this.record(scope);
@@ -1782,9 +1795,36 @@ var Context = class Context {
1782
1795
  */
1783
1796
  restRef(attributes, scope, anchor, tag) {
1784
1797
  const value = attributes.ref;
1785
- if (typeof tag !== "function" && isBinding(value) && isSlotReference(value.target)) this.forward(value.target, new ElementReference(scope, anchor));
1798
+ if (typeof tag !== "function" && isBinding(value)) {
1799
+ if (isSlotReference(value.target)) this.forward(value.target, new ElementReference(scope, anchor));
1800
+ else (this.record(scope).r ??= {})[anchor] = value.target;
1801
+ }
1786
1802
  return attributes;
1787
1803
  }
1804
+ /**
1805
+ * The `b-near` attribute of a visible `$client` that reads the signal at `slot` of `scope`,
1806
+ * which a component may get with `ref=$bind(...)`. It records the key, so `refKey` marks only
1807
+ * the elements that a callback waits for.
1808
+ */
1809
+ near(scope, slot) {
1810
+ const key = `${scope}.${slot}`;
1811
+ (this.root.waited ??= /* @__PURE__ */ new Set()).add(key);
1812
+ return ` b-near="${key}"`;
1813
+ }
1814
+ /**
1815
+ * The `b-r` attribute of an element that a component forwards for its caller: the scope and slot
1816
+ * of the signal at the end of the bindings, `S.slot`, when a visible `$client` waits for it.
1817
+ * The loader finds the element by it. Empty otherwise.
1818
+ */
1819
+ refKey(scope, slot) {
1820
+ let target = this.ownRecord(scope)?.b?.[slot];
1821
+ let key = "";
1822
+ while (isSlotReference(target)) {
1823
+ key = `${target.scope}.${target.slot}`;
1824
+ target = this.find(target.scope)?.record.b?.[target.slot];
1825
+ }
1826
+ return this.root.waited?.has(key) ? ` b-r="${key}"` : "";
1827
+ }
1788
1828
  /** Returns the reference that a `ref` signal holds on the server. */
1789
1829
  element(scope, anchor) {
1790
1830
  return new ElementReference(scope, anchor);
@@ -1800,10 +1840,7 @@ var Context = class Context {
1800
1840
  if (args === void 0 && /#t\d/.test(ref)) {
1801
1841
  const render = value;
1802
1842
  function template(...rest) {
1803
- return new Children(scope, async () => {
1804
- const html = await render(...rest);
1805
- return isRaw(html) ? rawHTML(html) : insertValue(html);
1806
- });
1843
+ return new Children(scope, async (ctx, at) => insert(await render(...rest), ctx, at));
1807
1844
  }
1808
1845
  functionReferences.set(template, new FunctionReference(ref, scope));
1809
1846
  return template;
@@ -2182,7 +2219,7 @@ var Children = class {
2182
2219
  reference.at = at;
2183
2220
  reference.anchor = anchor;
2184
2221
  }
2185
- const html = await (at === void 0 ? renderBody(ctx) : ctx.children(from, at, () => renderBody(ctx), tag));
2222
+ const html = await (at === void 0 ? renderBody(ctx) : ctx.children(from, at, () => renderBody(ctx, at), tag));
2186
2223
  if (ref === void 0) this[RAW] ??= html;
2187
2224
  return html;
2188
2225
  };
@@ -2225,6 +2262,7 @@ function actionResult(ctx, fn) {
2225
2262
  function insert(value, ctx, scope, tag, anchor) {
2226
2263
  if (value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function") return Promise.resolve(value).then((resolved) => insert(resolved, ctx, scope, tag, anchor));
2227
2264
  if (isLazy(value) && ctx) return value[LAZY](ctx, scope, tag, anchor);
2265
+ if (isRaw(value) && value.s !== void 0 && ctx && scope !== void 0) ctx.call(value.s, scope);
2228
2266
  if (Array.isArray(value)) {
2229
2267
  const parts = [];
2230
2268
  let allStrings = true;
@@ -3848,4 +3886,4 @@ function spread(attributes, on, names) {
3848
3886
  //#endregion
3849
3887
  export { isRedirect as $, waitAll as A, parseForm as B, spacerTag as C, streamParts as D, stateValue as E, rateLimit as F, revalidate as G, matchRoute as H, parseSubmission as I, RequestEvent as J, setCacheStore as K, ValidationError as L, RateLimitError as M, clientAddress as N, streamState as O, configureRateLimit as P, getEvent as Q, fieldErrors as R, settled as S, stateScript as T, cached as U, safeParse as V, memoryStore as W, dedupe as X, ServerError as Y, defineMiddleware as Z, packState as _, binding as a, render as b, component as c, handleRoute as d, redirect as et, inlineBodies as f, memo as g, lazy as h, actionResult as i, idempotent as j, wait as k, dynamic as l, isCrossSite as m, NotReady as n, caught as o, insert as p, storageStore as q, action as r, children as s, Context as t, withEvent as tt, handleRequest as u, read as v, spread as w, renderToStream as x, ready as y, parse as z };
3850
3888
 
3851
- //# sourceMappingURL=server-DjyOVJtJ.js.map
3889
+ //# sourceMappingURL=server-C6c-GXF4.js.map