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