xlwings-server 1.1.0__py3-none-any.whl
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.
- xlwings_server/.env.template +145 -0
- xlwings_server/__init__.py +12 -0
- xlwings_server/_version.py +34 -0
- xlwings_server/auth/__init__.py +0 -0
- xlwings_server/auth/custom/__init__.py +26 -0
- xlwings_server/auth/entraid/__init__.py +131 -0
- xlwings_server/auth/entraid/jwks.py +10 -0
- xlwings_server/azure_functions_templates/.funcignore +28 -0
- xlwings_server/azure_functions_templates/function_app.py +28 -0
- xlwings_server/azure_functions_templates/host.json +22 -0
- xlwings_server/azure_functions_templates/local.settings.json +8 -0
- xlwings_server/build_utils/__init__.py +9 -0
- xlwings_server/build_utils/static_file_hasher.py +212 -0
- xlwings_server/cli.py +1592 -0
- xlwings_server/config.py +228 -0
- xlwings_server/custom_functions/__init__.py +8 -0
- xlwings_server/custom_functions/examples.py +177 -0
- xlwings_server/custom_scripts/__init__.py +8 -0
- xlwings_server/custom_scripts/examples.py +94 -0
- xlwings_server/databases.py +19 -0
- xlwings_server/dependencies.py +126 -0
- xlwings_server/docker_templates/.dockerignore +15 -0
- xlwings_server/docker_templates/Dockerfile +60 -0
- xlwings_server/docker_templates/docker-compose.yaml +32 -0
- xlwings_server/hotreload.py +59 -0
- xlwings_server/main.py +242 -0
- xlwings_server/models/__init__.py +14 -0
- xlwings_server/models/user.py +53 -0
- xlwings_server/object_handles.py +142 -0
- xlwings_server/routers/__init__.py +0 -0
- xlwings_server/routers/manifest.py +82 -0
- xlwings_server/routers/root.py +16 -0
- xlwings_server/routers/socketio.py +69 -0
- xlwings_server/routers/taskpane.py +12 -0
- xlwings_server/routers/xlwings.py +197 -0
- xlwings_server/security_headers.json +53 -0
- xlwings_server/serializers/__init__.py +25 -0
- xlwings_server/serializers/default_serializer.py +19 -0
- xlwings_server/serializers/dictionary_serializer.py +25 -0
- xlwings_server/serializers/framework.py +50 -0
- xlwings_server/serializers/numpy_serializer.py +26 -0
- xlwings_server/serializers/pandas_serializer.py +95 -0
- xlwings_server/static/css/core.css +28 -0
- xlwings_server/static/css/style.css +0 -0
- xlwings_server/static/images/favicon.png +0 -0
- xlwings_server/static/images/xlwings-16.png +0 -0
- xlwings_server/static/images/xlwings-32.png +0 -0
- xlwings_server/static/images/xlwings-64.png +0 -0
- xlwings_server/static/images/xlwings-80.png +0 -0
- xlwings_server/static/js/auth.js +13 -0
- xlwings_server/static/js/config.js +4 -0
- xlwings_server/static/js/core/alpinejs-csp-boilerplate.js +11 -0
- xlwings_server/static/js/core/bootstrap-customizations.js +7 -0
- xlwings_server/static/js/core/custom-functions-code.js +296 -0
- xlwings_server/static/js/core/examples.js +62 -0
- xlwings_server/static/js/core/hotreload.js +3 -0
- xlwings_server/static/js/core/htmx-handlers.js +86 -0
- xlwings_server/static/js/core/officejs-history-fix-part1.js +3 -0
- xlwings_server/static/js/core/officejs-history-fix-part2.js +2 -0
- xlwings_server/static/js/core/reload-custom-functions.js +79 -0
- xlwings_server/static/js/core/socketio-handlers.js +34 -0
- xlwings_server/static/js/core/xlwings-alert.js +22 -0
- xlwings_server/static/js/core/xlwingsjs/alert.js +85 -0
- xlwings_server/static/js/core/xlwingsjs/auth.js +63 -0
- xlwings_server/static/js/core/xlwingsjs/sheet-buttons.js +133 -0
- xlwings_server/static/js/core/xlwingsjs/utils.js +119 -0
- xlwings_server/static/js/core/xlwingsjs/wasm.js +131 -0
- xlwings_server/static/js/core/xlwingsjs/xlwings.js +1060 -0
- xlwings_server/static/js/main.js +0 -0
- xlwings_server/static/js/ribbon.js +17 -0
- xlwings_server/static/vendor/@alpinejs/LICENSE +21 -0
- xlwings_server/static/vendor/@alpinejs/csp/dist/cdn.min.js +7 -0
- xlwings_server/static/vendor/@microsoft/office-js/LICENSE.md +76 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/af-za/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/agaveerrorux.js +18 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/agavedefaulticon32x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/agavedefaulticon96x96.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/businessbarclose_16x16x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/dropdownarrow_16x16x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/ellipsis_16x16x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/miniinfoblue_16x16x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/moe_default_icon.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/moe_status_icons.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/office.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/images/refresh_16x16x32.png +0 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/index.html +16 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/agaveerrorux/style/agaveerrorux.css +482 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/am-et/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-ae/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-bh/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-dz/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-eg/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-iq/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-jo/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-kw/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-lb/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-ly/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-ma/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-om/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-qa/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-sa/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-sy/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-tn/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ar-ye/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ariatelemetry/aria-web-telemetry-2.8.0.min.js +2 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ariatelemetry/aria-web-telemetry-2.9.0.min.js +2 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ariatelemetry/aria-web-telemetry.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/az-latn-az/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/be-by/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/bg-bg/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/bn-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/bs-latn-ba/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ca-es/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/cs-cz/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/cy-gb/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/da-dk/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/de-at/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/de-ch/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/de-de/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/de-li/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/de-lu/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/el-gr/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-029/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-au/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-bz/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-ca/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-gb/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-ie/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-in/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-jm/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-my/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-nz/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-ph/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-sg/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-tt/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-us/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-za/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/en-zw/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-ar/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-bo/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-cl/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-co/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-cr/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-do/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-ec/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-es/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-gt/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-hn/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-mx/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-ni/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-pa/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-pe/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-pr/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-py/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-sv/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-us/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-uy/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es-ve/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/es6-promise.js +5 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/et-ee/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/eu-es/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-15.01.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-15.02.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-15.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-mac-16.00-core.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-mac-16.00.js +25 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-web-16.00-core.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-web-16.00.js +25 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-win32-16.00.js +19 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-win32-16.01-core.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-win32-16.01.js +25 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excel-winrt-16.00.js +25 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excelios-15.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excelwebapp-15.01.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excelwebapp-15.02.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/excelwebapp-15.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fa-ir/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fi-fi/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fil-ph/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-be/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-ca/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-ch/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-fr/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-lu/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/fr-mc/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ga-ie/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/gl-es/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/gu-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/he-il/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/hi-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/hr-ba/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/hr-hr/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/html2canvas.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/hu-hu/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/hy-am/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/id-id/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/is-is/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/it-ch/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/it-it/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ja-jp/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ka-ge/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/kk-kz/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/km-kh/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/kn-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ko-kr/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/lb-lu/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/lo-la/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/lt-lt/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/lv-lv/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/mk-mk/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ml-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/mn-mn/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/mr-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ms-bn/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ms-my/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/mt-mt/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/nb-no/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ne-np/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/nl-be/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/nl-nl/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/nn-no/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/o15apptofilemappingtable.js +11 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/office-vsdoc.js +28596 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/office.js +84 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/pl-pl/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/pt-br/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/pt-pt/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ro-ro/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ru-ru/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/si-lk/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sk-sk/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sl-si/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sq-al/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sr-cyrl-cs/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sr-cyrl-rs/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sr-latn-cs/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sr-latn-rs/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sv-fi/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sv-se/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/sw-ke/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ta-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/te-in/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/telemetry/oteljs.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/telemetry/oteljs_agave.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/th-th/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/tr-tr/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/uk-ua/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/ur-pk/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/vi-vn/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/webauth/webauth.browserauth.js +77 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/webauth/webauth.implicit.js +35 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/zh-cn/office_strings.js +1 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/zh-hk/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/zh-mo/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/zh-sg/office_strings.js +8 -0
- xlwings_server/static/vendor/@microsoft/office-js/dist/zh-tw/office_strings.js +1 -0
- xlwings_server/static/vendor/axios/dist/axios.min.js +3 -0
- xlwings_server/static/vendor/axios/dist/axios.min.js.map +1 -0
- xlwings_server/static/vendor/bootstrap/LICENSE +21 -0
- xlwings_server/static/vendor/bootstrap/dist/js/bootstrap.bundle.min.js +7 -0
- xlwings_server/static/vendor/bootstrap/dist/js/bootstrap.bundle.min.js.map +1 -0
- xlwings_server/static/vendor/bootstrap-xlwings/dist/bootstrap-xlwings.min.css +12 -0
- xlwings_server/static/vendor/bootstrap-xlwings/dist/bootstrap-xlwings.min.css.map +1 -0
- xlwings_server/static/vendor/htmx-ext-head-support/head-support.js +144 -0
- xlwings_server/static/vendor/htmx-ext-loading-states/loading-states.js +184 -0
- xlwings_server/static/vendor/htmx.org/LICENSE +13 -0
- xlwings_server/static/vendor/htmx.org/dist/htmx.min.js +1 -0
- xlwings_server/static/vendor/socket.io/LICENSE +22 -0
- xlwings_server/static/vendor/socket.io/client-dist/socket.io.min.js +7 -0
- xlwings_server/static/vendor/socket.io/client-dist/socket.io.min.js.map +1 -0
- xlwings_server/templates/_book.html +8 -0
- xlwings_server/templates/alert_base.html +16 -0
- xlwings_server/templates/base.html +117 -0
- xlwings_server/templates/examples/alpine/README.md +26 -0
- xlwings_server/templates/examples/alpine/taskpane.html +47 -0
- xlwings_server/templates/examples/auth/README.md +38 -0
- xlwings_server/templates/examples/auth/protected.html +8 -0
- xlwings_server/templates/examples/auth/public.html +11 -0
- xlwings_server/templates/examples/excel_object_model/README.md +49 -0
- xlwings_server/templates/examples/excel_object_model/add_name_form.html +27 -0
- xlwings_server/templates/examples/hello_world/README.md +9 -0
- xlwings_server/templates/examples/hello_world/taskpane_hello.html +24 -0
- xlwings_server/templates/examples/htmx_form/README.md +44 -0
- xlwings_server/templates/examples/htmx_form/_greeting.html +6 -0
- xlwings_server/templates/examples/htmx_form/taskpane_htmx_form.html +21 -0
- xlwings_server/templates/examples/live_form_validation/README.md +60 -0
- xlwings_server/templates/examples/live_form_validation/add_name_form.html +33 -0
- xlwings_server/templates/examples/multi_app/README.md +34 -0
- xlwings_server/templates/examples/multi_app/taskpane1.html +7 -0
- xlwings_server/templates/examples/multi_app/taskpane2.html +7 -0
- xlwings_server/templates/examples/multi_app/taskpane_loader.html +5 -0
- xlwings_server/templates/examples/navigation/README.md +28 -0
- xlwings_server/templates/examples/navigation/_navigation.html +16 -0
- xlwings_server/templates/examples/navigation/taskpane_one.html +8 -0
- xlwings_server/templates/examples/navigation/taskpane_three.html +8 -0
- xlwings_server/templates/examples/navigation/taskpane_two.html +8 -0
- xlwings_server/templates/examples/pictures/README.md +42 -0
- xlwings_server/templates/examples/pictures/_picture.html +4 -0
- xlwings_server/templates/examples/pictures/taskpane_pictures.html +26 -0
- xlwings_server/templates/manifest.xml +155 -0
- xlwings_server/templates/taskpane.html +1 -0
- xlwings_server/templates/xlwings_alert.html +27 -0
- xlwings_server/templates.py +61 -0
- xlwings_server/utils.py +32 -0
- xlwings_server/wasm/__init__.py +0 -0
- xlwings_server/wasm/config.py +24 -0
- xlwings_server/wasm/main.py +236 -0
- xlwings_server/wasm/requirements.txt +5 -0
- xlwings_server-1.1.0.dist-info/METADATA +61 -0
- xlwings_server-1.1.0.dist-info/RECORD +313 -0
- xlwings_server-1.1.0.dist-info/WHEEL +4 -0
- xlwings_server-1.1.0.dist-info/entry_points.txt +2 -0
- xlwings_server-1.1.0.dist-info/licenses/LICENSE.md +223 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Office.auth.getAccessToken claims that it does everything that this module does,
|
|
2
|
+
// only it doesn't: https://github.com/OfficeDev/office-js/issues/3298
|
|
3
|
+
|
|
4
|
+
let accessToken = null;
|
|
5
|
+
let isRenewingToken = false;
|
|
6
|
+
let tokenLock = false;
|
|
7
|
+
let tokenExpiry = null;
|
|
8
|
+
|
|
9
|
+
function hasKeyExpired() {
|
|
10
|
+
if (!tokenExpiry) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const currentTime = Math.floor(Date.now() / 1000); // Convert to seconds
|
|
14
|
+
// Renew 15 minutes before expiry
|
|
15
|
+
return currentTime >= tokenExpiry - 15 * 60;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function renewAccessToken() {
|
|
19
|
+
console.log("Renewing access token");
|
|
20
|
+
try {
|
|
21
|
+
accessToken = await Office.auth.getAccessToken({
|
|
22
|
+
allowSignInPrompt: true,
|
|
23
|
+
allowConsentPrompt: true,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Read exp
|
|
27
|
+
let payload = accessToken.split(".")[1];
|
|
28
|
+
// Add padding to base64Url string and then use atob() to decode it
|
|
29
|
+
let base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
|
|
30
|
+
while (base64.length % 4) {
|
|
31
|
+
base64 += "=";
|
|
32
|
+
}
|
|
33
|
+
let decodedPayload = JSON.parse(window.atob(base64));
|
|
34
|
+
tokenExpiry = decodedPayload.exp;
|
|
35
|
+
|
|
36
|
+
accessToken = "Bearer " + accessToken;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
let token_error = `Error ${error.code}: ${error.message}`;
|
|
39
|
+
console.log(token_error);
|
|
40
|
+
// return token error so it can be logged on backend
|
|
41
|
+
accessToken = token_error;
|
|
42
|
+
} finally {
|
|
43
|
+
tokenLock = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function getAccessToken() {
|
|
48
|
+
await Office.onReady();
|
|
49
|
+
if (!accessToken || hasKeyExpired()) {
|
|
50
|
+
if (!tokenLock) {
|
|
51
|
+
tokenLock = true;
|
|
52
|
+
isRenewingToken = true;
|
|
53
|
+
await renewAccessToken();
|
|
54
|
+
|
|
55
|
+
isRenewingToken = false;
|
|
56
|
+
} else {
|
|
57
|
+
while (isRenewingToken) {
|
|
58
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return accessToken;
|
|
63
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { showGlobalStatus, hideGlobalStatus } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
const registeredHandlers = {};
|
|
4
|
+
|
|
5
|
+
export async function registerSheetButtons(scriptsMeta) {
|
|
6
|
+
await Office.onReady();
|
|
7
|
+
await removeAllEventHandlers();
|
|
8
|
+
for (const meta of scriptsMeta) {
|
|
9
|
+
// Support both legacy target_cell and button
|
|
10
|
+
const buttonRef = meta?.button || meta?.target_cell || null;
|
|
11
|
+
if (buttonRef) {
|
|
12
|
+
await registerSheetButton(buttonRef, meta);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function registerSheetButton(buttonRef, meta) {
|
|
18
|
+
// buttonRef is in the form [ShapeName]Sheet1!A1, where [ShapeName] is optional
|
|
19
|
+
await Excel.run(async (context) => {
|
|
20
|
+
let shapeName = null;
|
|
21
|
+
let sheetName, cellRef;
|
|
22
|
+
|
|
23
|
+
// Check for optional [] part
|
|
24
|
+
const match = buttonRef.match(/^\[(.*?)\](.*)$/);
|
|
25
|
+
if (match) {
|
|
26
|
+
shapeName = match[1];
|
|
27
|
+
[sheetName, cellRef] = match[2].split("!");
|
|
28
|
+
} else {
|
|
29
|
+
[sheetName, cellRef] = buttonRef.split("!");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (sheetName.startsWith("'") && sheetName.endsWith("'")) {
|
|
33
|
+
sheetName = sheetName.slice(1, -1);
|
|
34
|
+
}
|
|
35
|
+
let sheet = context.workbook.worksheets.getItemOrNullObject(sheetName);
|
|
36
|
+
await context.sync();
|
|
37
|
+
|
|
38
|
+
// Check if shape exists
|
|
39
|
+
if (shapeName) {
|
|
40
|
+
let shape = sheet.shapes.getItemOrNullObject(shapeName);
|
|
41
|
+
await context.sync();
|
|
42
|
+
if (shape.isNullObject) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Create a unique key for this handler
|
|
48
|
+
let scriptName = meta.function_name;
|
|
49
|
+
const handlerKey = `${buttonRef}_${scriptName}`;
|
|
50
|
+
|
|
51
|
+
// Register event handler and store the result
|
|
52
|
+
const eventResult = sheet.onSelectionChanged.add(async function (event) {
|
|
53
|
+
let selectedRangeAddress = event.address;
|
|
54
|
+
if (selectedRangeAddress === cellRef && !sheet.isNullObject) {
|
|
55
|
+
const startTime = Date.now();
|
|
56
|
+
try {
|
|
57
|
+
let authResult =
|
|
58
|
+
typeof globalThis.getAuth === "function"
|
|
59
|
+
? await globalThis.getAuth()
|
|
60
|
+
: { token: "", provider: "" };
|
|
61
|
+
if (meta?.show_taskpane) {
|
|
62
|
+
await Office.addin.showAsTaskpane();
|
|
63
|
+
}
|
|
64
|
+
showGlobalStatus(`Running '${scriptName}' ...`);
|
|
65
|
+
await xlwings.runPython({
|
|
66
|
+
include: meta?.include || "",
|
|
67
|
+
exclude: meta?.exclude || "",
|
|
68
|
+
auth: authResult.token,
|
|
69
|
+
headers: { "Auth-Provider": authResult.provider },
|
|
70
|
+
scriptName: scriptName,
|
|
71
|
+
});
|
|
72
|
+
} finally {
|
|
73
|
+
// Only move selection down if it's still on the button cell
|
|
74
|
+
// If the script changed the selection, leave it as is
|
|
75
|
+
const currentSelection = context.workbook.getSelectedRange();
|
|
76
|
+
currentSelection.load("address");
|
|
77
|
+
await context.sync();
|
|
78
|
+
|
|
79
|
+
// Extract cell reference from full address (e.g., 'Sheet1!B4' -> 'B4')
|
|
80
|
+
const currentAddress = currentSelection.address.split("!").pop();
|
|
81
|
+
if (currentAddress === selectedRangeAddress) {
|
|
82
|
+
sheet.getRange(selectedRangeAddress).getOffsetRange(1, 0).select();
|
|
83
|
+
await context.sync();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Ensure the status is shown for a minimum time to avoid flickering
|
|
87
|
+
const elapsedTime = Date.now() - startTime;
|
|
88
|
+
const minDisplayTime = 500; // milliseconds
|
|
89
|
+
|
|
90
|
+
if (elapsedTime < minDisplayTime) {
|
|
91
|
+
await new Promise((resolve) =>
|
|
92
|
+
setTimeout(resolve, minDisplayTime - elapsedTime),
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
hideGlobalStatus();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Store the event result for later removal if needed
|
|
102
|
+
registeredHandlers[handlerKey] = eventResult;
|
|
103
|
+
|
|
104
|
+
await context.sync();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Helper function to remove all registered event handlers
|
|
109
|
+
async function removeAllEventHandlers() {
|
|
110
|
+
const handlerKeys = Object.keys(registeredHandlers);
|
|
111
|
+
|
|
112
|
+
if (handlerKeys.length === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (const key of handlerKeys) {
|
|
117
|
+
const eventResult = registeredHandlers[key];
|
|
118
|
+
try {
|
|
119
|
+
// Use the stored context to remove the handler
|
|
120
|
+
await Excel.run(eventResult.context, async (context) => {
|
|
121
|
+
eventResult.remove();
|
|
122
|
+
await context.sync();
|
|
123
|
+
});
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.warn(`Failed to remove handler ${key}:`, error);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Clear the registry
|
|
130
|
+
Object.keys(registeredHandlers).forEach(
|
|
131
|
+
(key) => delete registeredHandlers[key],
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export async function getActiveBookName() {
|
|
2
|
+
try {
|
|
3
|
+
await Office.onReady();
|
|
4
|
+
return await Excel.run(async (context) => {
|
|
5
|
+
const workbook = context.workbook;
|
|
6
|
+
workbook.load("name");
|
|
7
|
+
await context.sync();
|
|
8
|
+
return workbook.name;
|
|
9
|
+
});
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Culture Info Name, e.g., en-DE
|
|
16
|
+
let cachedCultureInfoName = null;
|
|
17
|
+
export async function getCultureInfoName() {
|
|
18
|
+
if (cachedCultureInfoName) {
|
|
19
|
+
return cachedCultureInfoName;
|
|
20
|
+
}
|
|
21
|
+
if (!Office.context.requirements.isSetSupported("ExcelApi", "1.12")) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const context = new Excel.RequestContext();
|
|
25
|
+
context.application.cultureInfo.load(["name"]);
|
|
26
|
+
await context.sync();
|
|
27
|
+
cachedCultureInfoName = `${context.application.cultureInfo.name}`;
|
|
28
|
+
return cachedCultureInfoName;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Date format
|
|
32
|
+
let cachedDateFormat = null;
|
|
33
|
+
export async function getDateFormat() {
|
|
34
|
+
if (cachedDateFormat) {
|
|
35
|
+
return cachedDateFormat;
|
|
36
|
+
}
|
|
37
|
+
if (!Office.context.requirements.isSetSupported("ExcelApi", "1.12")) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const context = new Excel.RequestContext();
|
|
41
|
+
context.application.cultureInfo.datetimeFormat.load(["shortDatePattern"]);
|
|
42
|
+
await context.sync();
|
|
43
|
+
cachedDateFormat = `${context.application.cultureInfo.datetimeFormat.shortDatePattern}`;
|
|
44
|
+
return cachedDateFormat;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function printSupportedApiVersions() {
|
|
48
|
+
const versions = [...Array(30)].map((_, i) => `1.${i}`);
|
|
49
|
+
|
|
50
|
+
async function printBuildInfo() {
|
|
51
|
+
if (Office.context.diagnostics) {
|
|
52
|
+
console.log(`User Agent: ${navigator.userAgent}`);
|
|
53
|
+
console.log(`Office Build: ${Office.context.diagnostics.version}`);
|
|
54
|
+
console.log(`Office Platform: ${Office.context.diagnostics.platform}`);
|
|
55
|
+
console.log(
|
|
56
|
+
`Culture Info Name: ${(await getCultureInfoName()) || "N/A"}`,
|
|
57
|
+
);
|
|
58
|
+
console.log(`Local Date Format: ${(await getDateFormat()) || "N/A"}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function printSupportedVersion(apiName) {
|
|
63
|
+
let supportedVersion = null;
|
|
64
|
+
|
|
65
|
+
for (const version of versions) {
|
|
66
|
+
if (Office.context.requirements.isSetSupported(apiName, version)) {
|
|
67
|
+
supportedVersion = version;
|
|
68
|
+
} else {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (supportedVersion) {
|
|
74
|
+
console.log(`${apiName}: ${supportedVersion}`);
|
|
75
|
+
} else {
|
|
76
|
+
console.log(`${apiName}: N/A`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
Office.onReady(async () => {
|
|
81
|
+
await printBuildInfo();
|
|
82
|
+
const apiNames = [
|
|
83
|
+
"ExcelAPI",
|
|
84
|
+
"SharedRuntime",
|
|
85
|
+
"CustomFunctions",
|
|
86
|
+
"CustomFunctionsRuntime",
|
|
87
|
+
"DialogAPI",
|
|
88
|
+
"RibbonAPI",
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
apiNames.forEach((name) => {
|
|
92
|
+
printSupportedVersion(name);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function showGlobalError(message) {
|
|
98
|
+
const alertEl = document.getElementById("global-error-alert");
|
|
99
|
+
const alertMessage = alertEl.querySelector("span");
|
|
100
|
+
alertMessage.textContent = message;
|
|
101
|
+
alertEl.classList.remove("d-none");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function showGlobalStatus(message) {
|
|
105
|
+
const alertEl = document.getElementById("global-status-alert");
|
|
106
|
+
const alertMessage = alertEl.querySelector("span");
|
|
107
|
+
alertMessage.textContent = message;
|
|
108
|
+
alertEl.classList.remove("d-none");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function hideGlobalError() {
|
|
112
|
+
const alertEl = document.getElementById("global-error-alert");
|
|
113
|
+
alertEl.classList.add("d-none");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function hideGlobalStatus() {
|
|
117
|
+
const alertEl = document.getElementById("global-status-alert");
|
|
118
|
+
alertEl.classList.add("d-none");
|
|
119
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
async function initPyodide() {
|
|
2
|
+
if (config.onWasm === false) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const globalStatusAlert = document.querySelector("#global-status-alert");
|
|
7
|
+
const globalErrorAlert = document.querySelector("#global-error-alert");
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
// Show loading status
|
|
11
|
+
if (globalStatusAlert && !config.isOfficialLiteAddin) {
|
|
12
|
+
globalStatusAlert.classList.remove("d-none");
|
|
13
|
+
globalStatusAlert.querySelector("span").innerHTML = `
|
|
14
|
+
<div class="spinner-border spinner-border-sm text-alert me-1" role="status">
|
|
15
|
+
<span class="visually-hidden">Loading...</span>
|
|
16
|
+
</div>
|
|
17
|
+
Loading...
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Hide any previous error
|
|
22
|
+
if (globalErrorAlert) {
|
|
23
|
+
globalErrorAlert.classList.add("d-none");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let pyodide = await loadPyodide();
|
|
27
|
+
|
|
28
|
+
const pyodideConfigResponse = await fetch(
|
|
29
|
+
config.appPath + "/xlwings/pyodide.json",
|
|
30
|
+
);
|
|
31
|
+
if (!pyodideConfigResponse.ok) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Failed to fetch pyodide config: ${pyodideConfigResponse.statusText}`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
const pyodideConfigData = await pyodideConfigResponse.json();
|
|
37
|
+
|
|
38
|
+
// Install dependencies
|
|
39
|
+
if (!config.isOfficialLiteAddin) {
|
|
40
|
+
await pyodide.loadPackage("micropip");
|
|
41
|
+
const micropip = pyodide.pyimport("micropip");
|
|
42
|
+
let packages = pyodideConfigData["packages"];
|
|
43
|
+
await micropip.install(packages, { keep_going: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Python files
|
|
47
|
+
const files = pyodideConfigData["files"];
|
|
48
|
+
function createDirectories(files) {
|
|
49
|
+
const createdDirs = new Set();
|
|
50
|
+
Object.values(files).forEach((localPath) => {
|
|
51
|
+
const parts = localPath.split("/");
|
|
52
|
+
if (parts.length > 1) {
|
|
53
|
+
const dirPath = parts.slice(0, parts.length - 1).join("/");
|
|
54
|
+
if (!createdDirs.has(dirPath)) {
|
|
55
|
+
// TODO: does this work for nested dirs? Also, ./ is probably wrong
|
|
56
|
+
if (dirPath !== ".") {
|
|
57
|
+
pyodide.FS.mkdir(dirPath);
|
|
58
|
+
pyodide.FS.mount(pyodide.FS.filesystems.MEMFS, {}, dirPath);
|
|
59
|
+
}
|
|
60
|
+
createdDirs.add(dirPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
createDirectories(files);
|
|
67
|
+
|
|
68
|
+
for (const [endpoint, localPath] of Object.entries(files)) {
|
|
69
|
+
const response = await fetch(config.appPath + endpoint);
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
throw new Error(`Failed to fetch ${endpoint}: ${response.statusText}`);
|
|
72
|
+
}
|
|
73
|
+
const content = await response.text();
|
|
74
|
+
pyodide.FS.writeFile(localPath, content);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!config.isOfficialLiteAddin) {
|
|
78
|
+
// Entrypoint
|
|
79
|
+
let mainText = pyodide.FS.readFile("./main.py", { encoding: "utf8" });
|
|
80
|
+
await pyodide.runPythonAsync(mainText);
|
|
81
|
+
|
|
82
|
+
// Functions
|
|
83
|
+
// You can't simply export them as the will be null when used in
|
|
84
|
+
// custom-functions-code.js (it's only assigned the function here).
|
|
85
|
+
globalThis.wasmCustomFunctionsCall = pyodide.globals.get(
|
|
86
|
+
"custom_functions_call",
|
|
87
|
+
);
|
|
88
|
+
globalThis.getXlwingsScripts = pyodide.globals.get("get_xlwings_scripts");
|
|
89
|
+
globalThis.wasmCustomFunctionsMeta = pyodide.globals.get(
|
|
90
|
+
"custom_functions_meta",
|
|
91
|
+
);
|
|
92
|
+
globalThis.wasmCustomFunctionsCode = pyodide.globals.get(
|
|
93
|
+
"custom_functions_code",
|
|
94
|
+
);
|
|
95
|
+
globalThis.wasmCustomScriptsCall = pyodide.globals.get(
|
|
96
|
+
"custom_scripts_call",
|
|
97
|
+
);
|
|
98
|
+
globalThis.wasmCustomScriptsMeta = pyodide.globals.get(
|
|
99
|
+
"custom_scripts_meta",
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Hide loading status on success
|
|
103
|
+
if (globalStatusAlert) {
|
|
104
|
+
globalStatusAlert.classList.add("d-none");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return pyodide;
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.error("Pyodide initialization failed:", err);
|
|
111
|
+
|
|
112
|
+
// Hide loading status
|
|
113
|
+
if (globalStatusAlert) {
|
|
114
|
+
globalStatusAlert.classList.add("d-none");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Show error alert
|
|
118
|
+
if (globalErrorAlert) {
|
|
119
|
+
globalErrorAlert.classList.remove("d-none");
|
|
120
|
+
globalErrorAlert.innerHTML = `
|
|
121
|
+
Error initializing Pyodide: ${err.message}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Call as follows:
|
|
130
|
+
// let pyodide = await pyodideReadyPromise;
|
|
131
|
+
export let pyodideReadyPromise = initPyodide();
|