@sheetxl/react 0.7.27 → 0.7.28-beta.2
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/cjs/Bo9Kx3L_XQkGPBJ5.cjs +1 -0
- package/browser/cjs/Pl04-kDEQSO8_qFU.cjs +156 -0
- package/browser/cjs/index.cjs +24 -24
- package/browser/esm/BPJdKxa9KFZWhw7o.mjs +6286 -0
- package/browser/esm/index.mjs +19258 -4911
- package/licenses/dependencies.txt +42 -214
- package/node/esm/CUEW3f18r-pU7F0q.mjs +9 -0
- package/node/esm/index.mjs +17035 -3691
- package/package.json +10 -11
- package/resources/contents.json +60 -0
- package/resources/locales/contents.json +114 -0
- package/resources/locales/de/clipboard.cmd.json +36 -0
- package/resources/locales/de/editor.cmd.json +128 -0
- package/resources/locales/de/movable.cmd.json +123 -0
- package/resources/locales/de/selection.cmd.json +373 -0
- package/resources/locales/de/sheet.cmd.json +1563 -0
- package/resources/locales/de/table.cmd.json +83 -0
- package/resources/locales/de/ui.msg.json +166 -0
- package/resources/locales/de/workbook.cmd.json +282 -0
- package/resources/locales/en/clipboard.cmd.json +36 -0
- package/resources/locales/en/editor.cmd.json +128 -0
- package/resources/locales/en/movable.cmd.json +123 -0
- package/resources/locales/en/selection.cmd.json +373 -0
- package/resources/locales/en/sheet.cmd.json +1563 -0
- package/resources/locales/en/table.cmd.json +83 -0
- package/resources/locales/en/ui.msg.json +166 -0
- package/resources/locales/en/workbook.cmd.json +282 -0
- package/types/index.d.ts +2 -1767
- package/types/src/border/StaticBorderRenderer.d.ts +32 -0
- package/types/src/border/StyledStrokePath.d.ts +14 -0
- package/types/src/border/index.d.ts +4 -0
- package/types/src/border/useBorders.d.ts +87 -0
- package/types/src/cell/ColumnButton.d.ts +45 -0
- package/types/src/cell/CornerTriangle.d.ts +27 -0
- package/types/src/cell/FormulaCellRenderer.d.ts +34 -0
- package/types/src/cell/SheetCellRenderer.d.ts +52 -0
- package/types/src/cell/SheetHeaderRenderer.d.ts +37 -0
- package/types/src/cell/index.d.ts +7 -0
- package/types/src/cell/useFormulaViewAnchor.d.ts +42 -0
- package/types/src/chart/ChartEditor.d.ts +17 -0
- package/types/src/chart/PresetChartTypeDescriptors.d.ts +35 -0
- package/types/src/chart/index.d.ts +3 -0
- package/types/src/chart/templates/area-stacked-percent-template.json.d.ts +10 -0
- package/types/src/chart/templates/area-stacked-template.json.d.ts +10 -0
- package/types/src/chart/templates/area-template.json.d.ts +9 -0
- package/types/src/chart/templates/bar-stacked-percent-template.json.d.ts +10 -0
- package/types/src/chart/templates/bar-stacked-template.json.d.ts +10 -0
- package/types/src/chart/templates/bar-template.json.d.ts +9 -0
- package/types/src/chart/templates/column-stacked-percent-template.json.d.ts +10 -0
- package/types/src/chart/templates/column-stacked-template.json.d.ts +10 -0
- package/types/src/chart/templates/column-template.json.d.ts +9 -0
- package/types/src/chart/templates/line-markers-template.json.d.ts +10 -0
- package/types/src/chart/templates/line-stacked-markers-template.json.d.ts +11 -0
- package/types/src/chart/templates/line-stacked-percent-markers-template.json.d.ts +11 -0
- package/types/src/chart/templates/line-stacked-percent-template.json.d.ts +10 -0
- package/types/src/chart/templates/line-stacked-template.json.d.ts +10 -0
- package/types/src/chart/templates/line-template.json.d.ts +9 -0
- package/types/src/chart/templates/pie-doughnut-template.json.d.ts +10 -0
- package/types/src/chart/templates/pie-template.json.d.ts +9 -0
- package/types/src/chart/templates/scatter-lines-markers-smooth-template.json.d.ts +10 -0
- package/types/src/chart/templates/scatter-lines-markers-template.json.d.ts +10 -0
- package/types/src/chart/templates/scatter-lines-smooth-template.json.d.ts +10 -0
- package/types/src/chart/templates/scatter-lines-template.json.d.ts +10 -0
- package/types/src/chart/templates/scatter-markers-template.json.d.ts +10 -0
- package/types/src/clipboard/ClipboardCommands.d.ts +68 -0
- package/types/src/clipboard/SheetClipboardLayer.d.ts +22 -0
- package/types/src/clipboard/index.d.ts +3 -0
- package/types/src/commands/Catalog.d.ts +8 -0
- package/types/src/commands/CommandRootProvider.d.ts +36 -0
- package/types/src/commands/InputClipboardCommands.d.ts +41 -0
- package/types/src/commands/InputClipboardInjector.d.ts +16 -0
- package/types/src/commands/MainFocusContext.d.ts +13 -0
- package/types/src/commands/PaneScopeProvider.d.ts +40 -0
- package/types/src/commands/createTransactionalMiddleware.d.ts +49 -0
- package/types/src/commands/index.d.ts +7 -0
- package/types/src/context/SheetContext.d.ts +18 -0
- package/types/src/context/WorkbookContext.d.ts +20 -0
- package/types/src/context/index.d.ts +3 -0
- package/types/src/editableLabel/EditableLabel.d.ts +28 -0
- package/types/src/editableLabel/index.d.ts +2 -0
- package/types/src/editor/EditorCommands.d.ts +98 -0
- package/types/src/editor/FunctionPreviewPanel.d.ts +166 -0
- package/types/src/editor/NamedHintPanel.d.ts +38 -0
- package/types/src/editor/NamedItemsPanel.d.ts +59 -0
- package/types/src/editor/SheetCellEditorLayer.d.ts +40 -0
- package/types/src/editor/SheetCellInput.d.ts +99 -0
- package/types/src/editor/SheetEditable.d.ts +53 -0
- package/types/src/editor/SheetReferenceHeaderLayer.d.ts +46 -0
- package/types/src/editor/SheetReferenceLayer.d.ts +55 -0
- package/types/src/editor/formulaCaret.d.ts +84 -0
- package/types/src/editor/formulaEval.d.ts +202 -0
- package/types/src/editor/formulaPresentation.d.ts +136 -0
- package/types/src/editor/formulaText.d.ts +80 -0
- package/types/src/editor/functionArgs.d.ts +111 -0
- package/types/src/editor/functionHint.d.ts +37 -0
- package/types/src/editor/index.d.ts +18 -0
- package/types/src/editor/referencePointNav.d.ts +39 -0
- package/types/src/editor/useFormulaHints.d.ts +126 -0
- package/types/src/editor/useFormulaInput.d.ts +326 -0
- package/types/src/editor/useProtectedEditNotice.d.ts +14 -0
- package/types/src/editor/useReferenceMode.d.ts +177 -0
- package/types/src/form/FormulaInput.d.ts +86 -0
- package/types/src/form/FormulaInputParts.d.ts +94 -0
- package/types/src/form/index.d.ts +5 -0
- package/types/src/form/useEditCommit.d.ts +174 -0
- package/types/src/form/useInputField.d.ts +86 -0
- package/types/src/frame/CommandContext.d.ts +179 -0
- package/types/src/frame/IFrame.d.ts +17 -0
- package/types/src/frame/index.d.ts +3 -0
- package/types/src/icons/LogoNoPaddingIcon.d.ts +3 -0
- package/types/src/icons/LogoTextNoPaddingIcon.d.ts +4 -0
- package/types/src/icons/WaterMark.d.ts +12 -0
- package/types/src/icons/chart/ChartAreaIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartAreaStackedIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartAreaStackedPercentIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartBarIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartBarStackedIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartBarStackedPercentIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartBubble3DIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartBubbleIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartColumnIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartColumnStackedIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartColumnStackedPercentIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineMarkersIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineStackedIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineStackedMarkersIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineStackedPercentIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartLineStackedPercentMarkersIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartPieDoughnutIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartPieIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartScatterLinesIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartScatterLinesMarkersIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartScatterLinesMarkersSmoothIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartScatterLinesSmoothIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartScatterMarkersIcon.d.ts +5 -0
- package/types/src/icons/chart/ChartWaterfallIcon.d.ts +5 -0
- package/types/src/icons/chart/ThemedChartIcon.d.ts +20 -0
- package/types/src/icons/chart/index.d.ts +50 -0
- package/types/src/icons/index.d.ts +4 -0
- package/types/src/index.d.ts +27 -0
- package/types/src/io/WorkbookIO.d.ts +50 -0
- package/types/src/io/index.d.ts +2 -0
- package/types/src/layer/BorderLayer.d.ts +14 -0
- package/types/src/layer/CellErrorLayer.d.ts +49 -0
- package/types/src/layer/CellFillLayer.d.ts +15 -0
- package/types/src/layer/ConditionalBarLayer.d.ts +41 -0
- package/types/src/layer/ConditionalIcons.d.ts +34 -0
- package/types/src/layer/ConditionalIconsLayer.d.ts +31 -0
- package/types/src/layer/ContextMenuLayer.d.ts +27 -0
- package/types/src/layer/HeaderResizerLayer.d.ts +28 -0
- package/types/src/layer/HeaderSelectionLayer.d.ts +89 -0
- package/types/src/layer/ResizeIndicator.d.ts +19 -0
- package/types/src/layer/SheetBackgroundLayer.d.ts +22 -0
- package/types/src/layer/SheetCellLayer.d.ts +49 -0
- package/types/src/layer/SheetColumnButtonLayer.d.ts +23 -0
- package/types/src/layer/SheetGridLineLayer.d.ts +22 -0
- package/types/src/layer/SheetHeaderCellLayer.d.ts +30 -0
- package/types/src/layer/SheetMovableLayer.d.ts +26 -0
- package/types/src/layer/SheetTableCommandLayer.d.ts +16 -0
- package/types/src/layer/SpillLayer.d.ts +22 -0
- package/types/src/layer/TableLayer.d.ts +22 -0
- package/types/src/layer/ValidationIndicatorLayer.d.ts +41 -0
- package/types/src/layer/index.d.ts +25 -0
- package/types/src/layer/resizeIndicatorState.d.ts +26 -0
- package/types/src/layer/useSheetFeatureRegions.d.ts +21 -0
- package/types/src/layer/useSheetVisibleCells.d.ts +60 -0
- package/types/src/layer/useSheetVisibleDecorations.d.ts +42 -0
- package/types/src/layer/useTableHeaderCells.d.ts +22 -0
- package/types/src/layer/useVisibleTables.d.ts +27 -0
- package/types/src/listener/index.d.ts +3 -0
- package/types/src/listener/useModelListener.d.ts +67 -0
- package/types/src/listener/useRangeListener.d.ts +15 -0
- package/types/src/movable/EmptyFrame.d.ts +16 -0
- package/types/src/movable/IMovableArea.d.ts +34 -0
- package/types/src/movable/MovableCommands.d.ts +22 -0
- package/types/src/movable/MovableFrame.d.ts +48 -0
- package/types/src/movable/MovableLayer.d.ts +77 -0
- package/types/src/movable/MoveableBundle.d.ts +4 -0
- package/types/src/movable/index.d.ts +4 -0
- package/types/src/picture/IPictureEditor.d.ts +39 -0
- package/types/src/picture/PictureEditor.d.ts +4 -0
- package/types/src/picture/index.d.ts +3 -0
- package/types/src/selection/SelectionCommands.d.ts +23 -0
- package/types/src/selection/SheetSelection.d.ts +53 -0
- package/types/src/selection/SheetSelectionLayer.d.ts +30 -0
- package/types/src/selection/index.d.ts +4 -0
- package/types/src/shape/ShapeEditor.d.ts +16 -0
- package/types/src/shape/index.d.ts +2 -0
- package/types/src/sheet/ConditionalFormatPresets.d.ts +56 -0
- package/types/src/sheet/ISheetElement.d.ts +233 -0
- package/types/src/sheet/ISheetHeaderElement.d.ts +138 -0
- package/types/src/sheet/NotImplemented.d.ts +3 -0
- package/types/src/sheet/SheetCommandProvider.d.ts +57 -0
- package/types/src/sheet/SheetCommands.d.ts +75 -0
- package/types/src/sheet/SheetElement.d.ts +15 -0
- package/types/src/sheet/SheetHeaderElement.d.ts +4 -0
- package/types/src/sheet/SheetScrollbar.d.ts +28 -0
- package/types/src/sheet/TopLeftCorner.d.ts +17 -0
- package/types/src/sheet/index.d.ts +7 -0
- package/types/src/slicer/SlicerEditor.d.ts +16 -0
- package/types/src/slicer/index.d.ts +2 -0
- package/types/src/tabStrip/SheetTab.d.ts +41 -0
- package/types/src/tabStrip/Sortable.d.ts +66 -0
- package/types/src/tabStrip/Tab.d.ts +19 -0
- package/types/src/tabStrip/TabStrip.d.ts +41 -0
- package/types/src/tabStrip/TabStripItem.d.ts +36 -0
- package/types/src/tabStrip/TabStripRow.d.ts +9 -0
- package/types/src/tabStrip/index.d.ts +7 -0
- package/types/src/table/TableCommands.d.ts +16 -0
- package/types/src/taskPane/ITaskPane.d.ts +72 -0
- package/types/src/taskPane/TaskPaneArea.d.ts +144 -0
- package/types/src/taskPane/TaskPaneFrame.d.ts +48 -0
- package/types/src/taskPane/TaskPaneRegistry.d.ts +108 -0
- package/types/src/taskPane/TaskPaneStrip.d.ts +33 -0
- package/types/src/taskPane/TaskPaneTitle.d.ts +24 -0
- package/types/src/taskPane/index.d.ts +7 -0
- package/types/src/taskPane/useTaskPane.d.ts +29 -0
- package/types/src/theme/DocThemesContext.d.ts +3 -0
- package/types/src/theme/DocThemesProvider.d.ts +15 -0
- package/types/src/theme/ThemeState.d.ts +19 -0
- package/types/src/theme/buildDocThemeCSS.d.ts +16 -0
- package/types/src/theme/buildOOXMLThemeCSS.d.ts +13 -0
- package/types/src/theme/createCSSSystemLookup.d.ts +51 -0
- package/types/src/theme/index.d.ts +11 -0
- package/types/src/theme/useAppColorScheme.d.ts +15 -0
- package/types/src/theme/useDocThemes.d.ts +3 -0
- package/types/src/theme/useGridColorScheme.d.ts +20 -0
- package/types/src/theme/useSystemColors.d.ts +44 -0
- package/types/src/undo/UndoCommands.d.ts +28 -0
- package/types/src/undo/UndoManagerContext.d.ts +14 -0
- package/types/src/undo/index.d.ts +3 -0
- package/types/src/workbook/DefaultRenderers.d.ts +14 -0
- package/types/src/workbook/GlobalWorkbookElement.d.ts +10 -0
- package/types/src/workbook/IWorkbookElement.d.ts +178 -0
- package/types/src/workbook/WindowChrome.d.ts +61 -0
- package/types/src/workbook/WorkbookCommandContributor.d.ts +24 -0
- package/types/src/workbook/WorkbookCommands.d.ts +97 -0
- package/types/src/workbook/WorkbookElement.d.ts +9 -0
- package/types/src/workbook/WorkbookStrip.d.ts +73 -0
- package/types/src/workbook/index.d.ts +17 -0
- package/types/src/workbook/resolveWorkbookInput.d.ts +27 -0
- package/types/src/workbook/useResolvedWorkbook.d.ts +31 -0
- package/types/src/workbook/useWindowChrome.d.ts +24 -0
- package/types/src/workbook/useWorkbookApp.d.ts +47 -0
- package/types/src/workbook/useWorkbookEncrypted.d.ts +15 -0
- package/types/src/workbook/useWorkbookFormat.d.ts +18 -0
- package/types/src/workbook/useWorkbookName.d.ts +13 -0
- package/types/src/workbook/useWorkbookSaveState.d.ts +29 -0
- package/browser/cjs/DNki9dGbSn_gUfd3.cjs +0 -7
- package/browser/cjs/Da611GSWMp5ncOGO.cjs +0 -16
- package/browser/cjs/F8ZECny0CwW2OV5X.cjs +0 -161
- package/browser/esm/BYGSBjns_83FWXAx.mjs +0 -3905
- package/browser/esm/CmObbQiLq9AAM7-q.mjs +0 -394
- package/browser/esm/Daa2g2QALCIHFgqP.mjs +0 -1377
- package/node/assets/style.css +0 -1
- package/node/esm/Bu9xI_rgkuupQ2AO.mjs +0 -11
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { RemoveListener } from '@sheetxl/utils';
|
|
2
|
+
import { IWorkbook, IThemeCollection, ICell, IRange } from '@sheetxl/sdk';
|
|
3
|
+
import { Command, IReactNotifier } from '@sheetxl/utils-react';
|
|
4
|
+
import { CommandContext } from '../frame';
|
|
5
|
+
import { ActivateFrameOptions } from '../taskPane';
|
|
6
|
+
import { SheetEditable } from '../editor';
|
|
7
|
+
/**
|
|
8
|
+
* Workbook-level command **behavior** (pure callbacks) + the structure-protection / sheet-count disable
|
|
9
|
+
* reducer. Workbook model ops are self-transacting, so — unlike the sheet — there is no transactional
|
|
10
|
+
* middleware here. The command chrome (label / description / shortcut / tags) lives in the catalog
|
|
11
|
+
* (`workbook.cmd.en.json`);.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Catalog chrome with **no contributed behavior yet** — commands whose implementation is deliberately
|
|
15
|
+
* deferred, parked here so they aren't lost. Each keeps its chrome (label / description / shortcut)
|
|
16
|
+
* in the catalog, so it resolves but stays disabled until a callback is contributed:
|
|
17
|
+
*
|
|
18
|
+
* - `spellCheck` (F7) — check the workbook for spelling mistakes.
|
|
19
|
+
* - `maximumWorkbookToggle` (Ctrl+F10) — toggle showing the workbook maximized. Note: Excel
|
|
20
|
+
* toggles maximize; ours should maximize within the browser — useful when the sheet is 'windowed'
|
|
21
|
+
* as an embedded component.
|
|
22
|
+
* - `createNamedReferenceFromSelection` (Ctrl+Shift+F3) — auto-generate names from the selected
|
|
23
|
+
* cells (Excel's Create-from-Selection).
|
|
24
|
+
* - `showFormat` (Ctrl+Shift+F) — open the format pane. Should also be available in the status bar.
|
|
25
|
+
|
|
26
|
+
* - `workbookViewToggleExpandFormulaBar` (Ctrl+Shift+U) — expand or collapse the formula bar.
|
|
27
|
+
* F6 - Move focus through primary workbook elements (we can implement this by check each workbook element and moving through)
|
|
28
|
+
* F8 - Extend Selection
|
|
29
|
+
* F10 - Move focus to toolbar
|
|
30
|
+
* F11 - Insert chart as a new tab
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* The **serializable** slice of the last search — what `findNext` / `findPrevious` (and the find window's
|
|
34
|
+
* seed) repeat. Deliberately NOT `ICellRange.FindOptions`: that type carries `matchCustom` (a function),
|
|
35
|
+
* `from` (a live address), and `reverse`, none of which survive a round-trip or mean anything next session.
|
|
36
|
+
* `reverse` in particular is excluded on purpose — direction comes from *which command ran*, not memory.
|
|
37
|
+
*/
|
|
38
|
+
export interface FindMemory {
|
|
39
|
+
/** The search text. */
|
|
40
|
+
text: string;
|
|
41
|
+
matchCase?: boolean;
|
|
42
|
+
matchEntireCell?: boolean;
|
|
43
|
+
useRegex?: boolean;
|
|
44
|
+
fields?: ICell.Content[];
|
|
45
|
+
axis?: IRange.Axis;
|
|
46
|
+
/** Sheet vs whole workbook (the window's "Within"). */
|
|
47
|
+
scope?: CommandContext.FindScopeOptions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The last-search memory handle — **live getter/setter** over the bridge's `usePersistenceState`, exactly
|
|
51
|
+
* like {@link PickerMemory} for the style pickers. A getter (not the value) so recording a search doesn't
|
|
52
|
+
* change the `data` identity and re-run this whole contributor.
|
|
53
|
+
*/
|
|
54
|
+
export interface FindMemoryHandle {
|
|
55
|
+
getLastFind?: () => FindMemory | null;
|
|
56
|
+
setLastFind?: (value: FindMemory | null) => void;
|
|
57
|
+
}
|
|
58
|
+
/** Options for {@link contributeWorkbookCommands}. */
|
|
59
|
+
export interface ContributeWorkbookCommandsOptions {
|
|
60
|
+
/** Busy / error / dialogs (find, goto, new-style, named-reference). */
|
|
61
|
+
notifier?: IReactNotifier;
|
|
62
|
+
/** Activate a task pane by key (the test `activateTask` command). Threaded from `useTaskPaneArea()`. */
|
|
63
|
+
activateTaskPane?: (key: string, options?: ActivateFrameOptions) => void;
|
|
64
|
+
/** Theme collection for the `selectTheme` picker context. Omit ⇒ the picker has no list to show. */
|
|
65
|
+
themes?: IThemeCollection;
|
|
66
|
+
/**
|
|
67
|
+
* Focus the name box (the formula bar's named-range editor). `activeNameBox` is a **workbook** command (the
|
|
68
|
+
* name box is logically part of the workbook surface), but its editor is currently packaged in the studio
|
|
69
|
+
* formula bar — so the focus is injected as a plain callback (keeps this package free of studio types). This
|
|
70
|
+
* is a **bridge**: when the name-box capability gets a react home (chromeless-workbook track), this becomes a
|
|
71
|
+
* proper imperative handle on `IWorkbookElement`. Omit ⇒ `activeNameBox` stays disabled (no name box).
|
|
72
|
+
*/
|
|
73
|
+
focusNameBox?: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* The shared cell {@link SheetEditable} — the `insertFunction` picker seeds `=FN(` through it (start an edit
|
|
76
|
+
* on the active cell if idle, or insert at the focused editor's caret). Functions are a **workbook** concern
|
|
77
|
+
* (custom functions live in the workbook's scripts, not any one sheet), so the picker resolves here rather
|
|
78
|
+
* than on `sheet`. Omit ⇒ `insertFunction` stays chrome-only (the category list still shows; inserting no-ops).
|
|
79
|
+
*/
|
|
80
|
+
editable?: SheetEditable | null;
|
|
81
|
+
/**
|
|
82
|
+
* Persisted last-search memory (`workbook.lastFind`), owned by the bridge's `usePersistenceState`. Feeds
|
|
83
|
+
* `findNext` / `findPrevious` and the find window's seed. Omit ⇒ those two stay disabled and the window
|
|
84
|
+
* always seeds from the active cell.
|
|
85
|
+
*/
|
|
86
|
+
findMemory?: FindMemoryHandle;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Contribute the workbook **behavior** (pure callbacks) + the structure-protection / sheet-count disable
|
|
90
|
+
* reducer onto `contribution`. Returns a disposer that detaches the model listeners.
|
|
91
|
+
*/
|
|
92
|
+
/** The single `data` bundle {@link contributeWorkbookCommands} takes (the `DynamicCommandContributor` shape). */
|
|
93
|
+
export interface WorkbookCommandData extends ContributeWorkbookCommandsOptions {
|
|
94
|
+
workbook: IWorkbook | null;
|
|
95
|
+
}
|
|
96
|
+
export declare function contributeWorkbookCommands(contribution: Command.CommandContribution, data: WorkbookCommandData): RemoveListener;
|
|
97
|
+
//# sourceMappingURL=WorkbookCommands.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IWorkbookElement, WorkbookElementProps } from './IWorkbookElement';
|
|
3
|
+
/**
|
|
4
|
+
* The workbook editor/viewer. Resolves a `Promise` / `ReadOptions` workbook input (showing loading /
|
|
5
|
+
* error) before rendering the base element; colors resolve from the injected `--sxl-*` token matrix and
|
|
6
|
+
* the self-sourced color scheme (no theme provider).
|
|
7
|
+
*/
|
|
8
|
+
export declare const WorkbookElement: React.NamedExoticComponent<Omit<WorkbookElementProps, "ref"> & React.RefAttributes<IWorkbookElement>>;
|
|
9
|
+
//# sourceMappingURL=WorkbookElement.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
3
|
+
import { ScrollButtonProps } from '@sheetxl/utils-react';
|
|
4
|
+
import { SheetTabProps } from '../tabStrip';
|
|
5
|
+
/**
|
|
6
|
+
* A table tab strip that operates on an {@link IWorkbook}.
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkbookStripProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/**
|
|
10
|
+
* The workbook. Required — the strip renders this workbook's sheets and cannot function without it.
|
|
11
|
+
*/
|
|
12
|
+
workbook: IWorkbook;
|
|
13
|
+
/**
|
|
14
|
+
* If true, the tab strip is disabled.
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true then the tab strips can not be modified but can still be selected.
|
|
20
|
+
* @defaultValue `!workbook.getProtection().isStructureAllowed()`
|
|
21
|
+
*/
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the user has initiated a change to the active tab but before it has
|
|
25
|
+
* been rendered. Return `false` to cancel.
|
|
26
|
+
*/
|
|
27
|
+
onBeforeUserChange?(index: number): boolean | void;
|
|
28
|
+
/**
|
|
29
|
+
* Called after the tab has been changed.
|
|
30
|
+
*/
|
|
31
|
+
onUserChange?(index: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Condensed (detached) layout: the strip is separated from the grid — e.g. stacked under the
|
|
34
|
+
* scrollbar on a small screen. The selected tab uses a plain rounded tab (rather than the
|
|
35
|
+
* inverted, open-top shape that reads as part of the grid above) and the scroll buttons are
|
|
36
|
+
* hidden. When `false` (default) the strip reads as an extension of the grid.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
condensed?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Override how each sheet tab renders. Defaults to a plain {@link SheetTab}. A host with its
|
|
43
|
+
* own tab chrome (e.g. the MUI strip's ripple surface) supplies this rather than re-forking
|
|
44
|
+
* the whole strip. The `sheet`, `inverted` and (when {@link onTabContextMenu} is set)
|
|
45
|
+
* `onContextMenu` are provided; anything else is the underlying {@link TabStrip} tab props.
|
|
46
|
+
*/
|
|
47
|
+
renderSheetTab?: (props: SheetTabProps) => React.ReactElement;
|
|
48
|
+
/**
|
|
49
|
+
* Called on a sheet tab's context-menu (right-click) event, after that tab has been selected.
|
|
50
|
+
* The strip itself renders no menu — a host provides one (e.g. the MUI strip's `SheetTabMenu`).
|
|
51
|
+
*/
|
|
52
|
+
onTabContextMenu?: (event: React.MouseEvent<HTMLElement>, index: number) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Scroll-button renderers forwarded to the underlying {@link TabStrip}. A host can inject
|
|
55
|
+
* styled variants (e.g. the MUI strip's tooltip-wrapped buttons). Only the "edge" button is
|
|
56
|
+
* currently rendered by `TabStrip`; start/end are accepted for parity. Pass `null` to suppress
|
|
57
|
+
* a button (as the strip does for all three in {@link condensed} layout).
|
|
58
|
+
*/
|
|
59
|
+
renderScrollButtonStart?: ((props: ScrollButtonProps) => React.ReactElement) | null;
|
|
60
|
+
renderScrollButtonEnd?: ((props: ScrollButtonProps) => React.ReactElement) | null;
|
|
61
|
+
renderScrollButtonEdge?: ((props: ScrollButtonProps) => React.ReactElement) | null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Imperative handle for {@link WorkbookStrip}: the root element plus tab-editing methods
|
|
65
|
+
* (delegated to the underlying {@link TabStrip}). A host menu (e.g. the MUI "Rename" action)
|
|
66
|
+
* uses `startEdit` to begin an inline tab rename.
|
|
67
|
+
*/
|
|
68
|
+
export interface WorkbookStripRef extends HTMLDivElement {
|
|
69
|
+
startEdit(index: number): void;
|
|
70
|
+
cancel(index: number): void;
|
|
71
|
+
}
|
|
72
|
+
export declare const WorkbookStrip: React.NamedExoticComponent<WorkbookStripProps & React.RefAttributes<WorkbookStripRef>>;
|
|
73
|
+
//# sourceMappingURL=WorkbookStrip.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type * from './IWorkbookElement';
|
|
2
|
+
export * from './WorkbookElement';
|
|
3
|
+
export * from './WorkbookStrip';
|
|
4
|
+
export * from './DefaultRenderers';
|
|
5
|
+
export * from './GlobalWorkbookElement';
|
|
6
|
+
export * from './WorkbookCommands';
|
|
7
|
+
export * from './WorkbookCommandContributor';
|
|
8
|
+
export * from './useWorkbookSaveState';
|
|
9
|
+
export * from './useWorkbookName';
|
|
10
|
+
export * from './useWorkbookEncrypted';
|
|
11
|
+
export * from './useWorkbookFormat';
|
|
12
|
+
export * from './resolveWorkbookInput';
|
|
13
|
+
export * from './useResolvedWorkbook';
|
|
14
|
+
export * from './WindowChrome';
|
|
15
|
+
export * from './useWindowChrome';
|
|
16
|
+
export * from './useWorkbookApp';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IWorkbook, IWorkbookIO } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The accepted workbook input: a live model, a promise for one, or read options to create one.
|
|
4
|
+
* A read-produced workbook carries its {@link IWorkbookIO.Origin} itself (see
|
|
5
|
+
* {@link IWorkbook.getOrigin}) — there is no separate pairing to thread.
|
|
6
|
+
*/
|
|
7
|
+
export type WorkbookInput = IWorkbook | Promise<IWorkbook> | IWorkbookIO.ReadOptions;
|
|
8
|
+
export interface ResolveWorkbookOptions {
|
|
9
|
+
/** IO used to read {@link IWorkbookIO.ReadOptions}. Defaults to the shared {@link WorkbookIO}. */
|
|
10
|
+
io?: IWorkbookIO;
|
|
11
|
+
/** Theme applied to a freshly-created default workbook (empty/absent input). */
|
|
12
|
+
defaultTheme?: IWorkbook.ConstructorOptions['theme'];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a {@link WorkbookInput} (or absent/empty input) into an {@link IWorkbook}.
|
|
16
|
+
*
|
|
17
|
+
* - a {@link Workbook} instance is used directly
|
|
18
|
+
* - `null` / an empty options object → a fresh default workbook (unbound origin)
|
|
19
|
+
* - a promise is awaited (and may itself resolve to read options)
|
|
20
|
+
* - {@link IWorkbookIO.ReadOptions} (a `source`) is read via the `io`; the workbook carries the
|
|
21
|
+
* origin minted by the read
|
|
22
|
+
*
|
|
23
|
+
* Throws if a source cannot be read (so a caller can surface an error state rather than a `null`
|
|
24
|
+
* workbook — note {@link IWorkbookIO.read} resolves `null` on failure).
|
|
25
|
+
*/
|
|
26
|
+
export declare const resolveWorkbookInput: (input: WorkbookInput | null | undefined, options?: ResolveWorkbookOptions) => Promise<IWorkbook>;
|
|
27
|
+
//# sourceMappingURL=resolveWorkbookInput.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
import { WorkbookInput, ResolveWorkbookOptions } from './resolveWorkbookInput';
|
|
3
|
+
/** The workbook-resolution lifecycle state returned by {@link useResolvedWorkbook}. */
|
|
4
|
+
export type ResolvedWorkbookState = {
|
|
5
|
+
status: 'loading';
|
|
6
|
+
} | {
|
|
7
|
+
status: 'loaded';
|
|
8
|
+
workbook: IWorkbook;
|
|
9
|
+
} | {
|
|
10
|
+
status: 'error';
|
|
11
|
+
error: unknown;
|
|
12
|
+
};
|
|
13
|
+
export interface UseResolvedWorkbookOptions extends ResolveWorkbookOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Change this to force a re-resolve of the same `input` (e.g. a retry / reload). The `input`
|
|
16
|
+
* identity is the primary trigger; `reloadKey` is an explicit additional one.
|
|
17
|
+
*/
|
|
18
|
+
reloadKey?: unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve a {@link WorkbookInput} (instance / promise / read options / empty) into React state, with
|
|
22
|
+
* a cancellation guard so a superseded input can't overwrite a newer one (stale-load race). On a
|
|
23
|
+
* reload it keeps the previously loaded workbook visible until the new one resolves.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* `io` / `defaultTheme` are resolve-time config (read live), NOT reactive triggers — only `input`
|
|
27
|
+
* (and an explicit {@link UseResolvedWorkbookOptions.reloadKey}) re-resolve, so a changing theme/io
|
|
28
|
+
* identity never forces a re-read of the same source.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useResolvedWorkbook: (input: WorkbookInput | null | undefined, options?: UseResolvedWorkbookOptions) => ResolvedWorkbookState;
|
|
31
|
+
//# sourceMappingURL=useResolvedWorkbook.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WindowChromeOptions } from './WindowChrome';
|
|
2
|
+
/**
|
|
3
|
+
* Opt-in single-per-window app chrome for a workbook: document/tab title (with an unsaved marker),
|
|
4
|
+
* an unsaved-changes close prompt, and a browser keyboard guard. A thin React wrapper over
|
|
5
|
+
* {@link WindowChrome}.
|
|
6
|
+
*
|
|
7
|
+
* @param name The workbook display name to reflect, or `null` (see `useWorkbookName`).
|
|
8
|
+
* @param isDirty Whether there are unsaved changes (see `useWorkbookSaveState`).
|
|
9
|
+
* @param options Behavior options (title / close prompt / keyboard guard).
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* For apps that own the whole window — NOT for embedding `Studio` as a widget (which must not touch
|
|
13
|
+
* the window title / `beforeunload` of its host). Each concern (title / close / keyboard) defaults
|
|
14
|
+
* on and can be disabled individually via {@link WindowChromeOptions}.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const name = useWorkbookName(workbook);
|
|
19
|
+
* const { isDirty } = useWorkbookSaveState(workbook, WorkbookIO);
|
|
20
|
+
* useWindowChrome(name, isDirty);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const useWindowChrome: (name: string | null, isDirty: boolean, options?: WindowChromeOptions) => void;
|
|
24
|
+
//# sourceMappingURL=useWindowChrome.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IWorkbook, IWorkbookIO } from '@sheetxl/sdk';
|
|
2
|
+
import { WindowChromeOptions } from './WindowChrome';
|
|
3
|
+
export interface WorkbookAppOptions extends WindowChromeOptions {
|
|
4
|
+
/**
|
|
5
|
+
* What to open. A live {@link IWorkbook} / `Promise` for one is used directly; a
|
|
6
|
+
* {@link IWorkbookIO.ReadOptions} (or a `source` string) is read via {@link WorkbookAppOptions.io}.
|
|
7
|
+
* If omitted, the `?source` (and `?title`) URL query is used (see {@link WorkbookAppOptions.fromUrl});
|
|
8
|
+
* with no source at all, a blank workbook is created.
|
|
9
|
+
*/
|
|
10
|
+
source?: IWorkbook | Promise<IWorkbook> | IWorkbookIO.ReadOptions | string;
|
|
11
|
+
/**
|
|
12
|
+
* IO used to read a source AND as the save commit-source for the dirty marker. Defaults to the
|
|
13
|
+
* shared {@link WorkbookIO} (the same instance Studio's file commands use, so the dirty state
|
|
14
|
+
* matches) — most apps don't need to pass this.
|
|
15
|
+
*/
|
|
16
|
+
io?: IWorkbookIO;
|
|
17
|
+
/**
|
|
18
|
+
* When no explicit {@link WorkbookAppOptions.source} is given, read `?source` / `?title` from the
|
|
19
|
+
* URL.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue true
|
|
22
|
+
*/
|
|
23
|
+
fromUrl?: boolean;
|
|
24
|
+
/** Theme for a freshly-created blank workbook (no source). */
|
|
25
|
+
defaultTheme?: IWorkbook.ConstructorOptions['theme'];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Single-call setup for a single-per-window workbook app: resolves the workbook ONCE (an explicit
|
|
29
|
+
* source, the `?source` URL query, or a blank workbook) and manages the window chrome (document/tab
|
|
30
|
+
* title with an unsaved marker, an unsaved-changes close prompt, and a browser keyboard guard).
|
|
31
|
+
*
|
|
32
|
+
* @returns the workbook (an `IWorkbook` or a `Promise<IWorkbook>`) to hand to the view
|
|
33
|
+
* ({@link @sheetxl/react!WorkbookElement} or `Studio`). The view awaits the **same** promise, so the
|
|
34
|
+
* workbook loads once and the chrome + the view observe the same instance.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* For apps that own the whole window — NOT for embedding a workbook as a widget. Read failures
|
|
38
|
+
* reject the returned promise (so the view's error panel shows) rather than yielding a null workbook.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const workbook = useWorkbookApp(); // reads ?source, else a blank workbook
|
|
43
|
+
* return <Studio workbook={workbook} />; // or <WorkbookElement workbook={workbook} />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const useWorkbookApp: (options?: WorkbookAppOptions) => IWorkbook | Promise<IWorkbook>;
|
|
47
|
+
//# sourceMappingURL=useWorkbookApp.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks whether a workbook is — or, once saved, *will be* — encrypted, as React state.
|
|
4
|
+
*
|
|
5
|
+
* @param workbook The workbook to track, or `null`.
|
|
6
|
+
* @returns `true` when the file is encrypted or a password has been set for it.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Reads `Origin.isEncrypted()`, which covers both: a read or a completed write records what is on
|
|
10
|
+
* disk, and `Origin.setPassword` records the intent immediately — the same latitude
|
|
11
|
+
* `Origin.setName` has. One source, one `onChange` to follow, so a lock appears the moment a
|
|
12
|
+
* password is set rather than only after the save that applies it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useWorkbookEncrypted: (workbook: IWorkbook | null) => boolean;
|
|
15
|
+
//# sourceMappingURL=useWorkbookEncrypted.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the format a workbook is bound to (`Origin.getFormat()`) as React state.
|
|
4
|
+
*
|
|
5
|
+
* @param workbook The workbook to track, or `null`.
|
|
6
|
+
* @returns The resolved format key (e.g. `'SheetXL'`), the path's extension when no key has been
|
|
7
|
+
* resolved yet, or `null` for an unbound workbook.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* A format KEY, not a full format type — resolving one to the other needs the registry
|
|
11
|
+
* (`getWriteFormats({ search: key })`), which is async and a concern of whoever is asking.
|
|
12
|
+
*
|
|
13
|
+
* Follows the handle's `onChange`, so chrome that names the current format (a Save As menu, a
|
|
14
|
+
* status bar) updates the moment a Save As re-targets the workbook rather than going stale until
|
|
15
|
+
* the next mount.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useWorkbookFormat: (workbook: IWorkbook | null) => string | null;
|
|
18
|
+
//# sourceMappingURL=useWorkbookFormat.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks a workbook's name (`getName()`) as React state, updating on {@link IWorkbook.IListeners.onNameChange}.
|
|
4
|
+
*
|
|
5
|
+
* @param workbook The workbook to track, or `null`.
|
|
6
|
+
* @returns The current workbook name, or `null` when there is no workbook / no name.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* A small model observer so the title shown by chrome (a tab title, the Studio title bar, etc.)
|
|
10
|
+
* follows the workbook's name reactively rather than reading it once.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useWorkbookName: (workbook: IWorkbook | null) => string | null;
|
|
13
|
+
//# sourceMappingURL=useWorkbookName.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IWorkbook, ITransaction, TransactionSaveStateManager } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The result of {@link useWorkbookSaveState}.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkbookSaveState {
|
|
6
|
+
/**
|
|
7
|
+
* `true` when the workbook has unsaved changes (its current commit differs from the last saved).
|
|
8
|
+
*/
|
|
9
|
+
isDirty: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The underlying manager, or `null` until a workbook is set. Use {@link TransactionSaveStateManager.isDirty}
|
|
12
|
+
* for a live (non-render) read, e.g. inside a command handler.
|
|
13
|
+
*/
|
|
14
|
+
saveState: TransactionSaveStateManager | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Tracks a workbook's dirty (unsaved-changes) state as React state.
|
|
18
|
+
*
|
|
19
|
+
* @param workbook The workbook to track, or `null`.
|
|
20
|
+
* @param commitSource A source of durable-commit notifications (e.g. `WorkbookIO`) so a successful
|
|
21
|
+
* save marks the workbook clean automatically.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Owns a {@link TransactionSaveStateManager} for the life of the workbook and closes it on
|
|
25
|
+
* change/unmount. The "saved baseline" is whatever the `commitSource` reports as durably committed;
|
|
26
|
+
* without one, dirtiness is measured relative to the workbook's initial commit.
|
|
27
|
+
*/
|
|
28
|
+
export declare const useWorkbookSaveState: (workbook: IWorkbook | null, commitSource?: ITransaction.ICommitSource) => WorkbookSaveState;
|
|
29
|
+
//# sourceMappingURL=useWorkbookSaveState.d.ts.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";/**
|
|
2
|
-
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.27
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/function _e(m,j){for(var O=0;O<j.length;O++){const o=j[O];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in m)){const s=Object.getOwnPropertyDescriptor(o,a);s&&Object.defineProperty(m,a,s.get?s:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(m,Symbol.toStringTag,{value:"Module"}))}var K,W={},G={},E={},X={},$,U={};function me(){if($)return U;$=1;var m=U&&U.__awaiter||function(o,a,s,n){return new(s||(s=Promise))(function(e,u){function h(_){try{P(n.next(_))}catch(f){u(f)}}function d(_){try{P(n.throw(_))}catch(f){u(f)}}function P(_){var f;_.done?e(_.value):(f=_.value,f instanceof s?f:new s(function(r){r(f)})).then(h,d)}P((n=n.apply(o,a||[])).next())})},j=U&&U.__generator||function(o,a){var s,n,e,u,h={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return u={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function d(P){return function(_){return(function(f){if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,n&&(e=2&f[0]?n.return:f[0]?n.throw||((e=n.return)&&e.call(n),0):n.next)&&!(e=e.call(n,f[1])).done)return e;switch(n=0,e&&(f=[2&f[0],e.value]),f[0]){case 0:case 1:e=f;break;case 4:return h.label++,{value:f[1],done:!1};case 5:h.label++,n=f[1],f=[0];continue;case 7:f=h.ops.pop(),h.trys.pop();continue;default:if(e=h.trys,!((e=e.length>0&&e[e.length-1])||f[0]!==6&&f[0]!==2)){h=0;continue}if(f[0]===3&&(!e||f[1]>e[0]&&f[1]<e[3])){h.label=f[1];break}if(f[0]===6&&h.label<e[1]){h.label=e[1],e=f;break}if(e&&h.label<e[2]){h.label=e[2],h.ops.push(f);break}e[2]&&h.ops.pop(),h.trys.pop();continue}f=a.call(o,h)}catch(r){f=[6,r],n=0}finally{s=e=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}})([P,_])}}};Object.defineProperty(U,"__esModule",{value:!0}),U.JsDelivrSourceResolver=void 0;var O=(function(){function o(){}return o.prototype.resolvePackageJson=function(a,s,n){return m(this,void 0,void 0,function(){return j(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(a).concat(s?"@".concat(s):"").concat(n?"/".concat(n):"","/package.json"))];case 1:return[2,e.sent()]}})})},o.prototype.resolveSourceFile=function(a,s,n){return m(this,void 0,void 0,function(){return j(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://cdn.jsdelivr.net/npm/".concat(a).concat(s?"@".concat(s):"","/").concat(n))];case 1:return[2,e.sent()]}})})},o.prototype.resolveFile=function(a){return m(this,void 0,void 0,function(){var s;return j(this,function(n){switch(n.label){case 0:return[4,fetch(a,{method:"GET"})];case 1:return(s=n.sent()).ok?[4,s.text()]:[3,3];case 2:return[2,n.sent()];case 3:if(s.status===404)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(a));case 4:return[2]}})})},o})();return U.JsDelivrSourceResolver=O,U}var H,Q,Y,C={},F={};function q(){if(Q)return H;function m(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function j(o,a){for(var s,n="",e=0,u=-1,h=0,d=0;d<=o.length;++d){if(d<o.length)s=o.charCodeAt(d);else{if(s===47)break;s=47}if(s===47){if(!(u===d-1||h===1))if(u!==d-1&&h===2){if(n.length<2||e!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var P=n.lastIndexOf("/");if(P!==n.length-1){P===-1?(n="",e=0):e=(n=n.slice(0,P)).length-1-n.lastIndexOf("/"),u=d,h=0;continue}}else if(n.length===2||n.length===1){n="",e=0,u=d,h=0;continue}}a&&(n.length>0?n+="/..":n="..",e=2)}else n.length>0?n+="/"+o.slice(u+1,d):n=o.slice(u+1,d),e=d-u-1;u=d,h=0}else s===46&&h!==-1?++h:h=-1}return n}Q=1;var O={resolve:function(){for(var o,a="",s=!1,n=arguments.length-1;n>=-1&&!s;n--){var e;n>=0?e=arguments[n]:(o===void 0&&(o=process.cwd()),e=o),m(e),e.length!==0&&(a=e+"/"+a,s=e.charCodeAt(0)===47)}return a=j(a,!s),s?a.length>0?"/"+a:"/":a.length>0?a:"."},normalize:function(o){if(m(o),o.length===0)return".";var a=o.charCodeAt(0)===47,s=o.charCodeAt(o.length-1)===47;return(o=j(o,!a)).length!==0||a||(o="."),o.length>0&&s&&(o+="/"),a?"/"+o:o},isAbsolute:function(o){return m(o),o.length>0&&o.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var o,a=0;a<arguments.length;++a){var s=arguments[a];m(s),s.length>0&&(o===void 0?o=s:o+="/"+s)}return o===void 0?".":O.normalize(o)},relative:function(o,a){if(m(o),m(a),o===a||(o=O.resolve(o))===(a=O.resolve(a)))return"";for(var s=1;s<o.length&&o.charCodeAt(s)===47;++s);for(var n=o.length,e=n-s,u=1;u<a.length&&a.charCodeAt(u)===47;++u);for(var h=a.length-u,d=e<h?e:h,P=-1,_=0;_<=d;++_){if(_===d){if(h>d){if(a.charCodeAt(u+_)===47)return a.slice(u+_+1);if(_===0)return a.slice(u+_)}else e>d&&(o.charCodeAt(s+_)===47?P=_:_===0&&(P=0));break}var f=o.charCodeAt(s+_);if(f!==a.charCodeAt(u+_))break;f===47&&(P=_)}var r="";for(_=s+P+1;_<=n;++_)_!==n&&o.charCodeAt(_)!==47||(r.length===0?r+="..":r+="/..");return r.length>0?r+a.slice(u+P):(u+=P,a.charCodeAt(u)===47&&++u,a.slice(u))},_makeLong:function(o){return o},dirname:function(o){if(m(o),o.length===0)return".";for(var a=o.charCodeAt(0),s=a===47,n=-1,e=!0,u=o.length-1;u>=1;--u)if((a=o.charCodeAt(u))===47){if(!e){n=u;break}}else e=!1;return n===-1?s?"/":".":s&&n===1?"//":o.slice(0,n)},basename:function(o,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');m(o);var s,n=0,e=-1,u=!0;if(a!==void 0&&a.length>0&&a.length<=o.length){if(a.length===o.length&&a===o)return"";var h=a.length-1,d=-1;for(s=o.length-1;s>=0;--s){var P=o.charCodeAt(s);if(P===47){if(!u){n=s+1;break}}else d===-1&&(u=!1,d=s+1),h>=0&&(P===a.charCodeAt(h)?--h===-1&&(e=s):(h=-1,e=d))}return n===e?e=d:e===-1&&(e=o.length),o.slice(n,e)}for(s=o.length-1;s>=0;--s)if(o.charCodeAt(s)===47){if(!u){n=s+1;break}}else e===-1&&(u=!1,e=s+1);return e===-1?"":o.slice(n,e)},extname:function(o){m(o);for(var a=-1,s=0,n=-1,e=!0,u=0,h=o.length-1;h>=0;--h){var d=o.charCodeAt(h);if(d!==47)n===-1&&(e=!1,n=h+1),d===46?a===-1?a=h:u!==1&&(u=1):a!==-1&&(u=-1);else if(!e){s=h+1;break}}return a===-1||n===-1||u===0||u===1&&a===n-1&&a===s+1?"":o.slice(a,n)},format:function(o){if(o===null||typeof o!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof o);return(function(a,s){var n=s.dir||s.root,e=s.base||(s.name||"")+(s.ext||"");return n?n===s.root?n+e:n+a+e:e})("/",o)},parse:function(o){m(o);var a={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return a;var s,n=o.charCodeAt(0),e=n===47;e?(a.root="/",s=1):s=0;for(var u=-1,h=0,d=-1,P=!0,_=o.length-1,f=0;_>=s;--_)if((n=o.charCodeAt(_))!==47)d===-1&&(P=!1,d=_+1),n===46?u===-1?u=_:f!==1&&(f=1):u!==-1&&(f=-1);else if(!P){h=_+1;break}return u===-1||d===-1||f===0||f===1&&u===d-1&&u===h+1?d!==-1&&(a.base=a.name=h===0&&e?o.slice(1,d):o.slice(h,d)):(h===0&&e?(a.name=o.slice(1,u),a.base=o.slice(1,d)):(a.name=o.slice(h,u),a.base=o.slice(h,d)),a.ext=o.slice(u,d)),h>0?a.dir=o.slice(0,h-1):e&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return O.posix=O,H=O}var Z,J={};function be(){if(Z)return J;Z=1;var m=J&&J.__importDefault||function(O){return O&&O.__esModule?O:{default:O}};Object.defineProperty(J,"__esModule",{value:!0}),J.importResourcePathToString=void 0;var j=m(q());return J.importResourcePathToString=function(O){var o;switch(O.kind){case"package":return j.default.join(O.packageName,(o=O.importPath)!==null&&o!==void 0?o:"","package.json");case"relative":return j.default.join(O.sourcePath,O.importPath);case"relative-in-package":return j.default.join(O.packageName,O.sourcePath,O.importPath)}},J}var ee,B={};function ke(){return ee?B:(ee=1,Object.defineProperty(B,"__esModule",{value:!0}),B.invokeUpdate=void 0,B.invokeUpdate=function(m,j){var O,o="".concat(m.type,": ");switch(m.type){case"CodeChanged":case"ResolveNewImports":o+="";break;case"LookedUpTypeFile":o+='"'.concat(m.path,'" was ').concat(m.success?"sucessfully":"not sucessfully"," looked up");break;case"AttemptedLookUpFile":o+='"'.concat(m.path,'" was ').concat(m.success?"sucessfully":"not sucessfully"," attempted to looked up");break;case"LookedUpPackage":o+='package.json for package "'.concat(m.package,'" was ').concat(m.success?"sucessfully":"not sucessfully"," looked up").concat(m.definitelyTyped?" (found in definitely typed repo)":"");break;case"LoadedFromCache":o+='"'.concat(m.importPath,'" was loaded from cache');break;case"StoredToCache":o+='"'.concat(m.importPath,'" was stored to cache')}o.endsWith(": ")&&(o=o.slice(void 0,-2)),(O=j.onUpdate)===null||O===void 0||O.call(j,m,o)},B)}var te,re,ne,oe,z={};function we(){if(te)return z;te=1,Object.defineProperty(z,"__esModule",{value:!0}),z.RecursionDepth=void 0;var m=(function(){function j(O,o,a){o===void 0&&(o=0),a===void 0&&(a=0),this.options=O,this.fileRecursionDepth=o,this.packageRecursionDepth=a}return j.prototype.nextPackage=function(){return new j(this.options,this.fileRecursionDepth,this.packageRecursionDepth+1)},j.prototype.nextFile=function(){return new j(this.options,this.fileRecursionDepth+1,this.packageRecursionDepth)},j.prototype.same=function(){return new j(this.options,this.fileRecursionDepth,this.packageRecursionDepth)},j.prototype.shouldStop=function(){return this.options.fileRecursionDepth>0&&this.fileRecursionDepth>=this.options.fileRecursionDepth||this.options.packageRecursionDepth>0&&this.packageRecursionDepth>=this.options.packageRecursionDepth},j})();return z.RecursionDepth=m,z}function Pe(){if(re)return C;re=1;var m=C&&C.__assign||function(){return m=Object.assign||function(r){for(var t,c=1,l=arguments.length;c<l;c++)for(var i in t=arguments[c])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r},m.apply(this,arguments)},j=C&&C.__createBinding||(Object.create?function(r,t,c,l){l===void 0&&(l=c);var i=Object.getOwnPropertyDescriptor(t,c);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[c]}}),Object.defineProperty(r,l,i)}:function(r,t,c,l){l===void 0&&(l=c),r[l]=t[c]}),O=C&&C.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),o=C&&C.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var c in r)c!=="default"&&Object.prototype.hasOwnProperty.call(r,c)&&j(t,r,c);return O(t,r),t},a=C&&C.__awaiter||function(r,t,c,l){return new(c||(c=Promise))(function(i,g){function v(k){try{y(l.next(k))}catch(p){g(p)}}function b(k){try{y(l.throw(k))}catch(p){g(p)}}function y(k){var p;k.done?i(k.value):(p=k.value,p instanceof c?p:new c(function(w){w(p)})).then(v,b)}y((l=l.apply(r,t||[])).next())})},s=C&&C.__generator||function(r,t){var c,l,i,g,v={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function b(y){return function(k){return(function(p){if(c)throw new TypeError("Generator is already executing.");for(;v;)try{if(c=1,l&&(i=2&p[0]?l.return:p[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,p[1])).done)return i;switch(l=0,i&&(p=[2&p[0],i.value]),p[0]){case 0:case 1:i=p;break;case 4:return v.label++,{value:p[1],done:!1};case 5:v.label++,l=p[1],p=[0];continue;case 7:p=v.ops.pop(),v.trys.pop();continue;default:if(i=v.trys,!((i=i.length>0&&i[i.length-1])||p[0]!==6&&p[0]!==2)){v=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){v.label=p[1];break}if(p[0]===6&&v.label<i[1]){v.label=i[1],i=p;break}if(i&&v.label<i[2]){v.label=i[2],v.ops.push(p);break}i[2]&&v.ops.pop(),v.trys.pop();continue}p=t.call(r,v)}catch(w){p=[6,w],l=0}finally{c=i=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}})([y,k])}}},n=C&&C.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,c=t&&r[t],l=0;if(c)return c.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&l>=r.length&&(r=void 0),{value:r&&r[l++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},e=C&&C.__read||function(r,t){var c=typeof Symbol=="function"&&r[Symbol.iterator];if(!c)return r;var l,i,g=c.call(r),v=[];try{for(;(t===void 0||t-- >0)&&!(l=g.next()).done;)v.push(l.value)}catch(b){i={error:b}}finally{try{l&&!l.done&&(c=g.return)&&c.call(g)}finally{if(i)throw i.error}}return v};Object.defineProperty(C,"__esModule",{value:!0}),C.ImportResolver=void 0;var u=(function(){if(Y)return F;Y=1;var r=F&&F.__createBinding||(Object.create?function(b,y,k,p){p===void 0&&(p=k);var w=Object.getOwnPropertyDescriptor(y,k);w&&!("get"in w?!y.__esModule:w.writable||w.configurable)||(w={enumerable:!0,get:function(){return y[k]}}),Object.defineProperty(b,p,w)}:function(b,y,k,p){p===void 0&&(p=k),b[p]=y[k]}),t=F&&F.__setModuleDefault||(Object.create?function(b,y){Object.defineProperty(b,"default",{enumerable:!0,value:y})}:function(b,y){b.default=y}),c=F&&F.__importStar||function(b){if(b&&b.__esModule)return b;var y={};if(b!=null)for(var k in b)k!=="default"&&Object.prototype.hasOwnProperty.call(b,k)&&r(y,b,k);return t(y,b),y},l=F&&F.__read||function(b,y){var k=typeof Symbol=="function"&&b[Symbol.iterator];if(!k)return b;var p,w,S=k.call(b),A=[];try{for(;(y===void 0||y-- >0)&&!(p=S.next()).done;)A.push(p.value)}catch(x){w={error:x}}finally{try{p&&!p.done&&(k=S.return)&&k.call(S)}finally{if(w)throw w.error}}return A},i=F&&F.__spreadArray||function(b,y,k){if(k||arguments.length===2)for(var p,w=0,S=y.length;w<S;w++)!p&&w in y||(p||(p=Array.prototype.slice.call(y,0,w)),p[w]=y[w]);return b.concat(p||Array.prototype.slice.call(y))};Object.defineProperty(F,"__esModule",{value:!0}),F.DependencyParser=void 0;var g=c(q()),v=(function(){function b(){this.REGEX_CLEAN=/[\n|\r]/g,this.REGEX_DETECT_IMPORT=/(?:(?:(?:import)|(?:export))(?:.)*?from\s+["']([^"']+)["'])|(?:((?:require|import))(?:\s+)?\(["']([^"']+)["']\))|(?:\/+\s+<reference\s+path=["']([^"']+)["']\s+\/>)/g,this.REGEX_NODE_MODULE=/^node:([\w\W\/]+)$/}return b.prototype.parseDependencies=function(y,k){var p=this;return i([],l(y.matchAll(this.REGEX_DETECT_IMPORT)),!1).map(function(w){var S,A;return(A=(S=w[1])!==null&&S!==void 0?S:w[2])!==null&&A!==void 0?A:w[3]}).filter(function(w){return!!w}).map(function(w){return p.resolvePath(w,k)})},b.prototype.resolvePath=function(y,k){var p=y.match(this.REGEX_NODE_MODULE);if(p)return{kind:"relative-in-package",packageName:"@types/node",importPath:"".concat(p[1],".d.ts"),sourcePath:""};if(typeof k=="string"){if(y.startsWith("."))return{kind:"relative",importPath:y,sourcePath:k};if(y.startsWith("@")){var w=y.split("/");return{kind:"package",packageName:"".concat(w[0],"/").concat(w[1]),importPath:w.slice(2).join("/")}}return{kind:"package",packageName:(w=y.split("/"))[0],importPath:w.slice(1).join("/")}}switch(k.kind){case"package":throw Error("TODO?");case"relative":throw Error("TODO2?");case"relative-in-package":return y.startsWith(".")?{kind:"relative-in-package",packageName:k.packageName,sourcePath:g.join(k.sourcePath,k.importPath),importPath:y}:y.startsWith("@")?(w=y.split("/"),{kind:"package",packageName:"".concat(w[0],"/").concat(w[1]),importPath:w.slice(2).join("/")}):{kind:"package",packageName:(w=y.split("/"))[0],importPath:w.slice(1).join("/")}}},b})();return F.DependencyParser=v,F})(),h=be(),d=o(q()),P=ke(),_=we(),f=(function(){function r(t){var c,l;if(this.options=t,this.loadedFiles=[],this.dependencyParser=new u.DependencyParser,this.cache=t.sourceCache,this.sourceResolver=t.sourceResolver,this.newImportsResolved=!1,this.monaco=t.monaco,t.preloadPackages&&t.versions){this.versions=t.versions;try{for(var i=n(Object.entries(t.versions)),g=i.next();!g.done;g=i.next()){var v=e(g.value,2),b=v[0];v[1],this.resolveImport({kind:"package",packageName:b,importPath:""},new _.RecursionDepth(this.options)).catch(function(y){console.error(y)})}}catch(y){c={error:y}}finally{try{g&&!g.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}}}}return r.prototype.wereNewImportsResolved=function(){return this.newImportsResolved},r.prototype.resetNewImportsResolved=function(){this.newImportsResolved=!1},r.prototype.resolveImportsInFile=function(t,c,l){var i,g,v;return a(this,void 0,void 0,function(){var b,y,k,p,w,S,A,x;return s(this,function(R){switch(R.label){case 0:if(l.shouldStop())return[2];b=this.dependencyParser.parseDependencies(t,c),R.label=1;case 1:R.trys.push([1,8,9,10]),y=n(b),k=y.next(),R.label=2;case 2:if(k.done)return[3,7];p=k.value,R.label=3;case 3:return R.trys.push([3,5,,6]),[4,this.resolveImport(p,l)];case 4:return R.sent(),[3,6];case 5:return w=R.sent(),this.options.onError?(g=(i=this.options).onError)===null||g===void 0||g.call(i,(v=w.message)!==null&&v!==void 0?v:w):console.error(w),[3,6];case 6:return k=y.next(),[3,2];case 7:return[3,10];case 8:return S=R.sent(),A={error:S},[3,10];case 9:try{k&&!k.done&&(x=y.return)&&x.call(y)}finally{if(A)throw A.error}return[7];case 10:return[2]}})})},r.prototype.resolveImport=function(t,c){return a(this,void 0,void 0,function(){var l,i;return s(this,function(g){switch(g.label){case 0:if(l=this.hashImportResourcePath(t),this.loadedFiles.includes(l))return[2];switch(this.loadedFiles.push(l),t.kind){case"package":return[3,1];case"relative":return[3,5];case"relative-in-package":return[3,6]}return[3,8];case 1:return[4,this.resolveImportFromPackageRoot(t)];case 2:return(i=g.sent())?[4,this.resolveImportInPackage(i,c.nextPackage().nextFile())]:[3,4];case 3:case 7:return[2,g.sent()];case 4:return[3,8];case 5:throw Error("Not implemented yet");case 6:return[4,this.resolveImportInPackage(t,c.nextFile())];case 8:return[2]}})})},r.prototype.resolveImportInPackage=function(t,c){return a(this,void 0,void 0,function(){var l,i,g;return s(this,function(v){switch(v.label){case 0:return[4,this.loadSourceFileContents(t)];case 1:return(l=v.sent())?(i=l.source,g=l.at,this.createModel(i,this.monaco.Uri.parse(this.options.fileRootPath+d.join("node_modules/".concat(t.packageName),g))),[4,this.resolveImportsInFile(i,{kind:"relative-in-package",packageName:t.packageName,sourcePath:d.dirname(g),importPath:""},c)]):[3,3];case 2:v.sent(),v.label=3;case 3:return[2]}})})},r.prototype.resolveImportFromPackageRoot=function(t){var c,l,i,g,v,b,y,k,p;return a(this,void 0,void 0,function(){var w,S,A,x,R,N,V,D,T;return s(this,function(M){switch(M.label){case 0:return w={type:"LookedUpPackage",package:t.packageName,definitelyTyped:!1,success:!1},!this.options.onlySpecifiedPackages||!((c=this.versions)===null||c===void 0)&&c[t.packageName]||!((l=this.versions)===null||l===void 0)&&l["@types/"+t.packageName]?(S=(g=(i=t.importPath)===null||i===void 0?void 0:i.length)!==null&&g!==void 0&&g,A=S?"/".concat(t.importPath):"",[4,this.resolvePackageJson(t.packageName,(v=this.versions)===null||v===void 0?void 0:v[t.packageName],S?t.importPath:void 0)]):((0,P.invokeUpdate)(w,this.options),[2]);case 1:return(x=M.sent())||!S?[3,3]:[4,this.resolvePackageJson(t.packageName,(b=this.versions)===null||b===void 0?void 0:b[t.packageName])];case 2:x=M.sent(),A="",M.label=3;case 3:return x?(R=JSON.parse(x)).typings||R.types?(T=R.typings||R.types,this.createModel(x,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(t.packageName).concat(A,"/package.json"))),(0,P.invokeUpdate)({type:"LookedUpPackage",package:t.packageName,definitelyTyped:!1,success:!0},this.options),this.setVersion(t.packageName,R.version),[2,{kind:"relative-in-package",packageName:t.packageName,sourcePath:"",importPath:d.join((y=t.importPath)!==null&&y!==void 0?y:"",T.startsWith("./")?T.slice(2):T)}]):[3,4]:[3,7];case 4:return N="@types/".concat(t.packageName.startsWith("@")?t.packageName.slice(1).replace(/\//,"__"):t.packageName),[4,this.resolvePackageJson(N,(k=this.versions)===null||k===void 0?void 0:k[N])];case 5:if(V=M.sent()){if((D=JSON.parse(V)).typings||D.types)return T=D.typings||D.types,this.createModel(V,this.monaco.Uri.parse("".concat(this.options.fileRootPath,"node_modules/").concat(N,"/package.json"))),(0,P.invokeUpdate)({type:"LookedUpPackage",package:N,definitelyTyped:!0,success:!0},this.options),this.setVersion(N,D.version),[2,{kind:"relative-in-package",packageName:N,sourcePath:"",importPath:d.join((p=t.importPath)!==null&&p!==void 0?p:"",T.startsWith("./")?T.slice(2):T)}];(0,P.invokeUpdate)(w,this.options)}else(0,P.invokeUpdate)(w,this.options);M.label=6;case 6:return[3,8];case 7:(0,P.invokeUpdate)(w,this.options),M.label=8;case 8:return[2]}})})},r.prototype.loadSourceFileContents=function(t){return a(this,void 0,void 0,function(){var c,l,i,g,v,b,y,k,p,w,S,A,x,R,N,V;return s(this,function(D){switch(D.label){case 0:return c=d.join(t.packageName,t.sourcePath,t.importPath),l={type:"LookedUpTypeFile",path:c,definitelyTyped:!1,success:!1},i=t.packageName,g=this.getVersion(t.packageName),(v=[".d.ts","/index.d.ts",".ts",".tsx","/index.ts","/index.tsx"]).map(function(T){return t.importPath.endsWith(T)}).reduce(function(T,M){return T||M},!1)?[4,this.resolveSourceFile(i,g,d.join(t.sourcePath,t.importPath))]:[3,2];case 1:return(R=D.sent())?[2,{source:R,at:d.join(t.sourcePath,t.importPath)}]:[3,9];case 2:D.trys.push([2,7,8,9]),b=n(v),y=b.next(),D.label=3;case 3:return y.done?[3,6]:(k=y.value,p=d.join(t.sourcePath,t.importPath),x=(k===".d.ts"&&p.endsWith(".js")?p.slice(0,-3):p)+k,[4,this.resolveSourceFile(i,g,x)]);case 4:if(R=D.sent(),(0,P.invokeUpdate)({type:"AttemptedLookUpFile",path:d.join(i,x),success:!!R},this.options),R)return(0,P.invokeUpdate)({type:"LookedUpTypeFile",path:d.join(i,x),success:!0},this.options),[2,{source:R,at:x}];D.label=5;case 5:return y=b.next(),[3,3];case 6:return[3,9];case 7:return w=D.sent(),N={error:w},[3,9];case 8:try{y&&!y.done&&(V=b.return)&&V.call(b)}finally{if(N)throw N.error}return[7];case 9:return[4,this.resolvePackageJson(i,g,d.join(t.sourcePath,t.importPath))];case 10:return(S=D.sent())&&(A=JSON.parse(S).types)?(x=d.join(t.sourcePath,t.importPath,A),[4,this.resolveSourceFile(i,g,x)]):[3,12];case 11:if(R=D.sent())return(0,P.invokeUpdate)({type:"LookedUpTypeFile",path:d.join(i,x),success:!0},this.options),[2,{source:R,at:x}];D.label=12;case 12:return(0,P.invokeUpdate)(l,this.options),[2,null]}})})},r.prototype.getVersion=function(t){var c;return(c=this.versions)===null||c===void 0?void 0:c[t]},r.prototype.setVersions=function(t){var c,l;this.versions=t,(l=(c=this.options).onUpdateVersions)===null||l===void 0||l.call(c,t)},r.prototype.setVersion=function(t,c){var l;this.setVersions(m(m({},this.versions),((l={})[t]=c,l)))},r.prototype.createModel=function(t,c){c=c.with({path:c.path.replace("@types/","")}),this.monaco.editor.getModel(c)||(this.monaco.editor.createModel(t,"typescript",c),this.newImportsResolved=!0)},r.prototype.hashImportResourcePath=function(t){return(0,h.importResourcePathToString)(t)},r.prototype.resolvePackageJson=function(t,c,l){return a(this,void 0,void 0,function(){var i,g,v,b;return s(this,function(y){switch(y.label){case 0:return i=d.join(t+(c?"@".concat(c):""),l??"","package.json"),g=!1,v=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(i)]:[3,2];case 1:return g=y.sent(),[3,4];case 2:return[4,this.cache.getFile(i)];case 3:v=y.sent(),g=v!==void 0,y.label=4;case 4:return g?v==null?[3,5]:(b=v,[3,7]):[3,8];case 5:return[4,this.cache.getFile(i)];case 6:b=y.sent(),y.label=7;case 7:return[2,b];case 8:return[4,this.sourceResolver.resolvePackageJson(t,c,l)];case 9:return(v=y.sent())&&this.cache.storeFile(i,v),[2,v]}})})},r.prototype.resolveSourceFile=function(t,c,l){return a(this,void 0,void 0,function(){var i,g,v,b;return s(this,function(y){switch(y.label){case 0:return i=d.join(t+(c?"@".concat(c):""),l),g=!1,v=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(i)]:[3,2];case 1:return g=y.sent(),[3,4];case 2:return[4,this.cache.getFile(i)];case 3:v=y.sent(),g=v!==void 0,y.label=4;case 4:return g?((0,P.invokeUpdate)({type:"LoadedFromCache",importPath:i},this.options),v==null?[3,5]:(b=v,[3,7])):[3,8];case 5:return[4,this.cache.getFile(i)];case 6:b=y.sent(),y.label=7;case 7:return[2,b];case 8:return[4,this.sourceResolver.resolveSourceFile(t,c,l)];case 9:return(v=y.sent())&&((0,P.invokeUpdate)({type:"StoredToCache",importPath:i},this.options),this.cache.storeFile(i,v)),[2,v]}})})},r})();return C.ImportResolver=f,C}function Oe(){if(ne)return E;ne=1;var m=E&&E.__assign||function(){return m=Object.assign||function(r){for(var t,c=1,l=arguments.length;c<l;c++)for(var i in t=arguments[c])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r},m.apply(this,arguments)},j=E&&E.__createBinding||(Object.create?function(r,t,c,l){l===void 0&&(l=c);var i=Object.getOwnPropertyDescriptor(t,c);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[c]}}),Object.defineProperty(r,l,i)}:function(r,t,c,l){l===void 0&&(l=c),r[l]=t[c]}),O=E&&E.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),o=E&&E.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var c in r)c!=="default"&&Object.prototype.hasOwnProperty.call(r,c)&&j(t,r,c);return O(t,r),t},a=E&&E.__awaiter||function(r,t,c,l){return new(c||(c=Promise))(function(i,g){function v(k){try{y(l.next(k))}catch(p){g(p)}}function b(k){try{y(l.throw(k))}catch(p){g(p)}}function y(k){var p;k.done?i(k.value):(p=k.value,p instanceof c?p:new c(function(w){w(p)})).then(v,b)}y((l=l.apply(r,t||[])).next())})},s=E&&E.__generator||function(r,t){var c,l,i,g,v={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return g={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function b(y){return function(k){return(function(p){if(c)throw new TypeError("Generator is already executing.");for(;v;)try{if(c=1,l&&(i=2&p[0]?l.return:p[0]?l.throw||((i=l.return)&&i.call(l),0):l.next)&&!(i=i.call(l,p[1])).done)return i;switch(l=0,i&&(p=[2&p[0],i.value]),p[0]){case 0:case 1:i=p;break;case 4:return v.label++,{value:p[1],done:!1};case 5:v.label++,l=p[1],p=[0];continue;case 7:p=v.ops.pop(),v.trys.pop();continue;default:if(i=v.trys,!((i=i.length>0&&i[i.length-1])||p[0]!==6&&p[0]!==2)){v=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]<i[3])){v.label=p[1];break}if(p[0]===6&&v.label<i[1]){v.label=i[1],i=p;break}if(i&&v.label<i[2]){v.label=i[2],v.ops.push(p);break}i[2]&&v.ops.pop(),v.trys.pop();continue}p=t.call(r,v)}catch(w){p=[6,w],l=0}finally{c=i=0}if(5&p[0])throw p[1];return{value:p[0]?p[1]:void 0,done:!0}})([y,k])}}},n=E&&E.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,c=t&&r[t],l=0;if(c)return c.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&l>=r.length&&(r=void 0),{value:r&&r[l++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(E,"__esModule",{value:!0}),E.AutoTypingsCore=void 0;var e=(function(){if(K)return X;K=1,Object.defineProperty(X,"__esModule",{value:!0}),X.DummySourceCache=void 0;var r=(function(){function t(){}return t.prototype.getFile=function(c){return Promise.resolve(void 0)},t.prototype.isFileAvailable=function(c){return Promise.resolve(!1)},t.prototype.storeFile=function(c,l){return Promise.resolve(void 0)},t.prototype.clear=function(){return Promise.resolve(void 0)},t})();return X.DummySourceCache=r,X})(),u=me(),h=Pe(),d=o(q()),P=ke(),_=we(),f=(function(){function r(t,c){var l=this;this.editor=t,this.options=c,this.disposables=[],this.importResolver=new h.ImportResolver(c);var i=t.onDidChangeModelContent(function(g){l.debouncedResolveContents()});this.disposables.push(i),this.resolveContents(),c.dontAdaptEditorOptions||c.monaco.languages.typescript.typescriptDefaults.setCompilerOptions(m(m({},c.monaco.languages.typescript.typescriptDefaults.getCompilerOptions()),{moduleResolution:c.monaco.languages.typescript.ModuleResolutionKind.NodeJs,allowSyntheticDefaultImports:!0,rootDir:c.fileRootPath}))}return r.create=function(t,c){var l,i;return a(this,void 0,void 0,function(){var g;return s(this,function(v){if(c?.shareCache&&c.sourceCache&&!r.sharedCache&&(r.sharedCache=c.sourceCache),!(g=c?.monaco))throw new Error("monacoInstance not found, you can specify the monaco instance via options.monaco");return[2,new r(t,m(m({fileRootPath:"inmemory://model/",onlySpecifiedPackages:!1,preloadPackages:!1,shareCache:!1,dontAdaptEditorOptions:!1,dontRefreshModelValueAfterResolvement:!1,sourceCache:(l=r.sharedCache)!==null&&l!==void 0?l:new e.DummySourceCache,sourceResolver:(i=c?.sourceResolver)!==null&&i!==void 0?i:new u.JsDelivrSourceResolver,debounceDuration:4e3,fileRecursionDepth:10,packageRecursionDepth:3},c),{monaco:g}))]})})},r.prototype.dispose=function(){var t,c;try{for(var l=n(this.disposables),i=l.next();!i.done;i=l.next())i.value.dispose()}catch(g){t={error:g}}finally{try{i&&!i.done&&(c=l.return)&&c.call(l)}finally{if(t)throw t.error}}},r.prototype.setVersions=function(t){this.importResolver.setVersions(t),this.options.versions=t},r.prototype.clearCache=function(){return a(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.options.sourceCache.clear()];case 1:return t.sent(),[2]}})})},r.prototype.debouncedResolveContents=function(){var t=this;this.isResolving||((0,P.invokeUpdate)({type:"CodeChanged"},this.options),this.options.debounceDuration<=0?this.resolveContents():(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){return a(t,void 0,void 0,function(){return s(this,function(c){switch(c.label){case 0:return[4,this.resolveContents()];case 1:return c.sent(),this.debounceTimer=void 0,[2]}})})},this.options.debounceDuration)))},r.prototype.resolveContents=function(){var t;return a(this,void 0,void 0,function(){var c,l,i,g;return s(this,function(v){switch(v.label){case 0:if(this.isResolving=!0,(0,P.invokeUpdate)({type:"ResolveNewImports"},this.options),!(c=this.editor.getModel()))throw Error("No model");l=c.getLinesContent(),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,this.importResolver.resolveImportsInFile(l.join(`
|
|
7
|
-
`),d.dirname(c.uri.toString()),new _.RecursionDepth(this.options))];case 2:return v.sent(),[3,4];case 3:if(i=v.sent(),!this.options.onError)throw i;return this.options.onError((t=i.message)!==null&&t!==void 0?t:i),[3,4];case 4:return this.importResolver.wereNewImportsResolved()&&(this.options.dontRefreshModelValueAfterResolvement||(g=this.editor.getPosition(),c.setValue(c.getValue()),g&&this.editor.setPosition(g)),this.importResolver.resetNewImportsResolved()),this.isResolving=!1,[2]}})})},r})();return E.AutoTypingsCore=f,E}var ae,I={};function je(){if(ae)return I;ae=1;var m=I&&I.__awaiter||function(a,s,n,e){return new(n||(n=Promise))(function(u,h){function d(f){try{_(e.next(f))}catch(r){h(r)}}function P(f){try{_(e.throw(f))}catch(r){h(r)}}function _(f){var r;f.done?u(f.value):(r=f.value,r instanceof n?r:new n(function(t){t(r)})).then(d,P)}_((e=e.apply(a,s||[])).next())})},j=I&&I.__generator||function(a,s){var n,e,u,h,d={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return h={next:P(0),throw:P(1),return:P(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function P(_){return function(f){return(function(r){if(n)throw new TypeError("Generator is already executing.");for(;d;)try{if(n=1,e&&(u=2&r[0]?e.return:r[0]?e.throw||((u=e.return)&&u.call(e),0):e.next)&&!(u=u.call(e,r[1])).done)return u;switch(e=0,u&&(r=[2&r[0],u.value]),r[0]){case 0:case 1:u=r;break;case 4:return d.label++,{value:r[1],done:!1};case 5:d.label++,e=r[1],r=[0];continue;case 7:r=d.ops.pop(),d.trys.pop();continue;default:if(u=d.trys,!((u=u.length>0&&u[u.length-1])||r[0]!==6&&r[0]!==2)){d=0;continue}if(r[0]===3&&(!u||r[1]>u[0]&&r[1]<u[3])){d.label=r[1];break}if(r[0]===6&&d.label<u[1]){d.label=u[1],u=r;break}if(u&&d.label<u[2]){d.label=u[2],d.ops.push(r);break}u[2]&&d.ops.pop(),d.trys.pop();continue}r=s.call(a,d)}catch(t){r=[6,t],e=0}finally{n=u=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}})([_,f])}}},O=I&&I.__values||function(a){var s=typeof Symbol=="function"&&Symbol.iterator,n=s&&a[s],e=0;if(n)return n.call(a);if(a&&typeof a.length=="number")return{next:function(){return a&&e>=a.length&&(a=void 0),{value:a&&a[e++],done:!a}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(I,"__esModule",{value:!0}),I.LocalStorageCache=void 0;var o=(function(){function a(){this.localCache={}}return a.prototype.getFile=function(s){var n;return m(this,void 0,void 0,function(){return j(this,function(e){try{return[2,(n=localStorage.getItem(a.LOCALSTORAGE_PREFIX+s))!==null&&n!==void 0?n:void 0]}catch{return[2,this.localCache[s]]}return[2]})})},a.prototype.storeFile=function(s,n){return m(this,void 0,void 0,function(){return j(this,function(e){this.localCache[s]=n;try{localStorage.setItem(a.LOCALSTORAGE_PREFIX+s,n)}catch{}return[2]})})},a.prototype.clear=function(){return m(this,void 0,void 0,function(){var s,n,e,u,h,d,P;return j(this,function(_){for(this.localCache={},s=[],n=0;n<localStorage.length;n++)(h=localStorage.key(n))!=null&&h.startsWith(a.LOCALSTORAGE_PREFIX)&&s.push(h);try{for(e=O(s),u=e.next();!u.done;u=e.next())h=u.value,localStorage.removeItem(h)}catch(f){d={error:f}}finally{try{u&&!u.done&&(P=e.return)&&P.call(e)}finally{if(d)throw d.error}}return[2]})})},a.LOCALSTORAGE_PREFIX="__autotyper_cache_",a})();return I.LocalStorageCache=o,I}var ie,se={},ce,ue={},le,pe={},he,fe={},de,ve,ye,ge,L={};function Re(){if(de)return L;de=1;var m=L&&L.__awaiter||function(o,a,s,n){return new(s||(s=Promise))(function(e,u){function h(_){try{P(n.next(_))}catch(f){u(f)}}function d(_){try{P(n.throw(_))}catch(f){u(f)}}function P(_){var f;_.done?e(_.value):(f=_.value,f instanceof s?f:new s(function(r){r(f)})).then(h,d)}P((n=n.apply(o,a||[])).next())})},j=L&&L.__generator||function(o,a){var s,n,e,u,h={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return u={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function d(P){return function(_){return(function(f){if(s)throw new TypeError("Generator is already executing.");for(;h;)try{if(s=1,n&&(e=2&f[0]?n.return:f[0]?n.throw||((e=n.return)&&e.call(n),0):n.next)&&!(e=e.call(n,f[1])).done)return e;switch(n=0,e&&(f=[2&f[0],e.value]),f[0]){case 0:case 1:e=f;break;case 4:return h.label++,{value:f[1],done:!1};case 5:h.label++,n=f[1],f=[0];continue;case 7:f=h.ops.pop(),h.trys.pop();continue;default:if(e=h.trys,!((e=e.length>0&&e[e.length-1])||f[0]!==6&&f[0]!==2)){h=0;continue}if(f[0]===3&&(!e||f[1]>e[0]&&f[1]<e[3])){h.label=f[1];break}if(f[0]===6&&h.label<e[1]){h.label=e[1],e=f;break}if(e&&h.label<e[2]){h.label=e[2],h.ops.push(f);break}e[2]&&h.ops.pop(),h.trys.pop();continue}f=a.call(o,h)}catch(r){f=[6,r],n=0}finally{s=e=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}})([P,_])}}};Object.defineProperty(L,"__esModule",{value:!0}),L.UnpkgSourceResolver=void 0;var O=(function(){function o(){}return o.prototype.resolvePackageJson=function(a,s,n){return m(this,void 0,void 0,function(){return j(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(a).concat(s?"@".concat(s):"").concat(n?"/".concat(n):"","/package.json"))];case 1:return[2,e.sent()]}})})},o.prototype.resolveSourceFile=function(a,s,n){return m(this,void 0,void 0,function(){return j(this,function(e){switch(e.label){case 0:return[4,this.resolveFile("https://unpkg.com/".concat(a).concat(s?"@".concat(s):"","/").concat(n))];case 1:return[2,e.sent()]}})})},o.prototype.resolveFile=function(a){return m(this,void 0,void 0,function(){var s;return j(this,function(n){switch(n.label){case 0:return[4,fetch(a,{method:"GET"})];case 1:return(s=n.sent()).ok?[4,s.text()]:[3,3];case 2:return[2,n.sent()];case 3:if(s.status===404)return[2,""];throw Error("Error other than 404 while fetching from Unpkg at ".concat(a));case 4:return[2]}})})},o})();return L.UnpkgSourceResolver=O,L}function Ce(){return ve||(ve=1,(function(m){var j=W&&W.__createBinding||(Object.create?function(o,a,s,n){n===void 0&&(n=s);var e=Object.getOwnPropertyDescriptor(a,s);e&&!("get"in e?!a.__esModule:e.writable||e.configurable)||(e={enumerable:!0,get:function(){return a[s]}}),Object.defineProperty(o,n,e)}:function(o,a,s,n){n===void 0&&(n=s),o[n]=a[s]}),O=W&&W.__exportStar||function(o,a){for(var s in o)s==="default"||Object.prototype.hasOwnProperty.call(a,s)||j(a,o,s)};Object.defineProperty(m,"__esModule",{value:!0}),O((function(){if(oe)return G;oe=1;var o,a=G&&G.__extends||(o=function(n,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,h){u.__proto__=h}||function(u,h){for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&(u[d]=h[d])},o(n,e)},function(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function u(){this.constructor=n}o(n,e),n.prototype=e===null?Object.create(e):(u.prototype=e.prototype,new u)});Object.defineProperty(G,"__esModule",{value:!0}),G.AutoTypings=void 0;var s=(function(n){function e(u,h){return n.call(this,u,h)||this}return a(e,n),e})(Oe().AutoTypingsCore);return G.AutoTypings=s,G})(),m),O(be(),m),O(je(),m),O((ie||(ie=1,Object.defineProperty(se,"__esModule",{value:!0})),se),m),O((ce||(ce=1,Object.defineProperty(ue,"__esModule",{value:!0})),ue),m),O((le||(le=1,Object.defineProperty(pe,"__esModule",{value:!0})),pe),m),O((he||(he=1,Object.defineProperty(fe,"__esModule",{value:!0})),fe),m),O(Re(),m),O(me(),m)})(W)),W}const Se=_e({__proto__:null},[ge?ye:(ge=1,ye=Ce())]);exports.customEditor=Se;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";/**
|
|
2
|
-
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.27
|
|
3
|
-
*
|
|
4
|
-
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react");function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function we(e,t){if(e==null)return{};var r,n,o=(function(c,a){if(c==null)return{};var f,p,j={},y=Object.keys(c);for(p=0;p<y.length;p++)f=y[p],a.indexOf(f)>=0||(j[f]=c[f]);return j})(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)r=u[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function ce(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Oe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ae(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ae(Object(r),!0).forEach(function(n){Oe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function C(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),u=0;u<n;u++)o[u]=arguments[u];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,a=new Array(c),f=0;f<c;f++)a[f]=arguments[f];return t.apply(r,[].concat(o,a))}}}function _(e){return{}.toString.call(e).includes("Object")}function A(e){return typeof e=="function"}var E=C(function(e,t){throw new Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),N={changes:function(e,t){return _(t)||E("changeType"),Object.keys(t).some(function(r){return n=e,o=r,!Object.prototype.hasOwnProperty.call(n,o);var n,o})&&E("changeField"),t},selector:function(e){A(e)||E("selectorType")},handler:function(e){A(e)||_(e)||E("handlerType"),_(e)&&Object.values(e).some(function(t){return!A(t)})&&E("handlersType")},initial:function(e){var t;e||E("initialIsRequired"),_(e)||E("initialType"),t=e,Object.keys(t).length||E("initialContent")}};function je(e,t){return A(t)?t(e.current):t}function Me(e,t){return e.current=le(le({},e.current),t),t}function Ee(e,t,r){return A(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Pe={create:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};N.initial(e),N.handler(t);var r={current:e},n=C(Ee)(r,t),o=C(Me)(r),u=C(N.changes)(e),c=C(je)(r);return[function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return N.selector(a),a(r.current)},function(a){(function(){for(var f=arguments.length,p=new Array(f),j=0;j<f;j++)p[j]=arguments[j];return function(y){return p.reduceRight(function(R,k){return k(R)},y)}})(n,o,u,c)(a)}]}},K,de={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
7
|
-
You are using deprecated way of configuration.
|
|
8
|
-
|
|
9
|
-
Instead of using
|
|
10
|
-
monaco.config({ urls: { monacoBase: '...' } })
|
|
11
|
-
use
|
|
12
|
-
monaco.config({ paths: { vs: '...' } })
|
|
13
|
-
|
|
14
|
-
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
15
|
-
`},se=(K=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return n.length>=K.length?K.apply(this,n):function(){for(var u=arguments.length,c=new Array(u),a=0;a<u;a++)c[a]=arguments[a];return e.apply(t,[].concat(n,c))}})(de),Se={config:function(e){var t;return e||se("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||se("configType"),e.urls?(console.warn(de.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function ge(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],ge(e[r],t[r]))}),ue(ue({},e),t)}var Re={type:"cancelation",msg:"operation is manually canceled"};function Q(e){var t=!1,r=new Promise(function(n,o){e.then(function(u){return t?o(Re):n(u)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var X,Z,ke=Pe.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),pe=(Z=2,(function(e){if(Array.isArray(e))return e})(X=ke)||(function(e,t){if(typeof Symbol<"u"&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,u=void 0;try{for(var c,a=e[Symbol.iterator]();!(n=(c=a.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(f){o=!0,u=f}finally{try{n||a.return==null||a.return()}finally{if(o)throw u}}return r}})(X,Z)||(function(e,t){if(e){if(typeof e=="string")return ce(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(e,t):void 0}})(X,Z)||(function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
16
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()),V=pe[0],U=pe[1];function Te(e){return document.body.appendChild(e)}function xe(e){var t,r,n=V(function(u){return{config:u.config,reject:u.reject}}),o=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return o.onload=function(){return e()},o.onerror=n.reject,o}function Ie(){var e=V(function(r){return{config:r.config,resolve:r.resolve,reject:r.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){he(r),e.resolve(r)},function(r){e.reject(r)})}function he(e){V().monaco||U({monaco:e})}var ee=new Promise(function(e,t){return U({resolve:e,reject:t})}),L={config:function(e){var t=Se.config(e),r=t.monaco,n=we(t,["monaco"]);U(function(o){return{config:ge(o.config,n),monaco:r}})},init:function(){var e=V(function(t){return{monaco:t.monaco,isInitialized:t.isInitialized,resolve:t.resolve}});if(!e.isInitialized){if(U({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Q(ee);if(window.monaco&&window.monaco.editor)return he(window.monaco),e.resolve(window.monaco),Q(ee);(function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(u,c){return c(u)},o)}})(Te,xe)(Ie)}return Q(ee)},__getMonacoInstance:function(){return V(function(e){return e.monaco})}},te={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Ce={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Ae=function({children:e}){return i.createElement("div",{style:Ce.container},e)},De=function({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:u,wrapperProps:c}){return i.createElement("section",{style:{...te.wrapper,width:e,height:t},...c},!r&&i.createElement(Ae,null,n),i.createElement("div",{ref:o,style:{...te.fullWidth,...!r&&te.hide},className:u}))},me=i.memo(De),re=function(e){i.useEffect(e,[])},O=function(e,t,r=!0){let n=i.useRef(!0);i.useEffect(n.current||!r?()=>{n.current=!1}:e,t)};function D(){}function S(e,t,r,n){return(function(o,u){return o.editor.getModel(fe(o,u))})(e,n)||(function(o,u,c,a){return o.editor.createModel(u,c,a?fe(o,a):void 0)})(e,t,r,n)}function fe(e,t){return e.Uri.parse(t)}var Ve=function({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:u,modifiedModelPath:c,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:f=!1,theme:p="light",loading:j="Loading...",options:y={},height:R="100%",width:k="100%",className:B,wrapperProps:W={},beforeMount:Y=D,onMount:$=D}){let[w,T]=i.useState(!1),[x,h]=i.useState(!0),m=i.useRef(null),d=i.useRef(null),I=i.useRef(null),v=i.useRef($),l=i.useRef(Y),P=i.useRef(!1);re(()=>{let s=L.init();return s.then(g=>(d.current=g)&&h(!1)).catch(g=>g?.type!=="cancelation"&&console.error("Monaco initialization: error:",g)),()=>m.current?(function(){let g=m.current?.getModel();a||g?.original?.dispose(),f||g?.modified?.dispose(),m.current?.dispose()})():s.cancel()}),O(()=>{if(m.current&&d.current){let s=m.current.getOriginalEditor(),g=S(d.current,e||"",n||r||"text",u||"");g!==s.getModel()&&s.setModel(g)}},[u],w),O(()=>{if(m.current&&d.current){let s=m.current.getModifiedEditor(),g=S(d.current,t||"",o||r||"text",c||"");g!==s.getModel()&&s.setModel(g)}},[c],w),O(()=>{let s=m.current.getModifiedEditor();s.getOption(d.current.editor.EditorOption.readOnly)?s.setValue(t||""):t!==s.getValue()&&(s.executeEdits("",[{range:s.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),s.pushUndoStop())},[t],w),O(()=>{m.current?.getModel()?.original.setValue(e||"")},[e],w),O(()=>{let{original:s,modified:g}=m.current.getModel();d.current.editor.setModelLanguage(s,n||r||"text"),d.current.editor.setModelLanguage(g,o||r||"text")},[r,n,o],w),O(()=>{d.current?.editor.setTheme(p)},[p],w),O(()=>{m.current?.updateOptions(y)},[y],w);let q=i.useCallback(()=>{if(!d.current)return;l.current(d.current);let s=S(d.current,e||"",n||r||"text",u||""),g=S(d.current,t||"",o||r||"text",c||"");m.current?.setModel({original:s,modified:g})},[r,t,o,e,n,u,c]),z=i.useCallback(()=>{!P.current&&I.current&&(m.current=d.current.editor.createDiffEditor(I.current,{automaticLayout:!0,...y}),q(),d.current?.editor.setTheme(p),T(!0),P.current=!0)},[y,p,q]);return i.useEffect(()=>{w&&v.current(m.current,d.current)},[w]),i.useEffect(()=>{!x&&!w&&z()},[x,w,z]),i.createElement(me,{width:k,height:R,isEditorReady:w,loading:j,_ref:I,className:B,wrapperProps:W})},Le=i.memo(Ve),qe=function(){let[e,t]=i.useState(L.__getMonacoInstance());return re(()=>{let r;return e||(r=L.init(),r.then(n=>{t(n)})),()=>r?.cancel()}),e},ze=function(e){let t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current},F=new Map,_e=function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:u,theme:c="light",line:a,loading:f="Loading...",options:p={},overrideServices:j={},saveViewState:y=!0,keepCurrentModel:R=!1,width:k="100%",height:B="100%",className:W,wrapperProps:Y={},beforeMount:$=D,onMount:w=D,onChange:T,onValidate:x=D}){let[h,m]=i.useState(!1),[d,I]=i.useState(!0),v=i.useRef(null),l=i.useRef(null),P=i.useRef(null),q=i.useRef(w),z=i.useRef($),s=i.useRef(),g=i.useRef(n),ve=ze(u),ne=i.useRef(!1),G=i.useRef(!1);re(()=>{let b=L.init();return b.then(M=>(v.current=M)&&I(!1)).catch(M=>M?.type!=="cancelation"&&console.error("Monaco initialization: error:",M)),()=>l.current?(s.current?.dispose(),R?y&&F.set(u,l.current.saveViewState()):l.current.getModel()?.dispose(),void l.current.dispose()):b.cancel()}),O(()=>{let b=S(v.current,e||n||"",t||o||"",u||r||"");b!==l.current?.getModel()&&(y&&F.set(ve,l.current?.saveViewState()),l.current?.setModel(b),y&&l.current?.restoreViewState(F.get(u)))},[u],h),O(()=>{l.current?.updateOptions(p)},[p],h),O(()=>{!l.current||n===void 0||(l.current.getOption(v.current.editor.EditorOption.readOnly)?l.current.setValue(n):n!==l.current.getValue()&&(G.current=!0,l.current.executeEdits("",[{range:l.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),l.current.pushUndoStop(),G.current=!1))},[n],h),O(()=>{let b=l.current?.getModel();b&&o&&v.current?.editor.setModelLanguage(b,o)},[o],h),O(()=>{a!==void 0&&l.current?.revealLine(a)},[a],h),O(()=>{v.current?.editor.setTheme(c)},[c],h);let oe=i.useCallback(()=>{if(P.current&&v.current&&!ne.current){z.current(v.current);let b=u||r,M=S(v.current,n||e||"",t||o||"",b||"");l.current=v.current?.editor.create(P.current,{model:M,automaticLayout:!0,...p},j),y&&l.current.restoreViewState(F.get(b)),v.current.editor.setTheme(c),a!==void 0&&l.current.revealLine(a),m(!0),ne.current=!0}},[e,t,r,n,o,u,p,j,y,c,a]);return i.useEffect(()=>{h&&q.current(l.current,v.current)},[h]),i.useEffect(()=>{!d&&!h&&oe()},[d,h,oe]),g.current=n,i.useEffect(()=>{h&&T&&(s.current?.dispose(),s.current=l.current?.onDidChangeModelContent(b=>{G.current||T(l.current.getValue(),b)}))},[h,T]),i.useEffect(()=>{if(h){let b=v.current.editor.onDidChangeMarkers(M=>{let H=l.current.getModel()?.uri;if(H&&M.find(J=>J.path===H.path)){let J=v.current.editor.getModelMarkers({resource:H});x?.(J)}});return()=>{b?.dispose()}}return()=>{}},[h,x]),i.createElement(me,{width:k,height:B,isEditorReady:h,loading:f,_ref:P,className:W,wrapperProps:Y})},ye=i.memo(_e),Ne=ye;exports.DiffEditor=Le,exports.Editor=ye,exports.default=Ne,exports.loader=L,exports.useMonaco=qe;
|