@trebco/treb 23.6.5 → 25.0.0-rc2
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/.eslintignore +8 -0
- package/.eslintrc.js +164 -0
- package/README-shadow-DOM.md +88 -0
- package/README.md +37 -130
- package/api-config.json +29 -0
- package/api-generator/api-generator-types.ts +82 -0
- package/api-generator/api-generator.ts +1172 -0
- package/api-generator/package.json +3 -0
- package/build/treb-spreadsheet.mjs +14 -0
- package/{treb.d.ts → build/treb.d.ts} +323 -271
- package/esbuild-custom-element.mjs +336 -0
- package/esbuild.js +305 -0
- package/package.json +49 -14
- package/treb-base-types/package.json +5 -0
- package/treb-base-types/src/api_types.ts +36 -0
- package/treb-base-types/src/area.ts +583 -0
- package/treb-base-types/src/basic_types.ts +45 -0
- package/treb-base-types/src/cell.ts +612 -0
- package/treb-base-types/src/cells.ts +1066 -0
- package/treb-base-types/src/color.ts +124 -0
- package/treb-base-types/src/import.ts +71 -0
- package/treb-base-types/src/index-standalone.ts +29 -0
- package/treb-base-types/src/index.ts +42 -0
- package/treb-base-types/src/layout.ts +47 -0
- package/treb-base-types/src/localization.ts +187 -0
- package/treb-base-types/src/rectangle.ts +145 -0
- package/treb-base-types/src/render_text.ts +72 -0
- package/treb-base-types/src/style.ts +545 -0
- package/treb-base-types/src/table.ts +109 -0
- package/treb-base-types/src/text_part.ts +54 -0
- package/treb-base-types/src/theme.ts +608 -0
- package/treb-base-types/src/union.ts +152 -0
- package/treb-base-types/src/value-type.ts +164 -0
- package/treb-base-types/style/resizable.css +59 -0
- package/treb-calculator/modern.tsconfig.json +11 -0
- package/treb-calculator/package.json +5 -0
- package/treb-calculator/src/calculator.ts +2546 -0
- package/treb-calculator/src/complex-math.ts +558 -0
- package/treb-calculator/src/dag/array-vertex.ts +198 -0
- package/treb-calculator/src/dag/graph.ts +951 -0
- package/treb-calculator/src/dag/leaf_vertex.ts +118 -0
- package/treb-calculator/src/dag/spreadsheet_vertex.ts +327 -0
- package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +44 -0
- package/treb-calculator/src/dag/vertex.ts +352 -0
- package/treb-calculator/src/descriptors.ts +162 -0
- package/treb-calculator/src/expression-calculator.ts +1069 -0
- package/treb-calculator/src/function-error.ts +103 -0
- package/treb-calculator/src/function-library.ts +103 -0
- package/treb-calculator/src/functions/base-functions.ts +1214 -0
- package/treb-calculator/src/functions/checkbox.ts +164 -0
- package/treb-calculator/src/functions/complex-functions.ts +253 -0
- package/treb-calculator/src/functions/finance-functions.ts +399 -0
- package/treb-calculator/src/functions/information-functions.ts +102 -0
- package/treb-calculator/src/functions/matrix-functions.ts +182 -0
- package/treb-calculator/src/functions/sparkline.ts +335 -0
- package/treb-calculator/src/functions/statistics-functions.ts +350 -0
- package/treb-calculator/src/functions/text-functions.ts +298 -0
- package/treb-calculator/src/index.ts +27 -0
- package/treb-calculator/src/notifier-types.ts +59 -0
- package/treb-calculator/src/primitives.ts +428 -0
- package/treb-calculator/src/utilities.ts +305 -0
- package/treb-charts/package.json +5 -0
- package/treb-charts/src/chart-functions.ts +156 -0
- package/treb-charts/src/chart-types.ts +230 -0
- package/treb-charts/src/chart.ts +1288 -0
- package/treb-charts/src/index.ts +24 -0
- package/treb-charts/src/main.ts +37 -0
- package/treb-charts/src/rectangle.ts +52 -0
- package/treb-charts/src/renderer.ts +1841 -0
- package/treb-charts/src/util.ts +122 -0
- package/treb-charts/style/charts.scss +221 -0
- package/treb-charts/style/old-charts.scss +250 -0
- package/treb-embed/markup/layout.html +137 -0
- package/treb-embed/markup/toolbar.html +175 -0
- package/treb-embed/modern.tsconfig.json +25 -0
- package/treb-embed/src/custom-element/content-types.d.ts +18 -0
- package/treb-embed/src/custom-element/global.d.ts +11 -0
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1228 -0
- package/treb-embed/src/custom-element/treb-global.ts +44 -0
- package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +52 -0
- package/treb-embed/src/embedded-spreadsheet.ts +5358 -0
- package/treb-embed/src/index.ts +16 -0
- package/treb-embed/src/language-model.ts +41 -0
- package/treb-embed/src/options.ts +298 -0
- package/treb-embed/src/progress-dialog.ts +228 -0
- package/treb-embed/src/selection-state.ts +16 -0
- package/treb-embed/src/spinner.ts +42 -0
- package/treb-embed/src/toolbar-message.ts +96 -0
- package/treb-embed/src/types.ts +167 -0
- package/treb-embed/style/autocomplete.scss +103 -0
- package/treb-embed/style/dark-theme.scss +114 -0
- package/treb-embed/style/defaults.scss +36 -0
- package/treb-embed/style/dialog.scss +181 -0
- package/treb-embed/style/dropdown-select.scss +101 -0
- package/treb-embed/style/formula-bar.scss +193 -0
- package/treb-embed/style/grid.scss +374 -0
- package/treb-embed/style/layout.scss +424 -0
- package/treb-embed/style/mouse-mask.scss +67 -0
- package/treb-embed/style/note.scss +92 -0
- package/treb-embed/style/overlay-editor.scss +102 -0
- package/treb-embed/style/spinner.scss +92 -0
- package/treb-embed/style/tab-bar.scss +228 -0
- package/treb-embed/style/table.scss +80 -0
- package/treb-embed/style/theme-defaults.scss +444 -0
- package/treb-embed/style/toolbar.scss +416 -0
- package/treb-embed/style/tooltip.scss +68 -0
- package/treb-embed/style/treb-icons.scss +130 -0
- package/treb-embed/style/treb-spreadsheet-element.scss +20 -0
- package/treb-embed/style/z-index.scss +43 -0
- package/treb-export/docs/charts.md +68 -0
- package/treb-export/modern.tsconfig.json +19 -0
- package/treb-export/package.json +4 -0
- package/treb-export/src/address-type.ts +77 -0
- package/treb-export/src/base-template.ts +22 -0
- package/treb-export/src/column-width.ts +85 -0
- package/treb-export/src/drawing2/chart-template-components2.ts +389 -0
- package/treb-export/src/drawing2/chart2.ts +282 -0
- package/treb-export/src/drawing2/column-chart-template2.ts +521 -0
- package/treb-export/src/drawing2/donut-chart-template2.ts +296 -0
- package/treb-export/src/drawing2/drawing2.ts +355 -0
- package/treb-export/src/drawing2/embedded-image.ts +71 -0
- package/treb-export/src/drawing2/scatter-chart-template2.ts +555 -0
- package/treb-export/src/export-worker/export-worker.ts +99 -0
- package/treb-export/src/export-worker/index-modern.ts +22 -0
- package/treb-export/src/export2.ts +2204 -0
- package/treb-export/src/import2.ts +882 -0
- package/treb-export/src/relationship.ts +36 -0
- package/treb-export/src/shared-strings2.ts +128 -0
- package/treb-export/src/template-2.ts +22 -0
- package/treb-export/src/unescape_xml.ts +47 -0
- package/treb-export/src/workbook-sheet2.ts +182 -0
- package/treb-export/src/workbook-style2.ts +1285 -0
- package/treb-export/src/workbook-theme2.ts +88 -0
- package/treb-export/src/workbook2.ts +491 -0
- package/treb-export/src/xml-utils.ts +201 -0
- package/treb-export/template/base/[Content_Types].xml +2 -0
- package/treb-export/template/base/_rels/.rels +2 -0
- package/treb-export/template/base/docProps/app.xml +2 -0
- package/treb-export/template/base/docProps/core.xml +12 -0
- package/treb-export/template/base/xl/_rels/workbook.xml.rels +2 -0
- package/treb-export/template/base/xl/sharedStrings.xml +2 -0
- package/treb-export/template/base/xl/styles.xml +2 -0
- package/treb-export/template/base/xl/theme/theme1.xml +2 -0
- package/treb-export/template/base/xl/workbook.xml +2 -0
- package/treb-export/template/base/xl/worksheets/sheet1.xml +2 -0
- package/treb-export/template/base.xlsx +0 -0
- package/treb-format/package.json +8 -0
- package/treb-format/src/format.test.ts +213 -0
- package/treb-format/src/format.ts +942 -0
- package/treb-format/src/format_cache.ts +199 -0
- package/treb-format/src/format_parser.ts +723 -0
- package/treb-format/src/index.ts +25 -0
- package/treb-format/src/number_format_section.ts +100 -0
- package/treb-format/src/value_parser.ts +337 -0
- package/treb-grid/package.json +5 -0
- package/treb-grid/src/editors/autocomplete.ts +394 -0
- package/treb-grid/src/editors/autocomplete_matcher.ts +260 -0
- package/treb-grid/src/editors/formula_bar.ts +473 -0
- package/treb-grid/src/editors/formula_editor_base.ts +910 -0
- package/treb-grid/src/editors/overlay_editor.ts +511 -0
- package/treb-grid/src/index.ts +37 -0
- package/treb-grid/src/layout/base_layout.ts +2618 -0
- package/treb-grid/src/layout/grid_layout.ts +299 -0
- package/treb-grid/src/layout/rectangle_cache.ts +86 -0
- package/treb-grid/src/render/selection-renderer.ts +414 -0
- package/treb-grid/src/render/svg_header_overlay.ts +93 -0
- package/treb-grid/src/render/svg_selection_block.ts +187 -0
- package/treb-grid/src/render/tile_renderer.ts +2122 -0
- package/treb-grid/src/types/annotation.ts +216 -0
- package/treb-grid/src/types/border_constants.ts +34 -0
- package/treb-grid/src/types/clipboard_data.ts +31 -0
- package/treb-grid/src/types/data_model.ts +334 -0
- package/treb-grid/src/types/drag_mask.ts +81 -0
- package/treb-grid/src/types/grid.ts +7743 -0
- package/treb-grid/src/types/grid_base.ts +3644 -0
- package/treb-grid/src/types/grid_command.ts +470 -0
- package/treb-grid/src/types/grid_events.ts +124 -0
- package/treb-grid/src/types/grid_options.ts +97 -0
- package/treb-grid/src/types/grid_selection.ts +60 -0
- package/treb-grid/src/types/named_range.ts +369 -0
- package/treb-grid/src/types/scale-control.ts +202 -0
- package/treb-grid/src/types/serialize_options.ts +72 -0
- package/treb-grid/src/types/set_range_options.ts +52 -0
- package/treb-grid/src/types/sheet.ts +3099 -0
- package/treb-grid/src/types/sheet_types.ts +95 -0
- package/treb-grid/src/types/tab_bar.ts +464 -0
- package/treb-grid/src/types/tile.ts +59 -0
- package/treb-grid/src/types/update_flags.ts +75 -0
- package/treb-grid/src/util/dom_utilities.ts +44 -0
- package/treb-grid/src/util/fontmetrics2.ts +179 -0
- package/treb-grid/src/util/ua.ts +104 -0
- package/treb-logo.svg +18 -0
- package/treb-parser/package.json +5 -0
- package/treb-parser/src/csv-parser.ts +122 -0
- package/treb-parser/src/index.ts +25 -0
- package/treb-parser/src/md-parser.ts +526 -0
- package/treb-parser/src/parser-types.ts +397 -0
- package/treb-parser/src/parser.test.ts +298 -0
- package/treb-parser/src/parser.ts +2673 -0
- package/treb-utils/package.json +5 -0
- package/treb-utils/src/dispatch.ts +57 -0
- package/treb-utils/src/event_source.ts +147 -0
- package/treb-utils/src/ievent_source.ts +33 -0
- package/treb-utils/src/index.ts +31 -0
- package/treb-utils/src/measurement.ts +174 -0
- package/treb-utils/src/resizable.ts +160 -0
- package/treb-utils/src/scale.ts +137 -0
- package/treb-utils/src/serialize_html.ts +124 -0
- package/treb-utils/src/template.ts +70 -0
- package/treb-utils/src/validate_uri.ts +61 -0
- package/tsconfig.json +10 -0
- package/tsproject.json +30 -0
- package/util/license-plugin-esbuild.js +86 -0
- package/util/list-css-vars.sh +46 -0
- package/README-esm.md +0 -37
- package/treb-bundle.css +0 -2
- package/treb-bundle.mjs +0 -15
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
'browser': true,
|
|
4
|
+
'node': true,
|
|
5
|
+
},
|
|
6
|
+
root: true,
|
|
7
|
+
parser: '@typescript-eslint/parser',
|
|
8
|
+
plugins: [
|
|
9
|
+
'@typescript-eslint',
|
|
10
|
+
],
|
|
11
|
+
extends: [
|
|
12
|
+
'eslint:recommended',
|
|
13
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
14
|
+
'plugin:@typescript-eslint/recommended',
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
rules: {
|
|
18
|
+
'no-irregular-whitespace': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
skipComments: true,
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
'camelcase': 'off',
|
|
25
|
+
'@typescript-eslint/camelcase': 'off',
|
|
26
|
+
// '@typescript-eslint/explicit-function-return-type': 'off',
|
|
27
|
+
'@typescript-eslint/quotes': [
|
|
28
|
+
'error',
|
|
29
|
+
'single',
|
|
30
|
+
{ 'allowTemplateLiterals': true },
|
|
31
|
+
],
|
|
32
|
+
'brace-style': 'off',
|
|
33
|
+
'@typescript-eslint/brace-style': [
|
|
34
|
+
'error',
|
|
35
|
+
'stroustrup',
|
|
36
|
+
{ 'allowSingleLine': true },
|
|
37
|
+
],
|
|
38
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
39
|
+
|
|
40
|
+
/*
|
|
41
|
+
|
|
42
|
+
FIXME: needs configuration. I'm ok with it generally but why split
|
|
43
|
+
accessors for the same field?
|
|
44
|
+
|
|
45
|
+
UPDATE: see also https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
46
|
+
|
|
47
|
+
not sure how these work together
|
|
48
|
+
|
|
49
|
+
'@typescript-eslint/member-ordering': [
|
|
50
|
+
'error',
|
|
51
|
+
],
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
"rules": {
|
|
60
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
61
|
+
"@typescript-eslint/array-type": "error",
|
|
62
|
+
"@typescript-eslint/ban-types": "error",
|
|
63
|
+
"@typescript-eslint/class-name-casing": "error",
|
|
64
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
65
|
+
"@typescript-eslint/indent": [
|
|
66
|
+
2
|
|
67
|
+
],
|
|
68
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
69
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
70
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
71
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
72
|
+
"@typescript-eslint/no-namespace": "error",
|
|
73
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
|
74
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
75
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
76
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
77
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
78
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
79
|
+
"@typescript-eslint/quotes": [
|
|
80
|
+
"error",
|
|
81
|
+
"single"
|
|
82
|
+
],
|
|
83
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
84
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
85
|
+
"camelcase": "off",
|
|
86
|
+
"complexity": "off",
|
|
87
|
+
"constructor-super": "error",
|
|
88
|
+
"curly": [
|
|
89
|
+
"error",
|
|
90
|
+
"multi-line"
|
|
91
|
+
],
|
|
92
|
+
"dot-notation": "error",
|
|
93
|
+
"eqeqeq": [
|
|
94
|
+
"error",
|
|
95
|
+
"smart"
|
|
96
|
+
],
|
|
97
|
+
"guard-for-in": "error",
|
|
98
|
+
"id-blacklist": "error",
|
|
99
|
+
"id-match": "error",
|
|
100
|
+
"import/order": "off",
|
|
101
|
+
"max-classes-per-file": [
|
|
102
|
+
"error",
|
|
103
|
+
1
|
|
104
|
+
],
|
|
105
|
+
"new-parens": "error",
|
|
106
|
+
"no-bitwise": "error",
|
|
107
|
+
"no-caller": "error",
|
|
108
|
+
"no-cond-assign": "error",
|
|
109
|
+
"no-console": "off",
|
|
110
|
+
"no-debugger": "error",
|
|
111
|
+
"no-empty": "error",
|
|
112
|
+
"no-eval": "error",
|
|
113
|
+
"no-fallthrough": "off",
|
|
114
|
+
"no-invalid-this": "off",
|
|
115
|
+
"no-multiple-empty-lines": "off",
|
|
116
|
+
"no-new-wrappers": "error",
|
|
117
|
+
"no-shadow": [
|
|
118
|
+
"error",
|
|
119
|
+
{
|
|
120
|
+
"hoist": "all"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"no-throw-literal": "error",
|
|
124
|
+
"no-trailing-spaces": "error",
|
|
125
|
+
"no-undef-init": "error",
|
|
126
|
+
"no-underscore-dangle": "error",
|
|
127
|
+
"no-unsafe-finally": "error",
|
|
128
|
+
"no-unused-expressions": "error",
|
|
129
|
+
"no-unused-labels": "error",
|
|
130
|
+
"no-var": "error",
|
|
131
|
+
"object-shorthand": "error",
|
|
132
|
+
"one-var": [
|
|
133
|
+
"error",
|
|
134
|
+
"never"
|
|
135
|
+
],
|
|
136
|
+
"prefer-arrow/prefer-arrow-functions": "error",
|
|
137
|
+
"prefer-const": "error",
|
|
138
|
+
"quote-props": [
|
|
139
|
+
"error",
|
|
140
|
+
"as-needed"
|
|
141
|
+
],
|
|
142
|
+
"radix": "error",
|
|
143
|
+
"spaced-comment": "error",
|
|
144
|
+
"use-isnan": "error",
|
|
145
|
+
"valid-typeof": "off",
|
|
146
|
+
|
|
147
|
+
/ *
|
|
148
|
+
"@typescript-eslint/tslint/config": [
|
|
149
|
+
"error",
|
|
150
|
+
{
|
|
151
|
+
"rules": {
|
|
152
|
+
"jsdoc-format": true,
|
|
153
|
+
"no-reference-import": true,
|
|
154
|
+
"one-line": [
|
|
155
|
+
true,
|
|
156
|
+
"check-open-brace"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
* /
|
|
162
|
+
}
|
|
163
|
+
*/
|
|
164
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
### Note on shadow DOM
|
|
3
|
+
Date: March 4 2023
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
I spent the last couple of weeks building TREB as a custom element using
|
|
8
|
+
shadow DOM.
|
|
9
|
+
|
|
10
|
+
The benefits of shadow DOM would be tremendous, particularly style isolation.
|
|
11
|
+
But ultimately there are just too many things broken for this to be practical
|
|
12
|
+
as of today (March 2023). We can revisit in the future.
|
|
13
|
+
|
|
14
|
+
### Selection
|
|
15
|
+
|
|
16
|
+
Selection behaves differently in various browsers. Specifically the issue
|
|
17
|
+
arises when we try to get the current selection. We primarily use selections
|
|
18
|
+
when typing spreadsheet formula. This happens in either the formula bar or
|
|
19
|
+
the overlay editor (replacement for the old in-cell editor).
|
|
20
|
+
|
|
21
|
+
We typically check the selection in order to get the caret position. We use
|
|
22
|
+
the caret position and the entered text to highlight references in formulas
|
|
23
|
+
and to insert references when mouse-selecting.
|
|
24
|
+
|
|
25
|
+
#### Cross-browser selection
|
|
26
|
+
|
|
27
|
+
The standard way to get the selection, in light DOM, is `Window.getSelection`.
|
|
28
|
+
|
|
29
|
+
In Firefox this still works in shadow DOM. It does not work in Chrome, but
|
|
30
|
+
they add a nonstandard method to the shadow root so `ShadowRoot.getSelection`
|
|
31
|
+
works instead.
|
|
32
|
+
|
|
33
|
+
Safari supports neither. We can hack our way around this in Safari using the
|
|
34
|
+
`beforeinput` event, which will give you the selection on a particular
|
|
35
|
+
component. We wrote a helper class that would allow you to get the selection
|
|
36
|
+
by sending an event to the component and then blocking any component update,
|
|
37
|
+
but collecting the selection from the event.
|
|
38
|
+
|
|
39
|
+
That Safari fix required making our `GetSelection` method asynchronous, which
|
|
40
|
+
changed a lot of code paths but which was ultimately not a huge problem.
|
|
41
|
+
|
|
42
|
+
#### Potential resolution
|
|
43
|
+
|
|
44
|
+
We could live with our workaround. There is a proposal for a standar fix,
|
|
45
|
+
|
|
46
|
+
https://github.com/WICG/webcomponents/issues/79
|
|
47
|
+
|
|
48
|
+
but that proposal is already 8 years old and shows no sign of moving.
|
|
49
|
+
|
|
50
|
+
### Focus/typing
|
|
51
|
+
|
|
52
|
+
Focus and typing was the big blocker. For the most part this seems to work
|
|
53
|
+
correctly in Chrome. Safari was not fully investigated. Firefox is completely
|
|
54
|
+
broken.
|
|
55
|
+
|
|
56
|
+
Among other things, Firefox doesn't support changing selection between light
|
|
57
|
+
DOM and shadow DOM elements:
|
|
58
|
+
|
|
59
|
+
https://bugzilla.mozilla.org/show_bug.cgi?id=1685300
|
|
60
|
+
https://bugzilla.mozilla.org/show_bug.cgi?id=1496769
|
|
61
|
+
|
|
62
|
+
That results in the cursor not showing up, or the text not being editable, or
|
|
63
|
+
the element not being selectable at all.
|
|
64
|
+
|
|
65
|
+
This bug is 5 years old, the latest comment is ~8 months old at this point
|
|
66
|
+
and there doesn't seem to be any movement on it.
|
|
67
|
+
|
|
68
|
+
Additionally some elements would randomly change to RTL when editing text. I
|
|
69
|
+
couldn't find a bug tracking this and did not fully investigate, but setting
|
|
70
|
+
standard properties (`dir` attribute, `direction` style property) would not
|
|
71
|
+
resolve this issue.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
package/README.md
CHANGED
|
@@ -1,149 +1,56 @@
|
|
|
1
|
-
|
|
2
1
|
# TREB
|
|
3
2
|
|
|
4
|
-
https://treb.app
|
|
5
|
-
|
|
6
|
-
TREB is a spreadsheet component you can embed in web pages, web apps, or blogs.
|
|
3
|
+
<a href='https://treb.app'><img alt="TREB logo (a leaf)" width="64" height="64" src="treb-logo.svg"></img></a>
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
front-end frameworks.
|
|
5
|
+
http://treb.app
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
TREB is a spreadsheet component designed for embedding in web pages,
|
|
8
|
+
web apps, and blogs.
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
## Using
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
> npm install --save @trebco/treb
|
|
12
|
+
To add a spreadsheet to your web page, first add the script file
|
|
17
13
|
```
|
|
18
|
-
|
|
19
|
-
## Stylesheet
|
|
20
|
-
|
|
21
|
-
Note that the library does not automatially load the stylesheet it needs to
|
|
22
|
-
render properly (we do this for sites/apps that have strict CSP settings). So
|
|
23
|
-
you need to load the stylesheet, either via `import` in your front-end
|
|
24
|
-
framework or by just including the stylesheet in your HTML.
|
|
25
|
-
|
|
26
|
-
## Using
|
|
27
|
-
|
|
28
|
-
Here's how to add a spreadsheet in a couple of frameworks:
|
|
29
|
-
|
|
30
|
-
### Svelte (and svelte-kit)
|
|
31
|
-
|
|
32
|
-
```html
|
|
33
|
-
<script lang="ts">
|
|
34
|
-
|
|
35
|
-
// import the onMount handler from svelte
|
|
36
|
-
import { onMount } from 'svelte';
|
|
37
|
-
|
|
38
|
-
// import TREB module
|
|
39
|
-
import { TREB } from 'treb';
|
|
40
|
-
|
|
41
|
-
// import stylesheet
|
|
42
|
-
import 'treb/treb-bundle.css';
|
|
43
|
-
|
|
44
|
-
// reference to the HTML node we will use to mount the spreadsheet
|
|
45
|
-
let container: HTMLElement;
|
|
46
|
-
|
|
47
|
-
onMount(() => {
|
|
48
|
-
|
|
49
|
-
// create spreadsheet, passing a reference to the container node
|
|
50
|
-
TREB.CreateSpreadsheet({
|
|
51
|
-
container,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<!-- this is the node where we will add the spreadsheet -->
|
|
59
|
-
<div bind:this={container}></div>
|
|
60
|
-
|
|
14
|
+
<script type="module" defer src="https://unpkg.com/@trebco/treb@next"></script>
|
|
61
15
|
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import React from 'react';
|
|
68
|
-
|
|
69
|
-
// import TREB module
|
|
70
|
-
import { TREB } from 'treb';
|
|
71
|
-
|
|
72
|
-
// import TREB stylesheets
|
|
73
|
-
import 'treb/treb-bundle.css';
|
|
74
|
-
|
|
75
|
-
class SpreadsheetComponent extends React.Component {
|
|
76
|
-
|
|
77
|
-
// reference to our DOM node
|
|
78
|
-
public container: React.RefObject<HTMLDivElement>;
|
|
79
|
-
|
|
80
|
-
constructor(props) {
|
|
81
|
-
super(props);
|
|
82
|
-
|
|
83
|
-
// create ref to DOM node
|
|
84
|
-
this.container = React.createRef();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public componentDidMount() {
|
|
88
|
-
// create spreadsheet, passing reference to the container node
|
|
89
|
-
TREB.CreateSpreadsheet({
|
|
90
|
-
container: this.container.current,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public render() {
|
|
95
|
-
return (
|
|
96
|
-
<div ref={this.container}></div>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export default SpreadsheetComponent;
|
|
16
|
+
then use the custom element in your page
|
|
17
|
+
```
|
|
18
|
+
<treb-spreadsheeet></treb-spreadsheet>
|
|
102
19
|
```
|
|
103
20
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
There are other ways to embed TREB spreadsheets in vanilla javascript and
|
|
107
|
-
HTML. This is an example specifically for the ES module. See the docs for
|
|
108
|
-
other options.
|
|
109
|
-
|
|
110
|
-
```html
|
|
111
|
-
<html>
|
|
112
|
-
<head>
|
|
113
|
-
|
|
114
|
-
<!-- include stylesheet -->
|
|
115
|
-
<link rel='stylesheet' href='/path/to/treb-bundle.css'>
|
|
116
|
-
<script type='module'>
|
|
117
|
-
|
|
118
|
-
// import from esm
|
|
119
|
-
import { TREB } from '/path/to/treb-bundle.mjs';
|
|
120
|
-
|
|
121
|
-
// run this when the DOM is complete
|
|
122
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
123
|
-
|
|
124
|
-
// get the node
|
|
125
|
-
const container = document.querySelector('.embedded-spreadsheet');
|
|
126
|
-
|
|
127
|
-
// call CreateSpreadsheet with the container node
|
|
128
|
-
TREB.CreateSpreadsheet({ container });
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
</script>
|
|
133
|
-
</head>
|
|
134
|
-
<body>
|
|
21
|
+
For more information on options, configuration, and using the API,
|
|
22
|
+
go to [docs.treb.app][1].
|
|
135
23
|
|
|
136
|
-
|
|
137
|
-
<div class="embedded-spreadsheet"></div>
|
|
24
|
+
## Download
|
|
138
25
|
|
|
139
|
-
|
|
140
|
-
</html>
|
|
26
|
+
Download from npm using npm, yarn, pnpm or your favorite module tool
|
|
141
27
|
```
|
|
28
|
+
npm install @trebco/treb
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## License
|
|
142
32
|
|
|
143
|
-
|
|
33
|
+
TREB is provided under the GNU Lesser General Public License (LGPL).
|
|
34
|
+
See the file [LICENSE.txt][3] for details. TREB is also available under a
|
|
35
|
+
commercial license with different terms. For more information contact
|
|
36
|
+
us at [info@treb.app][4].
|
|
144
37
|
|
|
145
|
-
|
|
38
|
+
## Note on icons
|
|
146
39
|
|
|
40
|
+
TREB includes icons from [font awesome][6], used under the terms of the
|
|
41
|
+
[font awesome free license][7]; and [bootstrap icons][8], used under the terms
|
|
42
|
+
of the [MIT license][9].
|
|
147
43
|
|
|
44
|
+
The TREB icon (a leaf) is a trademark of trebco, llc. Other icons are property
|
|
45
|
+
of their respective owners.
|
|
148
46
|
|
|
47
|
+
[1]: https://docs.treb.app
|
|
48
|
+
[2]: treb-embed/style/treb-icons.scss
|
|
49
|
+
[3]: LICENSE.txt
|
|
50
|
+
[4]: mailto:info@treb.app
|
|
51
|
+
[5]: https://treb.app/download
|
|
52
|
+
[6]: https://fontawesome.com/
|
|
53
|
+
[7]: https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt
|
|
54
|
+
[8]: https://icons.getbootstrap.com/
|
|
55
|
+
[9]: https://github.com/twbs/icons/blob/main/LICENSE.md
|
|
149
56
|
|
package/api-config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
|
|
3
|
+
"package": "./package.json",
|
|
4
|
+
|
|
5
|
+
"output": "./build/treb.d.ts",
|
|
6
|
+
|
|
7
|
+
"root": "./declaration",
|
|
8
|
+
|
|
9
|
+
"index": "treb-embed/src/index.d.ts",
|
|
10
|
+
|
|
11
|
+
"include": [
|
|
12
|
+
"treb-embed/src/custom-element/global.d.ts"
|
|
13
|
+
],
|
|
14
|
+
|
|
15
|
+
"drop_types": [
|
|
16
|
+
"GridEvent"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"convert_to_any": [
|
|
20
|
+
"TREBDocument"
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
"exclude_tags": [
|
|
24
|
+
"internal"
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
"flatten_enums": true
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
export interface Config {
|
|
3
|
+
|
|
4
|
+
/** root of declaration dir, relative to config file */
|
|
5
|
+
root: string;
|
|
6
|
+
|
|
7
|
+
/** starting point for docs, relative to root */
|
|
8
|
+
index: string;
|
|
9
|
+
|
|
10
|
+
/** output file relative to config file (or stdout) */
|
|
11
|
+
output?: string;
|
|
12
|
+
|
|
13
|
+
/** package.json for version information */
|
|
14
|
+
package: string;
|
|
15
|
+
|
|
16
|
+
/** drop these types, even if they're exported */
|
|
17
|
+
drop_types: string[];
|
|
18
|
+
|
|
19
|
+
/** keep variables of this type but change to any */
|
|
20
|
+
convert_to_any: string[];
|
|
21
|
+
|
|
22
|
+
/** exclude via jsdoc tags. typically "internal" */
|
|
23
|
+
exclude_tags: string[];
|
|
24
|
+
|
|
25
|
+
/** drop generics */
|
|
26
|
+
drop_generics: string[];
|
|
27
|
+
|
|
28
|
+
/** rename types */
|
|
29
|
+
rename_types: Record<string, string>;
|
|
30
|
+
|
|
31
|
+
/** additional files to include. these will be concatenated to the generated output. */
|
|
32
|
+
include: string[];
|
|
33
|
+
|
|
34
|
+
/** map declaration files directly (by prefix) */
|
|
35
|
+
map: Record<string, string>;
|
|
36
|
+
|
|
37
|
+
/** turn enums into union types. this helps import. */
|
|
38
|
+
flatten_enums: boolean;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export interface ReadTypeArgs {
|
|
44
|
+
/**
|
|
45
|
+
* types we are looking for. if this is missing, we will colllect
|
|
46
|
+
* all types that are exported and public (TODO: also not @internal)
|
|
47
|
+
*/
|
|
48
|
+
types?: string[],
|
|
49
|
+
|
|
50
|
+
/** dependencies, with target types */
|
|
51
|
+
recursive_targets: Record<string, string[]>,
|
|
52
|
+
|
|
53
|
+
/** ... */
|
|
54
|
+
imported_types: Record<string, string>,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* this has to change, because we may collect reference types
|
|
58
|
+
* from types which we don't actually want (the owner/parent).
|
|
59
|
+
* however, we don't know ahead of time because the (owner/parent)
|
|
60
|
+
* type may be referenced later...
|
|
61
|
+
*
|
|
62
|
+
* so this is a map of who references it -> the reference. we
|
|
63
|
+
* can collapse this list later once we decide what we actually want
|
|
64
|
+
* to keep.
|
|
65
|
+
*
|
|
66
|
+
* actually let's keep both records...
|
|
67
|
+
*/
|
|
68
|
+
referenced_type_map: Record<string, string[]>,
|
|
69
|
+
|
|
70
|
+
/** types we will need, from the imports (probably) */
|
|
71
|
+
referenced_types: Record<string, number>,
|
|
72
|
+
|
|
73
|
+
/** types we have resolved (we can stop looking for them) */
|
|
74
|
+
found_types: Record<string, string>,
|
|
75
|
+
|
|
76
|
+
/** ... */
|
|
77
|
+
extra_types: Record<string, string>,
|
|
78
|
+
|
|
79
|
+
/** exported variables */
|
|
80
|
+
exported_variables: string[],
|
|
81
|
+
|
|
82
|
+
}
|