@revenexx/studio-shared 0.3.2 → 0.4.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 (166) hide show
  1. package/dist/module.d.mts +6 -0
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +12 -1
  4. package/dist/runtime/components/Dashboard/DashboardConfirmDialog.d.vue.ts +16 -0
  5. package/dist/runtime/components/Dashboard/DashboardConfirmDialog.vue +39 -0
  6. package/dist/runtime/components/Dashboard/DashboardConfirmDialog.vue.d.ts +16 -0
  7. package/dist/runtime/components/Dashboard/DashboardControls.d.vue.ts +58 -0
  8. package/dist/runtime/components/Dashboard/DashboardControls.vue +209 -0
  9. package/dist/runtime/components/Dashboard/DashboardControls.vue.d.ts +58 -0
  10. package/dist/runtime/components/Dashboard/DashboardGrid.d.vue.ts +17 -0
  11. package/dist/runtime/components/Dashboard/DashboardGrid.vue +87 -0
  12. package/dist/runtime/components/Dashboard/DashboardGrid.vue.d.ts +17 -0
  13. package/dist/runtime/components/Dashboard/DashboardNameDialog.d.vue.ts +19 -0
  14. package/dist/runtime/components/Dashboard/DashboardNameDialog.vue +61 -0
  15. package/dist/runtime/components/Dashboard/DashboardNameDialog.vue.d.ts +19 -0
  16. package/dist/runtime/components/Dashboard/DashboardPickerDialog.d.vue.ts +15 -0
  17. package/dist/runtime/components/Dashboard/DashboardPickerDialog.vue +100 -0
  18. package/dist/runtime/components/Dashboard/DashboardPickerDialog.vue.d.ts +15 -0
  19. package/dist/runtime/components/Dashboard/DashboardShareDialog.d.vue.ts +28 -0
  20. package/dist/runtime/components/Dashboard/DashboardShareDialog.vue +155 -0
  21. package/dist/runtime/components/Dashboard/DashboardShareDialog.vue.d.ts +28 -0
  22. package/dist/runtime/components/Dashboard/DashboardTopBar.d.vue.ts +64 -0
  23. package/dist/runtime/components/Dashboard/DashboardTopBar.vue +79 -0
  24. package/dist/runtime/components/Dashboard/DashboardTopBar.vue.d.ts +64 -0
  25. package/dist/runtime/components/Dashboard/DashboardWidgetConfigDialog.d.vue.ts +44 -0
  26. package/dist/runtime/components/Dashboard/DashboardWidgetConfigDialog.vue +153 -0
  27. package/dist/runtime/components/Dashboard/DashboardWidgetConfigDialog.vue.d.ts +44 -0
  28. package/dist/runtime/components/Dashboard/DashboardWidgetFrame.d.vue.ts +28 -0
  29. package/dist/runtime/components/Dashboard/DashboardWidgetFrame.vue +80 -0
  30. package/dist/runtime/components/Dashboard/DashboardWidgetFrame.vue.d.ts +28 -0
  31. package/dist/runtime/components/Dashboard/DashboardWidgetHost.d.vue.ts +7 -0
  32. package/dist/runtime/components/Dashboard/DashboardWidgetHost.vue +30 -0
  33. package/dist/runtime/components/Dashboard/DashboardWidgetHost.vue.d.ts +7 -0
  34. package/dist/runtime/components/Dashboard/DashboardWidgetIcon.d.vue.ts +9 -0
  35. package/dist/runtime/components/Dashboard/DashboardWidgetIcon.vue +13 -0
  36. package/dist/runtime/components/Dashboard/DashboardWidgetIcon.vue.d.ts +9 -0
  37. package/dist/runtime/components/Dashboard/DashboardWidgetLibrary.d.vue.ts +24 -0
  38. package/dist/runtime/components/Dashboard/DashboardWidgetLibrary.vue +140 -0
  39. package/dist/runtime/components/Dashboard/DashboardWidgetLibrary.vue.d.ts +24 -0
  40. package/dist/runtime/components/Dashboard/DashboardWidgetPreview.d.vue.ts +23 -0
  41. package/dist/runtime/components/Dashboard/DashboardWidgetPreview.vue +124 -0
  42. package/dist/runtime/components/Dashboard/DashboardWidgetPreview.vue.d.ts +23 -0
  43. package/dist/runtime/components/DataTable/ColumnsMenu.d.vue.ts +2 -1
  44. package/dist/runtime/components/DataTable/ColumnsMenu.vue.d.ts +2 -1
  45. package/dist/runtime/components/DataTable/DataTable.d.vue.ts +105 -28
  46. package/dist/runtime/components/DataTable/DataTable.vue +403 -38
  47. package/dist/runtime/components/DataTable/DataTable.vue.d.ts +105 -28
  48. package/dist/runtime/components/DataTable/FacetChips.d.vue.ts +17 -0
  49. package/dist/runtime/components/DataTable/FacetChips.vue +72 -0
  50. package/dist/runtime/components/DataTable/FacetChips.vue.d.ts +17 -0
  51. package/dist/runtime/components/DataTable/FacetPanel.d.vue.ts +21 -0
  52. package/dist/runtime/components/DataTable/FacetPanel.vue +359 -0
  53. package/dist/runtime/components/DataTable/FacetPanel.vue.d.ts +21 -0
  54. package/dist/runtime/components/DataTable/FilterMenu.d.vue.ts +6 -5
  55. package/dist/runtime/components/DataTable/FilterMenu.vue.d.ts +6 -5
  56. package/dist/runtime/components/DataTable/SavedViewsMenu.d.vue.ts +6 -1
  57. package/dist/runtime/components/DataTable/SavedViewsMenu.vue +83 -63
  58. package/dist/runtime/components/DataTable/SavedViewsMenu.vue.d.ts +6 -1
  59. package/dist/runtime/components/DataTable/SortMenu.d.vue.ts +9 -3
  60. package/dist/runtime/components/DataTable/SortMenu.vue +40 -12
  61. package/dist/runtime/components/DataTable/SortMenu.vue.d.ts +9 -3
  62. package/dist/runtime/components/DataTable/ViewModeSwitch.d.vue.ts +4 -2
  63. package/dist/runtime/components/DataTable/ViewModeSwitch.vue.d.ts +4 -2
  64. package/dist/runtime/components/Form/FieldCell.d.vue.ts +32 -0
  65. package/dist/runtime/components/Form/FieldCell.vue +46 -0
  66. package/dist/runtime/components/Form/FieldCell.vue.d.ts +32 -0
  67. package/dist/runtime/components/Form/FieldGrid.d.vue.ts +13 -0
  68. package/dist/runtime/components/Form/FieldGrid.vue +11 -0
  69. package/dist/runtime/components/Form/FieldGrid.vue.d.ts +13 -0
  70. package/dist/runtime/components/Form/FormContextCard.d.vue.ts +33 -0
  71. package/dist/runtime/components/Form/FormContextCard.vue +56 -0
  72. package/dist/runtime/components/Form/FormContextCard.vue.d.ts +33 -0
  73. package/dist/runtime/components/Form/FormLayout.d.vue.ts +47 -0
  74. package/dist/runtime/components/Form/FormLayout.vue +169 -0
  75. package/dist/runtime/components/Form/FormLayout.vue.d.ts +47 -0
  76. package/dist/runtime/components/Form/FormSection.d.vue.ts +25 -0
  77. package/dist/runtime/components/Form/FormSection.vue +48 -0
  78. package/dist/runtime/components/Form/FormSection.vue.d.ts +25 -0
  79. package/dist/runtime/components/Form/SaveBar.d.vue.ts +44 -0
  80. package/dist/runtime/components/Form/SaveBar.vue +71 -0
  81. package/dist/runtime/components/Form/SaveBar.vue.d.ts +44 -0
  82. package/dist/runtime/components/Media/MediaFolderTree.d.vue.ts +2 -1
  83. package/dist/runtime/components/Media/MediaFolderTree.vue.d.ts +2 -1
  84. package/dist/runtime/components/Media/MediaPickerDialog.d.vue.ts +4 -3
  85. package/dist/runtime/components/Media/MediaPickerDialog.vue.d.ts +4 -3
  86. package/dist/runtime/components/Media/MediaUploader.d.vue.ts +4 -3
  87. package/dist/runtime/components/Media/MediaUploader.vue.d.ts +4 -3
  88. package/dist/runtime/components/Shared/AppIcon.d.vue.ts +21 -0
  89. package/dist/runtime/components/Shared/AppIcon.vue +47 -0
  90. package/dist/runtime/components/Shared/AppIcon.vue.d.ts +21 -0
  91. package/dist/runtime/components/Shared/BuildLogsFlyout.d.vue.ts +2 -1
  92. package/dist/runtime/components/Shared/BuildLogsFlyout.vue.d.ts +2 -1
  93. package/dist/runtime/components/Shared/DetailSheet.d.vue.ts +60 -0
  94. package/dist/runtime/components/Shared/DetailSheet.vue +207 -0
  95. package/dist/runtime/components/Shared/DetailSheet.vue.d.ts +60 -0
  96. package/dist/runtime/components/Shared/FloatingPanel.d.vue.ts +7 -6
  97. package/dist/runtime/components/Shared/FloatingPanel.vue.d.ts +7 -6
  98. package/dist/runtime/components/Shared/GitDeploymentSettings.d.vue.ts +2 -1
  99. package/dist/runtime/components/Shared/GitDeploymentSettings.vue.d.ts +2 -1
  100. package/dist/runtime/components/Shared/KpiTile.d.vue.ts +2 -1
  101. package/dist/runtime/components/Shared/KpiTile.vue.d.ts +2 -1
  102. package/dist/runtime/components/Shared/ListSurface.d.vue.ts +3 -2
  103. package/dist/runtime/components/Shared/ListSurface.vue.d.ts +3 -2
  104. package/dist/runtime/components/Shared/PageHeader.d.vue.ts +7 -6
  105. package/dist/runtime/components/Shared/PageHeader.vue.d.ts +7 -6
  106. package/dist/runtime/components/Shared/RecordLayout.d.vue.ts +8 -7
  107. package/dist/runtime/components/Shared/RecordLayout.vue.d.ts +8 -7
  108. package/dist/runtime/components/Shared/RecordRailCard.d.vue.ts +3 -2
  109. package/dist/runtime/components/Shared/RecordRailCard.vue.d.ts +3 -2
  110. package/dist/runtime/components/Shared/SidebarNav.d.vue.ts +3 -2
  111. package/dist/runtime/components/Shared/SidebarNav.vue.d.ts +3 -2
  112. package/dist/runtime/components/Shared/SidebarNavLink.d.vue.ts +2 -1
  113. package/dist/runtime/components/Shared/SidebarNavLink.vue.d.ts +2 -1
  114. package/dist/runtime/components/Shared/SortHeader.d.vue.ts +3 -2
  115. package/dist/runtime/components/Shared/SortHeader.vue +6 -2
  116. package/dist/runtime/components/Shared/SortHeader.vue.d.ts +3 -2
  117. package/dist/runtime/components/Shared/StateCard.d.vue.ts +6 -5
  118. package/dist/runtime/components/Shared/StateCard.vue.d.ts +6 -5
  119. package/dist/runtime/components/Shared/StudioCard.d.vue.ts +5 -4
  120. package/dist/runtime/components/Shared/StudioCard.vue.d.ts +5 -4
  121. package/dist/runtime/components/Shared/TabBar.d.vue.ts +9 -10
  122. package/dist/runtime/components/Shared/TabBar.vue +26 -7
  123. package/dist/runtime/components/Shared/TabBar.vue.d.ts +9 -10
  124. package/dist/runtime/components/Shared/ViewTab.d.vue.ts +2 -1
  125. package/dist/runtime/components/Shared/ViewTab.vue.d.ts +2 -1
  126. package/dist/runtime/components/Shared/Wizard.d.vue.ts +10 -7
  127. package/dist/runtime/components/Shared/Wizard.vue.d.ts +10 -7
  128. package/dist/runtime/composables/useDashboards.d.ts +27 -0
  129. package/dist/runtime/composables/useDashboards.js +143 -0
  130. package/dist/runtime/composables/useDetailSheet.d.ts +20 -0
  131. package/dist/runtime/composables/useDetailSheet.js +50 -0
  132. package/dist/runtime/composables/usePlatformTenant.d.ts +6 -0
  133. package/dist/runtime/composables/useSavedViews.d.ts +44 -0
  134. package/dist/runtime/composables/useSavedViews.js +44 -0
  135. package/dist/runtime/composables/useStickyListView.d.ts +60 -0
  136. package/dist/runtime/composables/useStickyListView.js +32 -0
  137. package/dist/runtime/lib/activeTenant.d.ts +58 -0
  138. package/dist/runtime/lib/activeTenant.js +45 -0
  139. package/dist/runtime/lib/appIcon.d.ts +48 -0
  140. package/dist/runtime/lib/appIcon.js +27 -0
  141. package/dist/runtime/lib/canonicalJson.d.ts +43 -0
  142. package/dist/runtime/lib/canonicalJson.js +38 -0
  143. package/dist/runtime/lib/dashboardIcons.d.ts +4 -0
  144. package/dist/runtime/lib/dashboardIcons.js +50 -0
  145. package/dist/runtime/lib/detailSheet.d.ts +43 -0
  146. package/dist/runtime/lib/detailSheet.js +34 -0
  147. package/dist/runtime/lib/facets.d.ts +200 -0
  148. package/dist/runtime/lib/facets.js +171 -0
  149. package/dist/runtime/lib/formLayout.d.ts +94 -0
  150. package/dist/runtime/lib/formLayout.js +70 -0
  151. package/dist/runtime/lib/formLayoutContext.d.ts +26 -0
  152. package/dist/runtime/lib/formLayoutContext.js +1 -0
  153. package/dist/runtime/lib/gridTracks.d.ts +55 -0
  154. package/dist/runtime/lib/gridTracks.js +29 -0
  155. package/dist/runtime/lib/rowMove.d.ts +38 -0
  156. package/dist/runtime/lib/rowMove.js +20 -0
  157. package/dist/runtime/lib/solarIconMap.d.ts +15 -0
  158. package/dist/runtime/lib/solarIconMap.js +280 -0
  159. package/dist/runtime/lib/solarIcons.d.ts +37 -0
  160. package/dist/runtime/lib/solarIcons.js +25 -0
  161. package/dist/runtime/lib/widgetRegistry.d.ts +124 -0
  162. package/dist/runtime/lib/widgetRegistry.js +66 -0
  163. package/dist/runtime/types/dashboard.d.ts +95 -0
  164. package/dist/runtime/types/dashboard.js +2 -0
  165. package/dist/types.d.mts +12 -0
  166. package/package.json +3 -2
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Moving a row by dragging it, as arithmetic the table does not have to own.
3
+ *
4
+ * The DataTable only knows rows and keys. What a move MEANS — which position
5
+ * column is written, which rows have to change — is the surface's business, so
6
+ * the table answers one question and stops: "the operator put row X here; what
7
+ * is the order now?". Kept apart from the component so the edge cases are a
8
+ * test rather than something found by dragging.
9
+ */
10
+ /** Which half of the row under the pointer the dragged row is dropped on. */
11
+ export type DropEdge = 'before' | 'after';
12
+ /**
13
+ * The edge of a row a pointer is nearest to.
14
+ *
15
+ * The middle of the row, not an arithmetic row height: a row whose label wraps
16
+ * is taller than its neighbours, and an index derived from "pointer offset ÷ 40
17
+ * pixels" puts the row one slot off on every list that has a long value in it.
18
+ */
19
+ export declare function dropEdge(pointerY: number, rowTop: number, rowHeight: number): DropEdge;
20
+ /**
21
+ * Where a row dragged from `from` lands when dropped on the `edge` of the row
22
+ * at `target`, as an index into the list WITHOUT the dragged row taken out.
23
+ *
24
+ * Returns null when the drop changes nothing — onto itself, or onto the edge
25
+ * it already touches (the bottom of the row above, the top of the row below).
26
+ * A move that changes nothing must not write anything, and it is easy to send
27
+ * two position updates for a row the operator merely picked up and put back.
28
+ */
29
+ export declare function dropTargetIndex(from: number, target: number, edge: DropEdge): number | null;
30
+ /** The keys in their new order, `from` moved to `to`. */
31
+ export declare function moveKey<K>(keys: readonly K[], from: number, to: number): K[];
32
+ /**
33
+ * The keyboard half of the same move: one step up or down, or null at an end.
34
+ *
35
+ * Dragging is a pointer gesture and cannot be the only way to reorder a list —
36
+ * the handle is a button, and the arrow keys on it move the row one place.
37
+ */
38
+ export declare function stepTarget(from: number, delta: -1 | 1, length: number): number | null;
@@ -0,0 +1,20 @@
1
+ export function dropEdge(pointerY, rowTop, rowHeight) {
2
+ return pointerY < rowTop + rowHeight / 2 ? "before" : "after";
3
+ }
4
+ export function dropTargetIndex(from, target, edge) {
5
+ if (from < 0 || target < 0) return null;
6
+ const insertAt = edge === "before" ? target : target + 1;
7
+ const to = insertAt > from ? insertAt - 1 : insertAt;
8
+ return to === from ? null : to;
9
+ }
10
+ export function moveKey(keys, from, to) {
11
+ if (from < 0 || from >= keys.length || to < 0 || to >= keys.length || from === to) return [...keys];
12
+ const next = [...keys];
13
+ const [moved] = next.splice(from, 1);
14
+ next.splice(to, 0, moved);
15
+ return next;
16
+ }
17
+ export function stepTarget(from, delta, length) {
18
+ const to = from + delta;
19
+ return to < 0 || to >= length ? null : to;
20
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * GENERATED by `node scripts/icons.mjs`. Do not edit by hand.
3
+ *
4
+ * The closed set of Solar icons the cockpit resolves by name: every icon the
5
+ * app manifests, this repo's code and the curated picker set ask for. Named
6
+ * imports, so the bundle carries these 127 instead of all 1,413
7
+ * (PE-985). A name outside the set renders the fallback glyph; run
8
+ * `pnpm icons` after adding one, and `pnpm icons:check` to verify.
9
+ */
10
+ import type { Component } from 'vue';
11
+ export declare const SOLAR_ICON_MAP: Readonly<Record<string, Component>>;
12
+ /** Manifest names Solar does not have → the glyph drawn for them. */
13
+ export declare const SOLAR_ICON_ALIASES: Readonly<Record<string, string>>;
14
+ /** Drawn for a name outside the map. */
15
+ export declare const SOLAR_FALLBACK_ICON: Component;
@@ -0,0 +1,280 @@
1
+ import {
2
+ AddCircle,
3
+ AddSquare,
4
+ Alarm,
5
+ Archive,
6
+ ArrowRight,
7
+ Atom,
8
+ Backspace,
9
+ Bag,
10
+ BagCheck,
11
+ Bell,
12
+ Bill,
13
+ BillList,
14
+ Bolt,
15
+ Book,
16
+ Bookmark,
17
+ Box,
18
+ BranchingPathsUp,
19
+ Broom,
20
+ Buildings,
21
+ Calendar,
22
+ CalendarMinimalistic,
23
+ Card,
24
+ CardTransfer,
25
+ Cart,
26
+ CartLarge,
27
+ CartPlus,
28
+ Chart,
29
+ Chart2,
30
+ ChartSquare,
31
+ ChatRound,
32
+ ChatRoundLine,
33
+ CheckCircle,
34
+ CheckRead,
35
+ ChecklistMinimalistic,
36
+ Clipboard,
37
+ ClipboardList,
38
+ ClockCircle,
39
+ CloseCircle,
40
+ Code,
41
+ Copy,
42
+ Cpu,
43
+ DangerTriangle,
44
+ Database,
45
+ Delivery,
46
+ Document,
47
+ DocumentText,
48
+ Download,
49
+ DownloadMinimalistic,
50
+ Earth,
51
+ Eye,
52
+ File,
53
+ FileText,
54
+ Folder,
55
+ FolderOpen,
56
+ FolderPathConnect,
57
+ Forbidden,
58
+ Gallery,
59
+ GalleryMinimalistic,
60
+ Global,
61
+ GraphDown,
62
+ GraphUp,
63
+ Hashtag,
64
+ Heart,
65
+ Help,
66
+ Home,
67
+ Import,
68
+ Inbox,
69
+ InboxIn,
70
+ Key,
71
+ Layers,
72
+ Letter,
73
+ Lightbulb,
74
+ Link,
75
+ LinkRound,
76
+ List,
77
+ ListCheck,
78
+ Lock,
79
+ MagicStick,
80
+ Magnifer,
81
+ Map,
82
+ MapPoint,
83
+ MedalRibbon,
84
+ MoneyBag,
85
+ Notebook,
86
+ NotebookMinimalistic,
87
+ Palette,
88
+ Pause,
89
+ Pen,
90
+ Plain,
91
+ Play,
92
+ PlugCircle,
93
+ Pulse,
94
+ Radar,
95
+ Refresh,
96
+ RefreshCircle,
97
+ Restart,
98
+ RewindBackCircle,
99
+ Routing,
100
+ Ruler,
101
+ Scale,
102
+ Server,
103
+ Settings,
104
+ Shield,
105
+ ShieldCheck,
106
+ ShieldCross,
107
+ ShieldUser,
108
+ Shop,
109
+ Shuffle,
110
+ Star,
111
+ Stars,
112
+ Tag,
113
+ TagPrice,
114
+ Ticket,
115
+ TrashBinMinimalistic,
116
+ TrashBinTrash,
117
+ UndoLeftRound,
118
+ Upload,
119
+ User,
120
+ UserBlock,
121
+ UserCheck,
122
+ UserId,
123
+ UsersGroupRounded,
124
+ Wallet,
125
+ WalletMoney,
126
+ Weigher,
127
+ Widget,
128
+ Widget5
129
+ } from "#solar-icons";
130
+ export const SOLAR_ICON_MAP = {
131
+ AddCircle,
132
+ AddSquare,
133
+ Alarm,
134
+ Archive,
135
+ ArrowRight,
136
+ Atom,
137
+ Backspace,
138
+ Bag,
139
+ BagCheck,
140
+ Bell,
141
+ Bill,
142
+ BillList,
143
+ Bolt,
144
+ Book,
145
+ Bookmark,
146
+ Box,
147
+ BranchingPathsUp,
148
+ Broom,
149
+ Buildings,
150
+ Calendar,
151
+ CalendarMinimalistic,
152
+ Card,
153
+ CardTransfer,
154
+ Cart,
155
+ CartLarge,
156
+ CartPlus,
157
+ Chart,
158
+ Chart2,
159
+ ChartSquare,
160
+ ChatRound,
161
+ ChatRoundLine,
162
+ CheckCircle,
163
+ CheckRead,
164
+ ChecklistMinimalistic,
165
+ Clipboard,
166
+ ClipboardList,
167
+ ClockCircle,
168
+ CloseCircle,
169
+ Code,
170
+ Copy,
171
+ Cpu,
172
+ DangerTriangle,
173
+ Database,
174
+ Delivery,
175
+ Document,
176
+ DocumentText,
177
+ Download,
178
+ DownloadMinimalistic,
179
+ Earth,
180
+ Eye,
181
+ File,
182
+ FileText,
183
+ Folder,
184
+ FolderOpen,
185
+ FolderPathConnect,
186
+ Forbidden,
187
+ Gallery,
188
+ GalleryMinimalistic,
189
+ Global,
190
+ GraphDown,
191
+ GraphUp,
192
+ Hashtag,
193
+ Heart,
194
+ Help,
195
+ Home,
196
+ Import,
197
+ Inbox,
198
+ InboxIn,
199
+ Key,
200
+ Layers,
201
+ Letter,
202
+ Lightbulb,
203
+ Link,
204
+ LinkRound,
205
+ List,
206
+ ListCheck,
207
+ Lock,
208
+ MagicStick,
209
+ Magnifer,
210
+ Map,
211
+ MapPoint,
212
+ MedalRibbon,
213
+ MoneyBag,
214
+ Notebook,
215
+ NotebookMinimalistic,
216
+ Palette,
217
+ Pause,
218
+ Pen,
219
+ Plain,
220
+ Play,
221
+ PlugCircle,
222
+ Pulse,
223
+ Radar,
224
+ Refresh,
225
+ RefreshCircle,
226
+ Restart,
227
+ RewindBackCircle,
228
+ Routing,
229
+ Ruler,
230
+ Scale,
231
+ Server,
232
+ Settings,
233
+ Shield,
234
+ ShieldCheck,
235
+ ShieldCross,
236
+ ShieldUser,
237
+ Shop,
238
+ Shuffle,
239
+ Star,
240
+ Stars,
241
+ Tag,
242
+ TagPrice,
243
+ Ticket,
244
+ TrashBinMinimalistic,
245
+ TrashBinTrash,
246
+ UndoLeftRound,
247
+ Upload,
248
+ User,
249
+ UserBlock,
250
+ UserCheck,
251
+ UserId,
252
+ UsersGroupRounded,
253
+ Wallet,
254
+ WalletMoney,
255
+ Weigher,
256
+ Widget,
257
+ Widget5
258
+ };
259
+ export const SOLAR_ICON_ALIASES = {
260
+ "activity": "Pulse",
261
+ "building": "Buildings",
262
+ "check": "CheckCircle",
263
+ "clock": "ClockCircle",
264
+ "edit": "Pen",
265
+ "file-search": "FileText",
266
+ "folder-tree": "FolderPathConnect",
267
+ "git-merge": "BranchingPathsUp",
268
+ "plug": "PlugCircle",
269
+ "plus": "AddCircle",
270
+ "puzzle": "Widget",
271
+ "receipt": "Bill",
272
+ "send": "Plain",
273
+ "shield-x": "ShieldCross",
274
+ "shopping-cart": "Cart",
275
+ "slash": "Forbidden",
276
+ "sparkles": "Stars",
277
+ "trending-down": "GraphDown",
278
+ "users": "UsersGroupRounded"
279
+ };
280
+ export const SOLAR_FALLBACK_ICON = Widget;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A Solar icon by the name an app manifest uses for it (`money-bag`).
3
+ *
4
+ * The one lookup behind every surface that draws a glyph by NAME — the Apps and
5
+ * Commerce sidebars, `AppIcon`, and the Commerce renderer's tiles, buttons,
6
+ * empty states and option icons. It was copy-pasted into each of them before
7
+ * PE-560 and PE-985.
8
+ *
9
+ * The names resolve against a CLOSED map (`solarIconMap.ts`, generated by
10
+ * `scripts/icons.mjs` from the app manifests and this repo's code), not the
11
+ * whole icon set: a namespace import put all 1,413 Solar icons into the boot
12
+ * bundle, 11.66 MB of JS, for the ~130 anything asks for (PE-985).
13
+ *
14
+ * Two lookups, because callers want different things from a miss:
15
+ *
16
+ * - {@link solarIcon} returns `undefined`, for callers that have their own
17
+ * next candidate (`AppIcon` walks `manifest.icon` → nav icon → fallback);
18
+ * - {@link solarIconOrFallback} returns the generic glyph, for a spot that
19
+ * would otherwise be blank.
20
+ */
21
+ import type { Component } from 'vue';
22
+ import { SOLAR_FALLBACK_ICON } from './solarIconMap.js';
23
+ export { SOLAR_FALLBACK_ICON };
24
+ /**
25
+ * The map's export name for `name`, or null when the map has none.
26
+ *
27
+ * Accepts every spelling the consumers accepted before: kebab (`money-bag`),
28
+ * snake (`card_2`), digits (`chart-2`) and the export name itself (`Layers`).
29
+ */
30
+ export declare function solarIconKey(name: string | null | undefined): string | null;
31
+ /** The icon for `name`, or undefined — the caller picks its own fallback. */
32
+ export declare function solarIcon(name: string | null | undefined): Component | undefined;
33
+ /**
34
+ * The icon for `name`; the generic glyph for a name the map does not know;
35
+ * null only when there is no name at all (nothing was asked for).
36
+ */
37
+ export declare function solarIconOrFallback(name: string | null | undefined): Component | null;
@@ -0,0 +1,25 @@
1
+ import { SOLAR_FALLBACK_ICON, SOLAR_ICON_ALIASES, SOLAR_ICON_MAP } from "./solarIconMap.js";
2
+ import { solarExportName } from "./appIcon.js";
3
+ export { SOLAR_FALLBACK_ICON };
4
+ const warned = /* @__PURE__ */ new Set();
5
+ function reportMiss(name) {
6
+ if (!import.meta.dev || warned.has(name)) return;
7
+ warned.add(name);
8
+ console.warn(`[solarIcons] no icon "${name}" in the closed map; drawing the fallback. Run \`pnpm icons\` (scripts/icons.mjs) to add it.`);
9
+ }
10
+ export function solarIconKey(name) {
11
+ const raw = name?.trim();
12
+ if (!raw) return null;
13
+ const key = SOLAR_ICON_ALIASES[raw] ?? solarExportName(raw);
14
+ return key in SOLAR_ICON_MAP ? key : null;
15
+ }
16
+ export function solarIcon(name) {
17
+ const key = solarIconKey(name);
18
+ if (key) return SOLAR_ICON_MAP[key];
19
+ if (name?.trim()) reportMiss(name.trim());
20
+ return void 0;
21
+ }
22
+ export function solarIconOrFallback(name) {
23
+ if (!name?.trim()) return null;
24
+ return solarIcon(name) ?? SOLAR_FALLBACK_ICON;
25
+ }
@@ -0,0 +1,124 @@
1
+ import type { Component, InjectionKey, MaybeRef } from 'vue';
2
+ export type WidgetCategory = 'commerce' | 'operations' | 'ai' | 'workspace' | 'apps';
3
+ /**
4
+ * The schematic the library draws for a widget. Not a screenshot and not the
5
+ * live widget: a shape, so the picture cannot go stale and costs no query.
6
+ */
7
+ export type WidgetPreviewShape = 'kpi-row' | 'bar-chart' | 'ranked-list' | 'funnel' | 'stat-split' | 'feed' | 'status-grid' | 'text' | 'links' | 'greeting' | 'sparkline-grid' | 'count';
8
+ export interface WidgetConfigField {
9
+ key: string;
10
+ /** Catalogue key for the field label. */
11
+ labelKey?: string;
12
+ /** Ready-made label — a field a manifest named, which arrives translated. */
13
+ label?: string;
14
+ type: 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'links' | 'filters' | 'sort';
15
+ /** Catalogue keys for the help line and the placeholder. */
16
+ helpKey?: string;
17
+ placeholderKey?: string;
18
+ help?: string;
19
+ options?: {
20
+ value: string;
21
+ labelKey?: string;
22
+ label?: string;
23
+ }[];
24
+ default?: unknown;
25
+ }
26
+ export interface WidgetDefinition {
27
+ /** Stable id persisted in `dashboards.widgets[].type`. Never rename in place. */
28
+ type: string;
29
+ /**
30
+ * Catalogue key for the title. A surface whose widgets are declared in code
31
+ * uses this; one whose widgets come from a manifest already has the operator's
32
+ * language and passes `title` instead.
33
+ */
34
+ titleKey?: string;
35
+ title?: string;
36
+ descriptionKey?: string;
37
+ description?: string;
38
+ /** Solar icon name — must also exist in WidgetIcon's map. */
39
+ icon: string;
40
+ category: WidgetCategory;
41
+ /** The schematic the library draws. */
42
+ preview: WidgetPreviewShape;
43
+ defaultSize: {
44
+ w: number;
45
+ h: number;
46
+ };
47
+ minSize?: {
48
+ w: number;
49
+ h: number;
50
+ };
51
+ /**
52
+ * The component, always as a loader, always memoised per type. An adapter
53
+ * that renders many types through ONE component hands in a loader that
54
+ * resolves immediately (`() => Promise.resolve(Adapter)`) rather than the
55
+ * component itself — a Vue component can be a function too, and telling the
56
+ * two apart by inspection is how a functional component ends up being awaited.
57
+ */
58
+ component: () => Promise<Component | {
59
+ default: Component;
60
+ }>;
61
+ /** Rendered by the generic config form; omit for a widget with no options. */
62
+ configFields?: WidgetConfigField[];
63
+ /** Installed apps this widget reads from. Empty = works for every tenant. */
64
+ requiresApps?: string[];
65
+ /**
66
+ * Announced but not built. It appears in the library so people can see what
67
+ * is coming, and cannot be placed — a card that adds an empty promise to a
68
+ * dashboard is worse than one that says "not yet".
69
+ */
70
+ comingSoon?: boolean;
71
+ /** Widget draws its own header/card; the frame then renders body-only. */
72
+ bare?: boolean;
73
+ /**
74
+ * Config the widget always carries, merged under the operator's own. The
75
+ * adapter for manifest widgets uses it to say WHICH manifest widget a type
76
+ * stands for, without that ending up in the config form.
77
+ */
78
+ fixedConfig?: Record<string, unknown>;
79
+ }
80
+ export interface WidgetCategoryGroup {
81
+ category: WidgetCategory;
82
+ labelKey: string;
83
+ widgets: WidgetDefinition[];
84
+ }
85
+ /** Catalogue keys for the library's group headings. */
86
+ export declare const WIDGET_CATEGORY_KEYS: Record<WidgetCategory, string>;
87
+ export interface WidgetRegistry {
88
+ all: () => WidgetDefinition[];
89
+ get: (type: string) => WidgetDefinition | undefined;
90
+ byCategory: () => WidgetCategoryGroup[];
91
+ /** The component for a type, memoised. Null when the type is unknown. */
92
+ componentFor: (type: string) => Component | null;
93
+ /** Defaults from `configFields`, plus whatever the definition fixes. */
94
+ defaultConfigFor: (type: string) => Record<string, unknown>;
95
+ }
96
+ /**
97
+ * Build a registry over a fixed list or a reactive one.
98
+ *
99
+ * Reactive is the interesting case: Commerce derives its definitions from the
100
+ * installed apps' manifests, which resolve after mount. A registry built over
101
+ * the computed sees them arrive without the surface re-providing anything.
102
+ */
103
+ export declare function createWidgetRegistry(source: MaybeRef<WidgetDefinition[]>): WidgetRegistry;
104
+ export declare const WIDGET_REGISTRY: InjectionKey<WidgetRegistry>;
105
+ /** Called once by the surface that owns the dashboard. */
106
+ export declare function provideWidgetRegistry(registry: WidgetRegistry): void;
107
+ /**
108
+ * The registry of the surface this component is rendering on.
109
+ *
110
+ * An empty registry rather than a throw when nothing is provided: a dashboard
111
+ * component mounted outside a surface should render the same "unknown widget"
112
+ * placeholder it renders for a retired type, not take the page down.
113
+ */
114
+ export declare function useWidgetRegistry(): WidgetRegistry;
115
+ /** Apps a widget needs that are not in the given installed set. */
116
+ export declare function missingAppsFor(definition: WidgetDefinition, installed: Set<string>): string[];
117
+ /**
118
+ * A definition's heading, with the translator the host registered. Written
119
+ * once because four components need it and each got it subtly wrong on its own:
120
+ * an operator's own title wins, then the definition's text, then its key.
121
+ */
122
+ export declare function widgetTitle(definition: WidgetDefinition | undefined, t: (key: string) => string, operatorTitle?: string): string;
123
+ /** Same rule for the library's second line. */
124
+ export declare function widgetDescription(definition: WidgetDefinition, t: (key: string) => string): string;
@@ -0,0 +1,66 @@
1
+ import { computed, defineAsyncComponent, inject, isRef, provide } from "vue";
2
+ export const WIDGET_CATEGORY_KEYS = {
3
+ commerce: "dashboard.category.commerce",
4
+ operations: "dashboard.category.operations",
5
+ ai: "dashboard.category.ai",
6
+ workspace: "dashboard.category.workspace",
7
+ apps: "dashboard.category.apps"
8
+ };
9
+ const CATEGORY_ORDER = ["commerce", "apps", "operations", "ai", "workspace"];
10
+ export function createWidgetRegistry(source) {
11
+ const definitions = computed(() => isRef(source) ? source.value : source);
12
+ const byType = computed(() => new Map(definitions.value.map((d) => [d.type, d])));
13
+ const components = /* @__PURE__ */ new Map();
14
+ function get(type) {
15
+ return byType.value.get(type);
16
+ }
17
+ return {
18
+ all: () => definitions.value,
19
+ get,
20
+ byCategory() {
21
+ return CATEGORY_ORDER.map((category) => ({
22
+ category,
23
+ labelKey: WIDGET_CATEGORY_KEYS[category],
24
+ widgets: definitions.value.filter((d) => d.category === category)
25
+ })).filter((group) => group.widgets.length > 0);
26
+ },
27
+ componentFor(type) {
28
+ const cached = components.get(type);
29
+ if (cached) return cached;
30
+ const definition = get(type);
31
+ if (!definition) return null;
32
+ const component = defineAsyncComponent(definition.component);
33
+ components.set(type, component);
34
+ return component;
35
+ },
36
+ defaultConfigFor(type) {
37
+ const definition = get(type);
38
+ if (!definition) return {};
39
+ const out = {};
40
+ for (const field of definition.configFields ?? []) {
41
+ if (field.default !== void 0) out[field.key] = field.default;
42
+ }
43
+ return { ...out, ...definition.fixedConfig ?? {} };
44
+ }
45
+ };
46
+ }
47
+ export const WIDGET_REGISTRY = Symbol("studio-widget-registry");
48
+ export function provideWidgetRegistry(registry) {
49
+ provide(WIDGET_REGISTRY, registry);
50
+ }
51
+ export function useWidgetRegistry() {
52
+ return inject(WIDGET_REGISTRY, null) ?? createWidgetRegistry([]);
53
+ }
54
+ export function missingAppsFor(definition, installed) {
55
+ return (definition.requiresApps ?? []).filter((app) => !installed.has(app));
56
+ }
57
+ export function widgetTitle(definition, t, operatorTitle) {
58
+ if (operatorTitle) return operatorTitle;
59
+ if (!definition) return "";
60
+ if (definition.title) return definition.title;
61
+ return definition.titleKey ? t(definition.titleKey) : "";
62
+ }
63
+ export function widgetDescription(definition, t) {
64
+ if (definition.description) return definition.description;
65
+ return definition.descriptionKey ? t(definition.descriptionKey) : "";
66
+ }