@trebco/treb 37.0.0 → 37.0.1
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/build/package.json +119 -0
- package/build/treb-base-types/src/api_types.d.ts +11 -0
- package/build/treb-base-types/src/api_types.js +22 -0
- package/build/treb-base-types/src/api_types.js.map +1 -0
- package/build/treb-base-types/src/area-utils.d.ts +9 -0
- package/build/treb-base-types/src/area-utils.js +50 -0
- package/build/treb-base-types/src/area-utils.js.map +1 -0
- package/build/treb-base-types/src/area.d.ts +182 -0
- package/build/treb-base-types/src/area.js +715 -0
- package/build/treb-base-types/src/area.js.map +1 -0
- package/build/treb-base-types/src/basic_types.d.ts +20 -0
- package/build/treb-base-types/src/basic_types.js +22 -0
- package/build/treb-base-types/src/basic_types.js.map +1 -0
- package/build/treb-base-types/src/cell.d.ts +167 -0
- package/build/treb-base-types/src/cell.js +432 -0
- package/build/treb-base-types/src/cell.js.map +1 -0
- package/build/treb-base-types/src/cells.d.ts +251 -0
- package/build/treb-base-types/src/cells.js +1136 -0
- package/build/treb-base-types/src/cells.js.map +1 -0
- package/build/treb-base-types/src/color.d.ts +35 -0
- package/build/treb-base-types/src/color.js +162 -0
- package/build/treb-base-types/src/color.js.map +1 -0
- package/build/treb-base-types/src/dom-utilities.d.ts +70 -0
- package/build/treb-base-types/src/dom-utilities.js +144 -0
- package/build/treb-base-types/src/dom-utilities.js.map +1 -0
- package/build/treb-base-types/src/evaluate-options.d.ts +35 -0
- package/build/treb-base-types/src/evaluate-options.js +22 -0
- package/build/treb-base-types/src/evaluate-options.js.map +1 -0
- package/build/treb-base-types/src/font-stack.d.ts +37 -0
- package/build/treb-base-types/src/font-stack.js +93 -0
- package/build/treb-base-types/src/font-stack.js.map +1 -0
- package/build/treb-base-types/src/gradient.d.ts +18 -0
- package/build/treb-base-types/src/gradient.js +86 -0
- package/build/treb-base-types/src/gradient.js.map +1 -0
- package/build/treb-base-types/src/import.d.ts +48 -0
- package/build/treb-base-types/src/import.js +22 -0
- package/build/treb-base-types/src/import.js.map +1 -0
- package/build/treb-base-types/src/index-standalone.d.ts +6 -0
- package/build/treb-base-types/src/index-standalone.js +27 -0
- package/build/treb-base-types/src/index-standalone.js.map +1 -0
- package/build/treb-base-types/src/index.d.ts +22 -0
- package/build/treb-base-types/src/index.js +45 -0
- package/build/treb-base-types/src/index.js.map +1 -0
- package/build/treb-base-types/src/layout.d.ts +22 -0
- package/build/treb-base-types/src/layout.js +22 -0
- package/build/treb-base-types/src/layout.js.map +1 -0
- package/build/treb-base-types/src/localization.d.ts +37 -0
- package/build/treb-base-types/src/localization.js +157 -0
- package/build/treb-base-types/src/localization.js.map +1 -0
- package/build/treb-base-types/src/rectangle.d.ts +51 -0
- package/build/treb-base-types/src/rectangle.js +123 -0
- package/build/treb-base-types/src/rectangle.js.map +1 -0
- package/build/treb-base-types/src/render_text.d.ts +34 -0
- package/build/treb-base-types/src/render_text.js +22 -0
- package/build/treb-base-types/src/render_text.js.map +1 -0
- package/build/treb-base-types/src/style.d.ts +214 -0
- package/build/treb-base-types/src/style.js +373 -0
- package/build/treb-base-types/src/style.js.map +1 -0
- package/build/treb-base-types/src/table.d.ts +58 -0
- package/build/treb-base-types/src/table.js +27 -0
- package/build/treb-base-types/src/table.js.map +1 -0
- package/build/treb-base-types/src/text_part.d.ts +26 -0
- package/build/treb-base-types/src/text_part.js +47 -0
- package/build/treb-base-types/src/text_part.js.map +1 -0
- package/build/treb-base-types/src/theme.d.ts +120 -0
- package/build/treb-base-types/src/theme.js +460 -0
- package/build/treb-base-types/src/theme.js.map +1 -0
- package/build/treb-base-types/src/union.d.ts +73 -0
- package/build/treb-base-types/src/union.js +61 -0
- package/build/treb-base-types/src/union.js.map +1 -0
- package/build/treb-base-types/src/value-type.d.ts +86 -0
- package/build/treb-base-types/src/value-type.js +168 -0
- package/build/treb-base-types/src/value-type.js.map +1 -0
- package/build/treb-base-types/src/worker-proxy.d.ts +95 -0
- package/build/treb-base-types/src/worker-proxy.js +221 -0
- package/build/treb-base-types/src/worker-proxy.js.map +1 -0
- package/build/treb-calculator/src/calculator.d.ts +249 -0
- package/build/treb-calculator/src/calculator.js +2755 -0
- package/build/treb-calculator/src/calculator.js.map +1 -0
- package/build/treb-calculator/src/complex-math.d.ts +75 -0
- package/build/treb-calculator/src/complex-math.js +559 -0
- package/build/treb-calculator/src/complex-math.js.map +1 -0
- package/build/treb-calculator/src/dag/array-vertex.d.ts +71 -0
- package/build/treb-calculator/src/dag/array-vertex.js +156 -0
- package/build/treb-calculator/src/dag/array-vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.d.ts +48 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.js +84 -0
- package/build/treb-calculator/src/dag/calculation_leaf_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/graph.d.ts +134 -0
- package/build/treb-calculator/src/dag/graph.js +842 -0
- package/build/treb-calculator/src/dag/graph.js.map +1 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.d.ts +58 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.js +232 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.d.ts +20 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js +25 -0
- package/build/treb-calculator/src/dag/spreadsheet_vertex_base.js.map +1 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.d.ts +43 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.js +81 -0
- package/build/treb-calculator/src/dag/state_leaf_vertex.js.map +1 -0
- package/build/treb-calculator/src/dag/vertex.d.ts +71 -0
- package/build/treb-calculator/src/dag/vertex.js +274 -0
- package/build/treb-calculator/src/dag/vertex.js.map +1 -0
- package/build/treb-calculator/src/descriptors.d.ts +189 -0
- package/build/treb-calculator/src/descriptors.js +22 -0
- package/build/treb-calculator/src/descriptors.js.map +1 -0
- package/build/treb-calculator/src/expression-calculator.d.ts +127 -0
- package/build/treb-calculator/src/expression-calculator.js +1033 -0
- package/build/treb-calculator/src/expression-calculator.js.map +1 -0
- package/build/treb-calculator/src/function-error.d.ts +35 -0
- package/build/treb-calculator/src/function-error.js +85 -0
- package/build/treb-calculator/src/function-error.js.map +1 -0
- package/build/treb-calculator/src/function-library.d.ts +22 -0
- package/build/treb-calculator/src/function-library.js +96 -0
- package/build/treb-calculator/src/function-library.js.map +1 -0
- package/build/treb-calculator/src/functions/base-functions.d.ts +7 -0
- package/build/treb-calculator/src/functions/base-functions.js +2611 -0
- package/build/treb-calculator/src/functions/base-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/beta.d.ts +17 -0
- package/build/treb-calculator/src/functions/beta.js +201 -0
- package/build/treb-calculator/src/functions/beta.js.map +1 -0
- package/build/treb-calculator/src/functions/checkbox.d.ts +3 -0
- package/build/treb-calculator/src/functions/checkbox.js +128 -0
- package/build/treb-calculator/src/functions/checkbox.js.map +1 -0
- package/build/treb-calculator/src/functions/complex-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/complex-functions.js +217 -0
- package/build/treb-calculator/src/functions/complex-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/date-utils.d.ts +3 -0
- package/build/treb-calculator/src/functions/date-utils.js +59 -0
- package/build/treb-calculator/src/functions/date-utils.js.map +1 -0
- package/build/treb-calculator/src/functions/finance-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/finance-functions.js +547 -0
- package/build/treb-calculator/src/functions/finance-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/fp.d.ts +2 -0
- package/build/treb-calculator/src/functions/fp.js +463 -0
- package/build/treb-calculator/src/functions/fp.js.map +1 -0
- package/build/treb-calculator/src/functions/function-utilities.d.ts +2 -0
- package/build/treb-calculator/src/functions/function-utilities.js +36 -0
- package/build/treb-calculator/src/functions/function-utilities.js.map +1 -0
- package/build/treb-calculator/src/functions/gamma.d.ts +20 -0
- package/build/treb-calculator/src/functions/gamma.js +142 -0
- package/build/treb-calculator/src/functions/gamma.js.map +1 -0
- package/build/treb-calculator/src/functions/information-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/information-functions.js +71 -0
- package/build/treb-calculator/src/functions/information-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/lambda-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/lambda-functions.js +85 -0
- package/build/treb-calculator/src/functions/lambda-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/matrix-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/matrix-functions.js +144 -0
- package/build/treb-calculator/src/functions/matrix-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/normal.d.ts +2 -0
- package/build/treb-calculator/src/functions/normal.js +32 -0
- package/build/treb-calculator/src/functions/normal.js.map +1 -0
- package/build/treb-calculator/src/functions/regex-functions.d.ts +2 -0
- package/build/treb-calculator/src/functions/regex-functions.js +188 -0
- package/build/treb-calculator/src/functions/regex-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/sparkline.d.ts +37 -0
- package/build/treb-calculator/src/functions/sparkline.js +264 -0
- package/build/treb-calculator/src/functions/sparkline.js.map +1 -0
- package/build/treb-calculator/src/functions/statistics-functions.d.ts +6 -0
- package/build/treb-calculator/src/functions/statistics-functions.js +989 -0
- package/build/treb-calculator/src/functions/statistics-functions.js.map +1 -0
- package/build/treb-calculator/src/functions/students-t.d.ts +3 -0
- package/build/treb-calculator/src/functions/students-t.js +64 -0
- package/build/treb-calculator/src/functions/students-t.js.map +1 -0
- package/build/treb-calculator/src/functions/text-functions.d.ts +3 -0
- package/build/treb-calculator/src/functions/text-functions.js +320 -0
- package/build/treb-calculator/src/functions/text-functions.js.map +1 -0
- package/build/treb-calculator/src/index.d.ts +2 -0
- package/build/treb-calculator/src/index.js +22 -0
- package/build/treb-calculator/src/index.js.map +1 -0
- package/build/treb-calculator/src/notifier-types.d.ts +26 -0
- package/build/treb-calculator/src/notifier-types.js +22 -0
- package/build/treb-calculator/src/notifier-types.js.map +1 -0
- package/build/treb-calculator/src/primitives.d.ts +15 -0
- package/build/treb-calculator/src/primitives.js +398 -0
- package/build/treb-calculator/src/primitives.js.map +1 -0
- package/build/treb-calculator/src/utilities.d.ts +68 -0
- package/build/treb-calculator/src/utilities.js +324 -0
- package/build/treb-calculator/src/utilities.js.map +1 -0
- package/build/treb-charts/src/chart-functions.d.ts +8 -0
- package/build/treb-charts/src/chart-functions.js +209 -0
- package/build/treb-charts/src/chart-functions.js.map +1 -0
- package/build/treb-charts/src/chart-types.d.ts +233 -0
- package/build/treb-charts/src/chart-types.js +57 -0
- package/build/treb-charts/src/chart-types.js.map +1 -0
- package/build/treb-charts/src/chart-utils.d.ts +106 -0
- package/build/treb-charts/src/chart-utils.js +1060 -0
- package/build/treb-charts/src/chart-utils.js.map +1 -0
- package/build/treb-charts/src/chart.d.ts +23 -0
- package/build/treb-charts/src/chart.js +94 -0
- package/build/treb-charts/src/chart.js.map +1 -0
- package/build/treb-charts/src/default-chart-renderer.d.ts +16 -0
- package/build/treb-charts/src/default-chart-renderer.js +533 -0
- package/build/treb-charts/src/default-chart-renderer.js.map +1 -0
- package/build/treb-charts/src/index.d.ts +5 -0
- package/build/treb-charts/src/index.js +24 -0
- package/build/treb-charts/src/index.js.map +1 -0
- package/build/treb-charts/src/main.d.ts +1 -0
- package/build/treb-charts/src/main.js +34 -0
- package/build/treb-charts/src/main.js.map +1 -0
- package/build/treb-charts/src/quicksort.d.ts +1 -0
- package/build/treb-charts/src/quicksort.js +49 -0
- package/build/treb-charts/src/quicksort.js.map +1 -0
- package/build/treb-charts/src/rectangle.d.ts +18 -0
- package/build/treb-charts/src/rectangle.js +41 -0
- package/build/treb-charts/src/rectangle.js.map +1 -0
- package/build/treb-charts/src/renderer-type.d.ts +24 -0
- package/build/treb-charts/src/renderer-type.js +22 -0
- package/build/treb-charts/src/renderer-type.js.map +1 -0
- package/build/treb-charts/src/renderer.d.ts +127 -0
- package/build/treb-charts/src/renderer.js +1518 -0
- package/build/treb-charts/src/renderer.js.map +1 -0
- package/build/treb-charts/src/util.d.ts +18 -0
- package/build/treb-charts/src/util.js +71 -0
- package/build/treb-charts/src/util.js.map +1 -0
- package/build/treb-data-model/src/annotation.d.ts +167 -0
- package/build/treb-data-model/src/annotation.js +120 -0
- package/build/treb-data-model/src/annotation.js.map +1 -0
- package/build/treb-data-model/src/conditional_format.d.ts +155 -0
- package/build/treb-data-model/src/conditional_format.js +62 -0
- package/build/treb-data-model/src/conditional_format.js.map +1 -0
- package/build/treb-data-model/src/data-validation.d.ts +28 -0
- package/build/treb-data-model/src/data-validation.js +22 -0
- package/build/treb-data-model/src/data-validation.js.map +1 -0
- package/build/treb-data-model/src/data_model.d.ts +173 -0
- package/build/treb-data-model/src/data_model.js +637 -0
- package/build/treb-data-model/src/data_model.js.map +1 -0
- package/build/treb-data-model/src/index.d.ts +13 -0
- package/build/treb-data-model/src/index.js +28 -0
- package/build/treb-data-model/src/index.js.map +1 -0
- package/build/treb-data-model/src/language-model.d.ts +22 -0
- package/build/treb-data-model/src/language-model.js +22 -0
- package/build/treb-data-model/src/language-model.js.map +1 -0
- package/build/treb-data-model/src/named.d.ts +124 -0
- package/build/treb-data-model/src/named.js +372 -0
- package/build/treb-data-model/src/named.js.map +1 -0
- package/build/treb-data-model/src/serialize_options.d.ts +49 -0
- package/build/treb-data-model/src/serialize_options.js +22 -0
- package/build/treb-data-model/src/serialize_options.js.map +1 -0
- package/build/treb-data-model/src/sheet.d.ts +499 -0
- package/build/treb-data-model/src/sheet.js +2904 -0
- package/build/treb-data-model/src/sheet.js.map +1 -0
- package/build/treb-data-model/src/sheet_collection.d.ts +58 -0
- package/build/treb-data-model/src/sheet_collection.js +112 -0
- package/build/treb-data-model/src/sheet_collection.js.map +1 -0
- package/build/treb-data-model/src/sheet_selection.d.ts +42 -0
- package/build/treb-data-model/src/sheet_selection.js +39 -0
- package/build/treb-data-model/src/sheet_selection.js.map +1 -0
- package/build/treb-data-model/src/sheet_types.d.ts +104 -0
- package/build/treb-data-model/src/sheet_types.js +22 -0
- package/build/treb-data-model/src/sheet_types.js.map +1 -0
- package/build/treb-data-model/src/types.d.ts +59 -0
- package/build/treb-data-model/src/types.js +22 -0
- package/build/treb-data-model/src/types.js.map +1 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.d.ts +75 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.js +1144 -0
- package/build/treb-embed/src/custom-element/spreadsheet-constructor.js.map +1 -0
- package/build/treb-embed/src/custom-element/treb-global.d.ts +36 -0
- package/build/treb-embed/src/custom-element/treb-global.js +64 -0
- package/build/treb-embed/src/custom-element/treb-global.js.map +1 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.d.ts +1 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js +61 -0
- package/build/treb-embed/src/custom-element/treb-spreadsheet-element.js.map +1 -0
- package/build/treb-embed/src/embedded-spreadsheet.d.ts +1358 -0
- package/build/treb-embed/src/embedded-spreadsheet.js +5205 -0
- package/build/treb-embed/src/embedded-spreadsheet.js.map +1 -0
- package/build/treb-embed/src/index.d.ts +12 -0
- package/build/treb-embed/src/index.js +34 -0
- package/build/treb-embed/src/index.js.map +1 -0
- package/build/treb-embed/src/options.d.ts +266 -0
- package/build/treb-embed/src/options.js +56 -0
- package/build/treb-embed/src/options.js.map +1 -0
- package/build/treb-embed/src/plugin.d.ts +9 -0
- package/build/treb-embed/src/plugin.js +22 -0
- package/build/treb-embed/src/plugin.js.map +1 -0
- package/build/treb-embed/src/progress-dialog.d.ts +49 -0
- package/build/treb-embed/src/progress-dialog.js +178 -0
- package/build/treb-embed/src/progress-dialog.js.map +1 -0
- package/build/treb-embed/src/selection-state.d.ts +15 -0
- package/build/treb-embed/src/selection-state.js +22 -0
- package/build/treb-embed/src/selection-state.js.map +1 -0
- package/build/treb-embed/src/spinner.d.ts +8 -0
- package/build/treb-embed/src/spinner.js +40 -0
- package/build/treb-embed/src/spinner.js.map +1 -0
- package/build/treb-embed/src/toolbar-message.d.ts +72 -0
- package/build/treb-embed/src/toolbar-message.js +22 -0
- package/build/treb-embed/src/toolbar-message.js.map +1 -0
- package/build/treb-embed/src/types.d.ts +185 -0
- package/build/treb-embed/src/types.js +45 -0
- package/build/treb-embed/src/types.js.map +1 -0
- package/build/treb-embed/tsconfig.tsbuildinfo +1 -0
- package/build/treb-export/src/address-type.d.ts +34 -0
- package/build/treb-export/src/address-type.js +53 -0
- package/build/treb-export/src/address-type.js.map +1 -0
- package/build/treb-export/src/base-template.d.ts +1 -0
- package/build/treb-export/src/base-template.js +22 -0
- package/build/treb-export/src/base-template.js.map +1 -0
- package/build/treb-export/src/column-width.d.ts +2 -0
- package/build/treb-export/src/column-width.js +80 -0
- package/build/treb-export/src/column-width.js.map +1 -0
- package/build/treb-export/src/drawing/bubble-chart-template.d.ts +514 -0
- package/build/treb-export/src/drawing/bubble-chart-template.js +544 -0
- package/build/treb-export/src/drawing/bubble-chart-template.js.map +1 -0
- package/build/treb-export/src/drawing/chart-template-components2.d.ts +365 -0
- package/build/treb-export/src/drawing/chart-template-components2.js +386 -0
- package/build/treb-export/src/drawing/chart-template-components2.js.map +1 -0
- package/build/treb-export/src/drawing/chart.d.ts +26 -0
- package/build/treb-export/src/drawing/chart.js +247 -0
- package/build/treb-export/src/drawing/chart.js.map +1 -0
- package/build/treb-export/src/drawing/column-chart-template2.d.ts +490 -0
- package/build/treb-export/src/drawing/column-chart-template2.js +518 -0
- package/build/treb-export/src/drawing/column-chart-template2.js.map +1 -0
- package/build/treb-export/src/drawing/donut-chart-template2.d.ts +272 -0
- package/build/treb-export/src/drawing/donut-chart-template2.js +293 -0
- package/build/treb-export/src/drawing/donut-chart-template2.js.map +1 -0
- package/build/treb-export/src/drawing/drawing.d.ts +49 -0
- package/build/treb-export/src/drawing/drawing.js +193 -0
- package/build/treb-export/src/drawing/drawing.js.map +1 -0
- package/build/treb-export/src/drawing/embedded-image.d.ts +12 -0
- package/build/treb-export/src/drawing/embedded-image.js +54 -0
- package/build/treb-export/src/drawing/embedded-image.js.map +1 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.d.ts +520 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.js +551 -0
- package/build/treb-export/src/drawing/scatter-chart-template2.js.map +1 -0
- package/build/treb-export/src/export.d.ts +72 -0
- package/build/treb-export/src/export.js +2039 -0
- package/build/treb-export/src/export.js.map +1 -0
- package/build/treb-export/src/import-export-messages.d.ts +31 -0
- package/build/treb-export/src/import-export-messages.js +22 -0
- package/build/treb-export/src/import-export-messages.js.map +1 -0
- package/build/treb-export/src/import.d.ts +33 -0
- package/build/treb-export/src/import.js +1258 -0
- package/build/treb-export/src/import.js.map +1 -0
- package/build/treb-export/src/index.worker.d.ts +1 -0
- package/build/treb-export/src/index.worker.js +93 -0
- package/build/treb-export/src/index.worker.js.map +1 -0
- package/build/treb-export/src/metadata.d.ts +51 -0
- package/build/treb-export/src/metadata.js +153 -0
- package/build/treb-export/src/metadata.js.map +1 -0
- package/build/treb-export/src/ooxml.d.ts +7 -0
- package/build/treb-export/src/ooxml.js +41 -0
- package/build/treb-export/src/ooxml.js.map +1 -0
- package/build/treb-export/src/relationship.d.ts +8 -0
- package/build/treb-export/src/relationship.js +27 -0
- package/build/treb-export/src/relationship.js.map +1 -0
- package/build/treb-export/src/shared-strings.d.ts +11 -0
- package/build/treb-export/src/shared-strings.js +105 -0
- package/build/treb-export/src/shared-strings.js.map +1 -0
- package/build/treb-export/src/template-2.d.ts +1 -0
- package/build/treb-export/src/template-2.js +22 -0
- package/build/treb-export/src/template-2.js.map +1 -0
- package/build/treb-export/src/unescape_xml.d.ts +1 -0
- package/build/treb-export/src/unescape_xml.js +61 -0
- package/build/treb-export/src/unescape_xml.js.map +1 -0
- package/build/treb-export/src/workbook-sheet.d.ts +75 -0
- package/build/treb-export/src/workbook-sheet.js +128 -0
- package/build/treb-export/src/workbook-sheet.js.map +1 -0
- package/build/treb-export/src/workbook-style.d.ts +110 -0
- package/build/treb-export/src/workbook-style.js +1134 -0
- package/build/treb-export/src/workbook-style.js.map +1 -0
- package/build/treb-export/src/workbook-theme.d.ts +13 -0
- package/build/treb-export/src/workbook-theme.js +85 -0
- package/build/treb-export/src/workbook-theme.js.map +1 -0
- package/build/treb-export/src/workbook.d.ts +123 -0
- package/build/treb-export/src/workbook.js +644 -0
- package/build/treb-export/src/workbook.js.map +1 -0
- package/build/treb-export/src/xml-test.d.ts +9 -0
- package/build/treb-export/src/xml-test.js +52 -0
- package/build/treb-export/src/xml-test.js.map +1 -0
- package/build/treb-export/src/xml-utils.d.ts +76 -0
- package/build/treb-export/src/xml-utils.js +223 -0
- package/build/treb-export/src/xml-utils.js.map +1 -0
- package/build/treb-export/src/zip-wrapper.d.ts +22 -0
- package/build/treb-export/src/zip-wrapper.js +93 -0
- package/build/treb-export/src/zip-wrapper.js.map +1 -0
- package/build/treb-format/src/format.d.ts +130 -0
- package/build/treb-format/src/format.js +805 -0
- package/build/treb-format/src/format.js.map +1 -0
- package/build/treb-format/src/format_cache.d.ts +55 -0
- package/build/treb-format/src/format_cache.js +166 -0
- package/build/treb-format/src/format_cache.js.map +1 -0
- package/build/treb-format/src/format_parser.d.ts +70 -0
- package/build/treb-format/src/format_parser.js +618 -0
- package/build/treb-format/src/format_parser.js.map +1 -0
- package/build/treb-format/src/index.d.ts +4 -0
- package/build/treb-format/src/index.js +25 -0
- package/build/treb-format/src/index.js.map +1 -0
- package/build/treb-format/src/number_format_section.d.ts +58 -0
- package/build/treb-format/src/number_format_section.js +78 -0
- package/build/treb-format/src/number_format_section.js.map +1 -0
- package/build/treb-format/src/value_parser.d.ts +48 -0
- package/build/treb-format/src/value_parser.js +244 -0
- package/build/treb-format/src/value_parser.js.map +1 -0
- package/build/treb-grid/src/editors/autocomplete.d.ts +39 -0
- package/build/treb-grid/src/editors/autocomplete.js +316 -0
- package/build/treb-grid/src/editors/autocomplete.js.map +1 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.d.ts +74 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.js +212 -0
- package/build/treb-grid/src/editors/autocomplete_matcher.js.map +1 -0
- package/build/treb-grid/src/editors/editor.d.ts +214 -0
- package/build/treb-grid/src/editors/editor.js +879 -0
- package/build/treb-grid/src/editors/editor.js.map +1 -0
- package/build/treb-grid/src/editors/external_editor.d.ts +11 -0
- package/build/treb-grid/src/editors/external_editor.js +118 -0
- package/build/treb-grid/src/editors/external_editor.js.map +1 -0
- package/build/treb-grid/src/editors/formula_bar.d.ts +85 -0
- package/build/treb-grid/src/editors/formula_bar.js +444 -0
- package/build/treb-grid/src/editors/formula_bar.js.map +1 -0
- package/build/treb-grid/src/editors/overlay_editor.d.ts +85 -0
- package/build/treb-grid/src/editors/overlay_editor.js +353 -0
- package/build/treb-grid/src/editors/overlay_editor.js.map +1 -0
- package/build/treb-grid/src/index.d.ts +12 -0
- package/build/treb-grid/src/index.js +28 -0
- package/build/treb-grid/src/index.js.map +1 -0
- package/build/treb-grid/src/layout/base_layout.d.ts +346 -0
- package/build/treb-grid/src/layout/base_layout.js +2050 -0
- package/build/treb-grid/src/layout/base_layout.js.map +1 -0
- package/build/treb-grid/src/layout/grid_layout.d.ts +19 -0
- package/build/treb-grid/src/layout/grid_layout.js +235 -0
- package/build/treb-grid/src/layout/grid_layout.js.map +1 -0
- package/build/treb-grid/src/layout/mock-layout.d.ts +10 -0
- package/build/treb-grid/src/layout/mock-layout.js +37 -0
- package/build/treb-grid/src/layout/mock-layout.js.map +1 -0
- package/build/treb-grid/src/render/selection-renderer.d.ts +97 -0
- package/build/treb-grid/src/render/selection-renderer.js +315 -0
- package/build/treb-grid/src/render/selection-renderer.js.map +1 -0
- package/build/treb-grid/src/render/svg_header_overlay.d.ts +20 -0
- package/build/treb-grid/src/render/svg_header_overlay.js +76 -0
- package/build/treb-grid/src/render/svg_header_overlay.js.map +1 -0
- package/build/treb-grid/src/render/svg_selection_block.d.ts +27 -0
- package/build/treb-grid/src/render/svg_selection_block.js +106 -0
- package/build/treb-grid/src/render/svg_selection_block.js.map +1 -0
- package/build/treb-grid/src/render/tile_renderer.d.ts +121 -0
- package/build/treb-grid/src/render/tile_renderer.js +1609 -0
- package/build/treb-grid/src/render/tile_renderer.js.map +1 -0
- package/build/treb-grid/src/types/border_constants.d.ts +9 -0
- package/build/treb-grid/src/types/border_constants.js +34 -0
- package/build/treb-grid/src/types/border_constants.js.map +1 -0
- package/build/treb-grid/src/types/clipboard_data.d.ts +11 -0
- package/build/treb-grid/src/types/clipboard_data.js +22 -0
- package/build/treb-grid/src/types/clipboard_data.js.map +1 -0
- package/build/treb-grid/src/types/clipboard_data2.d.ts +46 -0
- package/build/treb-grid/src/types/clipboard_data2.js +22 -0
- package/build/treb-grid/src/types/clipboard_data2.js.map +1 -0
- package/build/treb-grid/src/types/drag_mask.d.ts +10 -0
- package/build/treb-grid/src/types/drag_mask.js +78 -0
- package/build/treb-grid/src/types/drag_mask.js.map +1 -0
- package/build/treb-grid/src/types/external_editor_config.d.ts +33 -0
- package/build/treb-grid/src/types/external_editor_config.js +22 -0
- package/build/treb-grid/src/types/external_editor_config.js.map +1 -0
- package/build/treb-grid/src/types/grid.d.ts +806 -0
- package/build/treb-grid/src/types/grid.js +6410 -0
- package/build/treb-grid/src/types/grid.js.map +1 -0
- package/build/treb-grid/src/types/grid_base.d.ts +442 -0
- package/build/treb-grid/src/types/grid_base.js +3523 -0
- package/build/treb-grid/src/types/grid_base.js.map +1 -0
- package/build/treb-grid/src/types/grid_command.d.ts +408 -0
- package/build/treb-grid/src/types/grid_command.js +75 -0
- package/build/treb-grid/src/types/grid_command.js.map +1 -0
- package/build/treb-grid/src/types/grid_events.d.ts +93 -0
- package/build/treb-grid/src/types/grid_events.js +36 -0
- package/build/treb-grid/src/types/grid_events.js.map +1 -0
- package/build/treb-grid/src/types/grid_options.d.ts +50 -0
- package/build/treb-grid/src/types/grid_options.js +34 -0
- package/build/treb-grid/src/types/grid_options.js.map +1 -0
- package/build/treb-grid/src/types/scale-control.d.ts +21 -0
- package/build/treb-grid/src/types/scale-control.js +148 -0
- package/build/treb-grid/src/types/scale-control.js.map +1 -0
- package/build/treb-grid/src/types/set_range_options.d.ts +24 -0
- package/build/treb-grid/src/types/set_range_options.js +22 -0
- package/build/treb-grid/src/types/set_range_options.js.map +1 -0
- package/build/treb-grid/src/types/tab_bar.d.ts +84 -0
- package/build/treb-grid/src/types/tab_bar.js +426 -0
- package/build/treb-grid/src/types/tab_bar.js.map +1 -0
- package/build/treb-grid/src/types/tile.d.ts +29 -0
- package/build/treb-grid/src/types/tile.js +22 -0
- package/build/treb-grid/src/types/tile.js.map +1 -0
- package/build/treb-grid/src/types/update_flags.d.ts +48 -0
- package/build/treb-grid/src/types/update_flags.js +22 -0
- package/build/treb-grid/src/types/update_flags.js.map +1 -0
- package/build/treb-grid/src/util/fontmetrics.d.ts +21 -0
- package/build/treb-grid/src/util/fontmetrics.js +82 -0
- package/build/treb-grid/src/util/fontmetrics.js.map +1 -0
- package/build/treb-grid/src/util/ua.d.ts +33 -0
- package/build/treb-grid/src/util/ua.js +86 -0
- package/build/treb-grid/src/util/ua.js.map +1 -0
- package/build/treb-parser/src/csv-parser.d.ts +13 -0
- package/build/treb-parser/src/csv-parser.js +107 -0
- package/build/treb-parser/src/csv-parser.js.map +1 -0
- package/build/treb-parser/src/index.d.ts +4 -0
- package/build/treb-parser/src/index.js +25 -0
- package/build/treb-parser/src/index.js.map +1 -0
- package/build/treb-parser/src/md-parser.d.ts +97 -0
- package/build/treb-parser/src/md-parser.js +403 -0
- package/build/treb-parser/src/md-parser.js.map +1 -0
- package/build/treb-parser/src/parser-types.d.ts +345 -0
- package/build/treb-parser/src/parser-types.js +53 -0
- package/build/treb-parser/src/parser-types.js.map +1 -0
- package/build/treb-parser/src/parser.d.ts +422 -0
- package/build/treb-parser/src/parser.js +2418 -0
- package/build/treb-parser/src/parser.js.map +1 -0
- package/build/treb-utils/src/event_source.d.ts +34 -0
- package/build/treb-utils/src/event_source.js +110 -0
- package/build/treb-utils/src/event_source.js.map +1 -0
- package/build/treb-utils/src/ievent_source.d.ts +9 -0
- package/build/treb-utils/src/ievent_source.js +22 -0
- package/build/treb-utils/src/ievent_source.js.map +1 -0
- package/build/treb-utils/src/index.d.ts +6 -0
- package/build/treb-utils/src/index.js +30 -0
- package/build/treb-utils/src/index.js.map +1 -0
- package/build/treb-utils/src/measurement.d.ts +42 -0
- package/build/treb-utils/src/measurement.js +145 -0
- package/build/treb-utils/src/measurement.js.map +1 -0
- package/build/treb-utils/src/scale.d.ts +16 -0
- package/build/treb-utils/src/scale.js +106 -0
- package/build/treb-utils/src/scale.js.map +1 -0
- package/build/treb-utils/src/serialize_html.d.ts +5 -0
- package/build/treb-utils/src/serialize_html.js +128 -0
- package/build/treb-utils/src/serialize_html.js.map +1 -0
- package/build/treb-utils/src/validate_uri.d.ts +20 -0
- package/build/treb-utils/src/validate_uri.js +55 -0
- package/build/treb-utils/src/validate_uri.js.map +1 -0
- package/dist/{chunk-XD5PEZBZ.mjs → chunk-E35ONJUS.mjs} +1 -1
- package/dist/treb-export-worker.mjs +2 -2
- package/dist/treb-spreadsheet.mjs +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2026 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
import { IsHTMLColor, IsThemeColor, ThemeColorIndex } from './style';
|
|
22
|
+
import { ColorFunctions } from './color';
|
|
23
|
+
// import * as LCHColorFunctions from './color2';
|
|
24
|
+
import { DOMContext } from './dom-utilities';
|
|
25
|
+
import { Measurement } from 'treb-utils';
|
|
26
|
+
import { font_stack_names, GenerateFontStack } from './font-stack';
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export const DefaultTheme = {
|
|
31
|
+
grid_color: '#ccc',
|
|
32
|
+
note_marker_color: '#d2c500',
|
|
33
|
+
mode: 'light',
|
|
34
|
+
offset_cache: {},
|
|
35
|
+
offset_light: '#fff',
|
|
36
|
+
offset_dark: '#000',
|
|
37
|
+
font_stacks: {},
|
|
38
|
+
grid_cell_font_size: { value: 10, unit: 'pt' },
|
|
39
|
+
};
|
|
40
|
+
/* *
|
|
41
|
+
* now just a wrapper, we should remove
|
|
42
|
+
*
|
|
43
|
+
* the only difference between this and the other function (ThemeColor2)
|
|
44
|
+
* is that this has a default for "defaultindex" => 0; calls can just
|
|
45
|
+
* call the second method with the extra argument.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated
|
|
48
|
+
* @internal
|
|
49
|
+
* /
|
|
50
|
+
export const ThemeColor = (theme: Theme, color?: Color): string => {
|
|
51
|
+
return ThemeColor2(theme, color, 0);
|
|
52
|
+
};
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* we cache values in the theme object so that we can dump it when we
|
|
56
|
+
* reload or update the theme.
|
|
57
|
+
*
|
|
58
|
+
* we're now inverting tint for dark themes. the idea is that if you
|
|
59
|
+
* are using a dark theme, it's more natural to go in that direction, and
|
|
60
|
+
* you can use the same foreground color.
|
|
61
|
+
*
|
|
62
|
+
* because this is ephemeral it won't impact export.
|
|
63
|
+
*/
|
|
64
|
+
const TintedColor = (theme, source) => {
|
|
65
|
+
const index = ThemeColorIndex(source);
|
|
66
|
+
let tint = (source.tint || 0);
|
|
67
|
+
if (theme.mode === 'dark') {
|
|
68
|
+
tint = -tint; // invert;
|
|
69
|
+
}
|
|
70
|
+
if (!theme.tint_cache) {
|
|
71
|
+
theme.tint_cache = [];
|
|
72
|
+
}
|
|
73
|
+
if (!theme.tint_cache[index]) {
|
|
74
|
+
theme.tint_cache[index] = {};
|
|
75
|
+
}
|
|
76
|
+
let color = theme.tint_cache[index][tint];
|
|
77
|
+
if (!color) {
|
|
78
|
+
const rgb = (theme.theme_colors_rgb ? theme.theme_colors_rgb[index] : [0, 0, 0]) || [0, 0, 0];
|
|
79
|
+
let tinted;
|
|
80
|
+
if (tint > 0) {
|
|
81
|
+
tinted = ColorFunctions.Lighten(rgb[0], rgb[1], rgb[2], tint * 100, true);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
tinted = ColorFunctions.Darken(rgb[0], rgb[1], rgb[2], -tint * 100, true);
|
|
85
|
+
}
|
|
86
|
+
color = `rgb(${tinted.r},${tinted.g},${tinted.b})`;
|
|
87
|
+
/*
|
|
88
|
+
// L is in [0, 100] and the passed tint value is between (-1 and 1). but
|
|
89
|
+
// is the tint value the desired value, or the adjustment? (...)
|
|
90
|
+
// looks like it's the adjustment. makes sense I guess if you pick the
|
|
91
|
+
// original colors.
|
|
92
|
+
|
|
93
|
+
// if the tint value was not originally in perceptual space we might need
|
|
94
|
+
// to curve it a bit? (...)
|
|
95
|
+
|
|
96
|
+
const lch = LCHColorFunctions.RGBToLCH(...rgb);
|
|
97
|
+
const tinted = LCHColorFunctions.LCHToRGB(lch.l + 50 * tint, lch.c, lch.h);
|
|
98
|
+
color = `rgb(${tinted.r},${tinted.g},${tinted.b})`;
|
|
99
|
+
*/
|
|
100
|
+
theme.tint_cache[index][tint] = color;
|
|
101
|
+
}
|
|
102
|
+
return color;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* this includes an implicit check for valid color, if a color
|
|
106
|
+
* can't be resolved it returns ''. now supports offset colors.
|
|
107
|
+
* offset returns a light color against a dark background, and
|
|
108
|
+
* vice versa. what constitutes a dark background is not entirely
|
|
109
|
+
* clear; atm using lightness = .65.
|
|
110
|
+
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export const ResolveThemeColor = (theme, color, default_index) => {
|
|
114
|
+
if (color && color.offset) {
|
|
115
|
+
// don't do this
|
|
116
|
+
if (color.offset.offset) {
|
|
117
|
+
console.warn('invalid offset color');
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
let resolved = '';
|
|
121
|
+
if (IsHTMLColor(color.offset)) {
|
|
122
|
+
const clamped = Measurement.MeasureColor(color.offset.text);
|
|
123
|
+
resolved = `rgb(${clamped[0]}, ${clamped[1]}, ${clamped[2]})`;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
resolved = ResolveThemeColor(theme, color.offset, undefined);
|
|
127
|
+
}
|
|
128
|
+
// check cache
|
|
129
|
+
if (theme.offset_cache && theme.offset_cache[resolved]) {
|
|
130
|
+
return theme.offset_cache[resolved];
|
|
131
|
+
}
|
|
132
|
+
let offset = theme.offset_light;
|
|
133
|
+
if (resolved) {
|
|
134
|
+
// ok figure it out?
|
|
135
|
+
const match = resolved.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
136
|
+
if (match) {
|
|
137
|
+
const background = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
138
|
+
// const hsl = ColorFunctions.RGBToHSL(r, g, b);
|
|
139
|
+
// const check = ColorFunctions.GetLuminance(r, g, b);
|
|
140
|
+
const a = Array.from(Measurement.MeasureColor(theme.offset_dark));
|
|
141
|
+
const b = Array.from(Measurement.MeasureColor(theme.offset_light));
|
|
142
|
+
const tc = ColorFunctions.GetTextColor(background, a, b);
|
|
143
|
+
offset = `rgb(${tc[0]}, ${tc[1]}, ${tc[2]})`;
|
|
144
|
+
/*
|
|
145
|
+
if (hsl.l >.65)) {
|
|
146
|
+
offset = theme.offset_dark;
|
|
147
|
+
}
|
|
148
|
+
*/
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
// ...
|
|
152
|
+
console.warn(`can't offset against color`, resolved, '(1)');
|
|
153
|
+
}
|
|
154
|
+
if (!theme.offset_cache) {
|
|
155
|
+
theme.offset_cache = {};
|
|
156
|
+
}
|
|
157
|
+
theme.offset_cache[resolved] = offset;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
console.warn(`can't resolve offset color`, color.offset, '(2)');
|
|
161
|
+
}
|
|
162
|
+
return offset;
|
|
163
|
+
}
|
|
164
|
+
// explicit color, or none
|
|
165
|
+
if (IsHTMLColor(color)) {
|
|
166
|
+
return color.text === 'none' ? '' : color.text;
|
|
167
|
+
}
|
|
168
|
+
// theme color. we need a way to cache these lookups, especially for tinting
|
|
169
|
+
if (IsThemeColor(color)) {
|
|
170
|
+
if (color.tint) {
|
|
171
|
+
return TintedColor(theme, color);
|
|
172
|
+
}
|
|
173
|
+
return theme.theme_colors ? theme.theme_colors[ThemeColorIndex(color)] : '';
|
|
174
|
+
}
|
|
175
|
+
// default from argument
|
|
176
|
+
if (default_index || default_index === 0) {
|
|
177
|
+
return theme.theme_colors ? theme.theme_colors[default_index] : '';
|
|
178
|
+
}
|
|
179
|
+
// actual default, which is nothing
|
|
180
|
+
return '';
|
|
181
|
+
};
|
|
182
|
+
const ParseFontSize = (size) => {
|
|
183
|
+
let value = 10;
|
|
184
|
+
let unit = 'pt';
|
|
185
|
+
const match = size.match(/^([\d.]+)(\D.*)$/); // pt, px, em, rem, %
|
|
186
|
+
if (match) {
|
|
187
|
+
value = Number(match[1]);
|
|
188
|
+
unit = match[2];
|
|
189
|
+
}
|
|
190
|
+
return { value, unit };
|
|
191
|
+
};
|
|
192
|
+
/* *
|
|
193
|
+
* pull out styles we apply to tables, if they differ from the base.
|
|
194
|
+
* setting "initial" or "inherit" doesn't work to clear them (at least atm);
|
|
195
|
+
* use "transparent" to unset.
|
|
196
|
+
* /
|
|
197
|
+
const TableStyleFromCSS = (base: CSSStyleDeclaration, style: CSSStyleDeclaration): Style.Properties => {
|
|
198
|
+
|
|
199
|
+
const props: Style.Properties = {};
|
|
200
|
+
|
|
201
|
+
if (style.borderTopColor !== base.borderTopColor) {
|
|
202
|
+
props.border_top = 1;
|
|
203
|
+
props.border_top_fill = { text: style.borderTopColor };
|
|
204
|
+
if (style.borderTopStyle === 'double') {
|
|
205
|
+
props.border_top = 2;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (style.borderBottomColor !== base.borderBottomColor) {
|
|
210
|
+
props.border_bottom = 1;
|
|
211
|
+
props.border_bottom_fill = { text: style.borderBottomColor };
|
|
212
|
+
if (style.borderBottomStyle === 'double') {
|
|
213
|
+
props.border_bottom = 2;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (style.backgroundColor !== base.backgroundColor) {
|
|
218
|
+
props.fill = { text: style.backgroundColor };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (style.color !== base.color) {
|
|
222
|
+
props.text = { text: style.color };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (style.fontWeight !== base.fontWeight) {
|
|
226
|
+
props.bold = /(?:700|bold)/.test(style.fontWeight);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (style.fontStyle !== base.fontStyle) {
|
|
230
|
+
props.italic = /italic/.test(style.fontStyle);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (style.textDecoration !== base.textDecoration) {
|
|
234
|
+
const style_underline = /underline/.test(style.textDecoration);
|
|
235
|
+
const base_underline = /underline/.test(base.textDecoration);
|
|
236
|
+
|
|
237
|
+
if (base_underline !== style_underline) {
|
|
238
|
+
props.underline = style_underline;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const style_strike = /line-through/.test(style.textDecoration);
|
|
242
|
+
const base_strike = /line-through/.test(base.textDecoration);
|
|
243
|
+
|
|
244
|
+
if (base_strike !== style_strike) {
|
|
245
|
+
props.strike = style_strike;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return props;
|
|
251
|
+
|
|
252
|
+
};
|
|
253
|
+
*/
|
|
254
|
+
// testing
|
|
255
|
+
const StyleFromCSS = (css, include_font_face = false) => {
|
|
256
|
+
// const { value, unit } = ParseFontSize(css.fontSize||'');
|
|
257
|
+
const style = {
|
|
258
|
+
fill: { text: css.backgroundColor }, // || 'none',
|
|
259
|
+
text: { text: css.color },
|
|
260
|
+
/*
|
|
261
|
+
font_size: {
|
|
262
|
+
unit, value,
|
|
263
|
+
},
|
|
264
|
+
*/
|
|
265
|
+
// use container size unless we scale. the reason we do this is
|
|
266
|
+
// because if we set scale, we always wind up with em units.
|
|
267
|
+
font_size: { unit: 'em', value: 1 },
|
|
268
|
+
// font_face: css.fontFamily,
|
|
269
|
+
};
|
|
270
|
+
if (include_font_face) {
|
|
271
|
+
style.font_face = css.fontFamily;
|
|
272
|
+
}
|
|
273
|
+
// the default border comes from the "theme colors", not from
|
|
274
|
+
// the CSS property (it used to come from the CSS property, which
|
|
275
|
+
// is why we have the CSS property set).
|
|
276
|
+
//
|
|
277
|
+
// default border is theme color 1.
|
|
278
|
+
//
|
|
279
|
+
if (/italic/i.test(css.font)) {
|
|
280
|
+
style.italic = true;
|
|
281
|
+
}
|
|
282
|
+
// for painting we only support regular (400) and bold (700), those
|
|
283
|
+
// are the only values allowed by canvas (I think)
|
|
284
|
+
if (css.fontWeight === '700') {
|
|
285
|
+
style.bold = true;
|
|
286
|
+
}
|
|
287
|
+
return style;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* how to derive the light/dark theme? it's complicated, as it turns out.
|
|
291
|
+
* there's almost nothing we can do to reliably determine what theme
|
|
292
|
+
* is set. the best thing would be color-scheme, which affects (among other
|
|
293
|
+
* things) scrollbars, but that might be set to something like 'light dark'
|
|
294
|
+
* which is indeterminate.
|
|
295
|
+
*
|
|
296
|
+
* so what we are going to do is check the grid foreground and background;
|
|
297
|
+
* if the foreground is lighter than the background, we're in dark mode.
|
|
298
|
+
* and vice-versa.
|
|
299
|
+
*
|
|
300
|
+
*/
|
|
301
|
+
const DeriveColorScheme = (theme, context) => {
|
|
302
|
+
const foreground_color = theme.grid_cell?.text;
|
|
303
|
+
const background_color = theme.grid_cell?.fill;
|
|
304
|
+
// because these are rendered to a canvas, we know that A is 255
|
|
305
|
+
context.fillStyle = IsHTMLColor(foreground_color) ? foreground_color.text : '';
|
|
306
|
+
context.fillRect(0, 0, 3, 3);
|
|
307
|
+
const fg = ColorFunctions.RGBToHSL(...Array.from(context.getImageData(1, 1, 1, 1).data));
|
|
308
|
+
context.fillStyle = IsHTMLColor(background_color) ? background_color.text : '';
|
|
309
|
+
context.fillRect(0, 0, 3, 3);
|
|
310
|
+
const bg = ColorFunctions.RGBToHSL(...Array.from(context.getImageData(1, 1, 1, 1).data));
|
|
311
|
+
// console.info({fg, bg});
|
|
312
|
+
return fg.l > bg.l ? 'dark' : 'light';
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* this is a shortcut for creating table formats based on theme colors.
|
|
316
|
+
* TODO: we might want to swap styles based on light/dark mode?
|
|
317
|
+
*
|
|
318
|
+
* @internal
|
|
319
|
+
*/
|
|
320
|
+
export const ThemeColorTable = (theme_color, tint = .7) => {
|
|
321
|
+
const borders = {
|
|
322
|
+
border_top: 1,
|
|
323
|
+
border_top_fill: { theme: theme_color },
|
|
324
|
+
border_bottom: 1,
|
|
325
|
+
border_bottom_fill: { theme: theme_color },
|
|
326
|
+
};
|
|
327
|
+
return {
|
|
328
|
+
header: {
|
|
329
|
+
// text: { theme: theme.mode === 'dark' ? 1 : 0, },
|
|
330
|
+
// text: { text: '#fff' },
|
|
331
|
+
text: { offset: { theme: theme_color } },
|
|
332
|
+
fill: { theme: theme_color },
|
|
333
|
+
bold: true,
|
|
334
|
+
...borders,
|
|
335
|
+
},
|
|
336
|
+
odd: {
|
|
337
|
+
fill: { theme: theme_color, tint },
|
|
338
|
+
...borders,
|
|
339
|
+
},
|
|
340
|
+
even: {
|
|
341
|
+
...borders,
|
|
342
|
+
},
|
|
343
|
+
total: {
|
|
344
|
+
...borders,
|
|
345
|
+
border_top: 2,
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* for stuff that's painted, we wamt to get the corresponding CSS value.
|
|
351
|
+
* we now set everything via CSS variables, but using the node structure
|
|
352
|
+
* allows us to read calculated values, especially when there are cascades.
|
|
353
|
+
*
|
|
354
|
+
* I keep trying to change this to just read CSS variables, but that does
|
|
355
|
+
* not do the same thing.
|
|
356
|
+
*
|
|
357
|
+
* @internal
|
|
358
|
+
*/
|
|
359
|
+
export const LoadThemeProperties = (container, use_font_stacks = false) => {
|
|
360
|
+
const theme = JSON.parse(JSON.stringify(DefaultTheme));
|
|
361
|
+
const DOM = DOMContext.GetInstance(container.ownerDocument);
|
|
362
|
+
const Append = (parent, classes) => {
|
|
363
|
+
return DOM.Div(classes, parent);
|
|
364
|
+
};
|
|
365
|
+
const ElementCSS = (parent, classes) => {
|
|
366
|
+
return DOM.view?.getComputedStyle(Append(parent, classes));
|
|
367
|
+
};
|
|
368
|
+
const node = Append(container, '');
|
|
369
|
+
const CSS = ElementCSS.bind(0, node);
|
|
370
|
+
let css = CSS('grid-cells');
|
|
371
|
+
theme.grid_cell = StyleFromCSS(css, false);
|
|
372
|
+
theme.grid_color = css.stroke || '';
|
|
373
|
+
theme.grid_cell_font_size = ParseFontSize(css.fontSize || '');
|
|
374
|
+
// console.info({theme});
|
|
375
|
+
if (use_font_stacks) {
|
|
376
|
+
for (const key of font_stack_names) {
|
|
377
|
+
css = CSS(`treb-font-stack-${key}`);
|
|
378
|
+
theme.font_stacks[key] = GenerateFontStack(key, css);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
// default only
|
|
383
|
+
css = CSS(`treb-font-stack-default`);
|
|
384
|
+
theme.font_stacks.default = GenerateFontStack('default', css);
|
|
385
|
+
}
|
|
386
|
+
// console.info(theme.font_stacks);
|
|
387
|
+
css = CSS('grid-headers');
|
|
388
|
+
theme.headers = StyleFromCSS(css, true);
|
|
389
|
+
theme.headers_grid_color = css.stroke;
|
|
390
|
+
if (!theme.headers_grid_color || theme.headers_grid_color === 'none') {
|
|
391
|
+
theme.headers_grid_color = theme.grid_color;
|
|
392
|
+
}
|
|
393
|
+
css = CSS('treb-offset-dark');
|
|
394
|
+
if (css.color) {
|
|
395
|
+
theme.offset_dark = css.color;
|
|
396
|
+
}
|
|
397
|
+
css = CSS('treb-offset-light');
|
|
398
|
+
if (css.color) {
|
|
399
|
+
theme.offset_light = css.color;
|
|
400
|
+
}
|
|
401
|
+
// this _is_ painted, but it doesn't necessarily need to be -- we
|
|
402
|
+
// could use a node. that would require moving it around, though.
|
|
403
|
+
// let's leave it for now.
|
|
404
|
+
css = CSS('note-marker');
|
|
405
|
+
theme.note_marker_color = css.backgroundColor;
|
|
406
|
+
// updating tables. we're now defining tables as Style.Properties
|
|
407
|
+
// directly. the aim is to use theme colors so we can have multiple
|
|
408
|
+
// table styles without too much fuss.
|
|
409
|
+
/*
|
|
410
|
+
const root_css = CSS('');
|
|
411
|
+
theme.table = {
|
|
412
|
+
header: TableStyleFromCSS(root_css, CSS('treb-table header')),
|
|
413
|
+
odd: TableStyleFromCSS(root_css, CSS('treb-table row-odd')),
|
|
414
|
+
even: TableStyleFromCSS(root_css, CSS('treb-table row-even')),
|
|
415
|
+
// footer: TableStyleFromCSS(root_css, CSS('treb-table footer')),
|
|
416
|
+
total: TableStyleFromCSS(root_css, CSS('treb-table total')),
|
|
417
|
+
}
|
|
418
|
+
*/
|
|
419
|
+
// console.info(theme.table);
|
|
420
|
+
// theme colors
|
|
421
|
+
node.style.color = 'rgba(1,2,3,.4)'; // this is an attempt at a unique identifier
|
|
422
|
+
css = CSS('');
|
|
423
|
+
const compare = css.color;
|
|
424
|
+
theme.theme_colors = [
|
|
425
|
+
IsHTMLColor(theme.grid_cell.fill) ? theme.grid_cell.fill.text : 'rgb(255, 255, 255)',
|
|
426
|
+
IsHTMLColor(theme.grid_cell.text) ? theme.grid_cell.text.text : 'rgb(51, 51, 51)',
|
|
427
|
+
];
|
|
428
|
+
for (let i = 1; i < 32; i++) {
|
|
429
|
+
css = CSS(`theme-color-${i}`);
|
|
430
|
+
if (!css.color || css.color === compare) {
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
theme.theme_colors.push(css.color);
|
|
434
|
+
}
|
|
435
|
+
// we could just parse, we know the returned css format is going
|
|
436
|
+
// to be an rgb triple (I think?)
|
|
437
|
+
const canvas = DOM.Create('canvas');
|
|
438
|
+
canvas.width = 3;
|
|
439
|
+
canvas.height = 3;
|
|
440
|
+
const context = canvas.getContext('2d', { willReadFrequently: true });
|
|
441
|
+
if (context) {
|
|
442
|
+
theme.mode = DeriveColorScheme(theme, context);
|
|
443
|
+
}
|
|
444
|
+
if (context) {
|
|
445
|
+
theme.theme_colors_rgb = theme.theme_colors.map((color) => {
|
|
446
|
+
context.fillStyle = color;
|
|
447
|
+
context.fillRect(0, 0, 3, 3);
|
|
448
|
+
const imagedata = context.getImageData(1, 1, 1, 1);
|
|
449
|
+
return Array.from(imagedata.data);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
theme.table = ThemeColorTable(4);
|
|
453
|
+
// this is a little odd, since we have the check above for "existing element";
|
|
454
|
+
// should we switch on that? or is that never used, and we can drop it? (...)
|
|
455
|
+
// console.info(node);
|
|
456
|
+
// console.info(theme);
|
|
457
|
+
node.parentElement?.removeChild(node);
|
|
458
|
+
return theme;
|
|
459
|
+
};
|
|
460
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRo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BAAgB,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACxD,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;YAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnD,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAA6B,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEjC,8EAA8E;IAC9E,6EAA6E;IAE7E,sBAAsB;IACtB,uBAAuB;IAEtB,IAAI,CAAC,aAAyB,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Complex, DimensionedQuantity } from './value-type';
|
|
2
|
+
import { ValueType } from './value-type';
|
|
3
|
+
export type CellValue = undefined | string | number | boolean | Complex | DimensionedQuantity;
|
|
4
|
+
/**
|
|
5
|
+
* utility method
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const Is2DArray: <T>(obj: undefined | T | T[] | T[][]) => obj is T[][];
|
|
10
|
+
export interface NumberUnion {
|
|
11
|
+
type: ValueType.number;
|
|
12
|
+
value: number;
|
|
13
|
+
}
|
|
14
|
+
export interface StringUnion {
|
|
15
|
+
type: ValueType.string;
|
|
16
|
+
value: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ErrorUnion {
|
|
19
|
+
type: ValueType.error;
|
|
20
|
+
value: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FormulaUnion {
|
|
23
|
+
type: ValueType.formula;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
export interface BooleanUnion {
|
|
27
|
+
type: ValueType.boolean;
|
|
28
|
+
value: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** we should have these for other types as well */
|
|
31
|
+
export interface ComplexUnion {
|
|
32
|
+
type: ValueType.complex;
|
|
33
|
+
value: Complex;
|
|
34
|
+
}
|
|
35
|
+
export interface DimensionedQuantityUnion {
|
|
36
|
+
type: ValueType.dimensioned_quantity;
|
|
37
|
+
value: DimensionedQuantity;
|
|
38
|
+
}
|
|
39
|
+
export interface UndefinedUnion {
|
|
40
|
+
type: ValueType.undefined;
|
|
41
|
+
value?: undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface ExtendedUnion {
|
|
44
|
+
type: ValueType.object;
|
|
45
|
+
value: unknown;
|
|
46
|
+
key?: string;
|
|
47
|
+
/** adding a source field so we can track */
|
|
48
|
+
source?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface FunctionUnion {
|
|
51
|
+
type: ValueType.function;
|
|
52
|
+
value: unknown;
|
|
53
|
+
}
|
|
54
|
+
/** potentially recursive structure */
|
|
55
|
+
export interface ArrayUnion {
|
|
56
|
+
type: ValueType.array;
|
|
57
|
+
value: UnionValue[][];
|
|
58
|
+
}
|
|
59
|
+
/** switch to a discriminated union. implicit type guards! */
|
|
60
|
+
export type UnionValue = NumberUnion | ArrayUnion | ComplexUnion | DimensionedQuantityUnion | ExtendedUnion | StringUnion | FormulaUnion | UndefinedUnion | BooleanUnion | FunctionUnion | ErrorUnion;
|
|
61
|
+
/**
|
|
62
|
+
* shortcut, although this is wasteful
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare const Box: (value: unknown, type?: ValueType) => UnionValue;
|
|
67
|
+
/**
|
|
68
|
+
* box a complex value in a union, potentially switching to a real if
|
|
69
|
+
* there's no imaginary component.
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare const ComplexOrReal: (value: Complex) => ComplexUnion | NumberUnion;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2026 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
import { ValueType, GetValueType } from './value-type';
|
|
22
|
+
/**
|
|
23
|
+
* utility method
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export const Is2DArray = (obj) => {
|
|
28
|
+
return !!obj && Array.isArray(obj) && Array.isArray(obj[0]);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* shortcut, although this is wasteful
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export const Box = (value, type) => {
|
|
36
|
+
// FIXME: type properly... instead of the GetValueType call
|
|
37
|
+
if (typeof type === 'undefined') {
|
|
38
|
+
type = GetValueType(value);
|
|
39
|
+
}
|
|
40
|
+
// assert?
|
|
41
|
+
return {
|
|
42
|
+
value,
|
|
43
|
+
type,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* box a complex value in a union, potentially switching to a real if
|
|
48
|
+
* there's no imaginary component.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export const ComplexOrReal = (value) => {
|
|
53
|
+
if (value.imaginary) {
|
|
54
|
+
return {
|
|
55
|
+
type: ValueType.complex,
|
|
56
|
+
value,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return { type: ValueType.number, value: value.real };
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=union.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../treb-base-types/src/union.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,GAA0B,EAAgB,EAAE;IACvE,OAAO,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAA;AAmFD;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAc,EAAE,IAAgB,EAAc,EAAE;IAElE,2DAA2D;IAE3D,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,IAAI,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,WAAW;IAEX,OAAO;QACL,KAAK;QACL,IAAI;KACS,CAAC;AAElB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAA4B,EAAE;IACxE,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,OAAO;YACL,IAAI,EAAE,SAAS,CAAC,OAAO;YACvB,KAAK;SACN,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC,CAAA"}
|