@stisocial/ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -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/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 +110 -0
- package/dist/id/AccountMenu/AccountMenu.d.ts +45 -0
- package/dist/id/AccountMenu/AccountMenu.js +98 -0
- package/dist/id/AccountMenu/AccountMenu.module.js +14 -0
- package/dist/id/AccountMenu/index.d.ts +2 -0
- package/dist/id/AppSwitcher/AppSwitcher.css +109 -0
- package/dist/id/AppSwitcher/AppSwitcher.d.ts +31 -0
- package/dist/id/AppSwitcher/AppSwitcher.js +88 -0
- package/dist/id/AppSwitcher/AppSwitcher.module.js +11 -0
- package/dist/id/AppSwitcher/index.d.ts +2 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.css +110 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.d.ts +37 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.js +153 -0
- package/dist/id/OrgSwitcher/OrgSwitcher.module.js +12 -0
- package/dist/id/OrgSwitcher/index.d.ts +2 -0
- package/dist/id/PermissionGate/PermissionGate.css +57 -0
- package/dist/id/PermissionGate/PermissionGate.d.ts +30 -0
- package/dist/id/PermissionGate/PermissionGate.js +51 -0
- package/dist/id/PermissionGate/PermissionGate.module.js +10 -0
- package/dist/id/PermissionGate/index.d.ts +2 -0
- package/dist/id/SignInButton/SignInButton.d.ts +20 -0
- package/dist/id/SignInButton/SignInButton.js +34 -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/index.d.ts +10 -0
- package/dist/id/index.js +6 -0
- package/dist/index.d.ts +26 -4
- package/dist/index.js +14 -3
- 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 +481 -0
- package/dist/messages/messages.js +964 -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 +24433 -14420
- package/package.json +45 -1
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLocale, useMessages } from "../../provider/UIProvider.js";
|
|
3
|
+
import { template } from "../../text/text.js";
|
|
4
|
+
import { FieldDescription, FieldErrorText, FieldLabel, fieldStyles } from "../../components/Field/Field.js";
|
|
5
|
+
import { IconButton } from "../../components/IconButton/IconButton.js";
|
|
6
|
+
import { VisuallyHidden } from "../../components/VisuallyHidden/VisuallyHidden.js";
|
|
7
|
+
import { CharacterCounter, characterCount } from "../../components/CharacterCounter/CharacterCounter.js";
|
|
8
|
+
import { CodeIcon } from "../../icons/generated/CodeIcon.js";
|
|
9
|
+
import { LinkIcon } from "../../icons/generated/LinkIcon.js";
|
|
10
|
+
import { RedoIcon } from "../../icons/generated/RedoIcon.js";
|
|
11
|
+
import { UndoIcon } from "../../icons/generated/UndoIcon.js";
|
|
12
|
+
import { Markdown } from "../../components/Markdown/Markdown.js";
|
|
13
|
+
import { ToggleButton as ToggleButton$1 } from "../../components/ToggleButton/ToggleButton.js";
|
|
14
|
+
import { Tab as Tab$1, TabList as TabList$1, TabPanel as TabPanel$1, Tabs as Tabs$1 } from "../../components/Tabs/Tabs.js";
|
|
15
|
+
import { Toolbar as Toolbar$1, ToolbarGroup, ToolbarSeparator } from "../../components/Toolbar/Toolbar.js";
|
|
16
|
+
import { applyEdit } from "../_shared/textEdit.js";
|
|
17
|
+
import { BoldIcon, BulletListIcon, CodeBlockIcon, HeadingThreeIcon, HeadingTwoIcon, ItalicIcon, NumberedListIcon, QuoteIcon, RuleIcon, StrikethroughIcon, TaskListIcon } from "../_shared/FormatIcons.js";
|
|
18
|
+
import { codeBlockEdit, continueListEdit, isBlockActive, isInlineActive, linkEdit, ruleEdit, toggleBlock, toggleInline } from "./commands.js";
|
|
19
|
+
import MarkdownEditor_module_default from "./MarkdownEditor.module.js";
|
|
20
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
22
|
+
import { TextArea, TextField } from "react-aria-components";
|
|
23
|
+
// src/editor/MarkdownEditor/MarkdownEditor.tsx
|
|
24
|
+
const useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
25
|
+
const INLINE_MARKS = [
|
|
26
|
+
"bold",
|
|
27
|
+
"italic",
|
|
28
|
+
"strike",
|
|
29
|
+
"code"
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Markdown düzenleyici: çok satırlı metin alanı, biçimlendirme çubuğu ve güvenli önizleme (HTML
|
|
33
|
+
* üretmez; `Markdown` bileşeniyle aynı ayrıştırıcı). Değer düz Markdown metnidir. Kısayollar:
|
|
34
|
+
* Ctrl/⌘+B kalın, +I italik, +K bağlantı; Enter liste, görev ve alıntıyı sürdürür. Biçimlendirme
|
|
35
|
+
* tarayıcının geri alma yığınına yazılır: Ctrl+Z her komutu geri alır.
|
|
36
|
+
*/
|
|
37
|
+
function MarkdownEditor({ label, hideLabel, description, errorMessage, value, defaultValue, onChange, view, defaultView = "write", onViewChange, layout = "tabs", toolbar = true, minRows = 6, maxRows = 20, maxLength, allowImages = false, placeholder, name, isRequired, isDisabled, isReadOnly, isInvalid, autoFocus, onKeyDown, inputRef, className, id }) {
|
|
38
|
+
const t = useMessages();
|
|
39
|
+
const locale = useLocale();
|
|
40
|
+
const [inner, setInner] = useState(defaultValue ?? "");
|
|
41
|
+
const text = value ?? inner;
|
|
42
|
+
const [innerView, setInnerView] = useState(defaultView);
|
|
43
|
+
const currentView = layout === "split" ? "write" : view ?? innerView;
|
|
44
|
+
const [sel, setSel] = useState({
|
|
45
|
+
start: 0,
|
|
46
|
+
end: 0
|
|
47
|
+
});
|
|
48
|
+
const area = useRef(null);
|
|
49
|
+
const frame = useRef(null);
|
|
50
|
+
const editable = !isDisabled && !isReadOnly;
|
|
51
|
+
const count = characterCount(text, locale);
|
|
52
|
+
const setRef = useCallback((el) => {
|
|
53
|
+
area.current = el;
|
|
54
|
+
if (typeof inputRef === "function") inputRef(el);
|
|
55
|
+
else if (inputRef) inputRef.current = el;
|
|
56
|
+
}, [inputRef]);
|
|
57
|
+
const readSelection = useCallback(() => {
|
|
58
|
+
const el = area.current;
|
|
59
|
+
if (!el) return;
|
|
60
|
+
const next = {
|
|
61
|
+
start: el.selectionStart ?? 0,
|
|
62
|
+
end: el.selectionEnd ?? 0
|
|
63
|
+
};
|
|
64
|
+
setSel((prev) => prev.start === next.start && prev.end === next.end ? prev : next);
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const el = area.current;
|
|
68
|
+
if (!el) return;
|
|
69
|
+
const events = [
|
|
70
|
+
"keyup",
|
|
71
|
+
"mouseup",
|
|
72
|
+
"select",
|
|
73
|
+
"touchend"
|
|
74
|
+
];
|
|
75
|
+
for (const e of events) el.addEventListener(e, readSelection);
|
|
76
|
+
return () => {
|
|
77
|
+
for (const e of events) el.removeEventListener(e, readSelection);
|
|
78
|
+
};
|
|
79
|
+
}, [readSelection]);
|
|
80
|
+
useIsoLayoutEffect(readSelection, [text, readSelection]);
|
|
81
|
+
useIsoLayoutEffect(() => {
|
|
82
|
+
const el = area.current;
|
|
83
|
+
if (!el || currentView !== "write") return;
|
|
84
|
+
el.style.removeProperty("height");
|
|
85
|
+
const cs = getComputedStyle(el);
|
|
86
|
+
const line = Number.parseFloat(cs.lineHeight);
|
|
87
|
+
const pad = Number.parseFloat(cs.paddingTop) + Number.parseFloat(cs.paddingBottom);
|
|
88
|
+
const min = minRows * line + pad;
|
|
89
|
+
const max = Math.max(maxRows, minRows) * line + pad;
|
|
90
|
+
const needed = el.scrollHeight;
|
|
91
|
+
el.style.setProperty("height", `${Math.min(Math.max(needed, min), max)}px`);
|
|
92
|
+
el.style.setProperty("overflow-y", needed > max ? "auto" : "hidden");
|
|
93
|
+
frame.current?.style.setProperty("--sti-md-min", `${Math.min(Math.max(needed, min), max)}px`);
|
|
94
|
+
}, [
|
|
95
|
+
text,
|
|
96
|
+
currentView,
|
|
97
|
+
minRows,
|
|
98
|
+
maxRows
|
|
99
|
+
]);
|
|
100
|
+
const state = () => ({
|
|
101
|
+
value: text,
|
|
102
|
+
start: sel.start,
|
|
103
|
+
end: sel.end
|
|
104
|
+
});
|
|
105
|
+
const run = (make) => {
|
|
106
|
+
const el = area.current;
|
|
107
|
+
if (!el || !editable) return;
|
|
108
|
+
el.focus();
|
|
109
|
+
const edit = make({
|
|
110
|
+
value: el.value,
|
|
111
|
+
start: el.selectionStart ?? 0,
|
|
112
|
+
end: el.selectionEnd ?? 0
|
|
113
|
+
});
|
|
114
|
+
if (!edit) return;
|
|
115
|
+
applyEdit(el, edit);
|
|
116
|
+
readSelection();
|
|
117
|
+
};
|
|
118
|
+
const historyCommand = (command) => {
|
|
119
|
+
const el = area.current;
|
|
120
|
+
if (!el || !editable) return;
|
|
121
|
+
el.focus();
|
|
122
|
+
document.execCommand(command);
|
|
123
|
+
};
|
|
124
|
+
const handleKeyDown = (e) => {
|
|
125
|
+
onKeyDown?.(e);
|
|
126
|
+
if (e.defaultPrevented || !editable || e.nativeEvent.isComposing) return;
|
|
127
|
+
const mod = e.ctrlKey || e.metaKey;
|
|
128
|
+
const key = e.key.toLowerCase();
|
|
129
|
+
let handled = true;
|
|
130
|
+
if (mod && !e.altKey && !e.shiftKey && key === "b") run((s) => toggleInline(s, "bold"));
|
|
131
|
+
else if (mod && !e.altKey && !e.shiftKey && key === "i") run((s) => toggleInline(s, "italic"));
|
|
132
|
+
else if (mod && !e.altKey && !e.shiftKey && key === "k") run((s) => linkEdit(s, t.markdownEditorLinkText));
|
|
133
|
+
else if (mod && e.shiftKey && !e.altKey && key === "x") run((s) => toggleInline(s, "strike"));
|
|
134
|
+
else if (e.key === "Enter" && !mod && !e.shiftKey && !e.altKey) {
|
|
135
|
+
const el = e.currentTarget;
|
|
136
|
+
const edit = continueListEdit({
|
|
137
|
+
value: el.value,
|
|
138
|
+
start: el.selectionStart ?? 0,
|
|
139
|
+
end: el.selectionEnd ?? 0
|
|
140
|
+
});
|
|
141
|
+
if (edit) applyEdit(el, edit);
|
|
142
|
+
else handled = false;
|
|
143
|
+
} else handled = false;
|
|
144
|
+
if (handled) e.preventDefault();
|
|
145
|
+
};
|
|
146
|
+
const combined = (v) => maxLength !== void 0 && characterCount(v, locale) > maxLength ? template(t.errorTooLong, { max: maxLength }) : null;
|
|
147
|
+
const markLabels = {
|
|
148
|
+
bold: {
|
|
149
|
+
label: t.editorBold,
|
|
150
|
+
icon: /* @__PURE__ */ jsx(BoldIcon, {})
|
|
151
|
+
},
|
|
152
|
+
italic: {
|
|
153
|
+
label: t.editorItalic,
|
|
154
|
+
icon: /* @__PURE__ */ jsx(ItalicIcon, {})
|
|
155
|
+
},
|
|
156
|
+
strike: {
|
|
157
|
+
label: t.editorStrike,
|
|
158
|
+
icon: /* @__PURE__ */ jsx(StrikethroughIcon, {})
|
|
159
|
+
},
|
|
160
|
+
code: {
|
|
161
|
+
label: t.editorCode,
|
|
162
|
+
icon: /* @__PURE__ */ jsx(CodeIcon, {})
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const blockButtons = [
|
|
166
|
+
{
|
|
167
|
+
kind: "h2",
|
|
168
|
+
label: t.editorHeading2,
|
|
169
|
+
icon: /* @__PURE__ */ jsx(HeadingTwoIcon, {})
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
kind: "h3",
|
|
173
|
+
label: t.editorHeading3,
|
|
174
|
+
icon: /* @__PURE__ */ jsx(HeadingThreeIcon, {})
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
kind: "quote",
|
|
178
|
+
label: t.editorQuote,
|
|
179
|
+
icon: /* @__PURE__ */ jsx(QuoteIcon, {})
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
kind: "ul",
|
|
183
|
+
label: t.editorBulletList,
|
|
184
|
+
icon: /* @__PURE__ */ jsx(BulletListIcon, {})
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
kind: "ol",
|
|
188
|
+
label: t.editorNumberedList,
|
|
189
|
+
icon: /* @__PURE__ */ jsx(NumberedListIcon, {})
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
kind: "task",
|
|
193
|
+
label: t.editorTaskList,
|
|
194
|
+
icon: /* @__PURE__ */ jsx(TaskListIcon, {})
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
const toolbarNode = toolbar ? /* @__PURE__ */ jsxs(Toolbar$1, {
|
|
198
|
+
"aria-label": t.editorToolbarLabel,
|
|
199
|
+
className: MarkdownEditor_module_default.toolbar,
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [INLINE_MARKS.map((mark) => /* @__PURE__ */ jsx(ToggleButton$1, {
|
|
202
|
+
variant: "ghost",
|
|
203
|
+
size: "sm",
|
|
204
|
+
label: markLabels[mark].label,
|
|
205
|
+
icon: markLabels[mark].icon,
|
|
206
|
+
isDisabled: !editable,
|
|
207
|
+
isSelected: isInlineActive(state(), mark),
|
|
208
|
+
onChange: () => run((s) => toggleInline(s, mark))
|
|
209
|
+
}, mark)), /* @__PURE__ */ jsx(IconButton, {
|
|
210
|
+
size: "sm",
|
|
211
|
+
label: t.editorLink,
|
|
212
|
+
icon: /* @__PURE__ */ jsx(LinkIcon, {}),
|
|
213
|
+
isDisabled: !editable,
|
|
214
|
+
onPress: () => run((s) => linkEdit(s, t.markdownEditorLinkText))
|
|
215
|
+
})] }),
|
|
216
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
217
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
218
|
+
blockButtons.map((b) => /* @__PURE__ */ jsx(ToggleButton$1, {
|
|
219
|
+
variant: "ghost",
|
|
220
|
+
size: "sm",
|
|
221
|
+
label: b.label,
|
|
222
|
+
icon: b.icon,
|
|
223
|
+
isDisabled: !editable,
|
|
224
|
+
isSelected: isBlockActive(state(), b.kind),
|
|
225
|
+
onChange: () => run((s) => toggleBlock(s, b.kind))
|
|
226
|
+
}, b.kind)),
|
|
227
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
228
|
+
size: "sm",
|
|
229
|
+
label: t.editorCodeBlock,
|
|
230
|
+
icon: /* @__PURE__ */ jsx(CodeBlockIcon, {}),
|
|
231
|
+
isDisabled: !editable,
|
|
232
|
+
onPress: () => run(codeBlockEdit)
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
235
|
+
size: "sm",
|
|
236
|
+
label: t.editorRule,
|
|
237
|
+
icon: /* @__PURE__ */ jsx(RuleIcon, {}),
|
|
238
|
+
isDisabled: !editable,
|
|
239
|
+
onPress: () => run(ruleEdit)
|
|
240
|
+
})
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
243
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
244
|
+
size: "sm",
|
|
245
|
+
label: t.editorUndo,
|
|
246
|
+
icon: /* @__PURE__ */ jsx(UndoIcon, {}),
|
|
247
|
+
isDisabled: !editable,
|
|
248
|
+
onPress: () => historyCommand("undo")
|
|
249
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
250
|
+
size: "sm",
|
|
251
|
+
label: t.editorRedo,
|
|
252
|
+
icon: /* @__PURE__ */ jsx(RedoIcon, {}),
|
|
253
|
+
isDisabled: !editable,
|
|
254
|
+
onPress: () => historyCommand("redo")
|
|
255
|
+
})] })
|
|
256
|
+
]
|
|
257
|
+
}) : null;
|
|
258
|
+
const input = /* @__PURE__ */ jsx(TextArea, {
|
|
259
|
+
ref: setRef,
|
|
260
|
+
className: MarkdownEditor_module_default.input,
|
|
261
|
+
rows: minRows,
|
|
262
|
+
placeholder,
|
|
263
|
+
onKeyDown: handleKeyDown
|
|
264
|
+
});
|
|
265
|
+
const preview = text.trim() === "" ? /* @__PURE__ */ jsx("p", {
|
|
266
|
+
className: MarkdownEditor_module_default.empty,
|
|
267
|
+
children: t.markdownEditorPreviewEmpty
|
|
268
|
+
}) : /* @__PURE__ */ jsx(Markdown, {
|
|
269
|
+
source: text,
|
|
270
|
+
userContent: true,
|
|
271
|
+
fullWidth: true,
|
|
272
|
+
size: "sm",
|
|
273
|
+
allowImages,
|
|
274
|
+
locale,
|
|
275
|
+
externalLinksInNewTab: true
|
|
276
|
+
});
|
|
277
|
+
const labelNode = hideLabel ? /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(FieldLabel, { children: label }) }) : /* @__PURE__ */ jsx(FieldLabel, { children: label });
|
|
278
|
+
const footer = maxLength !== void 0 ? /* @__PURE__ */ jsx("div", {
|
|
279
|
+
className: MarkdownEditor_module_default.footer,
|
|
280
|
+
children: /* @__PURE__ */ jsx(CharacterCounter, {
|
|
281
|
+
count,
|
|
282
|
+
max: maxLength
|
|
283
|
+
})
|
|
284
|
+
}) : null;
|
|
285
|
+
const body = layout === "split" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx("div", {
|
|
287
|
+
className: MarkdownEditor_module_default.bar,
|
|
288
|
+
children: toolbarNode
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ jsxs("div", {
|
|
291
|
+
className: MarkdownEditor_module_default.split,
|
|
292
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
293
|
+
className: MarkdownEditor_module_default.pane,
|
|
294
|
+
children: input
|
|
295
|
+
}), /* @__PURE__ */ jsx("section", {
|
|
296
|
+
className: MarkdownEditor_module_default.previewPane,
|
|
297
|
+
"aria-label": t.markdownEditorPreview,
|
|
298
|
+
tabIndex: 0,
|
|
299
|
+
children: preview
|
|
300
|
+
})]
|
|
301
|
+
}),
|
|
302
|
+
footer
|
|
303
|
+
] }) : /* @__PURE__ */ jsxs(Tabs$1, {
|
|
304
|
+
selectedKey: currentView,
|
|
305
|
+
onSelectionChange: (k) => {
|
|
306
|
+
const next = k;
|
|
307
|
+
if (view === void 0) setInnerView(next);
|
|
308
|
+
onViewChange?.(next);
|
|
309
|
+
},
|
|
310
|
+
className: MarkdownEditor_module_default.tabs,
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ jsxs("div", {
|
|
313
|
+
className: MarkdownEditor_module_default.bar,
|
|
314
|
+
children: [/* @__PURE__ */ jsxs(TabList$1, {
|
|
315
|
+
"aria-label": t.markdownEditorViews,
|
|
316
|
+
children: [/* @__PURE__ */ jsx(Tab$1, {
|
|
317
|
+
id: "write",
|
|
318
|
+
children: t.markdownEditorWrite
|
|
319
|
+
}), /* @__PURE__ */ jsx(Tab$1, {
|
|
320
|
+
id: "preview",
|
|
321
|
+
children: t.markdownEditorPreview
|
|
322
|
+
})]
|
|
323
|
+
}), currentView === "write" ? toolbarNode : null]
|
|
324
|
+
}),
|
|
325
|
+
/* @__PURE__ */ jsx(TabPanel$1, {
|
|
326
|
+
id: "write",
|
|
327
|
+
shouldForceMount: true,
|
|
328
|
+
className: MarkdownEditor_module_default.panel,
|
|
329
|
+
children: input
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsx(TabPanel$1, {
|
|
332
|
+
id: "preview",
|
|
333
|
+
className: MarkdownEditor_module_default.previewPanel,
|
|
334
|
+
children: preview
|
|
335
|
+
}),
|
|
336
|
+
currentView === "write" ? footer : null
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
return /* @__PURE__ */ jsxs(TextField, {
|
|
340
|
+
id,
|
|
341
|
+
value: text,
|
|
342
|
+
onChange: (v) => {
|
|
343
|
+
if (value === void 0) setInner(v);
|
|
344
|
+
onChange?.(v);
|
|
345
|
+
},
|
|
346
|
+
name,
|
|
347
|
+
validate: combined,
|
|
348
|
+
isRequired,
|
|
349
|
+
isDisabled,
|
|
350
|
+
isReadOnly,
|
|
351
|
+
isInvalid,
|
|
352
|
+
autoFocus,
|
|
353
|
+
"data-layout": layout,
|
|
354
|
+
className: [
|
|
355
|
+
fieldStyles.root,
|
|
356
|
+
MarkdownEditor_module_default.root,
|
|
357
|
+
className
|
|
358
|
+
].filter(Boolean).join(" "),
|
|
359
|
+
children: [
|
|
360
|
+
labelNode,
|
|
361
|
+
/* @__PURE__ */ jsx("div", {
|
|
362
|
+
ref: frame,
|
|
363
|
+
className: MarkdownEditor_module_default.frame,
|
|
364
|
+
children: body
|
|
365
|
+
}),
|
|
366
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null,
|
|
367
|
+
/* @__PURE__ */ jsx(FieldErrorText, { errorMessage })
|
|
368
|
+
]
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
export { MarkdownEditor };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './MarkdownEditor.css';
|
|
2
|
+
// src/editor/MarkdownEditor/MarkdownEditor.module.css
|
|
3
|
+
var MarkdownEditor_module_default = {
|
|
4
|
+
"root": "sti-MarkdownEditor-root-e6e3a",
|
|
5
|
+
"frame": "sti-MarkdownEditor-frame-bb380",
|
|
6
|
+
"tabs": "sti-MarkdownEditor-tabs-60cfd",
|
|
7
|
+
"bar": "sti-MarkdownEditor-bar-4a424",
|
|
8
|
+
"toolbar": "sti-MarkdownEditor-toolbar-8b529",
|
|
9
|
+
"panel": "sti-MarkdownEditor-panel-da748",
|
|
10
|
+
"previewPanel": "sti-MarkdownEditor-previewPanel-93a37",
|
|
11
|
+
"input": "sti-MarkdownEditor-input-703b3",
|
|
12
|
+
"previewPane": "sti-MarkdownEditor-previewPane-24a28",
|
|
13
|
+
"empty": "sti-MarkdownEditor-empty-17dbe",
|
|
14
|
+
"footer": "sti-MarkdownEditor-footer-941ae",
|
|
15
|
+
"split": "sti-MarkdownEditor-split-39df0",
|
|
16
|
+
"pane": "sti-MarkdownEditor-pane-1509b"
|
|
17
|
+
};
|
|
18
|
+
export { MarkdownEditor_module_default as default };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { lineBounds } from "../_shared/textEdit.js";
|
|
2
|
+
// src/editor/MarkdownEditor/commands.ts
|
|
3
|
+
/**
|
|
4
|
+
* Markdown düzenleyicisinin saf biçimlendirme komutları. Hepsi (metin, seçim) alır, bir `TextEdit`
|
|
5
|
+
* döndürür (uygulama `applyEdit` ile yapılır); DOM'a dokunmaz ve Node'da denenir.
|
|
6
|
+
*/
|
|
7
|
+
const MARKERS = {
|
|
8
|
+
bold: "**",
|
|
9
|
+
italic: "*",
|
|
10
|
+
strike: "~~",
|
|
11
|
+
code: "`"
|
|
12
|
+
};
|
|
13
|
+
const edit = (from, to, insert, selStart, selEnd = selStart) => ({
|
|
14
|
+
from,
|
|
15
|
+
to,
|
|
16
|
+
insert,
|
|
17
|
+
selectStart: selStart,
|
|
18
|
+
selectEnd: selEnd
|
|
19
|
+
});
|
|
20
|
+
/** Bir konumun iki yanındaki ardışık aynı karakterlerin sayısı. */
|
|
21
|
+
function runLength(value, from, step, ch) {
|
|
22
|
+
let n = 0;
|
|
23
|
+
for (let i = from; i >= 0 && i < value.length && value[i] === ch; i += step) n += 1;
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
/** `*` dizileri: `*` italik, `**` kalın, `***` ikisi; tek tek çift ve tek sayıya bakılır. */
|
|
27
|
+
function asteriskCovers(mark, run) {
|
|
28
|
+
if (mark === "bold") return run >= 2;
|
|
29
|
+
return run === 1 || run === 3;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Seçimin satıra göre sarıldığı işaret: seçimin hemen dışında ya da seçimin içinde (başında ve
|
|
33
|
+
* sonunda). Dönen değer işaretin uzunluğu ve sarmanın seçimin içinde olup olmadığıdır.
|
|
34
|
+
*/
|
|
35
|
+
function wrapping(state, mark) {
|
|
36
|
+
const m = MARKERS[mark];
|
|
37
|
+
const { value, start, end } = state;
|
|
38
|
+
const asterisk = m.startsWith("*");
|
|
39
|
+
if (value.slice(start - m.length, start) === m && value.slice(end, end + m.length) === m) {
|
|
40
|
+
if (!asterisk) return { inside: false };
|
|
41
|
+
const before = runLength(value, start - 1, -1, "*");
|
|
42
|
+
const after = runLength(value, end, 1, "*");
|
|
43
|
+
if (asteriskCovers(mark, Math.min(before, after))) return { inside: false };
|
|
44
|
+
}
|
|
45
|
+
const sel = value.slice(start, end);
|
|
46
|
+
if (sel.length > 2 * m.length && sel.startsWith(m) && sel.endsWith(m)) {
|
|
47
|
+
if (!asterisk) return { inside: true };
|
|
48
|
+
const lead = runLength(sel, 0, 1, "*");
|
|
49
|
+
const tail = runLength(sel, sel.length - 1, -1, "*");
|
|
50
|
+
if (asteriskCovers(mark, Math.min(lead, tail))) return { inside: true };
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/** Araç çubuğunun "basılı" göstergesi için: seçim bu işaretle sarılı mı. */
|
|
55
|
+
function isInlineActive(state, mark) {
|
|
56
|
+
return wrapping(state, mark) !== null;
|
|
57
|
+
}
|
|
58
|
+
/** Kalın, italik, üstü çizili ve satır içi kod: sarar ya da (sarılıysa) sarmayı kaldırır. */
|
|
59
|
+
function toggleInline(state, mark) {
|
|
60
|
+
const m = MARKERS[mark];
|
|
61
|
+
const { value, start, end } = state;
|
|
62
|
+
const found = wrapping(state, mark);
|
|
63
|
+
if (found && !found.inside) return edit(start - m.length, end + m.length, value.slice(start, end), start - m.length, end - m.length);
|
|
64
|
+
if (found?.inside) {
|
|
65
|
+
const inner = value.slice(start + m.length, end - m.length);
|
|
66
|
+
return edit(start, end, inner, start, start + inner.length);
|
|
67
|
+
}
|
|
68
|
+
if (start === end) return edit(start, end, m + m, start + m.length);
|
|
69
|
+
const sel = value.slice(start, end);
|
|
70
|
+
const lead = sel.length - sel.trimStart().length;
|
|
71
|
+
const core = sel.trim();
|
|
72
|
+
if (core === "") return edit(start, end, m + m, start + m.length);
|
|
73
|
+
const text = sel.slice(0, lead) + m + core + m + sel.slice(lead + core.length);
|
|
74
|
+
const from = start + lead + m.length;
|
|
75
|
+
return edit(start, end, text, from, from + core.length);
|
|
76
|
+
}
|
|
77
|
+
const LINE = /^([ \t]*)((?:>[ \t]?)*)((?:#{1,6}[ \t]+)|(?:[-*+][ \t]+\[[ xX]\][ \t]+)|(?:[-*+][ \t]+)|(?:\d{1,9}[.)][ \t]+))?(.*)$/;
|
|
78
|
+
function parseLine(line) {
|
|
79
|
+
const m = LINE.exec(line);
|
|
80
|
+
return {
|
|
81
|
+
indent: m[1] ?? "",
|
|
82
|
+
quote: m[2] ?? "",
|
|
83
|
+
marker: m[3] ?? "",
|
|
84
|
+
body: m[4] ?? ""
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function kindOfMarker(marker) {
|
|
88
|
+
if (/^#{2}[ \t]/.test(marker)) return "h2";
|
|
89
|
+
if (/^#{3}[ \t]/.test(marker)) return "h3";
|
|
90
|
+
if (/^[-*+][ \t]+\[[ xX]\]/.test(marker)) return "task";
|
|
91
|
+
if (/^[-*+][ \t]/.test(marker)) return "ul";
|
|
92
|
+
if (/^\d/.test(marker)) return "ol";
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
function affectedLines(state) {
|
|
96
|
+
const first = lineBounds(state.value, state.start);
|
|
97
|
+
let endPos = state.end;
|
|
98
|
+
if (state.end > state.start && state.value[state.end - 1] === "\n") endPos = state.end - 1;
|
|
99
|
+
const last = lineBounds(state.value, endPos);
|
|
100
|
+
return {
|
|
101
|
+
from: first.start,
|
|
102
|
+
to: last.end,
|
|
103
|
+
lines: state.value.slice(first.start, last.end).split("\n")
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Araç çubuğunun "basılı" göstergesi için: seçili satırların tümü bu türdeyse doğru. */
|
|
107
|
+
function isBlockActive(state, kind) {
|
|
108
|
+
const { lines } = affectedLines(state);
|
|
109
|
+
const filled = lines.filter((l) => l.trim() !== "");
|
|
110
|
+
if (filled.length === 0) return false;
|
|
111
|
+
return filled.every((l) => {
|
|
112
|
+
const p = parseLine(l);
|
|
113
|
+
return kind === "quote" ? p.quote !== "" : kindOfMarker(p.marker) === kind;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/** Başlık, alıntı ve liste önekleri: seçili satırlara ekler; hepsi o türdeyse kaldırır. */
|
|
117
|
+
function toggleBlock(state, kind) {
|
|
118
|
+
const { from, to, lines } = affectedLines(state);
|
|
119
|
+
const remove = isBlockActive(state, kind);
|
|
120
|
+
let n = 0;
|
|
121
|
+
const insert = lines.map((line) => {
|
|
122
|
+
if (line.trim() === "" && lines.length > 1) return line;
|
|
123
|
+
const p = parseLine(line);
|
|
124
|
+
if (kind === "quote") return remove ? p.indent + p.quote.replace(/^>[ \t]?/, "") + p.marker + p.body : `${p.indent}> ${p.quote}${p.marker}${p.body}`;
|
|
125
|
+
if (remove) return p.indent + p.quote + p.body;
|
|
126
|
+
n += 1;
|
|
127
|
+
const marker = kind === "h2" ? "## " : kind === "h3" ? "### " : kind === "ul" ? "- " : kind === "task" ? "- [ ] " : `${n}. `;
|
|
128
|
+
return p.indent + p.quote + marker + p.body;
|
|
129
|
+
}).join("\n");
|
|
130
|
+
if (lines.length === 1 && state.start === state.end) {
|
|
131
|
+
const delta = insert.length - (to - from);
|
|
132
|
+
const caret = Math.max(from, state.start + delta);
|
|
133
|
+
return edit(from, to, insert, caret);
|
|
134
|
+
}
|
|
135
|
+
return edit(from, to, insert, from, from + insert.length);
|
|
136
|
+
}
|
|
137
|
+
/** `[metin](adres)`: seçim metin olur; seçim bir adresse metin yer tutucu olur. */
|
|
138
|
+
function linkEdit(state, placeholder) {
|
|
139
|
+
const { value, start, end } = state;
|
|
140
|
+
const sel = value.slice(start, end);
|
|
141
|
+
if (/^(https?:\/\/|mailto:|tel:)\S+$/i.test(sel)) {
|
|
142
|
+
const text = `[${placeholder}](${sel})`;
|
|
143
|
+
return edit(start, end, text, start + 1, start + 1 + placeholder.length);
|
|
144
|
+
}
|
|
145
|
+
const label = sel === "" ? placeholder : sel;
|
|
146
|
+
const text = `[${label}](https://)`;
|
|
147
|
+
const urlStart = start + label.length + 3;
|
|
148
|
+
return edit(start, end, text, urlStart, urlStart + 8);
|
|
149
|
+
}
|
|
150
|
+
/** Çitli kod bloğu: seçimi sarar; zaten sarılıysa kaldırır. */
|
|
151
|
+
function codeBlockEdit(state) {
|
|
152
|
+
const { value, start, end } = state;
|
|
153
|
+
const before = value.slice(0, start);
|
|
154
|
+
const after = value.slice(end);
|
|
155
|
+
const open = /(^|\n)```[^\n`]*\n$/.exec(before);
|
|
156
|
+
const close = /^\n```(?=\n|$)/.exec(after);
|
|
157
|
+
if (open && close) {
|
|
158
|
+
const from = start - (open[0].length - (open[1] ?? "").length);
|
|
159
|
+
return edit(from, end + close[0].length, value.slice(start, end), from, from + (end - start));
|
|
160
|
+
}
|
|
161
|
+
const sel = value.slice(start, end);
|
|
162
|
+
const lead = start === 0 || value[start - 1] === "\n" ? "" : "\n";
|
|
163
|
+
const text = `${lead}\`\`\`\n${sel}\n\`\`\`${after.startsWith("\n") || after === "" ? "" : "\n"}`;
|
|
164
|
+
const caret = start + lead.length + 4;
|
|
165
|
+
return edit(start, end, text, caret, caret + sel.length);
|
|
166
|
+
}
|
|
167
|
+
/** Yatay çizgi: geçerli satırın altına, öncesinde boş satır bırakarak ekler. */
|
|
168
|
+
function ruleEdit(state) {
|
|
169
|
+
const { value, end } = state;
|
|
170
|
+
const { start: ls, end: le } = lineBounds(value, end);
|
|
171
|
+
const text = `${value.slice(ls, le).trim() !== "" ? "\n\n" : "\n"}---\n`;
|
|
172
|
+
return edit(le, le, text, le + text.length);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Enter: liste, görev ve alıntı satırında bir sonraki öğeyi açar; öğe boşsa listeden çıkar.
|
|
176
|
+
* İmleç önekin içindeyse ya da satır liste değilse `null` (tarayıcı satır ekler).
|
|
177
|
+
*/
|
|
178
|
+
function continueListEdit(state) {
|
|
179
|
+
const { value, start, end } = state;
|
|
180
|
+
if (start !== end) return null;
|
|
181
|
+
const { start: ls, end: le } = lineBounds(value, start);
|
|
182
|
+
const p = parseLine(value.slice(ls, le));
|
|
183
|
+
const prefixLength = p.indent.length + p.quote.length + p.marker.length;
|
|
184
|
+
if (p.marker === "" && p.quote === "") return null;
|
|
185
|
+
if (start - ls < prefixLength) return null;
|
|
186
|
+
if (p.body.trim() === "" && start === le) {
|
|
187
|
+
const rest = p.quote === "" ? "" : p.indent + p.quote.replace(/>[ \t]?$/, "");
|
|
188
|
+
return edit(ls, le, rest, ls + rest.length);
|
|
189
|
+
}
|
|
190
|
+
let next = p.marker;
|
|
191
|
+
if (/^\d/.test(next)) {
|
|
192
|
+
const n = Number.parseInt(next, 10) + 1;
|
|
193
|
+
next = next.replace(/^\d+/, String(n));
|
|
194
|
+
} else if (/\[[ xX]\]/.test(next)) next = next.replace(/\[[ xX]\]/, "[ ]");
|
|
195
|
+
const insert = `\n${p.indent}${p.quote}${next}`;
|
|
196
|
+
return edit(start, end, insert, start + insert.length);
|
|
197
|
+
}
|
|
198
|
+
export { codeBlockEdit, continueListEdit, isBlockActive, isInlineActive, linkEdit, ruleEdit, toggleBlock, toggleInline };
|