@almadar/std 16.21.3 → 16.21.4

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.
@@ -0,0 +1,560 @@
1
+ {
2
+ "name": "std-app-search",
3
+ "version": "1.0.0",
4
+ "description": "std-app-search — reusable global search: wraps a host content view and, on a SEARCH trigger, fetches the linked entity filtered by @config.searchField and renders the matching results, then CLEAR_SEARCH returns to the host view. Rebind to any entity; point @config.idleContent at the normal view and wire a trigger (e.g. AppLayout SEARCH) into SEARCH.",
5
+ "orbitals": [
6
+ {
7
+ "name": "AppSearchOrbital",
8
+ "entity": {
9
+ "name": "AppSearchTarget",
10
+ "persistence": "runtime",
11
+ "fields": [
12
+ {
13
+ "name": "id",
14
+ "type": "string",
15
+ "required": true
16
+ },
17
+ {
18
+ "name": "name",
19
+ "type": "string",
20
+ "description": "The primary human-readable label matched by search.",
21
+ "synonyms": "title, label, productName"
22
+ },
23
+ {
24
+ "name": "searchTerm",
25
+ "type": "string",
26
+ "default": "",
27
+ "intrinsic": true,
28
+ "description": "The current search query the user submitted.",
29
+ "synonyms": "query, term, q"
30
+ }
31
+ ]
32
+ },
33
+ "traits": [
34
+ {
35
+ "name": "AppSearch",
36
+ "entityRebindable": true,
37
+ "entityContract": {
38
+ "requires": [],
39
+ "provides": [
40
+ "searchTerm"
41
+ ]
42
+ },
43
+ "category": "interaction",
44
+ "linkedEntity": "AppSearchTarget",
45
+ "emits": [
46
+ {
47
+ "event": "AppSearchLoaded",
48
+ "description": "Filtered search results loaded",
49
+ "scope": "internal",
50
+ "payloadSchema": [
51
+ {
52
+ "name": "data",
53
+ "type": "[AppSearchTarget]"
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "event": "AppSearchFailed",
59
+ "description": "Search fetch failed",
60
+ "scope": "internal",
61
+ "payloadSchema": [
62
+ {
63
+ "name": "error",
64
+ "type": "string"
65
+ }
66
+ ]
67
+ }
68
+ ],
69
+ "stateMachine": {
70
+ "states": [
71
+ {
72
+ "name": "idle",
73
+ "isInitial": true
74
+ },
75
+ {
76
+ "name": "searching"
77
+ },
78
+ {
79
+ "name": "results"
80
+ }
81
+ ],
82
+ "events": [
83
+ {
84
+ "key": "INIT",
85
+ "name": "Initialize"
86
+ },
87
+ {
88
+ "key": "APP_SEARCH",
89
+ "name": "App Search",
90
+ "description": "A search query was submitted (e.g. from the AppLayout top-bar search).",
91
+ "synonyms": "query, find, lookup",
92
+ "tier": "essential",
93
+ "payloadSchema": [
94
+ {
95
+ "name": "value",
96
+ "type": "string"
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "key": "AppSearchLoaded",
102
+ "name": "App search loaded",
103
+ "payloadSchema": [
104
+ {
105
+ "name": "data",
106
+ "type": "[AppSearchTarget]"
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "key": "AppSearchFailed",
112
+ "name": "App search failed",
113
+ "payloadSchema": [
114
+ {
115
+ "name": "error",
116
+ "type": "string"
117
+ }
118
+ ]
119
+ },
120
+ {
121
+ "key": "CLEAR_SEARCH",
122
+ "name": "Clear Search"
123
+ }
124
+ ],
125
+ "transitions": [
126
+ {
127
+ "from": "idle",
128
+ "to": "idle",
129
+ "event": "INIT",
130
+ "effects": [
131
+ [
132
+ "fetch",
133
+ "AppSearchTarget",
134
+ {}
135
+ ],
136
+ [
137
+ "render-ui",
138
+ "main",
139
+ {
140
+ "type": "stack",
141
+ "gap": "md",
142
+ "children": [
143
+ "@config.idleContent"
144
+ ],
145
+ "direction": "vertical"
146
+ }
147
+ ]
148
+ ]
149
+ },
150
+ {
151
+ "from": "idle",
152
+ "to": "searching",
153
+ "event": "APP_SEARCH",
154
+ "effects": [
155
+ [
156
+ "set",
157
+ "@entity.searchTerm",
158
+ "@payload.value"
159
+ ],
160
+ [
161
+ "fetch",
162
+ "AppSearchTarget",
163
+ {
164
+ "filter": [
165
+ "or",
166
+ [
167
+ "=",
168
+ "@payload.value",
169
+ ""
170
+ ],
171
+ [
172
+ "str/includes",
173
+ [
174
+ "object/get",
175
+ "@entity",
176
+ "@config.searchField"
177
+ ],
178
+ "@payload.value"
179
+ ]
180
+ ],
181
+ "emit": {
182
+ "failure": "AppSearchFailed",
183
+ "success": "AppSearchLoaded"
184
+ }
185
+ }
186
+ ],
187
+ [
188
+ "render-ui",
189
+ "main",
190
+ {
191
+ "direction": "vertical",
192
+ "type": "stack",
193
+ "gap": "md",
194
+ "className": "py-12",
195
+ "children": [
196
+ {
197
+ "type": "spinner"
198
+ },
199
+ {
200
+ "variant": "caption",
201
+ "type": "typography",
202
+ "color": "muted",
203
+ "content": "Searching…"
204
+ }
205
+ ],
206
+ "align": "center"
207
+ }
208
+ ]
209
+ ]
210
+ },
211
+ {
212
+ "from": "searching",
213
+ "to": "searching",
214
+ "event": "APP_SEARCH",
215
+ "effects": [
216
+ [
217
+ "set",
218
+ "@entity.searchTerm",
219
+ "@payload.value"
220
+ ],
221
+ [
222
+ "fetch",
223
+ "AppSearchTarget",
224
+ {
225
+ "filter": [
226
+ "or",
227
+ [
228
+ "=",
229
+ "@payload.value",
230
+ ""
231
+ ],
232
+ [
233
+ "str/includes",
234
+ [
235
+ "object/get",
236
+ "@entity",
237
+ "@config.searchField"
238
+ ],
239
+ "@payload.value"
240
+ ]
241
+ ],
242
+ "emit": {
243
+ "success": "AppSearchLoaded",
244
+ "failure": "AppSearchFailed"
245
+ }
246
+ }
247
+ ],
248
+ [
249
+ "render-ui",
250
+ "main",
251
+ {
252
+ "type": "stack",
253
+ "gap": "md",
254
+ "align": "center",
255
+ "children": [
256
+ {
257
+ "type": "spinner"
258
+ },
259
+ {
260
+ "type": "typography",
261
+ "content": "Searching…",
262
+ "color": "muted",
263
+ "variant": "caption"
264
+ }
265
+ ],
266
+ "direction": "vertical",
267
+ "className": "py-12"
268
+ }
269
+ ]
270
+ ]
271
+ },
272
+ {
273
+ "from": "searching",
274
+ "to": "results",
275
+ "event": "AppSearchLoaded",
276
+ "effects": [
277
+ [
278
+ "render-ui",
279
+ "main",
280
+ {
281
+ "children": [
282
+ {
283
+ "type": "stack",
284
+ "gap": "sm",
285
+ "direction": "horizontal",
286
+ "children": [
287
+ {
288
+ "type": "icon",
289
+ "name": "search"
290
+ },
291
+ {
292
+ "type": "typography",
293
+ "variant": "h2",
294
+ "content": "@config.resultsTitle"
295
+ },
296
+ {
297
+ "action": "CLEAR_SEARCH",
298
+ "variant": "ghost",
299
+ "icon": "x",
300
+ "type": "button",
301
+ "label": "Clear search"
302
+ }
303
+ ],
304
+ "justify": "between",
305
+ "align": "center"
306
+ },
307
+ {
308
+ "variant": "caption",
309
+ "content": "Matching “@entity.searchTerm”",
310
+ "type": "typography",
311
+ "color": "muted"
312
+ },
313
+ {
314
+ "type": "divider"
315
+ },
316
+ {
317
+ "entity": "@payload.data",
318
+ "fields": "@config.resultFields",
319
+ "type": "data-grid",
320
+ "itemActions": "@config.resultActions"
321
+ }
322
+ ],
323
+ "direction": "vertical",
324
+ "gap": "lg",
325
+ "type": "stack",
326
+ "className": "max-w-6xl mx-auto w-full p-4"
327
+ }
328
+ ]
329
+ ]
330
+ },
331
+ {
332
+ "from": "searching",
333
+ "to": "idle",
334
+ "event": "AppSearchFailed",
335
+ "effects": [
336
+ [
337
+ "render-ui",
338
+ "main",
339
+ {
340
+ "type": "stack",
341
+ "children": [
342
+ {
343
+ "type": "alert",
344
+ "variant": "error",
345
+ "message": "@payload.error"
346
+ },
347
+ "@config.idleContent"
348
+ ],
349
+ "direction": "vertical",
350
+ "gap": "md"
351
+ }
352
+ ]
353
+ ]
354
+ },
355
+ {
356
+ "from": "results",
357
+ "to": "searching",
358
+ "event": "APP_SEARCH",
359
+ "effects": [
360
+ [
361
+ "set",
362
+ "@entity.searchTerm",
363
+ "@payload.value"
364
+ ],
365
+ [
366
+ "fetch",
367
+ "AppSearchTarget",
368
+ {
369
+ "filter": [
370
+ "or",
371
+ [
372
+ "=",
373
+ "@payload.value",
374
+ ""
375
+ ],
376
+ [
377
+ "str/includes",
378
+ [
379
+ "object/get",
380
+ "@entity",
381
+ "@config.searchField"
382
+ ],
383
+ "@payload.value"
384
+ ]
385
+ ],
386
+ "emit": {
387
+ "success": "AppSearchLoaded",
388
+ "failure": "AppSearchFailed"
389
+ }
390
+ }
391
+ ],
392
+ [
393
+ "render-ui",
394
+ "main",
395
+ {
396
+ "type": "stack",
397
+ "gap": "md",
398
+ "className": "py-12",
399
+ "align": "center",
400
+ "direction": "vertical",
401
+ "children": [
402
+ {
403
+ "type": "spinner"
404
+ },
405
+ {
406
+ "content": "Searching…",
407
+ "type": "typography",
408
+ "variant": "caption",
409
+ "color": "muted"
410
+ }
411
+ ]
412
+ }
413
+ ]
414
+ ]
415
+ },
416
+ {
417
+ "from": "results",
418
+ "to": "idle",
419
+ "event": "CLEAR_SEARCH",
420
+ "effects": [
421
+ [
422
+ "set",
423
+ "@entity.searchTerm",
424
+ ""
425
+ ],
426
+ [
427
+ "render-ui",
428
+ "main",
429
+ {
430
+ "type": "stack",
431
+ "gap": "md",
432
+ "direction": "vertical",
433
+ "children": [
434
+ "@config.idleContent"
435
+ ]
436
+ }
437
+ ]
438
+ ]
439
+ }
440
+ ]
441
+ },
442
+ "config": {
443
+ "resultFields": {
444
+ "type": "[AppSearchFieldSpec]",
445
+ "default": [
446
+ {
447
+ "label": "Name",
448
+ "variant": "h4",
449
+ "name": "name"
450
+ }
451
+ ],
452
+ "label": "Result columns",
453
+ "description": "Columns shown in the search-results grid; maps entity fields to display cells.",
454
+ "tier": "presentation",
455
+ "items": {
456
+ "type": "object",
457
+ "properties": {
458
+ "variant": {
459
+ "name": "variant",
460
+ "type": "string",
461
+ "required": false
462
+ },
463
+ "format": {
464
+ "name": "format",
465
+ "type": "string",
466
+ "required": false
467
+ },
468
+ "label": {
469
+ "name": "label",
470
+ "type": "string",
471
+ "required": false
472
+ },
473
+ "icon": {
474
+ "name": "icon",
475
+ "type": "string",
476
+ "required": false
477
+ },
478
+ "name": {
479
+ "name": "name",
480
+ "type": "string",
481
+ "required": true
482
+ }
483
+ }
484
+ }
485
+ },
486
+ "idleContent": {
487
+ "type": "trait",
488
+ "label": "Idle content",
489
+ "description": "The normal content view (e.g. the data ledger/browse trait) shown when no search is active.",
490
+ "tier": "presentation"
491
+ },
492
+ "resultActions": {
493
+ "type": "[AppSearchFieldSpec]",
494
+ "default": [],
495
+ "label": "Result row actions",
496
+ "description": "Optional per-row actions on a result (e.g. open).",
497
+ "tier": "presentation",
498
+ "items": {
499
+ "type": "object",
500
+ "properties": {
501
+ "label": {
502
+ "name": "label",
503
+ "type": "string",
504
+ "required": false
505
+ },
506
+ "variant": {
507
+ "name": "variant",
508
+ "type": "string",
509
+ "required": false
510
+ },
511
+ "icon": {
512
+ "name": "icon",
513
+ "type": "string",
514
+ "required": false
515
+ },
516
+ "name": {
517
+ "name": "name",
518
+ "type": "string",
519
+ "required": true
520
+ },
521
+ "format": {
522
+ "name": "format",
523
+ "type": "string",
524
+ "required": false
525
+ }
526
+ }
527
+ }
528
+ },
529
+ "searchField": {
530
+ "type": "string",
531
+ "default": "name",
532
+ "label": "Search field",
533
+ "description": "Entity field matched against the query (case-insensitive substring).",
534
+ "tier": "presentation"
535
+ },
536
+ "resultsTitle": {
537
+ "type": "string",
538
+ "default": "Search results",
539
+ "label": "Results title",
540
+ "description": "Heading shown above the search-results grid.",
541
+ "tier": "presentation"
542
+ }
543
+ },
544
+ "scope": "collection"
545
+ }
546
+ ],
547
+ "pages": [
548
+ {
549
+ "name": "AppSearchPage",
550
+ "path": "/app-search",
551
+ "traits": [
552
+ {
553
+ "ref": "AppSearch"
554
+ }
555
+ ]
556
+ }
557
+ ]
558
+ }
559
+ ]
560
+ }