@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
|
@@ -6,7 +6,7 @@ describe("GraphStore", () => {
|
|
|
6
6
|
it("should add a quad with URI object", () => {
|
|
7
7
|
const store = new GraphStore();
|
|
8
8
|
|
|
9
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
9
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
10
10
|
|
|
11
11
|
expect(store.size()).toBe(1);
|
|
12
12
|
});
|
|
@@ -14,7 +14,7 @@ describe("GraphStore", () => {
|
|
|
14
14
|
it("should add a quad with literal object", () => {
|
|
15
15
|
const store = new GraphStore();
|
|
16
16
|
|
|
17
|
-
store.addLiteral("ds:button", "
|
|
17
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
18
18
|
|
|
19
19
|
expect(store.size()).toBe(1);
|
|
20
20
|
});
|
|
@@ -22,9 +22,9 @@ describe("GraphStore", () => {
|
|
|
22
22
|
it("should add multiple quads", () => {
|
|
23
23
|
const store = new GraphStore();
|
|
24
24
|
|
|
25
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
26
|
-
store.addLiteral("ds:button", "
|
|
27
|
-
store.addQuad("ds:button", "
|
|
25
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
26
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
27
|
+
store.addQuad("ds:button", "ds:tier", "ds:global");
|
|
28
28
|
|
|
29
29
|
expect(store.size()).toBe(3);
|
|
30
30
|
});
|
|
@@ -33,8 +33,8 @@ describe("GraphStore", () => {
|
|
|
33
33
|
describe("getQuads", () => {
|
|
34
34
|
it("should return all quads", () => {
|
|
35
35
|
const store = new GraphStore();
|
|
36
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
37
|
-
store.addLiteral("ds:button", "
|
|
36
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
37
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
38
38
|
|
|
39
39
|
const quads = store.getQuads();
|
|
40
40
|
|
|
@@ -53,9 +53,9 @@ describe("GraphStore", () => {
|
|
|
53
53
|
describe("getQuadsForSubject", () => {
|
|
54
54
|
it("should return quads for a specific subject", () => {
|
|
55
55
|
const store = new GraphStore();
|
|
56
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
57
|
-
store.addLiteral("ds:button", "
|
|
58
|
-
store.addQuad("ds:input", "rdf:type", "
|
|
56
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
57
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
58
|
+
store.addQuad("ds:input", "rdf:type", "ds:Component");
|
|
59
59
|
|
|
60
60
|
const quads = store.getQuadsForSubject("ds:button");
|
|
61
61
|
|
|
@@ -64,7 +64,7 @@ describe("GraphStore", () => {
|
|
|
64
64
|
|
|
65
65
|
it("should return empty array for unknown subject", () => {
|
|
66
66
|
const store = new GraphStore();
|
|
67
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
67
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
68
68
|
|
|
69
69
|
const quads = store.getQuadsForSubject("ds:unknown");
|
|
70
70
|
|
|
@@ -75,9 +75,9 @@ describe("GraphStore", () => {
|
|
|
75
75
|
describe("getSubjects", () => {
|
|
76
76
|
it("should return unique subjects", () => {
|
|
77
77
|
const store = new GraphStore();
|
|
78
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
79
|
-
store.addLiteral("ds:button", "
|
|
80
|
-
store.addQuad("ds:input", "rdf:type", "
|
|
78
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
79
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
80
|
+
store.addQuad("ds:input", "rdf:type", "ds:Component");
|
|
81
81
|
|
|
82
82
|
const subjects = store.getSubjects();
|
|
83
83
|
|
|
@@ -90,7 +90,7 @@ describe("GraphStore", () => {
|
|
|
90
90
|
describe("getN3Store", () => {
|
|
91
91
|
it("should return underlying n3 store for serializers", () => {
|
|
92
92
|
const store = new GraphStore();
|
|
93
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
93
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
94
94
|
|
|
95
95
|
const n3Store = store.getN3Store();
|
|
96
96
|
|
|
@@ -102,8 +102,8 @@ describe("GraphStore", () => {
|
|
|
102
102
|
describe("clear", () => {
|
|
103
103
|
it("should remove all quads", () => {
|
|
104
104
|
const store = new GraphStore();
|
|
105
|
-
store.addQuad("ds:button", "rdf:type", "
|
|
106
|
-
store.addLiteral("ds:button", "
|
|
105
|
+
store.addQuad("ds:button", "rdf:type", "ds:Component");
|
|
106
|
+
store.addLiteral("ds:button", "ds:name", "Button");
|
|
107
107
|
|
|
108
108
|
store.clear();
|
|
109
109
|
|
|
@@ -125,7 +125,7 @@ describe("GraphStore", () => {
|
|
|
125
125
|
const store = new GraphStore();
|
|
126
126
|
const bn = store.createBlankNode();
|
|
127
127
|
|
|
128
|
-
store.addBlankNodeQuad("ds:button", "
|
|
128
|
+
store.addBlankNodeQuad("ds:button", "ds:hasProperty", bn);
|
|
129
129
|
|
|
130
130
|
expect(store.size()).toBe(1);
|
|
131
131
|
const quads = store.getQuads();
|
|
@@ -136,9 +136,9 @@ describe("GraphStore", () => {
|
|
|
136
136
|
const store = new GraphStore();
|
|
137
137
|
const bn = store.createBlankNode();
|
|
138
138
|
|
|
139
|
-
store.addBlankNodeQuad("ds:button", "
|
|
140
|
-
store.addLiteralFromBlankNode(bn, "
|
|
141
|
-
store.addQuadFromBlankNode(bn, "rdf:type", "
|
|
139
|
+
store.addBlankNodeQuad("ds:button", "ds:hasProperty", bn);
|
|
140
|
+
store.addLiteralFromBlankNode(bn, "ds:name", "content");
|
|
141
|
+
store.addQuadFromBlankNode(bn, "rdf:type", "ds:Property");
|
|
142
142
|
|
|
143
143
|
expect(store.size()).toBe(3);
|
|
144
144
|
});
|
|
@@ -147,8 +147,8 @@ describe("GraphStore", () => {
|
|
|
147
147
|
const store = new GraphStore();
|
|
148
148
|
const bn = store.createBlankNode();
|
|
149
149
|
|
|
150
|
-
store.addBlankNodeQuad("ds:button", "
|
|
151
|
-
store.addLiteralFromBlankNode(bn, "
|
|
150
|
+
store.addBlankNodeQuad("ds:button", "ds:hasProperty", bn);
|
|
151
|
+
store.addLiteralFromBlankNode(bn, "ds:name", "content");
|
|
152
152
|
|
|
153
153
|
const quads = store.getQuads();
|
|
154
154
|
expect(quads).toHaveLength(2);
|
package/src/graph/GraphStore.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default class GraphStore {
|
|
|
20
20
|
* Add a quad with a URI object
|
|
21
21
|
* @param subject - Subject URI (e.g., "ds:button")
|
|
22
22
|
* @param predicate - Predicate URI (e.g., "rdf:type")
|
|
23
|
-
* @param object - Object URI (e.g., "
|
|
23
|
+
* @param object - Object URI (e.g., "ds:Component")
|
|
24
24
|
*/
|
|
25
25
|
addQuad(subject: string, predicate: string, object: string): void {
|
|
26
26
|
this.store.addQuad(
|
|
@@ -36,7 +36,7 @@ export default class GraphStore {
|
|
|
36
36
|
/**
|
|
37
37
|
* Add a quad with a literal object
|
|
38
38
|
* @param subject - Subject URI (e.g., "ds:button")
|
|
39
|
-
* @param predicate - Predicate URI (e.g., "
|
|
39
|
+
* @param predicate - Predicate URI (e.g., "ds:name")
|
|
40
40
|
* @param value - Literal string value
|
|
41
41
|
*/
|
|
42
42
|
addLiteral(subject: string, predicate: string, value: string): void {
|
|
@@ -6,9 +6,9 @@ describe("PrefixMap", () => {
|
|
|
6
6
|
describe("add and get", () => {
|
|
7
7
|
it("should store and retrieve a prefix", () => {
|
|
8
8
|
const pm = new PrefixMap();
|
|
9
|
-
pm.add("
|
|
9
|
+
pm.add("ds", NAMESPACES.ds);
|
|
10
10
|
|
|
11
|
-
expect(pm.get("
|
|
11
|
+
expect(pm.get("ds")).toBe(NAMESPACES.ds);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("should return undefined for unknown prefix", () => {
|
|
@@ -21,9 +21,9 @@ describe("PrefixMap", () => {
|
|
|
21
21
|
describe("expand", () => {
|
|
22
22
|
it("should expand prefixed URI to full URI", () => {
|
|
23
23
|
const pm = new PrefixMap();
|
|
24
|
-
pm.add("
|
|
24
|
+
pm.add("ds", NAMESPACES.ds);
|
|
25
25
|
|
|
26
|
-
expect(pm.expand("
|
|
26
|
+
expect(pm.expand("ds:name")).toBe(`${NAMESPACES.ds}name`);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
it("should return original if no colon", () => {
|
|
@@ -51,9 +51,9 @@ describe("PrefixMap", () => {
|
|
|
51
51
|
describe("compact", () => {
|
|
52
52
|
it("should compact full URI to prefixed form", () => {
|
|
53
53
|
const pm = new PrefixMap();
|
|
54
|
-
pm.add("
|
|
54
|
+
pm.add("ds", NAMESPACES.ds);
|
|
55
55
|
|
|
56
|
-
expect(pm.compact(`${NAMESPACES.
|
|
56
|
+
expect(pm.compact(`${NAMESPACES.ds}name`)).toBe("ds:name");
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it("should return original if no matching prefix", () => {
|
|
@@ -74,27 +74,27 @@ describe("PrefixMap", () => {
|
|
|
74
74
|
describe("fromContext", () => {
|
|
75
75
|
it("should extract prefixes from JSON-LD context", () => {
|
|
76
76
|
const context = {
|
|
77
|
-
dso: NAMESPACES.dso,
|
|
78
77
|
ds: NAMESPACES.ds,
|
|
79
|
-
|
|
78
|
+
rdf: NAMESPACES.rdf,
|
|
79
|
+
name: "ds:name",
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
const pm = PrefixMap.fromContext(context);
|
|
83
83
|
|
|
84
|
-
expect(pm.get("dso")).toBe(NAMESPACES.dso);
|
|
85
84
|
expect(pm.get("ds")).toBe(NAMESPACES.ds);
|
|
85
|
+
expect(pm.get("rdf")).toBe(NAMESPACES.rdf);
|
|
86
86
|
expect(pm.get("name")).toBeUndefined(); // Not a namespace
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it("should ignore non-URI values", () => {
|
|
90
90
|
const context = {
|
|
91
|
-
|
|
92
|
-
name: { "@id": "
|
|
91
|
+
ds: NAMESPACES.ds,
|
|
92
|
+
name: { "@id": "ds:name" },
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
const pm = PrefixMap.fromContext(context);
|
|
96
96
|
|
|
97
|
-
expect(pm.get("
|
|
97
|
+
expect(pm.get("ds")).toBe(NAMESPACES.ds);
|
|
98
98
|
expect(pm.get("name")).toBeUndefined();
|
|
99
99
|
});
|
|
100
100
|
});
|
|
@@ -102,27 +102,27 @@ describe("PrefixMap", () => {
|
|
|
102
102
|
describe("entries", () => {
|
|
103
103
|
it("should iterate over all prefixes", () => {
|
|
104
104
|
const pm = new PrefixMap();
|
|
105
|
-
pm.add("dso", NAMESPACES.dso);
|
|
106
105
|
pm.add("ds", NAMESPACES.ds);
|
|
106
|
+
pm.add("rdf", NAMESPACES.rdf);
|
|
107
107
|
|
|
108
108
|
const entries = Array.from(pm.entries());
|
|
109
109
|
|
|
110
|
-
expect(entries).toContainEqual(["dso", NAMESPACES.dso]);
|
|
111
110
|
expect(entries).toContainEqual(["ds", NAMESPACES.ds]);
|
|
111
|
+
expect(entries).toContainEqual(["rdf", NAMESPACES.rdf]);
|
|
112
112
|
});
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
describe("toRecord", () => {
|
|
116
116
|
it("should convert to plain object for n3", () => {
|
|
117
117
|
const pm = new PrefixMap();
|
|
118
|
-
pm.add("dso", NAMESPACES.dso);
|
|
119
118
|
pm.add("ds", NAMESPACES.ds);
|
|
119
|
+
pm.add("rdf", NAMESPACES.rdf);
|
|
120
120
|
|
|
121
121
|
const record = pm.toRecord();
|
|
122
122
|
|
|
123
123
|
expect(record).toEqual({
|
|
124
|
-
dso: NAMESPACES.dso,
|
|
125
124
|
ds: NAMESPACES.ds,
|
|
125
|
+
rdf: NAMESPACES.rdf,
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
});
|
package/src/graph/PrefixMap.ts
CHANGED
|
@@ -23,22 +23,24 @@ describe("buildUri", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
describe("URI-safe conversion", () => {
|
|
26
|
-
it("should
|
|
26
|
+
it("should preserve case for ds: prefix (ontology prefix)", () => {
|
|
27
27
|
const template = "ds:{name}";
|
|
28
28
|
const row = { name: "Button" };
|
|
29
29
|
|
|
30
30
|
const uri = buildUri(template, row);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// ds: is treated as an ontology prefix, preserves case
|
|
33
|
+
expect(uri).toBe("ds:Button");
|
|
33
34
|
});
|
|
34
35
|
|
|
35
|
-
it("should replace spaces with hyphens", () => {
|
|
36
|
+
it("should replace spaces with hyphens for ds: prefix", () => {
|
|
36
37
|
const template = "ds:{name}";
|
|
37
38
|
const row = { name: "My Button" };
|
|
38
39
|
|
|
39
40
|
const uri = buildUri(template, row);
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
// ds: is an ontology prefix, preserves case but replaces spaces
|
|
43
|
+
expect(uri).toBe("ds:My-Button");
|
|
42
44
|
});
|
|
43
45
|
|
|
44
46
|
it("should preserve dots for versions", () => {
|
|
@@ -50,13 +52,24 @@ describe("buildUri", () => {
|
|
|
50
52
|
expect(uri).toBe("ds:1.0.0");
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
it("should remove special characters", () => {
|
|
55
|
+
it("should remove special characters but preserve case for ds:", () => {
|
|
54
56
|
const template = "ds:{name}";
|
|
55
57
|
const row = { name: "Button (Primary)" };
|
|
56
58
|
|
|
57
59
|
const uri = buildUri(template, row);
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
// ds: is an ontology prefix, preserves case
|
|
62
|
+
expect(uri).toBe("ds:Button-Primary");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("should lowercase for non-ontology prefixes", () => {
|
|
66
|
+
const template = "ex:{name}";
|
|
67
|
+
const row = { name: "Button" };
|
|
68
|
+
|
|
69
|
+
const uri = buildUri(template, row);
|
|
70
|
+
|
|
71
|
+
// ex: is not an ontology prefix, lowercases values
|
|
72
|
+
expect(uri).toBe("ex:button");
|
|
60
73
|
});
|
|
61
74
|
});
|
|
62
75
|
|
|
@@ -110,13 +123,13 @@ describe("buildUri", () => {
|
|
|
110
123
|
});
|
|
111
124
|
|
|
112
125
|
describe("ontology namespace templates", () => {
|
|
113
|
-
it("should preserve case for
|
|
114
|
-
const template = "
|
|
126
|
+
it("should preserve case for ds: prefix", () => {
|
|
127
|
+
const template = "ds:{Name}";
|
|
115
128
|
const row = { Name: "Component" };
|
|
116
129
|
|
|
117
130
|
const uri = buildUri(template, row);
|
|
118
131
|
|
|
119
|
-
expect(uri).toBe("
|
|
132
|
+
expect(uri).toBe("ds:Component");
|
|
120
133
|
});
|
|
121
134
|
|
|
122
135
|
it("should preserve case for rdf: prefix", () => {
|
|
@@ -138,21 +151,21 @@ describe("buildUri", () => {
|
|
|
138
151
|
});
|
|
139
152
|
|
|
140
153
|
it("should still replace spaces with hyphens in ontology URIs", () => {
|
|
141
|
-
const template = "
|
|
154
|
+
const template = "ds:{Name}";
|
|
142
155
|
const row = { Name: "My Component" };
|
|
143
156
|
|
|
144
157
|
const uri = buildUri(template, row);
|
|
145
158
|
|
|
146
|
-
expect(uri).toBe("
|
|
159
|
+
expect(uri).toBe("ds:My-Component");
|
|
147
160
|
});
|
|
148
161
|
|
|
149
162
|
it("should remove special characters in ontology URIs", () => {
|
|
150
|
-
const template = "
|
|
163
|
+
const template = "ds:{Name}";
|
|
151
164
|
const row = { Name: "Component (Type)" };
|
|
152
165
|
|
|
153
166
|
const uri = buildUri(template, row);
|
|
154
167
|
|
|
155
|
-
expect(uri).toBe("
|
|
168
|
+
expect(uri).toBe("ds:Component-Type");
|
|
156
169
|
});
|
|
157
170
|
});
|
|
158
171
|
});
|
package/src/graph/buildUri.ts
CHANGED
|
@@ -19,12 +19,24 @@ function toUriSafe(str: string, lowercase = true): string {
|
|
|
19
19
|
/**
|
|
20
20
|
* Check if a template is for an ontology namespace URI
|
|
21
21
|
* Ontology URIs should preserve the case of class/property names
|
|
22
|
-
* e.g., "
|
|
22
|
+
* e.g., "ds:{Name}" should produce "ds:Component", not "ds:component"
|
|
23
23
|
*/
|
|
24
24
|
function isOntologyTemplate(template: string): boolean {
|
|
25
|
-
// Common ontology namespace prefixes
|
|
26
|
-
const ontologyPrefixes = ["
|
|
27
|
-
|
|
25
|
+
// Common ontology namespace prefixes (ds: is the unified design system namespace)
|
|
26
|
+
const ontologyPrefixes = ["ds:", "rdf:", "rdfs:", "owl:", "xsd:", "skos:"];
|
|
27
|
+
// Also check for full namespace URIs
|
|
28
|
+
const ontologyNamespaces = [
|
|
29
|
+
"https://ds.canonical.com/",
|
|
30
|
+
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
31
|
+
"http://www.w3.org/2000/01/rdf-schema#",
|
|
32
|
+
"http://www.w3.org/2002/07/owl#",
|
|
33
|
+
"http://www.w3.org/2001/XMLSchema#",
|
|
34
|
+
"http://www.w3.org/2004/02/skos/core#",
|
|
35
|
+
];
|
|
36
|
+
return (
|
|
37
|
+
ontologyPrefixes.some((prefix) => template.startsWith(prefix)) ||
|
|
38
|
+
ontologyNamespaces.some((ns) => template.startsWith(ns))
|
|
39
|
+
);
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
/**
|
|
@@ -35,7 +47,7 @@ function isOntologyTemplate(template: string): boolean {
|
|
|
35
47
|
* If template is just a single column reference like "{uri}",
|
|
36
48
|
* returns the raw value without transformation.
|
|
37
49
|
*
|
|
38
|
-
* For ontology templates (
|
|
50
|
+
* For ontology templates (ds:, rdf:, etc.), preserves case of values.
|
|
39
51
|
*
|
|
40
52
|
* Otherwise, interpolates all placeholders and converts values
|
|
41
53
|
* to URI-safe format (lowercase, hyphens for spaces).
|
|
@@ -6,7 +6,7 @@ import serializeToJsonLd from "./JSONSerializer.js";
|
|
|
6
6
|
// Use realistic dot-separated URIs like the actual system
|
|
7
7
|
const buttonUri = `${NAMESPACES.ds}global.component.button`;
|
|
8
8
|
const inputUri = `${NAMESPACES.ds}global.component.input`;
|
|
9
|
-
const componentType = `${NAMESPACES.
|
|
9
|
+
const componentType = `${NAMESPACES.ds}Component`;
|
|
10
10
|
|
|
11
11
|
describe("serializeToJsonLd", () => {
|
|
12
12
|
it("should serialize a single subject to JSON-LD with compact URIs", async () => {
|
|
@@ -16,7 +16,6 @@ describe("serializeToJsonLd", () => {
|
|
|
16
16
|
|
|
17
17
|
const prefixes = new PrefixMap();
|
|
18
18
|
prefixes.add("ds", NAMESPACES.ds);
|
|
19
|
-
prefixes.add("dso", NAMESPACES.dso);
|
|
20
19
|
|
|
21
20
|
const doc = await serializeToJsonLd(store, {
|
|
22
21
|
prefixes,
|
|
@@ -27,7 +26,7 @@ describe("serializeToJsonLd", () => {
|
|
|
27
26
|
expect(doc["@id"]).toBe("ds:global.component.button");
|
|
28
27
|
// @type can be a string or array in JSON-LD
|
|
29
28
|
const type = doc["@type"];
|
|
30
|
-
expect(Array.isArray(type) ? type[0] : type).toBe("
|
|
29
|
+
expect(Array.isArray(type) ? type[0] : type).toBe("ds:Component");
|
|
31
30
|
});
|
|
32
31
|
|
|
33
32
|
it("should include context from prefixes", async () => {
|
|
@@ -36,7 +35,6 @@ describe("serializeToJsonLd", () => {
|
|
|
36
35
|
|
|
37
36
|
const prefixes = new PrefixMap();
|
|
38
37
|
prefixes.add("ds", NAMESPACES.ds);
|
|
39
|
-
prefixes.add("dso", NAMESPACES.dso);
|
|
40
38
|
|
|
41
39
|
const doc = await serializeToJsonLd(store, {
|
|
42
40
|
prefixes,
|
|
@@ -70,7 +68,6 @@ describe("serializeToJsonLd", () => {
|
|
|
70
68
|
|
|
71
69
|
const prefixes = new PrefixMap();
|
|
72
70
|
prefixes.add("ds", NAMESPACES.ds);
|
|
73
|
-
prefixes.add("dso", NAMESPACES.dso);
|
|
74
71
|
|
|
75
72
|
const docs = await serializeToJsonLd(store, { prefixes });
|
|
76
73
|
|
|
@@ -5,12 +5,11 @@ import serializeToTurtle from "./TTLSerializer.js";
|
|
|
5
5
|
|
|
6
6
|
const buttonUri = `${NAMESPACES.ds}button`;
|
|
7
7
|
const globalUri = `${NAMESPACES.ds}global`;
|
|
8
|
-
const componentType = `${NAMESPACES.
|
|
8
|
+
const componentType = `${NAMESPACES.ds}Component`;
|
|
9
9
|
|
|
10
10
|
function createPrefixMap(): PrefixMap {
|
|
11
11
|
const prefixes = new PrefixMap();
|
|
12
12
|
prefixes.add("ds", NAMESPACES.ds);
|
|
13
|
-
prefixes.add("dso", NAMESPACES.dso);
|
|
14
13
|
prefixes.add("rdf", NAMESPACES.rdf);
|
|
15
14
|
return prefixes;
|
|
16
15
|
}
|
|
@@ -33,7 +32,6 @@ describe("serializeToTurtle", () => {
|
|
|
33
32
|
const ttl = await serializeToTurtle(store, { prefixes });
|
|
34
33
|
|
|
35
34
|
expect(ttl).toContain("@prefix ds:");
|
|
36
|
-
expect(ttl).toContain("@prefix dso:");
|
|
37
35
|
expect(ttl).toContain("@prefix rdf:");
|
|
38
36
|
});
|
|
39
37
|
|
|
@@ -48,7 +46,7 @@ describe("serializeToTurtle", () => {
|
|
|
48
46
|
expect(ttl).toContain("ds:button");
|
|
49
47
|
// n3 uses 'a' shorthand for rdf:type in Turtle
|
|
50
48
|
expect(ttl).toMatch(/a |rdf:type/);
|
|
51
|
-
expect(ttl).toContain("
|
|
49
|
+
expect(ttl).toContain("ds:Component");
|
|
52
50
|
});
|
|
53
51
|
|
|
54
52
|
it("should serialize quads with literal objects", async () => {
|
|
@@ -22,8 +22,8 @@ function escapeRegex(str: string): string {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Convert named blank nodes to inline anonymous syntax
|
|
25
|
-
* Transforms: `
|
|
26
|
-
* Into: `
|
|
25
|
+
* Transforms: `ds:hasProperty _:n3-0.` + `_:n3-0 a ds:Property; ...`
|
|
26
|
+
* Into: `ds:hasProperty [ a ds:Property; ... ]`
|
|
27
27
|
*/
|
|
28
28
|
function inlineBlankNodes(turtle: string): string {
|
|
29
29
|
// Find all blank node definitions (blocks starting with _:... and ending with .)
|
|
@@ -54,10 +54,10 @@ describe("resolveReferences", () => {
|
|
|
54
54
|
const rows = [{ _codaId: "i-1", Name: "Component" }];
|
|
55
55
|
|
|
56
56
|
const map = resolveReferences(rows, {
|
|
57
|
-
uriTemplate: `${NAMESPACES.
|
|
57
|
+
uriTemplate: `${NAMESPACES.ds}{Name}`,
|
|
58
58
|
keyColumn: "Name",
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
expect(map.get("component")).toBe(`${NAMESPACES.
|
|
61
|
+
expect(map.get("component")).toBe(`${NAMESPACES.ds}Component`);
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -39,10 +39,9 @@ describe("transform", () => {
|
|
|
39
39
|
tables: {
|
|
40
40
|
uiBlocks: {
|
|
41
41
|
"@context": {
|
|
42
|
-
dso: NAMESPACES.dso,
|
|
43
42
|
ds: NAMESPACES.ds,
|
|
44
|
-
name: "
|
|
45
|
-
tier: { "@id": "
|
|
43
|
+
name: "ds:name",
|
|
44
|
+
tier: { "@id": "ds:tier", "@type": "@id" },
|
|
46
45
|
},
|
|
47
46
|
class: "{type}",
|
|
48
47
|
uriTemplate: "{uri}",
|
|
@@ -50,7 +49,7 @@ describe("transform", () => {
|
|
|
50
49
|
},
|
|
51
50
|
references: {
|
|
52
51
|
tiers: { uriTemplate: "{uri}", keyColumn: "name" },
|
|
53
|
-
uiBlockTypes: { uriTemplate: `${NAMESPACES.
|
|
52
|
+
uiBlockTypes: { uriTemplate: `${NAMESPACES.ds}{Name}`, keyColumn: "Name" },
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
55
|
|
|
@@ -86,14 +85,13 @@ describe("transform", () => {
|
|
|
86
85
|
const buttonQuads = store.getQuadsForSubject(`${NAMESPACES.ds}global:component:button`);
|
|
87
86
|
const typeQuad = buttonQuads.find((q) => q.predicate.value === PREDICATES.type);
|
|
88
87
|
|
|
89
|
-
// buildUri
|
|
90
|
-
expect(typeQuad?.object.value).toBe(`${NAMESPACES.
|
|
88
|
+
// buildUri preserves case for ds: prefix (ontology template)
|
|
89
|
+
expect(typeQuad?.object.value).toBe(`${NAMESPACES.ds}Component`);
|
|
91
90
|
});
|
|
92
91
|
|
|
93
92
|
it("should return prefixes from context", () => {
|
|
94
93
|
const { prefixes } = transform(config, extractedData);
|
|
95
94
|
|
|
96
|
-
expect(prefixes.get("dso")).toBe(NAMESPACES.dso);
|
|
97
95
|
expect(prefixes.get("ds")).toBe(NAMESPACES.ds);
|
|
98
96
|
});
|
|
99
97
|
});
|