@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,93 @@
|
|
|
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 { UA } from 'treb-grid';
|
|
22
|
+
import { Measurement } from 'treb-utils';
|
|
23
|
+
import { Style } from './style';
|
|
24
|
+
/**
|
|
25
|
+
* these are the stacks we're currently supporting.
|
|
26
|
+
*/
|
|
27
|
+
export const font_stack_names = [
|
|
28
|
+
'default',
|
|
29
|
+
'old-style',
|
|
30
|
+
'transitional',
|
|
31
|
+
'handwritten',
|
|
32
|
+
'monospace',
|
|
33
|
+
'industrial',
|
|
34
|
+
'ui',
|
|
35
|
+
];
|
|
36
|
+
export const font_stack_labels = {
|
|
37
|
+
'default': 'Sans-serif',
|
|
38
|
+
'old-style': 'Old style',
|
|
39
|
+
'transitional': 'Serif',
|
|
40
|
+
'handwritten': 'Handwritten',
|
|
41
|
+
'monospace': 'Monospace',
|
|
42
|
+
'industrial': 'Industrial sans',
|
|
43
|
+
'ui': 'System UI',
|
|
44
|
+
};
|
|
45
|
+
const font_cache = new Map();
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param name - for reporting purposes only
|
|
49
|
+
* @param computed - computed css to resolve variables
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
export const GenerateFontStack = (name, computed) => {
|
|
53
|
+
const family = computed.fontFamily;
|
|
54
|
+
let font = '';
|
|
55
|
+
const elements = family.split(/,/);
|
|
56
|
+
for (let element of elements) {
|
|
57
|
+
element = element.replace(/'"/g, '').trim();
|
|
58
|
+
const lc = element.toLowerCase();
|
|
59
|
+
//
|
|
60
|
+
// platform-specific hacks. this is kind of unfortunate.
|
|
61
|
+
//
|
|
62
|
+
if (UA.is_firefox && /sitka text/i.test(lc)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let check = font_cache.get(lc);
|
|
66
|
+
if (typeof check === 'undefined') {
|
|
67
|
+
check = Measurement.FontLoaded(element);
|
|
68
|
+
font_cache.set(lc, check);
|
|
69
|
+
}
|
|
70
|
+
if (check) {
|
|
71
|
+
font = element;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!font) {
|
|
76
|
+
console.warn('no font found for font stack', name);
|
|
77
|
+
}
|
|
78
|
+
// check the base size, and any adjustments for this font
|
|
79
|
+
const variable_name = font.toLowerCase().replace(/['"]/g, '').replace(/\W+/g, '-');
|
|
80
|
+
const base = computed.getPropertyValue('--treb-font-stack-default-size');
|
|
81
|
+
const adjusted = computed.getPropertyValue(`--treb-font-stack-${variable_name}-size`);
|
|
82
|
+
const variants = computed.getPropertyValue(`--treb-font-stack-${variable_name}-variant`);
|
|
83
|
+
const size = Style.ParseFontSize(adjusted || base || '10pt').font_size || { unit: 'pt', value: 10 };
|
|
84
|
+
// console.info({stack: name, family, font, base, adjusted, size, variants});
|
|
85
|
+
const stack = {
|
|
86
|
+
family,
|
|
87
|
+
font,
|
|
88
|
+
variants,
|
|
89
|
+
size,
|
|
90
|
+
};
|
|
91
|
+
return stack;
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=font-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-stack.js","sourceRoot":"","sources":["../../../treb-base-types/src/font-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,EAAiB,MAAM,SAAS,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS;IACT,WAAW;IACX,cAAc;IACd,aAAa;IACb,WAAW;IACX,YAAY;IACZ,IAAI;CACI,CAAC;AAIX,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC9D,SAAS,EAAE,YAAY;IACvB,WAAW,EAAE,WA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,yDAAyD;IAEzD,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnF,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,CAAC;IACzE,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,qBAAqB,aAAa,OAAO,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,qBAAqB,aAAa,UAAU,CAAC,CAAC;IACzF,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEpG,6EAA6E;IAE7E,MAAM,KAAK,GAAG;QACZ,MAAM;QACN,IAAI;QACJ,QAAQ;QACR,IAAI;KACL,CAAC;IAEF,OAAO,KAAK,CAAC;AAEf,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Color } from './style';
|
|
2
|
+
import { type Theme } from './theme';
|
|
3
|
+
export interface GradientStop {
|
|
4
|
+
value: number;
|
|
5
|
+
color: Color;
|
|
6
|
+
}
|
|
7
|
+
export type ColorSpace = 'RGB' | 'HSL';
|
|
8
|
+
export declare class Gradient {
|
|
9
|
+
color_space: ColorSpace;
|
|
10
|
+
mapped: Array<GradientStop & {
|
|
11
|
+
resolved: number[];
|
|
12
|
+
}>;
|
|
13
|
+
constructor(stops: GradientStop[], theme: Theme, color_space?: ColorSpace);
|
|
14
|
+
RenderColor(values: number[]): {
|
|
15
|
+
text: string;
|
|
16
|
+
};
|
|
17
|
+
Interpolate(value: number): Color;
|
|
18
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { Measurement } from 'treb-utils';
|
|
22
|
+
import {} from './style';
|
|
23
|
+
import { ResolveThemeColor } from './theme';
|
|
24
|
+
import { ColorFunctions } from './color';
|
|
25
|
+
export class Gradient {
|
|
26
|
+
color_space;
|
|
27
|
+
mapped;
|
|
28
|
+
constructor(stops, theme, color_space = 'RGB') {
|
|
29
|
+
this.color_space = color_space;
|
|
30
|
+
this.mapped = stops.map(stop => {
|
|
31
|
+
if (stop.value < 0 || stop.value > 1) {
|
|
32
|
+
throw new Error('invalid stop value');
|
|
33
|
+
}
|
|
34
|
+
const rgb = Measurement.MeasureColor(ResolveThemeColor(theme, stop.color));
|
|
35
|
+
let resolved = [];
|
|
36
|
+
if (color_space === 'HSL') {
|
|
37
|
+
const hsl = ColorFunctions.RGBToHSL(rgb[0], rgb[1], rgb[2]);
|
|
38
|
+
resolved = [hsl.h, hsl.s, hsl.l];
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
resolved = [...rgb];
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...stop, resolved,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
this.mapped.sort((a, b) => a.value - b.value);
|
|
48
|
+
// FIXME: we should expand the gradient, but for now we'll just clamp
|
|
49
|
+
if (this.mapped[0].value > 0) {
|
|
50
|
+
this.mapped.unshift({
|
|
51
|
+
...this.mapped[0], value: 0
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (this.mapped[this.mapped.length - 1].value < 1) {
|
|
55
|
+
this.mapped.push({
|
|
56
|
+
...this.mapped[this.mapped.length - 1], value: 1
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
RenderColor(values) {
|
|
61
|
+
if (this.color_space === 'RGB') {
|
|
62
|
+
return { text: `rgb(${values})` };
|
|
63
|
+
}
|
|
64
|
+
return { text: `hsl(${values[0]},${values[1] * 100}%,${values[2] * 100}%)` };
|
|
65
|
+
}
|
|
66
|
+
Interpolate(value) {
|
|
67
|
+
value = Math.min(1, Math.max(0, value));
|
|
68
|
+
for (const [index, stop] of this.mapped.entries()) {
|
|
69
|
+
if (value === stop.value) {
|
|
70
|
+
return this.RenderColor(stop.resolved);
|
|
71
|
+
}
|
|
72
|
+
if (value < stop.value) {
|
|
73
|
+
const a = this.mapped[index - 1];
|
|
74
|
+
const b = stop;
|
|
75
|
+
const range = b.value - a.value; // FIXME: cache
|
|
76
|
+
const advance = value - a.value;
|
|
77
|
+
const values = [0, 1, 2].map(index => {
|
|
78
|
+
return a.resolved[index] + (b.resolved[index] - a.resolved[index]) / range * advance;
|
|
79
|
+
});
|
|
80
|
+
return this.RenderColor(values);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { text: '' };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","sourceRoot":"","sources":["../../../treb-base-types/src/gradient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EA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gBACzB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzC,CAAC;YACD,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;gBACvB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBACjC,MAAM,CAAC,GAAG,IAAI,CAAC;gBAEf,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe;gBAChD,MAAM,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;gBAEhC,MAAM,MAAM,GAAG,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBACjC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;gBACvF,CAAC,CAAC,CAAC;gBAEH,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAElC,CAAC;QACH,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAEtB,CAAC;CAEF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CellStyle, Color } from './style';
|
|
2
|
+
import type { SerializedValueType } from './value-type';
|
|
3
|
+
import type { IArea } from './area';
|
|
4
|
+
import type { AnnotationLayout } from './layout';
|
|
5
|
+
import type { Table } from './table';
|
|
6
|
+
import type { DataValidation, AnnotationType, ConditionalFormat } from 'treb-data-model';
|
|
7
|
+
export interface CellParseResult {
|
|
8
|
+
row: number;
|
|
9
|
+
column: number;
|
|
10
|
+
type: SerializedValueType;
|
|
11
|
+
value: number | string | undefined | boolean;
|
|
12
|
+
calculated?: number | string | undefined | boolean;
|
|
13
|
+
calculated_type?: SerializedValueType;
|
|
14
|
+
style_ref?: number;
|
|
15
|
+
hyperlink?: string;
|
|
16
|
+
validation?: DataValidation;
|
|
17
|
+
merge_area?: IArea;
|
|
18
|
+
area?: IArea;
|
|
19
|
+
/** dynamic arrays */
|
|
20
|
+
spill?: IArea;
|
|
21
|
+
table?: Table;
|
|
22
|
+
}
|
|
23
|
+
export interface AnchoredAnnotation {
|
|
24
|
+
layout: AnnotationLayout;
|
|
25
|
+
type?: AnnotationType;
|
|
26
|
+
formula?: string;
|
|
27
|
+
data?: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* this is moved from export to avoid a circular reference
|
|
31
|
+
*/
|
|
32
|
+
export interface ImportedSheetData {
|
|
33
|
+
name: string | undefined;
|
|
34
|
+
cells: CellParseResult[];
|
|
35
|
+
default_column_width: number;
|
|
36
|
+
column_widths: number[];
|
|
37
|
+
row_heights: number[];
|
|
38
|
+
styles: CellStyle[];
|
|
39
|
+
conditional_formats: ConditionalFormat[];
|
|
40
|
+
data_validations?: DataValidation[];
|
|
41
|
+
sheet_style?: number;
|
|
42
|
+
column_styles?: number[];
|
|
43
|
+
row_styles?: number[];
|
|
44
|
+
annotations?: AnchoredAnnotation[];
|
|
45
|
+
outline?: number[];
|
|
46
|
+
tab_color?: Color;
|
|
47
|
+
hidden?: boolean;
|
|
48
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../treb-base-types/src/import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
/**
|
|
22
|
+
* this is a special index for inclusion in the standalone format lib
|
|
23
|
+
*/
|
|
24
|
+
export * from './localization';
|
|
25
|
+
export * from './text_part';
|
|
26
|
+
export * from './value-type';
|
|
27
|
+
//# sourceMappingURL=index-standalone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-standalone.js","sourceRoot":"","sources":["../../../treb-base-types/src/index-standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;GAEG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './area';
|
|
2
|
+
export * from './cell';
|
|
3
|
+
export * from './cells';
|
|
4
|
+
export * from './localization';
|
|
5
|
+
export * from './basic_types';
|
|
6
|
+
export * from './rectangle';
|
|
7
|
+
export * from './style';
|
|
8
|
+
export * from './text_part';
|
|
9
|
+
export * from './import';
|
|
10
|
+
export * from './union';
|
|
11
|
+
export * from './value-type';
|
|
12
|
+
export * from './theme';
|
|
13
|
+
export * from './color';
|
|
14
|
+
export * from './layout';
|
|
15
|
+
export * from './render_text';
|
|
16
|
+
export * from './api_types';
|
|
17
|
+
export * from './table';
|
|
18
|
+
export * from './gradient';
|
|
19
|
+
export * from './evaluate-options';
|
|
20
|
+
export * from './dom-utilities';
|
|
21
|
+
export * from './worker-proxy';
|
|
22
|
+
export * as AreaUtils from './area-utils';
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
export * from './area';
|
|
22
|
+
export * from './cell';
|
|
23
|
+
export * from './cells';
|
|
24
|
+
export * from './localization';
|
|
25
|
+
export * from './basic_types';
|
|
26
|
+
export * from './rectangle';
|
|
27
|
+
export * from './style';
|
|
28
|
+
export * from './text_part';
|
|
29
|
+
export * from './import';
|
|
30
|
+
export * from './union';
|
|
31
|
+
export * from './value-type';
|
|
32
|
+
export * from './theme';
|
|
33
|
+
export * from './color';
|
|
34
|
+
export * from './layout';
|
|
35
|
+
export * from './render_text';
|
|
36
|
+
export * from './api_types';
|
|
37
|
+
export * from './table';
|
|
38
|
+
export * from './gradient';
|
|
39
|
+
export * from './evaluate-options';
|
|
40
|
+
export * from './dom-utilities';
|
|
41
|
+
export * from './worker-proxy';
|
|
42
|
+
export * as AreaUtils from './area-utils';
|
|
43
|
+
// import * as Style from './style';
|
|
44
|
+
// export { Style };
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../treb-base-types/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,oCAAoC;AACpC,oBAAoB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ICellAddress } from './area';
|
|
2
|
+
/**
|
|
3
|
+
* offset from corner, as % of cell
|
|
4
|
+
*/
|
|
5
|
+
export interface AddressOffset {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* represents one corner of a layout rectangle
|
|
11
|
+
*/
|
|
12
|
+
export interface Corner {
|
|
13
|
+
address: ICellAddress;
|
|
14
|
+
offset: AddressOffset;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* represents the layout of an annotation, reference to the sheet
|
|
18
|
+
*/
|
|
19
|
+
export interface AnnotationLayout {
|
|
20
|
+
tl: Corner;
|
|
21
|
+
br: Corner;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../treb-base-types/src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* the point of localization is to have a central, single source of truth
|
|
3
|
+
* for the current locale. this can come from the browser, via a GET
|
|
4
|
+
* parameter (mostly for testing), or explicitly from a method call.
|
|
5
|
+
*
|
|
6
|
+
* based on locale we report settings for decimal separator, digit grouping,
|
|
7
|
+
* and argument separator.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Localization {
|
|
10
|
+
static locale: string;
|
|
11
|
+
static decimal_separator: ('.' | ',');
|
|
12
|
+
static argument_separator: ',' | ';';
|
|
13
|
+
static grouping_separator: ',' | ' ';
|
|
14
|
+
static date_components: {
|
|
15
|
+
short_days: string[];
|
|
16
|
+
long_days: string[];
|
|
17
|
+
short_months: string[];
|
|
18
|
+
long_months: string[];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* update the locale. this will be called on module load (should
|
|
22
|
+
* be just once), but can be called subsequently to update.
|
|
23
|
+
*
|
|
24
|
+
* priority:
|
|
25
|
+
* (1) function argument
|
|
26
|
+
* (2) get parameter
|
|
27
|
+
* (3) navigator.languages[0]
|
|
28
|
+
* (4) navigator.language
|
|
29
|
+
*
|
|
30
|
+
* regarding languages[0] vs language, see
|
|
31
|
+
* https://stackoverflow.com/a/33204290
|
|
32
|
+
*
|
|
33
|
+
* @param locale explicitly set locale
|
|
34
|
+
*/
|
|
35
|
+
static UpdateLocale(locale?: string): void;
|
|
36
|
+
private static UpdateDateComponent;
|
|
37
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
/**
|
|
22
|
+
* the point of localization is to have a central, single source of truth
|
|
23
|
+
* for the current locale. this can come from the browser, via a GET
|
|
24
|
+
* parameter (mostly for testing), or explicitly from a method call.
|
|
25
|
+
*
|
|
26
|
+
* based on locale we report settings for decimal separator, digit grouping,
|
|
27
|
+
* and argument separator.
|
|
28
|
+
*/
|
|
29
|
+
export class Localization {
|
|
30
|
+
static locale = 'en-us'; // default, for node
|
|
31
|
+
static decimal_separator = '.';
|
|
32
|
+
static argument_separator = ',';
|
|
33
|
+
static grouping_separator = ',';
|
|
34
|
+
static date_components = {
|
|
35
|
+
short_days: [
|
|
36
|
+
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
|
37
|
+
],
|
|
38
|
+
long_days: [
|
|
39
|
+
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
|
|
40
|
+
],
|
|
41
|
+
short_months: [
|
|
42
|
+
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
|
43
|
+
],
|
|
44
|
+
long_months: [
|
|
45
|
+
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
|
|
46
|
+
'September', 'October', 'November', 'December',
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* update the locale. this will be called on module load (should
|
|
51
|
+
* be just once), but can be called subsequently to update.
|
|
52
|
+
*
|
|
53
|
+
* priority:
|
|
54
|
+
* (1) function argument
|
|
55
|
+
* (2) get parameter
|
|
56
|
+
* (3) navigator.languages[0]
|
|
57
|
+
* (4) navigator.language
|
|
58
|
+
*
|
|
59
|
+
* regarding languages[0] vs language, see
|
|
60
|
+
* https://stackoverflow.com/a/33204290
|
|
61
|
+
*
|
|
62
|
+
* @param locale explicitly set locale
|
|
63
|
+
*/
|
|
64
|
+
static UpdateLocale(locale) {
|
|
65
|
+
if (locale) {
|
|
66
|
+
this.locale = locale; // 1
|
|
67
|
+
}
|
|
68
|
+
else if (typeof self !== 'undefined') {
|
|
69
|
+
// const location = ((typeof self === 'undefined' || typeof self.document === 'undefined') ?
|
|
70
|
+
// undefined : self.document.location);
|
|
71
|
+
const location = self?.document?.location;
|
|
72
|
+
if (location && location.search &&
|
|
73
|
+
/locale=([^?&]+?)(?:\?|$|&)/.test(location.search)) {
|
|
74
|
+
const match = location.search.match(/locale=(.*?)(?:\?|$|&)/);
|
|
75
|
+
if (match)
|
|
76
|
+
this.locale = match[1];
|
|
77
|
+
console.info('override locale', this.locale);
|
|
78
|
+
}
|
|
79
|
+
else if (typeof navigator !== 'undefined') {
|
|
80
|
+
if (navigator.languages && navigator.languages[0]) {
|
|
81
|
+
this.locale = navigator.languages[0];
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.locale = navigator.language;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// don't allow the "C" locale
|
|
89
|
+
if (this.locale === 'C') {
|
|
90
|
+
console.warn('Locale not set, defaulting to en-us');
|
|
91
|
+
this.locale = 'en-us';
|
|
92
|
+
}
|
|
93
|
+
const decimal_separator = new Intl.NumberFormat(this.locale, { minimumFractionDigits: 1 }).format(3.3).replace(/\d/g, '');
|
|
94
|
+
this.decimal_separator = (decimal_separator === ',') ? ',' : '.';
|
|
95
|
+
if (this.decimal_separator === ',') {
|
|
96
|
+
this.argument_separator = ';';
|
|
97
|
+
// FIXME: should be half-space (char?)
|
|
98
|
+
//
|
|
99
|
+
// the appropriate character (I think) is \u2009, "thin space", but
|
|
100
|
+
// it seems to be rendered as full-width space in monospace fonts --
|
|
101
|
+
// which makes sense -- and since we mostly use those it's probably
|
|
102
|
+
// immaterial.
|
|
103
|
+
//
|
|
104
|
+
// it might be useful for fonts with variable-width characters but
|
|
105
|
+
// tabular numbers, in which case we would want to use it.
|
|
106
|
+
//
|
|
107
|
+
// FIXME: does format use this field, or does it have its own? (...)
|
|
108
|
+
this.grouping_separator = ' ';
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.argument_separator = ',';
|
|
112
|
+
this.grouping_separator = ',';
|
|
113
|
+
}
|
|
114
|
+
// moved from number format lib
|
|
115
|
+
let date = new Date(2000, 0, 2, 12, 0, 0, 0); // Sun Jan 2
|
|
116
|
+
this.UpdateDateComponent(0, 0, date);
|
|
117
|
+
date = new Date(2000, 1, 7, 12, 0, 0, 0); // Mon Feb 7
|
|
118
|
+
this.UpdateDateComponent(1, 1, date);
|
|
119
|
+
date = new Date(2000, 2, 7, 12, 0, 0, 0); // Tue Mar 7
|
|
120
|
+
this.UpdateDateComponent(2, 2, date);
|
|
121
|
+
date = new Date(2000, 3, 5, 12, 0, 0, 0); // Wed Apr 5
|
|
122
|
+
this.UpdateDateComponent(3, 3, date);
|
|
123
|
+
date = new Date(2000, 4, 4, 12, 0, 0, 0); // Thur May 4
|
|
124
|
+
this.UpdateDateComponent(4, 4, date);
|
|
125
|
+
date = new Date(2000, 5, 2, 12, 0, 0, 0); // Fri Jun 2
|
|
126
|
+
this.UpdateDateComponent(5, 5, date);
|
|
127
|
+
date = new Date(2000, 6, 1, 12, 0, 0, 0); // Sat Jul 1
|
|
128
|
+
this.UpdateDateComponent(6, 6, date);
|
|
129
|
+
date = new Date(2000, 7, 1, 12, 0, 0, 0); // Aug
|
|
130
|
+
this.UpdateDateComponent(7, -1, date);
|
|
131
|
+
date = new Date(2000, 8, 1, 12, 0, 0, 0); // Sep
|
|
132
|
+
this.UpdateDateComponent(8, -1, date);
|
|
133
|
+
date = new Date(2000, 9, 1, 12, 0, 0, 0); // Oct
|
|
134
|
+
this.UpdateDateComponent(9, -1, date);
|
|
135
|
+
date = new Date(2000, 10, 1, 12, 0, 0, 0); // Nov
|
|
136
|
+
this.UpdateDateComponent(10, -1, date);
|
|
137
|
+
date = new Date(2000, 11, 1, 12, 0, 0, 0); // Dec
|
|
138
|
+
this.UpdateDateComponent(11, -1, date);
|
|
139
|
+
/*
|
|
140
|
+
console.info('LX', this.locale, this.date_components.short_days,
|
|
141
|
+
this.date_components.long_days, this.date_components.short_months,
|
|
142
|
+
this.date_components.long_months);
|
|
143
|
+
*/
|
|
144
|
+
}
|
|
145
|
+
static UpdateDateComponent(month_index, day_index, date) {
|
|
146
|
+
if (day_index >= 0) {
|
|
147
|
+
this.date_components.short_days[day_index] = date.toLocaleString(this.locale, { weekday: 'short' });
|
|
148
|
+
this.date_components.long_days[day_index] = date.toLocaleString(this.locale, { weekday: 'long' });
|
|
149
|
+
}
|
|
150
|
+
if (month_index >= 0) {
|
|
151
|
+
this.date_components.short_months[month_index] = date.toLocaleString(this.locale, { month: 'short' });
|
|
152
|
+
this.date_components.long_months[month_index] = date.toLocaleString(this.locale, { month: 'long' });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
Localization.UpdateLocale(); // always call
|
|
157
|
+
//# sourceMappingURL=localization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.js","sourceRoot":"","sources":["../../../treb-base-types/src/localization.ts"],"names":[],"mappings":"AAAA;;;;;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