contour-ds 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/build-manifest.json +205 -204
- package/dist/contour-wc-content.esm.js +1 -1
- package/dist/contour-wc-content.esm.min.js +1 -1
- package/dist/contour-wc-core.esm.js +712 -45
- package/dist/contour-wc-core.esm.min.js +1 -1
- package/dist/contour-wc-dashboard.esm.js +596 -90
- package/dist/contour-wc-dashboard.esm.min.js +1 -1
- package/dist/contour-wc-data.esm.js +467 -70
- package/dist/contour-wc-data.esm.min.js +1 -1
- package/dist/contour-wc-docs.esm.js +1 -1
- package/dist/contour-wc-docs.esm.min.js +1 -1
- package/dist/contour-wc-feedback.esm.js +260 -29
- package/dist/contour-wc-feedback.esm.min.js +1 -1
- package/dist/contour-wc-forms.esm.js +133 -40
- package/dist/contour-wc-forms.esm.min.js +1 -1
- package/dist/contour-wc-interaction.esm.js +64 -5
- package/dist/contour-wc-interaction.esm.min.js +1 -1
- package/dist/contour-wc-layout.esm.js +72 -10
- package/dist/contour-wc-layout.esm.min.js +1 -1
- package/dist/contour-wc-map.esm.js +69 -9
- package/dist/contour-wc-map.esm.min.js +1 -1
- package/dist/contour-wc-misc.esm.js +1 -1
- package/dist/contour-wc-misc.esm.min.js +1 -1
- package/dist/contour-wc-navigation.esm.js +136 -20
- package/dist/contour-wc-navigation.esm.min.js +1 -1
- package/dist/contour-wc-ui.esm.js +505 -80
- package/dist/contour-wc-ui.esm.min.js +1 -1
- package/dist/contour-wc.esm.js +2539 -320
- package/dist/contour-wc.esm.min.js +1 -1
- package/dist/contour-wc.js +2539 -320
- package/dist/contour-wc.min.js +1 -1
- package/dist/contour.code-snippets +44 -0
- package/dist/contour.components.json +12064 -135
- package/dist/contour.css +1368 -451
- package/dist/contour.d.ts +42 -21
- package/dist/contour.esm.js +138 -21
- package/dist/contour.esm.min.js +1 -1
- package/dist/contour.html-data.json +249 -9
- package/dist/contour.js +138 -21
- package/dist/contour.min.css +1 -1
- package/dist/contour.min.js +1 -1
- package/dist/contour.react.d.ts +5 -1
- package/dist/contour.single.html +2 -2
- package/dist/contour.single.min.css +1 -1
- package/dist/contour.tokens.json +36 -1
- package/dist/contour.vue.d.ts +5 -1
- package/dist/contour.web-types.json +241 -9
- package/dist/custom-elements.json +1225 -55
- package/dist/docs/actions.md +1 -1
- package/dist/docs/affordances.md +1 -1
- package/dist/docs/apireference.md +1 -1
- package/dist/docs/colour.md +1 -1
- package/dist/docs/componentindex.md +1 -1
- package/dist/docs/data.md +6 -2
- package/dist/docs/docs.md +1 -1
- package/dist/docs/feedback.md +1 -1
- package/dist/docs/field.md +1 -1
- package/dist/docs/forms.md +1 -1
- package/dist/docs/index.json +8 -8
- package/dist/docs/install.md +1 -1
- package/dist/docs/landing.md +1 -1
- package/dist/docs/mapengine.md +1 -1
- package/dist/docs/motion.md +1 -1
- package/dist/docs/navigation.md +1 -1
- package/dist/docs/overlays.md +1 -1
- package/dist/docs/overview.md +1 -1
- package/dist/docs/patterns.md +1 -1
- package/dist/docs/playground.md +1 -1
- package/dist/docs/principles.md +1 -1
- package/dist/docs/recipes.md +1 -1
- package/dist/docs/space.md +1 -1
- package/dist/docs/status.md +1 -1
- package/dist/docs/surfaces.md +1 -1
- package/dist/docs/theming.md +5 -2
- package/dist/docs/type.md +1 -1
- package/dist/docs/webcomponents.md +1 -1
- package/dist/hljs.css +34 -17
- package/dist/map-chrome-contract.json +26 -0
- package/dist/map-chrome.mapbox.css +121 -0
- package/dist/map-chrome.maplibre.css +121 -0
- package/dist/registry/items/contour-core.json +2 -2
- package/dist/registry/items/contour-data.json +2 -2
- package/dist/registry/items/contour-docs.json +2 -2
- package/dist/registry/items/contour-landing.json +2 -2
- package/dist/registry/registry.json +8 -8
- package/dist/surfaces/contour-core.min.css +1 -1
- package/dist/surfaces/contour-data.min.css +1 -1
- package/dist/surfaces/contour-docs.min.css +1 -1
- package/dist/surfaces/contour-landing.min.css +1 -1
- package/dist/wc/behaviours.mjs +11 -3
- package/dist/wc/core.mjs +307 -32
- package/dist/wc/dashboard.mjs +129 -20
- package/dist/wc/data-chart.mjs +170 -22
- package/dist/wc/data-export.mjs +150 -29
- package/dist/wc/data-gauge.mjs +11 -4
- package/dist/wc/data-geo.mjs +1 -1
- package/dist/wc/data-legend.mjs +15 -2
- package/dist/wc/data-readout.mjs +12 -1
- package/dist/wc/data-series.mjs +73 -5
- package/dist/wc/data-table.mjs +37 -8
- package/dist/wc/feedback.mjs +259 -28
- package/dist/wc/forms-controls.mjs +44 -16
- package/dist/wc/forms-field.mjs +46 -4
- package/dist/wc/forms-groups.mjs +31 -8
- package/dist/wc/forms-input.mjs +11 -11
- package/dist/wc/index.mjs +1 -1
- package/dist/wc/interaction.mjs +63 -4
- package/dist/wc/layout.mjs +72 -10
- package/dist/wc/map.mjs +68 -8
- package/dist/wc/navigation-menu.mjs +43 -9
- package/dist/wc/navigation-shell.mjs +39 -6
- package/dist/wc/navigation-tree.mjs +53 -4
- package/dist/wc/states.mjs +350 -9
- package/dist/wc/svg.mjs +43 -0
- package/dist/wc/ui-data.mjs +268 -28
- package/dist/wc/ui-feedback.mjs +36 -11
- package/dist/wc/ui-inputs.mjs +63 -25
- package/dist/wc/ui-overlays.mjs +138 -16
- package/integrations/ai/v0-prompt.md +1 -1
- package/integrations/frameworks/fixtures/authored/sample.jsx +15 -0
- package/integrations/frameworks/fixtures/authored/sample.vue +15 -0
- package/integrations/frameworks/fixtures/dist/rendered.html +32 -0
- package/integrations/libreship/contract.json +1025 -0
- package/integrations/native/README.md +24 -4
- package/integrations/native/build/android/colors.xml +278 -0
- package/integrations/native/build/flutter/contour_tokens.dart +280 -0
- package/integrations/native/build/ios/ContourTokens.swift +280 -0
- package/integrations/validate-markup.mjs +57 -7
- package/package.json +45 -18
package/dist/contour.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface ContourAlertElement extends ContourElement{title?:S;body?:S;var
|
|
|
19
19
|
export interface ContourAnalysisStackElement extends ContourElement{title?:S;heading?:S;}
|
|
20
20
|
export interface ContourAnchorElement extends ContourElement{href?:S;label?:S;}
|
|
21
21
|
export interface ContourAnimationControlsElement extends ContourElement{playing?:boolean;speed?:S;progress?:S;min?:S;max?:S;loop?:boolean;step?:S;markers?:S;}
|
|
22
|
-
export interface ContourAnnotationElement extends ContourElement{label?:S;x?:S;y?:S;}
|
|
22
|
+
export interface ContourAnnotationElement extends ContourElement{label?:S;x?:S;y?:S;kind?:S;locked?:boolean;}
|
|
23
23
|
export interface ContourAppElement extends ContourElement{title?:S;}
|
|
24
24
|
export interface ContourAvatarElement extends ContourElement{name?:S;size?:S;variant?:S;src?:S;status?:S;}
|
|
25
25
|
export interface ContourAvatarGroupElement extends ContourElement{items?:S;max?:number;}
|
|
@@ -66,8 +66,9 @@ export interface ContourDashKpiRowElement extends ContourDataElement{items?:S;}
|
|
|
66
66
|
export interface ContourDashShellElement extends ContourElement{title?:S;}
|
|
67
67
|
export interface ContourDashToolbarElement extends ContourElement{title?:S;actions?:S;}
|
|
68
68
|
export interface ContourDashboardGridElement extends ContourElement{cols?:S;gap?:S;}
|
|
69
|
-
export interface ContourDataExportElement extends ContourElement{data?:S;format?:S;filename?:S;label?:S;}
|
|
69
|
+
export interface ContourDataExportElement extends ContourElement{data?:S;format?:S;filename?:S;label?:S;scope?:S;crs?:S;provenance?:S;selected?:S;}
|
|
70
70
|
export interface ContourDataGridElement extends ContourDataElement{columns?:S;rows?:S;page?:S;filter?:S;"page-size"?:S;resizable?:boolean;virtual?:boolean;"row-height"?:S;loading?:S;error?:S;empty?:S;}
|
|
71
|
+
export interface ContourDataQualityElement extends ContourElement{label?:S;completeness?:number;freshness?:number;accuracy?:number;}
|
|
71
72
|
export interface ContourDataTableElement extends ContourDataElement{columns?:S;rows?:S;page?:number;pageSize?:number;}
|
|
72
73
|
export interface ContourDatamarkElement extends ContourElement{value?:S;unit?:S;label?:S;format?:S;locale?:S;}
|
|
73
74
|
export interface ContourDatePickerElement extends ContourFormElementBase{value?:S;range?:boolean;rangeStart?:S;rangeEnd?:S;label?:S;disabled?:boolean;error?:S;help?:S;time?:boolean;min?:S;max?:S;locale?:S;}
|
|
@@ -85,7 +86,7 @@ export interface ContourDocsShellElement extends ContourElement{title?:S;lede?:S
|
|
|
85
86
|
export interface ContourDonutElement extends ContourDataElement{value?:S;values?:S;items?:S;label?:S;color?:S;src?:S;note?:S;}
|
|
86
87
|
export interface ContourDonutGlyphElement extends ContourElement{size?:S;value?:S;color?:S;strokeWidth?:S;bgColor?:S;}
|
|
87
88
|
export interface ContourDotElement extends ContourElement{variant?:S;live?:boolean;}
|
|
88
|
-
export interface ContourDrawerElement extends ContourElement{title?:S;body?:S;size?:S;}
|
|
89
|
+
export interface ContourDrawerElement extends ContourElement{title?:S;body?:S;size?:S;mode?:S;}
|
|
89
90
|
export interface ContourDropIndicatorElement extends ContourElement{label?:S;open?:boolean;}
|
|
90
91
|
export interface ContourDropZoneElement extends ContourElement{label?:S;}
|
|
91
92
|
export interface ContourDropdownElement extends ContourElement{label?:S;items?:S;}
|
|
@@ -95,8 +96,8 @@ export interface ContourExpandableElement extends ContourElement{summary?:S;}
|
|
|
95
96
|
export interface ContourFabElement extends ContourElement{label?:S;icon?:S;}
|
|
96
97
|
export interface ContourFaqElement extends ContourElement{question?:S;answer?:S;items?:S;src?:S;}
|
|
97
98
|
export interface ContourFeatureElement extends ContourElement{index?:S;title?:S;body?:S;}
|
|
98
|
-
export interface ContourFeatureInspectorElement extends ContourElement{title?:S;open?:boolean;data?:S;}
|
|
99
|
-
export interface ContourFieldElement extends ContourElement{label?:S;hint?:S;error?:S;placeholder?:S;type?:S;required?:boolean;name?:S;value?:S;disabled?:boolean;customError?:S;}
|
|
99
|
+
export interface ContourFeatureInspectorElement extends ContourElement{title?:S;open?:boolean;data?:S;units?:S;types?:S;confidence?:S;}
|
|
100
|
+
export interface ContourFieldElement extends ContourElement{label?:S;hint?:S;error?:S;placeholder?:S;type?:S;required?:boolean;name?:S;value?:S;disabled?:boolean;customError?:S;min?:S;max?:S;step?:S;pattern?:S;minlength?:S;maxlength?:S;}
|
|
100
101
|
export interface ContourFieldGroupElement extends ContourElement{label?:S;hint?:S;error?:S;required?:boolean;}
|
|
101
102
|
export interface ContourFieldsetElement extends ContourElement{legend?:S;disabled?:boolean;}
|
|
102
103
|
export interface ContourFileTreeElement extends ContourElement{items?:S;}
|
|
@@ -126,11 +127,11 @@ export interface ContourLandingFeaturesFullElement extends ContourElement{items?
|
|
|
126
127
|
export interface ContourLandingHeroFullElement extends ContourElement{actions?:S;title?:S;text?:S;preview?:S;}
|
|
127
128
|
export interface ContourLayerPanelElement extends ContourElement{label?:S;items?:S;src?:S;}
|
|
128
129
|
export interface ContourLayerSwitchElement extends ContourElement{items?:S;src?:S;}
|
|
129
|
-
export interface ContourLegendElement extends ContourDataElement{title?:S;ramp?:S;scale?:S;items?:S;method?:S;norm?:S;selectable?:boolean;src?:S;graduated?:boolean;}
|
|
130
|
+
export interface ContourLegendElement extends ContourDataElement{title?:S;ramp?:S;scale?:S;items?:S;method?:S;norm?:S;selectable?:boolean;src?:S;graduated?:boolean;domain?:S;reverse?:boolean;}
|
|
130
131
|
export interface ContourLinkElement extends ContourElement{href?:S;label?:S;}
|
|
131
132
|
export interface ContourLiveBadgeElement extends ContourElement{label?:S;state?:S;live?:boolean;}
|
|
132
133
|
export interface ContourLoadingElement extends ContourElement{label?:S;}
|
|
133
|
-
export interface ContourMapAreaElement extends ContourElement{attribution?:S;"attribution-mark"?:S;scale?:S;controls?:S;"style-name"?:S;}
|
|
134
|
+
export interface ContourMapAreaElement extends ContourElement{attribution?:S;"attribution-mark"?:S;scale?:S;controls?:S;"style-name"?:S;fallback?:S;}
|
|
134
135
|
export interface ContourMapFooterElement extends ContourElement{brand?:S;}
|
|
135
136
|
export interface ContourMapLegendElement extends ContourElement{items?:S;label?:S;collapsed?:boolean;}
|
|
136
137
|
export interface ContourMapPanelElement extends ContourElement{title?:S;}
|
|
@@ -144,6 +145,7 @@ export interface ContourMetricsFullElement extends ContourDataElement{items?:S;s
|
|
|
144
145
|
export interface ContourMinimapElement extends ContourElement{label?:S;viewport?:S;src?:S;}
|
|
145
146
|
export interface ContourNotificationCenterElement extends ContourElement{count?:S;items?:S;color?:S;}
|
|
146
147
|
export interface ContourNumberFieldElement extends ContourFormElementBase{value?:S;min?:S;max?:S;step?:S;label?:S;disabled?:boolean;error?:S;help?:S;}
|
|
148
|
+
export interface ContourOfflineElement extends ContourElement{status?:S;label?:S;}
|
|
147
149
|
export interface ContourPagerFullElement extends ContourElement{prev?:S;next?:S;}
|
|
148
150
|
export interface ContourPaginationElement extends ContourElement{pages?:S;current?:S;src?:S;}
|
|
149
151
|
export interface ContourPaletteEditorElement extends ContourElement{colors?:S;}
|
|
@@ -155,10 +157,10 @@ export interface ContourPressableFullElement extends ContourElement{disabled?:bo
|
|
|
155
157
|
export interface ContourPriceFullElement extends ContourElement{value?:S;format?:S;locale?:S;}
|
|
156
158
|
export interface ContourProgressElement extends ContourElement{value?:S;label?:S;min?:S;max?:S;paused?:boolean;pausable?:boolean;}
|
|
157
159
|
export interface ContourProvenanceElement extends ContourElement{source?:S;confidence?:S;resolution?:S;coverage?:S;warning?:S;methodology?:S;}
|
|
158
|
-
export interface ContourPullToRefreshElement extends ContourElement{threshold?:S;}
|
|
160
|
+
export interface ContourPullToRefreshElement extends ContourElement{threshold?:S;resistance?:S;}
|
|
159
161
|
export interface ContourPullquoteElement extends ContourElement{quote?:S;name?:S;}
|
|
160
162
|
export interface ContourPurityRingElement extends ContourElement{size?:S;hue?:S;concentration?:S;color?:S;uncertainty?:S;timeStep?:S;timeSteps?:S;}
|
|
161
|
-
export interface ContourQueryBuilderElement extends ContourElement{query?:S;fields?:S;}
|
|
163
|
+
export interface ContourQueryBuilderElement extends ContourElement{query?:S;fields?:S;draft?:boolean;}
|
|
162
164
|
export interface ContourRadioElement extends ContourFormElementBase{label?:S;name?:S;value?:S;required?:boolean;checked?:boolean;disabled?:boolean;error?:S;help?:S;}
|
|
163
165
|
export interface ContourRadioListElement extends ContourElement{items?:S;options?:S;name?:S;value?:S;required?:boolean;src?:S;}
|
|
164
166
|
export interface ContourRangeElement extends ContourFormElementBase{min?:S;max?:S;value?:S;label?:S;disabled?:boolean;error?:S;help?:S;name?:S;step?:S;}
|
|
@@ -171,7 +173,7 @@ export interface ContourResizableElement extends ContourElement{direction?:S;val
|
|
|
171
173
|
export interface ContourResizeObserverElement extends ContourElement{debounce?:S;}
|
|
172
174
|
export interface ContourResponsiveContentElement extends ContourElement{breakpoint?:S;}
|
|
173
175
|
export interface ContourRowActionFullElement extends ContourElement{label?:S;disabled?:boolean;}
|
|
174
|
-
export interface ContourSavedViewElement extends ContourElement{name?:S;updated?:S;source?:S;active?:boolean;}
|
|
176
|
+
export interface ContourSavedViewElement extends ContourElement{name?:S;updated?:S;source?:S;active?:boolean;dirty?:boolean;conflict?:boolean;default?:boolean;}
|
|
175
177
|
export interface ContourScaleBarElement extends ContourElement{label?:S;value?:S;distance?:S;resolution?:S;latitude?:S;zoom?:S;src?:S;}
|
|
176
178
|
export interface ContourScrollAreaElement extends ContourElement{title?:S;}
|
|
177
179
|
export interface ContourSearchFieldElement extends ContourElement{value?:S;placeholder?:S;label?:S;name?:S;required?:boolean;disabled?:boolean;}
|
|
@@ -179,7 +181,8 @@ export interface ContourSearchTriggerFullElement extends ContourElement{label?:S
|
|
|
179
181
|
export interface ContourSectionHeadElement extends ContourElement{title?:S;desc?:S;}
|
|
180
182
|
export interface ContourSegmentedElement extends ContourFormElementBase{options?:S;items?:S;selected?:S;label?:S;value?:S;}
|
|
181
183
|
export interface ContourSelectElement extends ContourFormElementBase{options?:S;items?:S;required?:boolean;label?:S;placeholder?:S;disabled?:boolean;error?:S;help?:S;value?:S;name?:S;multiple?:boolean;autocomplete?:S;}
|
|
182
|
-
export interface
|
|
184
|
+
export interface ContourSelectionGroupElement extends ContourElement{selected?:S;mode?:S;}
|
|
185
|
+
export interface ContourSheetElement extends ContourElement{title?:S;body?:S;size?:S;mode?:S;}
|
|
183
186
|
export interface ContourShortcutElement extends ContourElement{key?:S;label?:S;}
|
|
184
187
|
export interface ContourShortcutListFullElement extends ContourElement{title?:S;}
|
|
185
188
|
export interface ContourShortcutPanelFullElement extends ContourElement{title?:S;}
|
|
@@ -190,10 +193,11 @@ export interface ContourSidebarElement extends ContourElement{title?:S;items?:S;
|
|
|
190
193
|
export interface ContourSkeletonElement extends ContourElement{size?:S;shimmer?:boolean;}
|
|
191
194
|
export interface ContourSkeletonGroupElement extends ContourElement{count?:number;size?:S;shimmer?:boolean;}
|
|
192
195
|
export interface ContourSkipLinkElement extends ContourElement{href?:S;label?:S;}
|
|
193
|
-
export interface
|
|
196
|
+
export interface ContourSmallMultiplesElement extends ContourElement{columns?:number;label?:S;}
|
|
197
|
+
export interface ContourSortableListElement extends ContourElement{items?:S;order?:S;reveal?:S;}
|
|
194
198
|
export interface ContourSparklineElement extends ContourDataElement{points?:S;src?:S;}
|
|
195
199
|
export interface ContourSparklineGlyphElement extends ContourElement{size?:S;points?:S;color?:S;strokeWidth?:S;bgColor?:S;}
|
|
196
|
-
export interface ContourSpatialFilterElement extends ContourElement{modes?:S;mode?:S;active?:S;bounds?:S;operator?:S;}
|
|
200
|
+
export interface ContourSpatialFilterElement extends ContourElement{modes?:S;mode?:S;active?:S;bounds?:S;operator?:S;crs?:S;count?:S;validation?:S;}
|
|
197
201
|
export interface ContourSpinnerElement extends ContourElement{size?:S;}
|
|
198
202
|
export interface ContourSplitButtonElement extends ContourElement{label?:S;menu?:S;}
|
|
199
203
|
export interface ContourSplitViewElement extends ContourElement{direction?:S;value?:S;"left-label"?:S;"right-label"?:S;}
|
|
@@ -230,7 +234,7 @@ export interface ContourTreeGridElement extends ContourElement{items?:S;rows?:S;
|
|
|
230
234
|
export interface ContourVersionControlElement extends ContourFormElementBase{options?:S;items?:S;value?:S;name?:S;}
|
|
231
235
|
export interface ContourVersionBannerFullElement extends ContourElement{message?:S;link?:S;href?:S;dismissible?:boolean;}
|
|
232
236
|
export interface ContourVirtualListElement extends ContourElement{items?:S;"item-height"?:S;orientation?:S;sticky?:boolean;}
|
|
233
|
-
export interface ContourWidgetStateElement extends ContourElement{loading?:S;error?:S;empty?:S;retry?:S;src?:S;}
|
|
237
|
+
export interface ContourWidgetStateElement extends ContourElement{loading?:S;error?:S;empty?:S;retry?:S;src?:S;"analysis-state"?:S;}
|
|
234
238
|
declare global { interface HTMLElementTagNameMap {
|
|
235
239
|
"contour-accordion":ContourAccordionElement;
|
|
236
240
|
"contour-activity":ContourActivityElement;
|
|
@@ -296,6 +300,7 @@ declare global { interface HTMLElementTagNameMap {
|
|
|
296
300
|
"contour-dashboard-grid":ContourDashboardGridElement;
|
|
297
301
|
"contour-data-export":ContourDataExportElement;
|
|
298
302
|
"contour-data-grid":ContourDataGridElement;
|
|
303
|
+
"contour-data-quality":ContourDataQualityElement;
|
|
299
304
|
"contour-data-table":ContourDataTableElement;
|
|
300
305
|
"contour-datamark":ContourDatamarkElement;
|
|
301
306
|
"contour-date-picker":ContourDatePickerElement;
|
|
@@ -377,6 +382,7 @@ declare global { interface HTMLElementTagNameMap {
|
|
|
377
382
|
"contour-minimap":ContourMinimapElement;
|
|
378
383
|
"contour-notification-center":ContourNotificationCenterElement;
|
|
379
384
|
"contour-number-field":ContourNumberFieldElement;
|
|
385
|
+
"contour-offline":ContourOfflineElement;
|
|
380
386
|
"contour-pager":ContourPagerFullElement;
|
|
381
387
|
"contour-pagination":ContourPaginationElement;
|
|
382
388
|
"contour-palette-editor":ContourPaletteEditorElement;
|
|
@@ -420,6 +426,7 @@ declare global { interface HTMLElementTagNameMap {
|
|
|
420
426
|
"contour-section-head":ContourSectionHeadElement;
|
|
421
427
|
"contour-segmented":ContourSegmentedElement;
|
|
422
428
|
"contour-select":ContourSelectElement;
|
|
429
|
+
"contour-selection-group":ContourSelectionGroupElement;
|
|
423
430
|
"contour-sheet":ContourSheetElement;
|
|
424
431
|
"contour-shortcut":ContourShortcutElement;
|
|
425
432
|
"contour-shortcut-list":ContourShortcutListFullElement;
|
|
@@ -432,6 +439,7 @@ declare global { interface HTMLElementTagNameMap {
|
|
|
432
439
|
"contour-skeleton":ContourSkeletonElement;
|
|
433
440
|
"contour-skeleton-group":ContourSkeletonGroupElement;
|
|
434
441
|
"contour-skip-link":ContourSkipLinkElement;
|
|
442
|
+
"contour-small-multiples":ContourSmallMultiplesElement;
|
|
435
443
|
"contour-sortable-list":ContourSortableListElement;
|
|
436
444
|
"contour-sparkline":ContourSparklineElement;
|
|
437
445
|
"contour-sparkline-glyph":ContourSparklineGlyphElement;
|
|
@@ -650,10 +658,11 @@ export declare function renderShadowDSD(tag: string, attrs?: string, light?: str
|
|
|
650
658
|
export declare const SHADOW_MARKUP: ContourShadowMarkup;
|
|
651
659
|
interface Window { Contour: ContourAPI; ContourShadowTemplates: ContourShadowMarkup; ContourShadowParts: Record<string, string[]>; ContourEvents: Record<string, { payload: string[]; composed: boolean }>; } }
|
|
652
660
|
|
|
653
|
-
export type ContourEventName = "contour:activate" | "contour:add" | "contour:activity-clear" | "contour:activity-filter" | "contour:activity-select" | "contour:rendered" | "contour:cap" | "contour:action" | "contour:break-change" | "contour:style-resolved" | "contour:advanced-toggle" | "contour:affordance-activate" | "contour:aggregate" | "contour:bearing" | "contour:btn-group-change" | "contour:brush-start" | "contour:brush-end" | "contour:brush" | "contour:change" | "contour:collapse" | "contour:cluster-toggle" | "contour:clear" | "contour:clear-all" | "contour:close" | "contour:copy" | "contour:apply" | "contour:dash-action" | "contour:diff-activate" | "contour:dismiss" | "contour:draw-start" | "contour:drag" | "contour:do-dont-activate" | "contour:docs-nav-select" | "contour:dragend" | "contour:dragstart" | "contour:drop" | "contour:empty-action" | "contour:filter" | "contour:filter-change" | "contour:error" | "contour:export" | "contour:refresh" | "contour:hide" | "contour:hover" | "contour:input" | "contour:invalid" | "contour:inspect-action" | "contour:layer-opacity" | "contour:layer-rename" | "contour:layer-duplicate" | "contour:layer-zoom" | "contour:zoom" | "contour:layer-projection" | "contour:layer-remove" | "contour:layer-reorder" | "contour:layer-toggle" | "contour:layer-visibility" | "contour:legend-toggle" | "contour:leave" | "contour:load" | "contour:map-control" | "contour:map-style" | "contour:map-attach" | "contour:map-ready" | "contour:map-detach" | "contour:map-popup-reposition" | "contour:map-viewport" | "contour:mode-change" | "contour:scope-change" | "contour:move" | "contour:open" | "contour:page" | "contour:ready" | "contour:read" | "contour:remove" | "contour:reorder" | "contour:range-change" | "contour:resize" | "contour:retry" | "contour:loop-change" | "contour:pause" | "contour:play" | "contour:seek" | "contour:select" | "contour:search" | "contour:spatial-filter" | "contour:split-change" | "contour:speed-change" | "contour:showcase-activate" | "contour:step-activate" | "contour:step-change" | "contour:show" | "contour:sort" | "contour:column-toggle" | "contour:submit" | "contour:stream-state" | "contour:tab-change" | "contour:theme-change" | "contour:tick" | "contour:time-change" | "contour:time-range-change" | "contour:toggle" | "contour:view-enter" | "contour:view-leave";
|
|
661
|
+
export type ContourEventName = "contour:activate" | "contour:add" | "contour:annotation-action" | "contour:activity-clear" | "contour:activity-filter" | "contour:activity-select" | "contour:rendered" | "contour:cap" | "contour:action" | "contour:break-change" | "contour:style-resolved" | "contour:advanced-toggle" | "contour:affordance-activate" | "contour:aggregate" | "contour:bearing" | "contour:btn-group-change" | "contour:brush-start" | "contour:brush-end" | "contour:brush" | "contour:change" | "contour:collapse" | "contour:cluster-toggle" | "contour:clear" | "contour:clear-all" | "contour:close" | "contour:copy" | "contour:default" | "contour:duplicate" | "contour:apply" | "contour:dash-action" | "contour:diff-activate" | "contour:dismiss" | "contour:toast-action" | "contour:draw-start" | "contour:drag" | "contour:do-dont-activate" | "contour:docs-nav-select" | "contour:dragend" | "contour:dragstart" | "contour:drop" | "contour:empty-action" | "contour:filter" | "contour:filter-change" | "contour:error" | "contour:export" | "contour:refresh" | "contour:hide" | "contour:hover" | "contour:input" | "contour:invalid" | "contour:inspect-action" | "contour:layer-opacity" | "contour:layer-rename" | "contour:layer-duplicate" | "contour:layer-zoom" | "contour:zoom" | "contour:layer-projection" | "contour:layer-remove" | "contour:layer-reorder" | "contour:layer-toggle" | "contour:layer-visibility" | "contour:legend-toggle" | "contour:leave" | "contour:load" | "contour:map-control" | "contour:map-style" | "contour:map-attach" | "contour:map-ready" | "contour:map-detach" | "contour:map-popup-reposition" | "contour:map-viewport" | "contour:mode-change" | "contour:scope-change" | "contour:move" | "contour:open" | "contour:page" | "contour:ready" | "contour:read" | "contour:remove" | "contour:rename" | "contour:share" | "contour:reorder" | "contour:row-action" | "contour:range-change" | "contour:resize" | "contour:retry" | "contour:chart-zoom" | "contour:brownout" | "contour:offline" | "contour:online" | "contour:parse-error" | "contour:loop-change" | "contour:pause" | "contour:play" | "contour:seek" | "contour:select" | "contour:selection" | "contour:search" | "contour:spatial-filter" | "contour:split-change" | "contour:speed-change" | "contour:showcase-activate" | "contour:step-activate" | "contour:step-change" | "contour:show" | "contour:sort" | "contour:column-toggle" | "contour:submit" | "contour:stream-state" | "contour:tab-change" | "contour:theme-change" | "contour:tick" | "contour:time-change" | "contour:time-range-change" | "contour:toggle" | "contour:view-enter" | "contour:view-leave";
|
|
654
662
|
export interface ContourEventMap {
|
|
655
663
|
"contour:activate": { files: unknown; label: unknown; row: unknown; value: unknown };
|
|
656
664
|
"contour:add": { value: unknown };
|
|
665
|
+
"contour:annotation-action": { action: unknown; kind: unknown; label: unknown };
|
|
657
666
|
"contour:activity-clear": Record<string, unknown>;
|
|
658
667
|
"contour:activity-filter": { unread: unknown };
|
|
659
668
|
"contour:activity-select": { index: unknown; text: unknown };
|
|
@@ -670,17 +679,20 @@ export interface ContourEventMap {
|
|
|
670
679
|
"contour:brush-start": { end: unknown; range: unknown; start: unknown; value: unknown };
|
|
671
680
|
"contour:brush-end": { end: unknown; range: unknown; start: unknown; value: unknown };
|
|
672
681
|
"contour:brush": { end: unknown; range: unknown; start: unknown; value: unknown };
|
|
673
|
-
"contour:change": { checked: unknown; color: unknown; direction: unknown; end: unknown; files: unknown; high: unknown; index: unknown; low: unknown; month: unknown; name: unknown; paused: unknown; query: unknown; speed: unknown; start: unknown; unit: unknown; value: unknown; values: unknown; year: unknown };
|
|
682
|
+
"contour:change": { checked: unknown; color: unknown; direction: unknown; draft: unknown; end: unknown; files: unknown; high: unknown; index: unknown; low: unknown; month: unknown; name: unknown; paused: unknown; query: unknown; speed: unknown; start: unknown; unit: unknown; value: unknown; values: unknown; year: unknown };
|
|
674
683
|
"contour:collapse": { collapsed: unknown };
|
|
675
684
|
"contour:cluster-toggle": { count: unknown; expanded: unknown };
|
|
676
685
|
"contour:clear": Record<string, unknown>;
|
|
677
686
|
"contour:clear-all": Record<string, unknown>;
|
|
678
687
|
"contour:close": { count: unknown; index: unknown; label: unknown; message: unknown; open: unknown; value: unknown };
|
|
679
688
|
"contour:copy": { text: unknown };
|
|
689
|
+
"contour:default": { default: unknown; name: unknown };
|
|
690
|
+
"contour:duplicate": { name: unknown };
|
|
680
691
|
"contour:apply": { name: unknown };
|
|
681
692
|
"contour:dash-action": { label: unknown };
|
|
682
693
|
"contour:diff-activate": { kind: unknown; text: unknown };
|
|
683
694
|
"contour:dismiss": { label: unknown };
|
|
695
|
+
"contour:toast-action": { action: unknown };
|
|
684
696
|
"contour:draw-start": { mode: unknown };
|
|
685
697
|
"contour:drag": { delta: unknown; key: unknown; value: unknown };
|
|
686
698
|
"contour:do-dont-activate": { kind: unknown; text: unknown };
|
|
@@ -692,7 +704,7 @@ export interface ContourEventMap {
|
|
|
692
704
|
"contour:filter": { query: unknown };
|
|
693
705
|
"contour:filter-change": { source: unknown; filter: unknown };
|
|
694
706
|
"contour:error": { src: unknown; message: unknown; name: unknown; status: unknown };
|
|
695
|
-
"contour:export": { format: unknown };
|
|
707
|
+
"contour:export": { format: unknown; scope: unknown; count: unknown; total: unknown; filename: unknown; crs: unknown; provenance: unknown };
|
|
696
708
|
"contour:refresh": Record<string, unknown>;
|
|
697
709
|
"contour:hide": Record<string, unknown>;
|
|
698
710
|
"contour:hover": { row: unknown };
|
|
@@ -727,17 +739,26 @@ export interface ContourEventMap {
|
|
|
727
739
|
"contour:ready": { version: unknown; count: unknown };
|
|
728
740
|
"contour:read": { label: unknown };
|
|
729
741
|
"contour:remove": { key: unknown; label: unknown; name: unknown; value: unknown };
|
|
742
|
+
"contour:rename": { name: unknown };
|
|
743
|
+
"contour:share": { name: unknown };
|
|
730
744
|
"contour:reorder": { from: unknown; to: unknown };
|
|
745
|
+
"contour:row-action": { index: unknown; item: unknown; label: unknown };
|
|
731
746
|
"contour:range-change": { value: unknown };
|
|
732
747
|
"contour:resize": { column: unknown; delta: unknown; height: unknown; value: unknown; width: unknown };
|
|
733
748
|
"contour:retry": { src: unknown };
|
|
749
|
+
"contour:chart-zoom": { zoom: unknown; panX: unknown; panY: unknown };
|
|
750
|
+
"contour:brownout": { level: unknown; reason: unknown; shed: unknown; recovery: unknown };
|
|
751
|
+
"contour:offline": { reason: unknown };
|
|
752
|
+
"contour:online": Record<string, unknown>;
|
|
753
|
+
"contour:parse-error": { src: unknown; reason: unknown; partial: unknown };
|
|
734
754
|
"contour:loop-change": { loop: unknown };
|
|
735
755
|
"contour:pause": Record<string, unknown>;
|
|
736
756
|
"contour:play": Record<string, unknown>;
|
|
737
757
|
"contour:seek": { progress: unknown; value: unknown };
|
|
738
758
|
"contour:select": { area: unknown; col: unknown; expanded: unknown; href: unknown; index: unknown; key: unknown; label: unknown; labels: unknown; level: unknown; path: unknown; range: unknown; result: unknown; row: unknown; rows: unknown; series: unknown; value: unknown };
|
|
759
|
+
"contour:selection": { mode: unknown; value: unknown };
|
|
739
760
|
"contour:search": { query: unknown };
|
|
740
|
-
"contour:spatial-filter": { action: unknown; mode: unknown; operator: unknown };
|
|
761
|
+
"contour:spatial-filter": { action: unknown; count: unknown; crs: unknown; mode: unknown; operator: unknown };
|
|
741
762
|
"contour:split-change": { value: unknown; width: unknown; height: unknown };
|
|
742
763
|
"contour:speed-change": { speed: unknown };
|
|
743
764
|
"contour:showcase-activate": { title: unknown };
|
|
@@ -749,10 +770,10 @@ export interface ContourEventMap {
|
|
|
749
770
|
"contour:submit": { submitting: unknown };
|
|
750
771
|
"contour:stream-state": { running: unknown };
|
|
751
772
|
"contour:tab-change": { index: unknown; label: unknown };
|
|
752
|
-
"contour:theme-change": { theme: unknown };
|
|
753
|
-
"contour:tick": { frame: unknown };
|
|
773
|
+
"contour:theme-change": { source: unknown; theme: unknown; value: unknown };
|
|
774
|
+
"contour:tick": { frame: unknown; interval: unknown; timestamp: unknown };
|
|
754
775
|
"contour:time-change": { progress: unknown; value: unknown };
|
|
755
|
-
"contour:time-range-change": { value: unknown };
|
|
776
|
+
"contour:time-range-change": { end: unknown; preset: unknown; start: unknown; timezone: unknown; value: unknown };
|
|
756
777
|
"contour:toggle": { collapsed: unknown; expanded: unknown; label: unknown; open: unknown; path: unknown; playing: unknown };
|
|
757
778
|
"contour:view-enter": Record<string, unknown>;
|
|
758
779
|
"contour:view-leave": Record<string, unknown>;
|
package/dist/contour.esm.js
CHANGED
|
@@ -15,6 +15,38 @@
|
|
|
15
15
|
const $ = (sel, root = document) => root.querySelector(sel);
|
|
16
16
|
const $$ = (sel, root = document) => Array.from((root || document).querySelectorAll(sel));
|
|
17
17
|
|
|
18
|
+
/* R34-127: two-step destructive confirmation. A `.c-btn--danger[data-confirm]`
|
|
19
|
+
requires a second click within a short window — the first arms it (label →
|
|
20
|
+
"Confirm?"), the second performs the action. Safe default, explicit action,
|
|
21
|
+
no modal, and an armed control restores itself if the reader waits. */
|
|
22
|
+
(() => {
|
|
23
|
+
let armed = null;
|
|
24
|
+
let timer = null;
|
|
25
|
+
const disarm = (btn) => {
|
|
26
|
+
if (btn && btn.dataset.prevLabel !== undefined) btn.textContent = btn.dataset.prevLabel;
|
|
27
|
+
if (btn) delete btn.dataset.armed;
|
|
28
|
+
armed = null;
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
};
|
|
31
|
+
document.addEventListener(
|
|
32
|
+
"click",
|
|
33
|
+
(e) => {
|
|
34
|
+
const btn = e.target && e.target.closest ? e.target.closest(".c-btn--danger[data-confirm]") : null;
|
|
35
|
+
if (!btn) return;
|
|
36
|
+
if (armed === btn) { disarm(btn); return; } // second click: proceed
|
|
37
|
+
armed = btn;
|
|
38
|
+
btn.dataset.prevLabel = btn.textContent;
|
|
39
|
+
btn.dataset.armed = "";
|
|
40
|
+
btn.textContent = btn.getAttribute("data-confirm") || "Confirm?";
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
timer = setTimeout(() => disarm(btn), 3000);
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
},
|
|
46
|
+
true,
|
|
47
|
+
);
|
|
48
|
+
})();
|
|
49
|
+
|
|
18
50
|
/* True when the event target is a place where the reader is typing, so a
|
|
19
51
|
single-key shortcut must not steal the character. */
|
|
20
52
|
const isTyping = (el) =>
|
|
@@ -131,6 +163,23 @@
|
|
|
131
163
|
};
|
|
132
164
|
|
|
133
165
|
const applyScheme = (value) => {
|
|
166
|
+
renderScheme(value);
|
|
167
|
+
try {
|
|
168
|
+
if (value === "light dark") localStorage.removeItem("contour-scheme");
|
|
169
|
+
else localStorage.setItem("contour-scheme", value);
|
|
170
|
+
} catch {
|
|
171
|
+
/* storage unavailable — the page still renders correctly */
|
|
172
|
+
}
|
|
173
|
+
syncSchemeControls(value);
|
|
174
|
+
announceTheme(value);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// R34-74: apply the concrete theme to the document without touching storage,
|
|
178
|
+
// so a cross-tab change and the initial paint share one render path and one
|
|
179
|
+
// canonical `contour:theme-change` announcement. Canvas/chart consumers
|
|
180
|
+
// listen for the event to re-read CSS-derived colours instead of waiting for
|
|
181
|
+
// a resize or attribute change.
|
|
182
|
+
const renderScheme = (value) => {
|
|
134
183
|
document.documentElement.classList.add("is-theme-switching");
|
|
135
184
|
const meta = schemeMeta();
|
|
136
185
|
if (meta) meta.setAttribute("content", value);
|
|
@@ -139,13 +188,15 @@
|
|
|
139
188
|
document.documentElement.classList.remove("is-theme-switching");
|
|
140
189
|
});
|
|
141
190
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const announceTheme = (value) => {
|
|
194
|
+
const resolved = value === "light dark" ? resolvedScheme() : value;
|
|
195
|
+
window.dispatchEvent(
|
|
196
|
+
new CustomEvent("contour:theme-change", {
|
|
197
|
+
detail: { theme: resolved, source: value === "light dark" ? "system" : "manual", value },
|
|
198
|
+
}),
|
|
199
|
+
);
|
|
149
200
|
};
|
|
150
201
|
|
|
151
202
|
const resolvedScheme = () =>
|
|
@@ -220,7 +271,16 @@
|
|
|
220
271
|
});
|
|
221
272
|
|
|
222
273
|
window.addEventListener("storage", (event) => {
|
|
223
|
-
|
|
274
|
+
// R34-73: a cross-tab change must re-apply the theme, not only relabel the
|
|
275
|
+
// controls. `event.key` is null when storage is cleared and "contour-scheme"
|
|
276
|
+
// when the override is set or removed (removeItem fires with newValue null),
|
|
277
|
+
// so both the set and the removal restore the system choice in every tab.
|
|
278
|
+
if (event.key === null || event.key === "contour-scheme") {
|
|
279
|
+
const value = storedScheme();
|
|
280
|
+
renderScheme(value);
|
|
281
|
+
syncSchemeControls(value);
|
|
282
|
+
announceTheme(value);
|
|
283
|
+
}
|
|
224
284
|
});
|
|
225
285
|
|
|
226
286
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
@@ -398,16 +458,22 @@
|
|
|
398
458
|
});
|
|
399
459
|
|
|
400
460
|
/* ---------------------------------------------------------------------
|
|
401
|
-
5. Section spy — highlights the current section in
|
|
461
|
+
5. Section spy — highlights the current section in every section menu
|
|
462
|
+
(the desktop rail AND the mobile <details> dropdown) from one scroll
|
|
463
|
+
state, so the two never disagree about where the reader is (R34-84).
|
|
402
464
|
--------------------------------------------------------------------- */
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
405
|
-
const sections =
|
|
406
|
-
|
|
407
|
-
|
|
465
|
+
const spyLinks = $$("[data-spy] a");
|
|
466
|
+
if (spyLinks.length) {
|
|
467
|
+
const sections = [
|
|
468
|
+
...new Set(
|
|
469
|
+
spyLinks
|
|
470
|
+
.map((link) => document.getElementById(link.getAttribute("href")?.slice(1)))
|
|
471
|
+
.filter(Boolean),
|
|
472
|
+
),
|
|
473
|
+
];
|
|
408
474
|
|
|
409
475
|
const setActive = (id) => {
|
|
410
|
-
|
|
476
|
+
spyLinks.forEach((link) => {
|
|
411
477
|
const active = link.getAttribute("href") === `#${id}`;
|
|
412
478
|
link.setAttribute("aria-current", active ? "true" : "false");
|
|
413
479
|
});
|
|
@@ -699,6 +765,22 @@
|
|
|
699
765
|
btn.setAttribute("aria-expanded", String(e.newState === "open"));
|
|
700
766
|
});
|
|
701
767
|
});
|
|
768
|
+
// R35-015: a popover drawer left open across the 56rem breakpoint would stay
|
|
769
|
+
// in the top layer over the wide-screen column. Close any open drawer when the
|
|
770
|
+
// layout crosses into the wide (ordinary-column) mode; the CSS override shows
|
|
771
|
+
// the nav as a column regardless, so the open state is only meaningful on the
|
|
772
|
+
// narrow layout.
|
|
773
|
+
{
|
|
774
|
+
const wide = window.matchMedia("(width >= 56rem)");
|
|
775
|
+
const closeDrawers = () => {
|
|
776
|
+
if (!wide.matches) return;
|
|
777
|
+
$$("[data-drawer-toggle]").forEach((btn) => {
|
|
778
|
+
const drawer = document.getElementById(btn.dataset.drawerToggle);
|
|
779
|
+
if (drawer && drawer.matches(":popover-open")) drawer.hidePopover();
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
wide.addEventListener("change", closeDrawers);
|
|
783
|
+
}
|
|
702
784
|
|
|
703
785
|
/* ---------------------------------------------------------------------
|
|
704
786
|
11c. Menu — roving focus + arrow keys for the light-DOM pattern
|
|
@@ -822,6 +904,21 @@
|
|
|
822
904
|
let filtered = [];
|
|
823
905
|
let active = 0;
|
|
824
906
|
|
|
907
|
+
/* Recent results (R34-63): the palette remembers the last few commands the
|
|
908
|
+
reader ran this session and surfaces them first when it opens empty, so a
|
|
909
|
+
repeated jump is one keystroke. Session memory only — no storage, so a
|
|
910
|
+
blocked-storage context is unaffected. */
|
|
911
|
+
const RECENT_MAX = 5;
|
|
912
|
+
const recent = [];
|
|
913
|
+
const recentKey = (cmd) => cmd.group + "\u0000" + cmd.title;
|
|
914
|
+
const rememberRecent = (cmd) => {
|
|
915
|
+
const key = recentKey(cmd);
|
|
916
|
+
const at = recent.findIndex((r) => recentKey(r) === key);
|
|
917
|
+
if (at !== -1) recent.splice(at, 1);
|
|
918
|
+
recent.unshift({ group: cmd.group, title: cmd.title });
|
|
919
|
+
if (recent.length > RECENT_MAX) recent.length = RECENT_MAX;
|
|
920
|
+
};
|
|
921
|
+
|
|
825
922
|
/* Subsequence match with a bonus for prefix and substring hits. */
|
|
826
923
|
const fuzzy = (query, text) => {
|
|
827
924
|
if (!query) return { score: 0, hits: [] };
|
|
@@ -849,9 +946,9 @@
|
|
|
849
946
|
|
|
850
947
|
const buildIndex = () => {
|
|
851
948
|
const found = [];
|
|
852
|
-
const push = (group, title, hint, icon, run) => {
|
|
949
|
+
const push = (group, title, hint, icon, run, context) => {
|
|
853
950
|
if (!title) return;
|
|
854
|
-
found.push({ group, title, hint, icon, run });
|
|
951
|
+
found.push({ group, title, hint, icon, run, context: context || "" });
|
|
855
952
|
};
|
|
856
953
|
|
|
857
954
|
// Navigation: any list marked as a command source.
|
|
@@ -890,6 +987,7 @@
|
|
|
890
987
|
el.dataset.commandHint || "",
|
|
891
988
|
el.dataset.commandIcon || "i-grid",
|
|
892
989
|
() => goTo(el),
|
|
990
|
+
el.dataset.commandContext || "",
|
|
893
991
|
);
|
|
894
992
|
});
|
|
895
993
|
|
|
@@ -967,7 +1065,12 @@
|
|
|
967
1065
|
indices with it. */
|
|
968
1066
|
const matchCommand = (query, cmd) => {
|
|
969
1067
|
const title = fuzzy(query, cmd.title);
|
|
970
|
-
if (title)
|
|
1068
|
+
if (title) {
|
|
1069
|
+
// An exact title match is what the reader typed; lift it above every
|
|
1070
|
+
// fuzzy hit so "button" lands Button first, not a substring match.
|
|
1071
|
+
const exact = query && cmd.title.toLowerCase() === query.toLowerCase() ? 40 : 0;
|
|
1072
|
+
return { score: title.score + 24 + exact, hits: title.hits, hintHits: [] };
|
|
1073
|
+
}
|
|
971
1074
|
const hint = fuzzy(query, cmd.hint);
|
|
972
1075
|
if (hint) return { score: hint.score + 8, hits: [], hintHits: hint.hits };
|
|
973
1076
|
const group = fuzzy(query, cmd.group);
|
|
@@ -993,12 +1096,20 @@
|
|
|
993
1096
|
|
|
994
1097
|
const render = () => {
|
|
995
1098
|
const query = field.value.trim();
|
|
1099
|
+
const recentKeys = new Set(recent.map(recentKey));
|
|
996
1100
|
filtered = index
|
|
997
1101
|
.map((cmd) => {
|
|
998
1102
|
const match = matchCommand(query, cmd);
|
|
999
1103
|
return match ? Object.assign({}, cmd, match) : null;
|
|
1000
1104
|
})
|
|
1001
1105
|
.filter(Boolean)
|
|
1106
|
+
// With an empty query, lift this session's recent commands into a
|
|
1107
|
+
// "Recent" group at the top; a typed query keeps the real groups.
|
|
1108
|
+
.map((cmd) =>
|
|
1109
|
+
!query && recentKeys.has(recentKey(cmd))
|
|
1110
|
+
? Object.assign({}, cmd, { group: "Recent", score: cmd.score + 100 })
|
|
1111
|
+
: cmd,
|
|
1112
|
+
)
|
|
1002
1113
|
.sort((a, b) => b.score - a.score);
|
|
1003
1114
|
|
|
1004
1115
|
if (!filtered.length) {
|
|
@@ -1019,9 +1130,14 @@
|
|
|
1019
1130
|
.map((cmd) => {
|
|
1020
1131
|
const position = filtered.indexOf(cmd);
|
|
1021
1132
|
const safeGroup = escapeHtml(group);
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1133
|
+
// Provenance (R34-63): the hint line carries the group, the
|
|
1134
|
+
// selector, and — when the page supplied it — the owning context
|
|
1135
|
+
// (the section a component specimen lives in), so a result says
|
|
1136
|
+
// where it comes from before it is opened.
|
|
1137
|
+
const parts = [];
|
|
1138
|
+
if (cmd.hint) parts.push(highlight(cmd.hint, cmd.hintHits));
|
|
1139
|
+
if (cmd.context) parts.push(escapeHtml(cmd.context));
|
|
1140
|
+
const hint = parts.length ? safeGroup + " \u00b7 " + parts.join(" \u00b7 ") : safeGroup;
|
|
1025
1141
|
return (
|
|
1026
1142
|
'<button class="c-command__item" role="option" aria-selected="false" tabindex="-1" id="command-item-' +
|
|
1027
1143
|
position +
|
|
@@ -1130,6 +1246,7 @@
|
|
|
1130
1246
|
const cmd = filtered[Number(item.dataset.index)];
|
|
1131
1247
|
if (!cmd) return;
|
|
1132
1248
|
close();
|
|
1249
|
+
rememberRecent(cmd);
|
|
1133
1250
|
cmd.run();
|
|
1134
1251
|
});
|
|
1135
1252
|
|