@aceshooting/lyra-ui 11.0.0 → 11.2.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/CHANGELOG.md +151 -0
- package/README.md +8 -0
- package/custom-elements.json +1 -1
- package/dist/components/agent-tools/activity-feed/activity-feed.class.js +1 -1
- package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
- package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
- package/dist/components/agent-tools/agent-trace/agent-trace.class.js +1 -1
- package/dist/components/agent-tools/browser-frame/browser-frame.class.js +1 -1
- package/dist/components/agent-tools/commit-card/commit-card.class.js +1 -1
- package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +1 -1
- package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
- package/dist/components/agent-tools/test-results/test-results.class.js +1 -1
- package/dist/components/agent-tools/thinking-panel/thinking-panel.class.js +1 -1
- package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +2 -2
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.d.ts +1 -0
- package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +1 -1
- package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
- package/dist/components/agent-tools/trace-tree/trace-tree.class.js +2 -2
- package/dist/components/charts/chart/bar-chart.class.js +1 -1
- package/dist/components/charts/chart/bubble-chart.class.js +1 -1
- package/dist/components/charts/chart/chart.class.js +1 -1
- package/dist/components/charts/chart/doughnut-chart.class.js +1 -1
- package/dist/components/charts/chart/histogram.class.js +1 -1
- package/dist/components/charts/chart/line-chart.class.js +1 -1
- package/dist/components/charts/chart/lite-chart.class.d.ts +32 -0
- package/dist/components/charts/chart/lite-chart.class.js +17 -4
- package/dist/components/charts/chart/lite-chart.styles.js +29 -0
- package/dist/components/charts/chart/pie-chart.class.js +1 -1
- package/dist/components/charts/chart/polar-area-chart.class.js +1 -1
- package/dist/components/charts/chart/radar-chart.class.js +1 -1
- package/dist/components/charts/chart/scatter-chart.class.js +1 -1
- package/dist/components/conversation/chat-message/chat-message.class.js +2 -2
- package/dist/components/conversation/chat-viewport/chat-viewport.class.js +1 -1
- package/dist/components/conversation/model-select/model-select.class.d.ts +1 -0
- package/dist/components/conversation/model-select/model-select.class.js +1 -1
- package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
- package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +1 -0
- package/dist/components/conversation/voice-picker/voice-picker.class.js +1 -1
- package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +1 -0
- package/dist/components/data/graph-query-builder/graph-query-builder.class.js +1 -1
- package/dist/components/data/heatmap/heatmap.class.d.ts +36 -1
- package/dist/components/data/heatmap/heatmap.class.js +1 -1
- package/dist/components/data/table/table.class.d.ts +19 -0
- package/dist/components/data/table/table.class.js +3 -3
- package/dist/components/forms/checkbox/checkbox.class.d.ts +1 -0
- package/dist/components/forms/checkbox/checkbox.class.js +1 -1
- package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +1 -0
- package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
- package/dist/components/forms/combobox/combobox.class.d.ts +1 -0
- package/dist/components/forms/combobox/combobox.class.js +1 -1
- package/dist/components/forms/date-picker/date-input.class.d.ts +12 -1
- package/dist/components/forms/date-picker/date-input.class.js +4 -2
- package/dist/components/forms/date-picker/date-picker.class.d.ts +30 -4
- package/dist/components/forms/date-picker/date-picker.class.js +4 -4
- package/dist/components/forms/locale-picker/locale-picker.class.d.ts +1 -0
- package/dist/components/forms/locale-picker/locale-picker.class.js +1 -1
- package/dist/components/forms/radio/radio-group.class.d.ts +1 -0
- package/dist/components/forms/radio/radio-group.class.js +1 -1
- package/dist/components/forms/radio/radio.class.d.ts +1 -0
- package/dist/components/forms/radio/radio.class.js +1 -1
- package/dist/components/forms/rubric-form/rubric-form.class.d.ts +1 -0
- package/dist/components/forms/rubric-form/rubric-form.class.js +1 -1
- package/dist/components/forms/select/select.class.d.ts +1 -0
- package/dist/components/forms/select/select.class.js +1 -1
- package/dist/components/forms/slider/slider.class.d.ts +1 -0
- package/dist/components/forms/slider/slider.class.js +1 -1
- package/dist/components/forms/switch/switch.class.d.ts +1 -0
- package/dist/components/forms/switch/switch.class.js +1 -1
- package/dist/components/forms/time-range/time-range.class.d.ts +1 -0
- package/dist/components/forms/time-range/time-range.class.js +1 -1
- package/dist/components/forms/token-input/token-input.class.d.ts +1 -0
- package/dist/components/forms/token-input/token-input.class.js +1 -1
- package/dist/components/media/attachment-chip/attachment-chip.class.js +2 -2
- package/dist/components/media/attachment-trigger/attachment-trigger.class.js +2 -2
- package/dist/components/media/file-icon/file-icon.class.js +1 -1
- package/dist/components/media/file-input/file-input.class.d.ts +1 -0
- package/dist/components/media/file-input/file-input.class.js +1 -1
- package/dist/components/media/flag/flag-peer-bulk.d.ts +12 -0
- package/dist/components/media/flag/flag-peer-bulk.js +1 -0
- package/dist/components/media/flag/flag.class.d.ts +28 -0
- package/dist/components/media/flag/flag.class.js +2 -2
- package/dist/components/retrieval/citation-badge/citation-badge.class.js +1 -1
- package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +1 -1
- package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +2 -2
- package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
- package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
- package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
- package/dist/components/viewers/document-compare/document-compare.class.js +1 -1
- package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
- package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
- package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
- package/dist/custom-elements-jsx.d.ts +5 -3
- package/dist/events.d.ts +7 -0
- package/dist/internal/canvas.js +1 -1
- package/dist/internal/form-associated.d.ts +1 -0
- package/dist/internal/form-associated.js +1 -1
- package/dist/internal/form-control-labels.js +1 -1
- package/dist/internal/lyra-element.js +1 -1
- package/dist/internal/package-metadata.d.ts +1 -1
- package/dist/internal/package-metadata.js +1 -1
- package/dist/lyra.d.ts +1 -1
- package/dist/svelte.d.ts +5 -3
- package/dist/theme.css +32 -0
- package/dist/vue.d.ts +5 -3
- package/llms/components/lr-agent-eval-dashboard.md +1 -1
- package/llms/components/lr-agent-workspace.md +1 -1
- package/llms/components/lr-box-plot.md +2 -2
- package/llms/components/lr-chart.md +1 -1
- package/llms/components/lr-chunk-inspector.md +1 -1
- package/llms/components/lr-combobox.md +3 -3
- package/llms/components/lr-date-input.md +22 -6
- package/llms/components/lr-date-picker.md +21 -5
- package/llms/components/lr-entity-dossier.md +1 -1
- package/llms/components/lr-eval-run.md +1 -1
- package/llms/components/lr-flag.md +24 -1
- package/llms/components/lr-grounding-summary.md +1 -1
- package/llms/components/lr-heatmap.md +18 -6
- package/llms/components/lr-lite-chart.md +19 -3
- package/llms/components/lr-map.md +2 -2
- package/llms/components/lr-memory-panel.md +1 -1
- package/llms/components/lr-option.md +3 -3
- package/llms/components/lr-popover.md +1 -1
- package/llms/components/lr-provenance-panel.md +1 -1
- package/llms/components/lr-rag-answer.md +1 -1
- package/llms/components/lr-rag-eval-dashboard.md +1 -1
- package/llms/components/lr-retrieval-results.md +1 -1
- package/llms/components/lr-retrieval-trace.md +1 -1
- package/llms/peers.md +10 -10
- package/llms/shared.md +19 -0
- package/llms/tokens.md +12 -0
- package/llms-full.txt +109 -21
- package/package.json +6 -6
- package/vscode-css-data.json +14 -0
- package/vscode-html-data.json +17 -3
- package/web-types.json +30 -4
|
@@ -723,7 +723,7 @@ export type LyraDatasetViewerReactProps = LyraReactElementProps<LyraDatasetViewe
|
|
|
723
723
|
'active-highlight-id'?: LyraDatasetViewer['activeHighlightId'];
|
|
724
724
|
'max-height'?: LyraDatasetViewer['maxHeight'];
|
|
725
725
|
}>;
|
|
726
|
-
export type LyraDateInputReactProps = LyraReactElementProps<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
726
|
+
export type LyraDateInputReactProps = LyraReactElementProps<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'presets' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
727
727
|
form: HTMLFormElement | string | null;
|
|
728
728
|
}, LyraDateInputEventMap, 'blur' | 'change' | 'focus' | 'input' | 'lr-after-hide' | 'lr-after-show' | 'lr-clear' | 'lr-hide' | 'lr-invalid' | 'lr-show', '--hide-duration' | '--lr-date-input-action-active-bg' | '--lr-date-input-action-active-color' | '--lr-date-input-action-active-radius' | '--lr-date-input-action-hover-bg' | '--lr-date-input-action-hover-color' | '--lr-date-input-action-hover-radius' | '--lr-date-input-control-height' | '--lr-date-input-control-min-height' | '--lr-date-input-focus-border-color' | '--lr-date-input-font-size' | '--lr-date-input-gap' | '--lr-date-input-padding-block' | '--lr-date-input-padding-inline' | '--lr-date-input-placeholder-color' | '--lr-date-input-radius' | '--lr-form-control-required-color' | '--lr-form-control-required-content' | '--lr-form-control-required-offset' | '--show-duration', {
|
|
729
729
|
'aria-label'?: LyraDateInput['accessibleLabel'];
|
|
@@ -1014,7 +1014,7 @@ export type LyraHandoffDividerReactProps = LyraReactElementProps<LyraHandoffDivi
|
|
|
1014
1014
|
'from-agent'?: LyraHandoffDivider['fromAgent'];
|
|
1015
1015
|
'to-agent'?: LyraHandoffDivider['toAgent'];
|
|
1016
1016
|
}>;
|
|
1017
|
-
export type LyraHeatmapReactProps = LyraReactElementProps<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1017
|
+
export type LyraHeatmapReactProps = LyraReactElementProps<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click' | 'lr-matrix-geometry-change', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1018
1018
|
'accessible-cells'?: LyraHeatmap['accessibleCells'];
|
|
1019
1019
|
'bucket-count'?: LyraHeatmap['bucketCount'];
|
|
1020
1020
|
'cell-size'?: LyraHeatmap['cellSize'];
|
|
@@ -1166,15 +1166,17 @@ export type LyraLineChartReactProps = LyraReactElementProps<LyraLineChart, 'anno
|
|
|
1166
1166
|
'y-label'?: LyraLineChart['yLabel'];
|
|
1167
1167
|
'y2-label'?: LyraLineChart['y2Label'];
|
|
1168
1168
|
}>;
|
|
1169
|
-
export type LyraLiteChartReactProps = LyraReactElementProps<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1169
|
+
export type LyraLiteChartReactProps = LyraReactElementProps<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'dataTableToggle' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'showDataTable' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-data-table-toggle-active-bg' | '--lr-lite-chart-data-table-toggle-hover-bg' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1170
1170
|
'accessible-label'?: LyraLiteChart['accessibleLabel'];
|
|
1171
1171
|
'bar-gap-ratio'?: LyraLiteChart['barGapRatio'];
|
|
1172
1172
|
'bar-width'?: LyraLiteChart['barWidth'];
|
|
1173
1173
|
'begin-at-zero'?: LyraLiteChart['beginAtZero'];
|
|
1174
|
+
'data-table-toggle'?: LyraLiteChart['dataTableToggle'];
|
|
1174
1175
|
'legend-position'?: LyraLiteChart['legendPosition'];
|
|
1175
1176
|
'max-labels'?: LyraLiteChart['maxLabels'];
|
|
1176
1177
|
'min-bar-height'?: LyraLiteChart['minBarHeight'];
|
|
1177
1178
|
'rounded-bars'?: LyraLiteChart['roundedBars'];
|
|
1179
|
+
'show-data-table'?: LyraLiteChart['showDataTable'];
|
|
1178
1180
|
'skip-zero'?: LyraLiteChart['skipZero'];
|
|
1179
1181
|
'table-totals'?: LyraLiteChart['tableTotals'];
|
|
1180
1182
|
'value-axis-gutter'?: LyraLiteChart['valueAxisGutter'];
|
package/dist/events.d.ts
CHANGED
|
@@ -1303,6 +1303,12 @@ export type LyraMapClickEvent = LyraMapEventMap['lr-map-click'];
|
|
|
1303
1303
|
* Detail type: `LyraMapEventMap['lr-map-load']`.
|
|
1304
1304
|
*/
|
|
1305
1305
|
export type LyraMapLoadEvent = LyraMapEventMap['lr-map-load'];
|
|
1306
|
+
/**
|
|
1307
|
+
* `lr-matrix-geometry-change` — dispatched by `<lr-heatmap>`.
|
|
1308
|
+
*
|
|
1309
|
+
* Detail type: `LyraHeatmapEventMap['lr-matrix-geometry-change']`.
|
|
1310
|
+
*/
|
|
1311
|
+
export type LyraMatrixGeometryChangeEvent = LyraHeatmapEventMap['lr-matrix-geometry-change'];
|
|
1306
1312
|
/**
|
|
1307
1313
|
* `lr-maximize-change` — dispatched by `<lr-tool-result-dialog>`.
|
|
1308
1314
|
*
|
|
@@ -2727,6 +2733,7 @@ export interface LyraGlobalEventMap {
|
|
|
2727
2733
|
'lr-location-change': LyraLocationChangeEvent;
|
|
2728
2734
|
'lr-map-click': LyraMapClickEvent;
|
|
2729
2735
|
'lr-map-load': LyraMapLoadEvent;
|
|
2736
|
+
'lr-matrix-geometry-change': LyraMatrixGeometryChangeEvent;
|
|
2730
2737
|
'lr-maximize-change': LyraMaximizeChangeEvent;
|
|
2731
2738
|
'lr-mcp-log': LyraMcpLogEvent;
|
|
2732
2739
|
'lr-mcp-open-link': LyraMcpOpenLinkEvent;
|
package/dist/internal/canvas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const scratchContexts=new WeakMap;function positiveFinite(value){return typeof value=="number"&&Number.isFinite(value)&&value>0?value:1}function resolveBoundedCanvasAllocation(input){const cssWidth=positiveFinite(input.cssWidth),cssHeight=positiveFinite(input.cssHeight),desiredScale=positiveFinite(input.desiredScale),maxDimension=Math.max(1,Math.floor(positiveFinite(input.maxDimension))),maxPixels=Math.max(1,positiveFinite(input.maxPixels)),areaScale=Math.sqrt(maxPixels)/Math.sqrt(cssWidth)/Math.sqrt(cssHeight),scale=Math.max(Number.MIN_VALUE,Math.min(desiredScale,maxDimension/cssWidth,maxDimension/cssHeight,areaScale)),pixelWidth=Math.max(1,Math.min(maxDimension,Math.floor(cssWidth*scale))),pixelHeight=Math.max(1,Math.min(maxDimension,Math.floor(cssHeight*scale)));return Object.freeze({cssWidth,cssHeight,pixelWidth,pixelHeight,scale,scaleX:pixelWidth/cssWidth,scaleY:pixelHeight/cssHeight})}function getScratchCtx(ownerDocument=typeof document>"u"?null:document){return ownerDocument?(scratchContexts.has(ownerDocument)||scratchContexts.set(ownerDocument,ownerDocument.createElement("canvas").getContext("2d")),scratchContexts.get(ownerDocument)??null):null}export{getScratchCtx,resolveBoundedCanvasAllocation};
|
|
1
|
+
const scratchContexts=new WeakMap;function positiveFinite(value){return typeof value=="number"&&Number.isFinite(value)&&value>0?value:1}function resolveBoundedCanvasAllocation(input){const cssWidth=positiveFinite(input.cssWidth),cssHeight=positiveFinite(input.cssHeight),desiredScale=positiveFinite(input.desiredScale),maxDimension=Math.max(1,Math.floor(positiveFinite(input.maxDimension))),maxPixels=Math.max(1,positiveFinite(input.maxPixels)),areaScale=Math.sqrt(maxPixels)/Math.sqrt(cssWidth)/Math.sqrt(cssHeight),scale=Math.max(Number.MIN_VALUE,Math.min(desiredScale,maxDimension/cssWidth,maxDimension/cssHeight,areaScale)),pixelWidth=Math.max(1,Math.min(maxDimension,Math.floor(cssWidth*scale))),pixelHeight=Math.max(1,Math.min(maxDimension,Math.floor(cssHeight*scale)));return Object.freeze({cssWidth,cssHeight,pixelWidth,pixelHeight,scale,scaleX:pixelWidth/cssWidth,scaleY:pixelHeight/cssHeight})}function getScratchCtx(ownerDocument=typeof document>"u"?null:document){return ownerDocument?(scratchContexts.has(ownerDocument)||scratchContexts.set(ownerDocument,ownerDocument.createElement("canvas").getContext("2d",{willReadFrequently:!0})),scratchContexts.get(ownerDocument)??null):null}export{getScratchCtx,resolveBoundedCanvasAllocation};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LitElement } from 'lit';
|
|
2
2
|
import { attachInternalsSafely, createFallbackInternals } from './element-internals.js';
|
|
3
|
+
import './form-control-labels.js';
|
|
3
4
|
export { attachInternalsSafely, createFallbackInternals };
|
|
4
5
|
type Constructor<T> = new (...args: any[]) => T;
|
|
5
6
|
/** A write to the public `form` IDL may name an owner by id while reads stay element-valued. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LYRA_DEFAULT_fieldRequired}from"./default-strings.generated.js";import{resolveLyraString}from"./localization-runtime.js";import{AnchoredValidityController,SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"./anchored-validity.js";import{syncValidityStates}from"./custom-states.js";import{installInvalidEventAlias}from"./invalid-event-alias.js";import{omittedEmptyStringConverter}from"./converters.js";import{attachInternalsSafely,createFallbackInternals}from"./element-internals.js";const FORM_ASSOCIATED_DEFAULT_STRINGS=Object.freeze({fieldRequired:LYRA_DEFAULT_fieldRequired});function setFormOwner(host,owner){const id=typeof owner=="string"?owner:owner?.id??"";id?host.setAttribute("form",id):host.removeAttribute("form")}function getFormOwner(internals){return internals.form}function createStringArrayFormDataState(name,values){const state=new FormData,key=name||"value";for(const value of values)state.append(key,value);return state}function readStringArrayFormDataState(state){if(typeof FormData!="function")return[];let entries;try{entries=[...FormData.prototype.values.call(state)]}catch{return[]}return entries.some(entry=>typeof entry!="string")?[]:entries}function isEmptyFormValue(value){if(value==null)return!0;if(typeof value=="string")return value==="";if(typeof value=="object")try{if(Array.isArray(value))return value.length===0;const prototype=Object.getPrototypeOf(value);if(prototype===null)return Object.keys(value).length===0;if(Object.getPrototypeOf(prototype)===null){const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor")?.value;if(typeof constructor=="function"&&constructor.name==="Object"&&constructor.prototype===prototype)return Object.keys(value).length===0}}catch{return!1}return!1}const stringFormValueAdapter={empty:"",toFormValue:value=>value,isEmpty:value=>value==="",fromAttribute:attribute=>attribute,toAttribute:value=>value,fromFormState:state=>typeof state=="string"?state:""};function resolveFormValueAdapter(adapter){return adapter===void 0?stringFormValueAdapter:{empty:adapter.empty,toFormValue:value=>adapter.toFormValue(value),...adapter.toFormState?{toFormState:value=>adapter.toFormState(value)}:{},isEmpty:adapter.isEmpty?value=>adapter.isEmpty(value):isEmptyFormValue,fromAttribute:adapter.fromAttribute?attribute=>adapter.fromAttribute(attribute):attribute=>attribute,toAttribute:adapter.toAttribute?value=>adapter.toAttribute(value):value=>value==null?null:String(value),fromFormState:adapter.fromFormState?state=>adapter.fromFormState(state):state=>typeof state=="string"?state:adapter.empty}}function isBarredFromValidation(host,internals){if((host.effectiveDisabled??host.disabled)||host.readonly)return!0;if(internals){const willValidate=readNativeWillValidate(internals);if(willValidate!==void 0)return!willValidate}return!1}function readNativeWillValidate(internals){if(typeof ElementInternals!="function")return;const getter=Object.getOwnPropertyDescriptor(ElementInternals.prototype,"willValidate")?.get;if(typeof getter=="function")try{const value=getter.call(internals);return typeof value=="boolean"?value:void 0}catch{return}}function installCustomErrorProperty(host,getCustomValidityMessage){if(Object.prototype.hasOwnProperty.call(host,"customError"))return;const setValidity=host.setCustomValidity.bind(host),resetValidity=host.resetValidity?.bind(host);let committing=!1,resetting=!1;const reflectMessage=message=>{message?host.getAttribute("custom-error")!==message&&host.setAttribute("custom-error",message):host.hasAttribute("custom-error")&&host.removeAttribute("custom-error")},commit=next=>{if(committing){resetting&&setValidity(next??"");return}const old=getCustomValidityMessage()||null,message=next??"";committing=!0;try{setValidity(message),reflectMessage(getCustomValidityMessage()||"")}finally{committing=!1}host.requestUpdate("customError",old)};Object.defineProperty(host,"customError",{configurable:!0,enumerable:!0,get:()=>getCustomValidityMessage()||null,set:commit}),Object.defineProperty(host,"setCustomValidity",{configurable:!0,writable:!0,value:commit}),resetValidity&&Object.defineProperty(host,"resetValidity",{configurable:!0,writable:!0,value:()=>{if(committing)return;const old=getCustomValidityMessage()||null;committing=!0,resetting=!0;try{resetValidity(),reflectMessage(getCustomValidityMessage()||"")}finally{resetting=!1,committing=!1}host.requestUpdate("customError",old)}})}function FormAssociated(Base,valueAdapter){const adapter=resolveFormValueAdapter(valueAdapter),defaultValueConverter={fromAttribute:attribute=>attribute===null?null:adapter.fromAttribute(attribute),toAttribute:value=>value==null?null:adapter.toAttribute(value)};class FormAssociatedElement extends Base{static{this.formAssociated=!0}static{this.properties={name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0,...valueAdapter?{converter:defaultValueConverter}:{}},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},form:{noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(...args){super(...args),this._fieldsetDisabled=!1,this._disabled=!1,this._reflectingDisabledAttribute=!1,this._name="",this._value=adapter.empty,this._defaultValue=adapter.empty,this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.reflectingCustomError=!1,this.reflectingFormOwner=!1,this._required=!1,this._hasInteracted=!1,this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),this.commitFormValue(this._value),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init));const markInteracted=()=>{this._hasInteracted||(this._hasInteracted=!0,this.syncValidityStates())};this.addEventListener("input",markInteracted),this.addEventListener("change",markInteracted),this.addEventListener("focusout",()=>{this.effectiveDisabled||markInteracted()}),this.syncValidityStates()}get form(){return getFormOwner(this.internals)}set form(owner){if(!this.reflectingFormOwner){this.reflectingFormOwner=!0;try{setFormOwner(this,owner)}finally{this.reflectingFormOwner=!1}}}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector("input:not([type='hidden']), textarea, select, button, [tabindex]:not([tabindex='-1'])")??null}[SET_ANCHORED_VALIDITY](flags,message=""){this.validityController.setValidity(flags,message),this.syncValidityStates()}commitCustomValidity(message){const old=this.customError,normalized=message??"";this.validityController.setCustomValidity(normalized),this.syncValidityStates(),this.reflectingCustomError=!0;try{normalized?this.setAttribute("custom-error",normalized):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}this.requestUpdate("customError",old)}setCustomValidity(message){this.commitCustomValidity(message)}resetValidity(){this.commitCustomValidity(""),this.updateValidity(),this.syncValidityStates()}syncValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this._hasInteracted,barred:this.isBarredFromValidation()})}isBarredFromValidation(){return isBarredFromValidation(this,this.internals)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}commitFormValue(value){const submitted=adapter.toFormValue(value);adapter.toFormState?this.internals.setFormValue(submitted,adapter.toFormState(value)):this.internals.setFormValue(submitted)}get value(){return this._value}set value(next){const old=this._value;this._value=next??adapter.empty,this.settingDefaultValue||(this._valueDirty=!0),this.commitFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}captureLiveValueCheckpoint(){return{value:this._value,dirty:this._valueDirty}}restoreLiveValueCheckpoint(checkpoint){const old=this._value;this._value=checkpoint.value,this._valueDirty=checkpoint.dirty,this.commitFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??adapter.empty,this.reflectingDefaultValue=!0;try{const attribute=next==null?null:adapter.toAttribute(this._defaultValue);attribute==null?this.removeAttribute("value"):this.setAttribute("value",attribute)}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get customError(){return this.validityController.customValidityMessage||null}set customError(next){this.reflectingCustomError||this.commitCustomValidity(next)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.updateValidity(),this.syncValidityStates(),this.requestUpdate("disabled",old)}toggleAttribute(qualifiedName,force){if(qualifiedName!=="disabled")return super.toggleAttribute(qualifiedName,force);this._reflectingDisabledAttribute=!0;try{return super.toggleAttribute(qualifiedName,force)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}setAttribute(qualifiedName,value){if(qualifiedName!=="disabled"){super.setAttribute(qualifiedName,value);return}this._reflectingDisabledAttribute=!0;try{super.setAttribute(qualifiedName,value)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}removeAttribute(qualifiedName){if(qualifiedName!=="disabled"){super.removeAttribute(qualifiedName);return}this._reflectingDisabledAttribute=!0;try{super.removeAttribute(qualifiedName)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}get required(){return this._required}set required(next){const old=this._required;this._required=next,this.toggleAttribute("required",next),this.updateValidity(),this.syncValidityStates(),this.requestUpdate("required",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}setFormValue(next){this.value=next}updateValidity(){if(this.isBarredFromValidation()){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&adapter.isEmpty(this._value)){const overrides=this.strings,message=resolveLyraString(this,"fieldRequired",overrides,void 0,void 0,FORM_ASSOCIATED_DEFAULT_STRINGS);this[SET_ANCHORED_VALIDITY]({valueMissing:!0},message)}else this[SET_ANCHORED_VALIDITY]({})}syncConstraintsToNative(){const host=this;host.hasUpdated&&host.performUpdate()}checkValidity(){return this.syncConstraintsToNative(),this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.syncConstraintsToNative(),this.updateValidity(),this._hasInteracted=!0,this.syncValidityStates(),this.internals.reportValidity()}formResetCallback(){this._valueDirty=!1,this.restoreLiveValueFromDefault(),this._hasInteracted=!1,this.syncValidityStates()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state,reason){this.value=adapter.fromFormState(state)}formDisabledCallback(fieldsetDisabled){if(this._reflectingDisabledAttribute)return;const before=this.effectiveDisabled;this._fieldsetDisabled=fieldsetDisabled,this.effectiveDisabled!==before&&(this.updateValidity(),this.syncValidityStates(),this.requestUpdate())}updated(changed){super.updated(changed),!(!changed.has("readonly")&&!changed.has("disabled"))&&(this.updateValidity(),this.syncValidityStates())}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.syncValidityStates()}}return FormAssociatedElement}export{FormAssociated,attachInternalsSafely,createFallbackInternals,createStringArrayFormDataState,getFormOwner,installCustomErrorProperty,isBarredFromValidation,isEmptyFormValue,readStringArrayFormDataState,setFormOwner,stringFormValueAdapter};
|
|
1
|
+
import{LYRA_DEFAULT_fieldRequired}from"./default-strings.generated.js";import{resolveLyraString}from"./localization-runtime.js";import{AnchoredValidityController,SET_ANCHORED_VALIDITY,VALIDITY_ANCHOR}from"./anchored-validity.js";import{syncValidityStates}from"./custom-states.js";import{installInvalidEventAlias}from"./invalid-event-alias.js";import{omittedEmptyStringConverter}from"./converters.js";import{attachInternalsSafely,createFallbackInternals}from"./element-internals.js";import"./form-control-labels.js";const FORM_ASSOCIATED_DEFAULT_STRINGS=Object.freeze({fieldRequired:LYRA_DEFAULT_fieldRequired});function setFormOwner(host,owner){const id=typeof owner=="string"?owner:owner?.id??"";id?host.setAttribute("form",id):host.removeAttribute("form")}function getFormOwner(internals){return internals.form}function createStringArrayFormDataState(name,values){const state=new FormData,key=name||"value";for(const value of values)state.append(key,value);return state}function readStringArrayFormDataState(state){if(typeof FormData!="function")return[];let entries;try{entries=[...FormData.prototype.values.call(state)]}catch{return[]}return entries.some(entry=>typeof entry!="string")?[]:entries}function isEmptyFormValue(value){if(value==null)return!0;if(typeof value=="string")return value==="";if(typeof value=="object")try{if(Array.isArray(value))return value.length===0;const prototype=Object.getPrototypeOf(value);if(prototype===null)return Object.keys(value).length===0;if(Object.getPrototypeOf(prototype)===null){const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor")?.value;if(typeof constructor=="function"&&constructor.name==="Object"&&constructor.prototype===prototype)return Object.keys(value).length===0}}catch{return!1}return!1}const stringFormValueAdapter={empty:"",toFormValue:value=>value,isEmpty:value=>value==="",fromAttribute:attribute=>attribute,toAttribute:value=>value,fromFormState:state=>typeof state=="string"?state:""};function resolveFormValueAdapter(adapter){return adapter===void 0?stringFormValueAdapter:{empty:adapter.empty,toFormValue:value=>adapter.toFormValue(value),...adapter.toFormState?{toFormState:value=>adapter.toFormState(value)}:{},isEmpty:adapter.isEmpty?value=>adapter.isEmpty(value):isEmptyFormValue,fromAttribute:adapter.fromAttribute?attribute=>adapter.fromAttribute(attribute):attribute=>attribute,toAttribute:adapter.toAttribute?value=>adapter.toAttribute(value):value=>value==null?null:String(value),fromFormState:adapter.fromFormState?state=>adapter.fromFormState(state):state=>typeof state=="string"?state:adapter.empty}}function isBarredFromValidation(host,internals){if((host.effectiveDisabled??host.disabled)||host.readonly)return!0;if(internals){const willValidate=readNativeWillValidate(internals);if(willValidate!==void 0)return!willValidate}return!1}function readNativeWillValidate(internals){if(typeof ElementInternals!="function")return;const getter=Object.getOwnPropertyDescriptor(ElementInternals.prototype,"willValidate")?.get;if(typeof getter=="function")try{const value=getter.call(internals);return typeof value=="boolean"?value:void 0}catch{return}}function installCustomErrorProperty(host,getCustomValidityMessage){if(Object.prototype.hasOwnProperty.call(host,"customError"))return;const setValidity=host.setCustomValidity.bind(host),resetValidity=host.resetValidity?.bind(host);let committing=!1,resetting=!1;const reflectMessage=message=>{message?host.getAttribute("custom-error")!==message&&host.setAttribute("custom-error",message):host.hasAttribute("custom-error")&&host.removeAttribute("custom-error")},commit=next=>{if(committing){resetting&&setValidity(next??"");return}const old=getCustomValidityMessage()||null,message=next??"";committing=!0;try{setValidity(message),reflectMessage(getCustomValidityMessage()||"")}finally{committing=!1}host.requestUpdate("customError",old)};Object.defineProperty(host,"customError",{configurable:!0,enumerable:!0,get:()=>getCustomValidityMessage()||null,set:commit}),Object.defineProperty(host,"setCustomValidity",{configurable:!0,writable:!0,value:commit}),resetValidity&&Object.defineProperty(host,"resetValidity",{configurable:!0,writable:!0,value:()=>{if(committing)return;const old=getCustomValidityMessage()||null;committing=!0,resetting=!0;try{resetValidity(),reflectMessage(getCustomValidityMessage()||"")}finally{resetting=!1,committing=!1}host.requestUpdate("customError",old)}})}function FormAssociated(Base,valueAdapter){const adapter=resolveFormValueAdapter(valueAdapter),defaultValueConverter={fromAttribute:attribute=>attribute===null?null:adapter.fromAttribute(attribute),toAttribute:value=>value==null?null:adapter.toAttribute(value)};class FormAssociatedElement extends Base{static{this.formAssociated=!0}static{this.properties={name:{reflect:!0,noAccessor:!0,converter:omittedEmptyStringConverter},value:{attribute:!1,noAccessor:!0},defaultValue:{attribute:"value",reflect:!0,useDefault:!0,noAccessor:!0,...valueAdapter?{converter:defaultValueConverter}:{}},customError:{attribute:"custom-error",reflect:!0,noAccessor:!0},form:{noAccessor:!0},disabled:{type:Boolean,reflect:!0,noAccessor:!0},required:{type:Boolean,reflect:!0,noAccessor:!0}}}constructor(...args){super(...args),this._fieldsetDisabled=!1,this._disabled=!1,this._reflectingDisabledAttribute=!1,this._name="",this._value=adapter.empty,this._defaultValue=adapter.empty,this._valueDirty=!1,this.settingDefaultValue=!1,this.reflectingDefaultValue=!1,this.reflectingCustomError=!1,this.reflectingFormOwner=!1,this._required=!1,this._hasInteracted=!1,this.internals=attachInternalsSafely(this),this.validityController=new AnchoredValidityController(this,this.internals,()=>this[VALIDITY_ANCHOR]()),this.commitFormValue(this._value),installInvalidEventAlias(this,init=>this.emit("lr-invalid",null,init));const markInteracted=()=>{this._hasInteracted||(this._hasInteracted=!0,this.syncValidityStates())};this.addEventListener("input",markInteracted),this.addEventListener("change",markInteracted),this.addEventListener("focusout",()=>{this.effectiveDisabled||markInteracted()}),this.syncValidityStates()}get form(){return getFormOwner(this.internals)}set form(owner){if(!this.reflectingFormOwner){this.reflectingFormOwner=!0;try{setFormOwner(this,owner)}finally{this.reflectingFormOwner=!1}}}getForm(){return getFormOwner(this.internals)}get labels(){return this.internals.labels}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}get willValidate(){return this.internals.willValidate}[VALIDITY_ANCHOR](){return this.renderRoot?.querySelector("input:not([type='hidden']), textarea, select, button, [tabindex]:not([tabindex='-1'])")??null}[SET_ANCHORED_VALIDITY](flags,message=""){this.validityController.setValidity(flags,message),this.syncValidityStates()}commitCustomValidity(message){const old=this.customError,normalized=message??"";this.validityController.setCustomValidity(normalized),this.syncValidityStates(),this.reflectingCustomError=!0;try{normalized?this.setAttribute("custom-error",normalized):this.removeAttribute("custom-error")}finally{this.reflectingCustomError=!1}this.requestUpdate("customError",old)}setCustomValidity(message){this.commitCustomValidity(message)}resetValidity(){this.commitCustomValidity(""),this.updateValidity(),this.syncValidityStates()}syncValidityStates(){syncValidityStates(this.internals,{required:this.required,hasInteracted:this._hasInteracted,barred:this.isBarredFromValidation()})}isBarredFromValidation(){return isBarredFromValidation(this,this.internals)}get name(){return this._name}set name(next){const old=this._name;this._name=next??"",this._name?this.setAttribute("name",this._name):this.removeAttribute("name"),this.requestUpdate("name",old)}commitFormValue(value){const submitted=adapter.toFormValue(value);adapter.toFormState?this.internals.setFormValue(submitted,adapter.toFormState(value)):this.internals.setFormValue(submitted)}get value(){return this._value}set value(next){const old=this._value;this._value=next??adapter.empty,this.settingDefaultValue||(this._valueDirty=!0),this.commitFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}captureLiveValueCheckpoint(){return{value:this._value,dirty:this._valueDirty}}restoreLiveValueCheckpoint(checkpoint){const old=this._value;this._value=checkpoint.value,this._valueDirty=checkpoint.dirty,this.commitFormValue(this._value),this.updateValidity(),this.requestUpdate("value",old)}get defaultValue(){return this._defaultValue}set defaultValue(next){if(this.reflectingDefaultValue)return;const old=this._defaultValue;this._defaultValue=next??adapter.empty,this.reflectingDefaultValue=!0;try{const attribute=next==null?null:adapter.toAttribute(this._defaultValue);attribute==null?this.removeAttribute("value"):this.setAttribute("value",attribute)}finally{this.reflectingDefaultValue=!1}this._valueDirty||this.restoreLiveValueFromDefault(),this.requestUpdate("defaultValue",old)}get customError(){return this.validityController.customValidityMessage||null}set customError(next){this.reflectingCustomError||this.commitCustomValidity(next)}get disabled(){return this._disabled}set disabled(next){const old=this._disabled;this._disabled=!!next,this.toggleAttribute("disabled",this._disabled),this.updateValidity(),this.syncValidityStates(),this.requestUpdate("disabled",old)}toggleAttribute(qualifiedName,force){if(qualifiedName!=="disabled")return super.toggleAttribute(qualifiedName,force);this._reflectingDisabledAttribute=!0;try{return super.toggleAttribute(qualifiedName,force)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}setAttribute(qualifiedName,value){if(qualifiedName!=="disabled"){super.setAttribute(qualifiedName,value);return}this._reflectingDisabledAttribute=!0;try{super.setAttribute(qualifiedName,value)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}removeAttribute(qualifiedName){if(qualifiedName!=="disabled"){super.removeAttribute(qualifiedName);return}this._reflectingDisabledAttribute=!0;try{super.removeAttribute(qualifiedName)}finally{queueMicrotask(()=>{this._reflectingDisabledAttribute=!1})}}get required(){return this._required}set required(next){const old=this._required;this._required=next,this.toggleAttribute("required",next),this.updateValidity(),this.syncValidityStates(),this.requestUpdate("required",old)}get effectiveDisabled(){return this.disabled||this._fieldsetDisabled}setFormValue(next){this.value=next}updateValidity(){if(this.isBarredFromValidation()){this[SET_ANCHORED_VALIDITY]({});return}if(this.required&&adapter.isEmpty(this._value)){const overrides=this.strings,message=resolveLyraString(this,"fieldRequired",overrides,void 0,void 0,FORM_ASSOCIATED_DEFAULT_STRINGS);this[SET_ANCHORED_VALIDITY]({valueMissing:!0},message)}else this[SET_ANCHORED_VALIDITY]({})}syncConstraintsToNative(){const host=this;host.hasUpdated&&host.performUpdate()}checkValidity(){return this.syncConstraintsToNative(),this.updateValidity(),this.internals.checkValidity()}reportValidity(){return this.syncConstraintsToNative(),this.updateValidity(),this._hasInteracted=!0,this.syncValidityStates(),this.internals.reportValidity()}formResetCallback(){this._valueDirty=!1,this.restoreLiveValueFromDefault(),this._hasInteracted=!1,this.syncValidityStates()}restoreLiveValueFromDefault(){this.settingDefaultValue=!0;try{this.value=this._defaultValue}finally{this.settingDefaultValue=!1}this._valueDirty=!1}formStateRestoreCallback(state,reason){this.value=adapter.fromFormState(state)}formDisabledCallback(fieldsetDisabled){if(this._reflectingDisabledAttribute)return;const before=this.effectiveDisabled;this._fieldsetDisabled=fieldsetDisabled,this.effectiveDisabled!==before&&(this.updateValidity(),this.syncValidityStates(),this.requestUpdate())}updated(changed){super.updated(changed),!(!changed.has("readonly")&&!changed.has("disabled"))&&(this.updateValidity(),this.syncValidityStates())}connectedCallback(){super.connectedCallback(),this.updateValidity(),this.syncValidityStates()}}return FormAssociatedElement}export{FormAssociated,attachInternalsSafely,createFallbackInternals,createStringArrayFormDataState,getFormOwner,installCustomErrorProperty,isBarredFromValidation,isEmptyFormValue,readStringArrayFormDataState,setFormOwner,stringFormValueAdapter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{deepActiveElementIn}from"./active-element.js";import{collectFocusableElements}from"./overlay-manager.js";const EXTERNAL_LABEL_ACTIVATION=Symbol("lr-external-label-activation"),EXTERNAL_LABEL_HOST_SEMANTICS=Symbol("lr-external-label-host-semantics"),attachedInternals=new WeakMap;function captureFormInternals(host,internals){attachedInternals.set(host,internals)}const COMPOSITE_ROLE_SELECTOR='[role="radiogroup"],[role="group"],[role="grid"],[role="tree"]',SEMANTIC_TARGET_SELECTOR=['input:not([type="hidden"]):not([tabindex="-1"])','textarea:not([tabindex="-1"])','select:not([tabindex="-1"])','button:not([tabindex="-1"])','[role]:not([tabindex="-1"])'].join(","),ACTIVATING_ROLES=new Set(["checkbox","switch","radio","menuitemcheckbox","menuitemradio"]),MAX_ASSOCIATION_CANDIDATES_PER_MUTATION=2048,MAX_ASSOCIATION_REFRESHES_PER_TASK=256,associationRootObservations=new WeakMap;function isLabelElement(node){return node!==null&&"nodeType"in node&&node.nodeType===1&&"localName"in node&&node.localName==="label"}function isHtmlElement(node){return node.nodeType===1&&"focus"in node&&"style"in node}function isShadowRootNode(node){return node?.nodeType===11&&"host"in node}function isCurrentlyAssociatedLabel(label,host){const root=host.getRootNode();if(label.getRootNode()!==root)return!1;if(!label.hasAttribute("for")){const control="control"in label?label.control:void 0;return control==null?label.contains(host):control===host}const id=label.htmlFor;return id===""?!1:"getElementById"in root&&typeof root.getElementById=="function"?root.getElementById(id)===host:!("querySelectorAll"in root)||typeof root.querySelectorAll!="function"?!1:[...root.querySelectorAll("[id]")].find(candidate=>candidate.id===id)===host}function addSubscriptionById(observation,subscription){if(!subscription.id)return;const subscribers=observation.subscriptionsById.get(subscription.id)??new Set;subscribers.add(subscription),observation.subscriptionsById.set(subscription.id,subscribers)}function removeSubscriptionById(observation,subscription){if(!subscription.id)return;const subscribers=observation.subscriptionsById.get(subscription.id);subscribers?.delete(subscription),subscribers?.size===0&&observation.subscriptionsById.delete(subscription.id)}function updateSubscriptionId(observation,subscription){const id=subscription.host.id;id!==subscription.id&&(removeSubscriptionById(observation,subscription),subscription.id=id,addSubscriptionById(observation,subscription))}function addImplicitSubscription(observation,label,subscription){const subscriptions=observation.implicitSubscriptionsByLabel.get(label)??new Set;subscriptions.add(subscription),observation.implicitSubscriptionsByLabel.set(label,subscriptions)}function removeImplicitSubscription(observation,label,subscription){const subscriptions=observation.implicitSubscriptionsByLabel.get(label);subscriptions?.delete(subscription),subscriptions?.size===0&&observation.implicitSubscriptionsByLabel.delete(label)}function updateImplicitSubscriptions(observation,subscription,labels){const next=labels.filter(label=>!label.hasAttribute("for"));for(const label of subscription.implicitLabels)next.includes(label)||removeImplicitSubscription(observation,label,subscription);for(const label of next)subscription.implicitLabels.includes(label)||addImplicitSubscription(observation,label,subscription);subscription.implicitLabels=next}function hasAssociationRefreshes(observation){return observation.pending.size>0||observation.fallbackIterator!==void 0}function cancelAssociationContinuation(observation){observation.cancelContinuation?.(),observation.cancelContinuation=void 0}function scheduleAssociationContinuation(observation){if(!hasAssociationRefreshes(observation)||observation.cancelContinuation!==void 0)return;const callback=()=>{observation.cancelContinuation=void 0,drainAssociationRefreshes(observation)};if(observation.ownerWindow){const handle=observation.ownerWindow.setTimeout(callback,0);observation.cancelContinuation=()=>observation.ownerWindow?.clearTimeout(handle)}else{const handle=globalThis.setTimeout(callback,0);observation.cancelContinuation=()=>globalThis.clearTimeout(handle)}}function refreshAssociationSubscription(observation,subscription){subscription.active&&(subscription.listener(),observation.fallbackIterator&&(subscription.fallbackGeneration=observation.fallbackGeneration))}function drainTargetedAssociationRefreshes(observation){let remaining=MAX_ASSOCIATION_REFRESHES_PER_TASK;for(const subscription of observation.pending)if(observation.pending.delete(subscription),refreshAssociationSubscription(observation,subscription),--remaining===0)break;scheduleAssociationContinuation(observation)}function drainAssociationRefreshes(observation){let remaining=MAX_ASSOCIATION_REFRESHES_PER_TASK;for(const subscription of observation.pending)if(observation.pending.delete(subscription),refreshAssociationSubscription(observation,subscription),--remaining===0)break;for(;remaining>0&&observation.fallbackIterator;){const next=observation.fallbackIterator.next();if(next.done){observation.fallbackIterator=void 0;break}next.value.active&&next.value.fallbackGeneration!==observation.fallbackGeneration&&(next.value.listener(),next.value.fallbackGeneration=observation.fallbackGeneration),remaining--}scheduleAssociationContinuation(observation)}function notifyAssociationSubscriptions(observation,subscriptions,fallbackAll=!1){if(fallbackAll){const continuationPending=observation.cancelContinuation!==void 0;observation.pending.clear(),observation.fallbackGeneration++,observation.fallbackIterator=observation.subscriptions.values();for(const subscription of subscriptions)subscription.active&&observation.pending.add(subscription);continuationPending?drainTargetedAssociationRefreshes(observation):drainAssociationRefreshes(observation);return}for(const subscription of subscriptions)subscription.active&&observation.pending.add(subscription);drainTargetedAssociationRefreshes(observation)}function isLabelableElement(element){return element.localName==="input"?element.type!=="hidden":element.localName==="button"||element.localName==="meter"||element.localName==="output"||element.localName==="progress"||element.localName==="select"||element.localName==="textarea"?!0:element.localName.includes("-")&&element.constructor.formAssociated===!0}function collectAssociationElement(element,result){const id=element.getAttribute("id");return id&&result.ids.add(id),isLabelElement(element)&&element.hasAttribute("for")&&element.htmlFor&&result.ids.add(element.htmlFor),isLabelableElement(element)}function nextAssociationNode(root,current){if(current.firstChild)return current.firstChild;let cursor=current;for(;cursor&&cursor!==root;){if(cursor.nextSibling)return cursor.nextSibling;cursor=cursor.parentNode}return null}function collectAssociationCandidates(node,result){let containsLabelable=!1,current=node;for(;current;){if(result.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){result.truncated=!0;break}result.work++,current.nodeType===1&&(containsLabelable=collectAssociationElement(current,result)||containsLabelable),current=nextAssociationNode(node,current)}return containsLabelable}function containingImplicitLabel(node){if(isLabelElement(node))return node.hasAttribute("for")?null:node;if(node.nodeType!==1||!("closest"in node))return null;const label=node.closest("label");return label&&!label.hasAttribute("for")?label:null}function collectFirstImplicitSubscription(observation,label,candidates,affected){let current=label.firstChild;for(;current;){if(candidates.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){candidates.truncated=!0;return}if(candidates.work++,current.nodeType===1&&(isLabelableElement(current)||observation.subscriptionsByHost.has(current))){const subscription=observation.subscriptionsByHost.get(current);subscription&&affected.add(subscription);return}current=nextAssociationNode(label,current)}}function affectedAssociationSubscriptions(observation,mutations){const affected=new Set,candidates={ids:new Set,implicitLabels:new Set,truncated:!1,work:0},addIndexedCandidates=()=>{for(const id of candidates.ids)for(const subscription of observation.subscriptionsById.get(id)??[])affected.add(subscription);for(const label of candidates.implicitLabels)for(const subscription of observation.implicitSubscriptionsByLabel.get(label)??[])affected.add(subscription)};for(const mutation of mutations){if(candidates.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){candidates.truncated=!0;break}if(candidates.work++,mutation.type==="attributes"){const target=mutation.target;if(mutation.attributeName==="id"){const oldId=mutation.oldValue??"",id=target.getAttribute("id")??"";oldId&&candidates.ids.add(oldId),id&&candidates.ids.add(id);const hostSubscription=observation.subscriptionsByHost.get(target);hostSubscription&&(affected.add(hostSubscription),updateSubscriptionId(observation,hostSubscription))}else if(mutation.attributeName==="for"&&isLabelElement(target)){const oldFor=mutation.oldValue;oldFor&&candidates.ids.add(oldFor),target.htmlFor&&candidates.ids.add(target.htmlFor);for(const subscription of observation.implicitSubscriptionsByLabel.get(target)??[])affected.add(subscription);target.hasAttribute("for")||candidates.implicitLabels.add(target)}else if(mutation.attributeName==="type"&&target.localName==="input"){const label=containingImplicitLabel(target);label&&candidates.implicitLabels.add(label)}continue}let changedLabelableShape=!1;for(const node of mutation.addedNodes)if(changedLabelableShape=collectAssociationCandidates(node,candidates)||changedLabelableShape,candidates.truncated)break;if(!candidates.truncated){for(const node of mutation.removedNodes)if(changedLabelableShape=collectAssociationCandidates(node,candidates)||changedLabelableShape,candidates.truncated)break}if(changedLabelableShape){const label=containingImplicitLabel(mutation.target);label&&candidates.implicitLabels.add(label)}if(candidates.truncated)break}if(addIndexedCandidates(),candidates.truncated)return{subscriptions:affected,fallbackAll:!0};for(const label of candidates.implicitLabels)if(collectFirstImplicitSubscription(observation,label,candidates,affected),candidates.truncated)return{subscriptions:affected,fallbackAll:!0};return{subscriptions:affected,fallbackAll:!1}}function observeAssociationRoot(host,listener){const root=host.getRootNode();let observation=associationRootObservations.get(root);if(!observation){const Observer=host.ownerDocument.defaultView?.MutationObserver,subscriptions=new Set,subscriptionsById=new Map,implicitSubscriptionsByLabel=new WeakMap,subscriptionsByHost=new WeakMap,pending=new Set,holder={},observer=Observer===void 0?void 0:new Observer(mutations=>{const current=holder.observation;if(!current)return;const affected=affectedAssociationSubscriptions(current,mutations);notifyAssociationSubscriptions(current,affected.subscriptions,affected.fallbackAll)});observer?.observe(root,{attributes:!0,attributeFilter:["for","id","type"],attributeOldValue:!0,childList:!0,subtree:!0}),observation={subscriptions,subscriptionsById,implicitSubscriptionsByLabel,subscriptionsByHost,pending,observer,ownerWindow:host.ownerDocument.defaultView,fallbackGeneration:0},holder.observation=observation,associationRootObservations.set(root,observation)}const subscription={host,listener,id:host.id,implicitLabels:[],fallbackGeneration:-1,active:!0};return observation.subscriptions.add(subscription),observation.subscriptionsByHost.set(host,subscription),addSubscriptionById(observation,subscription),{update(labels){subscription.active&&(updateSubscriptionId(observation,subscription),updateImplicitSubscriptions(observation,subscription,labels))},disconnect(){if(!subscription.active)return;subscription.active=!1,observation.pending.delete(subscription),observation.subscriptions.delete(subscription),observation.subscriptionsByHost.delete(host);for(const label of subscription.implicitLabels)removeImplicitSubscription(observation,label,subscription);subscription.implicitLabels=[],removeSubscriptionById(observation,subscription);const current=associationRootObservations.get(root);!current||current.subscriptions.size>0||(current.observer?.disconnect(),cancelAssociationContinuation(current),current.pending.clear(),current.fallbackIterator=void 0,associationRootObservations.delete(root))}}}function isComposedDescendant(host,candidate){let current=candidate;for(;current;){if(current===host)return!0;if(current.parentNode){current=current.parentNode;continue}current=isShadowRootNode(current)?current.host:null}return!1}function resolveExternalLabels(host){const native=attachedInternals.get(host)?.labels;if(native)return Array.from(native).filter(isLabelElement).filter(label=>isCurrentlyAssociatedLabel(label,host));const labels=[],ancestor=host.closest("label");ancestor&&isCurrentlyAssociatedLabel(ancestor,host)&&labels.push(ancestor);const root=host.getRootNode();if(host.id&&"querySelectorAll"in root)for(const found of root.querySelectorAll("label[for]"))isLabelElement(found)&&isCurrentlyAssociatedLabel(found,host)&&!labels.includes(found)&&labels.push(found);return labels}function labelText(node,exclude){if(node===exclude)return"";if(node.nodeType===Node.TEXT_NODE)return node.textContent??"";let text="";for(const child of node.childNodes)text+=labelText(child,exclude);return text}function resolveExternalLabelText(labels,host){return labels.map(label=>labelText(label,host).trim()).filter(text=>text!=="").join(" ")}class ExternalLabelController{constructor(host){this.host=host,this.labels=[],this.activating=!1,this.onLabelClick=event=>{if(this.activating||this.barred)return;const source=event.currentTarget;if(!source||!isLabelElement(source)||!isCurrentlyAssociatedLabel(source,this.host)){this.refresh();return}event.composedPath().includes(this.host)||queueMicrotask(()=>{if(event.defaultPrevented||!this.host.isConnected||this.barred)return;if(!isCurrentlyAssociatedLabel(source,this.host)){this.refresh();return}const focusTarget=this.resolveFocusTarget(),activation=this.resolveActivation(focusTarget);this.activating=!0;try{this.host.focus(),isComposedDescendant(this.host,deepActiveElementIn(this.host.ownerDocument))||focusTarget?.focus(),activation==="activate"&&focusTarget?.click()}finally{this.activating=!1}})}}hostConnected(){this.associationRootSubscription?.disconnect(),this.associationRootSubscription=observeAssociationRoot(this.host,()=>this.refresh()),this.refresh()}hostUpdated(){this.refresh()}hostDisconnected(){this.release(),this.stopObservingLabels(),this.associationRootSubscription?.disconnect(),this.associationRootSubscription=void 0;for(const label of this.labels)label.removeEventListener("click",this.onLabelClick);this.labels=[]}refresh(){const next=resolveExternalLabels(this.host);if(next.length!==this.labels.length||next.some((label,index)=>label!==this.labels[index])){for(const label of this.labels)label.removeEventListener("click",this.onLabelClick);this.labels=next;for(const label of this.labels)label.addEventListener("click",this.onLabelClick);this.observeLabels()}this.associationRootSubscription?.update(next),this.apply()}observeLabels(){this.stopObservingLabels();const Observer=this.host.ownerDocument.defaultView?.MutationObserver;if(this.labels.length===0||Observer===void 0)return;const observer=new Observer(()=>this.refresh());for(const label of this.labels)observer.observe(label,{characterData:!0,childList:!0,subtree:!0});this.labelObserver=observer}stopObservingLabels(){this.labelObserver?.disconnect(),this.labelObserver=void 0}get barred(){return typeof this.host.matches=="function"&&this.host.matches(":disabled")?!0:!!(this.host.effectiveDisabled??this.host.disabled)}resolveNameTarget(focusTarget){if(this.hostSemanticOwner)return this.host;const root=this.ownRoot;if(!root)return focusTarget;if(focusTarget){for(const composite of root.querySelectorAll(COMPOSITE_ROLE_SELECTOR))if(isHtmlElement(composite)&&isComposedDescendant(composite,focusTarget))return composite}if(focusTarget&&focusTarget.getRootNode()===root)return focusTarget;const owned=focusTarget?this.outermostOwnedAncestor(focusTarget):null;if(owned)return owned;const semantic=root.querySelector(SEMANTIC_TARGET_SELECTOR);return semantic&&isHtmlElement(semantic)?semantic:focusTarget}outermostOwnedAncestor(node){const root=this.ownRoot;let owned=null,current=node;for(;current&¤t!==this.host;)isHtmlElement(current)&&(current.getRootNode()===root||current.parentNode===this.host)&&(owned=current),current.parentNode?current=current.parentNode:current=isShadowRootNode(current)?current.host:null;return owned}get ownRoot(){const root=this.host.renderRoot;return isShadowRootNode(root)?root:this.host.shadowRoot}resolveFocusTarget(){return this.hostSemanticOwner?this.host:collectFocusableElements(this.host)[0]??null}get hostSemanticOwner(){const candidate=this.host;return typeof candidate[EXTERNAL_LABEL_HOST_SEMANTICS]=="function"?candidate:null}hostHasAuthoredName(owner){return owner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"has-authored-name"})===!0}resolveActivation(focusTarget){const declared=this.host[EXTERNAL_LABEL_ACTIVATION];if(typeof declared=="function")return declared.call(this.host);if(!focusTarget||focusTarget.getRootNode()!==this.ownRoot)return"focus";const role=focusTarget.getAttribute("role");return role&&ACTIVATING_ROLES.has(role)?"activate":"focus"}apply(){const hostOwner=this.hostSemanticOwner;if(hostOwner&&this.hostHasAuthoredName(hostOwner)||!hostOwner&&this.host.hasAttribute("aria-label")){this.release();return}const name=resolveExternalLabelText(this.labels,this.host);if(name===""){this.release();return}const settled=this.applied;if(settled&&settled.name===name&&settled.target.isConnected&&settled.target.getAttribute("aria-label")===name)return;const target=this.resolveNameTarget(this.resolveFocusTarget());target&&(this.applied&&this.applied.target!==target&&this.release(),this.applied||(this.applied={target,name,had:target.hasAttribute("aria-label"),previous:target.getAttribute("aria-label")}),target===this.host&&hostOwner?hostOwner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"apply",name}):target.getAttribute("aria-label")!==name&&target.setAttribute("aria-label",name),this.applied.name=name)}release(){const applied=this.applied;if(this.applied=void 0,!applied)return;const{target,name,had,previous}=applied,hostOwner=target===this.host?this.hostSemanticOwner:null;if(hostOwner){hostOwner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"release",appliedName:name,hadPrevious:had,previous});return}target.getAttribute("aria-label")===name&&(had?target.setAttribute("aria-label",previous??""):target.removeAttribute("aria-label"))}}export{EXTERNAL_LABEL_ACTIVATION,EXTERNAL_LABEL_HOST_SEMANTICS,ExternalLabelController,captureFormInternals,resolveExternalLabelText,resolveExternalLabels};
|
|
1
|
+
import{deepActiveElementIn}from"./active-element.js";import{collectFocusableElements}from"./overlay-manager.js";import{registerFormControlLabelSupport}from"./lyra-element.js";const EXTERNAL_LABEL_ACTIVATION=Symbol("lr-external-label-activation"),EXTERNAL_LABEL_HOST_SEMANTICS=Symbol("lr-external-label-host-semantics"),attachedInternals=new WeakMap;function captureFormInternals(host,internals){attachedInternals.set(host,internals)}const COMPOSITE_ROLE_SELECTOR='[role="radiogroup"],[role="group"],[role="grid"],[role="tree"]',SEMANTIC_TARGET_SELECTOR=['input:not([type="hidden"]):not([tabindex="-1"])','textarea:not([tabindex="-1"])','select:not([tabindex="-1"])','button:not([tabindex="-1"])','[role]:not([tabindex="-1"])'].join(","),ACTIVATING_ROLES=new Set(["checkbox","switch","radio","menuitemcheckbox","menuitemradio"]),MAX_ASSOCIATION_CANDIDATES_PER_MUTATION=2048,MAX_ASSOCIATION_REFRESHES_PER_TASK=256,associationRootObservations=new WeakMap;function isLabelElement(node){return node!==null&&"nodeType"in node&&node.nodeType===1&&"localName"in node&&node.localName==="label"}function isHtmlElement(node){return node.nodeType===1&&"focus"in node&&"style"in node}function isShadowRootNode(node){return node?.nodeType===11&&"host"in node}function isCurrentlyAssociatedLabel(label,host){const root=host.getRootNode();if(label.getRootNode()!==root)return!1;if(!label.hasAttribute("for")){const control="control"in label?label.control:void 0;return control==null?label.contains(host):control===host}const id=label.htmlFor;return id===""?!1:"getElementById"in root&&typeof root.getElementById=="function"?root.getElementById(id)===host:!("querySelectorAll"in root)||typeof root.querySelectorAll!="function"?!1:[...root.querySelectorAll("[id]")].find(candidate=>candidate.id===id)===host}function addSubscriptionById(observation,subscription){if(!subscription.id)return;const subscribers=observation.subscriptionsById.get(subscription.id)??new Set;subscribers.add(subscription),observation.subscriptionsById.set(subscription.id,subscribers)}function removeSubscriptionById(observation,subscription){if(!subscription.id)return;const subscribers=observation.subscriptionsById.get(subscription.id);subscribers?.delete(subscription),subscribers?.size===0&&observation.subscriptionsById.delete(subscription.id)}function updateSubscriptionId(observation,subscription){const id=subscription.host.id;id!==subscription.id&&(removeSubscriptionById(observation,subscription),subscription.id=id,addSubscriptionById(observation,subscription))}function addImplicitSubscription(observation,label,subscription){const subscriptions=observation.implicitSubscriptionsByLabel.get(label)??new Set;subscriptions.add(subscription),observation.implicitSubscriptionsByLabel.set(label,subscriptions)}function removeImplicitSubscription(observation,label,subscription){const subscriptions=observation.implicitSubscriptionsByLabel.get(label);subscriptions?.delete(subscription),subscriptions?.size===0&&observation.implicitSubscriptionsByLabel.delete(label)}function updateImplicitSubscriptions(observation,subscription,labels){const next=labels.filter(label=>!label.hasAttribute("for"));for(const label of subscription.implicitLabels)next.includes(label)||removeImplicitSubscription(observation,label,subscription);for(const label of next)subscription.implicitLabels.includes(label)||addImplicitSubscription(observation,label,subscription);subscription.implicitLabels=next}function hasAssociationRefreshes(observation){return observation.pending.size>0||observation.fallbackIterator!==void 0}function cancelAssociationContinuation(observation){observation.cancelContinuation?.(),observation.cancelContinuation=void 0}function scheduleAssociationContinuation(observation){if(!hasAssociationRefreshes(observation)||observation.cancelContinuation!==void 0)return;const callback=()=>{observation.cancelContinuation=void 0,drainAssociationRefreshes(observation)};if(observation.ownerWindow){const handle=observation.ownerWindow.setTimeout(callback,0);observation.cancelContinuation=()=>observation.ownerWindow?.clearTimeout(handle)}else{const handle=globalThis.setTimeout(callback,0);observation.cancelContinuation=()=>globalThis.clearTimeout(handle)}}function refreshAssociationSubscription(observation,subscription){subscription.active&&(subscription.listener(),observation.fallbackIterator&&(subscription.fallbackGeneration=observation.fallbackGeneration))}function drainTargetedAssociationRefreshes(observation){let remaining=MAX_ASSOCIATION_REFRESHES_PER_TASK;for(const subscription of observation.pending)if(observation.pending.delete(subscription),refreshAssociationSubscription(observation,subscription),--remaining===0)break;scheduleAssociationContinuation(observation)}function drainAssociationRefreshes(observation){let remaining=MAX_ASSOCIATION_REFRESHES_PER_TASK;for(const subscription of observation.pending)if(observation.pending.delete(subscription),refreshAssociationSubscription(observation,subscription),--remaining===0)break;for(;remaining>0&&observation.fallbackIterator;){const next=observation.fallbackIterator.next();if(next.done){observation.fallbackIterator=void 0;break}next.value.active&&next.value.fallbackGeneration!==observation.fallbackGeneration&&(next.value.listener(),next.value.fallbackGeneration=observation.fallbackGeneration),remaining--}scheduleAssociationContinuation(observation)}function notifyAssociationSubscriptions(observation,subscriptions,fallbackAll=!1){if(fallbackAll){const continuationPending=observation.cancelContinuation!==void 0;observation.pending.clear(),observation.fallbackGeneration++,observation.fallbackIterator=observation.subscriptions.values();for(const subscription of subscriptions)subscription.active&&observation.pending.add(subscription);continuationPending?drainTargetedAssociationRefreshes(observation):drainAssociationRefreshes(observation);return}for(const subscription of subscriptions)subscription.active&&observation.pending.add(subscription);drainTargetedAssociationRefreshes(observation)}function isLabelableElement(element){return element.localName==="input"?element.type!=="hidden":element.localName==="button"||element.localName==="meter"||element.localName==="output"||element.localName==="progress"||element.localName==="select"||element.localName==="textarea"?!0:element.localName.includes("-")&&element.constructor.formAssociated===!0}function collectAssociationElement(element,result){const id=element.getAttribute("id");return id&&result.ids.add(id),isLabelElement(element)&&element.hasAttribute("for")&&element.htmlFor&&result.ids.add(element.htmlFor),isLabelableElement(element)}function nextAssociationNode(root,current){if(current.firstChild)return current.firstChild;let cursor=current;for(;cursor&&cursor!==root;){if(cursor.nextSibling)return cursor.nextSibling;cursor=cursor.parentNode}return null}function collectAssociationCandidates(node,result){let containsLabelable=!1,current=node;for(;current;){if(result.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){result.truncated=!0;break}result.work++,current.nodeType===1&&(containsLabelable=collectAssociationElement(current,result)||containsLabelable),current=nextAssociationNode(node,current)}return containsLabelable}function containingImplicitLabel(node){if(isLabelElement(node))return node.hasAttribute("for")?null:node;if(node.nodeType!==1||!("closest"in node))return null;const label=node.closest("label");return label&&!label.hasAttribute("for")?label:null}function collectFirstImplicitSubscription(observation,label,candidates,affected){let current=label.firstChild;for(;current;){if(candidates.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){candidates.truncated=!0;return}if(candidates.work++,current.nodeType===1&&(isLabelableElement(current)||observation.subscriptionsByHost.has(current))){const subscription=observation.subscriptionsByHost.get(current);subscription&&affected.add(subscription);return}current=nextAssociationNode(label,current)}}function affectedAssociationSubscriptions(observation,mutations){const affected=new Set,candidates={ids:new Set,implicitLabels:new Set,truncated:!1,work:0},addIndexedCandidates=()=>{for(const id of candidates.ids)for(const subscription of observation.subscriptionsById.get(id)??[])affected.add(subscription);for(const label of candidates.implicitLabels)for(const subscription of observation.implicitSubscriptionsByLabel.get(label)??[])affected.add(subscription)};for(const mutation of mutations){if(candidates.work>=MAX_ASSOCIATION_CANDIDATES_PER_MUTATION){candidates.truncated=!0;break}if(candidates.work++,mutation.type==="attributes"){const target=mutation.target;if(mutation.attributeName==="id"){const oldId=mutation.oldValue??"",id=target.getAttribute("id")??"";oldId&&candidates.ids.add(oldId),id&&candidates.ids.add(id);const hostSubscription=observation.subscriptionsByHost.get(target);hostSubscription&&(affected.add(hostSubscription),updateSubscriptionId(observation,hostSubscription))}else if(mutation.attributeName==="for"&&isLabelElement(target)){const oldFor=mutation.oldValue;oldFor&&candidates.ids.add(oldFor),target.htmlFor&&candidates.ids.add(target.htmlFor);for(const subscription of observation.implicitSubscriptionsByLabel.get(target)??[])affected.add(subscription);target.hasAttribute("for")||candidates.implicitLabels.add(target)}else if(mutation.attributeName==="type"&&target.localName==="input"){const label=containingImplicitLabel(target);label&&candidates.implicitLabels.add(label)}continue}let changedLabelableShape=!1;for(const node of mutation.addedNodes)if(changedLabelableShape=collectAssociationCandidates(node,candidates)||changedLabelableShape,candidates.truncated)break;if(!candidates.truncated){for(const node of mutation.removedNodes)if(changedLabelableShape=collectAssociationCandidates(node,candidates)||changedLabelableShape,candidates.truncated)break}if(changedLabelableShape){const label=containingImplicitLabel(mutation.target);label&&candidates.implicitLabels.add(label)}if(candidates.truncated)break}if(addIndexedCandidates(),candidates.truncated)return{subscriptions:affected,fallbackAll:!0};for(const label of candidates.implicitLabels)if(collectFirstImplicitSubscription(observation,label,candidates,affected),candidates.truncated)return{subscriptions:affected,fallbackAll:!0};return{subscriptions:affected,fallbackAll:!1}}function observeAssociationRoot(host,listener){const root=host.getRootNode();let observation=associationRootObservations.get(root);if(!observation){const Observer=host.ownerDocument.defaultView?.MutationObserver,subscriptions=new Set,subscriptionsById=new Map,implicitSubscriptionsByLabel=new WeakMap,subscriptionsByHost=new WeakMap,pending=new Set,holder={},observer=Observer===void 0?void 0:new Observer(mutations=>{const current=holder.observation;if(!current)return;const affected=affectedAssociationSubscriptions(current,mutations);notifyAssociationSubscriptions(current,affected.subscriptions,affected.fallbackAll)});observer?.observe(root,{attributes:!0,attributeFilter:["for","id","type"],attributeOldValue:!0,childList:!0,subtree:!0}),observation={subscriptions,subscriptionsById,implicitSubscriptionsByLabel,subscriptionsByHost,pending,observer,ownerWindow:host.ownerDocument.defaultView,fallbackGeneration:0},holder.observation=observation,associationRootObservations.set(root,observation)}const subscription={host,listener,id:host.id,implicitLabels:[],fallbackGeneration:-1,active:!0};return observation.subscriptions.add(subscription),observation.subscriptionsByHost.set(host,subscription),addSubscriptionById(observation,subscription),{update(labels){subscription.active&&(updateSubscriptionId(observation,subscription),updateImplicitSubscriptions(observation,subscription,labels))},disconnect(){if(!subscription.active)return;subscription.active=!1,observation.pending.delete(subscription),observation.subscriptions.delete(subscription),observation.subscriptionsByHost.delete(host);for(const label of subscription.implicitLabels)removeImplicitSubscription(observation,label,subscription);subscription.implicitLabels=[],removeSubscriptionById(observation,subscription);const current=associationRootObservations.get(root);!current||current.subscriptions.size>0||(current.observer?.disconnect(),cancelAssociationContinuation(current),current.pending.clear(),current.fallbackIterator=void 0,associationRootObservations.delete(root))}}}function isComposedDescendant(host,candidate){let current=candidate;for(;current;){if(current===host)return!0;if(current.parentNode){current=current.parentNode;continue}current=isShadowRootNode(current)?current.host:null}return!1}function resolveExternalLabels(host){const native=attachedInternals.get(host)?.labels;if(native)return Array.from(native).filter(isLabelElement).filter(label=>isCurrentlyAssociatedLabel(label,host));const labels=[],ancestor=host.closest("label");ancestor&&isCurrentlyAssociatedLabel(ancestor,host)&&labels.push(ancestor);const root=host.getRootNode();if(host.id&&"querySelectorAll"in root)for(const found of root.querySelectorAll("label[for]"))isLabelElement(found)&&isCurrentlyAssociatedLabel(found,host)&&!labels.includes(found)&&labels.push(found);return labels}function labelText(node,exclude){if(node===exclude)return"";if(node.nodeType===Node.TEXT_NODE)return node.textContent??"";let text="";for(const child of node.childNodes)text+=labelText(child,exclude);return text}function resolveExternalLabelText(labels,host){return labels.map(label=>labelText(label,host).trim()).filter(text=>text!=="").join(" ")}class ExternalLabelController{constructor(host){this.host=host,this.labels=[],this.activating=!1,this.onLabelClick=event=>{if(this.activating||this.barred)return;const source=event.currentTarget;if(!source||!isLabelElement(source)||!isCurrentlyAssociatedLabel(source,this.host)){this.refresh();return}event.composedPath().includes(this.host)||queueMicrotask(()=>{if(event.defaultPrevented||!this.host.isConnected||this.barred)return;if(!isCurrentlyAssociatedLabel(source,this.host)){this.refresh();return}const focusTarget=this.resolveFocusTarget(),activation=this.resolveActivation(focusTarget);this.activating=!0;try{this.host.focus(),isComposedDescendant(this.host,deepActiveElementIn(this.host.ownerDocument))||focusTarget?.focus(),activation==="activate"&&focusTarget?.click()}finally{this.activating=!1}})}}hostConnected(){this.associationRootSubscription?.disconnect(),this.associationRootSubscription=observeAssociationRoot(this.host,()=>this.refresh()),this.refresh()}hostUpdated(){this.refresh()}hostDisconnected(){this.release(),this.stopObservingLabels(),this.associationRootSubscription?.disconnect(),this.associationRootSubscription=void 0;for(const label of this.labels)label.removeEventListener("click",this.onLabelClick);this.labels=[]}refresh(){const next=resolveExternalLabels(this.host);if(next.length!==this.labels.length||next.some((label,index)=>label!==this.labels[index])){for(const label of this.labels)label.removeEventListener("click",this.onLabelClick);this.labels=next;for(const label of this.labels)label.addEventListener("click",this.onLabelClick);this.observeLabels()}this.associationRootSubscription?.update(next),this.apply()}observeLabels(){this.stopObservingLabels();const Observer=this.host.ownerDocument.defaultView?.MutationObserver;if(this.labels.length===0||Observer===void 0)return;const observer=new Observer(()=>this.refresh());for(const label of this.labels)observer.observe(label,{characterData:!0,childList:!0,subtree:!0});this.labelObserver=observer}stopObservingLabels(){this.labelObserver?.disconnect(),this.labelObserver=void 0}get barred(){return typeof this.host.matches=="function"&&this.host.matches(":disabled")?!0:!!(this.host.effectiveDisabled??this.host.disabled)}resolveNameTarget(focusTarget){if(this.hostSemanticOwner)return this.host;const root=this.ownRoot;if(!root)return focusTarget;if(focusTarget){for(const composite of root.querySelectorAll(COMPOSITE_ROLE_SELECTOR))if(isHtmlElement(composite)&&isComposedDescendant(composite,focusTarget))return composite}if(focusTarget&&focusTarget.getRootNode()===root)return focusTarget;const owned=focusTarget?this.outermostOwnedAncestor(focusTarget):null;if(owned)return owned;const semantic=root.querySelector(SEMANTIC_TARGET_SELECTOR);return semantic&&isHtmlElement(semantic)?semantic:focusTarget}outermostOwnedAncestor(node){const root=this.ownRoot;let owned=null,current=node;for(;current&¤t!==this.host;)isHtmlElement(current)&&(current.getRootNode()===root||current.parentNode===this.host)&&(owned=current),current.parentNode?current=current.parentNode:current=isShadowRootNode(current)?current.host:null;return owned}get ownRoot(){const root=this.host.renderRoot;return isShadowRootNode(root)?root:this.host.shadowRoot}resolveFocusTarget(){return this.hostSemanticOwner?this.host:collectFocusableElements(this.host)[0]??null}get hostSemanticOwner(){const candidate=this.host;return typeof candidate[EXTERNAL_LABEL_HOST_SEMANTICS]=="function"?candidate:null}hostHasAuthoredName(owner){return owner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"has-authored-name"})===!0}resolveActivation(focusTarget){const declared=this.host[EXTERNAL_LABEL_ACTIVATION];if(typeof declared=="function")return declared.call(this.host);if(!focusTarget||focusTarget.getRootNode()!==this.ownRoot)return"focus";const role=focusTarget.getAttribute("role");return role&&ACTIVATING_ROLES.has(role)?"activate":"focus"}apply(){const hostOwner=this.hostSemanticOwner;if(hostOwner&&this.hostHasAuthoredName(hostOwner)||!hostOwner&&this.host.hasAttribute("aria-label")){this.release();return}const name=resolveExternalLabelText(this.labels,this.host);if(name===""){this.release();return}const settled=this.applied;if(settled&&settled.name===name&&settled.target.isConnected&&settled.target.getAttribute("aria-label")===name)return;const target=this.resolveNameTarget(this.resolveFocusTarget());target&&(this.applied&&this.applied.target!==target&&this.release(),this.applied||(this.applied={target,name,had:target.hasAttribute("aria-label"),previous:target.getAttribute("aria-label")}),target===this.host&&hostOwner?hostOwner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"apply",name}):target.getAttribute("aria-label")!==name&&target.setAttribute("aria-label",name),this.applied.name=name)}release(){const applied=this.applied;if(this.applied=void 0,!applied)return;const{target,name,had,previous}=applied,hostOwner=target===this.host?this.hostSemanticOwner:null;if(hostOwner){hostOwner[EXTERNAL_LABEL_HOST_SEMANTICS]({type:"release",appliedName:name,hadPrevious:had,previous});return}target.getAttribute("aria-label")===name&&(had?target.setAttribute("aria-label",previous??""):target.removeAttribute("aria-label"))}}registerFormControlLabelSupport(captureFormInternals,host=>new ExternalLabelController(host));export{EXTERNAL_LABEL_ACTIVATION,EXTERNAL_LABEL_HOST_SEMANTICS,ExternalLabelController,captureFormInternals,resolveExternalLabelText,resolveExternalLabels};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement}from"lit";import{property}from"lit/decorators.js";import{captureFormInternals,ExternalLabelController}from"./form-control-labels.js";import{tokens}from"./tokens.styles.js";import{palette}from"./tokens/palette.styles.js";import{resolveIntlLocale}from"./intl-cache.js";import{warnUnknownAttributes}from"./dev-mode-attribute-warning.js";import{observeInheritedContext,beginInheritedContextUpdate,finishInheritedContextUpdate,markInheritedContextUpdateRendered,queueInheritedDirectionChange,recordInheritedDirectionRead,recordInheritedLocaleRead}from"./inherited-context-observer.js";import{canonicalizeLyraLocale,enableLyraLocaleCache,invalidateLyraLocaleCache,lyraLocaleCatalogVersion,peekLyraLocale,recordLyraOwnerDocumentConnection,resolveLyraDirection,resolveLyraString,resolveLyraLocale,snapshotLyraLocaleStrings,subscribeLyraLocaleForHost}from"./localization-runtime.js";const PUBLIC_COLLECTION_ENTRY_LIMIT=1e4,PUBLIC_COLLECTION_NODE_LIMIT=5e4,PUBLIC_COLLECTION_DEPTH_LIMIT=256,OMIT_COLLECTION_VALUE=Symbol("omit-public-collection-value");function snapshotRealm(view){const candidate=view;return{Array:candidate?.Array??Array,Date:candidate?.Date??Date,Map:candidate?.Map??Map,Object:candidate?.Object??Object,Set:candidate?.Set??Set}}function isRealmNeutralPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor");return!!(constructor&&"value"in constructor&&typeof constructor.value=="function"&&constructor.value.name==="Object"&&Object.getPrototypeOf(prototype)===null)}catch{return!1}}function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function isNativeArrayBufferView(value){try{return ArrayBuffer.isView(value)}catch{return!1}}function isImmutableBlob(value){if(typeof Blob>"u")return!1;const sizeGetter=Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get;if(!sizeGetter)return!1;try{return sizeGetter.call(value),!0}catch{return!1}}const MUTATING_DATE_METHODS=new Set(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);function nativeDateTime(value){try{return Date.prototype.getTime.call(value)}catch{return OMIT_COLLECTION_VALUE}}function snapshotReadonlyDate(source,time,budget){const target=new budget.realm.Date(time),boundMethods=new Map,rejectMutation=()=>{throw new TypeError("Cannot mutate a readonly Date snapshot")},snapshot=new Proxy(target,{get(date,key){if(MUTATING_DATE_METHODS.has(key))return rejectMutation;if(key==="constructor")return budget.realm.Date;const value=Reflect.get(date,key,date);if(typeof value!="function")return value;const cached=boundMethods.get(key);if(cached)return cached;const bound=value.bind(date);return boundMethods.set(key,bound),bound}});return rememberSnapshot(budget,source,snapshot),Object.freeze(snapshot)}function rememberSnapshot(budget,source,snapshot){budget.seen.set(source,snapshot),budget.additions.push(source)}function snapshotTransaction(budget,create){const remaining=budget.remaining,additions=budget.additions.length,result=create();if(result!==OMIT_COLLECTION_VALUE)return result;budget.remaining=remaining;for(let index=budget.additions.length-1;index>=additions;index-=1)budget.seen.delete(budget.additions[index]);return budget.additions.length=additions,OMIT_COLLECTION_VALUE}function emptyRealmArray(realm){return Object.freeze(new realm.Array)}function*ownEnumerableStringKeys(value){for(const key in value)Object.getOwnPropertyDescriptor(value,key)?.enumerable&&(yield key)}function snapshotDataRecord(value,keys,prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys){const output=budget.realm.Object.create(prototype);rememberSnapshot(budget,value,output);try{for(const key of keys){const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor?.enumerable||!("value"in descriptor))continue;if(budget.remaining<=0)return OMIT_COLLECTION_VALUE;budget.remaining-=1;const entry=preserveRecordKeys?.has(key)?descriptor.value:preserveCollectionItemKeys?.has(key)?snapshotIdentityCollection(descriptor.value,budget.realm,budget):snapshotCollectionValue(descriptor.value,budget,depth+1);if(entry===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return OMIT_COLLECTION_VALUE}return Object.freeze(output)}function snapshotCollectionValue(value,budget,depth,preserveRecordKeys,preserveCollectionItemKeys,allowArrayPrefixTruncation=!1){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(budget.seen.has(value))return budget.seen.get(value);if(depth>PUBLIC_COLLECTION_DEPTH_LIMIT||budget.remaining<=0)return OMIT_COLLECTION_VALUE;if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE}if(!lengthDescriptor||!("value"in lengthDescriptor)||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE;const sourceLength=lengthDescriptor.value;if(!allowArrayPrefixTruncation&&sourceLength>PUBLIC_COLLECTION_ENTRY_LIMIT)return OMIT_COLLECTION_VALUE;const length=Math.min(sourceLength,PUBLIC_COLLECTION_ENTRY_LIMIT),output=new budget.realm.Array(length);rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){if(budget.remaining<=0){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}if(!descriptor)continue;if(!("value"in descriptor)){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(descriptor.value,budget,depth+1)));if(entry===OMIT_COLLECTION_VALUE){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}Object.defineProperty(output,index,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(isRealmNeutralPlainRecord(value)){let prototype;try{prototype=Object.getPrototypeOf(value)}catch{return OMIT_COLLECTION_VALUE}return snapshotDataRecord(value,ownEnumerableStringKeys(value),prototype===null?null:budget.realm.Object.prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys)}const dateTime=nativeDateTime(value);if(dateTime!==OMIT_COLLECTION_VALUE)return snapshotReadonlyDate(value,dateTime,budget);const entries=nativeMapEntries(value);if(entries)return snapshotDetachedMap(value,entries,budget,depth);const values=nativeSetValues(value);if(values)return snapshotDetachedSet(value,values,budget,depth);if(isNativeArrayBufferView(value))return OMIT_COLLECTION_VALUE;const rect=snapshotDOMRect(value,budget);return rect!==OMIT_COLLECTION_VALUE?rect:isImmutableBlob(value)?value:OMIT_COLLECTION_VALUE}function snapshotPublicCollection(value,view){if(value===null||typeof value!="object"&&typeof value!="function")return value;const realm=snapshotRealm(view),budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,void 0,void 0,!0));if(snapshot!==OMIT_COLLECTION_VALUE)return snapshot;if(isArrayValue(value)||isNativeArrayBufferView(value))return emptyRealmArray(realm);if(typeof value=="object"){if(nativeMapEntries(value))return readonlyMapFacade(new realm.Map,realm);if(nativeSetValues(value))return readonlySetFacade(new realm.Set,realm);if(isRealmNeutralPlainRecord(value)){const prototype=Object.getPrototypeOf(value);return Object.freeze(realm.Object.create(prototype===null?null:realm.Object.prototype))}}return emptyRealmArray(realm)}function nativeMapEntries(value){try{return Map.prototype.entries.call(value)}catch{return}}function nativeSetValues(value){try{return Set.prototype.values.call(value)}catch{return}}function snapshotDOMRect(value,budget){if(typeof DOMRectReadOnly>"u")return OMIT_COLLECTION_VALUE;const nativePrototype=DOMRectReadOnly.prototype,output=budget.realm.Object.create(budget.realm.Object.prototype);for(const key of["x","y","width","height","top","right","bottom","left"]){let coordinate;try{const getter=Object.getOwnPropertyDescriptor(nativePrototype,key)?.get;if(!getter)return OMIT_COLLECTION_VALUE;coordinate=getter.call(value)}catch{return OMIT_COLLECTION_VALUE}if(typeof coordinate!="number"||!Number.isFinite(coordinate))return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:coordinate,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function readonlyMapFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},get:{value:key=>backing.get(key)},has:{value:key=>backing.has(key)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach((entry,key)=>callback.call(thisArg,entry,key,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function readonlySetFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},has:{value:entry=>backing.has(entry)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach(entry=>callback.call(thisArg,entry,entry,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function snapshotIdentityMap(entries,realm=snapshotRealm()){const backing=new realm.Map;for(let next=entries.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=entries.next(),count+=1)backing.set(next.value[0],next.value[1]);return readonlyMapFacade(backing,realm)}function snapshotIdentitySet(values,realm=snapshotRealm()){const backing=new realm.Set;for(let next=values.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=values.next(),count+=1)backing.add(next.value);return readonlySetFacade(backing,realm)}function snapshotDetachedMap(source,entries,budget,depth){const backing=new budget.realm.Map,facade=readonlyMapFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=entries.next()}catch{break}if(next.done||budget.remaining<=0)break;const pair=snapshotTransaction(budget,()=>{budget.remaining-=1;const key=snapshotCollectionValue(next.value[0],budget,depth+1);if(key===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;const entry=snapshotCollectionValue(next.value[1],budget,depth+1);return entry===OMIT_COLLECTION_VALUE?OMIT_COLLECTION_VALUE:[key,entry]});pair!==OMIT_COLLECTION_VALUE&&backing.set(pair[0],pair[1])}return facade}function snapshotDetachedSet(source,values,budget,depth){const backing=new budget.realm.Set,facade=readonlySetFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=values.next()}catch{break}if(next.done||budget.remaining<=0)break;const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(next.value,budget,depth+1)));entry!==OMIT_COLLECTION_VALUE&&backing.add(entry)}return facade}function snapshotIdentityCollection(value,view,budget){const realm=snapshotRealm(view);if(budget&&value!==null&&(typeof value=="object"||typeof value=="function")&&budget.seen.has(value))return budget.seen.get(value);if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return emptyRealmArray(realm)}const length=lengthDescriptor&&"value"in lengthDescriptor&&typeof lengthDescriptor.value=="number"&&Number.isSafeInteger(lengthDescriptor.value)&&lengthDescriptor.value>=0?Math.min(lengthDescriptor.value,PUBLIC_COLLECTION_ENTRY_LIMIT):0,output=new realm.Array(length);budget&&rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}!descriptor||!("value"in descriptor)||Object.defineProperty(output,index,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(value===null||typeof value!="object")return value;const mapEntries=nativeMapEntries(value);if(mapEntries){const output=snapshotIdentityMap(mapEntries,realm);return budget&&rememberSnapshot(budget,value,output),output}const setValues=nativeSetValues(value);if(setValues){const output=snapshotIdentitySet(setValues,realm);return budget&&rememberSnapshot(budget,value,output),output}return emptyRealmArray(realm)}function snapshotEventDetail(value,view,preserveRootKeys,preserveCollectionItemKeys){if(value==null)return value;const budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm:snapshotRealm(view)},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,preserveRootKeys,preserveCollectionItemKeys));return snapshot===OMIT_COLLECTION_VALUE?null:snapshot}const SEED_FIRST_RENDER_STATE=Symbol("lr-seed-first-render-state"),SLOT_PRESENCE_UNRESOLVED=Symbol("lr-slot-presence-unresolved"),REACTIVE_HOST_ATTRIBUTES=["aria-label","aria-describedby","lang","dir"],DIRECTION_HOST_ATTRIBUTES=["class","style","slot"];function trustedLyraConstructorChain(instance){const constructors=[];let prototype=Object.getPrototypeOf(instance);for(;prototype&&prototype!==LitElement.prototype;){const descriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");typeof descriptor?.value=="function"&&constructors.push(descriptor.value),prototype=Object.getPrototypeOf(prototype)}return constructors}const collectionPolicyByPrototype=new WeakMap;function collectionPropertyPolicy(instance,name){const prototype=Object.getPrototypeOf(instance);let policies=collectionPolicyByPrototype.get(prototype);policies||(policies=new Map,collectionPolicyByPrototype.set(prototype,policies));const cached=policies.get(name);if(cached)return cached;let owns=!1,preservesItemIdentity=!1,preservesObjectIdentity=!1;for(const constructor of trustedLyraConstructorChain(instance)){const declared=constructor;Object.prototype.hasOwnProperty.call(constructor,"ownedCollectionProperties")&&declared.ownedCollectionProperties.includes(name)&&(owns=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionProperties")&&declared.identityCollectionProperties.includes(name)&&(preservesItemIdentity=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionObjectProperties")&&declared.identityCollectionObjectProperties.includes(name)&&(preservesObjectIdentity=!0)}const policy=Object.freeze({owns,preservesItemIdentity,preservesObjectIdentity});return policies.set(name,policy),policy}class LyraElement extends LitElement{static{this.styles=[palette,tokens]}static{this.ownedCollectionProperties=Object.freeze([])}static{this.identityCollectionProperties=Object.freeze([])}static{this.identityCollectionObjectProperties=Object.freeze([])}static{this.immutableEventDetails=Object.freeze([])}static{this.identityEventDetailProperties=Object.freeze({})}static{this.identityEventDetailCollectionItems=Object.freeze({})}static getPropertyDescriptor(name,key,options){const descriptor=super.getPropertyDescriptor(name,key,options);if(!descriptor?.set)return descriptor;const originalSet=descriptor.set;return{...descriptor,set(value){const policy=collectionPropertyPolicy(this,name);if(!policy.owns){originalSet.call(this,value);return}const ownerView=this.ownerDocument?.defaultView;originalSet.call(this,policy.preservesObjectIdentity&&value!==null&&typeof value=="object"&&!isArrayValue(value)?value:policy.preservesItemIdentity?snapshotIdentityCollection(value,ownerView):snapshotPublicCollection(value,ownerView))}}}static{this.defaultStrings=Object.freeze({})}static get observedAttributes(){return[...new Set([...super.observedAttributes,...REACTIVE_HOST_ATTRIBUTES,...DIRECTION_HOST_ATTRIBUTES])]}get strings(){return this.stringsValue}set strings(value){const previous=this.stringsValue;this.stringsValue=snapshotLyraLocaleStrings(value),this.requestUpdate("strings",previous)}constructor(){super(),this.locale="",this.stringsValue=snapshotLyraLocaleStrings({}),this.localeSubscriptionNeeded=!1,this.constructor.formAssociated&&this.addController(new ExternalLabelController(this))}attachInternals(){const internals=super.attachInternals();return captureFormInternals(this,internals),internals}connectedCallback(){this.hydratingServerShadow??=typeof Node>"u"||!this.hasUpdated&&this.shadowRoot!==null,super.connectedCallback(),warnUnknownAttributes(this,this.constructor.observedAttributes,this.constructor.knownUnobservedAttributes??[]),recordLyraOwnerDocumentConnection(this),enableLyraLocaleCache(this),invalidateLyraLocaleCache(this),this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=observeInheritedContext(this),this.localeSubscriptionNeeded&&this.ensureLocaleSubscription(),this.lastLocalizedCatalogVersion!==void 0&&lyraLocaleCatalogVersion(resolveLyraLocale(this))!==this.lastLocalizedCatalogVersion&&this.requestUpdate();const deferred=this.deferredAfterUpdate;if(deferred){this.deferredAfterUpdate=void 0;for(const[key,callback]of deferred)this.scheduleAfterUpdate(callback,key)}}disconnectedCallback(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0,this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=void 0,invalidateLyraLocaleCache(this),super.disconnectedCallback()}adoptedCallback(){this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,invalidateLyraLocaleCache(this),this.isConnected&&this.localeSubscriptionNeeded&&this.ensureLocaleSubscription()}requestUpdate(name,oldValue,options){invalidateLyraLocaleCache(this),super.requestUpdate(name,oldValue,options)}performUpdate(){beginInheritedContextUpdate(this);try{super.performUpdate()}finally{finishInheritedContextUpdate(this)}}update(changedProperties){super.update(changedProperties),markInheritedContextUpdateRendered(this)}ensureLocaleSubscription(){this.localeSubscriptionNeeded=!0,!(!this.isConnected||this.stopLocaleSubscription)&&(this.stopLocaleSubscription=subscribeLyraLocaleForHost(this))}attributeChangedCallback(name,oldValue,value){const directionHostAttribute=oldValue!==value&&DIRECTION_HOST_ATTRIBUTES.includes(name);directionHostAttribute&&queueInheritedDirectionChange(this,name==="slot"),super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&REACTIVE_HOST_ATTRIBUTES.includes(name)?this.requestUpdate():directionHostAttribute&&invalidateLyraLocaleCache(this)}seedFirstRenderState(seed){this.hasUpdated||this[SEED_FIRST_RENDER_STATE](seed)}[SEED_FIRST_RENDER_STATE](seed){if(!this.hydratingServerShadow){seed();return}const pending=this.deferredFirstRenderSeeds??=new Set;pending.add(seed),!(pending.size>1)&&this.updateComplete.then(()=>{setTimeout(()=>{this.hydratingServerShadow=!1;const seeds=this.deferredFirstRenderSeeds;this.deferredFirstRenderSeeds=void 0;for(const deferred of seeds??[])deferred();this.requestUpdate()},0)},()=>{this.hydratingServerShadow=!1,this.deferredFirstRenderSeeds=void 0})}updateBrowserDerivedState(update){this[SEED_FIRST_RENDER_STATE](update)}renderSlotPresence(present){return present||this[SLOT_PRESENCE_UNRESOLVED]()}[SLOT_PRESENCE_UNRESOLVED](){return typeof Node>"u"||this.hydratingServerShadow===!0}beginAbortableLoad(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0;const AbortControllerCtor=this.ownerDocument?.defaultView?.AbortController;if(AbortControllerCtor)return this.pendingLoadController=new AbortControllerCtor,this.pendingLoadController.signal}scheduleAfterUpdate(callback,key="load"){const pending=this.afterUpdateCallbacks??=new Map;pending.has(key)||(pending.set(key,callback),!(pending.size>1)&&queueMicrotask(()=>{const due=this.afterUpdateCallbacks;if(this.afterUpdateCallbacks=void 0,!due)return;if(this.isConnected){for(const due_callback of due.values())due_callback();return}const held=this.deferredAfterUpdate??=new Map;for(const[heldKey,heldCallback]of due)held.has(heldKey)||held.set(heldKey,heldCallback)}))}localize(key,fallback,values){const message=resolveLyraString(this,key,this.strings,fallback,values,this.constructor.defaultStrings),locale=peekLyraLocale(this);return recordInheritedLocaleRead(this,locale),locale!==void 0&&(this.lastLocalizedCatalogVersion=lyraLocaleCatalogVersion(locale),this.ensureLocaleSubscription()),message}get effectiveMessageLocale(){if(this.locale)return canonicalizeLyraLocale(this.locale);const locale=resolveLyraLocale(this);return recordInheritedLocaleRead(this,locale),this.ensureLocaleSubscription(),locale}get effectiveLocale(){return resolveIntlLocale(this.effectiveMessageLocale)}get effectiveIntlLocale(){return this.effectiveLocale}get effectiveDirection(){const direction=resolveLyraDirection(this);return recordInheritedDirectionRead(this,direction),direction}addEventListener(type,listener,options){super.addEventListener(type,listener,options)}removeEventListener(type,listener,options){super.removeEventListener(type,listener,options)}emit(name,...args){const[detail,options]=args,ownerDocument=this.ownerDocument;let CustomEventCtor=ownerDocument?.defaultView?.CustomEvent;if(!CustomEventCtor&&ownerDocument)try{const candidate=ownerDocument.createEvent("CustomEvent").constructor;typeof candidate=="function"&&(CustomEventCtor=candidate)}catch{}CustomEventCtor??=globalThis.CustomEvent;let snapshotsDetail=!1;const identityDetailKeys=new Set,identityCollectionItemKeys=new Set;for(const constructor of trustedLyraConstructorChain(this)){if(Object.prototype.hasOwnProperty.call(constructor,"immutableEventDetails")&&constructor.immutableEventDetails.includes(name)&&(snapshotsDetail=!0),Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailProperties"))for(const key of constructor.identityEventDetailProperties[name]??[])identityDetailKeys.add(key);if(Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailCollectionItems"))for(const key of constructor.identityEventDetailCollectionItems[name]??[])identityCollectionItemKeys.add(key)}const event=new CustomEventCtor(name,{detail:detail===void 0?null:snapshotsDetail?snapshotEventDetail(detail,ownerDocument?.defaultView,identityDetailKeys,identityCollectionItemKeys):detail,bubbles:!0,composed:!0,cancelable:options?.cancelable??!1});return this.dispatchEvent(event),event}}__decorate([property({reflect:!0})],LyraElement.prototype,"locale",void 0),__decorate([property({attribute:!1})],LyraElement.prototype,"strings",null);export{LyraElement,SEED_FIRST_RENDER_STATE,SLOT_PRESENCE_UNRESOLVED};
|
|
1
|
+
var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{LitElement}from"lit";import{property}from"lit/decorators.js";import{tokens}from"./tokens.styles.js";import{palette}from"./tokens/palette.styles.js";import{resolveIntlLocale}from"./intl-cache.js";import{warnUnknownAttributes}from"./dev-mode-attribute-warning.js";let formInternalsHook,externalLabelFactory;function registerFormControlLabelSupport(hook,factory){formInternalsHook=hook,externalLabelFactory=factory}import{observeInheritedContext,beginInheritedContextUpdate,finishInheritedContextUpdate,markInheritedContextUpdateRendered,queueInheritedDirectionChange,recordInheritedDirectionRead,recordInheritedLocaleRead}from"./inherited-context-observer.js";import{canonicalizeLyraLocale,enableLyraLocaleCache,invalidateLyraLocaleCache,lyraLocaleCatalogVersion,peekLyraLocale,recordLyraOwnerDocumentConnection,resolveLyraDirection,resolveLyraString,resolveLyraLocale,snapshotLyraLocaleStrings,subscribeLyraLocaleForHost}from"./localization-runtime.js";const PUBLIC_COLLECTION_ENTRY_LIMIT=1e4,PUBLIC_COLLECTION_NODE_LIMIT=5e4,PUBLIC_COLLECTION_DEPTH_LIMIT=256,OMIT_COLLECTION_VALUE=Symbol("omit-public-collection-value");function snapshotRealm(view){const candidate=view;return{Array:candidate?.Array??Array,Date:candidate?.Date??Date,Map:candidate?.Map??Map,Object:candidate?.Object??Object,Set:candidate?.Set??Set}}function isRealmNeutralPlainRecord(value){try{const prototype=Object.getPrototypeOf(value);if(prototype===null)return!0;const constructor=Object.getOwnPropertyDescriptor(prototype,"constructor");return!!(constructor&&"value"in constructor&&typeof constructor.value=="function"&&constructor.value.name==="Object"&&Object.getPrototypeOf(prototype)===null)}catch{return!1}}function isArrayValue(value){try{return Array.isArray(value)}catch{return!1}}function isNativeArrayBufferView(value){try{return ArrayBuffer.isView(value)}catch{return!1}}function isImmutableBlob(value){if(typeof Blob>"u")return!1;const sizeGetter=Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get;if(!sizeGetter)return!1;try{return sizeGetter.call(value),!0}catch{return!1}}const MUTATING_DATE_METHODS=new Set(["setDate","setFullYear","setHours","setMilliseconds","setMinutes","setMonth","setSeconds","setTime","setUTCDate","setUTCFullYear","setUTCHours","setUTCMilliseconds","setUTCMinutes","setUTCMonth","setUTCSeconds","setYear"]);function nativeDateTime(value){try{return Date.prototype.getTime.call(value)}catch{return OMIT_COLLECTION_VALUE}}function snapshotReadonlyDate(source,time,budget){const target=new budget.realm.Date(time),boundMethods=new Map,rejectMutation=()=>{throw new TypeError("Cannot mutate a readonly Date snapshot")},snapshot=new Proxy(target,{get(date,key){if(MUTATING_DATE_METHODS.has(key))return rejectMutation;if(key==="constructor")return budget.realm.Date;const value=Reflect.get(date,key,date);if(typeof value!="function")return value;const cached=boundMethods.get(key);if(cached)return cached;const bound=value.bind(date);return boundMethods.set(key,bound),bound}});return rememberSnapshot(budget,source,snapshot),Object.freeze(snapshot)}function rememberSnapshot(budget,source,snapshot){budget.seen.set(source,snapshot),budget.additions.push(source)}function snapshotTransaction(budget,create){const remaining=budget.remaining,additions=budget.additions.length,result=create();if(result!==OMIT_COLLECTION_VALUE)return result;budget.remaining=remaining;for(let index=budget.additions.length-1;index>=additions;index-=1)budget.seen.delete(budget.additions[index]);return budget.additions.length=additions,OMIT_COLLECTION_VALUE}function emptyRealmArray(realm){return Object.freeze(new realm.Array)}function*ownEnumerableStringKeys(value){for(const key in value)Object.getOwnPropertyDescriptor(value,key)?.enumerable&&(yield key)}function snapshotDataRecord(value,keys,prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys){const output=budget.realm.Object.create(prototype);rememberSnapshot(budget,value,output);try{for(const key of keys){const descriptor=Object.getOwnPropertyDescriptor(value,key);if(!descriptor?.enumerable||!("value"in descriptor))continue;if(budget.remaining<=0)return OMIT_COLLECTION_VALUE;budget.remaining-=1;const entry=preserveRecordKeys?.has(key)?descriptor.value:preserveCollectionItemKeys?.has(key)?snapshotIdentityCollection(descriptor.value,budget.realm,budget):snapshotCollectionValue(descriptor.value,budget,depth+1);if(entry===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:entry,enumerable:!0,configurable:!1,writable:!1})}}catch{return OMIT_COLLECTION_VALUE}return Object.freeze(output)}function snapshotCollectionValue(value,budget,depth,preserveRecordKeys,preserveCollectionItemKeys,allowArrayPrefixTruncation=!1){if(value===null||typeof value!="object"&&typeof value!="function"||typeof value=="function")return value;if(budget.seen.has(value))return budget.seen.get(value);if(depth>PUBLIC_COLLECTION_DEPTH_LIMIT||budget.remaining<=0)return OMIT_COLLECTION_VALUE;if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE}if(!lengthDescriptor||!("value"in lengthDescriptor)||typeof lengthDescriptor.value!="number"||!Number.isSafeInteger(lengthDescriptor.value)||lengthDescriptor.value<0)return allowArrayPrefixTruncation?emptyRealmArray(budget.realm):OMIT_COLLECTION_VALUE;const sourceLength=lengthDescriptor.value;if(!allowArrayPrefixTruncation&&sourceLength>PUBLIC_COLLECTION_ENTRY_LIMIT)return OMIT_COLLECTION_VALUE;const length=Math.min(sourceLength,PUBLIC_COLLECTION_ENTRY_LIMIT),output=new budget.realm.Array(length);rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){if(budget.remaining<=0){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}if(!descriptor)continue;if(!("value"in descriptor)){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(descriptor.value,budget,depth+1)));if(entry===OMIT_COLLECTION_VALUE){if(!allowArrayPrefixTruncation)return OMIT_COLLECTION_VALUE;output.length=index;break}Object.defineProperty(output,index,{value:entry,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(isRealmNeutralPlainRecord(value)){let prototype;try{prototype=Object.getPrototypeOf(value)}catch{return OMIT_COLLECTION_VALUE}return snapshotDataRecord(value,ownEnumerableStringKeys(value),prototype===null?null:budget.realm.Object.prototype,budget,depth,preserveRecordKeys,preserveCollectionItemKeys)}const dateTime=nativeDateTime(value);if(dateTime!==OMIT_COLLECTION_VALUE)return snapshotReadonlyDate(value,dateTime,budget);const entries=nativeMapEntries(value);if(entries)return snapshotDetachedMap(value,entries,budget,depth);const values=nativeSetValues(value);if(values)return snapshotDetachedSet(value,values,budget,depth);if(isNativeArrayBufferView(value))return OMIT_COLLECTION_VALUE;const rect=snapshotDOMRect(value,budget);return rect!==OMIT_COLLECTION_VALUE?rect:isImmutableBlob(value)?value:OMIT_COLLECTION_VALUE}function snapshotPublicCollection(value,view){if(value===null||typeof value!="object"&&typeof value!="function")return value;const realm=snapshotRealm(view),budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,void 0,void 0,!0));if(snapshot!==OMIT_COLLECTION_VALUE)return snapshot;if(isArrayValue(value)||isNativeArrayBufferView(value))return emptyRealmArray(realm);if(typeof value=="object"){if(nativeMapEntries(value))return readonlyMapFacade(new realm.Map,realm);if(nativeSetValues(value))return readonlySetFacade(new realm.Set,realm);if(isRealmNeutralPlainRecord(value)){const prototype=Object.getPrototypeOf(value);return Object.freeze(realm.Object.create(prototype===null?null:realm.Object.prototype))}}return emptyRealmArray(realm)}function nativeMapEntries(value){try{return Map.prototype.entries.call(value)}catch{return}}function nativeSetValues(value){try{return Set.prototype.values.call(value)}catch{return}}function snapshotDOMRect(value,budget){if(typeof DOMRectReadOnly>"u")return OMIT_COLLECTION_VALUE;const nativePrototype=DOMRectReadOnly.prototype,output=budget.realm.Object.create(budget.realm.Object.prototype);for(const key of["x","y","width","height","top","right","bottom","left"]){let coordinate;try{const getter=Object.getOwnPropertyDescriptor(nativePrototype,key)?.get;if(!getter)return OMIT_COLLECTION_VALUE;coordinate=getter.call(value)}catch{return OMIT_COLLECTION_VALUE}if(typeof coordinate!="number"||!Number.isFinite(coordinate))return OMIT_COLLECTION_VALUE;Object.defineProperty(output,key,{value:coordinate,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}function readonlyMapFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},get:{value:key=>backing.get(key)},has:{value:key=>backing.has(key)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach((entry,key)=>callback.call(thisArg,entry,key,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function readonlySetFacade(backing,realm=snapshotRealm()){let facade;return facade=realm.Object.create(realm.Object.prototype),Object.defineProperties(facade,{size:{enumerable:!0,get:()=>backing.size},entries:{value:()=>backing.entries()},has:{value:entry=>backing.has(entry)},keys:{value:()=>backing.keys()},values:{value:()=>backing.values()},forEach:{value:(callback,thisArg)=>backing.forEach(entry=>callback.call(thisArg,entry,entry,facade))},[Symbol.iterator]:{value:()=>backing[Symbol.iterator]()}}),Object.freeze(facade)}function snapshotIdentityMap(entries,realm=snapshotRealm()){const backing=new realm.Map;for(let next=entries.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=entries.next(),count+=1)backing.set(next.value[0],next.value[1]);return readonlyMapFacade(backing,realm)}function snapshotIdentitySet(values,realm=snapshotRealm()){const backing=new realm.Set;for(let next=values.next(),count=0;!next.done&&count<PUBLIC_COLLECTION_ENTRY_LIMIT;next=values.next(),count+=1)backing.add(next.value);return readonlySetFacade(backing,realm)}function snapshotDetachedMap(source,entries,budget,depth){const backing=new budget.realm.Map,facade=readonlyMapFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=entries.next()}catch{break}if(next.done||budget.remaining<=0)break;const pair=snapshotTransaction(budget,()=>{budget.remaining-=1;const key=snapshotCollectionValue(next.value[0],budget,depth+1);if(key===OMIT_COLLECTION_VALUE)return OMIT_COLLECTION_VALUE;const entry=snapshotCollectionValue(next.value[1],budget,depth+1);return entry===OMIT_COLLECTION_VALUE?OMIT_COLLECTION_VALUE:[key,entry]});pair!==OMIT_COLLECTION_VALUE&&backing.set(pair[0],pair[1])}return facade}function snapshotDetachedSet(source,values,budget,depth){const backing=new budget.realm.Set,facade=readonlySetFacade(backing,budget.realm);rememberSnapshot(budget,source,facade);for(let count=0;count<PUBLIC_COLLECTION_ENTRY_LIMIT;count+=1){let next;try{next=values.next()}catch{break}if(next.done||budget.remaining<=0)break;const entry=snapshotTransaction(budget,()=>(budget.remaining-=1,snapshotCollectionValue(next.value,budget,depth+1)));entry!==OMIT_COLLECTION_VALUE&&backing.add(entry)}return facade}function snapshotIdentityCollection(value,view,budget){const realm=snapshotRealm(view);if(budget&&value!==null&&(typeof value=="object"||typeof value=="function")&&budget.seen.has(value))return budget.seen.get(value);if(isArrayValue(value)){let lengthDescriptor;try{lengthDescriptor=Object.getOwnPropertyDescriptor(value,"length")}catch{return emptyRealmArray(realm)}const length=lengthDescriptor&&"value"in lengthDescriptor&&typeof lengthDescriptor.value=="number"&&Number.isSafeInteger(lengthDescriptor.value)&&lengthDescriptor.value>=0?Math.min(lengthDescriptor.value,PUBLIC_COLLECTION_ENTRY_LIMIT):0,output=new realm.Array(length);budget&&rememberSnapshot(budget,value,output);for(let index=0;index<length;index+=1){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,String(index))}catch{continue}!descriptor||!("value"in descriptor)||Object.defineProperty(output,index,{value:descriptor.value,enumerable:!0,configurable:!1,writable:!1})}return Object.freeze(output)}if(value===null||typeof value!="object")return value;const mapEntries=nativeMapEntries(value);if(mapEntries){const output=snapshotIdentityMap(mapEntries,realm);return budget&&rememberSnapshot(budget,value,output),output}const setValues=nativeSetValues(value);if(setValues){const output=snapshotIdentitySet(setValues,realm);return budget&&rememberSnapshot(budget,value,output),output}return emptyRealmArray(realm)}function snapshotEventDetail(value,view,preserveRootKeys,preserveCollectionItemKeys){if(value==null)return value;const budget={remaining:PUBLIC_COLLECTION_NODE_LIMIT,seen:new WeakMap,additions:[],realm:snapshotRealm(view)},snapshot=snapshotTransaction(budget,()=>snapshotCollectionValue(value,budget,0,preserveRootKeys,preserveCollectionItemKeys));return snapshot===OMIT_COLLECTION_VALUE?null:snapshot}const SEED_FIRST_RENDER_STATE=Symbol("lr-seed-first-render-state"),SLOT_PRESENCE_UNRESOLVED=Symbol("lr-slot-presence-unresolved"),REACTIVE_HOST_ATTRIBUTES=["aria-label","aria-describedby","lang","dir"],DIRECTION_HOST_ATTRIBUTES=["class","style","slot"];function trustedLyraConstructorChain(instance){const constructors=[];let prototype=Object.getPrototypeOf(instance);for(;prototype&&prototype!==LitElement.prototype;){const descriptor=Object.getOwnPropertyDescriptor(prototype,"constructor");typeof descriptor?.value=="function"&&constructors.push(descriptor.value),prototype=Object.getPrototypeOf(prototype)}return constructors}const collectionPolicyByPrototype=new WeakMap;function collectionPropertyPolicy(instance,name){const prototype=Object.getPrototypeOf(instance);let policies=collectionPolicyByPrototype.get(prototype);policies||(policies=new Map,collectionPolicyByPrototype.set(prototype,policies));const cached=policies.get(name);if(cached)return cached;let owns=!1,preservesItemIdentity=!1,preservesObjectIdentity=!1;for(const constructor of trustedLyraConstructorChain(instance)){const declared=constructor;Object.prototype.hasOwnProperty.call(constructor,"ownedCollectionProperties")&&declared.ownedCollectionProperties.includes(name)&&(owns=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionProperties")&&declared.identityCollectionProperties.includes(name)&&(preservesItemIdentity=!0),Object.prototype.hasOwnProperty.call(constructor,"identityCollectionObjectProperties")&&declared.identityCollectionObjectProperties.includes(name)&&(preservesObjectIdentity=!0)}const policy=Object.freeze({owns,preservesItemIdentity,preservesObjectIdentity});return policies.set(name,policy),policy}class LyraElement extends LitElement{static{this.styles=[palette,tokens]}static{this.ownedCollectionProperties=Object.freeze([])}static{this.identityCollectionProperties=Object.freeze([])}static{this.identityCollectionObjectProperties=Object.freeze([])}static{this.immutableEventDetails=Object.freeze([])}static{this.identityEventDetailProperties=Object.freeze({})}static{this.identityEventDetailCollectionItems=Object.freeze({})}static getPropertyDescriptor(name,key,options){const descriptor=super.getPropertyDescriptor(name,key,options);if(!descriptor?.set)return descriptor;const originalSet=descriptor.set;return{...descriptor,set(value){const policy=collectionPropertyPolicy(this,name);if(!policy.owns){originalSet.call(this,value);return}const ownerView=this.ownerDocument?.defaultView;originalSet.call(this,policy.preservesObjectIdentity&&value!==null&&typeof value=="object"&&!isArrayValue(value)?value:policy.preservesItemIdentity?snapshotIdentityCollection(value,ownerView):snapshotPublicCollection(value,ownerView))}}}static{this.defaultStrings=Object.freeze({})}static get observedAttributes(){return[...new Set([...super.observedAttributes,...REACTIVE_HOST_ATTRIBUTES,...DIRECTION_HOST_ATTRIBUTES])]}get strings(){return this.stringsValue}set strings(value){const previous=this.stringsValue;this.stringsValue=snapshotLyraLocaleStrings(value),this.requestUpdate("strings",previous)}constructor(){if(super(),this.locale="",this.stringsValue=snapshotLyraLocaleStrings({}),this.localeSubscriptionNeeded=!1,this.constructor.formAssociated){const controller=externalLabelFactory?.(this);controller&&this.addController(controller)}}attachInternals(){const internals=super.attachInternals();return formInternalsHook?.(this,internals),internals}connectedCallback(){this.hydratingServerShadow??=typeof Node>"u"||!this.hasUpdated&&this.shadowRoot!==null,super.connectedCallback(),warnUnknownAttributes(this,this.constructor.observedAttributes,this.constructor.knownUnobservedAttributes??[]),recordLyraOwnerDocumentConnection(this),enableLyraLocaleCache(this),invalidateLyraLocaleCache(this),this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=observeInheritedContext(this),this.localeSubscriptionNeeded&&this.ensureLocaleSubscription(),this.lastLocalizedCatalogVersion!==void 0&&lyraLocaleCatalogVersion(resolveLyraLocale(this))!==this.lastLocalizedCatalogVersion&&this.requestUpdate();const deferred=this.deferredAfterUpdate;if(deferred){this.deferredAfterUpdate=void 0;for(const[key,callback]of deferred)this.scheduleAfterUpdate(callback,key)}}disconnectedCallback(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0,this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,this.stopInheritedContextObservation?.(),this.stopInheritedContextObservation=void 0,invalidateLyraLocaleCache(this),super.disconnectedCallback()}adoptedCallback(){this.stopLocaleSubscription?.(),this.stopLocaleSubscription=void 0,invalidateLyraLocaleCache(this),this.isConnected&&this.localeSubscriptionNeeded&&this.ensureLocaleSubscription()}requestUpdate(name,oldValue,options){invalidateLyraLocaleCache(this),super.requestUpdate(name,oldValue,options)}performUpdate(){beginInheritedContextUpdate(this);try{super.performUpdate()}finally{finishInheritedContextUpdate(this)}}update(changedProperties){super.update(changedProperties),markInheritedContextUpdateRendered(this)}ensureLocaleSubscription(){this.localeSubscriptionNeeded=!0,!(!this.isConnected||this.stopLocaleSubscription)&&(this.stopLocaleSubscription=subscribeLyraLocaleForHost(this))}attributeChangedCallback(name,oldValue,value){const directionHostAttribute=oldValue!==value&&DIRECTION_HOST_ATTRIBUTES.includes(name);directionHostAttribute&&queueInheritedDirectionChange(this,name==="slot"),super.attributeChangedCallback(name,oldValue,value),oldValue!==value&&REACTIVE_HOST_ATTRIBUTES.includes(name)?this.requestUpdate():directionHostAttribute&&invalidateLyraLocaleCache(this)}seedFirstRenderState(seed){this.hasUpdated||this[SEED_FIRST_RENDER_STATE](seed)}[SEED_FIRST_RENDER_STATE](seed){if(!this.hydratingServerShadow){seed();return}const pending=this.deferredFirstRenderSeeds??=new Set;pending.add(seed),!(pending.size>1)&&this.updateComplete.then(()=>{setTimeout(()=>{this.hydratingServerShadow=!1;const seeds=this.deferredFirstRenderSeeds;this.deferredFirstRenderSeeds=void 0;for(const deferred of seeds??[])deferred();this.requestUpdate()},0)},()=>{this.hydratingServerShadow=!1,this.deferredFirstRenderSeeds=void 0})}updateBrowserDerivedState(update){this[SEED_FIRST_RENDER_STATE](update)}renderSlotPresence(present){return present||this[SLOT_PRESENCE_UNRESOLVED]()}[SLOT_PRESENCE_UNRESOLVED](){return typeof Node>"u"||this.hydratingServerShadow===!0}beginAbortableLoad(){this.pendingLoadController?.abort(),this.pendingLoadController=void 0;const AbortControllerCtor=this.ownerDocument?.defaultView?.AbortController;if(AbortControllerCtor)return this.pendingLoadController=new AbortControllerCtor,this.pendingLoadController.signal}scheduleAfterUpdate(callback,key="load"){const pending=this.afterUpdateCallbacks??=new Map;pending.has(key)||(pending.set(key,callback),!(pending.size>1)&&queueMicrotask(()=>{const due=this.afterUpdateCallbacks;if(this.afterUpdateCallbacks=void 0,!due)return;if(this.isConnected){for(const due_callback of due.values())due_callback();return}const held=this.deferredAfterUpdate??=new Map;for(const[heldKey,heldCallback]of due)held.has(heldKey)||held.set(heldKey,heldCallback)}))}localize(key,fallback,values){const message=resolveLyraString(this,key,this.strings,fallback,values,this.constructor.defaultStrings),locale=peekLyraLocale(this);return recordInheritedLocaleRead(this,locale),locale!==void 0&&(this.lastLocalizedCatalogVersion=lyraLocaleCatalogVersion(locale),this.ensureLocaleSubscription()),message}get effectiveMessageLocale(){if(this.locale)return canonicalizeLyraLocale(this.locale);const locale=resolveLyraLocale(this);return recordInheritedLocaleRead(this,locale),this.ensureLocaleSubscription(),locale}get effectiveLocale(){return resolveIntlLocale(this.effectiveMessageLocale)}get effectiveIntlLocale(){return this.effectiveLocale}get effectiveDirection(){const direction=resolveLyraDirection(this);return recordInheritedDirectionRead(this,direction),direction}addEventListener(type,listener,options){super.addEventListener(type,listener,options)}removeEventListener(type,listener,options){super.removeEventListener(type,listener,options)}emit(name,...args){const[detail,options]=args,ownerDocument=this.ownerDocument;let CustomEventCtor=ownerDocument?.defaultView?.CustomEvent;if(!CustomEventCtor&&ownerDocument)try{const candidate=ownerDocument.createEvent("CustomEvent").constructor;typeof candidate=="function"&&(CustomEventCtor=candidate)}catch{}CustomEventCtor??=globalThis.CustomEvent;let snapshotsDetail=!1;const identityDetailKeys=new Set,identityCollectionItemKeys=new Set;for(const constructor of trustedLyraConstructorChain(this)){if(Object.prototype.hasOwnProperty.call(constructor,"immutableEventDetails")&&constructor.immutableEventDetails.includes(name)&&(snapshotsDetail=!0),Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailProperties"))for(const key of constructor.identityEventDetailProperties[name]??[])identityDetailKeys.add(key);if(Object.prototype.hasOwnProperty.call(constructor,"identityEventDetailCollectionItems"))for(const key of constructor.identityEventDetailCollectionItems[name]??[])identityCollectionItemKeys.add(key)}const event=new CustomEventCtor(name,{detail:detail===void 0?null:snapshotsDetail?snapshotEventDetail(detail,ownerDocument?.defaultView,identityDetailKeys,identityCollectionItemKeys):detail,bubbles:!0,composed:!0,cancelable:options?.cancelable??!1});return this.dispatchEvent(event),event}}__decorate([property({reflect:!0})],LyraElement.prototype,"locale",void 0),__decorate([property({attribute:!1})],LyraElement.prototype,"strings",null);export{LyraElement,SEED_FIRST_RENDER_STATE,SLOT_PRESENCE_UNRESOLVED,registerFormControlLabelSupport};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="11.
|
|
1
|
+
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="11.2.0";export{LYRA_PACKAGE_NAME,LYRA_PACKAGE_VERSION};
|
package/dist/lyra.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export { LyraSequencePlayback } from './components/media/sequence-playback/seque
|
|
|
129
129
|
export { LyraPagination } from './components/data/pagination/pagination.class.js';
|
|
130
130
|
export type { LyraPaginationFormat, LyraPaginationChangeDetail, } from './components/data/pagination/pagination.class.js';
|
|
131
131
|
export { LyraHeatmap } from './components/data/heatmap/heatmap.class.js';
|
|
132
|
-
export type { HeatmapData, HeatmapMatrixData, HeatmapCalendarData, HeatmapMode, HeatmapScale, MatrixCellPos, CalendarCellPos, HeatmapAnnotation, HeatmapLegendStop, HeatmapSelectedCell, LyraHeatmapCellClickDetail, } from './components/data/heatmap/heatmap.class.js';
|
|
132
|
+
export type { HeatmapData, HeatmapMatrixData, HeatmapCalendarData, HeatmapMode, HeatmapScale, MatrixCellPos, CalendarCellPos, HeatmapAnnotation, HeatmapLegendStop, HeatmapSelectedCell, LyraHeatmapCellClickDetail, LyraHeatmapMatrixGeometryChangeDetail, } from './components/data/heatmap/heatmap.class.js';
|
|
133
133
|
export { linearAlpha, sqrtStep, } from './components/data/heatmap/heatmap-scale.js';
|
|
134
134
|
export { LyraTree } from './components/data/tree/tree.class.js';
|
|
135
135
|
export type { LyraTreeNodeData, TreeBadge, TreeSelection, LyraTreeEventMap, } from './components/data/tree/tree.class.js';
|
package/dist/svelte.d.ts
CHANGED
|
@@ -724,7 +724,7 @@ export type LyraDatasetViewerSvelteProps = LyraSvelteElementProps<LyraDatasetVie
|
|
|
724
724
|
'active-highlight-id'?: LyraDatasetViewer['activeHighlightId'];
|
|
725
725
|
'max-height'?: LyraDatasetViewer['maxHeight'];
|
|
726
726
|
}>;
|
|
727
|
-
export type LyraDateInputSvelteProps = LyraSvelteElementProps<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
727
|
+
export type LyraDateInputSvelteProps = LyraSvelteElementProps<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'presets' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
728
728
|
form: HTMLFormElement | string | null;
|
|
729
729
|
}, LyraDateInputEventMap, 'blur' | 'change' | 'focus' | 'input' | 'lr-after-hide' | 'lr-after-show' | 'lr-clear' | 'lr-hide' | 'lr-invalid' | 'lr-show', '--hide-duration' | '--lr-date-input-action-active-bg' | '--lr-date-input-action-active-color' | '--lr-date-input-action-active-radius' | '--lr-date-input-action-hover-bg' | '--lr-date-input-action-hover-color' | '--lr-date-input-action-hover-radius' | '--lr-date-input-control-height' | '--lr-date-input-control-min-height' | '--lr-date-input-focus-border-color' | '--lr-date-input-font-size' | '--lr-date-input-gap' | '--lr-date-input-padding-block' | '--lr-date-input-padding-inline' | '--lr-date-input-placeholder-color' | '--lr-date-input-radius' | '--lr-form-control-required-color' | '--lr-form-control-required-content' | '--lr-form-control-required-offset' | '--show-duration', {
|
|
730
730
|
'aria-label'?: LyraDateInput['accessibleLabel'];
|
|
@@ -1015,7 +1015,7 @@ export type LyraHandoffDividerSvelteProps = LyraSvelteElementProps<LyraHandoffDi
|
|
|
1015
1015
|
'from-agent'?: LyraHandoffDivider['fromAgent'];
|
|
1016
1016
|
'to-agent'?: LyraHandoffDivider['toAgent'];
|
|
1017
1017
|
}>;
|
|
1018
|
-
export type LyraHeatmapSvelteProps = LyraSvelteElementProps<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1018
|
+
export type LyraHeatmapSvelteProps = LyraSvelteElementProps<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click' | 'lr-matrix-geometry-change', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1019
1019
|
'accessible-cells'?: LyraHeatmap['accessibleCells'];
|
|
1020
1020
|
'bucket-count'?: LyraHeatmap['bucketCount'];
|
|
1021
1021
|
'cell-size'?: LyraHeatmap['cellSize'];
|
|
@@ -1167,15 +1167,17 @@ export type LyraLineChartSvelteProps = LyraSvelteElementProps<LyraLineChart, 'an
|
|
|
1167
1167
|
'y-label'?: LyraLineChart['yLabel'];
|
|
1168
1168
|
'y2-label'?: LyraLineChart['y2Label'];
|
|
1169
1169
|
}>;
|
|
1170
|
-
export type LyraLiteChartSvelteProps = LyraSvelteElementProps<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1170
|
+
export type LyraLiteChartSvelteProps = LyraSvelteElementProps<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'dataTableToggle' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'showDataTable' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-data-table-toggle-active-bg' | '--lr-lite-chart-data-table-toggle-hover-bg' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1171
1171
|
'accessible-label'?: LyraLiteChart['accessibleLabel'];
|
|
1172
1172
|
'bar-gap-ratio'?: LyraLiteChart['barGapRatio'];
|
|
1173
1173
|
'bar-width'?: LyraLiteChart['barWidth'];
|
|
1174
1174
|
'begin-at-zero'?: LyraLiteChart['beginAtZero'];
|
|
1175
|
+
'data-table-toggle'?: LyraLiteChart['dataTableToggle'];
|
|
1175
1176
|
'legend-position'?: LyraLiteChart['legendPosition'];
|
|
1176
1177
|
'max-labels'?: LyraLiteChart['maxLabels'];
|
|
1177
1178
|
'min-bar-height'?: LyraLiteChart['minBarHeight'];
|
|
1178
1179
|
'rounded-bars'?: LyraLiteChart['roundedBars'];
|
|
1180
|
+
'show-data-table'?: LyraLiteChart['showDataTable'];
|
|
1179
1181
|
'skip-zero'?: LyraLiteChart['skipZero'];
|
|
1180
1182
|
'table-totals'?: LyraLiteChart['tableTotals'];
|
|
1181
1183
|
'value-axis-gutter'?: LyraLiteChart['valueAxisGutter'];
|
package/dist/theme.css
CHANGED
|
@@ -468,4 +468,36 @@
|
|
|
468
468
|
--lr-theme-terminal-bg-bright-white: #696969;
|
|
469
469
|
/* terminal ramp: end */
|
|
470
470
|
}
|
|
471
|
+
|
|
472
|
+
/* Consumer-scope focus ring.
|
|
473
|
+
|
|
474
|
+
These four are LAYER-2 (--lr-*) names, which this file otherwise does not declare: every
|
|
475
|
+
component re-derives them from the --lr-theme-* inputs on its own :host, so a document-scope
|
|
476
|
+
declaration is normally both redundant and shadowed. They are the deliberate exception,
|
|
477
|
+
because --lr-focus-ring exists specifically to serve a CONSUMER-authored idiom -- the Web
|
|
478
|
+
Awesome `outline: var(--wa-focus-ring)` that migrating projects already have -- and that rule
|
|
479
|
+
is written against the consumer's own element, where a :host-only token resolves to nothing.
|
|
480
|
+
An empty var() makes the whole `outline` declaration invalid at computed-value time, and since
|
|
481
|
+
`outline` does not inherit, the ring did not degrade: it disappeared, with no console warning
|
|
482
|
+
and no test signal. That is a WCAG 2.4.7 failure, and it is the exact silent-failure class the
|
|
483
|
+
composite was introduced to prevent.
|
|
484
|
+
|
|
485
|
+
Declared on the mode selectors rather than :root alone, because .lr-dark /
|
|
486
|
+
[data-lr-theme='dark'] may sit on any ancestor: resolving the colour once at :root would
|
|
487
|
+
freeze the light value for a subtree that later switches to dark. Each mode host re-derives
|
|
488
|
+
from its own --lr-theme-color-focus.
|
|
489
|
+
|
|
490
|
+
Components are unaffected -- their own :host declarations still win over these inherited
|
|
491
|
+
values, which production-theme.test.ts asserts. */
|
|
492
|
+
:root,
|
|
493
|
+
.lr-light,
|
|
494
|
+
[data-lr-theme='light'],
|
|
495
|
+
.lr-dark,
|
|
496
|
+
[data-lr-theme='dark'] {
|
|
497
|
+
--lr-focus-ring-width: var(--lr-theme-focus-ring-width, 2px);
|
|
498
|
+
--lr-focus-ring-color: var(--lr-theme-color-focus, Highlight);
|
|
499
|
+
--lr-focus-ring-offset: var(--lr-theme-focus-ring-offset, 2px);
|
|
500
|
+
--lr-focus-ring: var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);
|
|
501
|
+
}
|
|
502
|
+
|
|
471
503
|
}
|
package/dist/vue.d.ts
CHANGED
|
@@ -726,7 +726,7 @@ export type LyraDatasetViewerVueProps = LyraVueCustomElement<LyraDatasetViewer,
|
|
|
726
726
|
'active-highlight-id'?: LyraDatasetViewer['activeHighlightId'];
|
|
727
727
|
'max-height'?: LyraDatasetViewer['maxHeight'];
|
|
728
728
|
}>;
|
|
729
|
-
export type LyraDateInputVueProps = LyraVueCustomElement<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
729
|
+
export type LyraDateInputVueProps = LyraVueCustomElement<LyraDateInput, 'accessibleLabel' | 'appearance' | 'assumeInteractionOn' | 'autocapitalize' | 'autocomplete' | 'autoCorrect' | 'clearLabel' | 'customError' | 'dayContent' | 'defaultValue' | 'dialogLabel' | 'disabled' | 'disabledDates' | 'disabledDaysOfWeek' | 'disableFuture' | 'disablePast' | 'distance' | 'enterKeyHint' | 'errorText' | 'firstDayOfWeek' | 'form' | 'hint' | 'inputMode' | 'isDateDisabled' | 'label' | 'locale' | 'max' | 'maxRange' | 'min' | 'minRange' | 'mode' | 'months' | 'name' | 'open' | 'openLabel' | 'pageBy' | 'pill' | 'placeholder' | 'placement' | 'presets' | 'readonly' | 'required' | 'selectionDirection' | 'selectionEnd' | 'selectionStart' | 'size' | 'spellcheck' | 'strings' | 'today' | 'validationTarget' | 'validators' | 'value' | 'valueAsDate' | 'valueAsRange' | 'weekdayFormat' | 'withClear' | 'withHint' | 'withLabel' | 'withOutsideDays' | 'withWeekNumbers', {
|
|
730
730
|
form: HTMLFormElement | string | null;
|
|
731
731
|
}, LyraDateInputEventMap, 'blur' | 'change' | 'focus' | 'input' | 'lr-after-hide' | 'lr-after-show' | 'lr-clear' | 'lr-hide' | 'lr-invalid' | 'lr-show', '--hide-duration' | '--lr-date-input-action-active-bg' | '--lr-date-input-action-active-color' | '--lr-date-input-action-active-radius' | '--lr-date-input-action-hover-bg' | '--lr-date-input-action-hover-color' | '--lr-date-input-action-hover-radius' | '--lr-date-input-control-height' | '--lr-date-input-control-min-height' | '--lr-date-input-focus-border-color' | '--lr-date-input-font-size' | '--lr-date-input-gap' | '--lr-date-input-padding-block' | '--lr-date-input-padding-inline' | '--lr-date-input-placeholder-color' | '--lr-date-input-radius' | '--lr-form-control-required-color' | '--lr-form-control-required-content' | '--lr-form-control-required-offset' | '--show-duration', {
|
|
732
732
|
'aria-label'?: LyraDateInput['accessibleLabel'];
|
|
@@ -1017,7 +1017,7 @@ export type LyraHandoffDividerVueProps = LyraVueCustomElement<LyraHandoffDivider
|
|
|
1017
1017
|
'from-agent'?: LyraHandoffDivider['fromAgent'];
|
|
1018
1018
|
'to-agent'?: LyraHandoffDivider['toAgent'];
|
|
1019
1019
|
}>;
|
|
1020
|
-
export type LyraHeatmapVueProps = LyraVueCustomElement<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1020
|
+
export type LyraHeatmapVueProps = LyraVueCustomElement<LyraHeatmap, 'accessibleCells' | 'annotations' | 'bucketCount' | 'cellColor' | 'cellInteractive' | 'cellSize' | 'cellText' | 'colLabelHeight' | 'colLabelRotation' | 'colorSteps' | 'data' | 'domain' | 'fitToWidth' | 'legendStops' | 'locale' | 'maxCellSize' | 'midpoint' | 'minCellSize' | 'rowLabelWidth' | 'scale' | 'selectedCell' | 'strings' | 'valueLabel', {}, LyraHeatmapEventMap, 'lr-cell-click' | 'lr-matrix-geometry-change', '--lr-heatmap-annotation-color' | '--lr-heatmap-color-steps-gradient' | '--lr-heatmap-focus-ring-color' | '--lr-heatmap-label-font' | '--lr-heatmap-no-data-fill' | '--lr-heatmap-scale-hi' | '--lr-heatmap-scale-lo' | '--lr-heatmap-selected-color' | '--lr-heatmap-tooltip-bg' | '--lr-heatmap-tooltip-text', {
|
|
1021
1021
|
'accessible-cells'?: LyraHeatmap['accessibleCells'];
|
|
1022
1022
|
'bucket-count'?: LyraHeatmap['bucketCount'];
|
|
1023
1023
|
'cell-size'?: LyraHeatmap['cellSize'];
|
|
@@ -1169,15 +1169,17 @@ export type LyraLineChartVueProps = LyraVueCustomElement<LyraLineChart, 'annotat
|
|
|
1169
1169
|
'y-label'?: LyraLineChart['yLabel'];
|
|
1170
1170
|
'y2-label'?: LyraLineChart['y2Label'];
|
|
1171
1171
|
}>;
|
|
1172
|
-
export type LyraLiteChartVueProps = LyraVueCustomElement<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1172
|
+
export type LyraLiteChartVueProps = LyraVueCustomElement<LyraLiteChart, 'accessibleLabel' | 'barGapRatio' | 'barWidth' | 'barX' | 'beginAtZero' | 'datasets' | 'dataTableToggle' | 'description' | 'formatter' | 'height' | 'label' | 'labels' | 'layout' | 'legend' | 'legendPosition' | 'legendText' | 'locale' | 'maxLabels' | 'minBarHeight' | 'pointText' | 'roundedBars' | 'scale' | 'selectedIndices' | 'showDataTable' | 'skipZero' | 'stacked' | 'strings' | 'tableCellFormatter' | 'tableTotals' | 'tickFormat' | 'type' | 'valueAxisGutter' | 'withoutValueAxis' | 'xLabel' | 'yLabel', {}, LyraLiteChartEventMap, 'lr-datum-activate' | 'lr-point-click', '--lr-chart-color-1' | '--lr-chart-color-2' | '--lr-chart-color-3' | '--lr-chart-color-4' | '--lr-chart-color-5' | '--lr-chart-color-6' | '--lr-chart-color-7' | '--lr-chart-color-8' | '--lr-chart-grid-color' | '--lr-chart-height' | '--lr-chart-legend-color' | '--lr-chart-legend-side-max' | '--lr-chart-pattern-step' | '--lr-chart-tick-color' | '--lr-lite-chart-data-table-toggle-active-bg' | '--lr-lite-chart-data-table-toggle-hover-bg' | '--lr-lite-chart-selected-outline-color' | '--lr-lite-chart-selected-outline-width', {
|
|
1173
1173
|
'accessible-label'?: LyraLiteChart['accessibleLabel'];
|
|
1174
1174
|
'bar-gap-ratio'?: LyraLiteChart['barGapRatio'];
|
|
1175
1175
|
'bar-width'?: LyraLiteChart['barWidth'];
|
|
1176
1176
|
'begin-at-zero'?: LyraLiteChart['beginAtZero'];
|
|
1177
|
+
'data-table-toggle'?: LyraLiteChart['dataTableToggle'];
|
|
1177
1178
|
'legend-position'?: LyraLiteChart['legendPosition'];
|
|
1178
1179
|
'max-labels'?: LyraLiteChart['maxLabels'];
|
|
1179
1180
|
'min-bar-height'?: LyraLiteChart['minBarHeight'];
|
|
1180
1181
|
'rounded-bars'?: LyraLiteChart['roundedBars'];
|
|
1182
|
+
'show-data-table'?: LyraLiteChart['showDataTable'];
|
|
1181
1183
|
'skip-zero'?: LyraLiteChart['skipZero'];
|
|
1182
1184
|
'table-totals'?: LyraLiteChart['tableTotals'];
|
|
1183
1185
|
'value-axis-gutter'?: LyraLiteChart['valueAxisGutter'];
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- **Family** `components/agent-tools/` — see `llms/index.md` for its siblings
|
|
8
8
|
- **Status** `stable` since `6.2.0` — see the maturity and deprecation policy in `llms/shared.md`
|
|
9
9
|
- **Deprecations** none
|
|
10
|
-
- **Optional peers**
|
|
10
|
+
- **Optional peers** none
|
|
11
11
|
- **Themeable via** 13 parts, 2 custom properties — see this component's own `@csspart`/`@cssprop` list below
|
|
12
12
|
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- **Family** `components/conversation/` — see `llms/index.md` for its siblings
|
|
8
8
|
- **Status** `stable` since `4.2.0` — see the maturity and deprecation policy in `llms/shared.md`
|
|
9
9
|
- **Deprecations** none
|
|
10
|
-
- **Optional peers** `
|
|
10
|
+
- **Optional peers** `dompurify`, `katex`, `marked`, `shiki` — see `llms/peers.md`
|
|
11
11
|
- **Themeable via** 16 parts, 0 custom properties — see this component's own `@csspart`/`@cssprop` list below
|
|
12
12
|
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- **Family** `components/charts/` — see `llms/index.md` for its siblings
|
|
8
8
|
- **Status** `stable` since `4.0.0` — see the maturity and deprecation policy in `llms/shared.md`
|
|
9
9
|
- **Deprecations** none
|
|
10
|
-
- **Optional peers** `@sgratzl/chartjs-chart-boxplot`, `chart.js
|
|
10
|
+
- **Optional peers** `@sgratzl/chartjs-chart-boxplot`, `chart.js` — see `llms/peers.md`
|
|
11
11
|
- **Themeable via** 12 parts, 13 custom properties — see this component's own `@csspart`/`@cssprop` list below
|
|
12
12
|
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`
|
|
13
13
|
|
|
@@ -46,7 +46,7 @@ browser). Does **not** extend `LyraChart` — a deliberately bespoke API.
|
|
|
46
46
|
- `formatter?: LyraChartFormatter`, `valueFormatter?: LyraChartValueFormatter` — numeric axis,
|
|
47
47
|
tooltip, table, summary, and export formatting; the context-object formatter takes precedence
|
|
48
48
|
- `showDataTable: boolean = false` (attribute `show-data-table`) — reveals the accessible data table
|
|
49
|
-
- `dataTableToggle: boolean = false` (attribute `data-table-toggle`, new in
|
|
49
|
+
- `dataTableToggle: boolean = false` (attribute `data-table-toggle`, new in 11.0.0) — renders a
|
|
50
50
|
localized disclosure button (`part="data-table-toggle"`) above the data table so a *sighted*
|
|
51
51
|
reader can reveal the numbers on demand. `showDataTable` alone is all-or-nothing, which left
|
|
52
52
|
consumers wrapping a duplicated table in their own `<details>`. With the toggle on,
|