@canonical/design-system 0.1.1 → 0.1.2

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 (74) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  2. package/.github/workflows/ci.yml +39 -0
  3. package/.mcp.json +1 -3
  4. package/biome.json +1 -1
  5. package/bun.lock +38 -35
  6. package/data/apps_launchpad/component/badge.ttl +2 -1
  7. package/data/apps_launchpad/component/button.ttl +2 -1
  8. package/data/apps_launchpad/component/combobox.ttl +2 -1
  9. package/data/apps_launchpad/component/text_input.ttl +2 -1
  10. package/data/apps_launchpad/component/tooltip.ttl +2 -1
  11. package/data/global/component/announcement.ttl +1 -1
  12. package/data/global/component/button.ttl +3 -1
  13. package/data/global/component/code_snippet.ttl +1 -1
  14. package/data/global/component/heading.ttl +3 -2
  15. package/data/global/component/tile.ttl +1 -1
  16. package/data/global/component/tooltip.ttl +38 -19
  17. package/data/global/pattern/dropdown_button.ttl +1 -1
  18. package/data/global/pattern/timeline.ttl +8 -4
  19. package/definitions/ontology.ttl +108 -161
  20. package/package.json +1 -1
  21. package/skills/anatomy-author/SKILL.md +5 -0
  22. package/skills/component-specifier/SKILL.md +5 -2
  23. package/skills/design-auditor/SKILL.md +5 -0
  24. package/source.json +7 -2
  25. package/src/cli.ts +33 -33
  26. package/src/collect/generateTurtle.tests.ts +181 -176
  27. package/src/collect/generateTurtle.ts +189 -138
  28. package/src/collect/index.ts +5 -2
  29. package/src/collect/scanAnnotations.tests.ts +116 -110
  30. package/src/collect/scanAnnotations.ts +35 -33
  31. package/src/collect/types.ts +34 -33
  32. package/src/collect/validateCollectConfig.tests.ts +135 -112
  33. package/src/collect/validateCollectConfig.ts +60 -54
  34. package/src/collect-implementations.ts +101 -88
  35. package/src/commands/extract.tests.ts +31 -32
  36. package/src/commands/extract.ts +29 -27
  37. package/src/commands/index.ts +1 -1
  38. package/src/commands/list.tests.ts +13 -14
  39. package/src/commands/list.ts +9 -9
  40. package/src/commands/transform.tests.ts +21 -21
  41. package/src/commands/transform.ts +118 -114
  42. package/src/config/types.ts +40 -40
  43. package/src/config/validateConfig.tests.ts +31 -31
  44. package/src/config/validateConfig.ts +9 -9
  45. package/src/constants.ts +7 -8
  46. package/src/graph/GraphStore.tests.ts +111 -111
  47. package/src/graph/GraphStore.ts +205 -189
  48. package/src/graph/PrefixMap.tests.ts +124 -122
  49. package/src/graph/PrefixMap.ts +77 -77
  50. package/src/graph/buildUri.tests.ts +116 -116
  51. package/src/graph/buildUri.ts +45 -45
  52. package/src/graph/index.ts +2 -2
  53. package/src/graph/types.ts +3 -3
  54. package/src/providers/CodaProvider.tests.ts +233 -233
  55. package/src/providers/CodaProvider.ts +145 -145
  56. package/src/providers/CodaProvider.types.generated.ts +12484 -12123
  57. package/src/providers/index.ts +13 -13
  58. package/src/serializers/JSONSerializer.tests.ts +64 -64
  59. package/src/serializers/JSONSerializer.ts +51 -51
  60. package/src/serializers/TTLSerializer.tests.ts +45 -45
  61. package/src/serializers/TTLSerializer.ts +64 -57
  62. package/src/serializers/index.ts +4 -1
  63. package/src/serializers/types.ts +3 -3
  64. package/src/transform/resolveReferences.tests.ts +47 -43
  65. package/src/transform/resolveReferences.ts +18 -18
  66. package/src/transform/resolveValue.tests.ts +55 -49
  67. package/src/transform/resolveValue.ts +48 -48
  68. package/src/transform/transform.tests.ts +90 -77
  69. package/src/transform/transform.ts +77 -77
  70. package/src/transform/transformRow.tests.ts +372 -356
  71. package/src/transform/transformRow.ts +222 -191
  72. package/src/transform/types.ts +4 -4
  73. package/tsconfig.json +2 -1
  74. package/.gemini/settings.json +0 -14
@@ -14,161 +14,161 @@ export type CodaCellValue = components["schemas"]["CellValue"];
14
14
 
15
15
  // Simplified types for this provider's API
16
16
  export interface TableMetadata {
17
- id: string;
18
- name: string;
17
+ id: string;
18
+ name: string;
19
19
  }
20
20
 
21
21
  export interface ColumnMetadata {
22
- id: string;
23
- name: string;
24
- type: string;
25
- format: components["schemas"]["ColumnFormat"];
22
+ id: string;
23
+ name: string;
24
+ type: string;
25
+ format: components["schemas"]["ColumnFormat"];
26
26
  }
27
27
 
28
28
  export interface TableRow {
29
- _codaId: string;
30
- [key: string]: unknown;
29
+ _codaId: string;
30
+ [key: string]: unknown;
31
31
  }
32
32
 
33
33
  /**
34
34
  * Coda API client for fetching document tables and data
35
35
  */
36
36
  export default class CodaProvider {
37
- private apiKey: string;
38
-
39
- constructor() {
40
- const apiKey = process.env.CODA_API_KEY;
41
- if (!apiKey) {
42
- throw new Error("CODA_API_KEY environment variable is required");
43
- }
44
- this.apiKey = apiKey;
45
- }
46
-
47
- private get headers(): Record<string, string> {
48
- return {
49
- Authorization: `Bearer ${this.apiKey}`,
50
- "Content-Type": "application/json",
51
- };
52
- }
53
-
54
- private async fetchWithAuth<T>(url: string): Promise<T> {
55
- const response = await fetch(url, {
56
- method: "GET",
57
- headers: this.headers,
58
- });
59
-
60
- if (!response.ok) {
61
- throw new Error(
62
- `Coda API error: ${response.status} ${response.statusText}`,
63
- );
64
- }
65
-
66
- return response.json() as Promise<T>;
67
- }
68
-
69
- /**
70
- * List all tables in a document
71
- *
72
- * @see https://coda.io/developers/apis/v1#tag/Tables/operation/listTables
73
- */
74
- async listTables(documentId: string): Promise<TableMetadata[]> {
75
- const tables: TableMetadata[] = [];
76
- let pageToken: string | undefined;
77
-
78
- do {
79
- const url = new URL(`${CODA_API_BASE}/docs/${documentId}/tables`);
80
- if (pageToken) {
81
- url.searchParams.set("pageToken", pageToken);
82
- }
83
-
84
- const response = await this.fetchWithAuth<CodaTableList>(url.toString());
85
-
86
- for (const table of response.items) {
87
- tables.push({
88
- id: table.id,
89
- name: table.name,
90
- });
91
- }
92
-
93
- pageToken = response.nextPageToken;
94
- } while (pageToken);
95
-
96
- return tables;
97
- }
98
-
99
- /**
100
- * Fetch all rows from a table
101
- *
102
- * @see https://coda.io/developers/apis/v1#tag/Rows/operation/listRows
103
- */
104
- async fetchTable(documentId: string, tableId: string): Promise<TableRow[]> {
105
- const rows: TableRow[] = [];
106
- let pageToken: string | undefined;
107
-
108
- do {
109
- const url = new URL(
110
- `${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/rows`,
111
- );
112
- url.searchParams.set("useColumnNames", "true");
113
- if (pageToken) {
114
- url.searchParams.set("pageToken", pageToken);
115
- }
116
-
117
- const response = await this.fetchWithAuth<CodaRowList>(url.toString());
118
-
119
- for (const row of response.items) {
120
- const normalizedRow: TableRow = { _codaId: row.id };
121
-
122
- for (const [key, value] of Object.entries(row.values)) {
123
- // Coda API prefixes column names with "c-" when using useColumnNames=true.
124
- // Strip this prefix to get clean column names matching the display names.
125
- const normalizedKey = key.startsWith("c-") ? key.slice(2) : key;
126
- normalizedRow[normalizedKey] = value;
127
- }
128
-
129
- rows.push(normalizedRow);
130
- }
131
-
132
- pageToken = response.nextPageToken;
133
- } while (pageToken);
134
-
135
- return rows;
136
- }
137
-
138
- /**
139
- * Fetch column metadata for a table
140
- *
141
- * @see https://coda.io/developers/apis/v1#tag/Columns/operation/listColumns
142
- */
143
- async fetchTableColumns(
144
- documentId: string,
145
- tableId: string,
146
- ): Promise<ColumnMetadata[]> {
147
- const columns: ColumnMetadata[] = [];
148
- let pageToken: string | undefined;
149
-
150
- do {
151
- const url = new URL(
152
- `${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/columns`,
153
- );
154
- if (pageToken) {
155
- url.searchParams.set("pageToken", pageToken);
156
- }
157
-
158
- const response = await this.fetchWithAuth<CodaColumnList>(url.toString());
159
-
160
- for (const col of response.items) {
161
- columns.push({
162
- id: col.id,
163
- name: col.name,
164
- type: col.format.type,
165
- format: col.format,
166
- });
167
- }
168
-
169
- pageToken = response.nextPageToken;
170
- } while (pageToken);
171
-
172
- return columns;
173
- }
37
+ private apiKey: string;
38
+
39
+ constructor() {
40
+ const apiKey = process.env.CODA_API_KEY;
41
+ if (!apiKey) {
42
+ throw new Error("CODA_API_KEY environment variable is required");
43
+ }
44
+ this.apiKey = apiKey;
45
+ }
46
+
47
+ private get headers(): Record<string, string> {
48
+ return {
49
+ Authorization: `Bearer ${this.apiKey}`,
50
+ "Content-Type": "application/json",
51
+ };
52
+ }
53
+
54
+ private async fetchWithAuth<T>(url: string): Promise<T> {
55
+ const response = await fetch(url, {
56
+ method: "GET",
57
+ headers: this.headers,
58
+ });
59
+
60
+ if (!response.ok) {
61
+ throw new Error(
62
+ `Coda API error: ${response.status} ${response.statusText}`,
63
+ );
64
+ }
65
+
66
+ return response.json() as Promise<T>;
67
+ }
68
+
69
+ /**
70
+ * List all tables in a document
71
+ *
72
+ * @see https://coda.io/developers/apis/v1#tag/Tables/operation/listTables
73
+ */
74
+ async listTables(documentId: string): Promise<TableMetadata[]> {
75
+ const tables: TableMetadata[] = [];
76
+ let pageToken: string | undefined;
77
+
78
+ do {
79
+ const url = new URL(`${CODA_API_BASE}/docs/${documentId}/tables`);
80
+ if (pageToken) {
81
+ url.searchParams.set("pageToken", pageToken);
82
+ }
83
+
84
+ const response = await this.fetchWithAuth<CodaTableList>(url.toString());
85
+
86
+ for (const table of response.items) {
87
+ tables.push({
88
+ id: table.id,
89
+ name: table.name,
90
+ });
91
+ }
92
+
93
+ pageToken = response.nextPageToken;
94
+ } while (pageToken);
95
+
96
+ return tables;
97
+ }
98
+
99
+ /**
100
+ * Fetch all rows from a table
101
+ *
102
+ * @see https://coda.io/developers/apis/v1#tag/Rows/operation/listRows
103
+ */
104
+ async fetchTable(documentId: string, tableId: string): Promise<TableRow[]> {
105
+ const rows: TableRow[] = [];
106
+ let pageToken: string | undefined;
107
+
108
+ do {
109
+ const url = new URL(
110
+ `${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/rows`,
111
+ );
112
+ url.searchParams.set("useColumnNames", "true");
113
+ if (pageToken) {
114
+ url.searchParams.set("pageToken", pageToken);
115
+ }
116
+
117
+ const response = await this.fetchWithAuth<CodaRowList>(url.toString());
118
+
119
+ for (const row of response.items) {
120
+ const normalizedRow: TableRow = { _codaId: row.id };
121
+
122
+ for (const [key, value] of Object.entries(row.values)) {
123
+ // Coda API prefixes column names with "c-" when using useColumnNames=true.
124
+ // Strip this prefix to get clean column names matching the display names.
125
+ const normalizedKey = key.startsWith("c-") ? key.slice(2) : key;
126
+ normalizedRow[normalizedKey] = value;
127
+ }
128
+
129
+ rows.push(normalizedRow);
130
+ }
131
+
132
+ pageToken = response.nextPageToken;
133
+ } while (pageToken);
134
+
135
+ return rows;
136
+ }
137
+
138
+ /**
139
+ * Fetch column metadata for a table
140
+ *
141
+ * @see https://coda.io/developers/apis/v1#tag/Columns/operation/listColumns
142
+ */
143
+ async fetchTableColumns(
144
+ documentId: string,
145
+ tableId: string,
146
+ ): Promise<ColumnMetadata[]> {
147
+ const columns: ColumnMetadata[] = [];
148
+ let pageToken: string | undefined;
149
+
150
+ do {
151
+ const url = new URL(
152
+ `${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/columns`,
153
+ );
154
+ if (pageToken) {
155
+ url.searchParams.set("pageToken", pageToken);
156
+ }
157
+
158
+ const response = await this.fetchWithAuth<CodaColumnList>(url.toString());
159
+
160
+ for (const col of response.items) {
161
+ columns.push({
162
+ id: col.id,
163
+ name: col.name,
164
+ type: col.format.type,
165
+ format: col.format,
166
+ });
167
+ }
168
+
169
+ pageToken = response.nextPageToken;
170
+ } while (pageToken);
171
+
172
+ return columns;
173
+ }
174
174
  }