@aceshooting/lyra-ui 29.2.1 → 29.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 29.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e020642: Preserve per-datum border colors across all Chart.js chart types when a series supplies a color array. Keep repeating series and point color palettes aligned with their original data indexes when the chart samples rows for display.
|
|
8
|
+
|
|
9
|
+
The chart-family gzip ceiling and unpacked package ceilings advance only to the next 64-byte boundary where the color correction and release notes exceed their previous limits; other size limits and measurement settings stay unchanged.
|
|
10
|
+
|
|
11
|
+
The matched quick Chromium comparison against 29.2.1 passed all semantic checks. Chart assignment settlement increased from 22.1 to 25.6 ms median, while total chart assignment remained 63.5 to 64.1 ms median. Seven additional timing metrics exceeded the advisory threshold in unchanged document, table, and select workloads, including no-op paint waits; fourteen metrics improved. These seven-sample observations include scheduling variation and do not establish a causal performance change.
|
|
12
|
+
- @aceshooting/lyra-translations@29.2.2
|
|
13
|
+
|
|
3
14
|
## 29.2.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ import{__decorate}from"tslib";import{SpatialSourceController,spatialContains}fro
|
|
|
5
5
|
${(this.spatial.result?.bins??[]).map((bin,index)=>{const current=this.spatialGuard(()=>this.spatial.result?.bins.includes(bin)===!0);return html`<tr><th scope="row">${this.spatialBinText(bin)}</th><td><button type="button" tabindex=${this.dataTableVisible?"0":"-1"} aria-label=${this.spatialBinText(bin)} data-spatial-bin=${index}
|
|
6
6
|
@click=${event=>{current(event)&&this.activateSpatialBin(bin)}}>${this.formatSummaryValue(bin.count)}</button></td></tr>`})}
|
|
7
7
|
</tbody></table>`}refreshPreparedModel(){if(!this.preparedDirty)return;this.preparedDirty=!1,this.preparedInvalid=!1,this.preparedRequestFailed=!1,this.preparedBaseModel=this.preparedModel=void 0,this.preparedEffective=void 0;const generation=this.preparedGeneration,input=this.preparedDataInput();this.preparedChanged||=this.preparedActive||input!==null,this.spatialActive=!1,this.preparedActive=input!==null;try{if(input!==null){const kind=Object.getOwnPropertyDescriptor(input,"kind");if(generation!==this.preparedGeneration)return;if(kind&&"value"in kind&&kind.value==="spatial"){const type=this.effectiveType();if(type!=="scatter"&&type!=="bubble"||this.scaleType!=="linear")throw new TypeError("Incompatible spatial chart");if(this.spatialActive=!0,this.preparedRequests.setSource(void 0,void 0),this.spatial.bind(input,this.viewport,normalizeChartRecordLimit(this.maxRecords),this.selectedPointId,{type}),generation!==this.preparedGeneration)return;this.preparedInvalid=this.spatial.error;return}const model=prepareChartModel(input,this.effectiveType(),normalizeChartRecordLimit(this.maxRecords));this.preparedBaseModel=this.preparedModel=model,this.preparedRequests.setSource(input,model.revision)}else this.preparedRequests.setSource(void 0,void 0)}catch{this.preparedInvalid=!0,this.preparedRequests.setSource(void 0,void 0)}}async revealSourcePoint(ref){if(typeof ref=="string")return this.revealSpatialPoint(ref);if(!this.isConnected||!ref||typeof ref.seriesId!="string")return!1;ref=Object.freeze({seriesId:ref.seriesId,sourceIndex:ref.sourceIndex}),this.preparedDirty&&await this.updateComplete;const model=this.preparedBaseModel;if(!model||model.kind!=="series")return!1;const series=model.series.find(series2=>series2.id===ref.seriesId);if(!series||!Number.isSafeInteger(ref.sourceIndex)||ref.sourceIndex<0||ref.sourceIndex>=series.counts.sourceCount)return!1;const lease=this.preparedRequests.begin("point",this.effectiveLocale);if(!lease)return!1;this.preparedPending=!0,this.preparedRequestFailed=!1,this.requestUpdate("preparedView",null);const signal=lease.context.signal;try{const source=model.source;if(source.kind!=="series"||source.revision!==model.revision)throw new Error("Prepared source revision changed");const response=source.getPoint(ref,{signal}),point=await preparedResponse(response,signal);if(!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision||point===null)return!1;let next=model;const refinement=Object.getOwnPropertyDescriptor(source,"queryRange");if(refinement){if(!("value"in refinement)||typeof refinement.value!="function")throw new TypeError("Invalid indexed refinement");const otherEntries=model.peerCount-series.samples.length,entryBudget=Math.min(model.limit-otherEntries,Math.floor(1e3/model.series.length)),maxPoints=Math.max(1,Math.floor((entryBudget-1)/2)),startIndex=Math.max(0,ref.sourceIndex-maxPoints),endIndex=Math.min(series.counts.sourceCount,ref.sourceIndex+Math.min(maxPoints+1,series.counts.sourceCount-ref.sourceIndex)),request={seriesId:ref.seriesId,startIndex,endIndex,maxPoints,signal},points=await preparedResponse(source.queryRange(request),signal);if(!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision)return!1;next=withPreparedRange(model,request,points)}const overlay=withPreparedPoint(next,ref,point);return!lease.isCurrent()||this.preparedBaseModel!==model||source.revision!==model.revision?!1:(this.preparedModel=overlay,this.preparedChanged=!0,this.preparedEffective=void 0,this.descriptionMemo=void 0,this.dataTableRows=void 0,!0)}catch{return lease.isCurrent()&&(this.preparedRequestFailed=!0,this.announcements.announceAssertive(this.localize("chartPreparedUnavailable"))),!1}finally{lease.isCurrent()&&(this.preparedPending=!1,this.requestUpdate("preparedView",null))}}canonicalLabels(){const source=this.labels;if(this.labelsSnapshot&&Object.is(this.labelsSnapshot.source,source))return this.labelsSnapshot.value;const value=projectChartStrings(source)??Object.freeze([]);return this.labelsSnapshot={source,value},value}canonicalAnnotations(){const source=this.annotations;if(this.annotationsSnapshot&&Object.is(this.annotationsSnapshot.source,source))return this.annotationsSnapshot.value;const value=projectChartAnnotations(source);return this.annotationsSnapshot={source,value},value}canonicalHiddenDatasets(){const source=this.hiddenDatasets;if(this.hiddenDatasetsSnapshot&&Object.is(this.hiddenDatasetsSnapshot.source,source))return this.hiddenDatasetsSnapshot.value;const value=source===void 0?void 0:Object.freeze(Array.isArray(source)?source.filter(index=>typeof index=="number"&&Number.isInteger(index)):[]);return this.hiddenDatasetsSnapshot={source,value},value}get datasets(){return this._datasets}set datasets(value){if(Object.is(value,this.datasetsSource)||Object.is(value,this._datasets))return;const previous=this._datasets;this._datasets=normalizeChartSeries(value),this.datasetsSource=value,this.requestUpdate("datasets",previous)}get hiddenDatums(){return this._hiddenDatums}set hiddenDatums(value){if(Object.is(value,this.hiddenDatumsSource)||Object.is(value,this._hiddenDatums))return;const previous=this._hiddenDatums;this._hiddenDatums=projectHiddenDatasetIndexes(value)??Object.freeze([]),this.hiddenDatumsSource=value,this.requestUpdate("hiddenDatums",previous)}get compactPlot(){return isDenseChartSize(this.size)}get plugins(){return this._plugins}set plugins(value){if(Object.is(value,this.pluginsSource)||Object.is(value,this._plugins))return;const previous=this._plugins;this._plugins=projectChartPlugins(value),this.pluginsSource=value,this.requestUpdate("plugins",previous)}get dataTableVisible(){return chartDataTableVisible(this.withDataTable,this.dataTableToggle,this.dataTableExpandedOverride)}toggleDataTable(){this.dataTableExpandedOverride=!this.dataTableVisible}get config(){return this._config}set config(value){if(Object.is(value,this.configSource)||value!==void 0&&Object.is(value,this._config))return;const previous=this._config;this._config=projectChartConfiguration(value),this.configSource=value,this.requestUpdate("config",previous)}normalizeEffectiveConfig(config){return config}effectiveConfig(){const config=this.normalizeEffectiveConfig(this.config??this.slottedConfig);return this.preparedDataInput()===null||!config?config:{type:config.type,options:config.options,plugins:config.plugins}}onConfigSlotChange(event){const slot=event.currentTarget;slot===this.configSlotEl&&this.collectConfigFromSlot(slot)}collectConfigFromSlot(slot){const script=slot.assignedElements({flatten:!0}).find(element=>element.localName==="script"&&element.type.trim().toLowerCase()==="application/json");let next;if(script)try{const parsed=JSON.parse(script.textContent??"");next=projectChartConfiguration(parsed)}catch{next=void 0}Object.is(this.slottedConfig,next)||(this.slottedConfig=next)}effectiveData(){if(this.spatialActive){const groups=this.spatialSeriesPoints();return{labels:[],datasets:(this.spatial.binding?.chart?.series??[]).map((series,index)=>{const data=groups[index].map(point=>Object.freeze({x:point.x,y:point.y,...point.radius===void 0?{}:{r:point.radius},...point.label===void 0?{}:{label:point.label}})),dataset=Object.freeze({label:series.label,data});return canonicalChartDatasetValues.set(dataset,data),dataset})}}if(this.preparedActive){const model=this.preparedModel;if(!model)return{labels:[],datasets:[]};if(this.preparedEffective?.model===model)return this.preparedEffective.data;const datasets2=model.series.map(series=>{const data2=model.kind==="series"?series.samples.map(point=>point?Object.freeze({x:point.x,y:point.y,label:String(point.sourceIndex)}):null):[...series.values];Object.freeze(data2);const dataset=Object.freeze({label:series.label,data:data2});return canonicalChartDatasetValues.set(dataset,data2),dataset}),data={labels:[...model.labels],datasets:datasets2};return this.preparedEffective={model,data},data}const labels=this.canonicalLabels(),datasets=this.datasets,config=this.config??this.slottedConfig,memo=this.effectiveDataMemo;if(memo?.labels===labels&&memo.datasets===datasets&&memo.config===config)return memo.value;const generated={labels:[...labels],datasets:datasets.map(series=>{const{points:_points,...safeSeries}=series,values=canonicalSeriesPoints(series)??canonicalSeriesData(series),data=[...values];Object.freeze(data);const dataset={...safeSeries,data,yAxisID:series.axis==="y2"?"y2":"y"};return canonicalChartDatasetValues.set(dataset,values),Object.freeze(dataset)})};Object.freeze(generated.labels),Object.freeze(generated.datasets);const override=projectChartDataConfiguration(this.effectiveConfig()?.data);let value=generated;if(override){const projected=projectChartDataConfiguration(deepMerge(generated,override));value={labels:projected?.labels??[],datasets:projected?.datasets??[]}}return this.effectiveDataMemo={labels,datasets,config,value},value}callbackDatasetIndex(value,effective=this.effectiveData()){const datasetIndex=chartCallbackDatasetIndex(value);if(datasetIndex===void 0)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[datasetIndex]??datasetIndex;return effective.datasets[sourceDatasetIndex]?datasetIndex:void 0}callbackIndexes(value,effective=this.effectiveData()){const hit=chartCallbackIndexes(value);if(!hit)return;const visualDatasetCount=this.visualDatasetSourceIndexes?.length??effective.datasets.length;if(hit.datasetIndex>=visualDatasetCount)return;const sourceDatasetIndex=this.visualDatasetSourceIndexes?.[hit.datasetIndex]??hit.datasetIndex,dataset=effective.datasets[sourceDatasetIndex];if(!dataset)return;const visualRowCount=this.visualRowSourceIndexes?.length??this.datasetValues(dataset).length;return hit.index<visualRowCount?hit:void 0}effectiveHiddenDatasetIndexes(){const effective=this.effectiveData(),controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),effective.datasets.length);return controlled!==void 0?controlled:effective.datasets.flatMap((dataset,index)=>chartDatasetBoolean(dataset,"hidden")===!0?[index]:[])}applyDatasetVisibility(){if(!this.chart)return!1;const chart=this.chart,sourceDatasetCount=this.effectiveData().datasets.length,datasetCount=this.visualDatasetSourceIndexes?.length??sourceDatasetCount,controlled=normalizeHiddenDatasets(this.canonicalHiddenDatasets(),sourceDatasetCount);if(controlled===void 0){for(let index=0;index<datasetCount;index++)try{const metadata=chart.getDatasetMeta?.(index);metadata&&(metadata.hidden=null)}catch{}return datasetCount>0}const hidden=new Set(controlled);for(let index=0;index<datasetCount;index++){const sourceIndex=this.visualDatasetSourceIndexes?.[index]??index;try{chart.setDatasetVisibility(index,!hidden.has(sourceIndex))}catch{}}return datasetCount>0}isSliceChart(){return["pie","doughnut","polarArea"].includes(this.effectiveType())}applyDatumVisibility(){if(!this.chart||!this.isSliceChart())return!1;const sample=this.dataTableSample(),rows=this.visualRowSourceIndexes,hidden=new Set(normalizeHiddenDatasets(this.hiddenDatums,sample.rowCount));let changed=!1;for(let index=0;index<(rows?.length??sample.rowCount);index++){const visible=!hidden.has(rows?.[index]??index);try{this.chart.getDataVisibility?.(index)===!visible&&(this.chart.toggleDataVisibility?.(index),changed=!0)}catch{}}return changed}hasExplicitConfigData(){const config=this.effectiveConfig();if(!isSafeChartConfigurationRecord(config))return!1;const data=chartRecordValue(config,"data");return data!==MISSING_OWN_DATA_DESCRIPTOR&&data!==UNSAFE_OWN_DATA_DESCRIPTOR}datasetLabel(dataset,index){return chartDatasetLabel(dataset)||this.localize("chartPointLabel",void 0,{n:getNumberFormat(this.effectiveLocale).format(index+1)})}datasetValues(dataset){return chartDatasetValues(dataset)}isPointDataset(dataset){const values=this.datasetValues(dataset);return this.effectiveType()==="scatter"||this.effectiveType()==="bubble"||values.some(value=>normalizedChartPoint(value)!==null)}appendData(label,values,maxPoints=0){this.preparedDataInput()===null&&this.withStreamedTableUpdate(()=>{const requested=Number.isFinite(maxPoints)?Math.max(0,Math.floor(maxPoints)):0,limit=requested>0?Math.min(requested,MAX_CHART_INPUT_ENTRIES):MAX_CHART_INPUT_ENTRIES,appendedValues=projectChartNumberData(values)??Object.freeze([]);if(this.hasExplicitConfigData()){const effective=this.effectiveData();let domainLength2=effective.labels.length;for(const dataset of effective.datasets)this.isPointDataset(dataset)||(domainLength2=Math.max(domainLength2,this.datasetValues(dataset).length));const labels2=[...effective.labels,...Array.from({length:Math.max(0,domainLength2-effective.labels.length)},()=>""),label],effectiveConfig=this.effectiveConfig(),currentData=projectChartDataConfiguration(effectiveConfig?.data)??{},explicitLabels=admitChartArray(currentData.labels)!==void 0,explicitDatasets=admitChartArray(currentData.datasets)!==void 0,nextLabels=labels2.slice(-limit);if(explicitLabels||(this.labels=nextLabels.map(labelText)),!explicitDatasets){const datasets2=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),appendedValues[index]??null];return appendChartSeries(series,data.slice(-limit))});this.datasets=datasets2}if(explicitLabels||explicitDatasets){const nextData={...currentData};explicitLabels&&(nextData.labels=Object.freeze(nextLabels)),explicitDatasets&&(nextData.datasets=effective.datasets.map((dataset,index)=>{if(this.isPointDataset(dataset))return dataset;const current=this.datasetValues(dataset),peer=chartDatasetPeerValues(dataset),padding=Array.from({length:Math.max(0,domainLength2-current.length)},()=>null),data=[...peer,...padding,appendedValues[index]??null],canonical=[...current,...padding,appendedValues[index]??null],nextData2=Object.freeze(data.slice(-limit)),nextCanonical=canonical.slice(-limit);canonicalChartDatasetDataValues.set(nextData2,Object.freeze(nextCanonical));const nextDataset=Object.freeze({...dataset,data:nextData2});return canonicalChartDatasetValues.set(nextDataset,Object.freeze(nextCanonical)),nextDataset})),Array.isArray(nextData.datasets)&&Object.freeze(nextData.datasets),canonicalChartDataSnapshots.add(nextData);const previous=this._config;this._config=Object.freeze({...effectiveConfig,data:Object.freeze(nextData)}),this.configSource=this._config,this.requestUpdate("config",previous)}return}const currentLabels=this.canonicalLabels();let domainLength=currentLabels.length;for(const series of this.datasets)canonicalSeriesPoints(series)===void 0&&(domainLength=Math.max(domainLength,canonicalSeriesData(series).length));const labels=[...currentLabels,...Array.from({length:Math.max(0,domainLength-currentLabels.length)},()=>""),label],datasets=this.datasets.map((series,index)=>{if(canonicalSeriesPoints(series)!==void 0)return series;const current=canonicalSeriesData(series),data=[...current,...Array.from({length:Math.max(0,domainLength-current.length)},()=>null),appendedValues[index]??null];return appendChartSeries(series,data.slice(-limit))});this.labels=labels.slice(-limit),this.datasets=datasets})}exportData(format){if(format==="png")return this.chart?.toBase64Image?.()??"";if(this.spatialActive)return spatialCsv(this.spatial.binding?.chart?.series??[],this.spatialPoints(),this.spatial.result?.bins??[],(value,record,column)=>{const datasetIndex="seriesId"in record?this.spatial.binding.chart.series.findIndex(series=>series.id===record.seriesId):void 0;return this.formatExportValue(value,{datasetIndex,..."sourceIndex"in record?{index:record.sourceIndex,label:record.label}:{},...column==="x"||column==="y"||column==="radius"?{statistic:column==="radius"?"r":column}:{}})});const effective=this.effectiveData(),columns=effective.datasets.map((dataset,datasetIndex)=>{const values=this.datasetValues(dataset),label=this.datasetLabel(dataset,datasetIndex),points=values.map(normalizedChartPoint).filter(point=>point!==null);return{dataset,label,point:this.isPointDataset(dataset),radius:points.some(point=>point.r!=null),pointLabel:points.some(point=>point.label!=null)}}),header=["label",...columns.flatMap(column=>column.point?[`${column.label} x`,`${column.label} y`,...column.radius?[`${column.label} r`]:[],...column.pointLabel?[`${column.label} label`]:[]]:[column.label])].map(escapeCsvField).join(",");let rowCount=effective.labels.length;for(const dataset of effective.datasets)rowCount=Math.max(rowCount,this.datasetValues(dataset).length);const exportCell=(value,metadata)=>typeof value!="number"||!Number.isFinite(value)?value??"":this.formatExportValue(value,metadata)??value,rows=Array.from({length:rowCount},(_,index)=>{const firstPoint=effective.datasets.map(dataset=>normalizedChartPoint(this.datasetValues(dataset)[index])).find(point=>point!==null),label=labelText(effective.labels[index])||firstPoint?.label||"";return[label,...columns.flatMap((column,datasetIndex)=>{const value=this.datasetValues(column.dataset)[index],axis=this.datasetValueAxis(column.dataset),metadata={datasetIndex,index,label:label||void 0,seriesLabel:column.label,...axis===void 0?{}:{axis}};if(!column.point)return[exportCell(value,metadata)];const point=normalizedChartPoint(value);return point?[exportCell(point.x,{...metadata,statistic:"x"}),exportCell(point.y,{...metadata,statistic:"y"}),...column.radius?[point.r==null?"":exportCell(point.r,{...metadata,statistic:"r"})]:[],...column.pointLabel?[point.label??""]:[]]:["","",...column.radius?[""]:[],...column.pointLabel?[""]:[]]})].map(escapeCsvField).join(",")});return[header,...rows].join(`\r
|
|
8
|
-
`)}connectedCallback(){super.connectedCallback(),this.preparedDirty=!0,this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=onAnnotationPluginRegistered(()=>this.rebuildAfterAnnotationRegistration()),this.visible=!this.ownerWindow?.IntersectionObserver,this.armReducedMotionWatcher();const ownerWindow=this.ownerWindow,ResizeObserverCtor=ownerWindow?.ResizeObserver;ResizeObserverCtor&&(this.resizeObserver=new ResizeObserverCtor(entries=>{const width=entries[0]?.contentRect.width??this.getBoundingClientRect().width;if(Number.isFinite(width)&&this.lastObservedInlineSize!==void 0&&Math.abs(width-this.lastObservedInlineSize)<.5||(this.lastObservedInlineSize=width,this.resizeDrawFrame!==void 0))return;const frameOwner=this.ownerWindow;frameOwner&&(this.resizeDrawFrameOwner=frameOwner,this.resizeDrawFrame=frameOwner.requestAnimationFrame(()=>{if(this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,!this.isConnected||this.ownerWindow!==frameOwner)return;const samplingWidth=Number.isFinite(this.lastObservedInlineSize)?Math.max(0,Math.floor(this.lastObservedInlineSize)):0;if(samplingWidth!==this.samplingWidth){this.samplingWidth=samplingWidth,this.updateAutoLegendPosition();return}this.updateAutoLegendPosition()||this.drawIfVisible()}))}),this.resizeObserver.observe(this)),this.updateAutoLegendPosition();const generation=++this.loadGeneration;this.zoomable&&this.requestZoomFeature(),this.loadLibrary(this.zoomable).then(async mod=>{try{await this.updateComplete}catch{return}if(await new Promise(resolve=>this.updateBrowserDerivedState(resolve)),!(generation!==this.loadGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.loadFailed=!0;return}this.loadFailed=!1,this.chartJsModule=mod,this.drawIfVisible()}}),this.needsDataLabels&&this.requestDataLabelsFeature(),this.needsAnnotations&&this.requestAnnotationFeature();const IntersectionObserverCtor=ownerWindow?.IntersectionObserver;if(IntersectionObserverCtor){const observerGeneration=++this.intersectionGeneration,observer=new IntersectionObserverCtor(entries=>{if(observerGeneration!==this.intersectionGeneration||this.intersectionObserver!==observer||!this.isConnected||this.ownerWindow!==ownerWindow)return;const wasVisible=this.visible;this.visible=entries[0]?.isIntersecting??!0,this.visible&&!wasVisible&&this.drawIfVisible()});this.intersectionObserver=observer,observer.observe(this)}}disconnectedCallback(){this.spatialRevealToken={},this.spatial.reset(),this.wakeSpatialWaiters(),this.preparedRequests.refresh(),this.preparedModel=this.preparedBaseModel=void 0,this.preparedEffective=void 0,this.preparedDirty=!0,this.chartSync.disconnect(),this.cancelDeferredTable?.(),this.cancelDeferredTable=void 0,this.deferredTableRows=void 0,super.disconnectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=void 0,this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings.clear(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeDrawFrame!==void 0&&this.resizeDrawFrameOwner?.cancelAnimationFrame(this.resizeDrawFrame),this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,this.lastObservedInlineSize=void 0,this.loadGeneration+=1,this.zoomLoadGeneration+=1,this.dataLabelsLoadGeneration+=1,this.annotationLoadGeneration+=1,this.discardChart(!1),this.builtPlugins=[],this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.intersectionGeneration+=1,this.visible=!0,this.disarmReducedMotionWatcher()}adoptedCallback(){this.spatial.authority.adopted(),this.spatialRevealToken={},this.wakeSpatialWaiters(),this.preparedRequests.adopted(),this.chartSync.disconnect(),this.canvasTokens.clear(),super.adoptedCallback(),this.announcements.adopted(),this.requestUpdate(),this.disarmReducedMotionWatcher(),this.armReducedMotionWatcher()}armReducedMotionWatcher(){this.reducedMotionWatch.arm()}disarmReducedMotionWatcher(){this.reducedMotionWatch.disarm()}get ownerWindow(){return this.ownerDocument?.defaultView??void 0}computedStyle(element=this){const view=this.ownerWindow;return view?view.getComputedStyle(element):"style"in element?element.style:this.style}applyDataLabelsPlugin(plugin){this.dataLabelsPlugin=plugin;let rebuilt=!1;plugin&&this.needsDataLabels&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],rebuilt=!0),this.drawIfVisible(),rebuilt&&this.showsLegend&&this.requestUpdate("canvasPresentation",null)}get zoomFeatureAvailable(){return this.zoomable&&this.zoomFeatureState==="available"}featureWarningMessages(){if(this.loading||this.loadFailed)return[];const messages=[];return this.zoomable&&this.zoomFeatureState==="unavailable"&&messages.push(this.localize("chartZoomUnavailable")),this.dataLabelsFeatureState==="unavailable"&&(this.dataLabels&&messages.push(this.localize("chartDataLabelsUnavailable")),this.stackTotals&&messages.push(this.localize("chartStackTotalsUnavailable"))),this.needsAnnotations&&this.annotationFeatureState==="unavailable"&&messages.push(this.localize("chartAnnotationsUnavailable")),messages}requestZoomFeature(){const generation=++this.zoomLoadGeneration;if(!this.zoomable){this.zoomFeatureState="idle";return}this.zoomFeatureState="loading",this.loadZoomFeature().then(result=>{generation!==this.zoomLoadGeneration||!this.isConnected||!this.zoomable||(this.zoomFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.drawIfVisible(),this.requestUpdate("canvasPresentation",null))})}requestAnnotationFeature(){const generation=++this.annotationLoadGeneration;if(!this.needsAnnotations){this.annotationFeatureState="idle";return}this.annotationFeatureState="loading",this.loadAnnotationFeature().then(result=>{generation!==this.annotationLoadGeneration||!this.isConnected||!this.needsAnnotations||(result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.annotationFeatureState=result.kind==="available"?"available":"unavailable",this.applyAnnotationPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate("canvasPresentation",null))})}applyAnnotationPlugin(plugin){this.annotationPlugin=plugin,plugin&&this.needsAnnotations&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[]),this.drawIfVisible()}rebuildAfterAnnotationRegistration(){!this.chart||this.needsAnnotations||(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],this.drawIfVisible())}requestDataLabelsFeature(){const generation=++this.dataLabelsLoadGeneration;if(!this.needsDataLabels){this.dataLabelsFeatureState="idle";return}this.dataLabelsFeatureState="loading",this.loadDataLabelsFeature().then(result=>{generation!==this.dataLabelsLoadGeneration||!this.isConnected||!this.needsDataLabels||(this.dataLabelsFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.applyDataLabelsPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate("canvasPresentation",null))})}willUpdate(changed){if(super.willUpdate(changed),this.refreshPreparedModel(),this.spatialActive){this.zoomed=this.viewport!==null;return}this.zoomed&&this.effectiveType()!==this.builtType&&(this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1}))}firstUpdated(changed){super.firstUpdated(changed),queueMicrotask(()=>{collectInitialSlotAssignment(this.configSlotEl,s=>this.collectConfigFromSlot(s))})}updated(changed){super.updated(changed);const appliedVisibility=this.appliedLegendVisibility;if(this.appliedLegendVisibility=void 0,!this.isConnected)return;let canvasChanges=changed;changed.has("hiddenDatasets")&&appliedVisibility!==void 0&&appliedVisibility.chart===this.chart&&appliedVisibility.hidden===this.canonicalHiddenDatasets()&&(canvasChanges=new Map(changed),canvasChanges.delete("hiddenDatasets"));const contentChanged=this.preparedChanged||this.chartContentChanged(canvasChanges);this.preparedChanged=!1;const syncDataChanged=contentChanged||changed.has("hiddenDatasets")||changed.has("hiddenDatums");this.chartSync.update(this.syncGroup,typeof this.syncGroup=="string"&&this.syncGroup.trim()!==""&&this.syncCompatible(),syncDataChanged);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&this.preparedInvalid&&!this.announcedPreparedInvalid&&this.announcements.announceAssertive(this.localize("chartPreparedUnavailable")),this.announcedPreparedInvalid=this.preparedInvalid,changed.has("keyboardDatumAnnouncement")&&changed.get("keyboardDatumAnnouncement")!==void 0&&this.keyboardDatumAnnouncement!==""&&this.announcements.announcePolite(this.keyboardDatumAnnouncement),changed.has("loadFailed")&&changed.get("loadFailed")!==void 0&&this.loadFailed&&this.announcements.announceAssertive(this.localize("chartMissingLibrary"));const dataTruncation=[this.inputLimitMessage(),this.dataTruncationMessage()].filter(Boolean).join(this.localize("chartSummarySeparator"));if(wasMounting&&(this.lastDataTruncationAnnouncement=dataTruncation),!this.loading&&!this.loadFailed){const featureWarnings=this.featureWarningMessages();for(const warning of featureWarnings)this.announcedFeatureWarnings.has(warning)||this.announcements.announceAssertive(warning);this.announcedFeatureWarnings=new Set(featureWarnings),!wasMounting&&dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation))}if(this.setAttribute("aria-busy",String(this.loading||this.preparedPending)),changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}if(this.loading)return;changed.has("zoomable")&&this.requestZoomFeature(),(changed.has("dataLabels")||changed.has("stackTotals"))&&this.requestDataLabelsFeature(),changed.has("annotations")&&this.requestAnnotationFeature();const effectiveDirection=this.effectiveDirection,effectiveLocale=this.effectiveLocale,contextChanged=this.lastDrawnDirection!==void 0&&this.lastDrawnDirection!==effectiveDirection||this.lastDrawnLocale!==void 0&&this.lastDrawnLocale!==effectiveLocale;if(this.lastDrawnDirection=effectiveDirection,this.lastDrawnLocale=effectiveLocale,!contentChanged&&!contextChanged){changed.has("hiddenDatums")&&this.visible&&this.applyDatumVisibility()&&this.chart?.update("none");return}this.drawIfVisible()}chartContentChanged(changed){return["preparedData","preparedView","spatialView","viewport","selectedPointId","type","maxRecords","samplingWidth","labels","datasets","hiddenDatasets","grid","axes","size","indexAxis","legendPosition","min","max","scaleType","annotations","plugins","autoLegendPosition","valueFormatter","formatter","tooltipTitleFormatter","tooltipFooterFormatter","area","height","xLabel","yLabel","y2Label","withoutZeroBaseline","stacked","stackedAxes","withoutAnimation","withoutLegend","withoutTooltip","syncGroup","dataLabels","stackTotals","config","slottedConfig","zoomable","locale","strings","loading"].some(name=>changed.has(name))}seriesToDataset(s,index,palette,effectiveType,chartStyle=this.chartStyleOptions(palette),rowIndexes){const series=canonicalChartSeries(s);if(!series)return{label:"",data:[]};const points=canonicalSeriesPoints(series),values=points??canonicalSeriesData(series),normalize=points?normalizedChartPoint:value=>typeof value=="number"&&Number.isFinite(value)?value:null,normalizedData=rowIndexes?rowIndexes.map(rowIndex=>normalize(values[rowIndex])):values.map(normalize),borderFallback=chartStyle.borderColors[index%chartStyle.borderColors.length]??palette[index%palette.length],fillFallback=chartStyle.fillColors[index%chartStyle.fillColors.length]??palette[index%palette.length],sourceColors=projectChartStrings(series.color),authoredColors=sourceColors&&rowIndexes?rowIndexes.map(rowIndex=>sourceColors[rowIndex]??""):typeof series.color=="string"?series.color:sourceColors,colors=typeof authoredColors=="string"?[this.canvasTokens.resolve(authoredColors,borderFallback??"transparent")]:authoredColors?this.canvasTokens.resolveMany(authoredColors,borderFallback??"transparent"):void 0,sliceChart=effectiveType==="pie"||effectiveType==="doughnut"||effectiveType==="polarArea",sliceFillColors=sliceChart&&chartStyle.fillColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.fillColors[sourceIndex%chartStyle.fillColors.length]}):void 0,sliceBorderColors=sliceChart&&chartStyle.borderColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.borderColors[sourceIndex%chartStyle.borderColors.length]}):void 0,fill=series.fill??this.area,backgroundColor=colors??sliceFillColors??fillFallback,datasetType=series.type??effectiveType,authoredSegmentColors=series.segmentColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>series.segmentColors[rowIndex%series.segmentColors.length]):series.segmentColors,segmentColors=authoredSegmentColors?this.canvasTokens.resolveMany(authoredSegmentColors,colors?.[0]??borderFallback??"transparent"):void 0,authoredPointColors=series.pointColors&&rowIndexes?rowIndexes.map(rowIndex=>series.pointColors[rowIndex]??""):series.pointColors,backgroundColors=projectChartStrings(backgroundColor),backgroundColorValue=typeof backgroundColor=="string"?backgroundColor:void 0,resolvedBackgroundColor=datasetType==="line"&&fill&&(colors||!chartStyle.authoredFillColors[index%chartStyle.authoredFillColors.length])?backgroundColors?backgroundColors.map(color=>this.canvasTokens.translucent(color)):backgroundColorValue&&this.canvasTokens.translucent(backgroundColorValue):backgroundColor,encoding=forcedColorEncoding(index),resolvedBackgroundColors=projectChartStrings(resolvedBackgroundColor),resolvedBackgroundColorValue=typeof resolvedBackgroundColor=="string"?resolvedBackgroundColor:void 0,encodedBackgroundColor=chartStyle.forcedColors?resolvedBackgroundColors?resolvedBackgroundColors.map((color,itemIndex)=>this.forcedColorPattern(sliceChart?itemIndex:index,color)):resolvedBackgroundColorValue&&this.forcedColorPattern(index,resolvedBackgroundColorValue):resolvedBackgroundColor,pointRadii=projectChartPointRadii(series.pointRadius);return{label:series.label,data:normalizedData,type:series.type,fill,...datasetType==="bar"&&this.hasConfiguredBarOption("borderRadius")?{}:{borderRadius:chartStyle.borderRadius},...datasetType==="bar"&&!Number.isFinite(series.width)&&this.hasConfiguredBarOption("borderWidth")||isArcDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"arc","borderWidth")?{}:{borderWidth:nonNegativeFinite(series.width,datasetType==="line"||datasetType==="radar"?chartStyle.lineBorderWidth:chartStyle.borderWidth)},borderDash:series.dash?[4,4]:chartStyle.forcedColors?[...encoding.dash]:void 0,pointStyle:chartStyle.forcedColors?encoding.pointStyle:void 0,backgroundColor:encodedBackgroundColor,borderColor:colors?.[0]??sliceBorderColors??borderFallback,pointBackgroundColor:authoredPointColors?this.canvasTokens.resolveMany(authoredPointColors,colors?.[0]??borderFallback??"transparent"):void 0,...isPointDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"point","radius")?{}:{pointRadius:pointRadii?(rowIndexes?rowIndexes.map(rowIndex=>pointRadii[rowIndex]):pointRadii).map(radius=>nonNegativeFinite(radius,chartStyle.pointRadius)):nonNegativeFinite(series.pointRadius,chartStyle.pointRadius)},...segmentColors?.length?{segment:{borderColor:ctx=>segmentColors[ctx.p0DataIndex%segmentColors.length]}}:{},yAxisID:series.axis==="y2"?"y2":"y",...series.stack!==void 0?{stack:series.stack}:{}}}hasConfiguredElementOption(datasetTypeKey,elementKey,option){const read=(value,key)=>{if(!isChartRecord(value))return;const descriptor=chartRecordValue(value,key);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value},options=this.effectiveConfig()?.options,dataset=read(read(options,"datasets"),datasetTypeKey),scopes=[dataset,read(read(dataset,"elements"),elementKey),read(read(options,"elements"),elementKey),options],prefixed=`${elementKey}${option[0].toUpperCase()}${option.slice(1)}`;return scopes.some(scope=>read(scope,prefixed)!==void 0||read(scope,option)!==void 0)}hasConfiguredBarOption(option){return this.hasConfiguredElementOption("bar","bar",option)}themeColors(){const cs=this.canvasTokens.sync()??this.computedStyle(),grid=cs.getPropertyValue("--grid-color").trim()||cs.getPropertyValue("--lr-chart-grid-color").trim()||cs.getPropertyValue("--_lr-chart-grid-color").trim(),tick=cs.getPropertyValue("--lr-chart-tick-color").trim()||cs.getPropertyValue("--_lr-chart-tick-color").trim(),legend=cs.getPropertyValue("--lr-chart-legend-color").trim()||cs.getPropertyValue("--_lr-chart-legend-color").trim(),tooltipBg=cs.getPropertyValue("--lr-chart-tooltip-bg").trim()||cs.getPropertyValue("--_lr-chart-tooltip-bg").trim(),tooltipText=cs.getPropertyValue("--lr-chart-tooltip-color").trim()||cs.getPropertyValue("--_lr-chart-tooltip-color").trim();return{grid:this.canvasTokens.resolve(grid,FALLBACK_GRID_COLOR),tick:this.canvasTokens.resolve(tick,FALLBACK_TICK_COLOR),tickFontSize:this.styleNumber("--lr-chart-tick-font-size","--_lr-chart-tick-font-size",FALLBACK_TICK_FONT_SIZE),legend:this.canvasTokens.resolve(legend,FALLBACK_LEGEND_COLOR),tooltipBg:this.canvasTokens.resolve(tooltipBg,FALLBACK_TOOLTIP_BG),tooltipText:this.canvasTokens.resolve(tooltipText,FALLBACK_TOOLTIP_TEXT)}}styleColor(name,fallback){const value=this.computedStyle().getPropertyValue(name).trim();return value?this.canvasTokens.resolve(value,fallback):fallback}styleNumber(name,fallbackToken,fallback){const computed=this.computedStyle(),value=computed.getPropertyValue(name).trim()||computed.getPropertyValue(fallbackToken).trim(),direct=DIRECT_PIXEL_NUMBER.exec(value);if(direct){const resolved2=Number.parseFloat(direct[1]);if(Number.isFinite(resolved2)&&resolved2>=0)return resolved2}if(!value||!this.ownerWindow)return fallback;const resolved=this.canvasTokens.length(value,()=>{const probe=this.ownerDocument.createElement("span");probe.hidden=!0,probe.setAttribute("aria-hidden","true"),probe.style.inlineSize=value,(this.shadowRoot??this).append(probe);try{return Number.parseFloat(this.computedStyle(probe).inlineSize)}finally{probe.remove()}});return Number.isFinite(resolved)&&resolved>=0?resolved:fallback}explicitTickFontSize(){const resolved=this.styleNumber("--lr-chart-tick-font-size","--lr-chart-tick-font-size",NaN);return Number.isNaN(resolved)?void 0:resolved}forcedColorPattern(index,background){if(!this.ownerWindow)return background;const surface=this.styleColor("--lr-color-surface",FALLBACK_TOOLTIP_BG),key=`${forcedColorEncoding(index).name}
|
|
8
|
+
`)}connectedCallback(){super.connectedCallback(),this.preparedDirty=!0,this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=onAnnotationPluginRegistered(()=>this.rebuildAfterAnnotationRegistration()),this.visible=!this.ownerWindow?.IntersectionObserver,this.armReducedMotionWatcher();const ownerWindow=this.ownerWindow,ResizeObserverCtor=ownerWindow?.ResizeObserver;ResizeObserverCtor&&(this.resizeObserver=new ResizeObserverCtor(entries=>{const width=entries[0]?.contentRect.width??this.getBoundingClientRect().width;if(Number.isFinite(width)&&this.lastObservedInlineSize!==void 0&&Math.abs(width-this.lastObservedInlineSize)<.5||(this.lastObservedInlineSize=width,this.resizeDrawFrame!==void 0))return;const frameOwner=this.ownerWindow;frameOwner&&(this.resizeDrawFrameOwner=frameOwner,this.resizeDrawFrame=frameOwner.requestAnimationFrame(()=>{if(this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,!this.isConnected||this.ownerWindow!==frameOwner)return;const samplingWidth=Number.isFinite(this.lastObservedInlineSize)?Math.max(0,Math.floor(this.lastObservedInlineSize)):0;if(samplingWidth!==this.samplingWidth){this.samplingWidth=samplingWidth,this.updateAutoLegendPosition();return}this.updateAutoLegendPosition()||this.drawIfVisible()}))}),this.resizeObserver.observe(this)),this.updateAutoLegendPosition();const generation=++this.loadGeneration;this.zoomable&&this.requestZoomFeature(),this.loadLibrary(this.zoomable).then(async mod=>{try{await this.updateComplete}catch{return}if(await new Promise(resolve=>this.updateBrowserDerivedState(resolve)),!(generation!==this.loadGeneration||!this.isConnected)){if(this.loading=!1,!mod){this.loadFailed=!0;return}this.loadFailed=!1,this.chartJsModule=mod,this.drawIfVisible()}}),this.needsDataLabels&&this.requestDataLabelsFeature(),this.needsAnnotations&&this.requestAnnotationFeature();const IntersectionObserverCtor=ownerWindow?.IntersectionObserver;if(IntersectionObserverCtor){const observerGeneration=++this.intersectionGeneration,observer=new IntersectionObserverCtor(entries=>{if(observerGeneration!==this.intersectionGeneration||this.intersectionObserver!==observer||!this.isConnected||this.ownerWindow!==ownerWindow)return;const wasVisible=this.visible;this.visible=entries[0]?.isIntersecting??!0,this.visible&&!wasVisible&&this.drawIfVisible()});this.intersectionObserver=observer,observer.observe(this)}}disconnectedCallback(){this.spatialRevealToken={},this.spatial.reset(),this.wakeSpatialWaiters(),this.preparedRequests.refresh(),this.preparedModel=this.preparedBaseModel=void 0,this.preparedEffective=void 0,this.preparedDirty=!0,this.chartSync.disconnect(),this.cancelDeferredTable?.(),this.cancelDeferredTable=void 0,this.deferredTableRows=void 0,super.disconnectedCallback(),this.stopAnnotationRegistrationWatch?.(),this.stopAnnotationRegistrationWatch=void 0,this.lastDataTruncationAnnouncement="",this.isMounting=!0,this.announcedFeatureWarnings.clear(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.resizeDrawFrame!==void 0&&this.resizeDrawFrameOwner?.cancelAnimationFrame(this.resizeDrawFrame),this.resizeDrawFrame=void 0,this.resizeDrawFrameOwner=void 0,this.lastObservedInlineSize=void 0,this.loadGeneration+=1,this.zoomLoadGeneration+=1,this.dataLabelsLoadGeneration+=1,this.annotationLoadGeneration+=1,this.discardChart(!1),this.builtPlugins=[],this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.intersectionGeneration+=1,this.visible=!0,this.disarmReducedMotionWatcher()}adoptedCallback(){this.spatial.authority.adopted(),this.spatialRevealToken={},this.wakeSpatialWaiters(),this.preparedRequests.adopted(),this.chartSync.disconnect(),this.canvasTokens.clear(),super.adoptedCallback(),this.announcements.adopted(),this.requestUpdate(),this.disarmReducedMotionWatcher(),this.armReducedMotionWatcher()}armReducedMotionWatcher(){this.reducedMotionWatch.arm()}disarmReducedMotionWatcher(){this.reducedMotionWatch.disarm()}get ownerWindow(){return this.ownerDocument?.defaultView??void 0}computedStyle(element=this){const view=this.ownerWindow;return view?view.getComputedStyle(element):"style"in element?element.style:this.style}applyDataLabelsPlugin(plugin){this.dataLabelsPlugin=plugin;let rebuilt=!1;plugin&&this.needsDataLabels&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],rebuilt=!0),this.drawIfVisible(),rebuilt&&this.showsLegend&&this.requestUpdate("canvasPresentation",null)}get zoomFeatureAvailable(){return this.zoomable&&this.zoomFeatureState==="available"}featureWarningMessages(){if(this.loading||this.loadFailed)return[];const messages=[];return this.zoomable&&this.zoomFeatureState==="unavailable"&&messages.push(this.localize("chartZoomUnavailable")),this.dataLabelsFeatureState==="unavailable"&&(this.dataLabels&&messages.push(this.localize("chartDataLabelsUnavailable")),this.stackTotals&&messages.push(this.localize("chartStackTotalsUnavailable"))),this.needsAnnotations&&this.annotationFeatureState==="unavailable"&&messages.push(this.localize("chartAnnotationsUnavailable")),messages}requestZoomFeature(){const generation=++this.zoomLoadGeneration;if(!this.zoomable){this.zoomFeatureState="idle";return}this.zoomFeatureState="loading",this.loadZoomFeature().then(result=>{generation!==this.zoomLoadGeneration||!this.isConnected||!this.zoomable||(this.zoomFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.drawIfVisible(),this.requestUpdate("canvasPresentation",null))})}requestAnnotationFeature(){const generation=++this.annotationLoadGeneration;if(!this.needsAnnotations){this.annotationFeatureState="idle";return}this.annotationFeatureState="loading",this.loadAnnotationFeature().then(result=>{generation!==this.annotationLoadGeneration||!this.isConnected||!this.needsAnnotations||(result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.annotationFeatureState=result.kind==="available"?"available":"unavailable",this.applyAnnotationPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate("canvasPresentation",null))})}applyAnnotationPlugin(plugin){this.annotationPlugin=plugin,plugin&&this.needsAnnotations&&this.chart&&(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[]),this.drawIfVisible()}rebuildAfterAnnotationRegistration(){!this.chart||this.needsAnnotations||(this.discardChart(!0),this.builtType=void 0,this.builtPlugins=[],this.drawIfVisible())}requestDataLabelsFeature(){const generation=++this.dataLabelsLoadGeneration;if(!this.needsDataLabels){this.dataLabelsFeatureState="idle";return}this.dataLabelsFeatureState="loading",this.loadDataLabelsFeature().then(result=>{generation!==this.dataLabelsLoadGeneration||!this.isConnected||!this.needsDataLabels||(this.dataLabelsFeatureState=result.kind==="available"?"available":"unavailable",result.kind!=="core-unavailable"&&!this.loading&&!this.chartJsModule&&(this.chartJsModule=result.mod),this.applyDataLabelsPlugin(result.kind==="available"?result.plugin:void 0),this.requestUpdate("canvasPresentation",null))})}willUpdate(changed){if(super.willUpdate(changed),this.refreshPreparedModel(),this.spatialActive){this.zoomed=this.viewport!==null;return}this.zoomed&&this.effectiveType()!==this.builtType&&(this.zoomed=!1,this.emit("lr-zoom",{zoomed:!1}))}firstUpdated(changed){super.firstUpdated(changed),queueMicrotask(()=>{collectInitialSlotAssignment(this.configSlotEl,s=>this.collectConfigFromSlot(s))})}updated(changed){super.updated(changed);const appliedVisibility=this.appliedLegendVisibility;if(this.appliedLegendVisibility=void 0,!this.isConnected)return;let canvasChanges=changed;changed.has("hiddenDatasets")&&appliedVisibility!==void 0&&appliedVisibility.chart===this.chart&&appliedVisibility.hidden===this.canonicalHiddenDatasets()&&(canvasChanges=new Map(changed),canvasChanges.delete("hiddenDatasets"));const contentChanged=this.preparedChanged||this.chartContentChanged(canvasChanges);this.preparedChanged=!1;const syncDataChanged=contentChanged||changed.has("hiddenDatasets")||changed.has("hiddenDatums");this.chartSync.update(this.syncGroup,typeof this.syncGroup=="string"&&this.syncGroup.trim()!==""&&this.syncCompatible(),syncDataChanged);const wasMounting=this.isMounting;this.isMounting=!1,!wasMounting&&this.preparedInvalid&&!this.announcedPreparedInvalid&&this.announcements.announceAssertive(this.localize("chartPreparedUnavailable")),this.announcedPreparedInvalid=this.preparedInvalid,changed.has("keyboardDatumAnnouncement")&&changed.get("keyboardDatumAnnouncement")!==void 0&&this.keyboardDatumAnnouncement!==""&&this.announcements.announcePolite(this.keyboardDatumAnnouncement),changed.has("loadFailed")&&changed.get("loadFailed")!==void 0&&this.loadFailed&&this.announcements.announceAssertive(this.localize("chartMissingLibrary"));const dataTruncation=[this.inputLimitMessage(),this.dataTruncationMessage()].filter(Boolean).join(this.localize("chartSummarySeparator"));if(wasMounting&&(this.lastDataTruncationAnnouncement=dataTruncation),!this.loading&&!this.loadFailed){const featureWarnings=this.featureWarningMessages();for(const warning of featureWarnings)this.announcedFeatureWarnings.has(warning)||this.announcements.announceAssertive(warning);this.announcedFeatureWarnings=new Set(featureWarnings),!wasMounting&&dataTruncation!==this.lastDataTruncationAnnouncement&&(this.lastDataTruncationAnnouncement=dataTruncation,dataTruncation&&this.announcements.announcePolite(dataTruncation))}if(this.setAttribute("aria-busy",String(this.loading||this.preparedPending)),changed.has("height")){const height=sanitizeCssLength(this.height,"height");height?this.style.setProperty("--_lr-chart-height",height):this.style.removeProperty("--_lr-chart-height")}if(this.loading)return;changed.has("zoomable")&&this.requestZoomFeature(),(changed.has("dataLabels")||changed.has("stackTotals"))&&this.requestDataLabelsFeature(),changed.has("annotations")&&this.requestAnnotationFeature();const effectiveDirection=this.effectiveDirection,effectiveLocale=this.effectiveLocale,contextChanged=this.lastDrawnDirection!==void 0&&this.lastDrawnDirection!==effectiveDirection||this.lastDrawnLocale!==void 0&&this.lastDrawnLocale!==effectiveLocale;if(this.lastDrawnDirection=effectiveDirection,this.lastDrawnLocale=effectiveLocale,!contentChanged&&!contextChanged){changed.has("hiddenDatums")&&this.visible&&this.applyDatumVisibility()&&this.chart?.update("none");return}this.drawIfVisible()}chartContentChanged(changed){return["preparedData","preparedView","spatialView","viewport","selectedPointId","type","maxRecords","samplingWidth","labels","datasets","hiddenDatasets","grid","axes","size","indexAxis","legendPosition","min","max","scaleType","annotations","plugins","autoLegendPosition","valueFormatter","formatter","tooltipTitleFormatter","tooltipFooterFormatter","area","height","xLabel","yLabel","y2Label","withoutZeroBaseline","stacked","stackedAxes","withoutAnimation","withoutLegend","withoutTooltip","syncGroup","dataLabels","stackTotals","config","slottedConfig","zoomable","locale","strings","loading"].some(name=>changed.has(name))}seriesToDataset(s,index,palette,effectiveType,chartStyle=this.chartStyleOptions(palette),rowIndexes){const series=canonicalChartSeries(s);if(!series)return{label:"",data:[]};const points=canonicalSeriesPoints(series),values=points??canonicalSeriesData(series),normalize=points?normalizedChartPoint:value=>typeof value=="number"&&Number.isFinite(value)?value:null,normalizedData=rowIndexes?rowIndexes.map(rowIndex=>normalize(values[rowIndex])):values.map(normalize),borderFallback=chartStyle.borderColors[index%chartStyle.borderColors.length]??palette[index%palette.length],fillFallback=chartStyle.fillColors[index%chartStyle.fillColors.length]??palette[index%palette.length],sourceColors=projectChartStrings(series.color),authoredColors=sourceColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>sourceColors[rowIndex%sourceColors.length]??""):typeof series.color=="string"?series.color:sourceColors,colors=typeof authoredColors=="string"?[this.canvasTokens.resolve(authoredColors,borderFallback??"transparent")]:authoredColors?this.canvasTokens.resolveMany(authoredColors,borderFallback??"transparent"):void 0,sliceChart=effectiveType==="pie"||effectiveType==="doughnut"||effectiveType==="polarArea",sliceFillColors=sliceChart&&chartStyle.fillColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.fillColors[sourceIndex%chartStyle.fillColors.length]}):void 0,sliceBorderColors=sliceChart&&chartStyle.borderColors.length?normalizedData.map((_,itemIndex)=>{const sourceIndex=rowIndexes?.[itemIndex]??itemIndex;return chartStyle.borderColors[sourceIndex%chartStyle.borderColors.length]}):void 0,fill=series.fill??this.area,backgroundColor=colors??sliceFillColors??fillFallback,datasetType=series.type??effectiveType,connectedStroke=datasetType==="line"||datasetType==="radar",authoredSegmentColors=series.segmentColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>series.segmentColors[rowIndex%series.segmentColors.length]):series.segmentColors,segmentColors=authoredSegmentColors?this.canvasTokens.resolveMany(authoredSegmentColors,colors?.[0]??borderFallback??"transparent"):void 0,authoredPointColors=series.pointColors?.length&&rowIndexes?rowIndexes.map(rowIndex=>series.pointColors[rowIndex%series.pointColors.length]??""):series.pointColors,backgroundColors=projectChartStrings(backgroundColor),backgroundColorValue=typeof backgroundColor=="string"?backgroundColor:void 0,resolvedBackgroundColor=datasetType==="line"&&fill&&(colors||!chartStyle.authoredFillColors[index%chartStyle.authoredFillColors.length])?backgroundColors?backgroundColors.map(color=>this.canvasTokens.translucent(color)):backgroundColorValue&&this.canvasTokens.translucent(backgroundColorValue):backgroundColor,encoding=forcedColorEncoding(index),resolvedBackgroundColors=projectChartStrings(resolvedBackgroundColor),resolvedBackgroundColorValue=typeof resolvedBackgroundColor=="string"?resolvedBackgroundColor:void 0,encodedBackgroundColor=chartStyle.forcedColors?resolvedBackgroundColors?resolvedBackgroundColors.map((color,itemIndex)=>this.forcedColorPattern(sliceChart?itemIndex:index,color)):resolvedBackgroundColorValue&&this.forcedColorPattern(index,resolvedBackgroundColorValue):resolvedBackgroundColor,pointRadii=projectChartPointRadii(series.pointRadius);return{label:series.label,data:normalizedData,type:series.type,fill,...datasetType==="bar"&&this.hasConfiguredBarOption("borderRadius")?{}:{borderRadius:chartStyle.borderRadius},...datasetType==="bar"&&!Number.isFinite(series.width)&&this.hasConfiguredBarOption("borderWidth")||isArcDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"arc","borderWidth")?{}:{borderWidth:nonNegativeFinite(series.width,connectedStroke?chartStyle.lineBorderWidth:chartStyle.borderWidth)},borderDash:series.dash?[4,4]:chartStyle.forcedColors?[...encoding.dash]:void 0,pointStyle:chartStyle.forcedColors?encoding.pointStyle:void 0,backgroundColor:encodedBackgroundColor,borderColor:(sourceColors?.length&&!connectedStroke?colors:colors?.[0])??sliceBorderColors??borderFallback,...connectedStroke&&sourceColors?.length?{pointBorderColor:colors}:{},pointBackgroundColor:authoredPointColors?this.canvasTokens.resolveMany(authoredPointColors,colors?.[0]??borderFallback??"transparent"):void 0,...isPointDatasetType(datasetType)&&this.hasConfiguredElementOption(datasetType,"point","radius")?{}:{pointRadius:pointRadii?(rowIndexes?rowIndexes.map(rowIndex=>pointRadii[rowIndex]):pointRadii).map(radius=>nonNegativeFinite(radius,chartStyle.pointRadius)):nonNegativeFinite(series.pointRadius,chartStyle.pointRadius)},...segmentColors?.length?{segment:{borderColor:ctx=>segmentColors[ctx.p0DataIndex%segmentColors.length]}}:{},yAxisID:series.axis==="y2"?"y2":"y",...series.stack!==void 0?{stack:series.stack}:{}}}hasConfiguredElementOption(datasetTypeKey,elementKey,option){const read=(value,key)=>{if(!isChartRecord(value))return;const descriptor=chartRecordValue(value,key);return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value},options=this.effectiveConfig()?.options,dataset=read(read(options,"datasets"),datasetTypeKey),scopes=[dataset,read(read(dataset,"elements"),elementKey),read(read(options,"elements"),elementKey),options],prefixed=`${elementKey}${option[0].toUpperCase()}${option.slice(1)}`;return scopes.some(scope=>read(scope,prefixed)!==void 0||read(scope,option)!==void 0)}hasConfiguredBarOption(option){return this.hasConfiguredElementOption("bar","bar",option)}themeColors(){const cs=this.canvasTokens.sync()??this.computedStyle(),grid=cs.getPropertyValue("--grid-color").trim()||cs.getPropertyValue("--lr-chart-grid-color").trim()||cs.getPropertyValue("--_lr-chart-grid-color").trim(),tick=cs.getPropertyValue("--lr-chart-tick-color").trim()||cs.getPropertyValue("--_lr-chart-tick-color").trim(),legend=cs.getPropertyValue("--lr-chart-legend-color").trim()||cs.getPropertyValue("--_lr-chart-legend-color").trim(),tooltipBg=cs.getPropertyValue("--lr-chart-tooltip-bg").trim()||cs.getPropertyValue("--_lr-chart-tooltip-bg").trim(),tooltipText=cs.getPropertyValue("--lr-chart-tooltip-color").trim()||cs.getPropertyValue("--_lr-chart-tooltip-color").trim();return{grid:this.canvasTokens.resolve(grid,FALLBACK_GRID_COLOR),tick:this.canvasTokens.resolve(tick,FALLBACK_TICK_COLOR),tickFontSize:this.styleNumber("--lr-chart-tick-font-size","--_lr-chart-tick-font-size",FALLBACK_TICK_FONT_SIZE),legend:this.canvasTokens.resolve(legend,FALLBACK_LEGEND_COLOR),tooltipBg:this.canvasTokens.resolve(tooltipBg,FALLBACK_TOOLTIP_BG),tooltipText:this.canvasTokens.resolve(tooltipText,FALLBACK_TOOLTIP_TEXT)}}styleColor(name,fallback){const value=this.computedStyle().getPropertyValue(name).trim();return value?this.canvasTokens.resolve(value,fallback):fallback}styleNumber(name,fallbackToken,fallback){const computed=this.computedStyle(),value=computed.getPropertyValue(name).trim()||computed.getPropertyValue(fallbackToken).trim(),direct=DIRECT_PIXEL_NUMBER.exec(value);if(direct){const resolved2=Number.parseFloat(direct[1]);if(Number.isFinite(resolved2)&&resolved2>=0)return resolved2}if(!value||!this.ownerWindow)return fallback;const resolved=this.canvasTokens.length(value,()=>{const probe=this.ownerDocument.createElement("span");probe.hidden=!0,probe.setAttribute("aria-hidden","true"),probe.style.inlineSize=value,(this.shadowRoot??this).append(probe);try{return Number.parseFloat(this.computedStyle(probe).inlineSize)}finally{probe.remove()}});return Number.isFinite(resolved)&&resolved>=0?resolved:fallback}explicitTickFontSize(){const resolved=this.styleNumber("--lr-chart-tick-font-size","--lr-chart-tick-font-size",NaN);return Number.isNaN(resolved)?void 0:resolved}forcedColorPattern(index,background){if(!this.ownerWindow)return background;const surface=this.styleColor("--lr-color-surface",FALLBACK_TOOLTIP_BG),key=`${forcedColorEncoding(index).name}
|
|
9
9
|
${background}
|
|
10
10
|
${surface}`;let pattern=this.forcedColorPatterns.get(key);return pattern||(pattern=createForcedColorPattern(this.ownerDocument,index,background,surface),this.forcedColorPatterns.set(key,pattern)),pattern}chartStyleOptions(palette){const computed=this.computedStyle(),authoredFillColors=palette.map((_,index)=>index<6&&!!computed.getPropertyValue(`--fill-color-${index+1}`).trim()),borderColors=palette.map((fallback,index)=>index<6?this.styleColor(`--border-color-${index+1}`,fallback):fallback),fillColors=palette.map((fallback,index)=>index<6?this.styleColor(`--fill-color-${index+1}`,fallback):fallback);return{borderColors,fillColors,authoredFillColors,borderRadius:this.styleNumber("--border-radius","--lr-radius",6),borderWidth:this.styleNumber("--border-width","--lr-border-width-thin",1),gridBorderWidth:this.styleNumber("--grid-border-width","--lr-border-width-thin",1),lineBorderWidth:this.styleNumber("--line-border-width","--lr-border-width-medium",2),pointRadius:this.styleNumber("--point-radius","--lr-space-2xs",4),forcedColors:forcedColorsActive(this.ownerWindow)}}get needsDataLabels(){return this.dataLabels||this.stackTotals}get needsAnnotations(){return this.normalizedAnnotations().length>0}normalizedAnnotations(){return this.canonicalAnnotations()}annotationColor(tone){const token=`--lr-color-${tone??"neutral"}`,raw=this.computedStyle().getPropertyValue(token).trim();return this.canvasTokens.resolve(raw,FALLBACK_TICK_COLOR)}annotationOptions(tick){const entries={},direction=this.effectiveDirection==="rtl"?"rtl":"ltr";return this.normalizedAnnotations().forEach((entry,index)=>{const axis=entry.axis==="x"?"x":"y",color=this.annotationColor(entry.tone),label=entry.label?{content:isolateCanvasText(entry.label,direction),display:!0,color:tick}:void 0;if(typeof entry.value=="number"){entries[`lr-annotation-${index}`]={type:"line",scaleID:axis,value:entry.value,borderColor:color,borderWidth:2,...label?{label}:{}};return}const bounds=axis==="y"?{yMin:entry.from,yMax:entry.to}:{xMin:entry.from,xMax:entry.to};entries[`lr-annotation-${index}`]={type:"box",...bounds,backgroundColor:this.canvasTokens.translucent(color),borderColor:color,borderWidth:0,...label?{label}:{}}}),entries}datalabelsOptions(theme,effectiveType){if(!this.needsDataLabels)return{display:!1};const effective=this.effectiveData(),datasets=effective.datasets,stackTotalsPossible=this.stackTotals&&(effectiveType==="bar"||effectiveType==="line"),sourceDatasetIndex=visualIndex=>this.visualDatasetSourceIndexes?.[visualIndex]??visualIndex,sourceRowIndex=visualIndex=>this.visualRowSourceIndexes?.[visualIndex]??visualIndex,topDatasetIndexByGroup=new Map;if(stackTotalsPossible){const visualDatasetCount=this.visualDatasetSourceIndexes?.length??datasets.length;for(let visualIndex=0;visualIndex<visualDatasetCount;visualIndex+=1){const dataset=datasets[sourceDatasetIndex(visualIndex)],axis=chartDatasetAxis(dataset);if(!this.axisStacked(axis))continue;let byGroup=topDatasetIndexByGroup.get(axis);byGroup||(byGroup=new Map,topDatasetIndexByGroup.set(axis,byGroup)),byGroup.set(chartDatasetStack(dataset),visualIndex)}}const totalsByGroup=new Map,totalsFor=(axis,stack)=>{let byGroup=totalsByGroup.get(axis);byGroup||(byGroup=new Map,totalsByGroup.set(axis,byGroup));let totals=byGroup.get(stack);return totals||(totals=this.computeStackTotals(axis,stack),byGroup.set(stack,totals)),totals},stackTotalsActive=[...topDatasetIndexByGroup.values()].some(byGroup=>byGroup.size>0),direction=this.effectiveDirection==="rtl"?"rtl":"ltr",isolate=text=>text.split(`
|
|
11
11
|
`).map(line=>isolateCanvasText(line,direction)).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="29.2.
|
|
1
|
+
const LYRA_PACKAGE_NAME="@aceshooting/lyra-ui",LYRA_PACKAGE_VERSION="29.2.2";export{LYRA_PACKAGE_NAME,LYRA_PACKAGE_VERSION};
|
package/llms/peers.md
CHANGED
|
@@ -39,7 +39,7 @@ for the page.
|
|
|
39
39
|
|---|---|---|
|
|
40
40
|
| `@aceshooting/lyra-flags` | `^2.3.0` | _(loaded by a shared internal module)_ |
|
|
41
41
|
| `@aceshooting/lyra-map` | `^1.2.0` | `lr-geojson-viewer`, `lr-map` |
|
|
42
|
-
| `@aceshooting/lyra-translations` | `^29.2.
|
|
42
|
+
| `@aceshooting/lyra-translations` | `^29.2.2` | _(not referenced by any component)_ |
|
|
43
43
|
| `@aiden0z/pptx-renderer` | `^1.4.0` | `lr-pptx-viewer` |
|
|
44
44
|
| `@sgratzl/chartjs-chart-boxplot` | `^4.0.0` | `lr-box-plot` |
|
|
45
45
|
| `chart.js` | `^4.0.1` | `lr-bar-chart`, `lr-box-plot`, `lr-bubble-chart`, `lr-chart`, `lr-doughnut-chart`, `lr-histogram`, `lr-line-chart`, `lr-pie-chart`, `lr-polar-area-chart`, `lr-radar-chart`, `lr-scatter-chart` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aceshooting/lyra-ui",
|
|
3
|
-
"version": "29.2.
|
|
3
|
+
"version": "29.2.2",
|
|
4
4
|
"description": "Free, independent Lit web components: an open-source alternative to Shoelace and Web Awesome with accessible forms, dashboards, charts, and agent UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -2605,7 +2605,7 @@
|
|
|
2605
2605
|
"peerDependencies": {
|
|
2606
2606
|
"@aceshooting/lyra-flags": "^2.3.0",
|
|
2607
2607
|
"@aceshooting/lyra-map": "^1.2.0",
|
|
2608
|
-
"@aceshooting/lyra-translations": "^29.2.
|
|
2608
|
+
"@aceshooting/lyra-translations": "^29.2.2",
|
|
2609
2609
|
"@aiden0z/pptx-renderer": "^1.4.0",
|
|
2610
2610
|
"@sgratzl/chartjs-chart-boxplot": "^4.0.0",
|
|
2611
2611
|
"chart.js": "^4.0.1",
|
|
@@ -2778,7 +2778,7 @@
|
|
|
2778
2778
|
"mammoth": "^1.13.0",
|
|
2779
2779
|
"maplibre-gl": "^6.15.0",
|
|
2780
2780
|
"marked": "^18.1.1",
|
|
2781
|
-
"oxc-parser": "^0.
|
|
2781
|
+
"oxc-parser": "^0.155.0",
|
|
2782
2782
|
"papaparse": "^5.7.0",
|
|
2783
2783
|
"pdfjs-dist": "^6.4.299",
|
|
2784
2784
|
"pixelmatch": "^8.0.0",
|