@bino-bi/bn-template-engine 1.0.0-next.26 → 1.0.0-next.28
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/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-5075771a.entry.js +1 -0
- package/dist/bn-template-engine/p-5d516435.entry.js +1 -0
- package/dist/bn-template-engine/p-5e90e728.entry.js +1 -0
- package/dist/bn-template-engine/p-9ef7e132.entry.js +1 -0
- package/dist/bn-template-engine/{p-f06c3703.entry.js → p-9f7a1980.entry.js} +1 -1
- package/dist/bn-template-engine/p-BeXgxHkW.js +1 -0
- package/dist/bn-template-engine/p-CH0bpt_k.js +1 -0
- package/dist/bn-template-engine/p-ClruFZD_.js +1 -0
- package/dist/bn-template-engine/{p-CTrNbSXN.js → p-DFmSrSnf.js} +1 -1
- package/dist/bn-template-engine/{p-BcLsoDrW.js → p-DI3efDSV.js} +1 -1
- package/dist/bn-template-engine/p-DXLTTILG.js +1 -0
- package/dist/bn-template-engine/p-DtP4jqG5.js +1 -0
- package/dist/bn-template-engine/p-a8281b71.entry.js +1 -0
- package/dist/bn-template-engine/p-b31277e7.entry.js +1 -0
- package/dist/bn-template-engine/p-b396ac84.entry.js +1 -0
- package/dist/cjs/{bn-asset_21.cjs.entry.js → bn-asset_28.cjs.entry.js} +21358 -6528
- package/dist/cjs/bn-grid.cjs.entry.js +4 -6
- package/dist/cjs/bn-image.cjs.entry.js +3 -5
- package/dist/cjs/bn-internationalization.cjs.entry.js +17 -6
- package/dist/cjs/bn-ruleset.cjs.entry.js +5 -5
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +115 -43
- package/dist/cjs/{context-protocol-DcTEh1rq.js → context-protocol-C0rKepqu.js} +108 -22
- package/dist/cjs/{diagnostics-CTgbq_Gc.js → diagnostics-Cq-qDtXq.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/queryError-BZjnIW_w.js +16 -0
- package/dist/cjs/{scaling-Dsb5_NXy.js → sanitizeHtml-Yx1xn6i_.js} +467 -287
- package/dist/cjs/{withBodyObserver-DJO98AJ-.js → withBodyObserver-CaPUjuC5.js} +1 -1
- package/dist/cjs/withHasError-qGW_yqIv.js +426 -0
- package/dist/cjs/{withStyled-D0jLwCib.js → withStyled-vSfogp9J.js} +543 -42
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +37 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +53 -28
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +37 -5
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +16 -7
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +67 -30
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +37 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +49 -29
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +37 -5
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +17 -7
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +34 -18
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +1 -1
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +37 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +52 -27
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +37 -5
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +16 -7
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +52 -18
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +37 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +74 -44
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +60 -19
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +218 -262
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +16 -25
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +3 -2
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +122 -52
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +60 -19
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +245 -250
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +22 -34
- package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +4 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +14 -2
- package/dist/collection/components/bn-context/bn-context.js +92 -22
- package/dist/collection/components/bn-dataset/bn-dataset.js +246 -90
- package/dist/collection/components/bn-datasource/bn-datasource.js +169 -77
- package/dist/collection/components/bn-footer/bn-footer.js +6 -6
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +14 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -74
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +59 -71
- package/dist/collection/components/bn-message/bn-message.js +2 -2
- package/dist/collection/components/bn-page/bn-page.css +0 -240
- package/dist/collection/components/bn-page/bn-page.js +14 -4
- package/dist/collection/components/bn-page/pageFormats.js +69 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +2 -2
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +7 -7
- package/dist/collection/components/bn-table/bn-table.css +38 -1
- package/dist/collection/components/bn-table/bn-table.js +96 -59
- package/dist/collection/components/bn-table/ibcs-table.css +39 -1
- package/dist/collection/components/bn-table/ibcs-table.js +89 -30
- package/dist/collection/components/bn-table/utils/Table.js +12 -13
- package/dist/collection/components/bn-table/utils/elements/Cell.js +9 -3
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +38 -34
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +2 -1
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -4
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +17 -4
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +128 -98
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +6 -20
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +9 -2
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +3 -2
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +36 -39
- package/dist/collection/components/bn-text/utils/template.js +79 -0
- package/dist/collection/components/bn-title/bn-title.js +10 -4
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +3 -1
- package/dist/collection/components/bn-tree/bn-tree.js +119 -23
- package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +59 -51
- package/dist/collection/components/bn-tree/utils/TreeLayout.js +30 -5
- package/dist/collection/components/bn-tree/utils/TreeParser.js +35 -0
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/context/context-protocol.js +1 -1
- package/dist/collection/context/scopedDb.js +47 -4
- package/dist/collection/stores/componentStyles.js +39 -0
- package/dist/collection/stores/internationalization.js +15 -13
- package/dist/collection/utils/DateStringFactory.js +17 -15
- package/dist/collection/utils/autoFit.js +2 -2
- package/dist/collection/utils/componentRegister.js +60 -16
- package/dist/collection/utils/constants.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +9 -12
- package/dist/collection/utils/emptyState.js +21 -0
- package/dist/collection/utils/formatter.js +29 -20
- package/dist/collection/utils/layoutObserver.js +1 -1
- package/dist/collection/utils/layoutState/generic.js +1 -1
- package/dist/collection/utils/layoutState/svgChartElements.js +2 -2
- package/dist/collection/utils/layoutTemplate.js +81 -0
- package/dist/collection/utils/measurementHost.js +2 -2
- package/dist/collection/utils/model/Order.js +1 -1
- package/dist/collection/utils/model/styles/SVGStyle.js +12 -4
- package/dist/collection/utils/parentDimensions.js +35 -3
- package/dist/collection/utils/queryError.js +11 -0
- package/dist/collection/utils/relativeVariance.js +14 -0
- package/dist/collection/utils/sanitizeHtml.js +30 -16
- package/dist/collection/utils/scaling.js +2 -2
- package/dist/collection/utils/stackColors.js +27 -5
- package/dist/collection/utils/stackLayout.js +71 -0
- package/dist/collection/utils/styled/attributes.js +16 -3
- package/dist/collection/utils/styled/style-sheet.js +1 -1
- package/dist/collection/utils/styled/withStyled.js +1 -1
- package/dist/collection/utils/testing/fakeGroup.js +21 -0
- package/dist/collection/utils/testing/mutationObserver.js +44 -0
- package/dist/collection/utils/testing/structureChart.js +26 -0
- package/dist/collection/utils/testing/timeChart.js +28 -0
- package/dist/collection/utils/validate.js +1 -1
- package/dist/collection/utils/withComponentStatus.js +137 -12
- package/dist/collection/utils/withInheritedProps.js +113 -64
- package/dist/collection/utils/withRuleSet.js +10 -7
- package/dist/collection/utils/withTranslation.js +3 -3
- package/dist/collection/utils/xy/FacetGrid.js +1 -1
- package/dist/collection/utils/xy/IsoCurves.js +1 -1
- package/dist/collection/utils/xy/NumericScale.js +46 -15
- package/dist/collection/utils/xy/PointLabeler.js +2 -2
- package/dist/collection/utils/xy/RadiusScale.js +2 -2
- package/dist/collection/utils/xy/SeriesPalette.js +3 -3
- package/dist/collection/utils/xy/VarianceMeasure.js +22 -4
- package/dist/collection/utils/xy/XYFrame.js +4 -4
- package/dist/collection/utils/xy/XYLegend.js +5 -7
- package/dist/collection/utils/xy/checkXYOverflow.js +32 -0
- package/dist/collection/utils/xy/formatXYValue.js +13 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +2 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -1
- package/dist/components/NumericScale.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGStyle.js +1 -0
- package/dist/components/TableAttribute.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -1
- package/dist/components/XYChartDataRow.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/checkXYOverflow.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/emptyState.js +1 -0
- package/dist/components/formatter.js +1 -1
- package/dist/components/ibcs-chart-bubble2.js +1 -1
- package/dist/components/ibcs-chart-bullet2.js +1 -1
- package/dist/components/ibcs-chart-scatter2.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutTemplate.js +1 -0
- package/dist/components/pageFormats.js +1 -0
- package/dist/components/parentDimensions.js +1 -0
- package/dist/components/queryError.js +1 -0
- package/dist/components/relativeVariance.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -1
- package/dist/components/stackColors.js +1 -1
- package/dist/components/stackLayout.js +1 -0
- package/dist/components/svg.esm.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStatus.js +1 -0
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withHasError.js +1 -1
- package/dist/components/withRuleSet.js +1 -1
- package/dist/components/withScalingGroup.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/{bn-asset_21.entry.js → bn-asset_28.entry.js} +20948 -6125
- package/dist/esm/bn-grid.entry.js +4 -6
- package/dist/esm/bn-image.entry.js +3 -5
- package/dist/esm/bn-internationalization.entry.js +17 -6
- package/dist/esm/bn-ruleset.entry.js +5 -5
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +111 -39
- package/dist/esm/{context-protocol-B-vdGKeG.js → context-protocol-CdTp19uA.js} +106 -22
- package/dist/esm/{diagnostics-CiquIw8B.js → diagnostics-vw6TKMiT.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/queryError-ClruFZD_.js +13 -0
- package/dist/esm/{scaling-Dggyeqts.js → sanitizeHtml-C5bFtARM.js} +464 -287
- package/dist/esm/{withBodyObserver-Cb9ZC5_J.js → withBodyObserver-DD_-r04o.js} +1 -1
- package/dist/esm/withHasError-73WV2SP5.js +422 -0
- package/dist/esm/{withStyled-DoNsbwS3.js → withStyled-BDEyKd_H.js} +513 -27
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +8 -4
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +2 -1
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +14 -2
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +12 -11
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +2 -1
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +8 -5
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +1 -1
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +8 -4
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +2 -1
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +13 -12
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -1
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +29 -6
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +4 -3
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +19 -15
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +63 -5
- package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +9 -8
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +15 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +41 -20
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +34 -18
- package/dist/types/components/bn-footer/bn-footer.d.ts +2 -2
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -10
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +13 -6
- package/dist/types/components/bn-message/bn-message.d.ts +2 -1
- package/dist/types/components/bn-page/bn-page.d.ts +2 -1
- package/dist/types/components/bn-page/pageFormats.d.ts +40 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +2 -2
- package/dist/types/components/bn-table/bn-table.d.ts +11 -10
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -5
- package/dist/types/components/bn-table/utils/Table.d.ts +3 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -2
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +6 -4
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +1 -1
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +14 -5
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +2 -2
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +6 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +2 -2
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-text/bn-text.d.ts +20 -13
- package/dist/types/components/bn-text/utils/template.d.ts +10 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +1 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -1
- package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +18 -5
- package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +5 -0
- package/dist/types/components.d.ts +226 -184
- package/dist/types/context/scopedDb.d.ts +20 -0
- package/dist/types/stores/componentStyles.d.ts +6 -0
- package/dist/types/utils/DateStringFactory.d.ts +3 -2
- package/dist/types/utils/autoFit.d.ts +2 -2
- package/dist/types/utils/componentRegister.d.ts +21 -5
- package/dist/types/utils/constants.d.ts +2 -2
- package/dist/types/utils/dataAnalyzer.d.ts +1 -1
- package/dist/types/utils/emptyState.d.ts +10 -0
- package/dist/types/utils/formatter.d.ts +7 -9
- package/dist/types/utils/layoutState/generic.d.ts +1 -1
- package/dist/types/utils/layoutState/svgChartElements.d.ts +2 -2
- package/dist/types/utils/layoutTemplate.d.ts +16 -0
- package/dist/types/utils/model/ChartStyles.d.ts +1 -1
- package/dist/types/utils/model/DataQueryResultRow.d.ts +2 -2
- package/dist/types/utils/model/Order.d.ts +1 -1
- package/dist/types/utils/model/styles/SVGStyle.d.ts +5 -1
- package/dist/types/utils/parentDimensions.d.ts +9 -0
- package/dist/types/utils/queryError.d.ts +5 -0
- package/dist/types/utils/relativeVariance.d.ts +9 -0
- package/dist/types/utils/sanitizeHtml.d.ts +2 -2
- package/dist/types/utils/scaling.d.ts +1 -1
- package/dist/types/utils/stackColors.d.ts +3 -2
- package/dist/types/utils/stackLayout.d.ts +49 -0
- package/dist/types/utils/testing/fakeGroup.d.ts +8 -0
- package/dist/types/utils/testing/mutationObserver.d.ts +5 -0
- package/dist/types/utils/testing/structureChart.d.ts +5 -0
- package/dist/types/utils/testing/timeChart.d.ts +5 -0
- package/dist/types/utils/validate.d.ts +1 -1
- package/dist/types/utils/withComponentStatus.d.ts +11 -3
- package/dist/types/utils/withInheritedProps.d.ts +42 -15
- package/dist/types/utils/withRuleSet.d.ts +2 -1
- package/dist/types/utils/withTranslation.d.ts +2 -2
- package/dist/types/utils/xy/FacetGrid.d.ts +1 -1
- package/dist/types/utils/xy/IsoCurves.d.ts +1 -1
- package/dist/types/utils/xy/NumericScale.d.ts +9 -4
- package/dist/types/utils/xy/PointLabeler.d.ts +2 -2
- package/dist/types/utils/xy/RadiusScale.d.ts +2 -2
- package/dist/types/utils/xy/SeriesPalette.d.ts +3 -3
- package/dist/types/utils/xy/VarianceMeasure.d.ts +10 -2
- package/dist/types/utils/xy/XYFrame.d.ts +4 -1
- package/dist/types/utils/xy/XYLegend.d.ts +3 -1
- package/dist/types/utils/xy/checkXYOverflow.d.ts +8 -0
- package/dist/types/utils/xy/formatXYValue.d.ts +7 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +1 -1
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +2 -0
- package/package.json +4 -2
- package/readme.md +11 -11
- package/dist/bn-template-engine/p-03304284.entry.js +0 -1
- package/dist/bn-template-engine/p-0fb02c57.entry.js +0 -1
- package/dist/bn-template-engine/p-4419db8f.entry.js +0 -1
- package/dist/bn-template-engine/p-45508f1b.entry.js +0 -1
- package/dist/bn-template-engine/p-461fdffa.entry.js +0 -1
- package/dist/bn-template-engine/p-5d7a3a77.entry.js +0 -1
- package/dist/bn-template-engine/p-62cc95b7.entry.js +0 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +0 -1
- package/dist/bn-template-engine/p-829212c3.entry.js +0 -1
- package/dist/bn-template-engine/p-B5Jd_eCX.js +0 -1
- package/dist/bn-template-engine/p-BA48JiHe.js +0 -1
- package/dist/bn-template-engine/p-BbmobTg0.js +0 -1
- package/dist/bn-template-engine/p-BcaI745G.js +0 -1
- package/dist/bn-template-engine/p-CG_Bcm6V.js +0 -1
- package/dist/bn-template-engine/p-CWWWM-XC.js +0 -1
- package/dist/bn-template-engine/p-CsJ84YRk.js +0 -1
- package/dist/bn-template-engine/p-D5e8I9Qe.js +0 -1
- package/dist/bn-template-engine/p-DVrDYxlh.js +0 -1
- package/dist/bn-template-engine/p-DjPXefnq.js +0 -1
- package/dist/bn-template-engine/p-DsTzlzxQ.js +0 -1
- package/dist/bn-template-engine/p-DtLI_CzV.js +0 -1
- package/dist/bn-template-engine/p-EtT29btN.js +0 -1
- package/dist/bn-template-engine/p-TuLpbB5O.js +0 -1
- package/dist/bn-template-engine/p-a5867a4c.entry.js +0 -1
- package/dist/bn-template-engine/p-b27009eb.entry.js +0 -1
- package/dist/bn-template-engine/p-bfa87b07.entry.js +0 -1
- package/dist/bn-template-engine/p-ceb80db3.entry.js +0 -1
- package/dist/bn-template-engine/p-fcfbb329.entry.js +0 -1
- package/dist/bn-template-engine/p-qRZrT-U3.js +0 -1
- package/dist/cjs/AxisConfig-DwiNUyYG.js +0 -233
- package/dist/cjs/LabelCollisionManager-Bv-xkeXw.js +0 -415
- package/dist/cjs/NumericScale-BAyYXpKL.js +0 -107
- package/dist/cjs/Order-2wRydarc.js +0 -87
- package/dist/cjs/SVGStyle-DoxylrEQ.js +0 -8219
- package/dist/cjs/SVGVariancesStyleGroup-CiI4GeWe.js +0 -50
- package/dist/cjs/VarianceMeasure-CQlSRzlp.js +0 -372
- package/dist/cjs/XYChartDataRow-C2FdL58s.js +0 -829
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +0 -792
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +0 -805
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +0 -678
- package/dist/cjs/bn-tree.cjs.entry.js +0 -1042
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +0 -624
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +0 -673
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +0 -667
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +0 -85
- package/dist/cjs/svgChartElements-tDA43aYj.js +0 -400
- package/dist/cjs/withHasError-BdDmiOXM.js +0 -258
- package/dist/cjs/withScalingGroup-CFIc5-6s.js +0 -73
- package/dist/components/autoFit.js +0 -1
- package/dist/components/main.js +0 -1
- package/dist/components/utils.js +0 -1
- package/dist/esm/AxisConfig-KqzWQbML.js +0 -224
- package/dist/esm/LabelCollisionManager-585bQMtP.js +0 -407
- package/dist/esm/NumericScale-DsTzlzxQ.js +0 -105
- package/dist/esm/Order-DZVWjEL_.js +0 -83
- package/dist/esm/SVGStyle-OrPkzjcb.js +0 -8209
- package/dist/esm/SVGVariancesStyleGroup-DO5QJfRQ.js +0 -48
- package/dist/esm/VarianceMeasure-DDjChp8C.js +0 -364
- package/dist/esm/XYChartDataRow-Dn83Tqh9.js +0 -820
- package/dist/esm/bn-chart-bubble.entry.js +0 -790
- package/dist/esm/bn-chart-bullet.entry.js +0 -803
- package/dist/esm/bn-chart-scatter.entry.js +0 -676
- package/dist/esm/bn-tree.entry.js +0 -1040
- package/dist/esm/ibcs-chart-bubble.entry.js +0 -622
- package/dist/esm/ibcs-chart-bullet.entry.js +0 -671
- package/dist/esm/ibcs-chart-scatter.entry.js +0 -665
- package/dist/esm/sanitizeHtml-BA48JiHe.js +0 -83
- package/dist/esm/svgChartElements-B3YClivG.js +0 -395
- package/dist/esm/withHasError-Bh1Viz52.js +0 -254
- package/dist/esm/withScalingGroup-DNBSqRC0.js +0 -71
|
@@ -1,6 +1,269 @@
|
|
|
1
|
-
import { g as getStores, c as clearStoresCache } from './context-protocol-
|
|
2
|
-
import { r as runIfExisits } from './withHasError-
|
|
1
|
+
import { g as getStores, c as clearStoresCache } from './context-protocol-CdTp19uA.js';
|
|
2
|
+
import { r as runIfExisits } from './withHasError-73WV2SP5.js';
|
|
3
3
|
import { g as getElement, f as forceUpdate } from './index-C5UYpZUU.js';
|
|
4
|
+
import { b as isBlankInput } from './withStyled-BDEyKd_H.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the available dimensions for a component.
|
|
8
|
+
*
|
|
9
|
+
* Width: visual parent's content-box width (excluding padding).
|
|
10
|
+
* Height: walks up the DOM to find the nearest ancestor with a constrained
|
|
11
|
+
* height (overflow !== 'visible' or explicit max-height). Falls back to
|
|
12
|
+
* the viewport height when every ancestor auto-grows with its content.
|
|
13
|
+
*
|
|
14
|
+
* When the component is slotted into a shadow DOM (e.g. inside
|
|
15
|
+
* bn-layout-page or bn-layout-card), the light DOM parentElement is NOT the
|
|
16
|
+
* visual container. We cross the light→shadow boundary via assignedSlot to
|
|
17
|
+
* find the actual slot wrapper that determines layout.
|
|
18
|
+
*/
|
|
19
|
+
function getParentDimensions(element, debug = false) {
|
|
20
|
+
const parent = findLayoutParent(element);
|
|
21
|
+
if (!parent) {
|
|
22
|
+
if (debug)
|
|
23
|
+
console.log("[parentDims] no layout parent found for", element.tagName);
|
|
24
|
+
return { width: 0, height: 0 };
|
|
25
|
+
}
|
|
26
|
+
const parentStyle = getComputedStyle(parent);
|
|
27
|
+
const width = parent.clientWidth - parseFloat(parentStyle.paddingLeft) - parseFloat(parentStyle.paddingRight);
|
|
28
|
+
const height = findConstrainedHeight(element, debug);
|
|
29
|
+
if (debug) {
|
|
30
|
+
console.log("[parentDims]", element.tagName, "→ layoutParent:", parent.tagName, parent.className || "(no class)", `clientW=${parent.clientWidth} → w=${Math.round(width)}, h=${Math.round(height)}`, "overflow:", parentStyle.overflow);
|
|
31
|
+
}
|
|
32
|
+
return { width: Math.max(0, width), height: Math.max(0, height) };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns the visual layout parent of an element, crossing the
|
|
36
|
+
* light→shadow DOM boundary when the element's parent is slotted.
|
|
37
|
+
*
|
|
38
|
+
* For a slotted element, the light DOM parentElement is NOT where
|
|
39
|
+
* the element renders visually. The actual container is the shadow
|
|
40
|
+
* DOM element that wraps the <slot>. We reach it via assignedSlot.
|
|
41
|
+
*/
|
|
42
|
+
function findLayoutParent(element) {
|
|
43
|
+
var _a;
|
|
44
|
+
const lightParent = element.parentElement;
|
|
45
|
+
if ((_a = lightParent === null || lightParent === void 0 ? void 0 : lightParent.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
46
|
+
return lightParent.assignedSlot.parentElement;
|
|
47
|
+
}
|
|
48
|
+
return lightParent;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Returns the visual parent, crossing shadow DOM boundaries in both
|
|
52
|
+
* directions: via assignedSlot for slotted elements (light → shadow) and
|
|
53
|
+
* via the shadow host when the element is a top-level child of a shadow
|
|
54
|
+
* root (shadow → host). Without the host crossing, the ancestor walk dies
|
|
55
|
+
* at the top of a component's shadow tree (e.g. inside bn-layout-card)
|
|
56
|
+
* and never sees outer constraints.
|
|
57
|
+
*/
|
|
58
|
+
function getVisualParent(element) {
|
|
59
|
+
var _a;
|
|
60
|
+
if ((_a = element.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
61
|
+
return element.assignedSlot.parentElement;
|
|
62
|
+
}
|
|
63
|
+
if (element.parentElement) {
|
|
64
|
+
return element.parentElement;
|
|
65
|
+
}
|
|
66
|
+
const root = element.getRootNode();
|
|
67
|
+
return root instanceof ShadowRoot ? root.host : null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Walks up the ancestor chain to find a height that is actually constrained
|
|
71
|
+
* (not just "whatever my content needs"). Crosses shadow DOM boundaries
|
|
72
|
+
* via assignedSlot when encountering slotted elements. Returns viewport
|
|
73
|
+
* height as a last resort.
|
|
74
|
+
*
|
|
75
|
+
* Ancestors inside a fit-content layout region (marked with
|
|
76
|
+
* `data-bn-fit-content` by bn-layout-page / bn-layout-card) are skipped
|
|
77
|
+
* even when they clip overflow: their height is derived from their own
|
|
78
|
+
* content - including the measuring component itself - so using it for
|
|
79
|
+
* auto-scaling creates a feedback loop where the chart inflates the cell
|
|
80
|
+
* and then reads the inflated cell back as "available height". The marker
|
|
81
|
+
* value carries the grid's row count; the constraint found above the
|
|
82
|
+
* fit-content region is divided by it, approximating the equal-share cell
|
|
83
|
+
* height the same layout would produce with fit-to-content disabled.
|
|
84
|
+
*/
|
|
85
|
+
function findConstrainedHeight(element, debug = false) {
|
|
86
|
+
let current = findLayoutParent(element);
|
|
87
|
+
let depth = 0;
|
|
88
|
+
let candidate = null;
|
|
89
|
+
let rowShareDivisor = 1;
|
|
90
|
+
while (current) {
|
|
91
|
+
// A fit-content region sizes itself from its content - every height
|
|
92
|
+
// measured below this point is circular. Discard inner candidates and
|
|
93
|
+
// keep walking for a content-independent constraint further up.
|
|
94
|
+
if (current.hasAttribute("data-bn-fit-content")) {
|
|
95
|
+
if (debug)
|
|
96
|
+
console.log(`[height:${depth}]`, current.tagName, "fit-content region → discarding inner candidate");
|
|
97
|
+
candidate = null;
|
|
98
|
+
const rows = parseInt(current.getAttribute("data-bn-fit-content"), 10);
|
|
99
|
+
if (!isNaN(rows) && rows > 1) {
|
|
100
|
+
rowShareDivisor *= rows;
|
|
101
|
+
}
|
|
102
|
+
current = getVisualParent(current);
|
|
103
|
+
depth++;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const style = getComputedStyle(current);
|
|
107
|
+
const overflow = style.overflowY;
|
|
108
|
+
if (debug) {
|
|
109
|
+
console.log(`[height:${depth}]`, current.tagName, current.className || "(no class)", `overflow=${overflow} clientH=${current.clientHeight} h=${style.height}`);
|
|
110
|
+
}
|
|
111
|
+
if (candidate === null) {
|
|
112
|
+
// An ancestor that clips / scrolls its content has a meaningful height
|
|
113
|
+
if (overflow === "hidden" || overflow === "scroll" || overflow === "auto") {
|
|
114
|
+
candidate = current.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);
|
|
115
|
+
if (debug)
|
|
116
|
+
console.log(`[height] candidate at depth ${depth}: ${Math.round(candidate)}px`);
|
|
117
|
+
}
|
|
118
|
+
else if (style.maxHeight !== "none") {
|
|
119
|
+
// An explicit max-height constrains the available space
|
|
120
|
+
const mh = parseFloat(style.maxHeight);
|
|
121
|
+
if (!isNaN(mh) && mh > 0) {
|
|
122
|
+
candidate = Math.min(mh, current.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
current = getVisualParent(current);
|
|
127
|
+
depth++;
|
|
128
|
+
}
|
|
129
|
+
if (candidate !== null) {
|
|
130
|
+
return candidate / rowShareDivisor;
|
|
131
|
+
}
|
|
132
|
+
if (debug)
|
|
133
|
+
console.log("[height] NO constrained ancestor → viewport fallback");
|
|
134
|
+
// No constrained ancestor found - use viewport, applying the same
|
|
135
|
+
// equal-share division a marked fit-content region demands
|
|
136
|
+
return typeof window !== "undefined" ? window.innerHeight / rowShareDivisor : 0;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* How many px of an element are cut off at the bottom, given the height of its content
|
|
140
|
+
* (both in layout px). Only an element that hides its overflow cuts something off: the
|
|
141
|
+
* element itself or one of its visual ancestors. 0 when there is none, the page then
|
|
142
|
+
* grows or scrolls and nothing is lost. Unlike the height of getParentDimensions this is
|
|
143
|
+
* no estimate, so it suits a warning for content that does not adapt its height to the
|
|
144
|
+
* space it has.
|
|
145
|
+
*/
|
|
146
|
+
function getClippedHeight(element, contentHeight) {
|
|
147
|
+
const rect = element.getBoundingClientRect();
|
|
148
|
+
// Rects are in screen px, after transforms (a page that is scaled to fit its window).
|
|
149
|
+
// `scale` converts the content height to them. Without a box (display: none) or under a
|
|
150
|
+
// rotation, where width and height swap, there is nothing to compare: no cut is reported.
|
|
151
|
+
const scale = element.offsetHeight > 0 ? rect.height / element.offsetHeight : 0;
|
|
152
|
+
const scaleX = element.offsetWidth > 0 ? rect.width / element.offsetWidth : 0;
|
|
153
|
+
if (!(scale > 0) || Math.abs(scale - scaleX) > scale * 0.01) {
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
const bottom = rect.top + contentHeight * scale;
|
|
157
|
+
let clipped = 0;
|
|
158
|
+
for (let current = element; current; current = getVisualParent(current)) {
|
|
159
|
+
const overflow = getComputedStyle(current).overflowY;
|
|
160
|
+
if (overflow === "hidden" || overflow === "clip") {
|
|
161
|
+
clipped = Math.max(clipped, bottom - current.getBoundingClientRect().bottom);
|
|
162
|
+
}
|
|
163
|
+
else if ((overflow === "auto" || overflow === "scroll") && current.scrollHeight > current.clientHeight + 1) {
|
|
164
|
+
// what lies below the fold of a container that scrolls can be scrolled into view
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return clipped / scale;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Parses the raw `scale` attribute string into a typed {@link ScalingConfig}.
|
|
173
|
+
* Handles null/empty (-> empty), literal `"none"` / `"auto"`, or a positive
|
|
174
|
+
* numeric string (-> factor mode). Invalid non-numeric strings fall back to empty.
|
|
175
|
+
*/
|
|
176
|
+
function parseScaling(scale) {
|
|
177
|
+
if (scale == null || scale === "")
|
|
178
|
+
return { mode: "empty" };
|
|
179
|
+
if (scale === "none")
|
|
180
|
+
return { mode: "none" };
|
|
181
|
+
if (scale === "auto")
|
|
182
|
+
return { mode: "auto" };
|
|
183
|
+
const num = Number(scale);
|
|
184
|
+
if (!isNaN(num) && num > 0)
|
|
185
|
+
return { mode: "factor", factor: num };
|
|
186
|
+
return { mode: "empty" };
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* SI suffixes accepted by the shared scaling-value grammar.
|
|
190
|
+
* Case-sensitive except `k`/`K`; lowercase `m` (SI milli) is deliberately
|
|
191
|
+
* rejected to avoid ambiguity with `M` (mega).
|
|
192
|
+
*/
|
|
193
|
+
const SCALING_SI_SUFFIX = { k: 1e3, K: 1e3, M: 1e6, G: 1e9, T: 1e12 };
|
|
194
|
+
/**
|
|
195
|
+
* Positive decimal with optional whitespace and optional single SI suffix.
|
|
196
|
+
* No sign, no exponent notation - keeps the grammar unambiguous against
|
|
197
|
+
* scaling-group names.
|
|
198
|
+
*/
|
|
199
|
+
const SCALING_NUMBER_RE = /^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;
|
|
200
|
+
/**
|
|
201
|
+
* Parses a raw scaling value with the shared grammar used by
|
|
202
|
+
* `unit-scaling` / `percentage-scaling` and `<bn-scaling-group>`:
|
|
203
|
+
*
|
|
204
|
+
* - `"auto"` (trimmed, case-insensitive) -> `{ kind: "auto" }`
|
|
205
|
+
* - a positive number with optional SI suffix (`"250000"`, `"2.5M"`, `"1 k"`;
|
|
206
|
+
* suffixes `k`/`K` = 1e3, `M` = 1e6, `G` = 1e9, `T` = 1e12) -> `{ kind: "number" }`
|
|
207
|
+
* - anything else (blank, signs, exponent notation, lowercase `m`/`g`/`t`,
|
|
208
|
+
* zero, negatives, non-finite) -> `{ kind: "invalid" }`
|
|
209
|
+
*/
|
|
210
|
+
function parseScalingValue(raw) {
|
|
211
|
+
var _a;
|
|
212
|
+
if (typeof raw === "number") {
|
|
213
|
+
return Number.isFinite(raw) && raw > 0 ? { kind: "number", value: raw } : { kind: "invalid", raw: String(raw) };
|
|
214
|
+
}
|
|
215
|
+
const s = (_a = raw === null || raw === void 0 ? void 0 : raw.toString().trim()) !== null && _a !== void 0 ? _a : "";
|
|
216
|
+
if (s.toLowerCase() === "auto")
|
|
217
|
+
return { kind: "auto" };
|
|
218
|
+
const match = SCALING_NUMBER_RE.exec(s);
|
|
219
|
+
if (match) {
|
|
220
|
+
const value = Number(match[1]) * (match[2] ? SCALING_SI_SUFFIX[match[2]] : 1);
|
|
221
|
+
if (Number.isFinite(value) && value > 0)
|
|
222
|
+
return { kind: "number", value };
|
|
223
|
+
}
|
|
224
|
+
return { kind: "invalid", raw: s };
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Resolves a raw `unit-scaling` / `percentage-scaling` value.
|
|
228
|
+
* Resolution order: `auto` -> scaling-group lookup (trimmed name) ->
|
|
229
|
+
* number/SI parse -> invalid. `auto` wins over a group of the same name
|
|
230
|
+
* because the name is reserved.
|
|
231
|
+
*/
|
|
232
|
+
function resolveScalingValue(raw, groups) {
|
|
233
|
+
const parsed = parseScalingValue(raw);
|
|
234
|
+
if (parsed.kind === "auto")
|
|
235
|
+
return { kind: "auto" };
|
|
236
|
+
if (typeof raw === "string") {
|
|
237
|
+
const name = raw.trim();
|
|
238
|
+
if (groups.has(name))
|
|
239
|
+
return { kind: "value", value: groups.get(name) };
|
|
240
|
+
}
|
|
241
|
+
if (parsed.kind === "number")
|
|
242
|
+
return { kind: "value", value: parsed.value };
|
|
243
|
+
return { kind: "invalid", raw: parsed.raw };
|
|
244
|
+
}
|
|
245
|
+
const SCALING_FORMAT_STEPS = [
|
|
246
|
+
[1e12, "T"],
|
|
247
|
+
[1e9, "G"],
|
|
248
|
+
[1e6, "M"],
|
|
249
|
+
[1e3, "k"],
|
|
250
|
+
];
|
|
251
|
+
/**
|
|
252
|
+
* Formats a positive value with the same SI suffixes the parser accepts,
|
|
253
|
+
* rounded to 3 significant digits (`250000` -> `"250k"`). Values just below
|
|
254
|
+
* a suffix boundary may round up across it (`999999` -> `"1000k"`) - fine
|
|
255
|
+
* for warning messages, which is all this is used for.
|
|
256
|
+
*/
|
|
257
|
+
function formatScalingValue(value) {
|
|
258
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
259
|
+
return String(value);
|
|
260
|
+
const sig = (n) => String(Number(n.toPrecision(3)));
|
|
261
|
+
for (const [mult, suffix] of SCALING_FORMAT_STEPS) {
|
|
262
|
+
if (value >= mult)
|
|
263
|
+
return `${sig(value / mult)}${suffix}`;
|
|
264
|
+
}
|
|
265
|
+
return sig(value);
|
|
266
|
+
}
|
|
4
267
|
|
|
5
268
|
/**
|
|
6
269
|
* Splits an array into two groups based on a predicate.
|
|
@@ -161,28 +424,27 @@ function isInheritedValue(value) {
|
|
|
161
424
|
return value === INHERITED_CLOSEST || value === INHERITED_PAGE;
|
|
162
425
|
}
|
|
163
426
|
/**
|
|
164
|
-
* Walks up the DOM tree (crossing shadow boundaries)
|
|
165
|
-
*
|
|
427
|
+
* Walks up the DOM tree (crossing shadow boundaries) and collects the layout
|
|
428
|
+
* ancestors an inheritance keyword can take its value from, nearest first.
|
|
166
429
|
*
|
|
167
|
-
* - `"inherited-closest"
|
|
168
|
-
*
|
|
430
|
+
* - `"inherited-closest"`: every `bn-layout-card` up to and including the
|
|
431
|
+
* first `bn-layout-page`.
|
|
432
|
+
* - `"inherited-page"`: that `bn-layout-page` only.
|
|
169
433
|
*
|
|
170
434
|
* Uses the same traversal pattern as `findContextElement` in
|
|
171
435
|
* `context-protocol.ts`.
|
|
172
436
|
*/
|
|
173
|
-
function
|
|
437
|
+
function findLayoutAncestors(element, mode) {
|
|
438
|
+
const ancestors = [];
|
|
174
439
|
let current = element.parentNode;
|
|
175
440
|
while (current) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (tag === ANCESTOR_CARD || tag === ANCESTOR_PAGE)
|
|
184
|
-
return current;
|
|
185
|
-
}
|
|
441
|
+
const tag = current.nodeName.toLowerCase();
|
|
442
|
+
if (tag === ANCESTOR_PAGE) {
|
|
443
|
+
ancestors.push(current);
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
if (tag === ANCESTOR_CARD && mode !== INHERITED_PAGE) {
|
|
447
|
+
ancestors.push(current);
|
|
186
448
|
}
|
|
187
449
|
if (current.parentNode) {
|
|
188
450
|
current = current.parentNode;
|
|
@@ -194,14 +456,43 @@ function findAncestor(element, mode) {
|
|
|
194
456
|
break;
|
|
195
457
|
}
|
|
196
458
|
}
|
|
459
|
+
return ancestors;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Reads `attr` from the nearest of `ancestors` that sets it.
|
|
463
|
+
*
|
|
464
|
+
* An ancestor whose attribute is missing, blank or an inheritance keyword it
|
|
465
|
+
* cannot resolve does not set it and is skipped, so a keyword is never handed
|
|
466
|
+
* down as a value. A card with `inherited-page` stands for the value of the
|
|
467
|
+
* page when the page has one: the cards between the two are not asked.
|
|
468
|
+
*/
|
|
469
|
+
function readInherited(ancestors, attr) {
|
|
470
|
+
var _a;
|
|
471
|
+
const own = (ancestor) => {
|
|
472
|
+
const value = ancestor.getAttribute(attr);
|
|
473
|
+
const trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
474
|
+
return !isBlankInput(trimmed) && !isInheritedValue(trimmed) ? value : undefined;
|
|
475
|
+
};
|
|
476
|
+
for (const ancestor of ancestors) {
|
|
477
|
+
if (((_a = ancestor.getAttribute(attr)) === null || _a === void 0 ? void 0 : _a.trim()) === INHERITED_PAGE) {
|
|
478
|
+
const page = ancestors.find((candidate) => candidate.nodeName.toLowerCase() === ANCESTOR_PAGE);
|
|
479
|
+
const pageValue = page && own(page);
|
|
480
|
+
if (pageValue !== undefined)
|
|
481
|
+
return pageValue;
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
const value = own(ancestor);
|
|
485
|
+
if (value !== undefined)
|
|
486
|
+
return value;
|
|
487
|
+
}
|
|
197
488
|
return undefined;
|
|
198
489
|
}
|
|
199
490
|
/**
|
|
200
491
|
* Walks up the DOM tree (crossing shadow boundaries) to find the nearest
|
|
201
492
|
* ancestor element that carries the given attribute, whatever its tag.
|
|
202
493
|
* Used for attributes that inherit by default (e.g. `i18n-namespace`), where
|
|
203
|
-
* any container
|
|
204
|
-
* itself
|
|
494
|
+
* any container - layout card, layout page, tree, grid, or the `bn-context`
|
|
495
|
+
* itself - can act as the provider.
|
|
205
496
|
*/
|
|
206
497
|
function findAncestorWithAttr(element, attr) {
|
|
207
498
|
let current = element.parentNode;
|
|
@@ -225,71 +516,71 @@ function findAncestorWithAttr(element, attr) {
|
|
|
225
516
|
* Mixin that enables property inheritance from ancestor layout components.
|
|
226
517
|
*
|
|
227
518
|
* When a component sets a prop to `"inherited-closest"` or `"inherited-page"`,
|
|
228
|
-
* this mixin resolves the actual value by walking up the DOM
|
|
229
|
-
* nearest `bn-layout-card` /
|
|
230
|
-
*
|
|
231
|
-
* changes, triggering a re-render when inherited
|
|
519
|
+
* this mixin resolves the actual value by walking up the DOM and reading the
|
|
520
|
+
* corresponding HTML attribute from the nearest `bn-layout-card` /
|
|
521
|
+
* `bn-layout-page` that sets it. A `MutationObserver` watches every ancestor
|
|
522
|
+
* on that path for attribute changes, triggering a re-render when inherited
|
|
523
|
+
* values update.
|
|
232
524
|
*
|
|
233
525
|
* Follows the same decorator-style pattern as `withComponentStyle`.
|
|
234
526
|
*
|
|
527
|
+
* A keyword that no ancestor satisfies is never used as a value: the resolver
|
|
528
|
+
* returns the fallback instead and, when `errors` is given, keeps a
|
|
529
|
+
* `WARN_inherited_<prop>` warning in it for as long as the keyword is
|
|
530
|
+
* unresolved.
|
|
531
|
+
*
|
|
235
532
|
* @param component The Stencil component instance
|
|
236
533
|
* @param mappings Array of prop-to-attribute mappings
|
|
534
|
+
* @param errors The component's error list, to report unresolved keywords
|
|
237
535
|
* @returns A resolver function used inside `prepare*()` methods
|
|
238
536
|
*/
|
|
537
|
+
const withInheritedProps = (
|
|
239
538
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
240
|
-
|
|
539
|
+
component, mappings, errors) => {
|
|
241
540
|
/** Resolved values keyed by propName. */
|
|
242
541
|
const resolved = new Map();
|
|
243
|
-
/**
|
|
542
|
+
/** The keyword each prop held at the last lookup, keyed by propName. */
|
|
543
|
+
const lookedUp = new Map();
|
|
544
|
+
/** Observer watching the layout ancestors' attributes. */
|
|
244
545
|
let observer = null;
|
|
245
|
-
/** The ancestor element currently being observed. */
|
|
246
|
-
let ancestorEl;
|
|
247
546
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
547
|
+
* Resolves each mapping whose prop is an inheritance keyword and watches
|
|
548
|
+
* every ancestor that can change the outcome, so a value that appears later
|
|
549
|
+
* on a card or the page is picked up.
|
|
250
550
|
*/
|
|
251
551
|
const resolveAll = () => {
|
|
552
|
+
var _a;
|
|
252
553
|
const element = getElement(component);
|
|
253
554
|
resolved.clear();
|
|
254
|
-
|
|
255
|
-
|
|
555
|
+
lookedUp.clear();
|
|
556
|
+
if (observer) {
|
|
557
|
+
observer.disconnect();
|
|
558
|
+
observer = null;
|
|
559
|
+
}
|
|
560
|
+
const attrsToWatch = new Map();
|
|
256
561
|
for (const mapping of mappings) {
|
|
257
562
|
const value = component[mapping.propName];
|
|
258
563
|
if (typeof value !== "string" || !isInheritedValue(value))
|
|
259
564
|
continue;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
565
|
+
lookedUp.set(mapping.propName, value);
|
|
566
|
+
// Looked up per prop: scenarios may come from a card and order from the page.
|
|
567
|
+
const ancestors = findLayoutAncestors(element, value);
|
|
568
|
+
const inherited = readInherited(ancestors, mapping.ancestorAttr);
|
|
569
|
+
if (inherited !== undefined) {
|
|
570
|
+
resolved.set(mapping.propName, inherited);
|
|
263
571
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
|
|
267
|
-
if (attrValue != null) {
|
|
268
|
-
resolved.set(mapping.propName, attrValue);
|
|
572
|
+
for (const ancestor of ancestors) {
|
|
573
|
+
attrsToWatch.set(ancestor, [...((_a = attrsToWatch.get(ancestor)) !== null && _a !== void 0 ? _a : []), mapping.ancestorAttr]);
|
|
269
574
|
}
|
|
270
|
-
attrsToWatch.push(mapping.ancestorAttr);
|
|
271
575
|
}
|
|
272
|
-
|
|
273
|
-
if (ancestorEl && attrsToWatch.length > 0) {
|
|
576
|
+
if (attrsToWatch.size > 0) {
|
|
274
577
|
observer = new MutationObserver(() => {
|
|
275
|
-
|
|
276
|
-
for (const mapping of mappings) {
|
|
277
|
-
if (!isInheritedValue(component[mapping.propName]))
|
|
278
|
-
continue;
|
|
279
|
-
const attrValue = ancestorEl.getAttribute(mapping.ancestorAttr);
|
|
280
|
-
if (attrValue != null) {
|
|
281
|
-
resolved.set(mapping.propName, attrValue);
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
resolved.delete(mapping.propName);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
578
|
+
resolveAll();
|
|
287
579
|
forceUpdate(component);
|
|
288
580
|
});
|
|
289
|
-
|
|
290
|
-
attributes: true,
|
|
291
|
-
|
|
292
|
-
});
|
|
581
|
+
for (const [ancestor, attributeFilter] of attrsToWatch) {
|
|
582
|
+
observer.observe(ancestor, { attributes: true, attributeFilter });
|
|
583
|
+
}
|
|
293
584
|
}
|
|
294
585
|
};
|
|
295
586
|
const connectedCallback = component["connectedCallback"];
|
|
@@ -303,19 +594,39 @@ const withInheritedProps = (component, mappings) => {
|
|
|
303
594
|
observer.disconnect();
|
|
304
595
|
observer = null;
|
|
305
596
|
}
|
|
306
|
-
ancestorEl = undefined;
|
|
307
597
|
resolved.clear();
|
|
598
|
+
lookedUp.clear();
|
|
308
599
|
runIfExisits(disconnectedCallback, component);
|
|
309
600
|
};
|
|
601
|
+
/** The layout field behind a mapped attribute, e.g. `title-scenarios` -> `titleScenarios`. */
|
|
602
|
+
const fieldName = (propName) => {
|
|
603
|
+
var _a;
|
|
604
|
+
return (_a = mappings
|
|
605
|
+
.find((mapping) => mapping.propName === propName)) === null || _a === void 0 ? void 0 : _a.ancestorAttr.replace(/-(\w)/g, (_match, char) => char.toUpperCase());
|
|
606
|
+
};
|
|
310
607
|
/**
|
|
311
|
-
* Resolver:
|
|
312
|
-
*
|
|
313
|
-
* its normal logic).
|
|
608
|
+
* Resolver: the one place that decides which value a mapped prop stands
|
|
609
|
+
* for, and that reports a keyword no ancestor satisfies.
|
|
314
610
|
*/
|
|
315
|
-
const resolve = (propName, currentValue) => {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
611
|
+
const resolve = (propName, currentValue, fallback) => {
|
|
612
|
+
const warningId = `WARN_inherited_${propName}`;
|
|
613
|
+
const isKeyword = isInheritedValue(currentValue);
|
|
614
|
+
// The prop became a keyword, or a different one, after the last lookup.
|
|
615
|
+
if (isKeyword && lookedUp.get(propName) !== currentValue) {
|
|
616
|
+
resolveAll();
|
|
617
|
+
}
|
|
618
|
+
const inherited = isKeyword ? resolved.get(propName) : undefined;
|
|
619
|
+
if (isKeyword && inherited === undefined) {
|
|
620
|
+
const scope = currentValue === INHERITED_PAGE ? "page" : "card or page";
|
|
621
|
+
errors === null || errors === void 0 ? void 0 : errors.addOrReplace({
|
|
622
|
+
id: warningId,
|
|
623
|
+
type: "warning",
|
|
624
|
+
message: `${propName}: '${currentValue}' could not be resolved, no surrounding ${scope} sets ${fieldName(propName)}`,
|
|
625
|
+
});
|
|
626
|
+
return { value: fallback, inherited: false, unresolved: true };
|
|
627
|
+
}
|
|
628
|
+
errors === null || errors === void 0 ? void 0 : errors.remove(warningId);
|
|
629
|
+
return { value: inherited !== null && inherited !== void 0 ? inherited : currentValue, inherited: inherited !== undefined, unresolved: false };
|
|
319
630
|
};
|
|
320
631
|
return resolve;
|
|
321
632
|
};
|
|
@@ -330,8 +641,8 @@ const withInheritedProps = (component, mappings) => {
|
|
|
330
641
|
* 1. The host element's own `i18n-namespace` attribute (the deprecated
|
|
331
642
|
* `namespace` attribute is honored as a fallback).
|
|
332
643
|
* 2. Otherwise the `i18n-namespace` attribute of the nearest ancestor that
|
|
333
|
-
* carries one
|
|
334
|
-
* `bn-context` itself
|
|
644
|
+
* carries one - a layout card, layout page, tree, grid, or the
|
|
645
|
+
* `bn-context` itself - crossing shadow boundaries. The resolved ancestor
|
|
335
646
|
* is observed so attribute changes re-render the component.
|
|
336
647
|
* 3. Otherwise the built-in `_system` namespace.
|
|
337
648
|
*
|
|
@@ -417,7 +728,7 @@ const withTranslation = (component) => {
|
|
|
417
728
|
const locales = stores.internationalization.state;
|
|
418
729
|
const locale = stores.context.state.locale;
|
|
419
730
|
// Per-key fallback chain: resolved namespace → _system → the key itself.
|
|
420
|
-
// Never throws
|
|
731
|
+
// Never throws - a missing key or unknown locale must not blank the component.
|
|
421
732
|
const tpl = (_c = (_b = (_a = locales[namespace]) === null || _a === void 0 ? void 0 : _a[locale]) === null || _b === void 0 ? void 0 : _b[key]) !== null && _c !== void 0 ? _c : (_e = (_d = locales["_system"]) === null || _d === void 0 ? void 0 : _d[locale]) === null || _e === void 0 ? void 0 : _e[key];
|
|
422
733
|
if (tpl == null) {
|
|
423
734
|
return key;
|
|
@@ -427,234 +738,100 @@ const withTranslation = (component) => {
|
|
|
427
738
|
return { t };
|
|
428
739
|
};
|
|
429
740
|
|
|
741
|
+
const ALLOWED_TAGS = new Set([
|
|
742
|
+
"br",
|
|
743
|
+
"b",
|
|
744
|
+
"i",
|
|
745
|
+
"strong",
|
|
746
|
+
"em",
|
|
747
|
+
"span",
|
|
748
|
+
"p",
|
|
749
|
+
"div",
|
|
750
|
+
"table",
|
|
751
|
+
"tr",
|
|
752
|
+
"td",
|
|
753
|
+
"th",
|
|
754
|
+
"thead",
|
|
755
|
+
"tbody",
|
|
756
|
+
"tfoot",
|
|
757
|
+
"ul",
|
|
758
|
+
"ol",
|
|
759
|
+
"li",
|
|
760
|
+
"h1",
|
|
761
|
+
"h2",
|
|
762
|
+
"h3",
|
|
763
|
+
"h4",
|
|
764
|
+
"h5",
|
|
765
|
+
"h6",
|
|
766
|
+
"sub",
|
|
767
|
+
"sup",
|
|
768
|
+
"small",
|
|
769
|
+
"hr",
|
|
770
|
+
"a",
|
|
771
|
+
"img",
|
|
772
|
+
"code",
|
|
773
|
+
"pre",
|
|
774
|
+
"blockquote",
|
|
775
|
+
"del",
|
|
776
|
+
]);
|
|
777
|
+
const ALLOWED_ATTRS = new Set([
|
|
778
|
+
"class",
|
|
779
|
+
"style",
|
|
780
|
+
"colspan",
|
|
781
|
+
"rowspan",
|
|
782
|
+
"href",
|
|
783
|
+
"title",
|
|
784
|
+
"src",
|
|
785
|
+
"alt",
|
|
786
|
+
"width",
|
|
787
|
+
"height",
|
|
788
|
+
]);
|
|
789
|
+
const ALLOWED_PROTOCOLS = new Set(["http:", "https:", "mailto:"]);
|
|
790
|
+
const ALLOWED_STYLE = /^\s*text-align:\s*(left|center|right)\s*;?\s*$/i;
|
|
430
791
|
/**
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
* Height: walks up the DOM to find the nearest ancestor with a constrained
|
|
435
|
-
* height (overflow !== 'visible' or explicit max-height). Falls back to
|
|
436
|
-
* the viewport height when every ancestor auto-grows with its content.
|
|
437
|
-
*
|
|
438
|
-
* When the component is slotted into a shadow DOM (e.g. inside
|
|
439
|
-
* bn-layout-page or bn-layout-card), the light DOM parentElement is NOT the
|
|
440
|
-
* visual container. We cross the light→shadow boundary via assignedSlot to
|
|
441
|
-
* find the actual slot wrapper that determines layout.
|
|
792
|
+
* Strips everything but the allowed tags and attributes from an HTML string.
|
|
793
|
+
* The string is parsed into a separate inert document, so nothing in it loads
|
|
794
|
+
* or runs. Disallowed elements are removed together with their content.
|
|
442
795
|
*/
|
|
443
|
-
function
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
const parentStyle = getComputedStyle(parent);
|
|
451
|
-
const width = parent.clientWidth - parseFloat(parentStyle.paddingLeft) - parseFloat(parentStyle.paddingRight);
|
|
452
|
-
const height = findConstrainedHeight(element, debug);
|
|
453
|
-
if (debug) {
|
|
454
|
-
console.log("[parentDims]", element.tagName, "→ layoutParent:", parent.tagName, parent.className || "(no class)", `clientW=${parent.clientWidth} → w=${Math.round(width)}, h=${Math.round(height)}`, "overflow:", parentStyle.overflow);
|
|
455
|
-
}
|
|
456
|
-
return { width: Math.max(0, width), height: Math.max(0, height) };
|
|
796
|
+
function sanitizeHtml(html) {
|
|
797
|
+
if (!html)
|
|
798
|
+
return "";
|
|
799
|
+
const body = new DOMParser().parseFromString(html, "text/html").body;
|
|
800
|
+
sanitizeNode(body);
|
|
801
|
+
return body.innerHTML;
|
|
457
802
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
function findLayoutParent(element) {
|
|
467
|
-
var _a;
|
|
468
|
-
const lightParent = element.parentElement;
|
|
469
|
-
if ((_a = lightParent === null || lightParent === void 0 ? void 0 : lightParent.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
470
|
-
return lightParent.assignedSlot.parentElement;
|
|
471
|
-
}
|
|
472
|
-
return lightParent;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Returns the visual parent, crossing shadow DOM boundaries in both
|
|
476
|
-
* directions: via assignedSlot for slotted elements (light → shadow) and
|
|
477
|
-
* via the shadow host when the element is a top-level child of a shadow
|
|
478
|
-
* root (shadow → host). Without the host crossing, the ancestor walk dies
|
|
479
|
-
* at the top of a component's shadow tree (e.g. inside bn-layout-card)
|
|
480
|
-
* and never sees outer constraints.
|
|
481
|
-
*/
|
|
482
|
-
function getVisualParent(element) {
|
|
483
|
-
var _a;
|
|
484
|
-
if ((_a = element.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentElement) {
|
|
485
|
-
return element.assignedSlot.parentElement;
|
|
486
|
-
}
|
|
487
|
-
if (element.parentElement) {
|
|
488
|
-
return element.parentElement;
|
|
489
|
-
}
|
|
490
|
-
const root = element.getRootNode();
|
|
491
|
-
return root instanceof ShadowRoot ? root.host : null;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Walks up the ancestor chain to find a height that is actually constrained
|
|
495
|
-
* (not just "whatever my content needs"). Crosses shadow DOM boundaries
|
|
496
|
-
* via assignedSlot when encountering slotted elements. Returns viewport
|
|
497
|
-
* height as a last resort.
|
|
498
|
-
*
|
|
499
|
-
* Ancestors inside a fit-content layout region (marked with
|
|
500
|
-
* `data-bn-fit-content` by bn-layout-page / bn-layout-card) are skipped
|
|
501
|
-
* even when they clip overflow: their height is derived from their own
|
|
502
|
-
* content — including the measuring component itself — so using it for
|
|
503
|
-
* auto-scaling creates a feedback loop where the chart inflates the cell
|
|
504
|
-
* and then reads the inflated cell back as "available height". The marker
|
|
505
|
-
* value carries the grid's row count; the constraint found above the
|
|
506
|
-
* fit-content region is divided by it, approximating the equal-share cell
|
|
507
|
-
* height the same layout would produce with fit-to-content disabled.
|
|
508
|
-
*/
|
|
509
|
-
function findConstrainedHeight(element, debug = false) {
|
|
510
|
-
let current = findLayoutParent(element);
|
|
511
|
-
let depth = 0;
|
|
512
|
-
let candidate = null;
|
|
513
|
-
let rowShareDivisor = 1;
|
|
514
|
-
while (current) {
|
|
515
|
-
// A fit-content region sizes itself from its content — every height
|
|
516
|
-
// measured below this point is circular. Discard inner candidates and
|
|
517
|
-
// keep walking for a content-independent constraint further up.
|
|
518
|
-
if (current.hasAttribute("data-bn-fit-content")) {
|
|
519
|
-
if (debug)
|
|
520
|
-
console.log(`[height:${depth}]`, current.tagName, "fit-content region → discarding inner candidate");
|
|
521
|
-
candidate = null;
|
|
522
|
-
const rows = parseInt(current.getAttribute("data-bn-fit-content"), 10);
|
|
523
|
-
if (!isNaN(rows) && rows > 1) {
|
|
524
|
-
rowShareDivisor *= rows;
|
|
525
|
-
}
|
|
526
|
-
current = getVisualParent(current);
|
|
527
|
-
depth++;
|
|
803
|
+
function sanitizeNode(node) {
|
|
804
|
+
for (const child of Array.from(node.childNodes)) {
|
|
805
|
+
if (child.nodeType === Node.TEXT_NODE)
|
|
806
|
+
continue;
|
|
807
|
+
const el = child;
|
|
808
|
+
// localName, not tagName: a form control named "tagName" shadows that property on its form.
|
|
809
|
+
if (child.nodeType !== Node.ELEMENT_NODE || !ALLOWED_TAGS.has(el.localName)) {
|
|
810
|
+
node.removeChild(child);
|
|
528
811
|
continue;
|
|
529
812
|
}
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
if (candidate === null) {
|
|
536
|
-
// An ancestor that clips / scrolls its content has a meaningful height
|
|
537
|
-
if (overflow === "hidden" || overflow === "scroll" || overflow === "auto") {
|
|
538
|
-
candidate = current.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);
|
|
539
|
-
if (debug)
|
|
540
|
-
console.log(`[height] candidate at depth ${depth}: ${Math.round(candidate)}px`);
|
|
541
|
-
}
|
|
542
|
-
else if (style.maxHeight !== "none") {
|
|
543
|
-
// An explicit max-height constrains the available space
|
|
544
|
-
const mh = parseFloat(style.maxHeight);
|
|
545
|
-
if (!isNaN(mh) && mh > 0) {
|
|
546
|
-
candidate = Math.min(mh, current.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom));
|
|
547
|
-
}
|
|
813
|
+
for (const attr of Array.from(el.attributes)) {
|
|
814
|
+
const name = attr.name.toLowerCase();
|
|
815
|
+
if (!ALLOWED_ATTRS.has(name) || ((name === "href" || name === "src") && !isAllowedUrl(name, attr.value))) {
|
|
816
|
+
el.removeAttribute(attr.name);
|
|
548
817
|
}
|
|
549
818
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
if (debug)
|
|
557
|
-
console.log("[height] NO constrained ancestor → viewport fallback");
|
|
558
|
-
// No constrained ancestor found — use viewport, applying the same
|
|
559
|
-
// equal-share division a marked fit-content region demands
|
|
560
|
-
return typeof window !== "undefined" ? window.innerHeight / rowShareDivisor : 0;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Parses the raw `scale` attribute string into a typed {@link ScalingConfig}.
|
|
565
|
-
* Handles null/empty (-> empty), literal `"none"` / `"auto"`, or a positive
|
|
566
|
-
* numeric string (-> factor mode). Invalid non-numeric strings fall back to empty.
|
|
567
|
-
*/
|
|
568
|
-
function parseScaling(scale) {
|
|
569
|
-
if (scale == null || scale === "")
|
|
570
|
-
return { mode: "empty" };
|
|
571
|
-
if (scale === "none")
|
|
572
|
-
return { mode: "none" };
|
|
573
|
-
if (scale === "auto")
|
|
574
|
-
return { mode: "auto" };
|
|
575
|
-
const num = Number(scale);
|
|
576
|
-
if (!isNaN(num) && num > 0)
|
|
577
|
-
return { mode: "factor", factor: num };
|
|
578
|
-
return { mode: "empty" };
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* SI suffixes accepted by the shared scaling-value grammar.
|
|
582
|
-
* Case-sensitive except `k`/`K`; lowercase `m` (SI milli) is deliberately
|
|
583
|
-
* rejected to avoid ambiguity with `M` (mega).
|
|
584
|
-
*/
|
|
585
|
-
const SCALING_SI_SUFFIX = { k: 1e3, K: 1e3, M: 1e6, G: 1e9, T: 1e12 };
|
|
586
|
-
/**
|
|
587
|
-
* Positive decimal with optional whitespace and optional single SI suffix.
|
|
588
|
-
* No sign, no exponent notation — keeps the grammar unambiguous against
|
|
589
|
-
* scaling-group names.
|
|
590
|
-
*/
|
|
591
|
-
const SCALING_NUMBER_RE = /^(\d+(?:\.\d+)?|\.\d+)\s*([kKMGT])?$/;
|
|
592
|
-
/**
|
|
593
|
-
* Parses a raw scaling value with the shared grammar used by
|
|
594
|
-
* `unit-scaling` / `percentage-scaling` and `<bn-scaling-group>`:
|
|
595
|
-
*
|
|
596
|
-
* - `"auto"` (trimmed, case-insensitive) -> `{ kind: "auto" }`
|
|
597
|
-
* - a positive number with optional SI suffix (`"250000"`, `"2.5M"`, `"1 k"`;
|
|
598
|
-
* suffixes `k`/`K` = 1e3, `M` = 1e6, `G` = 1e9, `T` = 1e12) -> `{ kind: "number" }`
|
|
599
|
-
* - anything else (blank, signs, exponent notation, lowercase `m`/`g`/`t`,
|
|
600
|
-
* zero, negatives, non-finite) -> `{ kind: "invalid" }`
|
|
601
|
-
*/
|
|
602
|
-
function parseScalingValue(raw) {
|
|
603
|
-
var _a;
|
|
604
|
-
if (typeof raw === "number") {
|
|
605
|
-
return Number.isFinite(raw) && raw > 0 ? { kind: "number", value: raw } : { kind: "invalid", raw: String(raw) };
|
|
606
|
-
}
|
|
607
|
-
const s = (_a = raw === null || raw === void 0 ? void 0 : raw.toString().trim()) !== null && _a !== void 0 ? _a : "";
|
|
608
|
-
if (s.toLowerCase() === "auto")
|
|
609
|
-
return { kind: "auto" };
|
|
610
|
-
const match = SCALING_NUMBER_RE.exec(s);
|
|
611
|
-
if (match) {
|
|
612
|
-
const value = Number(match[1]) * (match[2] ? SCALING_SI_SUFFIX[match[2]] : 1);
|
|
613
|
-
if (Number.isFinite(value) && value > 0)
|
|
614
|
-
return { kind: "number", value };
|
|
819
|
+
// Read through getAttribute: Stencil's mock-doc keeps style out of el.attributes.
|
|
820
|
+
const style = el.getAttribute("style");
|
|
821
|
+
if (style !== null && !ALLOWED_STYLE.test(style))
|
|
822
|
+
el.removeAttribute("style");
|
|
823
|
+
sanitizeNode(el);
|
|
615
824
|
}
|
|
616
|
-
return { kind: "invalid", raw: s };
|
|
617
825
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
*/
|
|
624
|
-
function resolveScalingValue(raw, groups) {
|
|
625
|
-
const parsed = parseScalingValue(raw);
|
|
626
|
-
if (parsed.kind === "auto")
|
|
627
|
-
return { kind: "auto" };
|
|
628
|
-
if (typeof raw === "string") {
|
|
629
|
-
const name = raw.trim();
|
|
630
|
-
if (groups.has(name))
|
|
631
|
-
return { kind: "value", value: groups.get(name) };
|
|
826
|
+
function isAllowedUrl(name, value) {
|
|
827
|
+
try {
|
|
828
|
+
// A fixed base lets relative URLs pass whatever the URL of the embedding page is.
|
|
829
|
+
const { protocol } = new URL(value, "http://a");
|
|
830
|
+
return ALLOWED_PROTOCOLS.has(protocol) || (name === "src" && protocol === "data:");
|
|
632
831
|
}
|
|
633
|
-
|
|
634
|
-
return
|
|
635
|
-
return { kind: "invalid", raw: parsed.raw };
|
|
636
|
-
}
|
|
637
|
-
const SCALING_FORMAT_STEPS = [
|
|
638
|
-
[1e12, "T"],
|
|
639
|
-
[1e9, "G"],
|
|
640
|
-
[1e6, "M"],
|
|
641
|
-
[1e3, "k"],
|
|
642
|
-
];
|
|
643
|
-
/**
|
|
644
|
-
* Formats a positive value with the same SI suffixes the parser accepts,
|
|
645
|
-
* rounded to 3 significant digits (`250000` -> `"250k"`). Values just below
|
|
646
|
-
* a suffix boundary may round up across it (`999999` -> `"1000k"`) — fine
|
|
647
|
-
* for warning messages, which is all this is used for.
|
|
648
|
-
*/
|
|
649
|
-
function formatScalingValue(value) {
|
|
650
|
-
if (!Number.isFinite(value) || value <= 0)
|
|
651
|
-
return String(value);
|
|
652
|
-
const sig = (n) => String(Number(n.toPrecision(3)));
|
|
653
|
-
for (const [mult, suffix] of SCALING_FORMAT_STEPS) {
|
|
654
|
-
if (value >= mult)
|
|
655
|
-
return `${sig(value / mult)}${suffix}`;
|
|
832
|
+
catch (_a) {
|
|
833
|
+
return false;
|
|
656
834
|
}
|
|
657
|
-
return sig(value);
|
|
658
835
|
}
|
|
659
836
|
|
|
660
|
-
export {
|
|
837
|
+
export { withDataset as a, getClippedHeight as b, resolveScalingValue as c, formatScalingValue as d, withInheritedProps as e, findLayoutAncestors as f, getParentDimensions as g, parseScalingValue as h, isInheritedValue as i, parseScaling as p, readInherited as r, sanitizeHtml as s, withTranslation as w };
|