@elaraai/e3-ui 1.0.83 → 1.0.85

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 (121) hide show
  1. package/dist/src/bind/data.d.ts +4 -3
  2. package/dist/src/bind/data.d.ts.map +1 -1
  3. package/dist/src/bind/data.js +4 -3
  4. package/dist/src/bind/data.js.map +1 -1
  5. package/dist/src/bind/record.d.ts +234 -6
  6. package/dist/src/bind/record.d.ts.map +1 -1
  7. package/dist/src/bind/record.js +250 -7
  8. package/dist/src/bind/record.js.map +1 -1
  9. package/dist/src/bind/sources.d.ts +148 -0
  10. package/dist/src/bind/sources.d.ts.map +1 -0
  11. package/dist/src/bind/sources.js +116 -0
  12. package/dist/src/bind/sources.js.map +1 -0
  13. package/dist/src/index.d.ts +4 -1
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/index.js +9 -1
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/internal.d.ts +4 -1
  18. package/dist/src/internal.d.ts.map +1 -1
  19. package/dist/src/internal.js +11 -1
  20. package/dist/src/internal.js.map +1 -1
  21. package/dist/src/query/builder.d.ts +3257 -0
  22. package/dist/src/query/builder.d.ts.map +1 -0
  23. package/dist/src/query/builder.js +126 -0
  24. package/dist/src/query/builder.js.map +1 -0
  25. package/dist/src/query/index.d.ts +108 -0
  26. package/dist/src/query/index.d.ts.map +1 -0
  27. package/dist/src/query/index.js +76 -0
  28. package/dist/src/query/index.js.map +1 -0
  29. package/dist/src/query/library.d.ts +3241 -0
  30. package/dist/src/query/library.d.ts.map +1 -0
  31. package/dist/src/query/library.js +114 -0
  32. package/dist/src/query/library.js.map +1 -0
  33. package/dist/src/query/queries.d.ts +4696 -0
  34. package/dist/src/query/queries.d.ts.map +1 -0
  35. package/dist/src/query/queries.js +129 -0
  36. package/dist/src/query/queries.js.map +1 -0
  37. package/dist/src/query/saved.d.ts +72 -0
  38. package/dist/src/query/saved.d.ts.map +1 -0
  39. package/dist/src/query/saved.js +84 -0
  40. package/dist/src/query/saved.js.map +1 -0
  41. package/dist/src/query/steps.d.ts +613 -0
  42. package/dist/src/query/steps.d.ts.map +1 -0
  43. package/dist/src/query/steps.js +316 -0
  44. package/dist/src/query/steps.js.map +1 -0
  45. package/dist/src/query/types.d.ts +444 -0
  46. package/dist/src/query/types.d.ts.map +1 -0
  47. package/dist/src/query/types.js +113 -0
  48. package/dist/src/query/types.js.map +1 -0
  49. package/dist/src/studio/builder.d.ts +3123 -0
  50. package/dist/src/studio/builder.d.ts.map +1 -0
  51. package/dist/src/studio/builder.js +115 -0
  52. package/dist/src/studio/builder.js.map +1 -0
  53. package/dist/src/studio/canvas.d.ts +83 -0
  54. package/dist/src/studio/canvas.d.ts.map +1 -0
  55. package/dist/src/studio/canvas.js +71 -0
  56. package/dist/src/studio/canvas.js.map +1 -0
  57. package/dist/src/studio/component.d.ts +178 -0
  58. package/dist/src/studio/component.d.ts.map +1 -0
  59. package/dist/src/studio/component.js +189 -0
  60. package/dist/src/studio/component.js.map +1 -0
  61. package/dist/src/studio/index.d.ts +104 -0
  62. package/dist/src/studio/index.d.ts.map +1 -0
  63. package/dist/src/studio/index.js +75 -0
  64. package/dist/src/studio/index.js.map +1 -0
  65. package/dist/src/studio/inspector.d.ts +208 -0
  66. package/dist/src/studio/inspector.d.ts.map +1 -0
  67. package/dist/src/studio/inspector.js +155 -0
  68. package/dist/src/studio/inspector.js.map +1 -0
  69. package/dist/src/studio/library.d.ts +3506 -0
  70. package/dist/src/studio/library.d.ts.map +1 -0
  71. package/dist/src/studio/library.js +245 -0
  72. package/dist/src/studio/library.js.map +1 -0
  73. package/dist/src/studio/page.d.ts +305 -0
  74. package/dist/src/studio/page.d.ts.map +1 -0
  75. package/dist/src/studio/page.js +105 -0
  76. package/dist/src/studio/page.js.map +1 -0
  77. package/dist/src/studio/pages.d.ts +10929 -0
  78. package/dist/src/studio/pages.d.ts.map +1 -0
  79. package/dist/src/studio/pages.js +502 -0
  80. package/dist/src/studio/pages.js.map +1 -0
  81. package/dist/src/studio/palette.d.ts +179 -0
  82. package/dist/src/studio/palette.d.ts.map +1 -0
  83. package/dist/src/studio/palette.js +120 -0
  84. package/dist/src/studio/palette.js.map +1 -0
  85. package/dist/src/studio/publish.d.ts +397 -0
  86. package/dist/src/studio/publish.d.ts.map +1 -0
  87. package/dist/src/studio/publish.js +198 -0
  88. package/dist/src/studio/publish.js.map +1 -0
  89. package/dist/src/ui.d.ts +16 -3
  90. package/dist/src/ui.d.ts.map +1 -1
  91. package/dist/src/ui.js +21 -1
  92. package/dist/src/ui.js.map +1 -1
  93. package/dist/test/bind/data/data.examples.d.ts +76 -1
  94. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  95. package/dist/test/bind/data/data.examples.js +176 -3
  96. package/dist/test/bind/data/data.examples.js.map +1 -1
  97. package/dist/test/bind/func/func.examples.d.ts +8 -0
  98. package/dist/test/bind/func/func.examples.d.ts.map +1 -1
  99. package/dist/test/bind/func/func.examples.js +4 -3
  100. package/dist/test/bind/func/func.examples.js.map +1 -1
  101. package/dist/test/bind/record/record.examples.d.ts +65 -1
  102. package/dist/test/bind/record/record.examples.d.ts.map +1 -1
  103. package/dist/test/bind/record/record.examples.js +21 -3
  104. package/dist/test/bind/record/record.examples.js.map +1 -1
  105. package/dist/test/query/query.examples.d.ts +5022 -0
  106. package/dist/test/query/query.examples.d.ts.map +1 -0
  107. package/dist/test/query/query.examples.js +467 -0
  108. package/dist/test/query/query.examples.js.map +1 -0
  109. package/dist/test/studio/component.examples.d.ts +7 -0
  110. package/dist/test/studio/component.examples.d.ts.map +1 -0
  111. package/dist/test/studio/component.examples.js +46 -0
  112. package/dist/test/studio/component.examples.js.map +1 -0
  113. package/dist/test/studio/page.examples.d.ts +7 -0
  114. package/dist/test/studio/page.examples.d.ts.map +1 -0
  115. package/dist/test/studio/page.examples.js +64 -0
  116. package/dist/test/studio/page.examples.js.map +1 -0
  117. package/dist/test/studio/studio.examples.d.ts +1766 -0
  118. package/dist/test/studio/studio.examples.d.ts.map +1 -0
  119. package/dist/test/studio/studio.examples.js +354 -0
  120. package/dist/test/studio/studio.examples.js.map +1 -0
  121. package/package.json +9 -8
@@ -0,0 +1,397 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * The builder's publish preview (#998) — the open page as it will publish,
7
+ * what changed since its live version, and the actions that publish it,
8
+ * computed in East for the `StudioBuilder` renderer, which draws the preview
9
+ * in the canvas's place: its bar — "● Preview", the device widths, the
10
+ * environment and Exit — the page at the device's width, and the aside: what
11
+ * changed since the live version, whether the components' code changed since,
12
+ * who sees it and when, and Save as draft and Publish. The page it shows is
13
+ * the one that publishes, the canvas's unsaved drafts in place, and it has the
14
+ * canvas apply them before it publishes, so the canvas stays the only writer
15
+ * of its drafts.
16
+ *
17
+ * @packageDocumentation
18
+ */
19
+ import { ArrayType, AsyncFunctionType, BooleanType, FunctionType, IntegerType, NullType, OptionType, StringType, StructType, VariantType } from "@elaraai/east";
20
+ /**
21
+ * One row of the preview's change list: the change, and the name of the
22
+ * placement it changed.
23
+ *
24
+ * @property change - The change, as `Studio.changes` lists it
25
+ * @property name - The placement's title, else its component's name, else its component's key
26
+ */
27
+ export declare const PublishChangeType: StructType<{
28
+ readonly change: VariantType<{
29
+ readonly added: StructType<{
30
+ readonly cell: StringType;
31
+ readonly component: StringType;
32
+ readonly detail: StringType;
33
+ }>;
34
+ readonly removed: StructType<{
35
+ readonly cell: StringType;
36
+ readonly component: StringType;
37
+ readonly detail: StringType;
38
+ }>;
39
+ readonly moved: StructType<{
40
+ readonly cell: StringType;
41
+ readonly component: StringType;
42
+ readonly detail: StringType;
43
+ }>;
44
+ readonly resized: StructType<{
45
+ readonly cell: StringType;
46
+ readonly component: StringType;
47
+ readonly detail: StringType;
48
+ }>;
49
+ readonly height: StructType<{
50
+ readonly cell: StringType;
51
+ readonly component: StringType;
52
+ readonly detail: StringType;
53
+ }>;
54
+ readonly aligned: StructType<{
55
+ readonly cell: StringType;
56
+ readonly component: StringType;
57
+ readonly detail: StringType;
58
+ }>;
59
+ readonly retitled: StructType<{
60
+ readonly cell: StringType;
61
+ readonly component: StringType;
62
+ readonly detail: StringType;
63
+ }>;
64
+ }>;
65
+ readonly name: StringType;
66
+ }>;
67
+ /** Type representing one row of the preview's change list. */
68
+ export type PublishChangeType = typeof PublishChangeType;
69
+ /**
70
+ * Where the open entry stands, as the preview's aside says it.
71
+ *
72
+ * @property ready - Something to publish: a page never published, or one whose layout or components' code changed since its live version
73
+ * @property current - Up to date: published, its layout and its components' code as they went live
74
+ * @property template - A template, which is not published
75
+ */
76
+ export declare const PublishStandingType: VariantType<{
77
+ readonly ready: NullType;
78
+ readonly current: NullType;
79
+ readonly template: NullType;
80
+ }>;
81
+ /** Type representing where the open entry stands. */
82
+ export type PublishStandingType = typeof PublishStandingType;
83
+ /**
84
+ * What the preview shows of the open entry, as East computes it.
85
+ *
86
+ * @property standing - Where it stands ({@link PublishStandingType})
87
+ * @property live - Its live version's number; `none` until it is first published, and for a template
88
+ * @property changes - The changes from its live version — from nothing, the first time — to the layout that publishes; none for a template
89
+ * @property changed - The components it places whose code changed since its live version, by name, in the order they are placed
90
+ * @property unsaved - The canvas draws drafts the page has not saved
91
+ */
92
+ export declare const PublishSummaryType: StructType<{
93
+ readonly standing: VariantType<{
94
+ readonly ready: NullType;
95
+ readonly current: NullType;
96
+ readonly template: NullType;
97
+ }>;
98
+ readonly live: OptionType<IntegerType>;
99
+ readonly changes: ArrayType<StructType<{
100
+ readonly change: VariantType<{
101
+ readonly added: StructType<{
102
+ readonly cell: StringType;
103
+ readonly component: StringType;
104
+ readonly detail: StringType;
105
+ }>;
106
+ readonly removed: StructType<{
107
+ readonly cell: StringType;
108
+ readonly component: StringType;
109
+ readonly detail: StringType;
110
+ }>;
111
+ readonly moved: StructType<{
112
+ readonly cell: StringType;
113
+ readonly component: StringType;
114
+ readonly detail: StringType;
115
+ }>;
116
+ readonly resized: StructType<{
117
+ readonly cell: StringType;
118
+ readonly component: StringType;
119
+ readonly detail: StringType;
120
+ }>;
121
+ readonly height: StructType<{
122
+ readonly cell: StringType;
123
+ readonly component: StringType;
124
+ readonly detail: StringType;
125
+ }>;
126
+ readonly aligned: StructType<{
127
+ readonly cell: StringType;
128
+ readonly component: StringType;
129
+ readonly detail: StringType;
130
+ }>;
131
+ readonly retitled: StructType<{
132
+ readonly cell: StringType;
133
+ readonly component: StringType;
134
+ readonly detail: StringType;
135
+ }>;
136
+ }>;
137
+ readonly name: StringType;
138
+ }>>;
139
+ readonly changed: ArrayType<StringType>;
140
+ readonly unsaved: BooleanType;
141
+ }>;
142
+ /** Type representing what the preview shows of the open entry. */
143
+ export type PublishSummaryType = typeof PublishSummaryType;
144
+ /**
145
+ * The publish preview, as the `StudioBuilder` renderer draws it — beside the
146
+ * page as it will publish, which the builder draws.
147
+ *
148
+ * @property project - The project — the page's eyebrow
149
+ * @property title - The page's title
150
+ * @property summary - Where it stands and what changed ({@link PublishSummaryType})
151
+ * @property env - Where it publishes to — the Env pill, and the Publish button's words
152
+ * @property audience - Who sees it — the Audience row
153
+ * @property rollout - When they see it — the Rollout row
154
+ * @property apply - The Apply the preview asked of the canvas, and the canvas's answer
155
+ * @property onApply - Asks the canvas to apply its drafts, under an id the answer names
156
+ * @property onPublish - Publishes the page, one commit; `none` when it committed, else what refused it
157
+ * @property onExit - Returns to the canvas; `none` when there is none to return to
158
+ */
159
+ export declare const StudioPublishPayloadType: StructType<{
160
+ readonly project: StringType;
161
+ readonly title: StringType;
162
+ readonly summary: StructType<{
163
+ readonly standing: VariantType<{
164
+ readonly ready: NullType;
165
+ readonly current: NullType;
166
+ readonly template: NullType;
167
+ }>;
168
+ readonly live: OptionType<IntegerType>;
169
+ readonly changes: ArrayType<StructType<{
170
+ readonly change: VariantType<{
171
+ readonly added: StructType<{
172
+ readonly cell: StringType;
173
+ readonly component: StringType;
174
+ readonly detail: StringType;
175
+ }>;
176
+ readonly removed: StructType<{
177
+ readonly cell: StringType;
178
+ readonly component: StringType;
179
+ readonly detail: StringType;
180
+ }>;
181
+ readonly moved: StructType<{
182
+ readonly cell: StringType;
183
+ readonly component: StringType;
184
+ readonly detail: StringType;
185
+ }>;
186
+ readonly resized: StructType<{
187
+ readonly cell: StringType;
188
+ readonly component: StringType;
189
+ readonly detail: StringType;
190
+ }>;
191
+ readonly height: StructType<{
192
+ readonly cell: StringType;
193
+ readonly component: StringType;
194
+ readonly detail: StringType;
195
+ }>;
196
+ readonly aligned: StructType<{
197
+ readonly cell: StringType;
198
+ readonly component: StringType;
199
+ readonly detail: StringType;
200
+ }>;
201
+ readonly retitled: StructType<{
202
+ readonly cell: StringType;
203
+ readonly component: StringType;
204
+ readonly detail: StringType;
205
+ }>;
206
+ }>;
207
+ readonly name: StringType;
208
+ }>>;
209
+ readonly changed: ArrayType<StringType>;
210
+ readonly unsaved: BooleanType;
211
+ }>;
212
+ readonly env: OptionType<StringType>;
213
+ readonly audience: OptionType<StringType>;
214
+ readonly rollout: OptionType<StringType>;
215
+ readonly apply: VariantType<{
216
+ readonly idle: NullType;
217
+ readonly asked: StringType;
218
+ readonly applied: StringType;
219
+ readonly refused: StructType<{
220
+ readonly id: StringType;
221
+ readonly reason: StringType;
222
+ }>;
223
+ }>;
224
+ readonly onApply: FunctionType<[StringType], NullType>;
225
+ readonly onPublish: AsyncFunctionType<[], OptionType<StringType>>;
226
+ readonly onExit: OptionType<FunctionType<[], NullType>>;
227
+ }>;
228
+ /** Type representing the publish preview, as the builder draws it. */
229
+ export type StudioPublishPayloadType = typeof StudioPublishPayloadType;
230
+ /**
231
+ * What the preview shows of the open entry: where it stands, the change list,
232
+ * the components whose code changed, and whether the canvas has drafts.
233
+ *
234
+ * @remarks
235
+ * `layout` is the layout that publishes — the page's cells as the canvas
236
+ * draws them, its unsaved drafts in place — and `saved` its draft as last
237
+ * saved. A page never published is ready, its changes those from nothing:
238
+ * every placement added. A published one is ready while its layout differs
239
+ * from its live version's, or a component it places has code other than the
240
+ * fingerprint the live version stored for it; otherwise it is current. A
241
+ * change names its placement by its title, else its component's name, else
242
+ * its component's key; a component the surface does not list is never
243
+ * counted as changed.
244
+ */
245
+ export declare const publishSummary: import("@elaraai/east").CallableFunctionExpr<[ArrayType<StructType<{
246
+ readonly key: StringType;
247
+ readonly name: StringType;
248
+ readonly category: StringType;
249
+ readonly icon: StringType;
250
+ readonly span: IntegerType;
251
+ readonly description: OptionType<StringType>;
252
+ readonly frame: VariantType<{
253
+ readonly card: NullType;
254
+ readonly none: NullType;
255
+ }>;
256
+ readonly tags: ArrayType<StringType>;
257
+ readonly collections: ArrayType<StringType>;
258
+ readonly deprecated: BooleanType;
259
+ readonly reads: StructType<{
260
+ readonly paths: ArrayType<ArrayType<VariantType<{
261
+ readonly field: StringType;
262
+ }>>>;
263
+ readonly functions: ArrayType<StringType>;
264
+ readonly records: ArrayType<StringType>;
265
+ readonly pages: ArrayType<ArrayType<VariantType<{
266
+ readonly field: StringType;
267
+ }>>>;
268
+ }>;
269
+ readonly fingerprint: StringType;
270
+ readonly render: FunctionType<[], import("@elaraai/east").RecursiveType<import("@elaraai/east-ui").UIComponentNode>>;
271
+ }>>, OptionType<StructType<{
272
+ readonly version: IntegerType;
273
+ readonly page: StructType<{
274
+ readonly title: StringType;
275
+ readonly cells: ArrayType<StructType<{
276
+ readonly key: StringType;
277
+ readonly row: StringType;
278
+ readonly span: IntegerType;
279
+ readonly height: OptionType<IntegerType>;
280
+ readonly align: VariantType<{
281
+ readonly top: NullType;
282
+ readonly center: NullType;
283
+ readonly stretch: NullType;
284
+ }>;
285
+ readonly title: OptionType<StringType>;
286
+ readonly component: StringType;
287
+ readonly fingerprint: StringType;
288
+ }>>;
289
+ }>;
290
+ }>>, StructType<{
291
+ readonly title: StringType;
292
+ readonly cells: ArrayType<StructType<{
293
+ readonly key: StringType;
294
+ readonly row: StringType;
295
+ readonly span: IntegerType;
296
+ readonly height: OptionType<IntegerType>;
297
+ readonly align: VariantType<{
298
+ readonly top: NullType;
299
+ readonly center: NullType;
300
+ readonly stretch: NullType;
301
+ }>;
302
+ readonly title: OptionType<StringType>;
303
+ readonly component: StringType;
304
+ readonly fingerprint: StringType;
305
+ }>>;
306
+ }>, ArrayType<StructType<{
307
+ readonly key: StringType;
308
+ readonly row: StringType;
309
+ readonly span: IntegerType;
310
+ readonly height: OptionType<IntegerType>;
311
+ readonly align: VariantType<{
312
+ readonly top: NullType;
313
+ readonly center: NullType;
314
+ readonly stretch: NullType;
315
+ }>;
316
+ readonly title: OptionType<StringType>;
317
+ readonly component: StringType;
318
+ readonly fingerprint: StringType;
319
+ }>>, BooleanType], StructType<{
320
+ readonly standing: VariantType<{
321
+ readonly ready: NullType;
322
+ readonly current: NullType;
323
+ readonly template: NullType;
324
+ }>;
325
+ readonly live: OptionType<IntegerType>;
326
+ readonly changes: ArrayType<StructType<{
327
+ readonly change: VariantType<{
328
+ readonly added: StructType<{
329
+ readonly cell: StringType;
330
+ readonly component: StringType;
331
+ readonly detail: StringType;
332
+ }>;
333
+ readonly removed: StructType<{
334
+ readonly cell: StringType;
335
+ readonly component: StringType;
336
+ readonly detail: StringType;
337
+ }>;
338
+ readonly moved: StructType<{
339
+ readonly cell: StringType;
340
+ readonly component: StringType;
341
+ readonly detail: StringType;
342
+ }>;
343
+ readonly resized: StructType<{
344
+ readonly cell: StringType;
345
+ readonly component: StringType;
346
+ readonly detail: StringType;
347
+ }>;
348
+ readonly height: StructType<{
349
+ readonly cell: StringType;
350
+ readonly component: StringType;
351
+ readonly detail: StringType;
352
+ }>;
353
+ readonly aligned: StructType<{
354
+ readonly cell: StringType;
355
+ readonly component: StringType;
356
+ readonly detail: StringType;
357
+ }>;
358
+ readonly retitled: StructType<{
359
+ readonly cell: StringType;
360
+ readonly component: StringType;
361
+ readonly detail: StringType;
362
+ }>;
363
+ }>;
364
+ readonly name: StringType;
365
+ }>>;
366
+ readonly changed: ArrayType<StringType>;
367
+ readonly unsaved: BooleanType;
368
+ }>>;
369
+ /**
370
+ * What refused a publish, or `none` when it committed. A publish another
371
+ * write overtook is a conflict: the page moved since the preview drew it.
372
+ */
373
+ export declare const publishRefusal: import("@elaraai/east").CallableFunctionExpr<[VariantType<{
374
+ readonly transport: StructType<{
375
+ readonly message: StringType;
376
+ }>;
377
+ readonly committed: StructType<{
378
+ readonly commitHash: StringType;
379
+ readonly stateHash: StringType;
380
+ }>;
381
+ readonly invalid: StructType<{
382
+ readonly message: StringType;
383
+ }>;
384
+ readonly failed: StructType<{
385
+ readonly exitCode: IntegerType;
386
+ readonly stderr: StringType;
387
+ }>;
388
+ readonly timed_out: StructType<{
389
+ readonly ms: IntegerType;
390
+ readonly stderr: StringType;
391
+ }>;
392
+ readonly conflict: StructType<{
393
+ readonly attempts: IntegerType;
394
+ readonly detail: OptionType<StringType>;
395
+ }>;
396
+ }>], OptionType<StringType>>;
397
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../src/studio/publish.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,WAAW,EAGX,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,UAAU,EAEV,UAAU,EACV,UAAU,EACV,WAAW,EAId,MAAM,eAAe,CAAC;AAgBvB;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG5B,CAAC;AAEH,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAC;AAEH,qDAAqD;AACrD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAE7D;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC,CAAC;AAEH,sEAAsE;AACtE,MAAM,MAAM,wBAAwB,GAAG,OAAO,wBAAwB,CAAC;AAMvE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqF1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;4BAc1B,CAAC"}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * The builder's publish preview (#998) — the open page as it will publish,
7
+ * what changed since its live version, and the actions that publish it,
8
+ * computed in East for the `StudioBuilder` renderer, which draws the preview
9
+ * in the canvas's place: its bar — "● Preview", the device widths, the
10
+ * environment and Exit — the page at the device's width, and the aside: what
11
+ * changed since the live version, whether the components' code changed since,
12
+ * who sees it and when, and Save as draft and Publish. The page it shows is
13
+ * the one that publishes, the canvas's unsaved drafts in place, and it has the
14
+ * canvas apply them before it publishes, so the canvas stays the only writer
15
+ * of its drafts.
16
+ *
17
+ * @packageDocumentation
18
+ */
19
+ import { ArrayType, AsyncFunctionType, BooleanType, DictType, East, FunctionType, IntegerType, NullType, OptionType, SetType, StringType, StructType, VariantType, none, some, variant, } from "@elaraai/east";
20
+ import { SnapGrid } from "@elaraai/east-ui/internal";
21
+ import { RecordOutcomeType } from "../bind/record.js";
22
+ import { StudioComponentType } from "./component.js";
23
+ import { StudioCellType, StudioChangeType, StudioLiveType, StudioPageType, pageChanges, } from "./pages.js";
24
+ // ============================================================================
25
+ // Types
26
+ // ============================================================================
27
+ /**
28
+ * One row of the preview's change list: the change, and the name of the
29
+ * placement it changed.
30
+ *
31
+ * @property change - The change, as `Studio.changes` lists it
32
+ * @property name - The placement's title, else its component's name, else its component's key
33
+ */
34
+ export const PublishChangeType = StructType({
35
+ change: StudioChangeType,
36
+ name: StringType,
37
+ });
38
+ /**
39
+ * Where the open entry stands, as the preview's aside says it.
40
+ *
41
+ * @property ready - Something to publish: a page never published, or one whose layout or components' code changed since its live version
42
+ * @property current - Up to date: published, its layout and its components' code as they went live
43
+ * @property template - A template, which is not published
44
+ */
45
+ export const PublishStandingType = VariantType({
46
+ ready: NullType,
47
+ current: NullType,
48
+ template: NullType,
49
+ });
50
+ /**
51
+ * What the preview shows of the open entry, as East computes it.
52
+ *
53
+ * @property standing - Where it stands ({@link PublishStandingType})
54
+ * @property live - Its live version's number; `none` until it is first published, and for a template
55
+ * @property changes - The changes from its live version — from nothing, the first time — to the layout that publishes; none for a template
56
+ * @property changed - The components it places whose code changed since its live version, by name, in the order they are placed
57
+ * @property unsaved - The canvas draws drafts the page has not saved
58
+ */
59
+ export const PublishSummaryType = StructType({
60
+ standing: PublishStandingType,
61
+ live: OptionType(IntegerType),
62
+ changes: ArrayType(PublishChangeType),
63
+ changed: ArrayType(StringType),
64
+ unsaved: BooleanType,
65
+ });
66
+ /**
67
+ * The publish preview, as the `StudioBuilder` renderer draws it — beside the
68
+ * page as it will publish, which the builder draws.
69
+ *
70
+ * @property project - The project — the page's eyebrow
71
+ * @property title - The page's title
72
+ * @property summary - Where it stands and what changed ({@link PublishSummaryType})
73
+ * @property env - Where it publishes to — the Env pill, and the Publish button's words
74
+ * @property audience - Who sees it — the Audience row
75
+ * @property rollout - When they see it — the Rollout row
76
+ * @property apply - The Apply the preview asked of the canvas, and the canvas's answer
77
+ * @property onApply - Asks the canvas to apply its drafts, under an id the answer names
78
+ * @property onPublish - Publishes the page, one commit; `none` when it committed, else what refused it
79
+ * @property onExit - Returns to the canvas; `none` when there is none to return to
80
+ */
81
+ export const StudioPublishPayloadType = StructType({
82
+ project: StringType,
83
+ title: StringType,
84
+ summary: PublishSummaryType,
85
+ env: OptionType(StringType),
86
+ audience: OptionType(StringType),
87
+ rollout: OptionType(StringType),
88
+ apply: SnapGrid.Types.ApplyState,
89
+ onApply: FunctionType([StringType], NullType),
90
+ onPublish: AsyncFunctionType([], OptionType(StringType)),
91
+ onExit: OptionType(FunctionType([], NullType)),
92
+ });
93
+ // ============================================================================
94
+ // What the preview shows
95
+ // ============================================================================
96
+ /**
97
+ * What the preview shows of the open entry: where it stands, the change list,
98
+ * the components whose code changed, and whether the canvas has drafts.
99
+ *
100
+ * @remarks
101
+ * `layout` is the layout that publishes — the page's cells as the canvas
102
+ * draws them, its unsaved drafts in place — and `saved` its draft as last
103
+ * saved. A page never published is ready, its changes those from nothing:
104
+ * every placement added. A published one is ready while its layout differs
105
+ * from its live version's, or a component it places has code other than the
106
+ * fingerprint the live version stored for it; otherwise it is current. A
107
+ * change names its placement by its title, else its component's name, else
108
+ * its component's key; a component the surface does not list is never
109
+ * counted as changed.
110
+ */
111
+ export const publishSummary = East.function([ArrayType(StudioComponentType), OptionType(StudioLiveType), StudioPageType, ArrayType(StudioCellType), BooleanType], PublishSummaryType, ($, components, live, layout, saved, template) => {
112
+ const unsaved = $.let(East.notEqual(layout.cells, saved));
113
+ $.if(template, ($2) => {
114
+ $2.return(East.value({
115
+ standing: variant("template", null),
116
+ live: none,
117
+ changes: [],
118
+ changed: [],
119
+ unsaved,
120
+ }, PublishSummaryType));
121
+ });
122
+ const listed = $.let(components.toDict((_$2, component) => component.key, (_$2, component) => component, (_$2, first) => first), DictType(StringType, StudioComponentType));
123
+ const before = $.let(live.match({
124
+ some: (_$2, version) => version.page,
125
+ none: (_$2) => East.value({ title: layout.title, cells: [] }, StudioPageType),
126
+ }), StudioPageType);
127
+ // Each placement's name, the later layout's where both hold it.
128
+ const names = $.let(new Map(), DictType(StringType, StringType));
129
+ $.for(before.cells.concat(layout.cells), ($2, cell) => {
130
+ const name = $2.let(cell.title.match({
131
+ some: (_$3, title) => title,
132
+ none: (_$3) => listed.tryGet(cell.component).match({
133
+ some: (_$4, component) => component.name,
134
+ none: (_$4) => cell.component,
135
+ }),
136
+ }));
137
+ $2(names.insertOrUpdate(cell.key, name, (_$3, _old) => name));
138
+ });
139
+ const changes = $.let(pageChanges(before, layout).map((_$2, change) => ({
140
+ change,
141
+ name: names.get(change.match({
142
+ added: (_$3, c) => c.cell,
143
+ removed: (_$3, c) => c.cell,
144
+ moved: (_$3, c) => c.cell,
145
+ resized: (_$3, c) => c.cell,
146
+ height: (_$3, c) => c.cell,
147
+ aligned: (_$3, c) => c.cell,
148
+ retitled: (_$3, c) => c.cell,
149
+ })),
150
+ })), ArrayType(PublishChangeType));
151
+ // The components whose code is not the code the live version stored
152
+ // for them, among those the layout places.
153
+ const stale = $.let(new Set(), SetType(StringType));
154
+ $.for(before.cells, ($2, cell) => {
155
+ $2.match(listed.tryGet(cell.component), {
156
+ some: ($3, component) => {
157
+ $3.if(component.fingerprint.notEqual(cell.fingerprint), ($4) => {
158
+ $4(stale.tryInsert(cell.component));
159
+ });
160
+ },
161
+ });
162
+ });
163
+ const named = $.let(new Set(), SetType(StringType));
164
+ const changed = $.let([], ArrayType(StringType));
165
+ $.for(layout.cells, ($2, cell) => {
166
+ $2.if(stale.has(cell.component).and(() => named.has(cell.component).not()), ($3) => {
167
+ $3(named.insert(cell.component));
168
+ $3(changed.pushLast(listed.get(cell.component).name));
169
+ });
170
+ });
171
+ const ready = $.let(live.hasTag("none").or(() => changes.size().greater(0n)).or(() => changed.size().greater(0n)));
172
+ return {
173
+ standing: ready.ifElse(() => East.value(variant("ready", null), PublishStandingType), () => East.value(variant("current", null), PublishStandingType)),
174
+ live: live.match({
175
+ some: (_$2, version) => some(version.version),
176
+ none: (_$2) => East.value(none, OptionType(IntegerType)),
177
+ }),
178
+ changes,
179
+ changed,
180
+ unsaved,
181
+ };
182
+ });
183
+ /**
184
+ * What refused a publish, or `none` when it committed. A publish another
185
+ * write overtook is a conflict: the page moved since the preview drew it.
186
+ */
187
+ export const publishRefusal = East.function([RecordOutcomeType], OptionType(StringType), ($, outcome) => {
188
+ const refused = $.let(none, OptionType(StringType));
189
+ $.match(outcome, {
190
+ conflict: ($2) => { $2.assign(refused, some("Another write changed this page first — review it and publish again")); },
191
+ invalid: ($2, refusal) => { $2.assign(refused, some(refusal.message)); },
192
+ failed: ($2, refusal) => { $2.assign(refused, some(East.str `The write failed: ${refusal.stderr}`)); },
193
+ timed_out: ($2) => { $2.assign(refused, some("The write ran out of time and wrote nothing")); },
194
+ transport: ($2, lost) => { $2.assign(refused, some(East.str `The write got no answer, so it may have been made — ${lost.message}`)); },
195
+ });
196
+ return refused;
197
+ });
198
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/studio/publish.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,IAAI,EACJ,OAAO,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACH,cAAc,EACd,gBAAg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AAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA,qBAAqB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACrG,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,6CAA6C,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/F,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA,uDAAuD,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;KACxI,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACnB,CAAC,CACJ,CAAC"}
package/dist/src/ui.d.ts CHANGED
@@ -13,10 +13,15 @@
13
13
  */
14
14
  import { type DatasetDef, type Runner, type TaskDef } from '@elaraai/e3/browser';
15
15
  import { UIComponentType } from '@elaraai/east-ui';
16
- import { type EastType, type CallableFunctionExpr, type CallableAsyncFunctionExpr, variant } from '@elaraai/east';
16
+ import { type CallableFunctionExpr, type CallableAsyncFunctionExpr, variant } from '@elaraai/east';
17
17
  /**
18
18
  * Create a UI task — an e3 task that produces a UIComponentType value.
19
19
  *
20
+ * Its function returns `UIComponentType`, exactly: a task in the `ui` role is
21
+ * rendered by its role alone, so its output is never anything else. The
22
+ * signature takes no other function, and one that slips past it, through a
23
+ * cast, is refused here, so no package deploys one.
24
+ *
20
25
  * The task's manifest combines:
21
26
  * - **Compute-time reads** — every dataset in `inputs` (the runner passes
22
27
  * their values to `fn` as positional args).
@@ -27,6 +32,14 @@ import { type EastType, type CallableFunctionExpr, type CallableAsyncFunctionExp
27
32
  * Paths used in `Data.bind` must be JS-side constants captured at IR-build
28
33
  * time (typically `e3.input(name, T).path`). Dynamic paths throw.
29
34
  *
35
+ * @param name - The task's name
36
+ * @param inputs - The datasets the runner passes `fn`, in order
37
+ * @param fn - Builds the UI component: returns `UIComponentType`
38
+ * @param options - `runner`, which defaults to east-c with no platforms
39
+ * @returns The task, whose output is the UI component
40
+ * @throws {Error} When `fn` returns another type than `UIComponentType`,
41
+ * naming the task and the type.
42
+ *
30
43
  * @example
31
44
  * ```ts
32
45
  * import e3 from '@elaraai/e3';
@@ -51,7 +64,7 @@ import { type EastType, type CallableFunctionExpr, type CallableAsyncFunctionExp
51
64
  * // Manifest: { reads: [name.path], writes: [] }
52
65
  * ```
53
66
  */
54
- export declare function ui<Name extends string, Inputs extends readonly DatasetDef[], O extends EastType = typeof UIComponentType>(name: Name, inputs: [...Inputs], fn: CallableFunctionExpr<any, O> | CallableAsyncFunctionExpr<any, O>, options?: {
67
+ export declare function ui<Name extends string, Inputs extends readonly DatasetDef[]>(name: Name, inputs: [...Inputs], fn: CallableFunctionExpr<any, UIComponentType> | CallableAsyncFunctionExpr<any, UIComponentType>, options?: {
55
68
  runner?: Runner;
56
- }): TaskDef<O, [variant<'field', 'tasks'>, variant<'field', Name>, variant<'field', 'output'>]>;
69
+ }): TaskDef<UIComponentType, [variant<'field', 'tasks'>, variant<'field', Name>, variant<'field', 'output'>]>;
57
70
  //# sourceMappingURL=ui.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAMH,OAAO,EAAQ,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,OAAO,EACR,MAAM,eAAe,CAAC;AAIvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAg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