@elaraai/e3-ui 1.0.84 → 1.0.86

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 (65) 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 +5 -2
  6. package/dist/src/bind/record.d.ts.map +1 -1
  7. package/dist/src/bind/record.js +5 -2
  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 +2 -0
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/index.js +5 -0
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/internal.d.ts +2 -0
  18. package/dist/src/internal.d.ts.map +1 -1
  19. package/dist/src/internal.js +6 -0
  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/ui.d.ts +16 -3
  50. package/dist/src/ui.d.ts.map +1 -1
  51. package/dist/src/ui.js +21 -1
  52. package/dist/src/ui.js.map +1 -1
  53. package/dist/test/bind/data/data.examples.d.ts +76 -1
  54. package/dist/test/bind/data/data.examples.d.ts.map +1 -1
  55. package/dist/test/bind/data/data.examples.js +176 -3
  56. package/dist/test/bind/data/data.examples.js.map +1 -1
  57. package/dist/test/bind/func/func.examples.d.ts +8 -0
  58. package/dist/test/bind/func/func.examples.d.ts.map +1 -1
  59. package/dist/test/bind/func/func.examples.js +4 -3
  60. package/dist/test/bind/func/func.examples.js.map +1 -1
  61. package/dist/test/query/query.examples.d.ts +5022 -0
  62. package/dist/test/query/query.examples.d.ts.map +1 -0
  63. package/dist/test/query/query.examples.js +467 -0
  64. package/dist/test/query/query.examples.js.map +1 -0
  65. package/package.json +9 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../src/query/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EAGV,KAAK,QAAQ,EACb,KAAK,kBAAkB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAGH,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,eAAe,EACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,oB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAgF,CAAC;AAMnH;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAChC,wGAAwG;IACxG,OAAO,EAAE,aAAa,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAChD,sGAAsG;IACtG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,MAAM,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;CACrE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,mBAAmB,GAAG,QAAQ,CAAC,eAAe,CAAC,CAO9E;AAMD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,aAAa,CAAC,CAA6B,CAAC"}
@@ -0,0 +1,114 @@
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
+ * `<Query.Library>` (#1063) — every saved query, and where new queries start,
7
+ * set out as Studio's page library is.
8
+ *
9
+ * The query library is a component of its own, apart from the builder: an
10
+ * interface — the saved queries record bound with its patch, the data sources
11
+ * a query may read, the builder it opens queries in, and who to tell — which
12
+ * the `QueryLibrary` renderer draws, headerless with one toolbar: the search,
13
+ * Sort, Grid · List and the primary "+ New query on <data source>"; beside it
14
+ * the data sources with their counts of saved queries, and this viewer's
15
+ * recent runs; under it the saved queries, each card a wireframe of its steps.
16
+ * It reads no dataset: a card draws a query, never its data.
17
+ *
18
+ * "Open in builder →" opens a query in the builder: it writes the builder's
19
+ * open query ({@link queryKeys}) and tells the host.
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+ import { ArrayType, FunctionType, NullType, OptionType, StringType, StructType, none, some, } from "@elaraai/east";
24
+ import { EastUI, optionsTag, } from "@elaraai/east-ui/internal";
25
+ import { DataSourceType, dataSources } from "../bind/sources.js";
26
+ import { QueriesHandleType } from "./queries.js";
27
+ // ============================================================================
28
+ // Types
29
+ // ============================================================================
30
+ /**
31
+ * The `QueryLibrary` renderer's payload — the query library's interface.
32
+ *
33
+ * @property queries - The saved queries record, bound with its patch — what it reads
34
+ * @property datasets - The data sources a query may read, by the names it reads them
35
+ * @property id - Names the builder whose open query it writes; `none` for the one builder
36
+ * @property onOpen - Told a query's name when it opens one in the builder — the host shows the builder
37
+ */
38
+ export const QueryLibraryPayloadType = StructType({
39
+ queries: QueriesHandleType,
40
+ datasets: ArrayType(DataSourceType),
41
+ id: OptionType(StringType),
42
+ onOpen: OptionType(FunctionType([StringType], NullType)),
43
+ });
44
+ // ============================================================================
45
+ // The renderer's carrier
46
+ // ============================================================================
47
+ /**
48
+ * Internal {@link EastUI.component} carrier. The React renderer registers
49
+ * against this in `@elaraai/e3-ui-components` via `implementUIComponent`.
50
+ */
51
+ export const QueryLibraryComponent = EastUI.component("QueryLibrary", QueryLibraryPayloadType, { optional: true });
52
+ /**
53
+ * Every saved query, and where new queries start.
54
+ *
55
+ * @remarks
56
+ * - **The toolbar**, one row: the search "Search N queries…", over names,
57
+ * descriptions and data sources; Sort · Recent or Name; Grid · List; and
58
+ * "+ New query on <data source>" — the data source the pane shows, else the
59
+ * first bound — which opens a new query on it in the builder.
60
+ * - **The pane**: All queries, then each bound data source with its count of
61
+ * the saved queries that start from it, the one shown in the brand; and, at
62
+ * its foot, Recent — this viewer's runs.
63
+ * - **The gallery**: three across, or a row each, every card a wireframe of
64
+ * the query — its source and a bar per step — with its name, its
65
+ * description (the author's, else the sentence generated from its steps),
66
+ * what it starts from and gives, and "Open in builder →". A card drags onto
67
+ * the builder that shares `id`. A query whose data sources aren't bound
68
+ * here says why, and doesn't open.
69
+ *
70
+ * The data source shown, the search, the order and the layout are the query
71
+ * library's own; the query it opens is the builder's, shared by `id` with a
72
+ * `<Query.Builder>`. The query library reads no dataset, and draws no border
73
+ * around itself. Its data sources are the surface's bindings, which the host
74
+ * loads with the surface as it loads any: bind a large one with
75
+ * `Data.bindPaged`, which is declared and never loaded whole.
76
+ *
77
+ * @param options - The bound record, the data sources, the builder's name and who to tell ({@link QueryLibraryOptions})
78
+ * @returns An East expression of type `UIComponentType`
79
+ * @throws {Error} When `datasets` is empty, or a name is not a jq identifier
80
+ *
81
+ * @example
82
+ * ```tsx
83
+ * import { East } from "@elaraai/east";
84
+ * import { Reactive, UIComponentType } from "@elaraai/east-ui";
85
+ * import { Data, Query, Record, ui } from "@elaraai/e3-ui";
86
+ *
87
+ * // The query library: every saved query, and where new queries start — over the builder's data sources.
88
+ * export const library = ui("query_library", [], East.function([], UIComponentType, _$ => (
89
+ * <Reactive>{$ => {
90
+ * const orders = $.let(Data.bindPaged(d.orders));
91
+ * const customers = $.let(Data.bind(d.customers));
92
+ * const saved = $.let(Record.bind(d.queries, [d.queriesPatch]));
93
+ * return <Query.Library queries={saved} datasets={{ orders, customers }} />;
94
+ * }}</Reactive>
95
+ * )));
96
+ * ```
97
+ */
98
+ function createLibrary(options) {
99
+ return QueryLibraryComponent.Root({
100
+ queries: { read: options.queries.read, history: options.queries.history, commit: { patch: options.queries.commit.patch } },
101
+ datasets: dataSources("Query.Library", options.datasets),
102
+ id: options.id === undefined ? none : some(options.id),
103
+ onOpen: options.onOpen === undefined ? none : some(options.onOpen),
104
+ });
105
+ }
106
+ // ============================================================================
107
+ // Tag
108
+ // ============================================================================
109
+ /**
110
+ * `<Query.Library>` — every saved query, and where new queries start. See
111
+ * {@link createLibrary}.
112
+ */
113
+ export const QueryLibrary = optionsTag(createLibrary);
114
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../../../src/query/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,IAAI,GAGP,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,MAAM,EACN,UAAU,GAIb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAsB,MAAM,cAAc,CAAC;AAErE,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAC9C,OAAO,EAAE,iBAAiB;IAC1B,QAAQ,EAAE,SAAS,CAAC,cAAc,CAAC;IACnC,EAAE,EAAE,UAAU,CAAC,UAAU,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC;CAC3D,CAAC,CAAC;AAKH,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,uBAAuB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AA8BnH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,SAAS,aAAa,CAAC,OAA4B;IAC/C,OAAO,qBAA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