twenty-ui 2.47.0 → 2.48.0
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/dist/{AllIcons-DrlkKKQf.cjs → AllIcons-Cyd7721G.cjs} +1 -1
- package/dist/{AllIcons-G3nKeM41.js → AllIcons-D132B8_i.js} +1 -1
- package/dist/{Button-Cs07psdD.js → Button-D5enZ0Qz.js} +1 -1
- package/dist/{Button-COxEKIHL.cjs → Button-Dbi5P05r.cjs} +1 -1
- package/dist/Dropdown-BKjAaZS0.cjs +1 -0
- package/dist/Dropdown-C2hXrjvD.js +820 -0
- package/dist/{ListItem-q6DHGlev.cjs → ListItem-CHTR-GLd.cjs} +1 -1
- package/dist/{ListItem-CXu35dzp.js → ListItem-CjnrSbka.js} +4 -4
- package/dist/ListItem.module-BJ9Ttjrc.js +34 -0
- package/dist/ListItem.module-CO4u2oeF.cjs +1 -0
- package/dist/OverflowingTextWithTooltip-BmUROIah.js +90 -0
- package/dist/OverflowingTextWithTooltip-Z2daM0_x.cjs +1 -0
- package/dist/{ProgressBar-D_3Gia0E.js → ProgressBar-BvT1dyFo.js} +1 -1
- package/dist/{ProgressBar-oF1qVHFx.cjs → ProgressBar-DfFz0fFB.cjs} +1 -1
- package/dist/{Radio-BMoQHDe7.js → Radio-DMI1B7o5.js} +1 -1
- package/dist/{Radio-D_YUizSv.cjs → Radio-xmHgGHQO.cjs} +1 -1
- package/dist/{ResizeHandle-Bjg4R0c-.js → ResizeHandle-C1kQ3MYR.js} +1 -0
- package/dist/ResizeHandle-DI4LHIQm.cjs +1 -0
- package/dist/Shortcut-BvWUZ3pb.js +72 -0
- package/dist/Shortcut-CgrdLv_L.cjs +1 -0
- package/dist/TabsTabContent-Co27Y2TU.cjs +1 -0
- package/dist/TabsTabContent-DVcObDp6.js +39 -0
- package/dist/Tooltip-Bg9Uk01p.cjs +1 -0
- package/dist/Tooltip-cLCgtFBF.js +124 -0
- package/dist/components/code-editor/CodeEditor/CodeEditor.d.ts +1 -1
- package/dist/components/code-editor/CodeEditor/__stories__/ControlledCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/CodeEditor/__stories__/ModelCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/CodeEditor/__stories__/ResizableCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/CodeEditor/__stories__/ThemedCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/CodeEditor/__stories__/UnmountingCodeEditor.d.ts +2 -0
- package/dist/components/code-editor/CodeEditor/__stories__/waitForCodeEditorContent.d.ts +4 -1
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorAutoHeightEffect.d.ts +9 -0
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorLifecycleEffect.d.ts +11 -0
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorLoaderConfigurationEffect.d.ts +7 -0
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorMarkersEffect.d.ts +10 -0
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorResizableHeightEffect.d.ts +11 -0
- package/dist/components/code-editor/CodeEditor/internal/CodeEditorThemeEffect.d.ts +10 -0
- package/dist/components/code-editor/CodeEditor/internal/constants/CodeEditorDefaultHeight.d.ts +1 -0
- package/dist/components/code-editor/CodeEditor/internal/types/ResizedCodeEditorHeight.d.ts +4 -0
- package/dist/components/code-editor/CodeEditor/internal/useCodeEditorHeight.d.ts +13 -0
- package/dist/components/code-editor/CodeEditor/internal/utils/defineCodeEditorDefaultTheme.d.ts +7 -0
- package/dist/components/code-editor/CodeEditor/internal/utils/getBaseCodeEditorTheme.d.ts +4 -1
- package/dist/components/code-editor/CodeEditor/internal/utils/getBoundedCodeEditorHeight.d.ts +1 -0
- package/dist/components/code-editor/CodeEditor/internal/utils/getCurrentCodeEditorHeight.d.ts +7 -0
- package/dist/components/code-editor/CodeEditor/internal/utils/getResizableCodeEditorHeight.d.ts +5 -0
- package/dist/components/code-editor/CodeEditor/types/CodeEditorProps.d.ts +4 -2
- package/dist/components/code-editor.cjs +1 -1
- package/dist/components/code-editor.mjs +267 -155
- package/dist/components/data-display.mjs +1 -1
- package/dist/components/feedback/Toast/internal/components/ToastCountdownEffect.d.ts +4 -3
- package/dist/components/feedback/Toast/internal/components/ToastProviderLifecycleEffect.d.ts +3 -0
- package/dist/components/feedback/Toast/internal/constants/DefaultToastDuration.d.ts +1 -0
- package/dist/components/feedback/Toast/internal/contexts/ToastContext.d.ts +60 -1
- package/dist/components/feedback/Toast/internal/contexts/ToastTimingContext.d.ts +12 -2
- package/dist/components/feedback/Toast/internal/hooks/useToastContext.d.ts +60 -1
- package/dist/components/feedback/Toast/internal/hooks/useToastCountdown.d.ts +26 -0
- package/dist/components/feedback/Toast/internal/stores/createToastStore.d.ts +60 -1
- package/dist/components/feedback/Toast/internal/utils/assertValidToastLimit.d.ts +1 -0
- package/dist/components/feedback/Toast/internal/utils/completeToastExit.d.ts +3 -2
- package/dist/components/feedback/Toast/internal/utils/createToastCountdownStore.d.ts +22 -0
- package/dist/components/feedback/Toast/internal/utils/createToastLifecycle.d.ts +62 -0
- package/dist/components/feedback/Toast/internal/utils/dismissToasts.d.ts +3 -2
- package/dist/components/feedback/Toast/internal/utils/updateToastLimit.d.ts +5 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterLifecycleControls.d.ts +7 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterLifecycleExample.d.ts +2 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterLifecycleExampleProps.d.ts +7 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterLifecycleTimingOverrideExample.d.ts +9 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterLifecycleUnrelatedNotificationActions.d.ts +5 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterPortalExample.d.ts +5 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterProviderLayoutReplayEffect.d.ts +4 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterProviderPassiveReplayEffect.d.ts +4 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterProviderReplayExample.d.ts +6 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterProviderSuspenseExample.d.ts +4 -0
- package/dist/components/feedback/Toaster/__stories__/ToasterProviderSuspension.d.ts +5 -0
- package/dist/components/feedback/Toaster/internal/ToasterItemExitEffect.d.ts +2 -1
- package/dist/components/feedback.cjs +1 -1
- package/dist/components/feedback.mjs +1 -1
- package/dist/components/input/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/input/SearchInput/types/SearchInputProps.d.ts +2 -3
- package/dist/components/input/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/components/input/SegmentedControl/types/SegmentedControlProps.d.ts +2 -0
- package/dist/components/input/SegmentedControl/types/SegmentedControlSize.d.ts +1 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input.cjs +1 -1
- package/dist/components/input.mjs +2 -2
- package/dist/components/layout/OverflowingList/OverflowingList.d.ts +1 -1
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListActionsExample.d.ts +7 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListCanceledCloseExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListControlledExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListControlledStateExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListDisabledTriggerFocusExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListEventBlockingExample.d.ts +7 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListFocusExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListInstanceCleanupExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListStateExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/__stories__/OverflowingListTriggerRefExample.d.ts +1 -0
- package/dist/components/layout/OverflowingList/internal/OverflowingListItem.d.ts +8 -2
- package/dist/components/layout/OverflowingList/internal/OverflowingListItemFocusEffect.d.ts +8 -0
- package/dist/components/layout/OverflowingList/internal/OverflowingListLayoutEffect.d.ts +16 -0
- package/dist/components/layout/OverflowingList/internal/OverflowingListPopupTarget.d.ts +10 -0
- package/dist/components/layout/OverflowingList/internal/focusOverflowingListFallback.d.ts +8 -0
- package/dist/components/layout/OverflowingList/internal/measureOverflowingListLayout.d.ts +10 -0
- package/dist/components/layout/OverflowingList/internal/types/OverflowingListLayout.d.ts +4 -0
- package/dist/components/layout/OverflowingList/internal/useFocusedElementUnmountRef.d.ts +1 -1
- package/dist/components/layout/OverflowingList/internal/useOverflowingListFocus.d.ts +30 -0
- package/dist/components/layout/OverflowingList/internal/useOverflowingListLayout.d.ts +6 -6
- package/dist/components/layout/OverflowingList/types/OverflowingListProps.d.ts +7 -2
- package/dist/components/layout.cjs +1 -1
- package/dist/components/layout.mjs +1 -1
- package/dist/components/navigation/Dropdown/Dropdown.d.ts +4 -4
- package/dist/components/navigation/Dropdown/internal/DropdownActionItem.d.ts +1 -1
- package/dist/components/navigation/Dropdown/internal/DropdownContent.d.ts +1 -1
- package/dist/components/navigation/Dropdown/internal/DropdownContextValue.d.ts +6 -5
- package/dist/components/navigation/Dropdown/internal/DropdownOptionItem.d.ts +1 -1
- package/dist/components/navigation/Dropdown/internal/DropdownRowFocus.d.ts +5 -0
- package/dist/components/navigation/Dropdown/internal/DropdownRowsEffect.d.ts +5 -0
- package/dist/components/navigation/Dropdown/internal/DropdownSubmenuTrigger.d.ts +1 -1
- package/dist/components/navigation/Dropdown/internal/getDropdownItemExplicitId.d.ts +5 -0
- package/dist/components/navigation/Dropdown/internal/getDropdownRows.d.ts +1 -0
- package/dist/components/navigation/Dropdown/internal/getDropdownSearch.d.ts +1 -0
- package/dist/components/navigation/Dropdown/internal/getDropdownTabStopRowId.d.ts +4 -0
- package/dist/components/navigation/Dropdown/internal/isDropdownDismissPrevented.d.ts +2 -1
- package/dist/components/navigation/Dropdown/internal/isDropdownRow.d.ts +4 -0
- package/dist/components/navigation/Dropdown/internal/isEnabledDropdownItem.d.ts +4 -0
- package/dist/components/navigation/Dropdown/internal/useDropdownItemFocus.d.ts +0 -1
- package/dist/components/navigation/Dropdown/internal/useDropdownKeyboardNavigation.d.ts +1 -6
- package/dist/components/navigation.cjs +1 -1
- package/dist/components/navigation.mjs +2 -2
- package/dist/components/settings.cjs +1 -1
- package/dist/components/settings.mjs +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.mjs +7 -7
- package/dist/data-display-0QO_WDSs.js +183 -0
- package/dist/data-display-CPmTJAWJ.cjs +1 -0
- package/dist/{data-display-DU3G8ZyI.js → data-display-KyZbLLy-.js} +1 -1
- package/dist/feedback-CM6fatE8.js +664 -0
- package/dist/feedback-ybO4n69s.cjs +1 -0
- package/dist/icon/components/TablerIcons.d.ts +1 -1
- package/dist/icon/constants/TwentyIconDictionary.d.ts +7 -7
- package/dist/icon/index.d.ts +1 -1
- package/dist/{icon-JuDK6Wxr.cjs → icon-BNcdwwdl.cjs} +1 -1
- package/dist/{icon-BdXwnJA6.js → icon-CUE-QGQK.js} +129 -128
- package/dist/icon.cjs +1 -1
- package/dist/icon.mjs +77 -76
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +222 -220
- package/dist/input-3D2lXywH.cjs +1 -0
- package/dist/{input-Bnu5kNjg.cjs → input-CJDYNwoO.cjs} +1 -1
- package/dist/{input-vl6yK36n.js → input-DRpDiMRi.js} +4 -4
- package/dist/input-TM3nUdu6.js +554 -0
- package/dist/layout-BszCDxAO.js +441 -0
- package/dist/layout-VaIq7Sjr.cjs +1 -0
- package/dist/{navigation-itBinyPi.js → navigation-B1SRvzKK.js} +8 -8
- package/dist/{navigation-Dg46Wr5m.js → navigation-CYAs2LnR.js} +1 -1
- package/dist/{navigation-WsiYsmaq.cjs → navigation-CthkGHJ8.cjs} +1 -1
- package/dist/{navigation-B1hPNYv2.cjs → navigation-DrOV5E67.cjs} +1 -1
- package/dist/primitives/data-display.cjs +1 -1
- package/dist/primitives/data-display.mjs +1 -1
- package/dist/primitives/feedback.cjs +1 -1
- package/dist/primitives/feedback.mjs +1 -1
- package/dist/primitives/input.cjs +1 -1
- package/dist/primitives/input.mjs +3 -3
- package/dist/primitives/layout.cjs +1 -1
- package/dist/primitives/layout.mjs +1 -1
- package/dist/primitives/navigation.cjs +1 -1
- package/dist/primitives/navigation.mjs +2 -2
- package/dist/primitives/surfaces/Tooltip/Tooltip.d.ts +1 -1
- package/dist/primitives/surfaces/Tooltip/internal/TooltipPopup.d.ts +1 -1
- package/dist/primitives/surfaces/Tooltip/types/TooltipPopupProps.d.ts +2 -0
- package/dist/primitives/surfaces.cjs +1 -1
- package/dist/primitives/surfaces.mjs +2 -2
- package/dist/primitives/typography/OverflowingTextWithTooltip/OverflowingTextTooltipModeProvider.d.ts +6 -0
- package/dist/primitives/typography/OverflowingTextWithTooltip/internal/OverflowingTextTooltipModeContext.d.ts +2 -0
- package/dist/primitives/typography/OverflowingTextWithTooltip/internal/isElementOverflowing.d.ts +1 -0
- package/dist/primitives/typography/OverflowingTextWithTooltip/types/OverflowingTextTooltipMode.d.ts +1 -0
- package/dist/primitives/typography/Shortcut/Shortcut.d.ts +1 -1
- package/dist/primitives/typography/Shortcut/internal/getShortcutPresentation.d.ts +1 -1
- package/dist/primitives/typography/Shortcut/types/ShortcutFormatOptions.d.ts +1 -0
- package/dist/primitives/typography/index.d.ts +2 -0
- package/dist/primitives/typography.cjs +1 -1
- package/dist/primitives/typography.mjs +10 -9
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.mjs +37 -36
- package/dist/{settings-BiSAY2oN.cjs → settings-BAYsnlZJ.cjs} +1 -1
- package/dist/{settings-CC-2gcAx.js → settings-BjEZiHXE.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/surfaces-0rL5DoHt.cjs +1 -0
- package/dist/{surfaces-DZ2A-Nb9.js → surfaces-BLsR5ka0.js} +54 -54
- package/dist/typography-B5QEuPaL.cjs +1 -0
- package/dist/typography-fOTFr0jS.js +11 -0
- package/package.json +1 -1
- package/dist/Dropdown-BBUGkQQV.cjs +0 -1
- package/dist/Dropdown-CScN_olN.js +0 -784
- package/dist/ListItem.module-Ar-vZ7Qu.js +0 -34
- package/dist/ListItem.module-B8NeDH1P.cjs +0 -1
- package/dist/OverflowingTextWithTooltip-Be2-wCcZ.js +0 -88
- package/dist/OverflowingTextWithTooltip-BlufG-6n.cjs +0 -1
- package/dist/ResizeHandle-CNlQ4TEE.cjs +0 -1
- package/dist/Shortcut-DKfB0kej.js +0 -71
- package/dist/Shortcut-ZuZ-KYSk.cjs +0 -1
- package/dist/TabsTabContent-DZUNi_iE.cjs +0 -1
- package/dist/TabsTabContent-s6J5bZ3R.js +0 -39
- package/dist/Tooltip-BMkznyoi.js +0 -120
- package/dist/Tooltip-JOYVeSsf.cjs +0 -1
- package/dist/components/navigation/Dropdown/internal/DropdownSearchTargetEffect.d.ts +0 -5
- package/dist/data-display-BMV-nC-9.js +0 -181
- package/dist/data-display-BkujQe5v.cjs +0 -1
- package/dist/feedback-B5x8tmnG.cjs +0 -1
- package/dist/feedback-DhilJ_fX.js +0 -509
- package/dist/input-BEKjAOjS.cjs +0 -1
- package/dist/input-BUgnp6eA.js +0 -559
- package/dist/layout-BKHabkTu.js +0 -267
- package/dist/layout-wuIu4rJ3.cjs +0 -1
- package/dist/surfaces-vyAhk2Gw.cjs +0 -1
- package/dist/typography-8DF9mq2w.cjs +0 -1
- package/dist/typography-DmY7-GzQ.js +0 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ResizedCodeEditorHeight } from './types/ResizedCodeEditorHeight';
|
|
2
|
+
export declare const useCodeEditorHeight: ({ height, resizable, autoHeight, }: {
|
|
3
|
+
height: number | string;
|
|
4
|
+
resizable: boolean;
|
|
5
|
+
autoHeight: boolean;
|
|
6
|
+
}) => {
|
|
7
|
+
currentHeight: string | number;
|
|
8
|
+
resizableHeight: number;
|
|
9
|
+
setResizableHeight: (value: number) => void;
|
|
10
|
+
setResizedHeight: import('react').Dispatch<import('react').SetStateAction<ResizedCodeEditorHeight | undefined>>;
|
|
11
|
+
setContentHeight: import('react').Dispatch<import('react').SetStateAction<number | undefined>>;
|
|
12
|
+
shouldAutoHeight: boolean;
|
|
13
|
+
};
|
package/dist/components/code-editor/CodeEditor/internal/utils/defineCodeEditorDefaultTheme.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Monaco } from '@monaco-editor/react';
|
|
2
|
+
import { ThemeType } from '../../../../../theme';
|
|
3
|
+
export declare const defineCodeEditorDefaultTheme: ({ monaco, theme, colorScheme, }: {
|
|
4
|
+
monaco: Monaco;
|
|
5
|
+
theme: ThemeType;
|
|
6
|
+
colorScheme: "light" | "dark";
|
|
7
|
+
}) => void;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { ThemeType } from '../../../../../theme';
|
|
2
2
|
import { editor } from 'monaco-editor';
|
|
3
|
-
export declare const getBaseCodeEditorTheme: (theme
|
|
3
|
+
export declare const getBaseCodeEditorTheme: ({ theme, colorScheme, }: {
|
|
4
|
+
theme: ThemeType;
|
|
5
|
+
colorScheme: "light" | "dark";
|
|
6
|
+
}) => editor.IStandaloneThemeData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBoundedCodeEditorHeight: (height: number) => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getCurrentCodeEditorHeight: ({ height, resizableHeight, contentHeight, shouldUseResizableHeight, shouldAutoHeight, }: {
|
|
2
|
+
height: number | string;
|
|
3
|
+
resizableHeight: number;
|
|
4
|
+
contentHeight: number | undefined;
|
|
5
|
+
shouldUseResizableHeight: boolean;
|
|
6
|
+
shouldAutoHeight: boolean;
|
|
7
|
+
}) => string | number;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EditorProps } from '@monaco-editor/react';
|
|
2
2
|
import { editor } from 'monaco-editor';
|
|
3
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
3
4
|
type CodeEditorVariant = 'default' | 'with-header' | 'borderless';
|
|
4
5
|
type CodeEditorContentPadding = 'default' | 'comfortable';
|
|
5
|
-
export type CodeEditorProps =
|
|
6
|
-
|
|
6
|
+
export type CodeEditorProps = EditorProps & {
|
|
7
|
+
containerProps?: Omit<ComponentPropsWithoutRef<'div'>, 'children'>;
|
|
8
|
+
ref?: Ref<HTMLDivElement>;
|
|
7
9
|
setMarkers?: (value: string) => editor.IMarkerData[];
|
|
8
10
|
variant?: CodeEditorVariant;
|
|
9
11
|
isLoading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var re=Object.create;var z=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var ae=(e,r,o,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of te(r))!ie.call(e,n)&&n!==o&&z(e,n,{get:()=>r[n],enumerable:!(t=oe(r,n))||t.enumerable});return e};var de=(e,r,o)=>(o=e!=null?re(ne(e)):{},ae(r||!e||!e.__esModule?z(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const M=require("../theme-1XkFz8Qu.cjs"),s=require("../isDefined-DS2Q42p5.cjs"),se=require("../Loader-Bb72CUQ9.cjs"),j=require("../ResizeHandle-DI4LHIQm.cjs");let ue=require("@base-ui/react/use-render"),C=require("@sniptt/guards"),F=require("clsx"),u=require("react"),d=require("react/jsx-runtime"),le=require("@base-ui/utils/clamp"),h=require("@monaco-editor/react");h=M.__toESM(h,1);var ce="baseCodeEditorTheme",fe=({shouldAutoHeight:e,editor:r,setContentHeight:o})=>((0,u.useEffect)(()=>{if(!e||!s.isDefined(r)){o(void 0);return}const t=()=>{const a=r.getContentHeight();!Number.isFinite(a)||a<=0||o(a)};t();const n=r.onDidContentSizeChange(t);return()=>n.dispose()},[r,e,o]),null),ge=({editor:e,setEditor:r,setMonaco:o,setIsEditorFocused:t})=>((0,u.useEffect)(()=>{if(!s.isDefined(e)){t(!1);return}t(e.hasWidgetFocus());const n=[e.onDidFocusEditorWidget(()=>t(!0)),e.onDidBlurEditorWidget(()=>t(!1)),e.onDidDispose(()=>{r(void 0),o(void 0)})];return()=>{for(const a of n)a.dispose()}},[e,r,o,t]),null),pe=({configureMonacoLoader:e,setIsMonacoLoaderConfigured:r})=>((0,u.useEffect)(()=>{let o=!0;return e().then(()=>{o&&r(!0)}),()=>{o=!1}},[e,r]),null),be=({editor:e,monaco:r,setMarkers:o})=>((0,u.useEffect)(()=>{if(!s.isDefined(e)||!s.isDefined(r)||!s.isDefined(o))return;const t=()=>{const a=e.getModel();s.isDefined(a)&&r.editor.setModelMarkers(a,"customMarker",o(a.getValue()))};t();const n=[e.onDidChangeModel(t),e.onDidChangeModelContent(t)];return()=>{for(const a of n)a.dispose()}},[e,r,o]),null),$=e=>(0,le.clamp)(e,j.RESIZE_HANDLE_DEFAULTS.min,j.RESIZE_HANDLE_DEFAULTS.max),_e=({height:e,resizable:r,editor:o,setResizedHeight:t})=>((0,u.useEffect)(()=>{if(!r||!s.isDefined(o))return;const n=o.getContainerDomNode().parentElement?.getBoundingClientRect().height;!s.isDefined(n)||n<=0||t({sourceHeight:e,value:$(n)})},[o,e,r,t]),null),i=e=>{if(e.trim()==="transparent")return"#00000000";const r=e.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s+\/\s+([\d.]+))?\)/);if(s.isDefined(r)){const[,o,t,n,a]=r;if(!s.isDefined(o)||!s.isDefined(t)||!s.isDefined(n))return e;const l=Math.round(parseFloat(o)*255).toString(16).padStart(2,"0"),c=Math.round(parseFloat(t)*255).toString(16).padStart(2,"0"),g=Math.round(parseFloat(n)*255).toString(16).padStart(2,"0");return s.isDefined(a)?`#${l}${c}${g}${Math.round(parseFloat(a)*255).toString(16).padStart(2,"0")}`:`#${l}${c}${g}`}return e},ve=({theme:e,colorScheme:r})=>({base:r==="dark"?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:i(e.font.color.secondary)},{token:"keyword",foreground:i(e.color.pink11)},{token:"keyword.control",foreground:i(e.color.pink11)},{token:"keyword.json",foreground:i(e.color.orange11)},{token:"number",foreground:i(e.color.orange11)},{token:"number.json",foreground:i(e.color.orange11)},{token:"regexp",foreground:i(e.color.orange11)},{token:"type",foreground:i(e.color.green11)},{token:"attribute.name",foreground:i(e.color.blue11)},{token:"tag",foreground:i(e.color.pink11)},{token:"string",foreground:i(e.color.green11)},{token:"string.key.json",foreground:i(e.color.blue11)},{token:"delimiter",foreground:i(e.font.color.light)},{token:"delimiter.bracket.json",foreground:i(e.font.color.light)},{token:"string.value.json",foreground:i(e.color.green11)},{token:"comment",foreground:i(e.font.color.light),fontStyle:"italic"}],colors:{"editor.background":i("transparent"),"editor.foreground":i(e.font.color.secondary),"editorCursor.foreground":i(e.font.color.primary),"editorLineNumber.foreground":i(e.font.color.extraLight),"editorLineNumber.activeForeground":i(e.font.color.light),"editor.lineHighlightBackground":i(e.background.tertiary),"editor.selectionBackground":i(e.background.transparent.blue),"editor.inactiveSelectionBackground":i(e.background.transparent.light),"editorIndentGuide.background1":i(e.border.color.light),"editorIndentGuide.activeBackground1":i(e.border.color.medium),"editorBracketMatch.background":i(e.background.transparent.light),"editorBracketMatch.border":i(e.border.color.medium)}}),A=({monaco:e,theme:r,colorScheme:o})=>{e.editor.defineTheme(ce,ve({theme:r,colorScheme:o}))},Ee=({monaco:e,theme:r,colorScheme:o,editorTheme:t})=>((0,u.useEffect)(()=>{s.isDefined(e)&&(A({monaco:e,theme:r,colorScheme:o}),e.editor.setTheme(t))},[o,t,e,r]),null),ke=({height:e,resizableHeight:r,contentHeight:o,shouldUseResizableHeight:t,shouldAutoHeight:n})=>t?r:n?o??e:e,Ce=({height:e,resizedHeight:r})=>r?.sourceHeight===e?r.value:(0,C.isNumber)(e)?$(e):450,he=({height:e,resizable:r,autoHeight:o})=>{const[t,n]=(0,u.useState)(),[a,l]=(0,u.useState)(),c=o&&!r,g=t?.sourceHeight===e,E=r&&(g||(0,C.isNumber)(e)),p=Ce({height:e,resizedHeight:t});return{currentHeight:ke({height:e,resizableHeight:p,contentHeight:a,shouldUseResizableHeight:E,shouldAutoHeight:c}),resizableHeight:p,setResizableHeight:b=>{n({sourceHeight:e,value:b})},setResizedHeight:n,setContentHeight:l,shouldAutoHeight:c}},He="_editorWrapper_zilk9_24",me="_editorLoader_zilk9_1",De="_container_zilk9_20",x={editorWrapper:He,editorLoader:me,container:De},B,xe=()=>(B??=import("monaco-editor").then(e=>{h.loader.config({monaco:e})}),B),Se=({onMount:e,beforeMount:r,setMarkers:o,height:t=450,width:n="100%",theme:a,loading:l=(0,d.jsx)(se.Loader,{}),variant:c="default",transparentBackground:g,isLoading:E=!1,options:p,resizable:b=!1,resizeLabel:W="Resize editor",contentPadding:w="default",autoHeight:I=!1,containerProps:H,ref:O,...P})=>{const _=M.useTheme(),y=M.useThemeColorScheme(),[L,q]=(0,u.useState)(),[v,N]=(0,u.useState)(),[K,U]=(0,u.useState)(!1),[G,V]=(0,u.useState)(!1),R=(0,u.useId)(),m=a??p?.theme??"baseCodeEditorTheme",{currentHeight:k,resizableHeight:Z,setResizableHeight:J,setResizedHeight:Q,setContentHeight:X,shouldAutoHeight:Y}=he({height:t,resizable:b,autoHeight:I}),D=(0,C.isNumber)(_.spacingMultiplicator)?_.spacingMultiplicator*4:void 0,ee=f=>{H?.onKeyDown?.(f),G&&f.stopPropagation()};return(0,d.jsxs)("div",{role:"group",...H,ref:O,className:(0,F.clsx)(x.container,H?.className),onKeyDown:ee,children:[(0,d.jsx)(pe,{configureMonacoLoader:xe,setIsMonacoLoaderConfigured:U}),(0,d.jsx)(_e,{height:t,resizable:b,editor:v,setResizedHeight:Q}),(0,d.jsx)(fe,{shouldAutoHeight:Y,editor:v,setContentHeight:X}),(0,d.jsx)(ge,{editor:v,setEditor:N,setMonaco:q,setIsEditorFocused:V}),(0,d.jsx)(be,{editor:v,monaco:L,setMarkers:o}),(0,d.jsx)(Ee,{monaco:L,theme:_,colorScheme:y,editorTheme:m}),E||!K?(0,d.jsx)("div",{className:x.editorLoader,"data-variant":c,style:{width:n,"--code-editor-height":(0,C.isNumber)(k)?`${k}px`:k},children:l}):(0,d.jsx)("div",{id:R,className:x.editorWrapper,"data-variant":c,"data-transparent-background":g||void 0,children:(0,d.jsx)(h.default,{...P,height:k,width:n,theme:m,loading:l,beforeMount:f=>{A({monaco:f,theme:_,colorScheme:y}),r?.(f)},onMount:(f,T)=>{q(T),N(f),e?.(f,T)},options:{formatOnPaste:!0,formatOnType:!0,fontFamily:_.code.font.family,bracketPairColorization:{enabled:!1},overviewRulerLanes:0,scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden"},minimap:{enabled:!1},...w==="comfortable"?{lineDecorationsWidth:D}:{},padding:{bottom:D,top:D},...p,theme:m}})}),b&&!E&&s.isDefined(v)&&(0,d.jsx)(j.ResizeHandle,{"aria-label":W,"aria-controls":R,value:Z,onValueChange:J})]})},Me="_editorHeader_19qlo_1",je="_elementContainer_19qlo_15",S={editorHeader:Me,elementContainer:je},ye=({title:e,startElement:r,endElement:o,className:t,render:n,ref:a,...l})=>(0,ue.useRender)({render:n,ref:a,props:{...l,className:(0,F.clsx)(S.editorHeader,t),children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:S.elementContainer,children:[r,e]}),(0,d.jsx)("div",{className:S.elementContainer,children:o})]})}});exports.CodeEditor=Se;exports.CodeEditorHeader=ye;
|
|
@@ -1,198 +1,305 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { n as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { useRender as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const a = Math.round(parseFloat(i) * 255).toString(16).padStart(2, "0"), k = Math.round(parseFloat(c) * 255).toString(16).padStart(2, "0"), b = Math.round(parseFloat(u) * 255).toString(16).padStart(2, "0");
|
|
17
|
-
return n(g) ? `#${a}${k}${b}${Math.round(parseFloat(g) * 255).toString(16).padStart(2, "0")}` : `#${a}${k}${b}`;
|
|
1
|
+
import { t as d } from "../isDefined-fMi6eQ4r.js";
|
|
2
|
+
import { n as rr, r as er } from "../theme-B2EaXhye.js";
|
|
3
|
+
import { t as or } from "../Loader-DtHWQH8w.js";
|
|
4
|
+
import { n as B, t as tr } from "../ResizeHandle-C1kQ3MYR.js";
|
|
5
|
+
import { useRender as nr } from "@base-ui/react/use-render";
|
|
6
|
+
import { isNumber as H } from "@sniptt/guards";
|
|
7
|
+
import { clsx as $ } from "clsx";
|
|
8
|
+
import { useEffect as p, useId as ir, useState as g } from "react";
|
|
9
|
+
import { Fragment as ar, jsx as s, jsxs as S } from "react/jsx-runtime";
|
|
10
|
+
import { clamp as dr } from "@base-ui/utils/clamp";
|
|
11
|
+
import sr, { loader as lr } from "@monaco-editor/react";
|
|
12
|
+
var ur = "baseCodeEditorTheme", cr = ({ shouldAutoHeight: r, editor: e, setContentHeight: o }) => (p(() => {
|
|
13
|
+
if (!r || !d(e)) {
|
|
14
|
+
o(void 0);
|
|
15
|
+
return;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const t = () => {
|
|
18
|
+
const a = e.getContentHeight();
|
|
19
|
+
!Number.isFinite(a) || a <= 0 || o(a);
|
|
20
|
+
};
|
|
21
|
+
t();
|
|
22
|
+
const i = e.onDidContentSizeChange(t);
|
|
23
|
+
return () => i.dispose();
|
|
24
|
+
}, [
|
|
25
|
+
e,
|
|
26
|
+
r,
|
|
27
|
+
o
|
|
28
|
+
]), null), fr = ({ editor: r, setEditor: e, setMonaco: o, setIsEditorFocused: t }) => (p(() => {
|
|
29
|
+
if (!d(r)) {
|
|
30
|
+
t(!1);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
t(r.hasWidgetFocus());
|
|
34
|
+
const i = [
|
|
35
|
+
r.onDidFocusEditorWidget(() => t(!0)),
|
|
36
|
+
r.onDidBlurEditorWidget(() => t(!1)),
|
|
37
|
+
r.onDidDispose(() => {
|
|
38
|
+
e(void 0), o(void 0);
|
|
39
|
+
})
|
|
40
|
+
];
|
|
41
|
+
return () => {
|
|
42
|
+
for (const a of i) a.dispose();
|
|
43
|
+
};
|
|
44
|
+
}, [
|
|
45
|
+
r,
|
|
46
|
+
e,
|
|
47
|
+
o,
|
|
48
|
+
t
|
|
49
|
+
]), null), gr = ({ configureMonacoLoader: r, setIsMonacoLoaderConfigured: e }) => (p(() => {
|
|
50
|
+
let o = !0;
|
|
51
|
+
return r().then(() => {
|
|
52
|
+
o && e(!0);
|
|
53
|
+
}), () => {
|
|
54
|
+
o = !1;
|
|
55
|
+
};
|
|
56
|
+
}, [r, e]), null), pr = ({ editor: r, monaco: e, setMarkers: o }) => (p(() => {
|
|
57
|
+
if (!d(r) || !d(e) || !d(o)) return;
|
|
58
|
+
const t = () => {
|
|
59
|
+
const a = r.getModel();
|
|
60
|
+
d(a) && e.editor.setModelMarkers(a, "customMarker", o(a.getValue()));
|
|
61
|
+
};
|
|
62
|
+
t();
|
|
63
|
+
const i = [r.onDidChangeModel(t), r.onDidChangeModelContent(t)];
|
|
64
|
+
return () => {
|
|
65
|
+
for (const a of i) a.dispose();
|
|
66
|
+
};
|
|
67
|
+
}, [
|
|
68
|
+
r,
|
|
69
|
+
e,
|
|
70
|
+
o
|
|
71
|
+
]), null), j = (r) => dr(r, B.min, B.max), mr = ({ height: r, resizable: e, editor: o, setResizedHeight: t }) => (p(() => {
|
|
72
|
+
if (!e || !d(o)) return;
|
|
73
|
+
const i = o.getContainerDomNode().parentElement?.getBoundingClientRect().height;
|
|
74
|
+
!d(i) || i <= 0 || t({
|
|
75
|
+
sourceHeight: r,
|
|
76
|
+
value: j(i)
|
|
77
|
+
});
|
|
78
|
+
}, [
|
|
79
|
+
o,
|
|
80
|
+
r,
|
|
81
|
+
e,
|
|
82
|
+
t
|
|
83
|
+
]), null), n = (r) => {
|
|
84
|
+
if (r.trim() === "transparent") return "#00000000";
|
|
85
|
+
const e = r.match(/color\(display-p3\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s+\/\s+([\d.]+))?\)/);
|
|
86
|
+
if (d(e)) {
|
|
87
|
+
const [, o, t, i, a] = e;
|
|
88
|
+
if (!d(o) || !d(t) || !d(i)) return r;
|
|
89
|
+
const l = Math.round(parseFloat(o) * 255).toString(16).padStart(2, "0"), u = Math.round(parseFloat(t) * 255).toString(16).padStart(2, "0"), f = Math.round(parseFloat(i) * 255).toString(16).padStart(2, "0");
|
|
90
|
+
return d(a) ? `#${l}${u}${f}${Math.round(parseFloat(a) * 255).toString(16).padStart(2, "0")}` : `#${l}${u}${f}`;
|
|
91
|
+
}
|
|
92
|
+
return r;
|
|
93
|
+
}, vr = ({ theme: r, colorScheme: e }) => ({
|
|
94
|
+
base: e === "dark" ? "vs-dark" : "vs",
|
|
22
95
|
inherit: !0,
|
|
23
96
|
rules: [
|
|
24
97
|
{
|
|
25
98
|
token: "",
|
|
26
|
-
foreground: r
|
|
99
|
+
foreground: n(r.font.color.secondary)
|
|
27
100
|
},
|
|
28
101
|
{
|
|
29
102
|
token: "keyword",
|
|
30
|
-
foreground: r
|
|
103
|
+
foreground: n(r.color.pink11)
|
|
31
104
|
},
|
|
32
105
|
{
|
|
33
106
|
token: "keyword.control",
|
|
34
|
-
foreground: r
|
|
107
|
+
foreground: n(r.color.pink11)
|
|
35
108
|
},
|
|
36
109
|
{
|
|
37
110
|
token: "keyword.json",
|
|
38
|
-
foreground: r
|
|
111
|
+
foreground: n(r.color.orange11)
|
|
39
112
|
},
|
|
40
113
|
{
|
|
41
114
|
token: "number",
|
|
42
|
-
foreground: r
|
|
115
|
+
foreground: n(r.color.orange11)
|
|
43
116
|
},
|
|
44
117
|
{
|
|
45
118
|
token: "number.json",
|
|
46
|
-
foreground: r
|
|
119
|
+
foreground: n(r.color.orange11)
|
|
47
120
|
},
|
|
48
121
|
{
|
|
49
122
|
token: "regexp",
|
|
50
|
-
foreground: r
|
|
123
|
+
foreground: n(r.color.orange11)
|
|
51
124
|
},
|
|
52
125
|
{
|
|
53
126
|
token: "type",
|
|
54
|
-
foreground: r
|
|
127
|
+
foreground: n(r.color.green11)
|
|
55
128
|
},
|
|
56
129
|
{
|
|
57
130
|
token: "attribute.name",
|
|
58
|
-
foreground: r
|
|
131
|
+
foreground: n(r.color.blue11)
|
|
59
132
|
},
|
|
60
133
|
{
|
|
61
134
|
token: "tag",
|
|
62
|
-
foreground: r
|
|
135
|
+
foreground: n(r.color.pink11)
|
|
63
136
|
},
|
|
64
137
|
{
|
|
65
138
|
token: "string",
|
|
66
|
-
foreground: r
|
|
139
|
+
foreground: n(r.color.green11)
|
|
67
140
|
},
|
|
68
141
|
{
|
|
69
142
|
token: "string.key.json",
|
|
70
|
-
foreground: r
|
|
143
|
+
foreground: n(r.color.blue11)
|
|
71
144
|
},
|
|
72
145
|
{
|
|
73
146
|
token: "delimiter",
|
|
74
|
-
foreground: r
|
|
147
|
+
foreground: n(r.font.color.light)
|
|
75
148
|
},
|
|
76
149
|
{
|
|
77
150
|
token: "delimiter.bracket.json",
|
|
78
|
-
foreground: r
|
|
151
|
+
foreground: n(r.font.color.light)
|
|
79
152
|
},
|
|
80
153
|
{
|
|
81
154
|
token: "string.value.json",
|
|
82
|
-
foreground: r
|
|
155
|
+
foreground: n(r.color.green11)
|
|
83
156
|
},
|
|
84
157
|
{
|
|
85
158
|
token: "comment",
|
|
86
|
-
foreground: r
|
|
159
|
+
foreground: n(r.font.color.light),
|
|
87
160
|
fontStyle: "italic"
|
|
88
161
|
}
|
|
89
162
|
],
|
|
90
163
|
colors: {
|
|
91
|
-
"editor.background":
|
|
92
|
-
"editor.foreground": r
|
|
93
|
-
"editorCursor.foreground": r
|
|
94
|
-
"editorLineNumber.foreground": r
|
|
95
|
-
"editorLineNumber.activeForeground": r
|
|
96
|
-
"editor.lineHighlightBackground": r
|
|
97
|
-
"editor.selectionBackground": r
|
|
98
|
-
"editor.inactiveSelectionBackground": r
|
|
99
|
-
"editorIndentGuide.background1": r
|
|
100
|
-
"editorIndentGuide.activeBackground1": r
|
|
101
|
-
"editorBracketMatch.background": r
|
|
102
|
-
"editorBracketMatch.border": r
|
|
164
|
+
"editor.background": n("transparent"),
|
|
165
|
+
"editor.foreground": n(r.font.color.secondary),
|
|
166
|
+
"editorCursor.foreground": n(r.font.color.primary),
|
|
167
|
+
"editorLineNumber.foreground": n(r.font.color.extraLight),
|
|
168
|
+
"editorLineNumber.activeForeground": n(r.font.color.light),
|
|
169
|
+
"editor.lineHighlightBackground": n(r.background.tertiary),
|
|
170
|
+
"editor.selectionBackground": n(r.background.transparent.blue),
|
|
171
|
+
"editor.inactiveSelectionBackground": n(r.background.transparent.light),
|
|
172
|
+
"editorIndentGuide.background1": n(r.border.color.light),
|
|
173
|
+
"editorIndentGuide.activeBackground1": n(r.border.color.medium),
|
|
174
|
+
"editorBracketMatch.background": n(r.background.transparent.light),
|
|
175
|
+
"editorBracketMatch.border": n(r.border.color.medium)
|
|
103
176
|
}
|
|
104
|
-
}),
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
177
|
+
}), W = ({ monaco: r, theme: e, colorScheme: o }) => {
|
|
178
|
+
r.editor.defineTheme(ur, vr({
|
|
179
|
+
theme: e,
|
|
180
|
+
colorScheme: o
|
|
181
|
+
}));
|
|
182
|
+
}, kr = ({ monaco: r, theme: e, colorScheme: o, editorTheme: t }) => (p(() => {
|
|
183
|
+
d(r) && (W({
|
|
184
|
+
monaco: r,
|
|
185
|
+
theme: e,
|
|
186
|
+
colorScheme: o
|
|
187
|
+
}), r.editor.setTheme(t));
|
|
188
|
+
}, [
|
|
189
|
+
o,
|
|
190
|
+
t,
|
|
191
|
+
r,
|
|
192
|
+
e
|
|
193
|
+
]), null), br = ({ height: r, resizableHeight: e, contentHeight: o, shouldUseResizableHeight: t, shouldAutoHeight: i }) => t ? e : i ? o ?? r : r, Cr = ({ height: r, resizedHeight: e }) => e?.sourceHeight === r ? e.value : H(r) ? j(r) : 450, hr = ({ height: r, resizable: e, autoHeight: o }) => {
|
|
194
|
+
const [t, i] = g(), [a, l] = g(), u = o && !e, f = t?.sourceHeight === r, C = e && (f || H(r)), m = Cr({
|
|
195
|
+
height: r,
|
|
196
|
+
resizedHeight: t
|
|
197
|
+
});
|
|
198
|
+
return {
|
|
199
|
+
currentHeight: br({
|
|
200
|
+
height: r,
|
|
201
|
+
resizableHeight: m,
|
|
202
|
+
contentHeight: a,
|
|
203
|
+
shouldUseResizableHeight: C,
|
|
204
|
+
shouldAutoHeight: u
|
|
205
|
+
}),
|
|
206
|
+
resizableHeight: m,
|
|
207
|
+
setResizableHeight: (v) => {
|
|
208
|
+
i({
|
|
209
|
+
sourceHeight: r,
|
|
210
|
+
value: v
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
setResizedHeight: i,
|
|
214
|
+
setContentHeight: l,
|
|
215
|
+
shouldAutoHeight: u
|
|
126
216
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
!Number.isFinite(s) || s <= 0 || T((v) => v === s ? v : s);
|
|
148
|
-
};
|
|
149
|
-
e();
|
|
150
|
-
const d = m.onDidContentSizeChange(e);
|
|
151
|
-
return () => {
|
|
152
|
-
d.dispose();
|
|
153
|
-
};
|
|
154
|
-
}, [m, M]), j || !q ? /* @__PURE__ */ l("div", {
|
|
155
|
-
className: S.editorLoader,
|
|
156
|
-
"data-variant": k,
|
|
157
|
-
style: { "--code-editor-height": typeof C == "number" ? `${C}px` : C },
|
|
158
|
-
children: /* @__PURE__ */ l(oo, {})
|
|
159
|
-
}) : /* @__PURE__ */ x("div", {
|
|
160
|
-
className: S.container,
|
|
161
|
-
onKeyDown: X,
|
|
217
|
+
}, Hr = "_editorWrapper_zilk9_24", Er = "_editorLoader_zilk9_1", _r = "_container_zilk9_20", M = {
|
|
218
|
+
editorWrapper: Hr,
|
|
219
|
+
editorLoader: Er,
|
|
220
|
+
container: _r
|
|
221
|
+
}, F, yr = () => (F ??= import("monaco-editor").then((r) => {
|
|
222
|
+
lr.config({ monaco: r });
|
|
223
|
+
}), F), Wr = ({ onMount: r, beforeMount: e, setMarkers: o, height: t = 450, width: i = "100%", theme: a, loading: l = /* @__PURE__ */ s(or, {}), variant: u = "default", transparentBackground: f, isLoading: C = !1, options: m, resizable: v = !1, resizeLabel: w = "Resize editor", contentPadding: A = "default", autoHeight: I = !1, containerProps: E, ref: O, ...K }) => {
|
|
224
|
+
const k = er(), L = rr(), [R, T] = g(), [b, x] = g(), [P, q] = g(!1), [G, U] = g(!1), z = ir(), _ = a ?? m?.theme ?? "baseCodeEditorTheme", { currentHeight: h, resizableHeight: V, setResizableHeight: Z, setResizedHeight: J, setContentHeight: Q, shouldAutoHeight: X } = hr({
|
|
225
|
+
height: t,
|
|
226
|
+
resizable: v,
|
|
227
|
+
autoHeight: I
|
|
228
|
+
}), y = H(k.spacingMultiplicator) ? k.spacingMultiplicator * 4 : void 0, Y = (c) => {
|
|
229
|
+
E?.onKeyDown?.(c), G && c.stopPropagation();
|
|
230
|
+
};
|
|
231
|
+
return /* @__PURE__ */ S("div", {
|
|
232
|
+
role: "group",
|
|
233
|
+
...E,
|
|
234
|
+
ref: O,
|
|
235
|
+
className: $(M.container, E?.className),
|
|
236
|
+
onKeyDown: Y,
|
|
162
237
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
value: o ?? "",
|
|
167
|
-
readOnly: !0
|
|
238
|
+
/* @__PURE__ */ s(gr, {
|
|
239
|
+
configureMonacoLoader: yr,
|
|
240
|
+
setIsMonacoLoaderConfigured: q
|
|
168
241
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
242
|
+
/* @__PURE__ */ s(mr, {
|
|
243
|
+
height: t,
|
|
244
|
+
resizable: v,
|
|
245
|
+
editor: b,
|
|
246
|
+
setResizedHeight: J
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ s(cr, {
|
|
249
|
+
shouldAutoHeight: X,
|
|
250
|
+
editor: b,
|
|
251
|
+
setContentHeight: Q
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ s(fr, {
|
|
254
|
+
editor: b,
|
|
255
|
+
setEditor: x,
|
|
256
|
+
setMonaco: T,
|
|
257
|
+
setIsEditorFocused: U
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ s(pr, {
|
|
260
|
+
editor: b,
|
|
261
|
+
monaco: R,
|
|
262
|
+
setMarkers: o
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ s(kr, {
|
|
265
|
+
monaco: R,
|
|
266
|
+
theme: k,
|
|
267
|
+
colorScheme: L,
|
|
268
|
+
editorTheme: _
|
|
269
|
+
}),
|
|
270
|
+
C || !P ? /* @__PURE__ */ s("div", {
|
|
271
|
+
className: M.editorLoader,
|
|
272
|
+
"data-variant": u,
|
|
273
|
+
style: {
|
|
274
|
+
width: i,
|
|
275
|
+
"--code-editor-height": H(h) ? `${h}px` : h
|
|
276
|
+
},
|
|
277
|
+
children: l
|
|
278
|
+
}) : /* @__PURE__ */ s("div", {
|
|
279
|
+
id: z,
|
|
280
|
+
className: M.editorWrapper,
|
|
281
|
+
"data-variant": u,
|
|
282
|
+
"data-transparent-background": f || void 0,
|
|
283
|
+
children: /* @__PURE__ */ s(sr, {
|
|
284
|
+
...K,
|
|
285
|
+
height: h,
|
|
286
|
+
width: i,
|
|
287
|
+
theme: _,
|
|
288
|
+
loading: l,
|
|
289
|
+
beforeMount: (c) => {
|
|
290
|
+
W({
|
|
291
|
+
monaco: c,
|
|
292
|
+
theme: k,
|
|
293
|
+
colorScheme: L
|
|
294
|
+
}), e?.(c);
|
|
188
295
|
},
|
|
189
|
-
|
|
190
|
-
|
|
296
|
+
onMount: (c, N) => {
|
|
297
|
+
T(N), x(c), r?.(c, N);
|
|
191
298
|
},
|
|
192
299
|
options: {
|
|
193
300
|
formatOnPaste: !0,
|
|
194
301
|
formatOnType: !0,
|
|
195
|
-
fontFamily:
|
|
302
|
+
fontFamily: k.code.font.family,
|
|
196
303
|
bracketPairColorization: { enabled: !1 },
|
|
197
304
|
overviewRulerLanes: 0,
|
|
198
305
|
scrollBeyondLastLine: !1,
|
|
@@ -201,38 +308,43 @@ var $ = "baseCodeEditorTheme", r = (o) => {
|
|
|
201
308
|
horizontal: "hidden"
|
|
202
309
|
},
|
|
203
310
|
minimap: { enabled: !1 },
|
|
204
|
-
...
|
|
205
|
-
|
|
311
|
+
...A === "comfortable" ? { lineDecorationsWidth: y } : {},
|
|
312
|
+
padding: {
|
|
313
|
+
bottom: y,
|
|
314
|
+
top: y
|
|
315
|
+
},
|
|
316
|
+
...m,
|
|
317
|
+
theme: _
|
|
206
318
|
}
|
|
207
319
|
})
|
|
208
320
|
}),
|
|
209
|
-
|
|
210
|
-
"aria-label":
|
|
211
|
-
"aria-controls":
|
|
212
|
-
value:
|
|
213
|
-
onValueChange:
|
|
321
|
+
v && !C && d(b) && /* @__PURE__ */ s(tr, {
|
|
322
|
+
"aria-label": w,
|
|
323
|
+
"aria-controls": z,
|
|
324
|
+
value: V,
|
|
325
|
+
onValueChange: Z
|
|
214
326
|
})
|
|
215
327
|
]
|
|
216
328
|
});
|
|
217
|
-
},
|
|
218
|
-
editorHeader:
|
|
219
|
-
elementContainer:
|
|
220
|
-
},
|
|
221
|
-
render:
|
|
222
|
-
ref:
|
|
329
|
+
}, Mr = "_editorHeader_19qlo_1", Dr = "_elementContainer_19qlo_15", D = {
|
|
330
|
+
editorHeader: Mr,
|
|
331
|
+
elementContainer: Dr
|
|
332
|
+
}, wr = ({ title: r, startElement: e, endElement: o, className: t, render: i, ref: a, ...l }) => nr({
|
|
333
|
+
render: i,
|
|
334
|
+
ref: a,
|
|
223
335
|
props: {
|
|
224
|
-
...
|
|
225
|
-
className:
|
|
226
|
-
children: /* @__PURE__ */
|
|
227
|
-
className:
|
|
228
|
-
children: [
|
|
229
|
-
}), /* @__PURE__ */
|
|
230
|
-
className:
|
|
231
|
-
children:
|
|
336
|
+
...l,
|
|
337
|
+
className: $(D.editorHeader, t),
|
|
338
|
+
children: /* @__PURE__ */ S(ar, { children: [/* @__PURE__ */ S("div", {
|
|
339
|
+
className: D.elementContainer,
|
|
340
|
+
children: [e, r]
|
|
341
|
+
}), /* @__PURE__ */ s("div", {
|
|
342
|
+
className: D.elementContainer,
|
|
343
|
+
children: o
|
|
232
344
|
})] })
|
|
233
345
|
}
|
|
234
346
|
});
|
|
235
347
|
export {
|
|
236
|
-
|
|
237
|
-
|
|
348
|
+
Wr as CodeEditor,
|
|
349
|
+
wr as CodeEditorHeader
|
|
238
350
|
};
|