@contractspec/example.analytics-dashboard 1.57.0 → 1.58.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 (173) hide show
  1. package/dist/browser/dashboard/dashboard.enum.js +34 -0
  2. package/dist/browser/dashboard/dashboard.operation.js +289 -0
  3. package/dist/browser/dashboard/dashboard.presentation.js +197 -0
  4. package/dist/browser/dashboard/dashboard.schema.js +126 -0
  5. package/dist/browser/dashboard/dashboard.test-spec.js +213 -0
  6. package/dist/browser/dashboard/index.js +299 -0
  7. package/dist/browser/dashboard.feature.js +84 -0
  8. package/dist/browser/datasource/posthog-datasource.js +289 -0
  9. package/dist/browser/docs/analytics-dashboard.docblock.js +103 -0
  10. package/dist/browser/docs/index.js +103 -0
  11. package/dist/browser/events.js +81 -0
  12. package/dist/browser/example.js +42 -0
  13. package/dist/browser/handlers/analytics.handlers.js +278 -0
  14. package/dist/browser/handlers/index.js +571 -0
  15. package/dist/browser/handlers/query.handlers.js +294 -0
  16. package/dist/browser/index.js +1677 -0
  17. package/dist/browser/query/index.js +159 -0
  18. package/dist/browser/query/query.enum.js +11 -0
  19. package/dist/browser/query/query.operation.js +154 -0
  20. package/dist/browser/query/query.presentation.js +119 -0
  21. package/dist/browser/query/query.schema.js +70 -0
  22. package/dist/browser/query/query.test-spec.js +113 -0
  23. package/dist/browser/query-engine/index.js +491 -0
  24. package/dist/browser/seeders/index.js +20 -0
  25. package/dist/browser/ui/AnalyticsDashboard.js +394 -0
  26. package/dist/browser/ui/hooks/index.js +69 -0
  27. package/dist/browser/ui/hooks/useAnalyticsData.js +66 -0
  28. package/dist/browser/ui/index.js +671 -0
  29. package/dist/browser/ui/renderers/analytics.markdown.js +275 -0
  30. package/dist/browser/ui/renderers/index.js +275 -0
  31. package/dist/dashboard/dashboard.enum.d.ts +3 -8
  32. package/dist/dashboard/dashboard.enum.d.ts.map +1 -1
  33. package/dist/dashboard/dashboard.enum.js +31 -39
  34. package/dist/dashboard/dashboard.operation.d.ts +444 -450
  35. package/dist/dashboard/dashboard.operation.d.ts.map +1 -1
  36. package/dist/dashboard/dashboard.operation.js +284 -207
  37. package/dist/dashboard/dashboard.presentation.d.ts +3 -8
  38. package/dist/dashboard/dashboard.presentation.d.ts.map +1 -1
  39. package/dist/dashboard/dashboard.presentation.js +193 -85
  40. package/dist/dashboard/dashboard.schema.d.ts +289 -294
  41. package/dist/dashboard/dashboard.schema.d.ts.map +1 -1
  42. package/dist/dashboard/dashboard.schema.js +119 -228
  43. package/dist/dashboard/dashboard.test-spec.d.ts +4 -9
  44. package/dist/dashboard/dashboard.test-spec.d.ts.map +1 -1
  45. package/dist/dashboard/dashboard.test-spec.js +209 -228
  46. package/dist/dashboard/index.d.ts +7 -4
  47. package/dist/dashboard/index.d.ts.map +1 -0
  48. package/dist/dashboard/index.js +299 -4
  49. package/dist/dashboard.feature.d.ts +1 -6
  50. package/dist/dashboard.feature.d.ts.map +1 -1
  51. package/dist/dashboard.feature.js +83 -175
  52. package/dist/datasource/posthog-datasource.d.ts +15 -19
  53. package/dist/datasource/posthog-datasource.d.ts.map +1 -1
  54. package/dist/datasource/posthog-datasource.js +274 -238
  55. package/dist/docs/analytics-dashboard.docblock.d.ts +2 -1
  56. package/dist/docs/analytics-dashboard.docblock.d.ts.map +1 -0
  57. package/dist/docs/analytics-dashboard.docblock.js +45 -56
  58. package/dist/docs/index.d.ts +2 -1
  59. package/dist/docs/index.d.ts.map +1 -0
  60. package/dist/docs/index.js +104 -1
  61. package/dist/events.d.ts +109 -115
  62. package/dist/events.d.ts.map +1 -1
  63. package/dist/events.js +74 -120
  64. package/dist/example.d.ts +2 -6
  65. package/dist/example.d.ts.map +1 -1
  66. package/dist/example.js +41 -55
  67. package/dist/handlers/analytics.handlers.d.ts +110 -109
  68. package/dist/handlers/analytics.handlers.d.ts.map +1 -1
  69. package/dist/handlers/analytics.handlers.js +267 -298
  70. package/dist/handlers/index.d.ts +3 -3
  71. package/dist/handlers/index.d.ts.map +1 -0
  72. package/dist/handlers/index.js +571 -3
  73. package/dist/handlers/query.handlers.d.ts +7 -11
  74. package/dist/handlers/query.handlers.d.ts.map +1 -1
  75. package/dist/handlers/query.handlers.js +292 -7
  76. package/dist/index.d.ts +12 -13
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +1678 -14
  79. package/dist/node/dashboard/dashboard.enum.js +34 -0
  80. package/dist/node/dashboard/dashboard.operation.js +289 -0
  81. package/dist/node/dashboard/dashboard.presentation.js +197 -0
  82. package/dist/node/dashboard/dashboard.schema.js +126 -0
  83. package/dist/node/dashboard/dashboard.test-spec.js +213 -0
  84. package/dist/node/dashboard/index.js +299 -0
  85. package/dist/node/dashboard.feature.js +84 -0
  86. package/dist/node/datasource/posthog-datasource.js +289 -0
  87. package/dist/node/docs/analytics-dashboard.docblock.js +103 -0
  88. package/dist/node/docs/index.js +103 -0
  89. package/dist/node/events.js +81 -0
  90. package/dist/node/example.js +42 -0
  91. package/dist/node/handlers/analytics.handlers.js +278 -0
  92. package/dist/node/handlers/index.js +571 -0
  93. package/dist/node/handlers/query.handlers.js +294 -0
  94. package/dist/node/index.js +1677 -0
  95. package/dist/node/query/index.js +159 -0
  96. package/dist/node/query/query.enum.js +11 -0
  97. package/dist/node/query/query.operation.js +154 -0
  98. package/dist/node/query/query.presentation.js +119 -0
  99. package/dist/node/query/query.schema.js +70 -0
  100. package/dist/node/query/query.test-spec.js +113 -0
  101. package/dist/node/query-engine/index.js +491 -0
  102. package/dist/node/seeders/index.js +20 -0
  103. package/dist/node/ui/AnalyticsDashboard.js +394 -0
  104. package/dist/node/ui/hooks/index.js +69 -0
  105. package/dist/node/ui/hooks/useAnalyticsData.js +66 -0
  106. package/dist/node/ui/index.js +671 -0
  107. package/dist/node/ui/renderers/analytics.markdown.js +275 -0
  108. package/dist/node/ui/renderers/index.js +275 -0
  109. package/dist/query/index.d.ts +7 -4
  110. package/dist/query/index.d.ts.map +1 -0
  111. package/dist/query/index.js +159 -4
  112. package/dist/query/query.enum.d.ts +1 -6
  113. package/dist/query/query.enum.d.ts.map +1 -1
  114. package/dist/query/query.enum.js +10 -14
  115. package/dist/query/query.operation.d.ts +148 -154
  116. package/dist/query/query.operation.d.ts.map +1 -1
  117. package/dist/query/query.operation.js +151 -109
  118. package/dist/query/query.presentation.d.ts +2 -7
  119. package/dist/query/query.presentation.d.ts.map +1 -1
  120. package/dist/query/query.presentation.js +116 -56
  121. package/dist/query/query.schema.d.ts +121 -126
  122. package/dist/query/query.schema.d.ts.map +1 -1
  123. package/dist/query/query.schema.js +66 -152
  124. package/dist/query/query.test-spec.d.ts +2 -7
  125. package/dist/query/query.test-spec.d.ts.map +1 -1
  126. package/dist/query/query.test-spec.js +111 -121
  127. package/dist/query-engine/index.d.ts +84 -88
  128. package/dist/query-engine/index.d.ts.map +1 -1
  129. package/dist/query-engine/index.js +489 -188
  130. package/dist/seeders/index.d.ts +4 -8
  131. package/dist/seeders/index.d.ts.map +1 -1
  132. package/dist/seeders/index.js +18 -16
  133. package/dist/ui/AnalyticsDashboard.d.ts +1 -6
  134. package/dist/ui/AnalyticsDashboard.d.ts.map +1 -1
  135. package/dist/ui/AnalyticsDashboard.js +389 -259
  136. package/dist/ui/hooks/index.d.ts +2 -2
  137. package/dist/ui/hooks/index.d.ts.map +1 -0
  138. package/dist/ui/hooks/index.js +69 -4
  139. package/dist/ui/hooks/useAnalyticsData.d.ts +16 -20
  140. package/dist/ui/hooks/useAnalyticsData.d.ts.map +1 -1
  141. package/dist/ui/hooks/useAnalyticsData.js +63 -69
  142. package/dist/ui/index.d.ts +7 -6
  143. package/dist/ui/index.d.ts.map +1 -0
  144. package/dist/ui/index.js +671 -5
  145. package/dist/ui/renderers/analytics.markdown.d.ts +13 -14
  146. package/dist/ui/renderers/analytics.markdown.d.ts.map +1 -1
  147. package/dist/ui/renderers/analytics.markdown.js +266 -254
  148. package/dist/ui/renderers/index.d.ts +2 -2
  149. package/dist/ui/renderers/index.d.ts.map +1 -0
  150. package/dist/ui/renderers/index.js +275 -2
  151. package/package.json +328 -67
  152. package/dist/dashboard/dashboard.enum.js.map +0 -1
  153. package/dist/dashboard/dashboard.operation.js.map +0 -1
  154. package/dist/dashboard/dashboard.presentation.js.map +0 -1
  155. package/dist/dashboard/dashboard.schema.js.map +0 -1
  156. package/dist/dashboard/dashboard.test-spec.js.map +0 -1
  157. package/dist/dashboard.feature.js.map +0 -1
  158. package/dist/datasource/posthog-datasource.js.map +0 -1
  159. package/dist/docs/analytics-dashboard.docblock.js.map +0 -1
  160. package/dist/events.js.map +0 -1
  161. package/dist/example.js.map +0 -1
  162. package/dist/handlers/analytics.handlers.js.map +0 -1
  163. package/dist/handlers/query.handlers.js.map +0 -1
  164. package/dist/query/query.enum.js.map +0 -1
  165. package/dist/query/query.operation.js.map +0 -1
  166. package/dist/query/query.presentation.js.map +0 -1
  167. package/dist/query/query.schema.js.map +0 -1
  168. package/dist/query/query.test-spec.js.map +0 -1
  169. package/dist/query-engine/index.js.map +0 -1
  170. package/dist/seeders/index.js.map +0 -1
  171. package/dist/ui/AnalyticsDashboard.js.map +0 -1
  172. package/dist/ui/hooks/useAnalyticsData.js.map +0 -1
  173. package/dist/ui/renderers/analytics.markdown.js.map +0 -1
@@ -1,27 +1,26 @@
1
- import { PresentationRenderer } from "@contractspec/lib.contracts";
2
-
3
- //#region src/ui/renderers/analytics.markdown.d.ts
1
+ /**
2
+ * Markdown renderers for Analytics Dashboard presentations
3
+ */
4
+ import type { PresentationRenderer } from '@contractspec/lib.contracts';
4
5
  /**
5
6
  * Markdown renderer for Analytics Dashboard Overview
6
7
  */
7
- declare const analyticsDashboardMarkdownRenderer: PresentationRenderer<{
8
- mimeType: string;
9
- body: string;
8
+ export declare const analyticsDashboardMarkdownRenderer: PresentationRenderer<{
9
+ mimeType: string;
10
+ body: string;
10
11
  }>;
11
12
  /**
12
13
  * Markdown renderer for Dashboard List
13
14
  */
14
- declare const dashboardListMarkdownRenderer: PresentationRenderer<{
15
- mimeType: string;
16
- body: string;
15
+ export declare const dashboardListMarkdownRenderer: PresentationRenderer<{
16
+ mimeType: string;
17
+ body: string;
17
18
  }>;
18
19
  /**
19
20
  * Markdown renderer for Query Builder
20
21
  */
21
- declare const queryBuilderMarkdownRenderer: PresentationRenderer<{
22
- mimeType: string;
23
- body: string;
22
+ export declare const queryBuilderMarkdownRenderer: PresentationRenderer<{
23
+ mimeType: string;
24
+ body: string;
24
25
  }>;
25
- //#endregion
26
- export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer };
27
26
  //# sourceMappingURL=analytics.markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.markdown.d.ts","names":[],"sources":["../../../src/ui/renderers/analytics.markdown.ts"],"mappings":";;;;;;cA+Ia,kCAAA,EAAoC,oBAAA;EAC/C,QAAA;EACA,IAAA;AAAA;;AAsFF;;cAAa,6BAAA,EAA+B,oBAAA;EAC1C,QAAA;EACA,IAAA;AAAA;;;;cAiDW,4BAAA,EAA8B,oBAAA;EACzC,QAAA;EACA,IAAA;AAAA"}
1
+ {"version":3,"file":"analytics.markdown.d.ts","sourceRoot":"","sources":["../../../src/ui/renderers/analytics.markdown.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAyIxE;;GAEG;AACH,eAAO,MAAM,kCAAkC,EAAE,oBAAoB,CAAC;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAgFA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC;IAC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CA2CA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,oBAAoB,CAAC;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAyDA,CAAC"}
@@ -1,264 +1,276 @@
1
- //#region src/ui/renderers/analytics.markdown.ts
2
- const mockDashboards = [
3
- {
4
- id: "dash-1",
5
- name: "Sales Overview",
6
- slug: "sales-overview",
7
- status: "PUBLISHED",
8
- widgetCount: 8,
9
- viewCount: 1250,
10
- lastViewedAt: "2024-01-16T12:00:00Z"
11
- },
12
- {
13
- id: "dash-2",
14
- name: "User Engagement",
15
- slug: "user-engagement",
16
- status: "PUBLISHED",
17
- widgetCount: 6,
18
- viewCount: 890,
19
- lastViewedAt: "2024-01-16T10:00:00Z"
20
- },
21
- {
22
- id: "dash-3",
23
- name: "Product Analytics",
24
- slug: "product-analytics",
25
- status: "PUBLISHED",
26
- widgetCount: 10,
27
- viewCount: 560,
28
- lastViewedAt: "2024-01-15T14:00:00Z"
29
- },
30
- {
31
- id: "dash-4",
32
- name: "Finance Report",
33
- slug: "finance-report",
34
- status: "DRAFT",
35
- widgetCount: 4,
36
- viewCount: 0,
37
- lastViewedAt: null
38
- }
1
+ // @bun
2
+ // src/ui/renderers/analytics.markdown.ts
3
+ var mockDashboards = [
4
+ {
5
+ id: "dash-1",
6
+ name: "Sales Overview",
7
+ slug: "sales-overview",
8
+ status: "PUBLISHED",
9
+ widgetCount: 8,
10
+ viewCount: 1250,
11
+ lastViewedAt: "2024-01-16T12:00:00Z"
12
+ },
13
+ {
14
+ id: "dash-2",
15
+ name: "User Engagement",
16
+ slug: "user-engagement",
17
+ status: "PUBLISHED",
18
+ widgetCount: 6,
19
+ viewCount: 890,
20
+ lastViewedAt: "2024-01-16T10:00:00Z"
21
+ },
22
+ {
23
+ id: "dash-3",
24
+ name: "Product Analytics",
25
+ slug: "product-analytics",
26
+ status: "PUBLISHED",
27
+ widgetCount: 10,
28
+ viewCount: 560,
29
+ lastViewedAt: "2024-01-15T14:00:00Z"
30
+ },
31
+ {
32
+ id: "dash-4",
33
+ name: "Finance Report",
34
+ slug: "finance-report",
35
+ status: "DRAFT",
36
+ widgetCount: 4,
37
+ viewCount: 0,
38
+ lastViewedAt: null
39
+ }
39
40
  ];
40
- const mockWidgets = [
41
- {
42
- id: "w-1",
43
- dashboardId: "dash-1",
44
- name: "Total Revenue",
45
- type: "METRIC",
46
- value: 125e3,
47
- change: 12.5
48
- },
49
- {
50
- id: "w-2",
51
- dashboardId: "dash-1",
52
- name: "Active Users",
53
- type: "METRIC",
54
- value: 4500,
55
- change: 8.2
56
- },
57
- {
58
- id: "w-3",
59
- dashboardId: "dash-1",
60
- name: "Revenue Trend",
61
- type: "LINE_CHART",
62
- dataPoints: 30
63
- },
64
- {
65
- id: "w-4",
66
- dashboardId: "dash-1",
67
- name: "Top Products",
68
- type: "BAR_CHART",
69
- dataPoints: 10
70
- },
71
- {
72
- id: "w-5",
73
- dashboardId: "dash-2",
74
- name: "Daily Active Users",
75
- type: "LINE_CHART",
76
- dataPoints: 30
77
- },
78
- {
79
- id: "w-6",
80
- dashboardId: "dash-2",
81
- name: "Session Duration",
82
- type: "METRIC",
83
- value: 245,
84
- change: -3.1
85
- }
41
+ var mockWidgets = [
42
+ {
43
+ id: "w-1",
44
+ dashboardId: "dash-1",
45
+ name: "Total Revenue",
46
+ type: "METRIC",
47
+ value: 125000,
48
+ change: 12.5
49
+ },
50
+ {
51
+ id: "w-2",
52
+ dashboardId: "dash-1",
53
+ name: "Active Users",
54
+ type: "METRIC",
55
+ value: 4500,
56
+ change: 8.2
57
+ },
58
+ {
59
+ id: "w-3",
60
+ dashboardId: "dash-1",
61
+ name: "Revenue Trend",
62
+ type: "LINE_CHART",
63
+ dataPoints: 30
64
+ },
65
+ {
66
+ id: "w-4",
67
+ dashboardId: "dash-1",
68
+ name: "Top Products",
69
+ type: "BAR_CHART",
70
+ dataPoints: 10
71
+ },
72
+ {
73
+ id: "w-5",
74
+ dashboardId: "dash-2",
75
+ name: "Daily Active Users",
76
+ type: "LINE_CHART",
77
+ dataPoints: 30
78
+ },
79
+ {
80
+ id: "w-6",
81
+ dashboardId: "dash-2",
82
+ name: "Session Duration",
83
+ type: "METRIC",
84
+ value: 245,
85
+ change: -3.1
86
+ }
86
87
  ];
87
- const mockQueries = [
88
- {
89
- id: "q-1",
90
- name: "Monthly Revenue",
91
- type: "AGGREGATION",
92
- isShared: true,
93
- executionCount: 1500
94
- },
95
- {
96
- id: "q-2",
97
- name: "User Growth",
98
- type: "METRIC",
99
- isShared: true,
100
- executionCount: 890
101
- },
102
- {
103
- id: "q-3",
104
- name: "Product Sales",
105
- type: "SQL",
106
- isShared: false,
107
- executionCount: 340
108
- },
109
- {
110
- id: "q-4",
111
- name: "Conversion Funnel",
112
- type: "AGGREGATION",
113
- isShared: true,
114
- executionCount: 450
115
- }
88
+ var mockQueries = [
89
+ {
90
+ id: "q-1",
91
+ name: "Monthly Revenue",
92
+ type: "AGGREGATION",
93
+ isShared: true,
94
+ executionCount: 1500
95
+ },
96
+ {
97
+ id: "q-2",
98
+ name: "User Growth",
99
+ type: "METRIC",
100
+ isShared: true,
101
+ executionCount: 890
102
+ },
103
+ {
104
+ id: "q-3",
105
+ name: "Product Sales",
106
+ type: "SQL",
107
+ isShared: false,
108
+ executionCount: 340
109
+ },
110
+ {
111
+ id: "q-4",
112
+ name: "Conversion Funnel",
113
+ type: "AGGREGATION",
114
+ isShared: true,
115
+ executionCount: 450
116
+ }
116
117
  ];
117
118
  function formatNumber(value) {
118
- if (value >= 1e6) return `${(value / 1e6).toFixed(1)}M`;
119
- if (value >= 1e3) return `${(value / 1e3).toFixed(1)}K`;
120
- return value.toString();
119
+ if (value >= 1e6) {
120
+ return `${(value / 1e6).toFixed(1)}M`;
121
+ }
122
+ if (value >= 1000) {
123
+ return `${(value / 1000).toFixed(1)}K`;
124
+ }
125
+ return value.toString();
121
126
  }
122
127
  function formatChange(change) {
123
- return `${change >= 0 ? "📈" : "📉"} ${change >= 0 ? "+" : ""}${change.toFixed(1)}%`;
128
+ const icon = change >= 0 ? "\uD83D\uDCC8" : "\uD83D\uDCC9";
129
+ const sign = change >= 0 ? "+" : "";
130
+ return `${icon} ${sign}${change.toFixed(1)}%`;
124
131
  }
125
- /**
126
- * Markdown renderer for Analytics Dashboard Overview
127
- */
128
- const analyticsDashboardMarkdownRenderer = {
129
- target: "markdown",
130
- render: async (desc) => {
131
- if (desc.source.type !== "component" || desc.source.componentKey !== "AnalyticsDashboard") throw new Error("analyticsDashboardMarkdownRenderer: not AnalyticsDashboard");
132
- const dashboards = mockDashboards;
133
- const widgets = mockWidgets;
134
- const queries = mockQueries;
135
- const dashboard = dashboards[0];
136
- if (!dashboard) return {
137
- mimeType: "text/markdown",
138
- body: "# No Dashboards\n\nNo dashboards available."
139
- };
140
- const dashboardWidgets = widgets.filter((w) => w.dashboardId === dashboard.id);
141
- const publishedDashboards = dashboards.filter((d) => d.status === "PUBLISHED");
142
- const totalViews = dashboards.reduce((sum, d) => sum + d.viewCount, 0);
143
- const sharedQueries = queries.filter((q) => q.isShared);
144
- const lines = [
145
- `# ${dashboard.name}`,
146
- "",
147
- "> Analytics dashboard overview",
148
- "",
149
- "## Key Metrics",
150
- ""
151
- ];
152
- const metricWidgets = dashboardWidgets.filter((w) => w.type === "METRIC");
153
- for (const widget of metricWidgets) {
154
- const w = widget;
155
- lines.push(`### ${w.name}`);
156
- lines.push(`**${formatNumber(w.value)}** ${formatChange(w.change)}`);
157
- lines.push("");
158
- }
159
- lines.push("## Visualizations");
160
- lines.push("");
161
- const chartWidgets = dashboardWidgets.filter((w) => w.type !== "METRIC");
162
- for (const widget of chartWidgets) {
163
- const w = widget;
164
- lines.push(`- **${w.name}** (${w.type.replace("_", " ")}) - ${w.dataPoints} data points`);
165
- }
166
- lines.push("");
167
- lines.push("## Dashboard Stats");
168
- lines.push("");
169
- lines.push("| Metric | Value |");
170
- lines.push("|--------|-------|");
171
- lines.push(`| Total Dashboards | ${dashboards.length} |`);
172
- lines.push(`| Published | ${publishedDashboards.length} |`);
173
- lines.push(`| Total Views | ${totalViews.toLocaleString()} |`);
174
- lines.push(`| Shared Queries | ${sharedQueries.length} |`);
175
- return {
176
- mimeType: "text/markdown",
177
- body: lines.join("\n")
178
- };
179
- }
132
+ var analyticsDashboardMarkdownRenderer = {
133
+ target: "markdown",
134
+ render: async (desc) => {
135
+ if (desc.source.type !== "component" || desc.source.componentKey !== "AnalyticsDashboard") {
136
+ throw new Error("analyticsDashboardMarkdownRenderer: not AnalyticsDashboard");
137
+ }
138
+ const dashboards = mockDashboards;
139
+ const widgets = mockWidgets;
140
+ const queries = mockQueries;
141
+ const dashboard = dashboards[0];
142
+ if (!dashboard) {
143
+ return {
144
+ mimeType: "text/markdown",
145
+ body: `# No Dashboards
146
+
147
+ No dashboards available.`
148
+ };
149
+ }
150
+ const dashboardWidgets = widgets.filter((w) => w.dashboardId === dashboard.id);
151
+ const publishedDashboards = dashboards.filter((d) => d.status === "PUBLISHED");
152
+ const totalViews = dashboards.reduce((sum, d) => sum + d.viewCount, 0);
153
+ const sharedQueries = queries.filter((q) => q.isShared);
154
+ const lines = [
155
+ `# ${dashboard.name}`,
156
+ "",
157
+ "> Analytics dashboard overview",
158
+ "",
159
+ "## Key Metrics",
160
+ ""
161
+ ];
162
+ const metricWidgets = dashboardWidgets.filter((w) => w.type === "METRIC");
163
+ for (const widget of metricWidgets) {
164
+ const w = widget;
165
+ lines.push(`### ${w.name}`);
166
+ lines.push(`**${formatNumber(w.value)}** ${formatChange(w.change)}`);
167
+ lines.push("");
168
+ }
169
+ lines.push("## Visualizations");
170
+ lines.push("");
171
+ const chartWidgets = dashboardWidgets.filter((w) => w.type !== "METRIC");
172
+ for (const widget of chartWidgets) {
173
+ const w = widget;
174
+ lines.push(`- **${w.name}** (${w.type.replace("_", " ")}) - ${w.dataPoints} data points`);
175
+ }
176
+ lines.push("");
177
+ lines.push("## Dashboard Stats");
178
+ lines.push("");
179
+ lines.push("| Metric | Value |");
180
+ lines.push("|--------|-------|");
181
+ lines.push(`| Total Dashboards | ${dashboards.length} |`);
182
+ lines.push(`| Published | ${publishedDashboards.length} |`);
183
+ lines.push(`| Total Views | ${totalViews.toLocaleString()} |`);
184
+ lines.push(`| Shared Queries | ${sharedQueries.length} |`);
185
+ return {
186
+ mimeType: "text/markdown",
187
+ body: lines.join(`
188
+ `)
189
+ };
190
+ }
180
191
  };
181
- /**
182
- * Markdown renderer for Dashboard List
183
- */
184
- const dashboardListMarkdownRenderer = {
185
- target: "markdown",
186
- render: async (desc) => {
187
- if (desc.source.type !== "component" || desc.source.componentKey !== "DashboardList") throw new Error("dashboardListMarkdownRenderer: not DashboardList");
188
- const dashboards = mockDashboards;
189
- const lines = [
190
- "# Dashboards",
191
- "",
192
- "> Browse and manage analytics dashboards",
193
- "",
194
- "| Dashboard | Widgets | Views | Status | Last Viewed |",
195
- "|-----------|---------|-------|--------|-------------|"
196
- ];
197
- for (const dashboard of dashboards) {
198
- const lastViewed = dashboard.lastViewedAt ? new Date(dashboard.lastViewedAt).toLocaleDateString() : "Never";
199
- const statusIcon = dashboard.status === "PUBLISHED" ? "🟢" : "⚫";
200
- lines.push(`| [${dashboard.name}](/dashboards/${dashboard.slug}) | ${dashboard.widgetCount} | ${dashboard.viewCount.toLocaleString()} | ${statusIcon} ${dashboard.status} | ${lastViewed} |`);
201
- }
202
- lines.push("");
203
- lines.push("## Quick Actions");
204
- lines.push("");
205
- lines.push("- **Create Dashboard** - Start with a blank canvas");
206
- lines.push("- **Import Template** - Use a pre-built template");
207
- lines.push("- **Clone Dashboard** - Duplicate an existing dashboard");
208
- return {
209
- mimeType: "text/markdown",
210
- body: lines.join("\n")
211
- };
212
- }
192
+ var dashboardListMarkdownRenderer = {
193
+ target: "markdown",
194
+ render: async (desc) => {
195
+ if (desc.source.type !== "component" || desc.source.componentKey !== "DashboardList") {
196
+ throw new Error("dashboardListMarkdownRenderer: not DashboardList");
197
+ }
198
+ const dashboards = mockDashboards;
199
+ const lines = [
200
+ "# Dashboards",
201
+ "",
202
+ "> Browse and manage analytics dashboards",
203
+ "",
204
+ "| Dashboard | Widgets | Views | Status | Last Viewed |",
205
+ "|-----------|---------|-------|--------|-------------|"
206
+ ];
207
+ for (const dashboard of dashboards) {
208
+ const lastViewed = dashboard.lastViewedAt ? new Date(dashboard.lastViewedAt).toLocaleDateString() : "Never";
209
+ const statusIcon = dashboard.status === "PUBLISHED" ? "\uD83D\uDFE2" : "\u26AB";
210
+ lines.push(`| [${dashboard.name}](/dashboards/${dashboard.slug}) | ${dashboard.widgetCount} | ${dashboard.viewCount.toLocaleString()} | ${statusIcon} ${dashboard.status} | ${lastViewed} |`);
211
+ }
212
+ lines.push("");
213
+ lines.push("## Quick Actions");
214
+ lines.push("");
215
+ lines.push("- **Create Dashboard** - Start with a blank canvas");
216
+ lines.push("- **Import Template** - Use a pre-built template");
217
+ lines.push("- **Clone Dashboard** - Duplicate an existing dashboard");
218
+ return {
219
+ mimeType: "text/markdown",
220
+ body: lines.join(`
221
+ `)
222
+ };
223
+ }
213
224
  };
214
- /**
215
- * Markdown renderer for Query Builder
216
- */
217
- const queryBuilderMarkdownRenderer = {
218
- target: "markdown",
219
- render: async (desc) => {
220
- if (desc.source.type !== "component" || desc.source.componentKey !== "QueryBuilder") throw new Error("queryBuilderMarkdownRenderer: not QueryBuilder");
221
- const queries = mockQueries;
222
- const lines = [
223
- "# Query Builder",
224
- "",
225
- "> Create and manage data queries",
226
- "",
227
- "## Saved Queries",
228
- "",
229
- "| Query | Type | Shared | Executions |",
230
- "|-------|------|--------|------------|"
231
- ];
232
- for (const query of queries) {
233
- const sharedIcon = query.isShared ? "🌐" : "🔒";
234
- lines.push(`| ${query.name} | ${query.type} | ${sharedIcon} | ${query.executionCount.toLocaleString()} |`);
235
- }
236
- lines.push("");
237
- lines.push("## Query Types");
238
- lines.push("");
239
- lines.push("### METRIC");
240
- lines.push("Query usage metrics from the metering system.");
241
- lines.push("");
242
- lines.push("### AGGREGATION");
243
- lines.push("Build aggregations with measures and dimensions without writing SQL.");
244
- lines.push("");
245
- lines.push("### SQL");
246
- lines.push("Write custom SQL queries for advanced analysis.");
247
- lines.push("");
248
- lines.push("## Features");
249
- lines.push("");
250
- lines.push("- Visual query builder");
251
- lines.push("- Auto-complete for fields and functions");
252
- lines.push("- Query validation and optimization");
253
- lines.push("- Result caching");
254
- lines.push("- Query sharing and collaboration");
255
- return {
256
- mimeType: "text/markdown",
257
- body: lines.join("\n")
258
- };
259
- }
225
+ var queryBuilderMarkdownRenderer = {
226
+ target: "markdown",
227
+ render: async (desc) => {
228
+ if (desc.source.type !== "component" || desc.source.componentKey !== "QueryBuilder") {
229
+ throw new Error("queryBuilderMarkdownRenderer: not QueryBuilder");
230
+ }
231
+ const queries = mockQueries;
232
+ const lines = [
233
+ "# Query Builder",
234
+ "",
235
+ "> Create and manage data queries",
236
+ "",
237
+ "## Saved Queries",
238
+ "",
239
+ "| Query | Type | Shared | Executions |",
240
+ "|-------|------|--------|------------|"
241
+ ];
242
+ for (const query of queries) {
243
+ const sharedIcon = query.isShared ? "\uD83C\uDF10" : "\uD83D\uDD12";
244
+ lines.push(`| ${query.name} | ${query.type} | ${sharedIcon} | ${query.executionCount.toLocaleString()} |`);
245
+ }
246
+ lines.push("");
247
+ lines.push("## Query Types");
248
+ lines.push("");
249
+ lines.push("### METRIC");
250
+ lines.push("Query usage metrics from the metering system.");
251
+ lines.push("");
252
+ lines.push("### AGGREGATION");
253
+ lines.push("Build aggregations with measures and dimensions without writing SQL.");
254
+ lines.push("");
255
+ lines.push("### SQL");
256
+ lines.push("Write custom SQL queries for advanced analysis.");
257
+ lines.push("");
258
+ lines.push("## Features");
259
+ lines.push("");
260
+ lines.push("- Visual query builder");
261
+ lines.push("- Auto-complete for fields and functions");
262
+ lines.push("- Query validation and optimization");
263
+ lines.push("- Result caching");
264
+ lines.push("- Query sharing and collaboration");
265
+ return {
266
+ mimeType: "text/markdown",
267
+ body: lines.join(`
268
+ `)
269
+ };
270
+ }
271
+ };
272
+ export {
273
+ queryBuilderMarkdownRenderer,
274
+ dashboardListMarkdownRenderer,
275
+ analyticsDashboardMarkdownRenderer
260
276
  };
261
-
262
- //#endregion
263
- export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer };
264
- //# sourceMappingURL=analytics.markdown.js.map
@@ -1,2 +1,2 @@
1
- import { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer } from "./analytics.markdown.js";
2
- export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer };
1
+ export { analyticsDashboardMarkdownRenderer, dashboardListMarkdownRenderer, queryBuilderMarkdownRenderer, } from './analytics.markdown';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/renderers/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kCAAkC,EAClC,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC"}