@stisocial/ui 0.1.0 → 0.2.1
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/CHANGELOG.md +32 -0
- package/README.md +25 -0
- package/dist/agency/FacebookPostPreview/FacebookPostPreview.css +73 -0
- package/dist/agency/FacebookPostPreview/FacebookPostPreview.d.ts +27 -0
- package/dist/agency/FacebookPostPreview/FacebookPostPreview.js +80 -0
- package/dist/agency/FacebookPostPreview/FacebookPostPreview.module.js +15 -0
- package/dist/agency/FacebookPostPreview/index.d.ts +2 -0
- package/dist/agency/InstagramPostPreview/InstagramPostPreview.css +84 -0
- package/dist/agency/InstagramPostPreview/InstagramPostPreview.d.ts +23 -0
- package/dist/agency/InstagramPostPreview/InstagramPostPreview.js +80 -0
- package/dist/agency/InstagramPostPreview/InstagramPostPreview.module.js +17 -0
- package/dist/agency/InstagramPostPreview/index.d.ts +2 -0
- package/dist/agency/InstagramReelPreview/InstagramReelPreview.css +84 -0
- package/dist/agency/InstagramReelPreview/InstagramReelPreview.d.ts +24 -0
- package/dist/agency/InstagramReelPreview/InstagramReelPreview.js +88 -0
- package/dist/agency/InstagramReelPreview/InstagramReelPreview.module.js +13 -0
- package/dist/agency/InstagramReelPreview/index.d.ts +2 -0
- package/dist/agency/InstagramStoryPreview/InstagramStoryPreview.css +105 -0
- package/dist/agency/InstagramStoryPreview/InstagramStoryPreview.d.ts +23 -0
- package/dist/agency/InstagramStoryPreview/InstagramStoryPreview.js +59 -0
- package/dist/agency/InstagramStoryPreview/InstagramStoryPreview.module.js +14 -0
- package/dist/agency/InstagramStoryPreview/index.d.ts +2 -0
- package/dist/agency/LinkedInPostPreview/LinkedInPostPreview.css +83 -0
- package/dist/agency/LinkedInPostPreview/LinkedInPostPreview.d.ts +30 -0
- package/dist/agency/LinkedInPostPreview/LinkedInPostPreview.js +99 -0
- package/dist/agency/LinkedInPostPreview/LinkedInPostPreview.module.js +16 -0
- package/dist/agency/LinkedInPostPreview/index.d.ts +2 -0
- package/dist/agency/PinterestPinPreview/PinterestPinPreview.css +96 -0
- package/dist/agency/PinterestPinPreview/PinterestPinPreview.d.ts +23 -0
- package/dist/agency/PinterestPinPreview/PinterestPinPreview.js +57 -0
- package/dist/agency/PinterestPinPreview/PinterestPinPreview.module.js +15 -0
- package/dist/agency/PinterestPinPreview/index.d.ts +2 -0
- package/dist/agency/ThreadsPostPreview/ThreadsPostPreview.css +101 -0
- package/dist/agency/ThreadsPostPreview/ThreadsPostPreview.d.ts +19 -0
- package/dist/agency/ThreadsPostPreview/ThreadsPostPreview.js +82 -0
- package/dist/agency/ThreadsPostPreview/ThreadsPostPreview.module.js +17 -0
- package/dist/agency/ThreadsPostPreview/index.d.ts +2 -0
- package/dist/agency/TikTokPreview/TikTokPreview.css +84 -0
- package/dist/agency/TikTokPreview/TikTokPreview.d.ts +25 -0
- package/dist/agency/TikTokPreview/TikTokPreview.js +95 -0
- package/dist/agency/TikTokPreview/TikTokPreview.module.js +13 -0
- package/dist/agency/TikTokPreview/index.d.ts +2 -0
- package/dist/agency/XPostPreview/XPostPreview.css +89 -0
- package/dist/agency/XPostPreview/XPostPreview.d.ts +20 -0
- package/dist/agency/XPostPreview/XPostPreview.js +91 -0
- package/dist/agency/XPostPreview/XPostPreview.module.js +16 -0
- package/dist/agency/XPostPreview/index.d.ts +2 -0
- package/dist/agency/YouTubeThumbnailPreview/YouTubeThumbnailPreview.css +55 -0
- package/dist/agency/YouTubeThumbnailPreview/YouTubeThumbnailPreview.d.ts +20 -0
- package/dist/agency/YouTubeThumbnailPreview/YouTubeThumbnailPreview.js +49 -0
- package/dist/agency/YouTubeThumbnailPreview/YouTubeThumbnailPreview.module.js +13 -0
- package/dist/agency/YouTubeThumbnailPreview/index.d.ts +2 -0
- package/dist/agency/_shared/Preview.css +226 -0
- package/dist/agency/_shared/Preview.d.ts +27 -0
- package/dist/agency/_shared/Preview.js +117 -0
- package/dist/agency/_shared/Preview.module.js +21 -0
- package/dist/agency/_shared/platforms.d.ts +24 -0
- package/dist/agency/_shared/platforms.js +109 -0
- package/dist/agency/index.d.ts +23 -0
- package/dist/agency/index.js +12 -0
- package/dist/ai/AiDisclosure/AiDisclosure.css +99 -0
- package/dist/ai/AiDisclosure/AiDisclosure.d.ts +28 -0
- package/dist/ai/AiDisclosure/AiDisclosure.js +52 -0
- package/dist/ai/AiDisclosure/AiDisclosure.module.js +10 -0
- package/dist/ai/AiDisclosure/index.d.ts +2 -0
- package/dist/ai/AttachmentChip/AttachmentChip.css +144 -0
- package/dist/ai/AttachmentChip/AttachmentChip.d.ts +40 -0
- package/dist/ai/AttachmentChip/AttachmentChip.js +140 -0
- package/dist/ai/AttachmentChip/AttachmentChip.module.js +13 -0
- package/dist/ai/AttachmentChip/index.d.ts +2 -0
- package/dist/ai/ChatThread/ChatThread.css +66 -0
- package/dist/ai/ChatThread/ChatThread.d.ts +20 -0
- package/dist/ai/ChatThread/ChatThread.js +87 -0
- package/dist/ai/ChatThread/ChatThread.module.js +10 -0
- package/dist/ai/ChatThread/ChatThreadMessage.css +80 -0
- package/dist/ai/ChatThread/ChatThreadMessage.d.ts +23 -0
- package/dist/ai/ChatThread/ChatThreadMessage.js +41 -0
- package/dist/ai/ChatThread/ChatThreadMessage.module.js +10 -0
- package/dist/ai/ChatThread/index.d.ts +3 -0
- package/dist/ai/ConversationList/ConversationList.css +175 -0
- package/dist/ai/ConversationList/ConversationList.d.ts +33 -0
- package/dist/ai/ConversationList/ConversationList.js +133 -0
- package/dist/ai/ConversationList/ConversationList.module.js +18 -0
- package/dist/ai/ConversationList/groups.d.ts +23 -0
- package/dist/ai/ConversationList/groups.js +47 -0
- package/dist/ai/MessageActions/MessageActions.css +9 -0
- package/dist/ai/MessageActions/MessageActions.d.ts +33 -0
- package/dist/ai/MessageActions/MessageActions.js +89 -0
- package/dist/ai/MessageActions/MessageActions.module.js +4 -0
- package/dist/ai/MessageActions/index.d.ts +2 -0
- package/dist/ai/ModelSelect/ModelSelect.css +7 -0
- package/dist/ai/ModelSelect/ModelSelect.d.ts +38 -0
- package/dist/ai/ModelSelect/ModelSelect.js +41 -0
- package/dist/ai/ModelSelect/ModelSelect.module.js +4 -0
- package/dist/ai/ModelSelect/index.d.ts +2 -0
- package/dist/ai/PromptInput/PromptInput.css +176 -0
- package/dist/ai/PromptInput/PromptInput.d.ts +54 -0
- package/dist/ai/PromptInput/PromptInput.js +199 -0
- package/dist/ai/PromptInput/PromptInput.module.js +15 -0
- package/dist/ai/PromptInput/index.d.ts +2 -0
- package/dist/ai/SourceList/SourceList.css +226 -0
- package/dist/ai/SourceList/SourceList.d.ts +36 -0
- package/dist/ai/SourceList/SourceList.js +102 -0
- package/dist/ai/SourceList/SourceList.module.js +17 -0
- package/dist/ai/StreamingText/StreamingText.css +69 -0
- package/dist/ai/StreamingText/StreamingText.d.ts +33 -0
- package/dist/ai/StreamingText/StreamingText.js +98 -0
- package/dist/ai/StreamingText/StreamingText.module.js +9 -0
- package/dist/ai/SuggestedPrompts/SuggestedPrompts.css +198 -0
- package/dist/ai/SuggestedPrompts/SuggestedPrompts.d.ts +35 -0
- package/dist/ai/SuggestedPrompts/SuggestedPrompts.js +54 -0
- package/dist/ai/SuggestedPrompts/SuggestedPrompts.module.js +14 -0
- package/dist/ai/SuggestedPrompts/index.d.ts +2 -0
- package/dist/ai/ThinkingIndicator/ThinkingIndicator.css +83 -0
- package/dist/ai/ThinkingIndicator/ThinkingIndicator.d.ts +16 -0
- package/dist/ai/ThinkingIndicator/ThinkingIndicator.js +47 -0
- package/dist/ai/ThinkingIndicator/ThinkingIndicator.module.js +10 -0
- package/dist/ai/ToolCallCard/ToolCallCard.css +249 -0
- package/dist/ai/ToolCallCard/ToolCallCard.d.ts +39 -0
- package/dist/ai/ToolCallCard/ToolCallCard.js +157 -0
- package/dist/ai/ToolCallCard/ToolCallCard.module.js +22 -0
- package/dist/ai/ToolCallCard/index.d.ts +2 -0
- package/dist/ai/_internal/glyphs.js +45 -0
- package/dist/ai/index.d.ts +23 -0
- package/dist/ai/index.js +15 -0
- package/dist/charts/AreaChart/AreaChart.css +9 -0
- package/dist/charts/AreaChart/AreaChart.d.ts +13 -0
- package/dist/charts/AreaChart/AreaChart.js +19 -0
- package/dist/charts/AreaChart/AreaChart.module.js +4 -0
- package/dist/charts/AreaChart/index.d.ts +2 -0
- package/dist/charts/BarChart/BarChart.css +9 -0
- package/dist/charts/BarChart/BarChart.d.ts +17 -0
- package/dist/charts/BarChart/BarChart.js +21 -0
- package/dist/charts/BarChart/BarChart.module.js +4 -0
- package/dist/charts/BarChart/index.d.ts +2 -0
- package/dist/charts/ChartLegend/ChartLegend.css +110 -0
- package/dist/charts/ChartLegend/ChartLegend.d.ts +36 -0
- package/dist/charts/ChartLegend/ChartLegend.js +55 -0
- package/dist/charts/ChartLegend/ChartLegend.module.js +11 -0
- package/dist/charts/ChartLegend/index.d.ts +2 -0
- package/dist/charts/ChartTable/ChartTable.css +109 -0
- package/dist/charts/ChartTable/ChartTable.d.ts +43 -0
- package/dist/charts/ChartTable/ChartTable.js +60 -0
- package/dist/charts/ChartTable/ChartTable.module.js +12 -0
- package/dist/charts/ChartTable/index.d.ts +2 -0
- package/dist/charts/ChartTooltip/ChartTooltip.css +77 -0
- package/dist/charts/ChartTooltip/ChartTooltip.d.ts +29 -0
- package/dist/charts/ChartTooltip/ChartTooltip.js +48 -0
- package/dist/charts/ChartTooltip/ChartTooltip.module.js +12 -0
- package/dist/charts/ChartTooltip/index.d.ts +2 -0
- package/dist/charts/ComboChart/ComboChart.css +9 -0
- package/dist/charts/ComboChart/ComboChart.d.ts +21 -0
- package/dist/charts/ComboChart/ComboChart.js +19 -0
- package/dist/charts/ComboChart/ComboChart.module.js +4 -0
- package/dist/charts/ComboChart/index.d.ts +3 -0
- package/dist/charts/LineChart/LineChart.css +9 -0
- package/dist/charts/LineChart/LineChart.d.ts +13 -0
- package/dist/charts/LineChart/LineChart.js +19 -0
- package/dist/charts/LineChart/LineChart.module.js +4 -0
- package/dist/charts/LineChart/index.d.ts +2 -0
- package/dist/charts/StackedBarChart/StackedBarChart.css +9 -0
- package/dist/charts/StackedBarChart/StackedBarChart.d.ts +17 -0
- package/dist/charts/StackedBarChart/StackedBarChart.js +21 -0
- package/dist/charts/StackedBarChart/StackedBarChart.module.js +4 -0
- package/dist/charts/StackedBarChart/index.d.ts +2 -0
- package/dist/charts/_internal/Bars.d.ts +31 -0
- package/dist/charts/_internal/Bars.js +295 -0
- package/dist/charts/_internal/LineArea.d.ts +32 -0
- package/dist/charts/_internal/LineArea.js +150 -0
- package/dist/charts/_internal/category.d.ts +19 -0
- package/dist/charts/_internal/category.js +139 -0
- package/dist/charts/_internal/format.d.ts +14 -0
- package/dist/charts/_internal/format.js +41 -0
- package/dist/charts/_internal/frame/ChartFrame.css +113 -0
- package/dist/charts/_internal/frame/ChartFrame.d.ts +3 -0
- package/dist/charts/_internal/frame/ChartFrame.js +217 -0
- package/dist/charts/_internal/frame/ChartFrame.module.js +17 -0
- package/dist/charts/_internal/marks/marks.css +195 -0
- package/dist/charts/_internal/marks/marks.js +192 -0
- package/dist/charts/_internal/marks/marks.module.js +12 -0
- package/dist/charts/_internal/math.js +107 -0
- package/dist/charts/_internal/shapes.d.ts +1 -0
- package/dist/charts/_internal/shapes.js +127 -0
- package/dist/charts/index.d.ts +20 -0
- package/dist/charts/index.js +9 -0
- package/dist/commerce/AddToCartButton/AddToCartButton.css +54 -0
- package/dist/commerce/AddToCartButton/AddToCartButton.d.ts +42 -0
- package/dist/commerce/AddToCartButton/AddToCartButton.js +94 -0
- package/dist/commerce/AddToCartButton/AddToCartButton.module.js +10 -0
- package/dist/commerce/AddToCartButton/index.d.ts +2 -0
- package/dist/commerce/PriceDisplay/PriceDisplay.css +77 -0
- package/dist/commerce/PriceDisplay/PriceDisplay.d.ts +35 -0
- package/dist/commerce/PriceDisplay/PriceDisplay.js +60 -0
- package/dist/commerce/PriceDisplay/PriceDisplay.module.js +10 -0
- package/dist/commerce/QuantityStepper/QuantityStepper.css +108 -0
- package/dist/commerce/QuantityStepper/QuantityStepper.d.ts +32 -0
- package/dist/commerce/QuantityStepper/QuantityStepper.js +86 -0
- package/dist/commerce/QuantityStepper/QuantityStepper.module.js +9 -0
- package/dist/commerce/QuantityStepper/index.d.ts +2 -0
- package/dist/commerce/StockBadge/StockBadge.d.ts +31 -0
- package/dist/commerce/StockBadge/StockBadge.js +47 -0
- package/dist/commerce/StockBadge/index.d.ts +2 -0
- package/dist/commerce/VariantSelector/VariantSelector.css +202 -0
- package/dist/commerce/VariantSelector/VariantSelector.d.ts +44 -0
- package/dist/commerce/VariantSelector/VariantSelector.js +77 -0
- package/dist/commerce/VariantSelector/VariantSelector.module.js +13 -0
- package/dist/commerce/VariantSelector/index.d.ts +2 -0
- package/dist/commerce/index.d.ts +10 -0
- package/dist/commerce/index.js +6 -0
- package/dist/components/Accordion/Accordion.css +176 -0
- package/dist/components/Accordion/Accordion.d.ts +40 -0
- package/dist/components/Accordion/Accordion.js +90 -0
- package/dist/components/Accordion/Accordion.module.js +17 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/components/Combobox/Combobox.js +1 -1
- package/dist/components/Disclosure/Disclosure.css +162 -0
- package/dist/components/Disclosure/Disclosure.d.ts +32 -0
- package/dist/components/Disclosure/Disclosure.js +60 -0
- package/dist/components/Disclosure/Disclosure.module.js +15 -0
- package/dist/components/Disclosure/index.d.ts +2 -0
- package/dist/components/DocumentLayout/DocumentLayout.css +202 -0
- package/dist/components/DocumentLayout/DocumentLayout.d.ts +33 -0
- package/dist/components/DocumentLayout/DocumentLayout.js +69 -0
- package/dist/components/DocumentLayout/DocumentLayout.module.js +20 -0
- package/dist/components/DocumentLayout/index.d.ts +2 -0
- package/dist/components/DocumentTable/DocumentTable.css +149 -0
- package/dist/components/DocumentTable/DocumentTable.d.ts +40 -0
- package/dist/components/DocumentTable/DocumentTable.js +67 -0
- package/dist/components/DocumentTable/DocumentTable.module.js +12 -0
- package/dist/components/DocumentTable/index.d.ts +2 -0
- package/dist/components/ErrorPage/ErrorPage.css +181 -0
- package/dist/components/ErrorPage/ErrorPage.d.ts +44 -0
- package/dist/components/ErrorPage/ErrorPage.js +145 -0
- package/dist/components/ErrorPage/ErrorPage.module.js +17 -0
- package/dist/components/ErrorPage/index.d.ts +2 -0
- package/dist/components/FeedbackWidget/FeedbackWidget.css +59 -0
- package/dist/components/FeedbackWidget/FeedbackWidget.d.ts +47 -0
- package/dist/components/FeedbackWidget/FeedbackWidget.js +198 -0
- package/dist/components/FeedbackWidget/FeedbackWidget.module.js +11 -0
- package/dist/components/FeedbackWidget/index.d.ts +2 -0
- package/dist/components/Figure/Figure.css +64 -0
- package/dist/components/Figure/Figure.d.ts +24 -0
- package/dist/components/Figure/Figure.js +38 -0
- package/dist/components/Figure/Figure.module.js +10 -0
- package/dist/components/Figure/index.d.ts +2 -0
- package/dist/components/FileList/FileList.css +160 -0
- package/dist/components/FileList/FileList.d.ts +45 -0
- package/dist/components/FileList/FileList.js +146 -0
- package/dist/components/FileList/FileList.module.js +15 -0
- package/dist/components/FileList/index.d.ts +2 -0
- package/dist/components/FilterPanel/FilterPanel.js +1 -1
- package/dist/components/IconPicker/IconPicker.js +1 -1
- package/dist/components/LinkRows/LinkRows.css +135 -0
- package/dist/components/LinkRows/LinkRows.d.ts +32 -0
- package/dist/components/LinkRows/LinkRows.js +62 -0
- package/dist/components/LinkRows/LinkRows.module.js +15 -0
- package/dist/components/LinkRows/index.d.ts +2 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +1 -1
- package/dist/components/OnboardingChecklist/OnboardingChecklist.js +1 -1
- package/dist/components/PageNumber/PageNumber.css +21 -0
- package/dist/components/PageNumber/PageNumber.d.ts +23 -0
- package/dist/components/PageNumber/PageNumber.js +33 -0
- package/dist/components/PageNumber/PageNumber.module.js +4 -0
- package/dist/components/PaymentInfo/PaymentInfo.css +116 -0
- package/dist/components/PaymentInfo/PaymentInfo.d.ts +41 -0
- package/dist/components/PaymentInfo/PaymentInfo.js +115 -0
- package/dist/components/PaymentInfo/PaymentInfo.module.js +15 -0
- package/dist/components/PaymentInfo/index.d.ts +2 -0
- package/dist/components/PersonItem/PersonItem.css +112 -0
- package/dist/components/PersonItem/PersonItem.d.ts +31 -0
- package/dist/components/PersonItem/PersonItem.js +54 -0
- package/dist/components/PersonItem/PersonItem.module.js +11 -0
- package/dist/components/PersonItem/index.d.ts +2 -0
- package/dist/components/PhoneField/PhoneField.js +1 -1
- package/dist/components/ReadMore/ReadMore.js +1 -1
- package/dist/components/SideNav/SideNav.js +1 -1
- package/dist/components/SignaturePad/SignaturePad.js +1 -1
- package/dist/components/SplitButton/SplitButton.js +1 -1
- package/dist/components/Table/Table.css +150 -0
- package/dist/components/Table/Table.d.ts +54 -0
- package/dist/components/Table/Table.js +75 -0
- package/dist/components/Table/Table.module.js +14 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.js +1 -1
- package/dist/components/TimeSlotPicker/TimeSlotPicker.d.ts +1 -11
- package/dist/components/TimeSlotPicker/TimeSlotPicker.js +2 -24
- package/dist/components/TimeSlotPicker/index.d.ts +3 -2
- package/dist/components/TimeSlotPicker/timeSlots.d.ts +12 -0
- package/dist/components/TimeSlotPicker/timeSlots.js +25 -0
- package/dist/components/TotalsBlock/TotalsBlock.css +86 -0
- package/dist/components/TotalsBlock/TotalsBlock.d.ts +32 -0
- package/dist/components/TotalsBlock/TotalsBlock.js +88 -0
- package/dist/components/TotalsBlock/TotalsBlock.module.js +10 -0
- package/dist/components/TotalsBlock/index.d.ts +3 -0
- package/dist/components/TotalsBlock/totals.d.ts +28 -0
- package/dist/components/TotalsBlock/totals.js +38 -0
- package/dist/components/TrashView/TrashView.css +166 -0
- package/dist/components/TrashView/TrashView.d.ts +49 -0
- package/dist/components/TrashView/TrashView.js +244 -0
- package/dist/components/TrashView/TrashView.module.js +22 -0
- package/dist/components/TrashView/index.d.ts +2 -0
- package/dist/components/TreeSelect/TreeSelect.js +1 -1
- package/dist/components/UploadQueue/UploadQueue.js +1 -1
- package/dist/components/Watermark/Watermark.css +51 -0
- package/dist/components/Watermark/Watermark.d.ts +23 -0
- package/dist/components/Watermark/Watermark.js +54 -0
- package/dist/components/Watermark/Watermark.module.js +8 -0
- package/dist/components/WhatsNew/WhatsNew.css +196 -0
- package/dist/components/WhatsNew/WhatsNew.d.ts +57 -0
- package/dist/components/WhatsNew/WhatsNew.js +191 -0
- package/dist/components/WhatsNew/WhatsNew.module.js +27 -0
- package/dist/components/WhatsNew/index.d.ts +2 -0
- package/dist/components/_document/text.js +14 -0
- package/dist/components/_document/types.d.ts +36 -0
- package/dist/components/_document/types.js +8 -0
- package/dist/components/_internal/listbox/SelectShell.js +1 -1
- package/dist/document/index.d.ts +13 -0
- package/dist/document/index.js +9 -0
- package/dist/editor/CodeEditor/CodeEditor.css +312 -0
- package/dist/editor/CodeEditor/CodeEditor.d.ts +66 -0
- package/dist/editor/CodeEditor/CodeEditor.js +256 -0
- package/dist/editor/CodeEditor/CodeEditor.module.js +32 -0
- package/dist/editor/CodeEditor/codeEdits.d.ts +1 -0
- package/dist/editor/CodeEditor/codeEdits.js +284 -0
- package/dist/editor/CodeEditor/highlight.js +195 -0
- package/dist/editor/CodeEditor/index.d.ts +3 -0
- package/dist/editor/JsonEditor/JsonEditor.css +10 -0
- package/dist/editor/JsonEditor/JsonEditor.d.ts +43 -0
- package/dist/editor/JsonEditor/JsonEditor.js +133 -0
- package/dist/editor/JsonEditor/JsonEditor.module.js +4 -0
- package/dist/editor/JsonEditor/index.d.ts +3 -0
- package/dist/editor/JsonEditor/json.d.ts +44 -0
- package/dist/editor/JsonEditor/json.js +246 -0
- package/dist/editor/MarkdownEditor/MarkdownEditor.css +173 -0
- package/dist/editor/MarkdownEditor/MarkdownEditor.d.ts +47 -0
- package/dist/editor/MarkdownEditor/MarkdownEditor.js +371 -0
- package/dist/editor/MarkdownEditor/MarkdownEditor.module.js +18 -0
- package/dist/editor/MarkdownEditor/commands.js +198 -0
- package/dist/editor/MarkdownEditor/index.d.ts +2 -0
- package/dist/editor/_shared/FormatIcons.js +138 -0
- package/dist/editor/_shared/textEdit.js +76 -0
- package/dist/editor/index.d.ts +9 -0
- package/dist/editor/index.js +5 -0
- package/dist/email/EmailButton/EmailButton.d.ts +22 -0
- package/dist/email/EmailButton/EmailButton.js +102 -0
- package/dist/email/EmailButton/index.d.ts +2 -0
- package/dist/email/EmailCallout/EmailCallout.d.ts +14 -0
- package/dist/email/EmailCallout/EmailCallout.js +42 -0
- package/dist/email/EmailCallout/index.d.ts +2 -0
- package/dist/email/EmailCode/EmailCode.d.ts +15 -0
- package/dist/email/EmailCode/EmailCode.js +58 -0
- package/dist/email/EmailCode/index.d.ts +2 -0
- package/dist/email/EmailColumns/EmailColumns.d.ts +18 -0
- package/dist/email/EmailColumns/EmailColumns.js +49 -0
- package/dist/email/EmailColumns/index.d.ts +2 -0
- package/dist/email/EmailDivider/EmailDivider.d.ts +7 -0
- package/dist/email/EmailDivider/EmailDivider.js +24 -0
- package/dist/email/EmailDivider/index.d.ts +2 -0
- package/dist/email/EmailFooter/EmailFooter.d.ts +30 -0
- package/dist/email/EmailFooter/EmailFooter.js +64 -0
- package/dist/email/EmailFooter/index.d.ts +2 -0
- package/dist/email/EmailHeader/EmailHeader.d.ts +23 -0
- package/dist/email/EmailHeader/EmailHeader.js +75 -0
- package/dist/email/EmailHeader/index.d.ts +2 -0
- package/dist/email/EmailHeading/EmailHeading.d.ts +11 -0
- package/dist/email/EmailHeading/EmailHeading.js +43 -0
- package/dist/email/EmailHeading/index.d.ts +2 -0
- package/dist/email/EmailImage/EmailImage.d.ts +25 -0
- package/dist/email/EmailImage/EmailImage.js +53 -0
- package/dist/email/EmailImage/index.d.ts +2 -0
- package/dist/email/EmailLayout/EmailLayout.d.ts +30 -0
- package/dist/email/EmailLayout/EmailLayout.js +79 -0
- package/dist/email/EmailLayout/emailDocument.d.ts +16 -0
- package/dist/email/EmailLayout/emailDocument.js +36 -0
- package/dist/email/EmailLayout/index.d.ts +3 -0
- package/dist/email/EmailList/EmailList.d.ts +10 -0
- package/dist/email/EmailList/EmailList.js +28 -0
- package/dist/email/EmailList/index.d.ts +2 -0
- package/dist/email/EmailPreheader/EmailPreheader.d.ts +14 -0
- package/dist/email/EmailPreheader/EmailPreheader.js +30 -0
- package/dist/email/EmailPreheader/index.d.ts +2 -0
- package/dist/email/EmailProductRow/EmailProductRow.d.ts +23 -0
- package/dist/email/EmailProductRow/EmailProductRow.js +112 -0
- package/dist/email/EmailProductRow/index.d.ts +2 -0
- package/dist/email/EmailSocialLinks/EmailSocialLinks.d.ts +19 -0
- package/dist/email/EmailSocialLinks/EmailSocialLinks.js +53 -0
- package/dist/email/EmailSocialLinks/index.d.ts +2 -0
- package/dist/email/EmailStats/EmailStats.d.ts +23 -0
- package/dist/email/EmailStats/EmailStats.js +86 -0
- package/dist/email/EmailStats/index.d.ts +2 -0
- package/dist/email/EmailTable/EmailTable.d.ts +24 -0
- package/dist/email/EmailTable/EmailTable.js +90 -0
- package/dist/email/EmailTable/index.d.ts +2 -0
- package/dist/email/EmailText/EmailText.d.ts +13 -0
- package/dist/email/EmailText/EmailText.js +35 -0
- package/dist/email/EmailText/index.d.ts +2 -0
- package/dist/email/_shared/theme.d.ts +8 -0
- package/dist/email/_shared/theme.js +90 -0
- package/dist/email/index.d.ts +36 -0
- package/dist/email/index.js +19 -0
- package/dist/icons/generated/index.js +8 -8
- package/dist/icons/index.js +8 -8
- package/dist/id/AccountMenu/AccountMenu.css +194 -0
- package/dist/id/AccountMenu/AccountMenu.d.ts +73 -0
- package/dist/id/AccountMenu/AccountMenu.js +171 -0
- package/dist/id/AccountMenu/AccountMenu.module.js +21 -0
- package/dist/id/AccountMenu/index.d.ts +2 -0
- package/dist/id/AppSwitcher/AppSwitcher.css +231 -0
- package/dist/id/AppSwitcher/AppSwitcher.d.ts +56 -0
- package/dist/id/AppSwitcher/AppSwitcher.js +141 -0
- package/dist/id/AppSwitcher/AppSwitcher.module.js +17 -0
- package/dist/id/AppSwitcher/index.d.ts +2 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.css +222 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.d.ts +62 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.js +189 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.module.js +16 -0
- package/dist/id/OrgSwitcher/index.d.ts +2 -0
- package/dist/id/PermissionGate/PermissionGate.css +68 -0
- package/dist/id/PermissionGate/PermissionGate.d.ts +32 -0
- package/dist/id/PermissionGate/PermissionGate.js +58 -0
- package/dist/id/PermissionGate/PermissionGate.module.js +11 -0
- package/dist/id/PermissionGate/index.d.ts +2 -0
- package/dist/id/SignInButton/SignInButton.css +179 -0
- package/dist/id/SignInButton/SignInButton.d.ts +29 -0
- package/dist/id/SignInButton/SignInButton.js +53 -0
- package/dist/id/SignInButton/SignInButton.module.js +10 -0
- package/dist/id/_internal/ActionItem/ActionItem.css +143 -0
- package/dist/id/_internal/ActionItem/ActionItem.js +68 -0
- package/dist/id/_internal/ActionItem/ActionItem.module.js +11 -0
- package/dist/id/_internal/StiMark/StiMark.css +28 -0
- package/dist/id/_internal/StiMark/StiMark.js +37 -0
- package/dist/id/_internal/StiMark/StiMark.module.js +8 -0
- package/dist/id/index.d.ts +10 -0
- package/dist/id/index.js +6 -0
- package/dist/index.d.ts +28 -5
- package/dist/index.js +16 -4
- package/dist/maps/DirectionsLink/DirectionsLink.css +10 -0
- package/dist/maps/DirectionsLink/DirectionsLink.d.ts +35 -0
- package/dist/maps/DirectionsLink/DirectionsLink.js +84 -0
- package/dist/maps/DirectionsLink/DirectionsLink.module.js +4 -0
- package/dist/maps/DirectionsLink/index.d.ts +2 -0
- package/dist/maps/LocationPicker/LocationPicker.css +60 -0
- package/dist/maps/LocationPicker/LocationPicker.d.ts +37 -0
- package/dist/maps/LocationPicker/LocationPicker.js +278 -0
- package/dist/maps/LocationPicker/LocationPicker.module.js +12 -0
- package/dist/maps/LocationPicker/index.d.ts +2 -0
- package/dist/maps/MapMarker/MapMarker.css +318 -0
- package/dist/maps/MapMarker/MapMarker.d.ts +35 -0
- package/dist/maps/MapMarker/MapMarker.js +142 -0
- package/dist/maps/MapMarker/MapMarker.module.js +20 -0
- package/dist/maps/MapMarker/index.d.ts +2 -0
- package/dist/maps/MapView/MapView.css +268 -0
- package/dist/maps/MapView/MapView.d.ts +71 -0
- package/dist/maps/MapView/MapView.js +495 -0
- package/dist/maps/MapView/MapView.module.js +23 -0
- package/dist/maps/MapView/index.d.ts +2 -0
- package/dist/maps/StoreLocator/StoreLocator.css +201 -0
- package/dist/maps/StoreLocator/StoreLocator.d.ts +43 -0
- package/dist/maps/StoreLocator/StoreLocator.js +225 -0
- package/dist/maps/StoreLocator/StoreLocator.module.js +21 -0
- package/dist/maps/StoreLocator/index.d.ts +2 -0
- package/dist/maps/TurkeyMap/TurkeyMap.css +229 -0
- package/dist/maps/TurkeyMap/TurkeyMap.d.ts +45 -0
- package/dist/maps/TurkeyMap/TurkeyMap.js +280 -0
- package/dist/maps/TurkeyMap/TurkeyMap.module.js +17 -0
- package/dist/maps/TurkeyMap/tileGrid.js +85 -0
- package/dist/maps/_internal/geo.d.ts +8 -0
- package/dist/maps/_internal/geo.js +116 -0
- package/dist/maps/_internal/mapContext.js +8 -0
- package/dist/maps/_internal/useControllable.js +24 -0
- package/dist/maps/index.d.ts +12 -0
- package/dist/maps/index.js +7 -0
- package/dist/media/AudioPlayer/AudioPlayer.css +106 -0
- package/dist/media/AudioPlayer/AudioPlayer.d.ts +38 -0
- package/dist/media/AudioPlayer/AudioPlayer.js +134 -0
- package/dist/media/AudioPlayer/AudioPlayer.module.js +16 -0
- package/dist/media/AudioPlayer/index.d.ts +2 -0
- package/dist/media/AudioWaveform/AudioWaveform.css +43 -0
- package/dist/media/AudioWaveform/AudioWaveform.d.ts +25 -0
- package/dist/media/AudioWaveform/AudioWaveform.js +101 -0
- package/dist/media/AudioWaveform/AudioWaveform.module.js +9 -0
- package/dist/media/AudioWaveform/peaks.d.ts +14 -0
- package/dist/media/AudioWaveform/peaks.js +54 -0
- package/dist/media/MediaCard/MediaCard.css +229 -0
- package/dist/media/MediaCard/MediaCard.d.ts +38 -0
- package/dist/media/MediaCard/MediaCard.js +120 -0
- package/dist/media/MediaCard/MediaCard.module.js +18 -0
- package/dist/media/MediaCard/index.d.ts +2 -0
- package/dist/media/VideoPlayer/VideoPlayer.css +125 -0
- package/dist/media/VideoPlayer/VideoPlayer.d.ts +54 -0
- package/dist/media/VideoPlayer/VideoPlayer.js +193 -0
- package/dist/media/VideoPlayer/VideoPlayer.module.js +12 -0
- package/dist/media/VideoThumbnail/VideoThumbnail.css +139 -0
- package/dist/media/VideoThumbnail/VideoThumbnail.d.ts +34 -0
- package/dist/media/VideoThumbnail/VideoThumbnail.js +63 -0
- package/dist/media/VideoThumbnail/VideoThumbnail.module.js +10 -0
- package/dist/media/VideoThumbnail/VideoThumbnailLink.js +18 -0
- package/dist/media/_internal/clock.js +17 -0
- package/dist/media/_internal/consent/ConsentNotice.css +55 -0
- package/dist/media/_internal/consent/ConsentNotice.js +40 -0
- package/dist/media/_internal/consent/ConsentNotice.module.js +10 -0
- package/dist/media/_internal/icons.js +77 -0
- package/dist/media/_internal/range/Range.css +187 -0
- package/dist/media/_internal/range/Range.js +130 -0
- package/dist/media/_internal/range/Range.module.js +10 -0
- package/dist/media/_internal/transport/MediaTransport.css +90 -0
- package/dist/media/_internal/transport/MediaTransport.js +172 -0
- package/dist/media/_internal/transport/MediaTransport.module.js +14 -0
- package/dist/media/_internal/url.js +31 -0
- package/dist/media/_internal/useConsent.js +28 -0
- package/dist/media/_internal/useMedia.js +146 -0
- package/dist/media/index.d.ts +9 -0
- package/dist/media/index.js +7 -0
- package/dist/messages/messages.d.ts +488 -0
- package/dist/messages/messages.js +978 -2
- package/dist/site/AnnouncementBar/AnnouncementBar.css +132 -0
- package/dist/site/AnnouncementBar/AnnouncementBar.d.ts +28 -0
- package/dist/site/AnnouncementBar/AnnouncementBar.js +64 -0
- package/dist/site/AnnouncementBar/AnnouncementBar.module.js +11 -0
- package/dist/site/AnnouncementBar/index.d.ts +2 -0
- package/dist/site/MegaMenu/MegaMenu.css +324 -0
- package/dist/site/MegaMenu/MegaMenu.d.ts +51 -0
- package/dist/site/MegaMenu/MegaMenu.js +170 -0
- package/dist/site/MegaMenu/MegaMenu.module.js +28 -0
- package/dist/site/MegaMenu/index.d.ts +2 -0
- package/dist/site/SiteFooter/SiteFooter.css +129 -0
- package/dist/site/SiteFooter/SiteFooter.d.ts +38 -0
- package/dist/site/SiteFooter/SiteFooter.js +79 -0
- package/dist/site/SiteFooter/SiteFooter.module.js +20 -0
- package/dist/site/SiteFooter/index.d.ts +2 -0
- package/dist/site/SiteHeader/SiteHeader.css +213 -0
- package/dist/site/SiteHeader/SiteHeader.d.ts +40 -0
- package/dist/site/SiteHeader/SiteHeader.js +115 -0
- package/dist/site/SiteHeader/SiteHeader.module.js +18 -0
- package/dist/site/SiteHeader/index.d.ts +2 -0
- package/dist/site/StickyCta/StickyCta.css +112 -0
- package/dist/site/StickyCta/StickyCta.d.ts +27 -0
- package/dist/site/StickyCta/StickyCta.js +69 -0
- package/dist/site/StickyCta/StickyCta.module.js +10 -0
- package/dist/site/StickyCta/index.d.ts +2 -0
- package/dist/site/index.d.ts +11 -0
- package/dist/site/index.js +6 -0
- package/dist/styles.css +24991 -14440
- package/dist/text/text.d.ts +5 -1
- package/dist/text/text.js +8 -2
- package/package.json +45 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { lineBounds } from "../_shared/textEdit.js";
|
|
2
|
+
// src/editor/CodeEditor/codeEdits.ts
|
|
3
|
+
/**
|
|
4
|
+
* Kod düzenleyicinin saf düzenleme işlevleri: girinti, Enter, geri silme, ikili işaret ve satır
|
|
5
|
+
* yorumu. Hepsi (metin, seçim) alır, bir `TextEdit` (ya da tarayıcının kendi davranışına bırakmak
|
|
6
|
+
* için `null`) döndürür; DOM'a dokunmaz.
|
|
7
|
+
*/
|
|
8
|
+
function indentUnit(tabSize, insertSpaces) {
|
|
9
|
+
return {
|
|
10
|
+
text: insertSpaces ? " ".repeat(tabSize) : " ",
|
|
11
|
+
size: tabSize
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Seçimin kapsadığı satırların başlangıcı ve sonu; son satır yalnız satır başına değen imleçse hariç. */
|
|
15
|
+
function lineRange(state) {
|
|
16
|
+
const first = lineBounds(state.value, state.start);
|
|
17
|
+
let endPos = state.end;
|
|
18
|
+
if (state.end > state.start && state.value[state.end - 1] === "\n") endPos = state.end - 1;
|
|
19
|
+
const last = lineBounds(state.value, endPos);
|
|
20
|
+
return {
|
|
21
|
+
from: first.start,
|
|
22
|
+
to: last.end
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Tab ve Shift+Tab. */
|
|
26
|
+
function indentEdit(state, unit, outdent) {
|
|
27
|
+
const { value, start, end } = state;
|
|
28
|
+
const multi = value.slice(start, end).includes("\n");
|
|
29
|
+
if (!outdent && !multi) {
|
|
30
|
+
const col = start - lineBounds(value, start).start;
|
|
31
|
+
const insert = unit.text === " " ? " " : " ".repeat(unit.size - col % unit.size);
|
|
32
|
+
const pos = start + insert.length;
|
|
33
|
+
return {
|
|
34
|
+
from: start,
|
|
35
|
+
to: end,
|
|
36
|
+
insert,
|
|
37
|
+
selectStart: pos,
|
|
38
|
+
selectEnd: pos
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const { from, to } = lineRange(state);
|
|
42
|
+
const lines = value.slice(from, to).split("\n");
|
|
43
|
+
let firstDelta = 0;
|
|
44
|
+
let total = 0;
|
|
45
|
+
const out = lines.map((line, i) => {
|
|
46
|
+
let next;
|
|
47
|
+
let delta;
|
|
48
|
+
if (outdent) {
|
|
49
|
+
const lead = /^( +|\t)/.exec(line)?.[0] ?? "";
|
|
50
|
+
const remove = lead.startsWith(" ") ? 1 : Math.min(lead.length, unit.size);
|
|
51
|
+
next = line.slice(remove);
|
|
52
|
+
delta = -remove;
|
|
53
|
+
} else if (line === "") {
|
|
54
|
+
next = line;
|
|
55
|
+
delta = 0;
|
|
56
|
+
} else {
|
|
57
|
+
next = unit.text + line;
|
|
58
|
+
delta = unit.text.length;
|
|
59
|
+
}
|
|
60
|
+
if (i === 0) firstDelta = delta;
|
|
61
|
+
total += delta;
|
|
62
|
+
return next;
|
|
63
|
+
});
|
|
64
|
+
const selectStart = start === from ? from : Math.max(from, start + firstDelta);
|
|
65
|
+
const selectEnd = Math.max(selectStart, end + total);
|
|
66
|
+
return {
|
|
67
|
+
from,
|
|
68
|
+
to,
|
|
69
|
+
insert: out.join("\n"),
|
|
70
|
+
selectStart,
|
|
71
|
+
selectEnd
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const CLOSERS = {
|
|
75
|
+
"{": "}",
|
|
76
|
+
"[": "]",
|
|
77
|
+
"(": ")"
|
|
78
|
+
};
|
|
79
|
+
const CLOSER_SET = new Set(Object.values(CLOSERS));
|
|
80
|
+
const QUOTES = /* @__PURE__ */ new Set([
|
|
81
|
+
"\"",
|
|
82
|
+
"'",
|
|
83
|
+
"`"
|
|
84
|
+
]);
|
|
85
|
+
const isWord = (ch) => ch !== void 0 && /[\p{L}\p{N}_]/u.test(ch);
|
|
86
|
+
/** Enter: satırın girintisini sürdürür; açılış ayracından sonra bir kademe girinti ekler. */
|
|
87
|
+
function enterEdit(state, unit, language) {
|
|
88
|
+
const { value, start, end } = state;
|
|
89
|
+
const { start: lineStart } = lineBounds(value, start);
|
|
90
|
+
const beforeCaret = value.slice(lineStart, start);
|
|
91
|
+
const lead = /^[ \t]*/.exec(beforeCaret)?.[0] ?? "";
|
|
92
|
+
const prev = beforeCaret.trimEnd().slice(-1);
|
|
93
|
+
const next = value[end];
|
|
94
|
+
let insert = `\n${lead}`;
|
|
95
|
+
let caret = start + insert.length;
|
|
96
|
+
if (language !== "plain" && prev in CLOSERS) {
|
|
97
|
+
const inner = `\n${lead}${unit.text}`;
|
|
98
|
+
if (next === CLOSERS[prev]) {
|
|
99
|
+
insert = `${inner}\n${lead}`;
|
|
100
|
+
caret = start + inner.length;
|
|
101
|
+
} else {
|
|
102
|
+
insert = inner;
|
|
103
|
+
caret = start + insert.length;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
from: start,
|
|
108
|
+
to: end,
|
|
109
|
+
insert,
|
|
110
|
+
selectStart: caret,
|
|
111
|
+
selectEnd: caret
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Geri silme: girintide bir sekme durağına, boş ikili işaretin ikisini birden siler. */
|
|
115
|
+
function backspaceEdit(state, unit, autoClose) {
|
|
116
|
+
const { value, start, end } = state;
|
|
117
|
+
if (start !== end || start === 0) return null;
|
|
118
|
+
const { start: lineStart } = lineBounds(value, start);
|
|
119
|
+
const before = value.slice(lineStart, start);
|
|
120
|
+
if (unit.text !== " " && before.length > 0 && /^ +$/.test(before)) {
|
|
121
|
+
const from = start - (before.length % unit.size || unit.size);
|
|
122
|
+
return {
|
|
123
|
+
from,
|
|
124
|
+
to: start,
|
|
125
|
+
insert: "",
|
|
126
|
+
selectStart: from,
|
|
127
|
+
selectEnd: from
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (autoClose) {
|
|
131
|
+
const open = value[start - 1];
|
|
132
|
+
const close = value[start];
|
|
133
|
+
if (open in CLOSERS && close === CLOSERS[open] || QUOTES.has(open) && close === open) return {
|
|
134
|
+
from: start - 1,
|
|
135
|
+
to: start + 1,
|
|
136
|
+
insert: "",
|
|
137
|
+
selectStart: start - 1,
|
|
138
|
+
selectEnd: start - 1
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
/** Karakter yazılırken: ikili işaret ekleme, seçimi sarma, kapanışın üzerinden geçme. */
|
|
144
|
+
function typeEdit(state, char) {
|
|
145
|
+
const { value, start, end } = state;
|
|
146
|
+
const closeFor = CLOSERS[char];
|
|
147
|
+
const isQuote = QUOTES.has(char);
|
|
148
|
+
if (start !== end) {
|
|
149
|
+
if (!closeFor && !isQuote) return null;
|
|
150
|
+
const close = closeFor ?? char;
|
|
151
|
+
const inner = value.slice(start, end);
|
|
152
|
+
return {
|
|
153
|
+
from: start,
|
|
154
|
+
to: end,
|
|
155
|
+
insert: char + inner + close,
|
|
156
|
+
selectStart: start + 1,
|
|
157
|
+
selectEnd: start + 1 + inner.length
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const next = value[start];
|
|
161
|
+
if ((CLOSER_SET.has(char) || isQuote) && next === char) return {
|
|
162
|
+
from: start,
|
|
163
|
+
to: start,
|
|
164
|
+
insert: "",
|
|
165
|
+
selectStart: start + 1,
|
|
166
|
+
selectEnd: start + 1
|
|
167
|
+
};
|
|
168
|
+
const prev = value[start - 1];
|
|
169
|
+
if (closeFor) {
|
|
170
|
+
if (next !== void 0 && !/\s/.test(next) && !CLOSER_SET.has(next) && next !== ";") return null;
|
|
171
|
+
return {
|
|
172
|
+
from: start,
|
|
173
|
+
to: start,
|
|
174
|
+
insert: char + closeFor,
|
|
175
|
+
selectStart: start + 1,
|
|
176
|
+
selectEnd: start + 1
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (isQuote) {
|
|
180
|
+
if (isWord(prev) || isWord(next) || prev === char) return null;
|
|
181
|
+
return {
|
|
182
|
+
from: start,
|
|
183
|
+
to: start,
|
|
184
|
+
insert: char + char,
|
|
185
|
+
selectStart: start + 1,
|
|
186
|
+
selectEnd: start + 1
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
/** Dile göre satır yorumu: ön ek ve (varsa) kapanış işareti; yorum yoksa `null`. */
|
|
192
|
+
function commentSyntax(language) {
|
|
193
|
+
switch (language) {
|
|
194
|
+
case "javascript":
|
|
195
|
+
case "typescript": return { prefix: "//" };
|
|
196
|
+
case "sql": return { prefix: "--" };
|
|
197
|
+
case "css": return {
|
|
198
|
+
prefix: "/*",
|
|
199
|
+
suffix: "*/"
|
|
200
|
+
};
|
|
201
|
+
case "html": return {
|
|
202
|
+
prefix: "<!--",
|
|
203
|
+
suffix: "-->"
|
|
204
|
+
};
|
|
205
|
+
default: return null;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** Ctrl+/: seçili satırlara yorum ekler; hepsi yorumluysa kaldırır. */
|
|
209
|
+
function commentEdit(state, language) {
|
|
210
|
+
const syntax = commentSyntax(language);
|
|
211
|
+
if (!syntax) return null;
|
|
212
|
+
const { from, to } = lineRange(state);
|
|
213
|
+
const lines = state.value.slice(from, to).split("\n");
|
|
214
|
+
const filled = lines.filter((l) => l.trim() !== "");
|
|
215
|
+
if (filled.length === 0) return null;
|
|
216
|
+
const { prefix, suffix } = syntax;
|
|
217
|
+
const commented = (l) => {
|
|
218
|
+
const t = l.trim();
|
|
219
|
+
return t.startsWith(prefix) && (!suffix || t.endsWith(suffix));
|
|
220
|
+
};
|
|
221
|
+
const remove = filled.every(commented);
|
|
222
|
+
const minIndent = Math.min(...filled.map((l) => (/^[ \t]*/.exec(l)?.[0] ?? "").length));
|
|
223
|
+
const insert = lines.map((l) => {
|
|
224
|
+
if (l.trim() === "") return l;
|
|
225
|
+
if (remove) {
|
|
226
|
+
const lead = (/^[ \t]*/.exec(l)?.[0] ?? "").length;
|
|
227
|
+
let body = l.slice(lead + prefix.length);
|
|
228
|
+
if (body.startsWith(" ")) body = body.slice(1);
|
|
229
|
+
if (suffix) {
|
|
230
|
+
body = body.trimEnd();
|
|
231
|
+
body = body.slice(0, body.length - suffix.length).replace(/ $/, "");
|
|
232
|
+
}
|
|
233
|
+
return l.slice(0, lead) + body;
|
|
234
|
+
}
|
|
235
|
+
const body = l.slice(minIndent);
|
|
236
|
+
return `${l.slice(0, minIndent)}${prefix} ${body}${suffix ? ` ${suffix}` : ""}`;
|
|
237
|
+
}).join("\n");
|
|
238
|
+
return {
|
|
239
|
+
from,
|
|
240
|
+
to,
|
|
241
|
+
insert,
|
|
242
|
+
selectStart: from,
|
|
243
|
+
selectEnd: from + insert.length
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
/** Alt+↑ / Alt+↓: seçili satırları bir satır yukarı ya da aşağı taşır. */
|
|
247
|
+
function moveLinesEdit(state, direction) {
|
|
248
|
+
const { value } = state;
|
|
249
|
+
const { from, to } = lineRange(state);
|
|
250
|
+
if (direction === -1 && from === 0) return null;
|
|
251
|
+
if (direction === 1 && to >= value.length) return null;
|
|
252
|
+
const block = value.slice(from, to);
|
|
253
|
+
if (direction === -1) {
|
|
254
|
+
const prevStart = lineBounds(value, from - 1).start;
|
|
255
|
+
const prevLine = value.slice(prevStart, from - 1);
|
|
256
|
+
const shift = -(prevLine.length + 1);
|
|
257
|
+
return {
|
|
258
|
+
from: prevStart,
|
|
259
|
+
to,
|
|
260
|
+
insert: `${block}\n${prevLine}`,
|
|
261
|
+
selectStart: state.start + shift,
|
|
262
|
+
selectEnd: state.end + shift
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
const nextEnd = lineBounds(value, to + 1).end;
|
|
266
|
+
const nextLine = value.slice(to + 1, nextEnd);
|
|
267
|
+
const shift = nextLine.length + 1;
|
|
268
|
+
return {
|
|
269
|
+
from,
|
|
270
|
+
to: nextEnd,
|
|
271
|
+
insert: `${nextLine}\n${block}`,
|
|
272
|
+
selectStart: state.start + shift,
|
|
273
|
+
selectEnd: state.end + shift
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/** İmleç konumu: 1 tabanlı satır ve sütun. */
|
|
277
|
+
function caretPosition(value, pos) {
|
|
278
|
+
const before = value.slice(0, pos);
|
|
279
|
+
return {
|
|
280
|
+
line: before.split("\n").length,
|
|
281
|
+
column: pos - (before.lastIndexOf("\n") + 1) + 1
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export { backspaceEdit, caretPosition, commentEdit, commentSyntax, enterEdit, indentEdit, indentUnit, moveLinesEdit, typeEdit };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// src/editor/CodeEditor/highlight.ts
|
|
2
|
+
/** Bu uzunluktan büyük metin renklendirilmez (yazma akıcı kalsın). */
|
|
3
|
+
const HIGHLIGHT_LIMIT = 1e5;
|
|
4
|
+
const words = (s) => new Set(s.split(" "));
|
|
5
|
+
const JS_KEYWORDS = words("as async await break case catch class const continue debugger default delete do else enum export extends finally for from function get if implements import in instanceof interface let new of package private protected public return set static super switch this throw try type typeof var void while with yield abstract declare readonly namespace keyof infer satisfies");
|
|
6
|
+
const JS_LITERALS = words("true false null undefined NaN Infinity");
|
|
7
|
+
const SQL_KEYWORDS = words("select from where and or not in is null like between join inner left right outer full cross on as group by order having limit offset insert into values update set delete create table alter drop index view primary key foreign references unique default distinct union all case when then else end exists asc desc count sum avg min max with returning");
|
|
8
|
+
const rule = (type, source) => ({
|
|
9
|
+
type,
|
|
10
|
+
re: new RegExp(source, "y")
|
|
11
|
+
});
|
|
12
|
+
const NUMBER = "0[xX][\\da-fA-F_]+n?|0[bB][01_]+n?|\\d[\\d_]*(?:\\.\\d+)?(?:[eE][+-]?\\d+)?n?|\\.\\d+(?:[eE][+-]?\\d+)?";
|
|
13
|
+
const DQ = "\"(?:[^\"\\\\\\n]|\\\\.)*\"?";
|
|
14
|
+
const SQ = "'(?:[^'\\\\\\n]|\\\\.)*'?";
|
|
15
|
+
const BLOCK_COMMENT = "/\\*[\\s\\S]*?(?:\\*/|$)";
|
|
16
|
+
/** Verilen konumdan başlayarak sıradaki kuralı uygular; hiçbiri uymazsa tek karakter düz kalır. */
|
|
17
|
+
function scan(text, rules, pos) {
|
|
18
|
+
for (const r of rules) {
|
|
19
|
+
r.re.lastIndex = pos;
|
|
20
|
+
const m = r.re.exec(text);
|
|
21
|
+
if (m && m[0].length > 0) return {
|
|
22
|
+
type: r.type,
|
|
23
|
+
text: m[0]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function push(out, token) {
|
|
29
|
+
const last = out.at(-1);
|
|
30
|
+
if (last && last.type === token.type && token.type === "plain") last.text += token.text;
|
|
31
|
+
else out.push(token);
|
|
32
|
+
}
|
|
33
|
+
function run(text, rules, classify) {
|
|
34
|
+
const out = [];
|
|
35
|
+
let pos = 0;
|
|
36
|
+
while (pos < text.length) {
|
|
37
|
+
let token = scan(text, rules, pos);
|
|
38
|
+
if (!token) token = {
|
|
39
|
+
type: "plain",
|
|
40
|
+
text: text.slice(pos, pos + 1)
|
|
41
|
+
};
|
|
42
|
+
if (classify) token = classify(token, text.slice(pos + token.text.length, pos + token.text.length + 64));
|
|
43
|
+
push(out, token);
|
|
44
|
+
pos += token.text.length;
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
const JS_RULES = [
|
|
49
|
+
rule("comment", `//[^\\n]*|${BLOCK_COMMENT}`),
|
|
50
|
+
rule("string", `${DQ}|${SQ}|\`(?:[^\`\\\\]|\\\\[\\s\\S])*\`?`),
|
|
51
|
+
rule("number", NUMBER),
|
|
52
|
+
rule("plain", "[A-Za-z_$][\\w$]*"),
|
|
53
|
+
rule("punct", "[{}()[\\];,.]|[+\\-*/%=<>!&|^~?:]+"),
|
|
54
|
+
rule("plain", "\\s+")
|
|
55
|
+
];
|
|
56
|
+
function tokenizeJs(text) {
|
|
57
|
+
return run(text, JS_RULES, (t, rest) => {
|
|
58
|
+
if (t.type !== "plain" || !/^[A-Za-z_$]/.test(t.text)) return t;
|
|
59
|
+
if (JS_KEYWORDS.has(t.text)) return {
|
|
60
|
+
type: "keyword",
|
|
61
|
+
text: t.text
|
|
62
|
+
};
|
|
63
|
+
if (JS_LITERALS.has(t.text)) return {
|
|
64
|
+
type: "literal",
|
|
65
|
+
text: t.text
|
|
66
|
+
};
|
|
67
|
+
if (/^\s*\(/.test(rest)) return {
|
|
68
|
+
type: "function",
|
|
69
|
+
text: t.text
|
|
70
|
+
};
|
|
71
|
+
return t;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const JSON_RULES = [
|
|
75
|
+
rule("string", DQ),
|
|
76
|
+
rule("number", "-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?"),
|
|
77
|
+
rule("plain", "[A-Za-z_]+"),
|
|
78
|
+
rule("punct", "[{}[\\]:,]"),
|
|
79
|
+
rule("plain", "\\s+")
|
|
80
|
+
];
|
|
81
|
+
function tokenizeJson(text) {
|
|
82
|
+
return run(text, JSON_RULES, (t, rest) => {
|
|
83
|
+
if (t.type === "string" && /^\s*:/.test(rest)) return {
|
|
84
|
+
type: "property",
|
|
85
|
+
text: t.text
|
|
86
|
+
};
|
|
87
|
+
if (t.type === "plain" && /^(true|false|null)$/.test(t.text)) return {
|
|
88
|
+
type: "literal",
|
|
89
|
+
text: t.text
|
|
90
|
+
};
|
|
91
|
+
return t;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const CSS_RULES = [
|
|
95
|
+
rule("comment", BLOCK_COMMENT),
|
|
96
|
+
rule("string", `${DQ}|${SQ}`),
|
|
97
|
+
rule("keyword", "@[\\w-]+"),
|
|
98
|
+
rule("number", "#[\\da-fA-F]{3,8}\\b"),
|
|
99
|
+
rule("number", "-?(?:\\d+\\.?\\d*|\\.\\d+)(?:[a-zA-Z%]+)?"),
|
|
100
|
+
rule("plain", "-{0,2}[A-Za-z_][\\w-]*"),
|
|
101
|
+
rule("tag", "[.#]-?[A-Za-z_][\\w-]*"),
|
|
102
|
+
rule("punct", "[{}()[\\];:,>+~*=]"),
|
|
103
|
+
rule("plain", "\\s+")
|
|
104
|
+
];
|
|
105
|
+
function tokenizeCss(text) {
|
|
106
|
+
let depth = 0;
|
|
107
|
+
return run(text, CSS_RULES, (t, rest) => {
|
|
108
|
+
if (t.type === "punct") {
|
|
109
|
+
if (t.text === "{") depth += 1;
|
|
110
|
+
else if (t.text === "}") depth = Math.max(0, depth - 1);
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
if (t.type === "plain" && /^-{0,2}[A-Za-z_]/.test(t.text)) {
|
|
114
|
+
if (depth > 0 && /^\s*:/.test(rest)) return {
|
|
115
|
+
type: "property",
|
|
116
|
+
text: t.text
|
|
117
|
+
};
|
|
118
|
+
if (depth === 0) return {
|
|
119
|
+
type: "tag",
|
|
120
|
+
text: t.text
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return t;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const HTML_OUTSIDE = [
|
|
127
|
+
rule("comment", "<!--[\\s\\S]*?(?:-->|$)"),
|
|
128
|
+
rule("tag", "<!?[A-Za-z][\\w:-]*|</[A-Za-z][\\w:-]*"),
|
|
129
|
+
rule("plain", "[^<]+|<")
|
|
130
|
+
];
|
|
131
|
+
const HTML_INSIDE = [
|
|
132
|
+
rule("punct", "/?>"),
|
|
133
|
+
rule("string", `${DQ}|${SQ}`),
|
|
134
|
+
rule("punct", "="),
|
|
135
|
+
rule("attr", "[^\\s=/>\"']+"),
|
|
136
|
+
rule("plain", "\\s+")
|
|
137
|
+
];
|
|
138
|
+
function tokenizeHtml(text) {
|
|
139
|
+
const out = [];
|
|
140
|
+
let pos = 0;
|
|
141
|
+
let inside = false;
|
|
142
|
+
while (pos < text.length) {
|
|
143
|
+
const token = scan(text, inside ? HTML_INSIDE : HTML_OUTSIDE, pos) ?? {
|
|
144
|
+
type: "plain",
|
|
145
|
+
text: text.slice(pos, pos + 1)
|
|
146
|
+
};
|
|
147
|
+
if (token.type === "tag") inside = true;
|
|
148
|
+
else if (inside && token.type === "punct" && token.text.endsWith(">")) inside = false;
|
|
149
|
+
push(out, token);
|
|
150
|
+
pos += token.text.length;
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
const SQL_RULES = [
|
|
155
|
+
rule("comment", `--[^\\n]*|${BLOCK_COMMENT}`),
|
|
156
|
+
rule("string", SQ),
|
|
157
|
+
rule("number", NUMBER),
|
|
158
|
+
rule("plain", "[A-Za-z_][\\w]*"),
|
|
159
|
+
rule("punct", "[();,.*=<>+\\-/%]"),
|
|
160
|
+
rule("plain", "\\s+")
|
|
161
|
+
];
|
|
162
|
+
function tokenizeSql(text) {
|
|
163
|
+
return run(text, SQL_RULES, (t) => t.type === "plain" && SQL_KEYWORDS.has(t.text.toLowerCase()) ? {
|
|
164
|
+
type: "keyword",
|
|
165
|
+
text: t.text
|
|
166
|
+
} : t);
|
|
167
|
+
}
|
|
168
|
+
/** Metni dilin kurallarına göre parçalar. */
|
|
169
|
+
function tokenize(text, language) {
|
|
170
|
+
if (language === "plain" || text.length > 1e5) return [{
|
|
171
|
+
type: "plain",
|
|
172
|
+
text
|
|
173
|
+
}];
|
|
174
|
+
switch (language) {
|
|
175
|
+
case "javascript":
|
|
176
|
+
case "typescript": return tokenizeJs(text);
|
|
177
|
+
case "json": return tokenizeJson(text);
|
|
178
|
+
case "css": return tokenizeCss(text);
|
|
179
|
+
case "html": return tokenizeHtml(text);
|
|
180
|
+
case "sql": return tokenizeSql(text);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Parçaları satırlara böler (yeni satır karakteri bir parçanın ortasındaysa parça bölünür). */
|
|
184
|
+
function splitLines(tokens) {
|
|
185
|
+
const lines = [[]];
|
|
186
|
+
for (const token of tokens) token.text.split("\n").forEach((part, i) => {
|
|
187
|
+
if (i > 0) lines.push([]);
|
|
188
|
+
if (part) lines[lines.length - 1].push({
|
|
189
|
+
type: token.type,
|
|
190
|
+
text: part
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
return lines;
|
|
194
|
+
}
|
|
195
|
+
export { HIGHLIGHT_LIMIT, splitLines, tokenize };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@layer sti.reset, sti.tokens, sti.base, sti.components, sti.variants, sti.utilities;
|
|
2
|
+
@layer sti.components {
|
|
3
|
+
.sti-JsonEditor-valid-fca24 {
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--sti-space-1);
|
|
6
|
+
color: var(--sti-fg-success);
|
|
7
|
+
font-weight: var(--sti-font-weight-medium);
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { JsonError, JsonErrorCode } from "./json.js";
|
|
2
|
+
import { KeyboardEvent, ReactNode, Ref } from "react";
|
|
3
|
+
/** Değişimle birlikte verilen doğrulama sonucu. */
|
|
4
|
+
export interface JsonInfo {
|
|
5
|
+
/** Metin geçerli bir JSON belgesi mi (boş metin geçersizdir). */
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
error?: JsonError;
|
|
8
|
+
}
|
|
9
|
+
export interface JsonEditorProps {
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
hideLabel?: boolean;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onChange?: (value: string, info: JsonInfo) => void;
|
|
16
|
+
/** Biçimlendirmede girinti (boşluk sayısı). Varsayılan 2. */
|
|
17
|
+
indent?: number;
|
|
18
|
+
/** Biçimlendir ve Sıkıştır düğmeleri. Varsayılan açık. */
|
|
19
|
+
showActions?: boolean;
|
|
20
|
+
/** Hata metni, yazmaya ara verilince ya da alandan çıkınca gösterilir; bu süre (ms). */
|
|
21
|
+
errorDelay?: number;
|
|
22
|
+
minRows?: number;
|
|
23
|
+
maxRows?: number;
|
|
24
|
+
lineNumbers?: boolean;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
isRequired?: boolean;
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
isReadOnly?: boolean;
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
onKeyDown?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
32
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
|
33
|
+
className?: string;
|
|
34
|
+
id?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* JSON düzenleyici: `CodeEditor` üzerine katı JSON denetimi. Hata satır ve sütunla bildirilir,
|
|
38
|
+
* hatalı satır işaretlenir, "Hataya git" imleci oraya taşır; Biçimlendir ve Sıkıştır sayıları ve
|
|
39
|
+
* dizeleri yazıldığı gibi korur. Hata metni her tuşta değil, yazmaya ara verilince ya da alandan
|
|
40
|
+
* çıkınca belirir (ekran okuyucu sürekli kesilmez); geçerli olunca hemen kaybolur.
|
|
41
|
+
*/
|
|
42
|
+
export declare function JsonEditor({ value, defaultValue, onChange, indent, showActions, errorDelay, isReadOnly, isDisabled, inputRef, ...rest }: JsonEditorProps): import("react").JSX.Element;
|
|
43
|
+
export type { JsonError, JsonErrorCode };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useFormatter, useMessages } from "../../provider/UIProvider.js";
|
|
3
|
+
import { template } from "../../text/text.js";
|
|
4
|
+
import { CheckCircleIcon } from "../../icons/generated/CheckCircleIcon.js";
|
|
5
|
+
import { Button } from "../../components/Button/Button.js";
|
|
6
|
+
import { applyEdit, revealOffset } from "../_shared/textEdit.js";
|
|
7
|
+
import { CodeEditor } from "../CodeEditor/CodeEditor.js";
|
|
8
|
+
import JsonEditor_module_default from "./JsonEditor.module.js";
|
|
9
|
+
import { checkJson, formatJson } from "./json.js";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
+
// src/editor/JsonEditor/JsonEditor.tsx
|
|
13
|
+
const MESSAGE_KEY = {
|
|
14
|
+
unexpectedChar: "jsonErrorUnexpectedChar",
|
|
15
|
+
unexpectedEnd: "jsonErrorUnexpectedEnd",
|
|
16
|
+
expectedValue: "jsonErrorExpectedValue",
|
|
17
|
+
expectedKey: "jsonErrorExpectedKey",
|
|
18
|
+
expectedColon: "jsonErrorExpectedColon",
|
|
19
|
+
expectedComma: "jsonErrorExpectedComma",
|
|
20
|
+
trailingComma: "jsonErrorTrailingComma",
|
|
21
|
+
badString: "jsonErrorBadString",
|
|
22
|
+
badNumber: "jsonErrorBadNumber",
|
|
23
|
+
trailing: "jsonErrorTrailing",
|
|
24
|
+
tooDeep: "jsonErrorTooDeep"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* JSON düzenleyici: `CodeEditor` üzerine katı JSON denetimi. Hata satır ve sütunla bildirilir,
|
|
28
|
+
* hatalı satır işaretlenir, "Hataya git" imleci oraya taşır; Biçimlendir ve Sıkıştır sayıları ve
|
|
29
|
+
* dizeleri yazıldığı gibi korur. Hata metni her tuşta değil, yazmaya ara verilince ya da alandan
|
|
30
|
+
* çıkınca belirir (ekran okuyucu sürekli kesilmez); geçerli olunca hemen kaybolur.
|
|
31
|
+
*/
|
|
32
|
+
function JsonEditor({ value, defaultValue, onChange, indent = 2, showActions = true, errorDelay = 450, isReadOnly, isDisabled, inputRef, ...rest }) {
|
|
33
|
+
const t = useMessages();
|
|
34
|
+
const f = useFormatter();
|
|
35
|
+
const [inner, setInner] = useState(defaultValue ?? "");
|
|
36
|
+
const text = value ?? inner;
|
|
37
|
+
const area = useRef(null);
|
|
38
|
+
const check = useMemo(() => checkJson(text), [text]);
|
|
39
|
+
const [settled, setSettled] = useState(text);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const timer = setTimeout(() => setSettled(text), errorDelay);
|
|
42
|
+
return () => clearTimeout(timer);
|
|
43
|
+
}, [text, errorDelay]);
|
|
44
|
+
const setRef = useCallback((el) => {
|
|
45
|
+
area.current = el;
|
|
46
|
+
if (typeof inputRef === "function") inputRef(el);
|
|
47
|
+
else if (inputRef) inputRef.current = el;
|
|
48
|
+
}, [inputRef]);
|
|
49
|
+
const empty = text.trim() === "";
|
|
50
|
+
const shown = !check.ok && settled === text && !empty ? check.error : null;
|
|
51
|
+
const markers = shown ? [{
|
|
52
|
+
line: shown.line,
|
|
53
|
+
tone: "danger"
|
|
54
|
+
}] : [];
|
|
55
|
+
const messageOf = (error) => {
|
|
56
|
+
if (error.code === "empty") return t.jsonEditorEmpty;
|
|
57
|
+
const message = template(t[MESSAGE_KEY[error.code]], { char: error.char ?? "" });
|
|
58
|
+
return template(t.jsonEditorErrorAt, {
|
|
59
|
+
line: f.number(error.line),
|
|
60
|
+
column: f.number(error.column),
|
|
61
|
+
message
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const change = (next) => {
|
|
65
|
+
if (value === void 0) setInner(next);
|
|
66
|
+
const c = checkJson(next);
|
|
67
|
+
onChange?.(next, c.ok ? { isValid: true } : {
|
|
68
|
+
isValid: false,
|
|
69
|
+
error: c.error
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const reformat = (width) => {
|
|
73
|
+
const el = area.current;
|
|
74
|
+
const r = formatJson(text, width);
|
|
75
|
+
if (!el || !r.ok || r.text === text) return;
|
|
76
|
+
applyEdit(el, {
|
|
77
|
+
from: 0,
|
|
78
|
+
to: text.length,
|
|
79
|
+
insert: r.text,
|
|
80
|
+
selectStart: 0,
|
|
81
|
+
selectEnd: 0
|
|
82
|
+
});
|
|
83
|
+
el.focus();
|
|
84
|
+
};
|
|
85
|
+
const goToError = () => {
|
|
86
|
+
const el = area.current;
|
|
87
|
+
if (!el || !shown) return;
|
|
88
|
+
el.focus();
|
|
89
|
+
const end = Math.min(el.value.length, shown.offset + 1);
|
|
90
|
+
el.setSelectionRange(shown.offset, end);
|
|
91
|
+
revealOffset(el, shown.offset);
|
|
92
|
+
};
|
|
93
|
+
const canFormat = check.ok && !isReadOnly && !isDisabled;
|
|
94
|
+
const actions = showActions ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
size: "sm",
|
|
97
|
+
isDisabled: !canFormat,
|
|
98
|
+
onPress: () => reformat(indent),
|
|
99
|
+
children: t.jsonEditorFormat
|
|
100
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
101
|
+
variant: "ghost",
|
|
102
|
+
size: "sm",
|
|
103
|
+
isDisabled: !canFormat,
|
|
104
|
+
onPress: () => reformat(0),
|
|
105
|
+
children: t.jsonEditorMinify
|
|
106
|
+
})] }) : void 0;
|
|
107
|
+
const status = shown ? /* @__PURE__ */ jsx(Button, {
|
|
108
|
+
variant: "ghost",
|
|
109
|
+
size: "sm",
|
|
110
|
+
onPress: goToError,
|
|
111
|
+
children: t.jsonEditorGoToError
|
|
112
|
+
}) : check.ok ? /* @__PURE__ */ jsxs("span", {
|
|
113
|
+
className: JsonEditor_module_default.valid,
|
|
114
|
+
children: [/* @__PURE__ */ jsx(CheckCircleIcon, {}), t.jsonEditorValid]
|
|
115
|
+
}) : void 0;
|
|
116
|
+
return /* @__PURE__ */ jsx(CodeEditor, {
|
|
117
|
+
...rest,
|
|
118
|
+
language: "json",
|
|
119
|
+
languageLabel: "JSON",
|
|
120
|
+
value: text,
|
|
121
|
+
onChange: change,
|
|
122
|
+
inputRef: setRef,
|
|
123
|
+
isReadOnly,
|
|
124
|
+
isDisabled,
|
|
125
|
+
isInvalid: shown !== null,
|
|
126
|
+
errorMessage: shown ? messageOf(shown) : void 0,
|
|
127
|
+
markers,
|
|
128
|
+
headerActions: actions,
|
|
129
|
+
footerStatus: status,
|
|
130
|
+
onBlur: () => setSettled(text)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export { JsonEditor };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { JsonError, JsonErrorCode, checkJson, formatJson, parseJson } from "./json.js";
|
|
2
|
+
import { JsonEditor, JsonEditorProps, JsonInfo } from "./JsonEditor.js";
|
|
3
|
+
export { JsonEditor, JsonEditorProps, type JsonError, type JsonErrorCode, JsonInfo, checkJson, formatJson, parseJson };
|