@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
@@ -2,24 +2,24 @@ import type { TransformConfig } from "../config/types.js";
2
2
  import { GraphStore, PrefixMap } from "../graph/index.js";
3
3
  import resolveReferences from "./resolveReferences.js";
4
4
  import transformRow from "./transformRow.js";
5
- import type { ReferenceMap, InlineDataMap } from "./types.js";
5
+ import type { InlineDataMap, ReferenceMap } from "./types.js";
6
6
 
7
7
  /**
8
8
  * Extracted data structure from the extract command
9
9
  */
10
10
  interface ExtractedData {
11
- document: string;
12
- extractedAt: string;
13
- tables: Record<string, Array<Record<string, unknown>>>;
11
+ document: string;
12
+ extractedAt: string;
13
+ tables: Record<string, Array<Record<string, unknown>>>;
14
14
  }
15
15
 
16
16
  /**
17
17
  * Result of the transform operation
18
18
  */
19
19
  export interface TransformResult {
20
- store: GraphStore;
21
- prefixes: PrefixMap;
22
- subjects: string[];
20
+ store: GraphStore;
21
+ prefixes: PrefixMap;
22
+ subjects: string[];
23
23
  }
24
24
 
25
25
  /**
@@ -29,83 +29,83 @@ export interface TransformResult {
29
29
  * for cross-table lookups, then transforms each row into quads.
30
30
  */
31
31
  export default function transform(
32
- config: TransformConfig,
33
- extractedData: ExtractedData,
32
+ config: TransformConfig,
33
+ extractedData: ExtractedData,
34
34
  ): TransformResult {
35
- const store = new GraphStore();
36
- const subjects: string[] = [];
35
+ const store = new GraphStore();
36
+ const subjects: string[] = [];
37
37
 
38
- // Build reference maps for all reference tables
39
- const mergedRefMap: ReferenceMap = new Map();
38
+ // Build reference maps for all reference tables
39
+ const mergedRefMap: ReferenceMap = new Map();
40
40
 
41
- if (config.references) {
42
- for (const [tableName, refConfig] of Object.entries(config.references)) {
43
- const tableData = extractedData.tables[tableName];
44
- if (tableData) {
45
- const refMap = resolveReferences(tableData, refConfig);
46
- // Merge into the combined map
47
- for (const [key, value] of refMap) {
48
- mergedRefMap.set(key, value);
49
- }
50
- }
51
- }
52
- }
41
+ if (config.references) {
42
+ for (const [tableName, refConfig] of Object.entries(config.references)) {
43
+ const tableData = extractedData.tables[tableName];
44
+ if (tableData) {
45
+ const refMap = resolveReferences(tableData, refConfig);
46
+ // Merge into the combined map
47
+ for (const [key, value] of refMap) {
48
+ mergedRefMap.set(key, value);
49
+ }
50
+ }
51
+ }
52
+ }
53
53
 
54
- // Collect all prefixes from table contexts
55
- const prefixes = new PrefixMap();
54
+ // Collect all prefixes from table contexts
55
+ const prefixes = new PrefixMap();
56
56
 
57
- // Build inline data maps for all tables (indexed by _codaId and common name columns)
58
- const inlineData: Record<string, InlineDataMap> = {};
59
- const nameColumns = ["name", "property name", "Name"];
60
- for (const [tableName, tableData] of Object.entries(extractedData.tables)) {
61
- const dataMap: InlineDataMap = new Map();
62
- for (const row of tableData) {
63
- // Index by Coda ID
64
- const codaId = row._codaId as string;
65
- if (codaId) {
66
- dataMap.set(codaId, row);
67
- }
68
- // Also index by common name columns for name-based lookups
69
- for (const col of nameColumns) {
70
- const nameValue = row[col];
71
- if (typeof nameValue === "string" && nameValue.length > 0) {
72
- dataMap.set(nameValue.toLowerCase(), row);
73
- }
74
- }
75
- }
76
- inlineData[tableName] = dataMap;
77
- }
57
+ // Build inline data maps for all tables (indexed by _codaId and common name columns)
58
+ const inlineData: Record<string, InlineDataMap> = {};
59
+ const nameColumns = ["name", "property name", "Name"];
60
+ for (const [tableName, tableData] of Object.entries(extractedData.tables)) {
61
+ const dataMap: InlineDataMap = new Map();
62
+ for (const row of tableData) {
63
+ // Index by Coda ID
64
+ const codaId = row._codaId as string;
65
+ if (codaId) {
66
+ dataMap.set(codaId, row);
67
+ }
68
+ // Also index by common name columns for name-based lookups
69
+ for (const col of nameColumns) {
70
+ const nameValue = row[col];
71
+ if (typeof nameValue === "string" && nameValue.length > 0) {
72
+ dataMap.set(nameValue.toLowerCase(), row);
73
+ }
74
+ }
75
+ }
76
+ inlineData[tableName] = dataMap;
77
+ }
78
78
 
79
- // Transform each configured table
80
- for (const [tableName, tableConfig] of Object.entries(config.tables)) {
81
- const tableData = extractedData.tables[tableName];
82
- if (!tableData) {
83
- continue;
84
- }
79
+ // Transform each configured table
80
+ for (const [tableName, tableConfig] of Object.entries(config.tables)) {
81
+ const tableData = extractedData.tables[tableName];
82
+ if (!tableData) {
83
+ continue;
84
+ }
85
85
 
86
- // Extract prefixes from this table's context
87
- const tablePrefixes = PrefixMap.fromContext(
88
- tableConfig["@context"] as Record<string, unknown>,
89
- );
90
- for (const [prefix, namespace] of tablePrefixes.entries()) {
91
- prefixes.add(prefix, namespace);
92
- }
86
+ // Extract prefixes from this table's context
87
+ const tablePrefixes = PrefixMap.fromContext(
88
+ tableConfig["@context"] as Record<string, unknown>,
89
+ );
90
+ for (const [prefix, namespace] of tablePrefixes.entries()) {
91
+ prefixes.add(prefix, namespace);
92
+ }
93
93
 
94
- // Transform each row
95
- for (const row of tableData) {
96
- const subjectUri = transformRow(
97
- row,
98
- tableConfig,
99
- store,
100
- prefixes,
101
- mergedRefMap,
102
- inlineData,
103
- );
104
- if (subjectUri !== null) {
105
- subjects.push(subjectUri);
106
- }
107
- }
108
- }
94
+ // Transform each row
95
+ for (const row of tableData) {
96
+ const subjectUri = transformRow(
97
+ row,
98
+ tableConfig,
99
+ store,
100
+ prefixes,
101
+ mergedRefMap,
102
+ inlineData,
103
+ );
104
+ if (subjectUri !== null) {
105
+ subjects.push(subjectUri);
106
+ }
107
+ }
108
+ }
109
109
 
110
- return { store, prefixes, subjects };
110
+ return { store, prefixes, subjects };
111
111
  }