@sheetxl/scripting-mui 0.8.0-beta.10 → 0.8.0-beta.11
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/browser/esm/index.mjs +224 -222
- package/node/esm/index.mjs +318 -315
- package/package.json +8 -8
- package/resources/locales/de/ui.msg.json +1 -0
- package/resources/locales/en/ui.msg.json +1 -0
- package/types/src/command/InsertScriptCommandButton.d.ts +2 -1
- package/types/src/template/TemplateSelectPanel.d.ts +4 -3
- package/types/src/utils/ScriptTemplates.d.ts +27 -0
- package/types/src/utils/index.d.ts +1 -2
- package/types/src/utils/FetchDirectory.d.ts +0 -20
- package/types/src/utils/Utils.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/scripting-mui",
|
|
3
3
|
"description": "Scripting MUI - MUI script workspace, toolbar and run-script plugin for SheetXL.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
4
|
+
"version": "0.8.0-beta.11",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"automation"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@sheetxl/react": "^0.8.0-beta.
|
|
41
|
-
"@sheetxl/scripting-react": "^0.8.0-beta.
|
|
42
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
43
|
-
"@sheetxl/studio-mui": "^0.8.0-beta.
|
|
44
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
45
|
-
"@sheetxl/utils-mui": "^0.8.0-beta.
|
|
46
|
-
"@sheetxl/utils-react": "^0.8.0-beta.
|
|
40
|
+
"@sheetxl/react": "^0.8.0-beta.11",
|
|
41
|
+
"@sheetxl/scripting-react": "^0.8.0-beta.11",
|
|
42
|
+
"@sheetxl/sdk": "^0.8.0-beta.11",
|
|
43
|
+
"@sheetxl/studio-mui": "^0.8.0-beta.11",
|
|
44
|
+
"@sheetxl/utils": "^0.8.0-beta.11",
|
|
45
|
+
"@sheetxl/utils-mui": "^0.8.0-beta.11",
|
|
46
|
+
"@sheetxl/utils-react": "^0.8.0-beta.11",
|
|
47
47
|
"clsx": "^2.1.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"insertFunction.fallbackLabel": "Funktion",
|
|
3
3
|
"insertFunction.insertNamed": "{name} einfügen",
|
|
4
4
|
"insertScript.fallbackLabel": "Skript einfügen",
|
|
5
|
+
"insertScript.loadFailedRetry": "Vorlagen konnten nicht geladen werden. Erneut versuchen",
|
|
5
6
|
"insertScript.loading": "Wird geladen...",
|
|
6
7
|
"runScript.executeNamed": "{name} ausführen",
|
|
7
8
|
"runScript.fallbackLabel": "Makro",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"insertFunction.fallbackLabel": "Function",
|
|
3
3
|
"insertFunction.insertNamed": "Insert {name}",
|
|
4
4
|
"insertScript.fallbackLabel": "Insert Script",
|
|
5
|
+
"insertScript.loadFailedRetry": "Couldn’t load templates. Retry",
|
|
5
6
|
"insertScript.loading": "Loading...",
|
|
6
7
|
"runScript.executeNamed": "Execute {name}",
|
|
7
8
|
"runScript.fallbackLabel": "Macro",
|
|
@@ -2,7 +2,8 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { CommandPopupButtonProps } from '@sheetxl/utils-mui';
|
|
3
3
|
export interface InsertScriptCommandButtonProps extends CommandPopupButtonProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* The script templates to read: a URL that serves `templates-scripting/contents.json`.
|
|
6
|
+
* @defaultValue {@link DEFAULT_SCRIPT_PATH}
|
|
6
7
|
*/
|
|
7
8
|
scriptPath?: string;
|
|
8
9
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/system';
|
|
3
|
-
import {
|
|
3
|
+
import { ScriptTemplate } from '../utils';
|
|
4
4
|
export interface TemplateSelectPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/**
|
|
6
6
|
* MUI SX props {@link https://mui.com/system/getting-started/the-sx-prop/}
|
|
7
7
|
*/
|
|
8
8
|
sx?: SxProps<Theme>;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* The script templates to read: a URL that serves `templates-scripting/contents.json`.
|
|
11
|
+
* @defaultValue {@link DEFAULT_SCRIPT_PATH}
|
|
11
12
|
*/
|
|
12
13
|
scriptPath?: string;
|
|
13
14
|
/**
|
|
14
15
|
* Called when a script button is clicked
|
|
15
16
|
*/
|
|
16
|
-
onScriptSelect?: (file:
|
|
17
|
+
onScriptSelect?: (file: ScriptTemplate) => void;
|
|
17
18
|
/**
|
|
18
19
|
* Disables every template, for scripts that cannot be changed.
|
|
19
20
|
* @defaultValue false
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the script templates are read from when no `scriptPath` is given: the published
|
|
3
|
+
* `@sheetxl/templates-scripting` for this build's release channel.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_SCRIPT_PATH: string;
|
|
6
|
+
/** How a script template runs, which is also the icon it shows. */
|
|
7
|
+
export type ScriptTemplateIcon = 'formula' | 'macro' | 'autostart';
|
|
8
|
+
/** One script template, with its source loaded. */
|
|
9
|
+
export interface ScriptTemplate {
|
|
10
|
+
/** The template's path within the catalog (`add.ts`), or `null` for the blank template. */
|
|
11
|
+
path: string | null;
|
|
12
|
+
/** The display title. */
|
|
13
|
+
title: string;
|
|
14
|
+
summary?: string;
|
|
15
|
+
icon?: ScriptTemplateIcon;
|
|
16
|
+
/** The script source. */
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Load the script templates at `path`, sources included, in the catalog's order.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Loaded once per `path` and shared by every caller. A template whose source does not load is left
|
|
24
|
+
* out; a catalog that cannot be found rejects.
|
|
25
|
+
*/
|
|
26
|
+
export declare const loadScriptTemplates: (path?: string) => Promise<ScriptTemplate[]>;
|
|
27
|
+
//# sourceMappingURL=ScriptTemplates.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface DirectoryFile<M = any> {
|
|
2
|
-
/** `null` for a synthetic entry with no backing file (e.g. the "blank" template). */
|
|
3
|
-
path: string | null;
|
|
4
|
-
metadata?: M;
|
|
5
|
-
content: string;
|
|
6
|
-
}
|
|
7
|
-
export interface DirectoryEntry<M = any> {
|
|
8
|
-
path: string;
|
|
9
|
-
metadata?: M;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Fetches and loads 'virtual files' using fetch.
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* This function only works if there is a directory.json file at the directory path.
|
|
16
|
-
*
|
|
17
|
-
* @returns {Promise<DirectoryFile[]>} A promise that resolves to the content of the directory.
|
|
18
|
-
*/
|
|
19
|
-
export declare const fetchDirectory: (directoryPath: string) => Promise<DirectoryFile[]>;
|
|
20
|
-
//# sourceMappingURL=FetchDirectory.d.ts.map
|