@canonical/design-system 0.1.0 → 0.1.1
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.
- package/.gemini/settings.json +14 -0
- package/.github/ISSUE_TEMPLATE/propose-changes-to-existing-ui-block.md +14 -0
- package/.github/ISSUE_TEMPLATE/propose-new-ui-block.md +26 -0
- package/.github/workflows/sync-coda-manual.yml +12 -0
- package/.github/workflows/sync-coda-scheduled.yml +13 -0
- package/.github/workflows/sync-coda.yml +38 -0
- package/.mcp.json +8 -2
- package/GEMINI.md +2 -0
- package/README.md +71 -51
- package/data/apps/component/file_tree.ttl +6 -7
- package/data/apps/component/key_value_pair.ttl +6 -7
- package/data/apps/component/navigation.ttl +6 -7
- package/data/apps/component/notification.ttl +7 -0
- package/data/apps/component/skeleton_loading.ttl +6 -7
- package/data/apps/component/status_bar.ttl +6 -7
- package/data/apps/component/toolbar.ttl +6 -7
- package/data/apps/group/notifications.ttl +7 -0
- package/data/apps/layout/application_layout.ttl +8 -7
- package/data/apps/layout/content_layout.ttl +9 -0
- package/data/apps/layout/empty_layout.ttl +6 -7
- package/data/apps/layout/list_page_layout.ttl +6 -7
- package/data/apps/layout/settings_page_layout.ttl +6 -7
- package/data/apps/layout/view_layout.ttl +9 -0
- package/data/apps/pattern/code_diff.ttl +6 -7
- package/data/apps/pattern/data_table.ttl +6 -7
- package/data/apps/pattern/destructive_modal.ttl +6 -7
- package/data/apps/pattern/key_value_summary.ttl +6 -7
- package/data/apps/pattern/keyboard_shortcuts.ttl +6 -7
- package/data/apps/pattern/notification_center.ttl +6 -7
- package/data/apps/pattern/side_panel.ttl +6 -7
- package/data/apps/pattern/sidepanel_stacked.ttl +6 -7
- package/data/apps/subcomponent/file_tree-node.ttl +7 -0
- package/data/apps.ttl +3 -4
- package/data/apps_anbox/component/copy_to_clipboard.ttl +7 -0
- package/data/apps_anbox/pattern/side_menu.ttl +13 -0
- package/data/apps_anbox.ttl +4 -0
- package/data/apps_juju/pattern/single_select_multi_layered.ttl +7 -0
- package/data/apps_juju.ttl +4 -0
- package/data/apps_landscape/component/password_constraints.ttl +32 -0
- package/data/apps_landscape.ttl +4 -0
- package/data/apps_launchpad/component/badge.ttl +22 -0
- package/data/apps_launchpad/component/breadcrumbs.ttl +14 -0
- package/data/apps_launchpad/component/button.ttl +34 -0
- package/data/apps_launchpad/component/checkbox.ttl +28 -0
- package/data/apps_launchpad/component/chip.ttl +42 -0
- package/data/apps_launchpad/component/combobox.ttl +51 -0
- package/data/apps_launchpad/component/description_list.ttl +13 -0
- package/data/apps_launchpad/component/radio.ttl +34 -0
- package/data/apps_launchpad/component/select.ttl +34 -0
- package/data/apps_launchpad/component/switch.ttl +21 -0
- package/data/apps_launchpad/component/text_input.ttl +35 -0
- package/data/apps_launchpad/component/textarea.ttl +35 -0
- package/data/apps_launchpad/component/tooltip.ttl +27 -0
- package/data/apps_launchpad/component/user_avatar.ttl +25 -0
- package/data/apps_launchpad/subcomponent/combobox-checkbox_option.ttl +29 -0
- package/data/apps_launchpad/subcomponent/combobox-footer.ttl +13 -0
- package/data/apps_launchpad/subcomponent/combobox-group.ttl +20 -0
- package/data/apps_launchpad/subcomponent/combobox-helper.ttl +19 -0
- package/data/apps_launchpad/subcomponent/combobox-loading.ttl +13 -0
- package/data/apps_launchpad/subcomponent/combobox-no_results.ttl +13 -0
- package/data/apps_launchpad/subcomponent/combobox-radio_option.ttl +29 -0
- package/data/apps_launchpad/subcomponent/combobox-search.ttl +22 -0
- package/data/apps_launchpad/subcomponent/description_list-item.ttl +19 -0
- package/data/apps_launchpad.ttl +4 -0
- package/data/apps_lxd/component/confirmation_checkbox.ttl +7 -0
- package/data/apps_lxd/component/copy_to_clipboard.ttl +7 -0
- package/data/apps_lxd/view/network_topology.ttl +7 -0
- package/data/apps_lxd.ttl +4 -0
- package/data/apps_portal/component/badge.ttl +7 -0
- package/data/apps_portal.ttl +4 -0
- package/data/apps_workplace/component/label-highlight.ttl +7 -0
- package/data/apps_workplace.ttl +4 -0
- package/data/apps_wpe.ttl +3 -4
- package/data/documentation/layout/documentation_layout.ttl +6 -7
- package/data/documentation/pattern/library_side_navigation.ttl +7 -0
- package/data/documentation.ttl +3 -4
- package/data/global/component/accordion.ttl +11 -12
- package/data/global/component/announcement.ttl +6 -7
- package/data/global/component/badge.ttl +7 -8
- package/data/global/component/breadcrumbs.ttl +13 -0
- package/data/global/component/button.ttl +27 -17
- package/data/global/component/button_link.ttl +7 -0
- package/data/global/component/card.ttl +6 -7
- package/data/global/component/chip.ttl +6 -7
- package/data/global/component/code.ttl +7 -0
- package/data/global/component/code_snippet-content.ttl +7 -0
- package/data/global/component/code_snippet-header.ttl +7 -0
- package/data/global/component/code_snippet.ttl +6 -7
- package/data/global/component/contextual_menu.ttl +6 -7
- package/data/global/component/heading.ttl +11 -12
- package/data/global/component/icon.ttl +12 -12
- package/data/global/component/icon_in_container.ttl +6 -7
- package/data/global/component/keyboard_key.ttl +6 -7
- package/data/global/component/label.ttl +12 -13
- package/data/global/component/notification_inline.ttl +6 -7
- package/data/global/component/notification_toast.ttl +6 -7
- package/data/global/component/pagination.ttl +6 -7
- package/data/global/component/popover.ttl +6 -7
- package/data/global/component/rich_text_editor.ttl +6 -7
- package/data/global/component/search_bar.ttl +6 -7
- package/data/global/component/table.ttl +6 -7
- package/data/global/component/tabs.ttl +6 -7
- package/data/global/component/theme_switcher.ttl +6 -7
- package/data/global/component/tile.ttl +11 -12
- package/data/global/component/tooltip.ttl +182 -7
- package/data/global/group/buttons.ttl +6 -7
- package/data/global/group/cards.ttl +6 -7
- package/data/global/group/code_snippets.ttl +7 -0
- package/data/global/group/keyboard_keys.ttl +7 -0
- package/data/global/group/tiles.ttl +6 -7
- package/data/global/layout/error_layout.ttl +6 -7
- package/data/global/layout/form_layout.ttl +6 -7
- package/data/global/layout/identity_page_form.ttl +6 -7
- package/data/global/modifier/alpha.ttl +5 -5
- package/data/global/modifier/beta.ttl +5 -5
- package/data/global/modifier/caution.ttl +5 -5
- package/data/global/modifier/comfortable.ttl +5 -5
- package/data/global/modifier/completed.ttl +5 -5
- package/data/global/modifier/constructive.ttl +5 -5
- package/data/global/modifier/dark.ttl +5 -5
- package/data/global/modifier/dense.ttl +5 -5
- package/data/global/modifier/destructive.ttl +5 -5
- package/data/global/modifier/editable.ttl +5 -5
- package/data/global/modifier/elevated.ttl +5 -5
- package/data/global/modifier/error.ttl +5 -5
- package/data/global/modifier/experimental.ttl +5 -5
- package/data/global/modifier/failed.ttl +5 -5
- package/data/global/modifier/focused.ttl +5 -5
- package/data/global/modifier/highlighted.ttl +5 -5
- package/data/global/modifier/in_progress.ttl +5 -5
- package/data/global/modifier/information.ttl +5 -5
- package/data/global/modifier/light.ttl +5 -5
- package/data/global/modifier/loading.ttl +5 -5
- package/data/global/modifier/muted.ttl +5 -5
- package/data/global/modifier/paper.ttl +5 -5
- package/data/global/modifier/planned.ttl +5 -5
- package/data/global/modifier/primary.ttl +5 -5
- package/data/global/modifier/secondary.ttl +5 -5
- package/data/global/modifier/stable.ttl +5 -5
- package/data/global/modifier/success.ttl +5 -5
- package/data/global/modifier/tertiary.ttl +5 -5
- package/data/global/modifier/warning.ttl +5 -5
- package/data/global/modifier/wireframe.ttl +5 -5
- package/data/global/modifier_family/_color_luminosity.ttl +5 -6
- package/data/global/modifier_family/_emphasis.ttl +5 -6
- package/data/global/modifier_family/_other.ttl +5 -6
- package/data/global/modifier_family/anticipation.ttl +5 -6
- package/data/global/modifier_family/criticality.ttl +5 -6
- package/data/global/modifier_family/density.ttl +5 -6
- package/data/global/modifier_family/importance.ttl +5 -6
- package/data/global/modifier_family/lifecycle.ttl +5 -6
- package/data/global/modifier_family/release.ttl +5 -6
- package/data/global/pattern/dropdown_button.ttl +7 -0
- package/data/global/pattern/info_table.ttl +6 -7
- package/data/global/pattern/modal.ttl +6 -7
- package/data/global/pattern/navigation.ttl +6 -7
- package/data/global/pattern/stepper.ttl +6 -7
- package/data/global/pattern/table_of_contents.ttl +6 -7
- package/data/global/pattern/timeline.ttl +60 -12
- package/data/global/subcomponent/accordion-item.ttl +15 -16
- package/data/global/subcomponent/breadcrumbs-item.ttl +15 -16
- package/data/global/subcomponent/card-content.ttl +11 -12
- package/data/global/subcomponent/card-header.ttl +11 -12
- package/data/global/subcomponent/card-image.ttl +16 -17
- package/data/global/subcomponent/card-thumbnail.ttl +7 -0
- package/data/global/subcomponent/divider.ttl +6 -7
- package/data/global/subcomponent/modal-content.ttl +6 -7
- package/data/global/subcomponent/modal-footer.ttl +6 -7
- package/data/global/subcomponent/modal-header.ttl +6 -7
- package/data/global/subcomponent/spinner.ttl +6 -7
- package/data/global/subcomponent/table-cell.ttl +6 -7
- package/data/global/subcomponent/table-row.ttl +6 -7
- package/data/global/subcomponent/tile-content.ttl +11 -12
- package/data/global/subcomponent/tile-header.ttl +11 -12
- package/data/global/subcomponent/timeline-content.ttl +11 -12
- package/data/global/subcomponent/timeline-event.ttl +42 -27
- package/data/global/subcomponent/timeline-expansion_indicator.ttl +7 -0
- package/data/global/subcomponent/timeline-header.ttl +6 -7
- package/data/global/view/settings_view.ttl +7 -0
- package/data/global.ttl +3 -4
- package/data/global_form/component/checkbox_input.ttl +6 -7
- package/data/global_form/component/choices_input.ttl +6 -7
- package/data/global_form/component/combobox_input.ttl +6 -7
- package/data/global_form/component/custom_choices_input.ttl +6 -7
- package/data/global_form/component/datepicker_input.ttl +6 -7
- package/data/global_form/component/rating_input.ttl +6 -7
- package/data/global_form/component/rich_text_input.ttl +7 -0
- package/data/global_form/component/segmented_control_input.ttl +6 -7
- package/data/global_form/component/slider_input.ttl +6 -7
- package/data/global_form/component/switch_input.ttl +6 -7
- package/data/global_form/component/text_input.ttl +6 -7
- package/data/global_form/component/textarea_input.ttl +6 -7
- package/data/global_form/component/wysiwginput.ttl +6 -7
- package/data/global_form/pattern/field.ttl +6 -7
- package/data/global_form/pattern/form.ttl +6 -7
- package/data/global_form/subcomponent/field-description.ttl +6 -7
- package/data/global_form/subcomponent/field-label.ttl +6 -7
- package/data/global_form.ttl +3 -4
- package/data/site/component/blog_card.ttl +7 -0
- package/data/site/component/quote.ttl +6 -7
- package/data/site/component/rule.ttl +6 -7
- package/data/site/component/section.ttl +6 -7
- package/data/site/group/blog_cards.ttl +7 -0
- package/data/site/layout/blog_page_layout.ttl +7 -0
- package/data/site/layout/case_study_layout.ttl +7 -0
- package/data/site/layout/site_layout.ttl +6 -7
- package/data/site/pattern/hero-github.ttl +6 -7
- package/data/site/pattern/hero.ttl +6 -7
- package/data/site/pattern/info_table.ttl +6 -7
- package/data/site/pattern/pricing_section.ttl +7 -0
- package/data/site/pattern/pricing_table.ttl +7 -0
- package/data/site/pattern/read_more_section.ttl +7 -0
- package/data/site/pattern/skip_link.ttl +6 -7
- package/data/site.ttl +3 -4
- package/data/sites_webcomponentsprototype/component/blog_cards.ttl +7 -0
- package/data/sites_webcomponentsprototype/component/ctablock.ttl +7 -0
- package/data/sites_webcomponentsprototype/component/list.ttl +7 -0
- package/data/sites_webcomponentsprototype/component/tabs.ttl +7 -0
- package/data/sites_webcomponentsprototype/layout/site_layout.ttl +8 -0
- package/data/sites_webcomponentsprototype/pattern/basic_section.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/blog_section.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/ctasection.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/equal_heights.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/hero.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/logo_section.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/quote_wrapper.ttl +7 -0
- package/data/sites_webcomponentsprototype/pattern/tiered_list.ttl +7 -0
- package/data/sites_webcomponentsprototype.ttl +4 -0
- package/data/stores.ttl +3 -4
- package/definitions/ontology.ttl +39 -25
- package/package.json +8 -8
- package/skills/anatomy-author/SKILL.md +9 -9
- package/skills/component-specifier/SKILL.md +81 -85
- package/skills/design-auditor/SKILL.md +45 -45
- package/source.json +35 -33
- package/src/collect/generateTurtle.tests.ts +21 -38
- package/src/commands/transform.ts +27 -3
- package/src/config/source.schema.json +9 -0
- package/src/config/types.ts +7 -0
- package/src/constants.ts +6 -7
- package/src/graph/GraphStore.tests.ts +23 -23
- package/src/graph/GraphStore.ts +2 -2
- package/src/graph/PrefixMap.tests.ts +16 -16
- package/src/graph/PrefixMap.ts +1 -1
- package/src/graph/buildUri.tests.ts +26 -13
- package/src/graph/buildUri.ts +17 -5
- package/src/serializers/JSONSerializer.tests.ts +2 -5
- package/src/serializers/TTLSerializer.tests.ts +2 -4
- package/src/serializers/TTLSerializer.ts +2 -2
- package/src/transform/resolveReferences.tests.ts +2 -2
- package/src/transform/transform.tests.ts +5 -7
- package/src/transform/transform.ts +3 -1
- package/src/transform/transformRow.tests.ts +149 -50
- package/src/transform/transformRow.ts +27 -3
- package/data/global/component/link.ttl +0 -8
- package/data/global/pattern/breadcrumbs.ttl +0 -14
- package/data/global/pattern/select_button.ttl +0 -8
- package/data/global/subcomponent/timeline-footer.ttl +0 -8
- package/session/A.DSL.md +0 -429
- package/session/B.NOTES.md +0 -84
- package/session/global.component.accordion.yaml +0 -13
- package/session/global.component.button.yaml +0 -26
- package/session/global.component.card.yaml +0 -24
- package/session/global.component.icon.yaml +0 -7
- package/session/global.component.label.yaml +0 -7
- package/session/global.component.tile.yaml +0 -21
- package/session/global.component.timeline.yaml +0 -20
- package/session/global.pattern.breadcrumbs.yaml +0 -13
- package/session/global.subcomponent.accordion-item.yaml +0 -37
- package/session/global.subcomponent.breadcrumbs-item.yaml +0 -21
- package/session/global.subcomponent.card-content.yaml +0 -7
- package/session/global.subcomponent.card-header.yaml +0 -22
- package/session/global.subcomponent.card-image.yaml +0 -7
- package/session/global.subcomponent.tile-content.yaml +0 -7
- package/session/global.subcomponent.tile-header.yaml +0 -8
- package/session/global.subcomponent.timeline-content.yaml +0 -13
- package/session/global.subcomponent.timeline-event.yaml +0 -20
- package/session/global.subcomponent.timeline-footer.yaml +0 -9
- package/session/global.subcomponent.timeline-header.yaml +0 -18
|
@@ -19,7 +19,7 @@ Start with a broad inventory, then drill into specific concerns:
|
|
|
19
19
|
sem_readme(package: "design-system")
|
|
20
20
|
→ Get overview of classes and counts
|
|
21
21
|
|
|
22
|
-
sem_lookup_batch(types: ["
|
|
22
|
+
sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout"])
|
|
23
23
|
→ Get full inventory across types
|
|
24
24
|
|
|
25
25
|
sem_sparql({quality queries})
|
|
@@ -45,12 +45,12 @@ What's connected vs. orphaned?
|
|
|
45
45
|
### Coverage: Components by Tier
|
|
46
46
|
|
|
47
47
|
```sparql
|
|
48
|
-
PREFIX
|
|
48
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
49
49
|
|
|
50
50
|
SELECT ?tierName (COUNT(?c) as ?componentCount) WHERE {
|
|
51
|
-
?c a
|
|
52
|
-
|
|
53
|
-
?tier
|
|
51
|
+
?c a ds:Component ;
|
|
52
|
+
ds:tier ?tier .
|
|
53
|
+
?tier ds:name ?tierName .
|
|
54
54
|
} GROUP BY ?tierName
|
|
55
55
|
ORDER BY DESC(?componentCount)
|
|
56
56
|
```
|
|
@@ -60,10 +60,10 @@ ORDER BY DESC(?componentCount)
|
|
|
60
60
|
### Coverage: UIBlock Types Distribution
|
|
61
61
|
|
|
62
62
|
```sparql
|
|
63
|
-
PREFIX
|
|
63
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
64
64
|
|
|
65
65
|
SELECT ?type (COUNT(?block) as ?count) WHERE {
|
|
66
|
-
VALUES ?type {
|
|
66
|
+
VALUES ?type { ds:Component ds:Pattern ds:Layout ds:Subcomponent }
|
|
67
67
|
?block a ?type .
|
|
68
68
|
} GROUP BY ?type
|
|
69
69
|
```
|
|
@@ -73,13 +73,13 @@ SELECT ?type (COUNT(?block) as ?count) WHERE {
|
|
|
73
73
|
### Quality: Components Missing Descriptions
|
|
74
74
|
|
|
75
75
|
```sparql
|
|
76
|
-
PREFIX
|
|
76
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
77
77
|
|
|
78
78
|
SELECT ?component ?name WHERE {
|
|
79
|
-
?component a
|
|
80
|
-
|
|
79
|
+
?component a ds:Component ;
|
|
80
|
+
ds:name ?name .
|
|
81
81
|
FILTER(!bound(?desc) || ?desc = "")
|
|
82
|
-
OPTIONAL { ?component
|
|
82
|
+
OPTIONAL { ?component ds:summary ?desc }
|
|
83
83
|
}
|
|
84
84
|
```
|
|
85
85
|
|
|
@@ -88,12 +88,12 @@ SELECT ?component ?name WHERE {
|
|
|
88
88
|
### Quality: Components Missing Usage Guidance
|
|
89
89
|
|
|
90
90
|
```sparql
|
|
91
|
-
PREFIX
|
|
91
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
92
92
|
|
|
93
93
|
SELECT ?component ?name WHERE {
|
|
94
|
-
?component a
|
|
95
|
-
|
|
96
|
-
FILTER NOT EXISTS { ?component
|
|
94
|
+
?component a ds:Component ;
|
|
95
|
+
ds:name ?name .
|
|
96
|
+
FILTER NOT EXISTS { ?component ds:whenToUse ?when }
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
@@ -102,26 +102,26 @@ SELECT ?component ?name WHERE {
|
|
|
102
102
|
### Quality: Components Missing Guidelines
|
|
103
103
|
|
|
104
104
|
```sparql
|
|
105
|
-
PREFIX
|
|
105
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
106
106
|
|
|
107
107
|
SELECT ?component ?name WHERE {
|
|
108
|
-
?component a
|
|
109
|
-
|
|
110
|
-
FILTER NOT EXISTS { ?component
|
|
108
|
+
?component a ds:Component ;
|
|
109
|
+
ds:name ?name .
|
|
110
|
+
FILTER NOT EXISTS { ?component ds:guidelines ?g }
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
### Consistency: Modifier Family Usage
|
|
115
115
|
|
|
116
116
|
```sparql
|
|
117
|
-
PREFIX
|
|
117
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
118
118
|
|
|
119
119
|
SELECT ?family ?familyName (COUNT(?component) as ?usage) WHERE {
|
|
120
|
-
?family a
|
|
121
|
-
|
|
120
|
+
?family a ds:ModifierFamily ;
|
|
121
|
+
ds:name ?familyName .
|
|
122
122
|
OPTIONAL {
|
|
123
|
-
?component a
|
|
124
|
-
|
|
123
|
+
?component a ds:Component ;
|
|
124
|
+
ds:hasModifierFamily ?family .
|
|
125
125
|
}
|
|
126
126
|
} GROUP BY ?family ?familyName
|
|
127
127
|
ORDER BY DESC(?usage)
|
|
@@ -132,12 +132,12 @@ ORDER BY DESC(?usage)
|
|
|
132
132
|
### Consistency: Components Without Modifier Families
|
|
133
133
|
|
|
134
134
|
```sparql
|
|
135
|
-
PREFIX
|
|
135
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
136
136
|
|
|
137
137
|
SELECT ?component ?name WHERE {
|
|
138
|
-
?component a
|
|
139
|
-
|
|
140
|
-
FILTER NOT EXISTS { ?component
|
|
138
|
+
?component a ds:Component ;
|
|
139
|
+
ds:name ?name .
|
|
140
|
+
FILTER NOT EXISTS { ?component ds:hasModifierFamily ?mf }
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
@@ -146,12 +146,12 @@ SELECT ?component ?name WHERE {
|
|
|
146
146
|
### Usage: Orphaned Subcomponents
|
|
147
147
|
|
|
148
148
|
```sparql
|
|
149
|
-
PREFIX
|
|
149
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
150
150
|
|
|
151
151
|
SELECT ?sub ?name WHERE {
|
|
152
|
-
?sub a
|
|
153
|
-
|
|
154
|
-
FILTER NOT EXISTS { ?sub
|
|
152
|
+
?sub a ds:Subcomponent ;
|
|
153
|
+
ds:name ?name .
|
|
154
|
+
FILTER NOT EXISTS { ?sub ds:parentComponent ?parent }
|
|
155
155
|
}
|
|
156
156
|
```
|
|
157
157
|
|
|
@@ -160,12 +160,12 @@ SELECT ?sub ?name WHERE {
|
|
|
160
160
|
### Usage: Components With Subcomponents
|
|
161
161
|
|
|
162
162
|
```sparql
|
|
163
|
-
PREFIX
|
|
163
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
164
164
|
|
|
165
165
|
SELECT ?component ?componentName (COUNT(?sub) as ?subCount) WHERE {
|
|
166
|
-
?component a
|
|
167
|
-
|
|
168
|
-
?sub
|
|
166
|
+
?component a ds:Component ;
|
|
167
|
+
ds:name ?componentName .
|
|
168
|
+
?sub ds:parentComponent ?component .
|
|
169
169
|
} GROUP BY ?component ?componentName
|
|
170
170
|
ORDER BY DESC(?subCount)
|
|
171
171
|
```
|
|
@@ -175,21 +175,21 @@ ORDER BY DESC(?subCount)
|
|
|
175
175
|
### Cross-Tier: Potential Promotion Candidates
|
|
176
176
|
|
|
177
177
|
```sparql
|
|
178
|
-
PREFIX
|
|
178
|
+
PREFIX ds: <https://ds.canonical.com/>
|
|
179
179
|
|
|
180
180
|
SELECT ?component ?name ?tierName WHERE {
|
|
181
|
-
?component a
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
?tier
|
|
181
|
+
?component a ds:Component ;
|
|
182
|
+
ds:name ?name ;
|
|
183
|
+
ds:tier ?tier .
|
|
184
|
+
?tier ds:name ?tierName .
|
|
185
185
|
|
|
186
186
|
# Find non-global components that might be universal
|
|
187
187
|
FILTER(?tier != <https://ds.canonical.com/data/global>)
|
|
188
188
|
|
|
189
189
|
# Heuristic: has modifier families (suggests maturity)
|
|
190
|
-
FILTER EXISTS { ?component
|
|
191
|
-
FILTER EXISTS { ?component
|
|
192
|
-
FILTER EXISTS { ?component
|
|
190
|
+
FILTER EXISTS { ?component ds:hasModifierFamily ?mf }
|
|
191
|
+
FILTER EXISTS { ?component ds:summary ?d }
|
|
192
|
+
FILTER EXISTS { ?component ds:whenToUse ?w }
|
|
193
193
|
}
|
|
194
194
|
```
|
|
195
195
|
|
|
@@ -346,7 +346,7 @@ For comprehensive review:
|
|
|
346
346
|
|
|
347
347
|
```
|
|
348
348
|
1. Inventory
|
|
349
|
-
sem_lookup_batch(types: ["
|
|
349
|
+
sem_lookup_batch(types: ["ds:Component", "ds:Pattern", "ds:Layout", "ds:Subcomponent"])
|
|
350
350
|
|
|
351
351
|
2. Coverage queries (all)
|
|
352
352
|
|
package/source.json
CHANGED
|
@@ -21,67 +21,69 @@
|
|
|
21
21
|
"tables": {
|
|
22
22
|
"uiBlocks": {
|
|
23
23
|
"@context": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"tier": { "@id": "dso:tier", "@type": "@id" },
|
|
24
|
+
"ds": "https://ds.canonical.com/",
|
|
25
|
+
"name": "ds:name",
|
|
26
|
+
"summary": "ds:summary",
|
|
27
|
+
"anatomy_dsl": "ds:anatomyDsl",
|
|
28
|
+
"Anatomy (classic)": "ds:anatomyClassic",
|
|
29
|
+
"tier": { "@id": "ds:tier", "@type": "@id" },
|
|
31
30
|
"properties": {
|
|
32
|
-
"@id": "
|
|
31
|
+
"@id": "ds:hasProperty",
|
|
33
32
|
"@inline": {
|
|
34
33
|
"table": "properties",
|
|
35
|
-
"class": "
|
|
34
|
+
"class": "ds:Property",
|
|
36
35
|
"properties": {
|
|
37
|
-
"property name": "
|
|
38
|
-
"type": "
|
|
39
|
-
"
|
|
40
|
-
"optional": "
|
|
41
|
-
"default": "
|
|
36
|
+
"property name": "ds:name",
|
|
37
|
+
"type": "ds:propertyType",
|
|
38
|
+
"summary": "ds:summary",
|
|
39
|
+
"optional": "ds:optional",
|
|
40
|
+
"default": "ds:defaultValue"
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
},
|
|
45
|
-
"modifier_families": { "@id": "
|
|
44
|
+
"modifier_families": { "@id": "ds:hasModifierFamily", "@type": "@id", "@container": "@set" }
|
|
46
45
|
},
|
|
47
46
|
"class": "{type}",
|
|
48
|
-
"uriTemplate": "{uri}"
|
|
47
|
+
"uriTemplate": "{uri}",
|
|
48
|
+
"classProperties": {
|
|
49
|
+
"ds:Layout": {
|
|
50
|
+
"layout_grid_template": "ds:grid",
|
|
51
|
+
"layout_information_domain": "ds:domain"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
49
54
|
},
|
|
50
55
|
"tiers": {
|
|
51
56
|
"@context": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"name": "dso:name"
|
|
57
|
+
"ds": "https://ds.canonical.com/",
|
|
58
|
+
"name": "ds:name"
|
|
55
59
|
},
|
|
56
|
-
"class": "
|
|
60
|
+
"class": "ds:Tier",
|
|
57
61
|
"uriTemplate": "{uri}"
|
|
58
62
|
},
|
|
59
63
|
"modifierFamilies": {
|
|
60
64
|
"@context": {
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"tier": { "@id": "dso:tier", "@type": "@id" }
|
|
65
|
+
"ds": "https://ds.canonical.com/",
|
|
66
|
+
"name": "ds:name",
|
|
67
|
+
"summary": "ds:summary",
|
|
68
|
+
"tier": { "@id": "ds:tier", "@type": "@id" }
|
|
66
69
|
},
|
|
67
|
-
"class": "
|
|
70
|
+
"class": "ds:ModifierFamily",
|
|
68
71
|
"uriTemplate": "{uri}"
|
|
69
72
|
},
|
|
70
73
|
"modifiers": {
|
|
71
74
|
"@context": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"family": { "@id": "dso:modifierFamily", "@type": "@id" }
|
|
75
|
+
"ds": "https://ds.canonical.com/",
|
|
76
|
+
"name": "ds:name",
|
|
77
|
+
"summary": "ds:summary",
|
|
78
|
+
"family": { "@id": "ds:modifierFamily", "@type": "@id" }
|
|
77
79
|
},
|
|
78
|
-
"class": "
|
|
80
|
+
"class": "ds:Modifier",
|
|
79
81
|
"uriTemplate": "{uri}"
|
|
80
82
|
}
|
|
81
83
|
},
|
|
82
84
|
"references": {
|
|
83
85
|
"uiBlockTypes": {
|
|
84
|
-
"uriTemplate": "
|
|
86
|
+
"uriTemplate": "ds:{name}",
|
|
85
87
|
"keyColumn": "name"
|
|
86
88
|
},
|
|
87
89
|
"tiers": {
|
|
@@ -9,7 +9,7 @@ describe("generateLibraryTurtle", () => {
|
|
|
9
9
|
link: "https://github.com/example/test",
|
|
10
10
|
prefix: {
|
|
11
11
|
short: "ds",
|
|
12
|
-
namespace: "https://ds.canonical.com/
|
|
12
|
+
namespace: "https://ds.canonical.com/",
|
|
13
13
|
},
|
|
14
14
|
pattern: "src/**/*.tsx",
|
|
15
15
|
};
|
|
@@ -17,13 +17,12 @@ describe("generateLibraryTurtle", () => {
|
|
|
17
17
|
it("should generate valid Turtle for minimal config", async () => {
|
|
18
18
|
const ttl = await generateLibraryTurtle(minimalConfig);
|
|
19
19
|
|
|
20
|
-
expect(ttl).toContain("@prefix
|
|
21
|
-
expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/data/>");
|
|
20
|
+
expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/>");
|
|
22
21
|
expect(ttl).toContain("ds:implementation.library.test-library");
|
|
23
|
-
expect(ttl).toContain("a
|
|
24
|
-
expect(ttl).toContain('
|
|
25
|
-
expect(ttl).toContain('
|
|
26
|
-
expect(ttl).toContain('
|
|
22
|
+
expect(ttl).toContain("a ds:ImplementationLibrary");
|
|
23
|
+
expect(ttl).toContain('ds:libraryName "Test Library"');
|
|
24
|
+
expect(ttl).toContain('ds:platform "react"');
|
|
25
|
+
expect(ttl).toContain('ds:link "https://github.com/example/test"');
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
it("should include optional properties when provided", async () => {
|
|
@@ -36,9 +35,9 @@ describe("generateLibraryTurtle", () => {
|
|
|
36
35
|
|
|
37
36
|
const ttl = await generateLibraryTurtle(fullConfig);
|
|
38
37
|
|
|
39
|
-
expect(ttl).toContain('
|
|
40
|
-
expect(ttl).toContain('
|
|
41
|
-
expect(ttl).toContain("
|
|
38
|
+
expect(ttl).toContain('ds:libraryDescription "A test library"');
|
|
39
|
+
expect(ttl).toContain('ds:documentation "https://docs.example.com"');
|
|
40
|
+
expect(ttl).toContain("ds:libraryTier ds:global");
|
|
42
41
|
});
|
|
43
42
|
|
|
44
43
|
it("should slugify library name for URI", async () => {
|
|
@@ -52,18 +51,6 @@ describe("generateLibraryTurtle", () => {
|
|
|
52
51
|
expect(ttl).toContain("ds:implementation.library.pragma-react-components");
|
|
53
52
|
});
|
|
54
53
|
|
|
55
|
-
it("should throw error when using reserved prefix 'dso'", () => {
|
|
56
|
-
const config: CollectConfig = {
|
|
57
|
-
...minimalConfig,
|
|
58
|
-
prefix: {
|
|
59
|
-
short: "dso",
|
|
60
|
-
namespace: "https://example.com/data/",
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
expect(() => generateLibraryTurtle(config)).toThrow('Prefix "dso" is reserved');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
54
|
it("should throw error when using reserved prefix 'rdf'", () => {
|
|
68
55
|
const config: CollectConfig = {
|
|
69
56
|
...minimalConfig,
|
|
@@ -87,7 +74,6 @@ describe("generateLibraryTurtle", () => {
|
|
|
87
74
|
|
|
88
75
|
const ttl = await generateLibraryTurtle(config);
|
|
89
76
|
expect(ttl).toContain("@prefix myprefix: <https://example.com/data/>");
|
|
90
|
-
expect(ttl).toContain("@prefix dso: <https://ds.canonical.com/ontology#>");
|
|
91
77
|
});
|
|
92
78
|
});
|
|
93
79
|
|
|
@@ -98,7 +84,7 @@ describe("generateObjectsTurtle", () => {
|
|
|
98
84
|
link: "https://github.com/example/test",
|
|
99
85
|
prefix: {
|
|
100
86
|
short: "ds",
|
|
101
|
-
namespace: "https://ds.canonical.com/
|
|
87
|
+
namespace: "https://ds.canonical.com/",
|
|
102
88
|
},
|
|
103
89
|
pattern: "src/**/*.tsx",
|
|
104
90
|
};
|
|
@@ -118,13 +104,10 @@ describe("generateObjectsTurtle", () => {
|
|
|
118
104
|
|
|
119
105
|
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
120
106
|
|
|
121
|
-
expect(ttl).toContain("@prefix
|
|
122
|
-
|
|
123
|
-
expect(ttl).toContain("ds:
|
|
124
|
-
expect(ttl).toContain(
|
|
125
|
-
expect(ttl).toContain("dso:library ds:implementation.library.test-library");
|
|
126
|
-
expect(ttl).toContain("dso:implementsBlock ds:global.component.button");
|
|
127
|
-
expect(ttl).toContain('dso:headLink "src/components/Button.tsx"');
|
|
107
|
+
expect(ttl).toContain("@prefix ds: <https://ds.canonical.com/>");
|
|
108
|
+
expect(ttl).toContain("a ds:ImplementationObject");
|
|
109
|
+
expect(ttl).toContain("ds:implementsBlock ds:global.component.button");
|
|
110
|
+
expect(ttl).toContain('ds:headLink "src/components/Button.tsx"');
|
|
128
111
|
});
|
|
129
112
|
|
|
130
113
|
it("should include version when provided", async () => {
|
|
@@ -138,7 +121,7 @@ describe("generateObjectsTurtle", () => {
|
|
|
138
121
|
|
|
139
122
|
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
140
123
|
|
|
141
|
-
expect(ttl).toContain('
|
|
124
|
+
expect(ttl).toContain('ds:implementationVersion "1.2.3"');
|
|
142
125
|
});
|
|
143
126
|
|
|
144
127
|
it("should include isDraft when true", async () => {
|
|
@@ -152,7 +135,7 @@ describe("generateObjectsTurtle", () => {
|
|
|
152
135
|
|
|
153
136
|
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
154
137
|
|
|
155
|
-
expect(ttl).toContain('
|
|
138
|
+
expect(ttl).toContain('ds:isDraft "true"');
|
|
156
139
|
});
|
|
157
140
|
|
|
158
141
|
it("should generate multiple implementation objects", async () => {
|
|
@@ -175,10 +158,10 @@ describe("generateObjectsTurtle", () => {
|
|
|
175
158
|
|
|
176
159
|
const ttl = await generateObjectsTurtle(config, annotations, "/base");
|
|
177
160
|
|
|
178
|
-
//
|
|
179
|
-
expect(ttl).toContain("ds:
|
|
180
|
-
expect(ttl).toContain("ds:
|
|
181
|
-
expect(ttl).toContain("ds:
|
|
161
|
+
// Check that all annotations are included
|
|
162
|
+
expect(ttl).toContain("ds:global.component.button");
|
|
163
|
+
expect(ttl).toContain("ds:global.component.card");
|
|
164
|
+
expect(ttl).toContain("ds:global.pattern.modal");
|
|
182
165
|
});
|
|
183
166
|
|
|
184
167
|
it("should use relative paths for headLink", async () => {
|
|
@@ -195,6 +178,6 @@ describe("generateObjectsTurtle", () => {
|
|
|
195
178
|
"/project/packages/react",
|
|
196
179
|
);
|
|
197
180
|
|
|
198
|
-
expect(ttl).toContain('
|
|
181
|
+
expect(ttl).toContain('ds:headLink "src/deep/nested/Component.tsx"');
|
|
199
182
|
});
|
|
200
183
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
1
|
+
import { readFile, writeFile, mkdir, rm, readdir } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import type { Config } from "../config/types.js";
|
|
4
4
|
import transformData from "../transform/transform.js";
|
|
@@ -25,12 +25,12 @@ async function loadExtractedData(inputPath: string): Promise<ExtractedData> {
|
|
|
25
25
|
* Parse URI into path components for file organization
|
|
26
26
|
*
|
|
27
27
|
* Splits dot-separated URI path into folder structure:
|
|
28
|
-
* "https://ds.canonical.com/
|
|
28
|
+
* "https://ds.canonical.com/global.component.button" -> ["global", "component", "button"]
|
|
29
29
|
*
|
|
30
30
|
* Returns array of path parts, or null if URI doesn't match expected format
|
|
31
31
|
*/
|
|
32
32
|
function parseUri(uri: string): string[] | null {
|
|
33
|
-
const dsNamespace = "https://ds.canonical.com/
|
|
33
|
+
const dsNamespace = "https://ds.canonical.com/";
|
|
34
34
|
|
|
35
35
|
if (!uri.startsWith(dsNamespace)) {
|
|
36
36
|
return null;
|
|
@@ -39,9 +39,32 @@ function parseUri(uri: string): string[] | null {
|
|
|
39
39
|
const path = uri.slice(dsNamespace.length);
|
|
40
40
|
const parts = path.split(".");
|
|
41
41
|
|
|
42
|
+
// Reject URIs with empty segments (e.g. double dots from unresolved templates)
|
|
43
|
+
if (parts.some((p) => p === "")) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
return parts.length > 0 ? parts : null;
|
|
43
48
|
}
|
|
44
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Remove all generated RDF files from the output directory tree.
|
|
52
|
+
* Called before writing new output to avoid stale files accumulating.
|
|
53
|
+
*/
|
|
54
|
+
async function cleanOutputDir(outputDir: string, ext: string): Promise<void> {
|
|
55
|
+
let entries: Awaited<ReturnType<typeof readdir>>;
|
|
56
|
+
try {
|
|
57
|
+
entries = await readdir(outputDir, { withFileTypes: true, recursive: true });
|
|
58
|
+
} catch {
|
|
59
|
+
return; // Directory doesn't exist yet
|
|
60
|
+
}
|
|
61
|
+
await Promise.all(
|
|
62
|
+
entries
|
|
63
|
+
.filter((e) => e.isFile() && e.name.endsWith(`.${ext}`))
|
|
64
|
+
.map((e) => rm(join(e.parentPath ?? e.path, e.name), { force: true })),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
45
68
|
/**
|
|
46
69
|
* Transforms extracted data into RDF and serializes to files
|
|
47
70
|
*/
|
|
@@ -62,6 +85,7 @@ export default async function transform(config: Config): Promise<void> {
|
|
|
62
85
|
const ext = isTurtle ? "ttl" : "jsonld";
|
|
63
86
|
|
|
64
87
|
await mkdir(config.transform.outputDir, { recursive: true });
|
|
88
|
+
await cleanOutputDir(config.transform.outputDir, ext);
|
|
65
89
|
|
|
66
90
|
if (config.transform.atomicity === "class") {
|
|
67
91
|
// One file per table - serialize all subjects together
|
|
@@ -89,6 +89,15 @@
|
|
|
89
89
|
"uriTemplate": {
|
|
90
90
|
"type": "string",
|
|
91
91
|
"description": "URI template with {ColumnName} placeholders"
|
|
92
|
+
},
|
|
93
|
+
"classProperties": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"additionalProperties": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"additionalProperties": { "type": "string" },
|
|
98
|
+
"description": "Column→predicate literal mappings for this class"
|
|
99
|
+
},
|
|
100
|
+
"description": "Additional literal column→predicate mappings applied only when the resolved class matches the key (prefixed form, e.g. 'ds:Layout')"
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
103
|
},
|
package/src/config/types.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface TableTransform {
|
|
|
56
56
|
"@context": JsonLdContext;
|
|
57
57
|
class: string;
|
|
58
58
|
uriTemplate: string;
|
|
59
|
+
/**
|
|
60
|
+
* Additional literal column→predicate mappings applied only when the
|
|
61
|
+
* resolved RDF class matches the key (prefixed form, e.g. "ds:Layout").
|
|
62
|
+
* Values in the inner map are `{ columnName: predicate }` pairs and are
|
|
63
|
+
* treated as plain string literals (same semantics as a bare string in @context).
|
|
64
|
+
*/
|
|
65
|
+
classProperties?: Record<string, Record<string, string>>;
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
/**
|
package/src/constants.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* RDF namespace URIs used throughout the application
|
|
3
3
|
*/
|
|
4
4
|
export const NAMESPACES = {
|
|
5
|
-
ds: "https://ds.canonical.com/
|
|
6
|
-
dso: "https://ds.canonical.com/ontology#",
|
|
5
|
+
ds: "https://ds.canonical.com/",
|
|
7
6
|
rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
8
7
|
} as const;
|
|
9
8
|
|
|
@@ -12,9 +11,9 @@ export const NAMESPACES = {
|
|
|
12
11
|
*/
|
|
13
12
|
export const PREDICATES = {
|
|
14
13
|
type: `${NAMESPACES.rdf}type`,
|
|
15
|
-
name: `${NAMESPACES.
|
|
16
|
-
|
|
17
|
-
tier: `${NAMESPACES.
|
|
18
|
-
properties: `${NAMESPACES.
|
|
19
|
-
hasModifierFamily: `${NAMESPACES.
|
|
14
|
+
name: `${NAMESPACES.ds}name`,
|
|
15
|
+
summary: `${NAMESPACES.ds}summary`,
|
|
16
|
+
tier: `${NAMESPACES.ds}tier`,
|
|
17
|
+
properties: `${NAMESPACES.ds}properties`,
|
|
18
|
+
hasModifierFamily: `${NAMESPACES.ds}hasModifierFamily`,
|
|
20
19
|
} as const;
|