lecodes-sdk 2.5.1 → 2.8.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 (50) hide show
  1. package/dist/global.d.ts +7 -7
  2. package/dist/types/gl/Foliage.d.ts +6 -0
  3. package/dist/types/inject.d.ts +1 -1
  4. package/dist/types/runtime/firstCall.d.ts +12 -0
  5. package/dist/types/runtime/rpc.d.ts +24 -0
  6. package/dist/types/runtime/wire.d.ts +11 -4
  7. package/dist/types/server/channel.d.ts +16 -0
  8. package/dist/types/server/computed.d.ts +59 -0
  9. package/dist/types/server/context.d.ts +13 -1
  10. package/dist/types/server/db/fields.d.ts +2 -1
  11. package/dist/types/server/db/marci/query.d.ts +53 -6
  12. package/dist/types/server/inject.d.ts +2 -0
  13. package/dist/types/server/ordered.d.ts +18 -0
  14. package/dist/types/ui/UIBottomSheet.d.ts +21 -14
  15. package/dist/types/ui/UIModal.d.ts +50 -22
  16. package/dist/types/version.d.ts +1 -1
  17. package/dist/types.json +1 -1
  18. package/package.json +2 -2
  19. package/src/bridges/gl.d.ts +4 -1
  20. package/src/chisel.ts +1 -1
  21. package/src/compile/compileProject.ts +7 -2
  22. package/src/compile/serverSplit.ts +8 -4
  23. package/src/compile/serverTypes.ts +17 -3
  24. package/src/gl/Foliage.ts +11 -1
  25. package/src/inject.ts +3 -2
  26. package/src/runtime/firstCall.ts +28 -0
  27. package/src/runtime/rpc.ts +141 -12
  28. package/src/runtime/wire.ts +11 -6
  29. package/src/server/channel.ts +32 -0
  30. package/src/server/channelHub.ts +246 -16
  31. package/src/server/clock.ts +50 -0
  32. package/src/server/computed.ts +84 -0
  33. package/src/server/computedHost.ts +413 -0
  34. package/src/server/context.ts +14 -2
  35. package/src/server/db/defineDb.ts +47 -7
  36. package/src/server/db/fields.ts +2 -1
  37. package/src/server/db/httpTransport.ts +37 -2
  38. package/src/server/db/httpWatch.ts +180 -0
  39. package/src/server/db/marci/query.ts +112 -7
  40. package/src/server/db/watch.ts +160 -0
  41. package/src/server/files/host.ts +2 -1
  42. package/src/server/host.ts +19 -4
  43. package/src/server/inject.ts +6 -2
  44. package/src/server/ordered.ts +41 -0
  45. package/src/server/rateLimit.ts +72 -0
  46. package/src/server/runtime.ts +127 -9
  47. package/src/ui/UIBottomSheet.ts +39 -30
  48. package/src/ui/UIModal.ts +128 -31
  49. package/src/ui/UIWidget.ts +21 -8
  50. package/src/version.ts +1 -1
@@ -73,15 +73,25 @@ export class WidgetElement extends ContainerElement<"widget"> {
73
73
  // factory) so subclasses like ModalElement inherit it.
74
74
  super(type, { position: "absolute", ...style }, children)
75
75
  }
76
- show(): void {
76
+ show(): void { this._setOpen(true) }
77
+ hide(): void { this._setOpen(false) }
78
+ /** @internal The body of show() / hide(): what every way of opening a widget runs — the calls,
79
+ * a modal's `open` binding. Subclasses wrap it (a modal syncs its pose, a sheet its detent). */
80
+ _setOpen(open: boolean): void {
77
81
  if (this._h.id === 0) return
82
+ if (!open) {
83
+ if (!this._shown) return
84
+ this._setShown(false)
85
+ this._writeDisplay("none")
86
+ return
87
+ }
78
88
  const parentId = tree().parent(this._h.id)
79
89
  if (parentId !== 0 && this._shown) return
80
90
  if (parentId === 0) {
81
91
  // No place of its own: the app layer takes it HIDDEN, and the flip below shows it — a show()
82
92
  // is a display flip wherever the widget is, so its pose plays (a modal's fade) exactly as on
83
93
  // a placed one. Appended shown, it would merely appear: a widget shows with its place, no pose.
84
- this.style({ display: "none" } as any)
94
+ this._writeDisplay("none")
85
95
  _appLayer().append(this as any) // pins it: _pinned reads the display
86
96
  } else {
87
97
  // Shown = on top of its root: a show() moves the widget to the TAIL of its parent's children
@@ -94,13 +104,16 @@ export class WidgetElement extends ContainerElement<"widget"> {
94
104
  tree().insert(parentId, this._h.id, siblings.length - 1)
95
105
  }
96
106
  }
97
- this.style({ display: "flex" } as any)
107
+ this._writeDisplay("flex")
98
108
  this._setShown(true)
99
109
  }
100
- hide(): void {
101
- if (this._h.id === 0 || !this._shown) return
102
- this._setShown(false)
103
- this.style({ display: "none" } as any)
110
+ /** @internal True while the widget writes its own display (show / hide / open): the one display
111
+ * write a modal lets through — the app's `display` on a modal is refused (ModalElement._mapStyle). */
112
+ _ownWrite = false
113
+ /** @internal The widget's own display write. */
114
+ _writeDisplay(display: "flex" | "none"): void {
115
+ this._ownWrite = true
116
+ try { this.style({ display } as any) } finally { this._ownWrite = false }
104
117
  }
105
118
  get isShown(): boolean {
106
119
  return this._shown
@@ -115,7 +128,7 @@ export class WidgetElement extends ContainerElement<"widget"> {
115
128
  }
116
129
  if (owner) {
117
130
  // Hidden first: a widget shows with its place, and the old contract showed it on show() only.
118
- this.style({ display: "none" } as any)
131
+ this._writeDisplay("none")
119
132
  owner.widgets.append(this as any)
120
133
  }
121
134
  return this
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  // same manifest). Its MAJOR is the bundle ↔ runtime contract: a bundle's `// sdk:` header line
5
5
  // and a host's embedded version must agree on the major for the host to run the bundle; minor
6
6
  // and patch never gate anything (features are detected, never versioned).
7
- export const SDK_VERSION = "2.5.1"
7
+ export const SDK_VERSION = "2.8.0"
8
8
 
9
9
  /** The major of a semver string, or null when it is not one. */
10
10
  export const sdkMajor = (version: string | null | undefined): number | null => {