@solidjs/web 2.0.0-rc.15 → 2.0.0-rc.17

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 (55) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +361 -483
  3. package/dist/server.js +346 -391
  4. package/dist/server.observe.js +346 -391
  5. package/dist/web.dev.js +110 -55
  6. package/dist/web.js +51 -50
  7. package/dist/web.observe.js +61 -55
  8. package/frames/dist/client.dev.js +610 -621
  9. package/frames/dist/client.js +540 -566
  10. package/frames/dist/client.observe.js +571 -573
  11. package/frames/dist/regions.js +43 -2
  12. package/frames/dist/server.dev.js +793 -424
  13. package/frames/dist/server.js +792 -371
  14. package/frames/dist/server.observe.js +792 -371
  15. package/frames/dist/wire.js +371 -6
  16. package/package.json +11 -11
  17. package/serialization/dist/decode.js +9 -7
  18. package/serialization/dist/serialization.js +9 -7
  19. package/serialization/types/serializer-decode.d.ts +2 -2
  20. package/server-functions/dist/client.dev.js +13 -22
  21. package/server-functions/dist/client.js +11 -22
  22. package/server-functions/dist/client.observe.js +13 -22
  23. package/server-functions/dist/rich-args.js +84 -1
  24. package/server-functions/dist/server.dev.js +194 -20
  25. package/server-functions/dist/server.js +194 -20
  26. package/server-functions/dist/server.observe.js +194 -20
  27. package/skills/server-components/SKILL.md +74 -185
  28. package/types/client.d.ts +27 -5
  29. package/types/diagnostics.d.ts +16 -0
  30. package/types/frames/assets-tier.d.ts +2 -2
  31. package/types/frames/client.d.ts +8 -3
  32. package/types/frames/frame-client.d.ts +121 -157
  33. package/types/frames/frame-morph.d.ts +28 -0
  34. package/types/frames/frame-sink.d.ts +13 -9
  35. package/types/frames/frame-transport.d.ts +30 -1
  36. package/types/frames/regions-tier.d.ts +15 -0
  37. package/types/frames/serializer-decode.d.ts +2 -2
  38. package/types/frames/server.d.ts +0 -52
  39. package/types/frames/wire-tier.d.ts +54 -1
  40. package/types/index.d.ts +2 -2
  41. package/types/jsx.d.ts +11 -5
  42. package/types/observe.d.ts +14 -7
  43. package/types/render.d.ts +3 -1
  44. package/types/response.d.ts +5 -4
  45. package/types/serializer-decode.d.ts +2 -2
  46. package/types/server-functions/argument-codec.d.ts +30 -0
  47. package/types/server-functions/client.d.ts +27 -9
  48. package/types/server-functions/server.d.ts +23 -2
  49. package/types/server-functions/shared.d.ts +19 -0
  50. package/types/server-functions/uploads.d.ts +50 -0
  51. package/types/server-observe.d.ts +3 -2
  52. package/types/server.d.ts +58 -77
  53. package/frames/dist/bind.dev.js +0 -326
  54. package/frames/dist/bind.js +0 -295
  55. package/types/frames/bind-tier.d.ts +0 -60
@@ -1,5 +1,5 @@
1
1
  import { createFrame } from '@solidjs/web/frames';
2
- import 'solid-js';
2
+ import { getOwner, onCleanup, runWithOwner } from 'solid-js';
3
3
 
4
4
  const ELEMENT_NODE = 1;
5
5
  const COMMENT_NODE = 8;
@@ -71,6 +71,10 @@ function resolve(frame, occurrence, regions, props, start) {
71
71
  element: makeFrameElement(childId),
72
72
  frame: undefined
73
73
  });else if (entry.childId !== childId) rename(entry, childId);
74
+ placements.has(entry.element) || placements.set(entry.element, {
75
+ o: null,
76
+ m: new Map()
77
+ });
74
78
  props[key] = entry.element;
75
79
  }
76
80
  }
@@ -91,6 +95,43 @@ function bind(frame, occurrence) {
91
95
  }
92
96
  }
93
97
  }
98
+ const placements = new WeakMap();
99
+ function place(el) {
100
+ const o = getOwner();
101
+ const p = placements.get(el);
102
+ if (!o || !p || p.o === o) return;
103
+ p.o = o;
104
+ onCleanup(() => {
105
+ if (p.o === o) p.o = null;
106
+ for (const entry of p.m.values()) if (entry.o === o) entry.o = null;
107
+ });
108
+ for (const entry of p.m.values()) entry.o || entry.run();
109
+ }
110
+ function nest(mount, props, ctx) {
111
+ const start = ctx && ctx.range && ctx.range.start;
112
+ const p = start && placements.get(start.parentNode.closest?.(FRAME_TAG));
113
+ if (!p) return mount(props, ctx);
114
+ const key = ctx.key;
115
+ let at = ctx;
116
+ const entry = {
117
+ o: null,
118
+ run() {
119
+ if (!at) {
120
+ at = {
121
+ ...ctx,
122
+ adopted: false,
123
+ existing: []
124
+ };
125
+ for (let n = start.nextSibling; n && n !== ctx.range.end; n = n.nextSibling) at.existing.push(n);
126
+ }
127
+ runWithOwner(entry.o = p.o, () => mount(props, at));
128
+ at = null;
129
+ }
130
+ };
131
+ p.m.set(key, entry);
132
+ ctx.onCleanup(() => p.m.get(key) === entry && p.m.delete(key));
133
+ if (p.o) entry.run();
134
+ }
94
135
  function unmount(frame, occurrence) {
95
136
  const slots = byFrame.get(frame);
96
137
  if (!slots) return;
@@ -127,4 +168,4 @@ function frames(frame) {
127
168
  return out;
128
169
  }
129
170
 
130
- export { bind, changed, frames, resolve, unmount };
171
+ export { bind, changed, frames, nest, place, resolve, unmount };