@intlayer/design-system 9.4.2 → 9.4.3
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/esm/api/index.mjs +2 -2
- package/dist/esm/api/useUser/index.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +6 -6
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NodeEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
- package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs +1 -1
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockShiki.mjs +6 -48
- package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
- package/dist/esm/components/IDE/shikiBundle.mjs +61 -0
- package/dist/esm/components/IDE/shikiBundle.mjs.map +1 -0
- package/dist/esm/components/IDE/shikiLanguages.mjs +2 -39
- package/dist/esm/components/IDE/shikiLanguages.mjs.map +1 -1
- package/dist/esm/components/IDE/shikiThemes.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs +7 -2
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs.map +1 -1
- package/dist/esm/components/MarkdownEditor/extensions.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/extensions.mjs.map +1 -1
- package/dist/esm/components/MarkdownEditor/novel/extensions/code-block-shiki.mjs +197 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/code-block-shiki.mjs.map +1 -0
- package/dist/esm/components/MarkdownEditor/novel/extensions/index.mjs +2 -1
- package/dist/esm/components/MarkdownEditor/novel/extensions/index.mjs.map +1 -1
- package/dist/esm/components/MarkdownEditor/novel/index.mjs +2 -1
- package/dist/esm/components/Modal/Modal.mjs +2 -2
- package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/esm/components/Pagination/Pagination.mjs +1 -1
- package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
- package/dist/esm/components/Tab/Tab.mjs +1 -1
- package/dist/esm/components/TechLogo/logos/HTMX.mjs +2 -2
- package/dist/esm/components/TechLogo/logos/HTMX.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +7 -7
- package/dist/esm/routes.mjs +22 -6
- package/dist/esm/routes.mjs.map +1 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts +1 -1
- package/dist/types/components/IDE/CodeBlockServer.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
- package/dist/types/components/IDE/shikiBundle.d.ts +74 -0
- package/dist/types/components/IDE/shikiBundle.d.ts.map +1 -0
- package/dist/types/components/IDE/shikiLanguages.d.ts +2 -39
- package/dist/types/components/IDE/shikiLanguages.d.ts.map +1 -1
- package/dist/types/components/IDE/shikiThemes.d.ts +3 -1
- package/dist/types/components/IDE/shikiThemes.d.ts.map +1 -1
- package/dist/types/components/MarkDownRender/MarkDownIframe.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/code-block-shiki.d.ts +15 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/code-block-shiki.d.ts.map +1 -0
- package/dist/types/components/MarkdownEditor/novel/extensions/index.d.ts +2 -1
- package/dist/types/components/MarkdownEditor/novel/extensions/index.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/novel/index.d.ts +2 -1
- package/dist/types/routes.d.ts +19 -3
- package/dist/types/routes.d.ts.map +1 -1
- package/package.json +30 -16
- package/src/components/MarkdownEditor/markdown-editor.css +1 -1
package/dist/esm/api/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useAiAPI, useAnalyticsAPI, useAssetAPI, useAuditAPI, useBitbucketAPI, useDictionaryAPI, useEditorAPI, useEnvironmentAPI, useGithubAPI, useGitlabAPI, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useNewsletterAPI, useOAuthAPI, useOrganizationAPI, useProjectAPI, useReviewerAPI, useSearchAPI, useShowcaseProjectAPI, useStripeAPI, useTagAPI, useTranslateAPI, useUserAPI } from "./useIntlayerAPI.mjs";
|
|
2
|
+
import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
|
|
2
3
|
import { useOAuth2 } from "./useAuth/useOAuth2.mjs";
|
|
3
4
|
import { useSession } from "./useAuth/useSession.mjs";
|
|
4
5
|
import { useAuth } from "./useAuth/useAuth.mjs";
|
|
6
|
+
import { useUser } from "./useUser/index.mjs";
|
|
5
7
|
import { useAskDocQuestion, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useChat, useCustomQuery, useGetAIStats, useTranslateJSONDeclaration } from "./hooks/ai.mjs";
|
|
6
8
|
import { useGetAnalyticsAudience, useGetContentStats, useGetExperimentResults } from "./hooks/analytics.mjs";
|
|
7
9
|
import { useDeleteAsset, useGetAssetById, useGetAssets, useUpdateAsset, useUploadAsset } from "./hooks/asset.mjs";
|
|
8
10
|
import { useAuditScan, useGetRecursiveAuditStatus, useStartRecursiveAudit } from "./hooks/audit.mjs";
|
|
9
|
-
import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
|
|
10
11
|
import { useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos } from "./hooks/bitbucket.mjs";
|
|
11
12
|
import { useAddDictionary, useDeleteDictionary, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useInfiniteGetDictionaries, usePushDictionaries, useUpdateDictionary } from "./hooks/dictionary.mjs";
|
|
12
13
|
import { useGetDiscussions, useGetDiscussionsData } from "./hooks/discussions.mjs";
|
|
@@ -24,6 +25,5 @@ import { useAcceptAffiliateInvitation, useCancelSubscription, useCreatePortalSes
|
|
|
24
25
|
import { useAddTag, useDeleteTag, useGetTags, useUpdateTag } from "./hooks/tag.mjs";
|
|
25
26
|
import { useFillAllTranslations, usePauseTranslationJob, useResumeTranslationJob, useStopTranslationJob } from "./hooks/translate.mjs";
|
|
26
27
|
import { useCreateUser, useDeleteUser, useGetUserById, useGetUsers, useUpdateUser, useUploadUserAvatar } from "./hooks/user.mjs";
|
|
27
|
-
import { useUser } from "./useUser/index.mjs";
|
|
28
28
|
|
|
29
29
|
export { useAcceptAffiliateInvitation, useAddDictionary, useAddEnvironment, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAiAPI, useAnalyticsAPI, useAskDocQuestion, useAskResetPassword, useAssetAPI, useAuditAPI, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAuth, useAutocomplete, useBitbucketAPI, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreatePromoCode, useCreateUser, useCustomQuery, useDeleteAccessKey, useDeleteAsset, useDeleteDictionary, useDeleteEnvironment, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeletePromoCode, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDictionaryAPI, useDisableTwoFactor, useEditorAPI, useEnableTwoFactor, useEnvironmentAPI, useEstimateMission, useFillAllTranslations, useGetAIStats, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateInvitations, useGetAffiliateOnboardingLink, useGetAffiliatePromoCode, useGetAffiliateStats, useGetAffiliates, useGetAnalyticsAudience, useGetAssetById, useGetAssets, useGetCIConfig, useGetChatHistory, useGetContentStats, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetExperimentResults, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjectInsights, useGetProjects, useGetPromoCodeById, useGetPromoCodes, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAPI, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAPI, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useInfiniteGetDictionaries, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useMigrateEnvironment, useNewsletterAPI, useOAuth2, useOAuthAPI, useOrganizationAPI, usePauseTranslationJob, useProjectAPI, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResetToProductionEnvironment, useResumeTranslationJob, useReviewerAPI, useSearchAPI, useSearchDoc, useSelectEnvironment, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSession, useShowcaseProjectAPI, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useStripeAPI, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useTagAPI, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateAPI, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateAsset, useUpdateDictionary, useUpdateEnvironment, useUpdateMemberAccess, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMailerConfig, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdatePromoCode, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadAsset, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useUser, useUserAPI, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useUser } from "../../api/useUser/index.mjs";
|
|
4
3
|
import { Button } from "../Button/Button.mjs";
|
|
4
|
+
import { useUser } from "../../api/useUser/index.mjs";
|
|
5
5
|
import { AutoCompleteTextarea } from "../TextArea/AutocompleteTextArea.mjs";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
|
|
4
3
|
import { Loader } from "../../Loader/index.mjs";
|
|
5
4
|
import { Button } from "../../Button/Button.mjs";
|
|
6
5
|
import { Accordion } from "../../Accordion/Accordion.mjs";
|
|
@@ -8,6 +7,7 @@ import { Container } from "../../Container/index.mjs";
|
|
|
8
7
|
import { ContentEditorInput as ContentEditorInput$1 } from "../../ContentEditor/ContentEditorInput.mjs";
|
|
9
8
|
import { ContentEditorTextArea as ContentEditorTextArea$1 } from "../../ContentEditor/ContentEditorTextArea.mjs";
|
|
10
9
|
import { SwitchSelector } from "../../SwitchSelector/SwitchSelector.mjs";
|
|
10
|
+
import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
|
|
11
11
|
import { renameKey } from "./object.mjs";
|
|
12
12
|
import { Label } from "../../Label/index.mjs";
|
|
13
13
|
import { useLocaleSwitcherContent } from "../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
|
|
@@ -16,9 +16,9 @@ import { SafeHtmlRenderer } from "./SafeHtmlRenderer.mjs";
|
|
|
16
16
|
import { Fragment, Suspense, lazy, memo, useState } from "react";
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
import { Plus, Trash, WandSparkles } from "lucide-react";
|
|
19
|
-
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
20
19
|
import { useIntlayer, useLocale } from "react-intlayer";
|
|
21
20
|
import { getLocaleName } from "@intlayer/core/localization";
|
|
21
|
+
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
22
22
|
import { getEmptyNode, getNodeType } from "@intlayer/core/dictionaryManipulator";
|
|
23
23
|
import * as NodeTypes from "@intlayer/types/nodeType";
|
|
24
24
|
import { camelCaseToSentence } from "@intlayer/config/client";
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { Button } from "../../Button/Button.mjs";
|
|
3
4
|
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
4
5
|
import { useAddDictionary } from "../../../api/hooks/dictionary.mjs";
|
|
5
6
|
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
6
|
-
import { Button } from "../../Button/Button.mjs";
|
|
7
7
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
8
8
|
import { Select } from "../../Select/Select.mjs";
|
|
9
9
|
import { InputElement } from "../../Form/elements/InputElement.mjs";
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils/cn.mjs";
|
|
4
|
-
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
5
|
-
import { useAuditContentDeclarationMetadata } from "../../../api/hooks/ai.mjs";
|
|
6
|
-
import { useGetDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
7
|
-
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
8
|
-
import { useGetTags } from "../../../api/hooks/tag.mjs";
|
|
9
4
|
import { Loader } from "../../Loader/index.mjs";
|
|
10
5
|
import { Button } from "../../Button/Button.mjs";
|
|
11
6
|
import { Container } from "../../Container/index.mjs";
|
|
12
7
|
import { Checkbox } from "../../Input/Checkbox.mjs";
|
|
13
8
|
import { Input } from "../../Input/Input.mjs";
|
|
9
|
+
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
10
|
+
import { useAuditContentDeclarationMetadata } from "../../../api/hooks/ai.mjs";
|
|
11
|
+
import { useGetDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
12
|
+
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
13
|
+
import { useGetTags } from "../../../api/hooks/tag.mjs";
|
|
14
14
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
15
15
|
import { Select } from "../../Select/Select.mjs";
|
|
16
16
|
import { FormItem } from "../../Form/FormItem.mjs";
|
|
@@ -30,8 +30,8 @@ import { useDictionaryDetailsSchema } from "./useDictionaryDetailsSchema.mjs";
|
|
|
30
30
|
import { useEffect, useMemo, useState } from "react";
|
|
31
31
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
32
|
import { WandSparkles } from "lucide-react";
|
|
33
|
-
import { useEditedContent } from "@intlayer/editor-react";
|
|
34
33
|
import { useIntlayer } from "react-intlayer";
|
|
34
|
+
import { useEditedContent } from "@intlayer/editor-react";
|
|
35
35
|
import { useWatch } from "react-hook-form";
|
|
36
36
|
import { AnimatePresence, motion } from "framer-motion";
|
|
37
37
|
|
|
@@ -13,8 +13,8 @@ import { StructureEditor } from "./StructureEditor.mjs";
|
|
|
13
13
|
import { useEffect, useState } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { ArrowLeft } from "lucide-react";
|
|
16
|
-
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
17
16
|
import { useIntlayer } from "react-intlayer";
|
|
17
|
+
import { useConfiguration, useDictionariesRecordActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
18
18
|
|
|
19
19
|
//#region src/components/DictionaryFieldEditor/DictionaryFieldEditor.tsx
|
|
20
20
|
const DictionaryFieldEditor = ({ dictionary, onClickDictionaryList, isDarkMode, mode, onDelete, onSave, showReturnButton = true, rightContent }) => {
|
|
@@ -5,8 +5,8 @@ import { getIsEditableSection } from "../getIsEditableSection.mjs";
|
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { ChevronRight, Plus } from "lucide-react";
|
|
8
|
-
import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
9
8
|
import { useIntlayer } from "react-intlayer";
|
|
9
|
+
import { useEditedContentActions, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
10
10
|
import { getContentNodeByKeyPath, getEmptyNode, getNodeType } from "@intlayer/core/dictionaryManipulator";
|
|
11
11
|
import * as NodeTypes from "@intlayer/types/nodeType";
|
|
12
12
|
import { isSameKeyPath } from "@intlayer/core/utils";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useGetDictionaries } from "../../api/hooks/dictionary.mjs";
|
|
4
3
|
import { Container } from "../Container/index.mjs";
|
|
4
|
+
import { useGetDictionaries } from "../../api/hooks/dictionary.mjs";
|
|
5
5
|
import { LocaleSwitcherContent } from "../LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs";
|
|
6
6
|
import { TextEditorContainer } from "./ContentEditorView/TextEditor.mjs";
|
|
7
7
|
import { Pagination } from "../Pagination/Pagination.mjs";
|
|
@@ -10,8 +10,8 @@ import { KeyPathBreadcrumb } from "./KeyPathBreadcrumb.mjs";
|
|
|
10
10
|
import { NavigationViewNode } from "./NavigationView/NavigationViewNode.mjs";
|
|
11
11
|
import { useCallback, useDeferredValue, useEffect, useMemo, useState, useTransition } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
14
13
|
import { useIntlayer } from "react-intlayer";
|
|
14
|
+
import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
15
15
|
import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
|
|
16
16
|
|
|
17
17
|
//#region src/components/DictionaryFieldEditor/NodeEditor.tsx
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils/cn.mjs";
|
|
4
|
+
import { Button } from "../../Button/Button.mjs";
|
|
4
5
|
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
5
6
|
import { useAuth } from "../../../api/useAuth/useAuth.mjs";
|
|
6
7
|
import { useDeleteDictionary, usePushDictionaries } from "../../../api/hooks/dictionary.mjs";
|
|
7
8
|
import { useWriteDictionary } from "../../../api/hooks/editor.mjs";
|
|
8
|
-
import { Button } from "../../Button/Button.mjs";
|
|
9
9
|
import { Modal } from "../../Modal/Modal.mjs";
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { ArrowUpFromLine, Download, RotateCcw, Save, Trash } from "lucide-react";
|
|
13
|
-
import { useDictionariesRecordActions, useEditedContent } from "@intlayer/editor-react";
|
|
14
13
|
import { useIntlayer } from "react-intlayer";
|
|
14
|
+
import { useDictionariesRecordActions, useEditedContent } from "@intlayer/editor-react";
|
|
15
15
|
|
|
16
16
|
//#region src/components/DictionaryFieldEditor/SaveForm/SaveForm.tsx
|
|
17
17
|
const SaveForm = ({ dictionary, mode, className, onDelete, onSave, ...props }) => {
|
|
@@ -6,8 +6,8 @@ import { EditableFieldInput } from "../../EditableField/EditableFieldInput.mjs";
|
|
|
6
6
|
import { NodeTypeSelector } from "../NodeTypeSelector.mjs";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Plus, Trash } from "lucide-react";
|
|
9
|
-
import { useConfiguration, useEditedContentActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
10
9
|
import { useIntlayer } from "react-intlayer";
|
|
10
|
+
import { useConfiguration, useEditedContentActions, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
11
11
|
import { getDefaultNode, getNodeChildren, getNodeType } from "@intlayer/core/dictionaryManipulator";
|
|
12
12
|
import * as NodeTypes from "@intlayer/types/nodeType";
|
|
13
13
|
import { isSameKeyPath } from "@intlayer/core/utils";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useItemSelector } from "../../../hooks/useItemSelector.mjs";
|
|
4
3
|
import { InputIndicator, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "../../Input/OTPInput.mjs";
|
|
4
|
+
import { useItemSelector } from "../../../hooks/useItemSelector.mjs";
|
|
5
5
|
import { FormField, useFormField } from "../FormField.mjs";
|
|
6
6
|
import { FormItemLayout } from "../layout/FormItemLayout.mjs";
|
|
7
7
|
import { useEffect, useRef } from "react";
|
|
@@ -35,7 +35,7 @@ const CodeBlockHighlight = ({ children, originalLang, targetFormat, initialHtml
|
|
|
35
35
|
code = transformCode(String(children), targetFormat);
|
|
36
36
|
shikiLang = resolveCodeLanguage(deriveLanguage(originalLang, targetFormat)).id;
|
|
37
37
|
}
|
|
38
|
-
const { codeToHtml } = await import("
|
|
38
|
+
const { codeToHtml } = await import("./shikiBundle.mjs");
|
|
39
39
|
if (cancelled) return;
|
|
40
40
|
const out = await codeToHtml(String(code), {
|
|
41
41
|
lang: shikiLang,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockHighlight.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"sourcesContent":["'use client';\n\n/**\n * Client-side Shiki highlighter that also handles TypeScript→ESM/CJS transformation.\n *\n * Everything runs inside a single useEffect so that:\n * - Nothing is imported at all while the canonical TypeScript source is shown\n * and its markup was already highlighted ahead of time.\n * - The transformer is only dynamically imported when a non-TypeScript format is selected.\n * - The previous highlighted HTML stays visible while the new one loads (no white-text flash).\n */\n\nimport { type ReactNode, useEffect, useRef, useState } from 'react';\nimport type { CodeFormat } from './CodeContext';\nimport { type CodeLanguage, resolveCodeLanguage } from './shikiLanguages';\nimport { SHIKI_THEMES } from './shikiThemes';\n\ntype Props = {\n /** Raw TypeScript source code (the canonical \"source of truth\"). */\n children: ReactNode;\n /** Language of the source (e.g. 'tsx', 'typescript'). */\n originalLang: CodeLanguage;\n /** Currently selected format: 'typescript' | 'esm' | 'commonjs'. */\n targetFormat: Exclude<CodeFormat, 'json'>;\n /** Markup for the TypeScript source, highlighted ahead of time. */\n initialHtml?: string;\n};\n\nexport const CodeBlockHighlight = ({\n children,\n originalLang,\n targetFormat,\n initialHtml,\n}: Props) => {\n const [html, setHtml] = useState<string | null>(initialHtml ?? null);\n const prevHtml = useRef<string | null>(initialHtml ?? null);\n\n useEffect(() => {\n // The pre-highlighted markup already is the TypeScript rendering — no need\n // to pull Shiki into the browser until another format is picked.\n if (initialHtml && targetFormat === 'typescript') {\n prevHtml.current = initialHtml;\n setHtml(initialHtml);\n return;\n }\n\n let cancelled = false;\n\n (async () => {\n try {\n let code = children;\n let shikiLang = resolveCodeLanguage(originalLang).id;\n\n // Only import the transformer when we actually need it.\n if (targetFormat !== 'typescript') {\n const { transformCode, deriveLanguage } = await import(\n './codeTransformer'\n );\n if (cancelled) return;\n code = transformCode(String(children), targetFormat);\n shikiLang = resolveCodeLanguage(\n deriveLanguage(originalLang, targetFormat)\n ).id;\n }\n\n const { codeToHtml } = await import('
|
|
1
|
+
{"version":3,"file":"CodeBlockHighlight.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockHighlight.tsx"],"sourcesContent":["'use client';\n\n/**\n * Client-side Shiki highlighter that also handles TypeScript→ESM/CJS transformation.\n *\n * Everything runs inside a single useEffect so that:\n * - Nothing is imported at all while the canonical TypeScript source is shown\n * and its markup was already highlighted ahead of time.\n * - The transformer is only dynamically imported when a non-TypeScript format is selected.\n * - The previous highlighted HTML stays visible while the new one loads (no white-text flash).\n */\n\nimport { type ReactNode, useEffect, useRef, useState } from 'react';\nimport type { CodeFormat } from './CodeContext';\nimport { type CodeLanguage, resolveCodeLanguage } from './shikiLanguages';\nimport { SHIKI_THEMES } from './shikiThemes';\n\ntype Props = {\n /** Raw TypeScript source code (the canonical \"source of truth\"). */\n children: ReactNode;\n /** Language of the source (e.g. 'tsx', 'typescript'). */\n originalLang: CodeLanguage;\n /** Currently selected format: 'typescript' | 'esm' | 'commonjs'. */\n targetFormat: Exclude<CodeFormat, 'json'>;\n /** Markup for the TypeScript source, highlighted ahead of time. */\n initialHtml?: string;\n};\n\nexport const CodeBlockHighlight = ({\n children,\n originalLang,\n targetFormat,\n initialHtml,\n}: Props) => {\n const [html, setHtml] = useState<string | null>(initialHtml ?? null);\n const prevHtml = useRef<string | null>(initialHtml ?? null);\n\n useEffect(() => {\n // The pre-highlighted markup already is the TypeScript rendering — no need\n // to pull Shiki into the browser until another format is picked.\n if (initialHtml && targetFormat === 'typescript') {\n prevHtml.current = initialHtml;\n setHtml(initialHtml);\n return;\n }\n\n let cancelled = false;\n\n (async () => {\n try {\n let code = children;\n let shikiLang = resolveCodeLanguage(originalLang).id;\n\n // Only import the transformer when we actually need it.\n if (targetFormat !== 'typescript') {\n const { transformCode, deriveLanguage } = await import(\n './codeTransformer'\n );\n if (cancelled) return;\n code = transformCode(String(children), targetFormat);\n shikiLang = resolveCodeLanguage(\n deriveLanguage(originalLang, targetFormat)\n ).id;\n }\n\n const { codeToHtml } = await import('./shikiBundle');\n if (cancelled) return;\n\n const out = await codeToHtml(String(code), {\n lang: shikiLang,\n themes: SHIKI_THEMES,\n defaultColor: false,\n });\n\n if (!cancelled) {\n prevHtml.current = out;\n setHtml(out);\n }\n } catch {\n // Shiki failed (unknown language, etc.) — fall through to plain-text.\n if (!cancelled) setHtml('');\n }\n })();\n\n return () => {\n cancelled = true;\n };\n }, [children, originalLang, targetFormat, initialHtml]);\n\n // Keep the previous highlighted output visible while the new one is loading.\n // This prevents the white-text flash on format switches.\n const display = html ?? prevHtml.current;\n\n if (!display) {\n return (\n <pre className=\"min-w-0 max-w-full overflow-x-auto\">\n <code>{children}</code>\n </pre>\n );\n }\n\n return (\n <div\n // biome-ignore lint/security/noDangerouslySetInnerHtml: Shiki generates safe HTML for code highlighting\n dangerouslySetInnerHTML={{ __html: display }}\n style={{ backgroundColor: 'transparent' }}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAa,sBAAsB,EACjC,UACA,cACA,cACA,kBACW;CACX,MAAM,CAAC,MAAM,WAAW,SAAwB,eAAe,IAAI;CACnE,MAAM,WAAW,OAAsB,eAAe,IAAI;CAE1D,gBAAgB;EAGd,IAAI,eAAe,iBAAiB,cAAc;GAChD,SAAS,UAAU;GACnB,QAAQ,WAAW;GACnB;EACF;EAEA,IAAI,YAAY;EAEhB,CAAC,YAAY;GACX,IAAI;IACF,IAAI,OAAO;IACX,IAAI,YAAY,oBAAoB,YAAY,CAAC,CAAC;IAGlD,IAAI,iBAAiB,cAAc;KACjC,MAAM,EAAE,eAAe,mBAAmB,MAAM,OAC9C;KAEF,IAAI,WAAW;KACf,OAAO,cAAc,OAAO,QAAQ,GAAG,YAAY;KACnD,YAAY,oBACV,eAAe,cAAc,YAAY,CAC3C,CAAC,CAAC;IACJ;IAEA,MAAM,EAAE,eAAe,MAAM,OAAO;IACpC,IAAI,WAAW;IAEf,MAAM,MAAM,MAAM,WAAW,OAAO,IAAI,GAAG;KACzC,MAAM;KACN,QAAQ;KACR,cAAc;IAChB,CAAC;IAED,IAAI,CAAC,WAAW;KACd,SAAS,UAAU;KACnB,QAAQ,GAAG;IACb;GACF,QAAQ;IAEN,IAAI,CAAC,WAAW,QAAQ,EAAE;GAC5B;EACF,EAAC,CAAE;EAEH,aAAa;GACX,YAAY;EACd;CACF,GAAG;EAAC;EAAU;EAAc;EAAc;CAAW,CAAC;CAItD,MAAM,UAAU,QAAQ,SAAS;CAEjC,IAAI,CAAC,SACH,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,QAAD,EAAO,SAAe;CACnB;CAIT,OACE,oBAAC,OAAD;EAEE,yBAAyB,EAAE,QAAQ,QAAQ;EAC3C,OAAO,EAAE,iBAAiB,cAAc;CACzC;AAEL"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.mjs";
|
|
2
2
|
import { SHIKI_THEMES } from "./shikiThemes.mjs";
|
|
3
|
+
import { codeToHtml } from "./shikiBundle.mjs";
|
|
3
4
|
import { Suspense } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { transformerMetaHighlight, transformerMetaWordHighlight, transformerNotationDiff, transformerNotationErrorLevel, transformerNotationHighlight, transformerNotationWordHighlight } from "@shikijs/transformers";
|
|
6
|
-
import { codeToHtml } from "shiki/bundle/web";
|
|
7
7
|
|
|
8
8
|
//#region src/components/IDE/CodeBlockServer.tsx
|
|
9
9
|
const CodeBlockShiki = (async ({ children, lang, onChange, ...props }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockServer.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockServer.tsx"],"sourcesContent":["import {\n transformerMetaHighlight,\n transformerMetaWordHighlight,\n transformerNotationDiff,\n transformerNotationErrorLevel,\n transformerNotationHighlight,\n transformerNotationWordHighlight,\n} from '@shikijs/transformers';\nimport { cn } from '@utils/cn';\nimport { type FC, type HTMLAttributes, Suspense } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"CodeBlockServer.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockServer.tsx"],"sourcesContent":["import {\n transformerMetaHighlight,\n transformerMetaWordHighlight,\n transformerNotationDiff,\n transformerNotationErrorLevel,\n transformerNotationHighlight,\n transformerNotationWordHighlight,\n} from '@shikijs/transformers';\nimport { cn } from '@utils/cn';\nimport { type FC, type HTMLAttributes, Suspense } from 'react';\nimport { type BundledLanguage, codeToHtml } from './shikiBundle';\nimport { SHIKI_THEMES } from './shikiThemes';\n\nexport const CodeBlockShiki = (async ({\n children,\n lang,\n onChange,\n ...props\n}: CodeBlockProps) => {\n const shikiOptions: Parameters<typeof codeToHtml>[1] = {\n lang,\n themes: SHIKI_THEMES,\n // Both palettes ship as CSS variables, so one markup serves both themes.\n defaultColor: false,\n transformers: [\n transformerNotationDiff(),\n transformerNotationHighlight(),\n transformerNotationWordHighlight(),\n transformerNotationErrorLevel(),\n transformerMetaHighlight(),\n transformerMetaWordHighlight(),\n ],\n };\n\n const out = await codeToHtml(children, shikiOptions);\n\n return (\n <div\n dangerouslySetInnerHTML={{ __html: out }}\n {...props}\n style={{ backgroundColor: 'transparent' }}\n />\n );\n}) as unknown as FC<CodeBlockProps>;\n\nconst CodeDefault: FC<CodeBlockProps> = ({\n children,\n isEditable,\n onChange,\n ...props\n}) => (\n <div contentEditable={isEditable} {...props}>\n <pre>\n <code>\n {typeof children === 'string'\n ? children.split('\\n').map((line, index) => (\n <span className=\"line block w-full\" key={index}>\n {line}\n </span>\n ))\n : children}\n </code>\n </pre>\n </div>\n);\n\nexport type CodeBlockProps = {\n children: string;\n lang: BundledLanguage;\n isEditable?: boolean;\n onChange?: (content: string) => void;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>;\n\nexport const CodeBlock: FC<CodeBlockProps> = ({\n className,\n onChange,\n isEditable,\n ...props\n}) => (\n <Suspense fallback={<CodeDefault {...props} />}>\n <CodeBlockShiki\n className={cn('flex w-full', className)}\n contentEditable={isEditable}\n onInput={(e) => onChange?.(e.currentTarget.textContent ?? '')}\n {...props}\n />\n </Suspense>\n);\n"],"mappings":";;;;;;;;AAaA,MAAa,kBAAkB,OAAO,EACpC,UACA,MACA,UACA,GAAG,YACiB;CACpB,MAAM,eAAiD;EACrD;EACA,QAAQ;EAER,cAAc;EACd,cAAc;GACZ,wBAAwB;GACxB,6BAA6B;GAC7B,iCAAiC;GACjC,8BAA8B;GAC9B,yBAAyB;GACzB,6BAA6B;EAC/B;CACF;CAEA,MAAM,MAAM,MAAM,WAAW,UAAU,YAAY;CAEnD,OACE,oBAAC,OAAD;EACE,yBAAyB,EAAE,QAAQ,IAAI;EACvC,GAAI;EACJ,OAAO,EAAE,iBAAiB,cAAc;CACzC;AAEL;AAEA,MAAM,eAAmC,EACvC,UACA,YACA,UACA,GAAG,YAEH,oBAAC,OAAD;CAAK,iBAAiB;CAAY,GAAI;WACpC,oBAAC,OAAD,YACE,oBAAC,QAAD,YACG,OAAO,aAAa,WACjB,SAAS,MAAM,IAAI,CAAC,CAAC,KAAK,MAAM,UAC9B,oBAAC,QAAD;EAAM,WAAU;YACb;CACG,GAFmC,KAEnC,CACP,IACD,SACA,GACH;AACF;AAUP,MAAa,aAAiC,EAC5C,WACA,UACA,YACA,GAAG,YAEH,oBAAC,UAAD;CAAU,UAAU,oBAAC,aAAD,EAAa,GAAI,MAAQ;WAC3C,oBAAC,gBAAD;EACE,WAAW,GAAG,eAAe,SAAS;EACtC,iBAAiB;EACjB,UAAU,MAAM,WAAW,EAAE,cAAc,eAAe,EAAE;EAC5D,GAAI;CACL;AACO"}
|
|
@@ -7,60 +7,18 @@ import { useEffect, useState } from "react";
|
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
|
|
9
9
|
//#region src/components/IDE/CodeBlockShiki.tsx
|
|
10
|
-
const languageCache = /* @__PURE__ */ new Map();
|
|
11
|
-
const themeCache = /* @__PURE__ */ new Map();
|
|
12
|
-
/**
|
|
13
|
-
* Lazy load the grammar of an already resolved language.
|
|
14
|
-
*
|
|
15
|
-
* @returns The grammar registrations, or `null` for languages Shiki renders
|
|
16
|
-
* without a grammar (plain text).
|
|
17
|
-
*/
|
|
18
|
-
const loadLanguage = async ({ id, loadGrammar }) => {
|
|
19
|
-
if (!loadGrammar) return null;
|
|
20
|
-
const cachedLanguage = languageCache.get(id);
|
|
21
|
-
if (cachedLanguage) return cachedLanguage;
|
|
22
|
-
const languagePromise = loadGrammar().then((module) => module.default);
|
|
23
|
-
languageCache.set(id, languagePromise);
|
|
24
|
-
return languagePromise;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Lazy load a theme module.
|
|
28
|
-
*/
|
|
29
|
-
const loadTheme = async (themeName) => {
|
|
30
|
-
const cachedTheme = themeCache.get(themeName);
|
|
31
|
-
if (cachedTheme) return cachedTheme;
|
|
32
|
-
const themePromise = (themeName === SHIKI_THEMES.dark ? import("shiki/themes/github-dark.mjs") : import("shiki/themes/github-light.mjs")).then((module) => module.default);
|
|
33
|
-
themeCache.set(themeName, themePromise);
|
|
34
|
-
return themePromise;
|
|
35
|
-
};
|
|
36
|
-
let highlighterPromise = null;
|
|
37
|
-
const getHighlighterInstance = async () => {
|
|
38
|
-
if (!highlighterPromise) highlighterPromise = import("shiki/bundle/web").then(({ createHighlighter }) => createHighlighter({
|
|
39
|
-
langs: [],
|
|
40
|
-
themes: []
|
|
41
|
-
}));
|
|
42
|
-
return highlighterPromise;
|
|
43
|
-
};
|
|
44
10
|
/**
|
|
45
11
|
* Highlight a snippet, lazily loading only the grammar and themes it needs.
|
|
46
12
|
*
|
|
47
13
|
* The language is resolved to a canonical Shiki id first, so that the id passed
|
|
48
|
-
* to `codeToHtml` always matches
|
|
14
|
+
* to `codeToHtml` always matches a grammar the bundle can load. Shiki itself is
|
|
15
|
+
* imported from `./shikiBundle` — the fine-grained bundle — and only once a
|
|
16
|
+
* snippet actually has to be highlighted in the browser.
|
|
49
17
|
*/
|
|
50
18
|
const highlightCode = async (code, lang) => {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
loadLanguage(resolvedLanguage),
|
|
55
|
-
loadTheme(SHIKI_THEMES.light),
|
|
56
|
-
loadTheme(SHIKI_THEMES.dark)
|
|
57
|
-
]);
|
|
58
|
-
if (languageModule && !highlighter.getLoadedLanguages().includes(resolvedLanguage.id)) await highlighter.loadLanguage(languageModule);
|
|
59
|
-
const loadedThemes = highlighter.getLoadedThemes();
|
|
60
|
-
if (!loadedThemes.includes(SHIKI_THEMES.light)) await highlighter.loadTheme(lightTheme);
|
|
61
|
-
if (!loadedThemes.includes(SHIKI_THEMES.dark)) await highlighter.loadTheme(darkTheme);
|
|
62
|
-
return highlighter.codeToHtml(String(code), {
|
|
63
|
-
lang: resolvedLanguage.id,
|
|
19
|
+
const { codeToHtml } = await import("./shikiBundle.mjs");
|
|
20
|
+
return codeToHtml(String(code), {
|
|
21
|
+
lang: resolveCodeLanguage(lang).id,
|
|
64
22
|
themes: SHIKI_THEMES,
|
|
65
23
|
defaultColor: false
|
|
66
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockShiki.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useEffect, useState } from 'react';\nimport { CodeDefault, shikiWrapperClassName } from './CodeBlockClient';\nimport {
|
|
1
|
+
{"version":3,"file":"CodeBlockShiki.mjs","names":[],"sources":["../../../../src/components/IDE/CodeBlockShiki.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useEffect, useState } from 'react';\nimport { CodeDefault, shikiWrapperClassName } from './CodeBlockClient';\nimport { type CodeLanguage, resolveCodeLanguage } from './shikiLanguages';\nimport { SHIKI_THEMES } from './shikiThemes';\n\n/**\n * Highlight a snippet, lazily loading only the grammar and themes it needs.\n *\n * The language is resolved to a canonical Shiki id first, so that the id passed\n * to `codeToHtml` always matches a grammar the bundle can load. Shiki itself is\n * imported from `./shikiBundle` — the fine-grained bundle — and only once a\n * snippet actually has to be highlighted in the browser.\n */\nconst highlightCode = async (\n code: ReactNode,\n lang: CodeLanguage\n): Promise<string> => {\n const { codeToHtml } = await import('./shikiBundle');\n\n return codeToHtml(String(code), {\n lang: resolveCodeLanguage(lang).id,\n themes: SHIKI_THEMES,\n defaultColor: false,\n });\n};\n\nexport type CodeBlockShikiProps = {\n children: ReactNode;\n lang: CodeLanguage;\n};\n\nexport const CodeBlockShiki: FC<CodeBlockShikiProps> = ({ children, lang }) => {\n const [html, setHtml] = useState<string | null>(null);\n\n useEffect(() => {\n let isCancelled = false;\n\n highlightCode(children, lang)\n .then((result) => {\n if (!isCancelled) setHtml(result);\n })\n .catch((error) => {\n console.error('Failed to highlight code:', error);\n if (!isCancelled) setHtml('');\n });\n\n return () => {\n isCancelled = true;\n };\n }, [children, lang]);\n\n return (\n <div className={shikiWrapperClassName}>\n {html ? (\n // biome-ignore lint/security/noDangerouslySetInnerHtml: Shiki generates safe HTML for code highlighting\n <div dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <CodeDefault>{children}</CodeDefault>\n )}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,gBAAgB,OACpB,MACA,SACoB;CACpB,MAAM,EAAE,eAAe,MAAM,OAAO;CAEpC,OAAO,WAAW,OAAO,IAAI,GAAG;EAC9B,MAAM,oBAAoB,IAAI,CAAC,CAAC;EAChC,QAAQ;EACR,cAAc;CAChB,CAAC;AACH;AAOA,MAAa,kBAA2C,EAAE,UAAU,WAAW;CAC7E,MAAM,CAAC,MAAM,WAAW,SAAwB,IAAI;CAEpD,gBAAgB;EACd,IAAI,cAAc;EAElB,cAAc,UAAU,IAAI,CAAC,CAC1B,MAAM,WAAW;GAChB,IAAI,CAAC,aAAa,QAAQ,MAAM;EAClC,CAAC,CAAC,CACD,OAAO,UAAU;GAChB,QAAQ,MAAM,6BAA6B,KAAK;GAChD,IAAI,CAAC,aAAa,QAAQ,EAAE;EAC9B,CAAC;EAEH,aAAa;GACX,cAAc;EAChB;CACF,GAAG,CAAC,UAAU,IAAI,CAAC;CAEnB,OACE,oBAAC,OAAD;EAAK,WAAW;YACb,OAEC,oBAAC,OAAD,EAAK,yBAAyB,EAAE,QAAQ,KAAK,EAAI,KAEjD,oBAAC,aAAD,EAAc,SAAsB;CAEnC;AAET"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { grammarAliases, grammarLoaders } from "./shikiLanguages.mjs";
|
|
2
|
+
import { createBundledHighlighter, createSingletonShorthands, guessEmbeddedLanguages } from "@shikijs/core";
|
|
3
|
+
import { createOnigurumaEngine } from "@shikijs/engine-oniguruma";
|
|
4
|
+
|
|
5
|
+
//#region src/components/IDE/shikiBundle.ts
|
|
6
|
+
/**
|
|
7
|
+
* Fine-grained Shiki bundle — a drop-in replacement for `shiki` and
|
|
8
|
+
* `shiki/bundle/web`.
|
|
9
|
+
*
|
|
10
|
+
* Both of those entry points statically pull `@shikijs/themes` (~70 themes) in
|
|
11
|
+
* full, and reference every grammar of their bundle (~220 and ~100
|
|
12
|
+
* respectively). Bundlers that group a package into a single chunk — Nitro does
|
|
13
|
+
* exactly that for `node_modules` — therefore emit ~10 MB of grammars and
|
|
14
|
+
* themes even though only two themes and the languages of
|
|
15
|
+
* {@link grammarLoaders} are ever asked for.
|
|
16
|
+
*
|
|
17
|
+
* This module rebuilds the same public surface on top of `@shikijs/core`, so
|
|
18
|
+
* the module graph only ever contains what is actually reachable. Everything is
|
|
19
|
+
* loaded on demand, exactly like the upstream bundles.
|
|
20
|
+
*
|
|
21
|
+
* @see https://shiki.style/guide/bundles#fine-grained-bundle
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Alias ids pointed at the loader of the grammar that owns them, so that an
|
|
25
|
+
* alias is enough to pull its grammar in — the way it is with the upstream
|
|
26
|
+
* bundles, whose maps carry the same alias entries.
|
|
27
|
+
*/
|
|
28
|
+
const aliasLoaders = Object.fromEntries(Object.entries(grammarAliases).map(([alias, canonicalId]) => [alias, grammarLoaders[canonicalId]]));
|
|
29
|
+
/** Every language id this bundle can highlight, aliases included. */
|
|
30
|
+
const bundledLanguages = {
|
|
31
|
+
...grammarLoaders,
|
|
32
|
+
...aliasLoaders
|
|
33
|
+
};
|
|
34
|
+
/** The two themes every code block is highlighted with. */
|
|
35
|
+
const bundledThemes = {
|
|
36
|
+
"github-light": () => import("shiki/themes/github-light.mjs"),
|
|
37
|
+
"github-dark": () => import("shiki/themes/github-dark.mjs")
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Creates a highlighter that resolves language and theme ids against this
|
|
41
|
+
* bundle, loading each one the first time it is asked for.
|
|
42
|
+
*
|
|
43
|
+
* Ids still have to be the ones a grammar answers to — pass every fence name
|
|
44
|
+
* through {@link resolveCodeLanguage} first, exactly as with `shiki`'s own
|
|
45
|
+
* bundles.
|
|
46
|
+
*/
|
|
47
|
+
const createHighlighter = createBundledHighlighter({
|
|
48
|
+
langs: bundledLanguages,
|
|
49
|
+
themes: bundledThemes,
|
|
50
|
+
engine: () => createOnigurumaEngine(import("shiki/wasm"))
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Shorthands backed by a lazily created singleton highlighter — the same
|
|
54
|
+
* `codeToHtml` / `codeToHast` / … functions `shiki` exports, restricted to this
|
|
55
|
+
* bundle.
|
|
56
|
+
*/
|
|
57
|
+
const { codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, getLastGrammarState, getSingletonHighlighter } = createSingletonShorthands(createHighlighter, { guessEmbeddedLanguages });
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { bundledLanguages, bundledThemes, codeToHast, codeToHtml, codeToTokens, codeToTokensBase, codeToTokensWithThemes, createHighlighter, getLastGrammarState, getSingletonHighlighter };
|
|
61
|
+
//# sourceMappingURL=shikiBundle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shikiBundle.mjs","names":[],"sources":["../../../../src/components/IDE/shikiBundle.ts"],"sourcesContent":["/**\n * Fine-grained Shiki bundle — a drop-in replacement for `shiki` and\n * `shiki/bundle/web`.\n *\n * Both of those entry points statically pull `@shikijs/themes` (~70 themes) in\n * full, and reference every grammar of their bundle (~220 and ~100\n * respectively). Bundlers that group a package into a single chunk — Nitro does\n * exactly that for `node_modules` — therefore emit ~10 MB of grammars and\n * themes even though only two themes and the languages of\n * {@link grammarLoaders} are ever asked for.\n *\n * This module rebuilds the same public surface on top of `@shikijs/core`, so\n * the module graph only ever contains what is actually reachable. Everything is\n * loaded on demand, exactly like the upstream bundles.\n *\n * @see https://shiki.style/guide/bundles#fine-grained-bundle\n */\n\nimport {\n createBundledHighlighter,\n createSingletonShorthands,\n guessEmbeddedLanguages,\n} from '@shikijs/core';\nimport { createOnigurumaEngine } from '@shikijs/engine-oniguruma';\nimport {\n type GrammarLoader,\n grammarAliases,\n grammarLoaders,\n type ShikiLanguageAlias,\n type ShikiLanguageId,\n} from './shikiLanguages';\nimport type { ShikiThemeId } from './shikiThemes';\n\n/** Theme registrations, as default-exported by the `shiki/themes/*` modules. */\nexport type ThemeRegistration =\n typeof import('shiki/themes/github-dark.mjs')['default'];\n\n/** Loads a single Shiki theme. */\nexport type ThemeLoader = () => Promise<{ default: ThemeRegistration }>;\n\n/**\n * Alias ids pointed at the loader of the grammar that owns them, so that an\n * alias is enough to pull its grammar in — the way it is with the upstream\n * bundles, whose maps carry the same alias entries.\n */\nconst aliasLoaders = Object.fromEntries(\n Object.entries(grammarAliases).map(([alias, canonicalId]) => [\n alias,\n grammarLoaders[canonicalId as ShikiLanguageId],\n ])\n) as Record<ShikiLanguageAlias, GrammarLoader>;\n\n/** Every language id this bundle can highlight, aliases included. */\nexport const bundledLanguages = {\n ...grammarLoaders,\n ...aliasLoaders,\n};\n\n/** The two themes every code block is highlighted with. */\nexport const bundledThemes = {\n 'github-light': () => import('shiki/themes/github-light.mjs'),\n 'github-dark': () => import('shiki/themes/github-dark.mjs'),\n} satisfies Record<ShikiThemeId, ThemeLoader>;\n\n/** Language ids accepted by this bundle's highlighter. */\nexport type BundledLanguage = keyof typeof bundledLanguages;\n\n/** Theme ids accepted by this bundle's highlighter. */\nexport type BundledTheme = keyof typeof bundledThemes;\n\n/**\n * Creates a highlighter that resolves language and theme ids against this\n * bundle, loading each one the first time it is asked for.\n *\n * Ids still have to be the ones a grammar answers to — pass every fence name\n * through {@link resolveCodeLanguage} first, exactly as with `shiki`'s own\n * bundles.\n */\nexport const createHighlighter = createBundledHighlighter<\n BundledLanguage,\n BundledTheme\n>({\n langs: bundledLanguages,\n themes: bundledThemes,\n engine: () => createOnigurumaEngine(import('shiki/wasm')),\n});\n\n/** Highlighter instance produced by {@link createHighlighter}. */\nexport type Highlighter = Awaited<ReturnType<typeof createHighlighter>>;\n\n/**\n * Shorthands backed by a lazily created singleton highlighter — the same\n * `codeToHtml` / `codeToHast` / … functions `shiki` exports, restricted to this\n * bundle.\n */\nexport const {\n codeToHast,\n codeToHtml,\n codeToTokens,\n codeToTokensBase,\n codeToTokensWithThemes,\n getLastGrammarState,\n getSingletonHighlighter,\n} = createSingletonShorthands<BundledLanguage, BundledTheme>(\n createHighlighter,\n {\n guessEmbeddedLanguages,\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,eAAe,OAAO,YAC1B,OAAO,QAAQ,cAAc,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAC3D,OACA,eAAe,YACjB,CAAC,CACH;;AAGA,MAAa,mBAAmB;CAC9B,GAAG;CACH,GAAG;AACL;;AAGA,MAAa,gBAAgB;CAC3B,sBAAsB,OAAO;CAC7B,qBAAqB,OAAO;AAC9B;;;;;;;;;AAgBA,MAAa,oBAAoB,yBAG/B;CACA,OAAO;CACP,QAAQ;CACR,cAAc,sBAAsB,OAAO,aAAa;AAC1D,CAAC;;;;;;AAUD,MAAa,EACX,YACA,YACA,cACA,kBACA,wBACA,qBACA,4BACE,0BACF,mBACA,EACE,uBACF,CACF"}
|
|
@@ -7,43 +7,16 @@
|
|
|
7
7
|
* grammar instead of bundling every language up front.
|
|
8
8
|
*/
|
|
9
9
|
const grammarLoaders = {
|
|
10
|
-
"angular-html": () => import("shiki/langs/angular-html.mjs"),
|
|
11
|
-
"angular-ts": () => import("shiki/langs/angular-ts.mjs"),
|
|
12
10
|
astro: () => import("shiki/langs/astro.mjs"),
|
|
13
11
|
bash: () => import("shiki/langs/bash.mjs"),
|
|
14
|
-
c: () => import("shiki/langs/c.mjs"),
|
|
15
|
-
cpp: () => import("shiki/langs/cpp.mjs"),
|
|
16
|
-
csharp: () => import("shiki/langs/csharp.mjs"),
|
|
17
12
|
css: () => import("shiki/langs/css.mjs"),
|
|
18
|
-
csv: () => import("shiki/langs/csv.mjs"),
|
|
19
|
-
dart: () => import("shiki/langs/dart.mjs"),
|
|
20
|
-
diff: () => import("shiki/langs/diff.mjs"),
|
|
21
|
-
docker: () => import("shiki/langs/docker.mjs"),
|
|
22
|
-
go: () => import("shiki/langs/go.mjs"),
|
|
23
|
-
graphql: () => import("shiki/langs/graphql.mjs"),
|
|
24
13
|
html: () => import("shiki/langs/html.mjs"),
|
|
25
|
-
http: () => import("shiki/langs/http.mjs"),
|
|
26
|
-
ini: () => import("shiki/langs/ini.mjs"),
|
|
27
|
-
java: () => import("shiki/langs/java.mjs"),
|
|
28
14
|
javascript: () => import("shiki/langs/javascript.mjs"),
|
|
29
15
|
json: () => import("shiki/langs/json.mjs"),
|
|
30
16
|
json5: () => import("shiki/langs/json5.mjs"),
|
|
31
|
-
|
|
32
|
-
less: () => import("shiki/langs/less.mjs"),
|
|
33
|
-
lua: () => import("shiki/langs/lua.mjs"),
|
|
17
|
+
jsonc: () => import("shiki/langs/jsonc.mjs"),
|
|
34
18
|
markdown: () => import("shiki/langs/markdown.mjs"),
|
|
35
|
-
nginx: () => import("shiki/langs/nginx.mjs"),
|
|
36
|
-
php: () => import("shiki/langs/php.mjs"),
|
|
37
|
-
powershell: () => import("shiki/langs/powershell.mjs"),
|
|
38
|
-
prisma: () => import("shiki/langs/prisma.mjs"),
|
|
39
|
-
python: () => import("shiki/langs/python.mjs"),
|
|
40
|
-
ruby: () => import("shiki/langs/ruby.mjs"),
|
|
41
|
-
rust: () => import("shiki/langs/rust.mjs"),
|
|
42
|
-
scss: () => import("shiki/langs/scss.mjs"),
|
|
43
|
-
sql: () => import("shiki/langs/sql.mjs"),
|
|
44
19
|
svelte: () => import("shiki/langs/svelte.mjs"),
|
|
45
|
-
swift: () => import("shiki/langs/swift.mjs"),
|
|
46
|
-
toml: () => import("shiki/langs/toml.mjs"),
|
|
47
20
|
tsx: () => import("shiki/langs/tsx.mjs"),
|
|
48
21
|
typescript: () => import("shiki/langs/typescript.mjs"),
|
|
49
22
|
vue: () => import("shiki/langs/vue.mjs"),
|
|
@@ -57,30 +30,20 @@ const shikiLanguageIds = Object.keys(grammarLoaders);
|
|
|
57
30
|
* canonical id that actually owns the grammar.
|
|
58
31
|
*/
|
|
59
32
|
const grammarAliases = {
|
|
60
|
-
"c#": "csharp",
|
|
61
|
-
"c++": "cpp",
|
|
62
33
|
cjs: "javascript",
|
|
63
34
|
console: "bash",
|
|
64
|
-
cs: "csharp",
|
|
65
35
|
cts: "typescript",
|
|
66
36
|
dockerfile: "docker",
|
|
67
|
-
golang: "go",
|
|
68
37
|
gql: "graphql",
|
|
69
38
|
htm: "html",
|
|
70
39
|
js: "javascript",
|
|
71
40
|
jsonc: "json5",
|
|
72
41
|
jsx: "tsx",
|
|
73
|
-
kt: "kotlin",
|
|
74
42
|
md: "markdown",
|
|
75
43
|
mdx: "markdown",
|
|
76
44
|
mjs: "javascript",
|
|
77
45
|
mts: "typescript",
|
|
78
46
|
postcss: "css",
|
|
79
|
-
ps1: "powershell",
|
|
80
|
-
pwsh: "powershell",
|
|
81
|
-
py: "python",
|
|
82
|
-
rb: "ruby",
|
|
83
|
-
rs: "rust",
|
|
84
47
|
sh: "bash",
|
|
85
48
|
shell: "bash",
|
|
86
49
|
shellscript: "bash",
|
|
@@ -118,5 +81,5 @@ const resolveCodeLanguage = (language) => {
|
|
|
118
81
|
};
|
|
119
82
|
|
|
120
83
|
//#endregion
|
|
121
|
-
export { resolveCodeLanguage, shikiLanguageIds };
|
|
84
|
+
export { grammarAliases, grammarLoaders, resolveCodeLanguage, shikiLanguageIds };
|
|
122
85
|
//# sourceMappingURL=shikiLanguages.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shikiLanguages.mjs","names":[],"sources":["../../../../src/components/IDE/shikiLanguages.ts"],"sourcesContent":["/**\n * Grammar registrations, as default-exported by the `shiki/langs/*` modules.\n */\nexport type LanguageGrammar =\n typeof import('shiki/langs/typescript.mjs')['default'];\n\n/**\n * Loads a single Shiki grammar (and its embedded dependencies).\n */\nexport type GrammarLoader = () => Promise<{ default: LanguageGrammar }>;\n\n/**\n * Shiki grammar loaders, keyed by the canonical Shiki language id.\n *\n * Import specifiers are written as literals (never template strings) so that\n * bundlers can statically analyse them and emit one lazily fetched chunk per\n * grammar instead of bundling every language up front.\n */\
|
|
1
|
+
{"version":3,"file":"shikiLanguages.mjs","names":[],"sources":["../../../../src/components/IDE/shikiLanguages.ts"],"sourcesContent":["/**\n * Grammar registrations, as default-exported by the `shiki/langs/*` modules.\n */\nexport type LanguageGrammar =\n typeof import('shiki/langs/typescript.mjs')['default'];\n\n/**\n * Loads a single Shiki grammar (and its embedded dependencies).\n */\nexport type GrammarLoader = () => Promise<{ default: LanguageGrammar }>;\n\n/**\n * Shiki grammar loaders, keyed by the canonical Shiki language id.\n *\n * Import specifiers are written as literals (never template strings) so that\n * bundlers can statically analyse them and emit one lazily fetched chunk per\n * grammar instead of bundling every language up front.\n */\nexport const grammarLoaders = {\n astro: () => import('shiki/langs/astro.mjs'),\n bash: () => import('shiki/langs/bash.mjs'),\n css: () => import('shiki/langs/css.mjs'),\n html: () => import('shiki/langs/html.mjs'),\n javascript: () => import('shiki/langs/javascript.mjs'),\n json: () => import('shiki/langs/json.mjs'),\n json5: () => import('shiki/langs/json5.mjs'),\n jsonc: () => import('shiki/langs/jsonc.mjs'),\n markdown: () => import('shiki/langs/markdown.mjs'),\n svelte: () => import('shiki/langs/svelte.mjs'),\n tsx: () => import('shiki/langs/tsx.mjs'),\n typescript: () => import('shiki/langs/typescript.mjs'),\n vue: () => import('shiki/langs/vue.mjs'),\n xml: () => import('shiki/langs/xml.mjs'),\n yaml: () => import('shiki/langs/yaml.mjs'),\n // 'angular-html': () => import('shiki/langs/angular-html.mjs'),\n // 'angular-ts': () => import('shiki/langs/angular-ts.mjs'),\n // c: () => import('shiki/langs/c.mjs'),\n // cpp: () => import('shiki/langs/cpp.mjs'),\n // csharp: () => import('shiki/langs/csharp.mjs'),\n // csv: () => import('shiki/langs/csv.mjs'),\n // dart: () => import('shiki/langs/dart.mjs'),\n // diff: () => import('shiki/langs/diff.mjs'),\n // docker: () => import('shiki/langs/docker.mjs'),\n // go: () => import('shiki/langs/go.mjs'),\n // graphql: () => import('shiki/langs/graphql.mjs'),\n // http: () => import('shiki/langs/http.mjs'),\n // ini: () => import('shiki/langs/ini.mjs'),\n // java: () => import('shiki/langs/java.mjs'),\n // kotlin: () => import('shiki/langs/kotlin.mjs'),\n // less: () => import('shiki/langs/less.mjs'),\n // lua: () => import('shiki/langs/lua.mjs'),\n // nginx: () => import('shiki/langs/nginx.mjs'),\n // php: () => import('shiki/langs/php.mjs'),\n // powershell: () => import('shiki/langs/powershell.mjs'),\n // prisma: () => import('shiki/langs/prisma.mjs'),\n // python: () => import('shiki/langs/python.mjs'),\n // ruby: () => import('shiki/langs/ruby.mjs'),\n // rust: () => import('shiki/langs/rust.mjs'),\n // scss: () => import('shiki/langs/scss.mjs'),\n // sql: () => import('shiki/langs/sql.mjs'), // swift: () => import('shiki/langs/swift.mjs'),\n // toml: () => import('shiki/langs/toml.mjs'),\n} satisfies Record<string, GrammarLoader>;\n\n/** Canonical Shiki language ids this package can highlight. */\nexport type ShikiLanguageId = keyof typeof grammarLoaders;\n\n/** Every canonical language id that ships with a grammar loader. */\nexport const shikiLanguageIds = Object.keys(\n grammarLoaders\n) as ShikiLanguageId[];\n\n/**\n * Code fence names that are rendered by another grammar, mapped to the\n * canonical id that actually owns the grammar.\n */\nexport const grammarAliases = {\n cjs: 'javascript',\n console: 'bash',\n cts: 'typescript',\n dockerfile: 'docker',\n gql: 'graphql',\n htm: 'html',\n js: 'javascript',\n jsonc: 'json5',\n jsx: 'tsx',\n md: 'markdown',\n mdx: 'markdown',\n mjs: 'javascript',\n mts: 'typescript',\n postcss: 'css',\n sh: 'bash',\n shell: 'bash',\n shellscript: 'bash',\n ts: 'typescript',\n yml: 'yaml',\n zsh: 'bash',\n} satisfies Record<string, ShikiLanguageId>;\n\n/** Code fence names accepted as aliases of a canonical language id. */\nexport type ShikiLanguageAlias = keyof typeof grammarAliases;\n\n/**\n * Languages Shiki renders without any grammar. They are also used as the\n * fallback for languages this package does not ship a grammar for.\n */\nexport type PlainTextLanguage = 'plaintext' | 'text' | 'txt';\n\nconst PLAIN_TEXT_LANGUAGE = 'plaintext' satisfies PlainTextLanguage;\n\n/** Every language name accepted by the code block components. */\nexport type CodeLanguage =\n | ShikiLanguageId\n | ShikiLanguageAlias\n | PlainTextLanguage;\n\n/**\n * A language name resolved to what Shiki actually needs to highlight it.\n */\nexport type ResolvedCodeLanguage = {\n /** Canonical language id to pass to `codeToHtml` / `codeToHast`. */\n id: ShikiLanguageId | PlainTextLanguage;\n /** Grammar loader, or `null` when the language needs no grammar. */\n loadGrammar: GrammarLoader | null;\n};\n\n/**\n * Resolve a code fence language name to a canonical Shiki id and its grammar\n * loader.\n *\n * Unknown names resolve to plain text rather than to an arbitrary grammar, so\n * that `codeToHtml` never receives a language it has not loaded.\n *\n * @param language - Language name coming from a code fence or a `lang` prop.\n *\n * @example\n * resolveCodeLanguage('ts'); // { id: 'typescript', loadGrammar: fn }\n * resolveCodeLanguage('toml'); // { id: 'toml', loadGrammar: fn }\n * resolveCodeLanguage('brainfuck'); // { id: 'plaintext', loadGrammar: null }\n */\nexport const resolveCodeLanguage = (\n language: CodeLanguage | string | undefined | null\n): ResolvedCodeLanguage => {\n const normalizedLanguage = (language ?? '').trim().toLowerCase();\n\n const canonicalId =\n grammarAliases[normalizedLanguage as ShikiLanguageAlias] ??\n (normalizedLanguage as ShikiLanguageId);\n\n const loadGrammar = grammarLoaders[canonicalId] as GrammarLoader | undefined;\n\n if (!loadGrammar) {\n return { id: PLAIN_TEXT_LANGUAGE, loadGrammar: null };\n }\n\n return { id: canonicalId, loadGrammar };\n};\n"],"mappings":";;;;;;;;AAkBA,MAAa,iBAAiB;CAC5B,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,WAAW,OAAO;CAClB,YAAY,OAAO;CACnB,kBAAkB,OAAO;CACzB,YAAY,OAAO;CACnB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,gBAAgB,OAAO;CACvB,cAAc,OAAO;CACrB,WAAW,OAAO;CAClB,kBAAkB,OAAO;CACzB,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,YAAY,OAAO;AA4BrB;;AAMA,MAAa,mBAAmB,OAAO,KACrC,cACF;;;;;AAMA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,KAAK;CACL,YAAY;CACZ,KAAK;CACL,KAAK;CACL,IAAI;CACJ,OAAO;CACP,KAAK;CACL,IAAI;CACJ,KAAK;CACL,KAAK;CACL,KAAK;CACL,SAAS;CACT,IAAI;CACJ,OAAO;CACP,aAAa;CACb,IAAI;CACJ,KAAK;CACL,KAAK;AACP;AAWA,MAAM,sBAAsB;;;;;;;;;;;;;;;AAgC5B,MAAa,uBACX,aACyB;CACzB,MAAM,sBAAsB,YAAY,GAAE,CAAE,KAAK,CAAC,CAAC,YAAY;CAE/D,MAAM,cACJ,eAAe,uBACd;CAEH,MAAM,cAAc,eAAe;CAEnC,IAAI,CAAC,aACH,OAAO;EAAE,IAAI;EAAqB,aAAa;CAAK;CAGtD,OAAO;EAAE,IAAI;EAAa;CAAY;AACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shikiThemes.mjs","names":[],"sources":["../../../../src/components/IDE/shikiThemes.ts"],"sourcesContent":["/**\n * Themes every code block is highlighted with.\n *\n * Shiki is always asked for both, with `defaultColor: false`, so each token\n * carries its light and dark colour as the `--shiki-light` / `--shiki-dark`\n * custom properties rather than a resolved `color`. The markup is therefore\n * theme-agnostic: it can be produced once — at build time — and never has to be\n * recomputed in the browser when the resolved theme changes.\n */\nexport const SHIKI_THEMES = {\n light: 'github-light',\n dark: 'github-dark',\n} as const;\n\nexport type ShikiThemes = typeof SHIKI_THEMES;\n"],"mappings":";;;;;;;;;;AASA,MAAa,eAAe;CAC1B,OAAO;CACP,MAAM;AACR"}
|
|
1
|
+
{"version":3,"file":"shikiThemes.mjs","names":[],"sources":["../../../../src/components/IDE/shikiThemes.ts"],"sourcesContent":["/**\n * Themes every code block is highlighted with.\n *\n * Shiki is always asked for both, with `defaultColor: false`, so each token\n * carries its light and dark colour as the `--shiki-light` / `--shiki-dark`\n * custom properties rather than a resolved `color`. The markup is therefore\n * theme-agnostic: it can be produced once — at build time — and never has to be\n * recomputed in the browser when the resolved theme changes.\n */\nexport const SHIKI_THEMES = {\n light: 'github-light',\n dark: 'github-dark',\n} as const;\n\nexport type ShikiThemes = typeof SHIKI_THEMES;\n\n/** Every theme id the fine-grained Shiki bundle can resolve. */\nexport type ShikiThemeId = ShikiThemes[keyof ShikiThemes];\n"],"mappings":";;;;;;;;;;AASA,MAAa,eAAe;CAC1B,OAAO;CACP,MAAM;AACR"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
|
|
4
3
|
import { Button } from "../Button/Button.mjs";
|
|
5
4
|
import { Container } from "../Container/index.mjs";
|
|
6
5
|
import { DropDown } from "../DropDown/index.mjs";
|
|
7
6
|
import { Input } from "../Input/Input.mjs";
|
|
8
7
|
import { SwitchSelector } from "../SwitchSelector/SwitchSelector.mjs";
|
|
8
|
+
import { usePersistedStore } from "../../hooks/usePersistedStore.mjs";
|
|
9
9
|
import { useLocaleSwitcherContent } from "./LocaleSwitcherContentContext.mjs";
|
|
10
10
|
import { useMemo, useRef, useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|