@astra-kit/ui 0.0.0-stage → 0.0.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 +15 -0
- package/LICENSE.md +21 -0
- package/README.md +384 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +57 -0
- package/dist/components/dropdown-menu.js +107 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +10 -0
- package/dist/constants/dropdown-menu.js +37 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure classification of a pointer drag into a horizontal swipe. Kept apart
|
|
3
|
+
* from the DOM so thresholds are unit-testable and shared by any pager.
|
|
4
|
+
*/
|
|
5
|
+
export declare const HORIZONTAL_SWIPE_DIRECTION: {
|
|
6
|
+
readonly next: "next";
|
|
7
|
+
readonly previous: "previous";
|
|
8
|
+
};
|
|
9
|
+
export type HorizontalSwipeDirection = (typeof HORIZONTAL_SWIPE_DIRECTION)[keyof typeof HORIZONTAL_SWIPE_DIRECTION];
|
|
10
|
+
export type HorizontalSwipeGesture = {
|
|
11
|
+
deltaX: number;
|
|
12
|
+
deltaY: number;
|
|
13
|
+
durationMs: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Decides whether a drag is a deliberate horizontal swipe. A leftward swipe
|
|
17
|
+
* moves to the next page and a rightward one to the previous page, like
|
|
18
|
+
* turning a calendar page.
|
|
19
|
+
*
|
|
20
|
+
* @param gesture - Pointer travel and duration.
|
|
21
|
+
* @returns The swipe direction, or null when the drag is not a swipe.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveHorizontalSwipe(gesture: HorizontalSwipeGesture): HorizontalSwipeDirection | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure classification of a pointer drag into a horizontal swipe. Kept apart
|
|
3
|
+
* from the DOM so thresholds are unit-testable and shared by any pager.
|
|
4
|
+
*/
|
|
5
|
+
export const HORIZONTAL_SWIPE_DIRECTION = {
|
|
6
|
+
next: "next",
|
|
7
|
+
previous: "previous"
|
|
8
|
+
};
|
|
9
|
+
/** Minimum horizontal travel, in CSS pixels, to count as a swipe. */
|
|
10
|
+
const SWIPE_MIN_DISTANCE_PX = 60;
|
|
11
|
+
/** Horizontal travel must dominate vertical travel by this ratio. */
|
|
12
|
+
const SWIPE_HORIZONTAL_DOMINANCE_RATIO = 1.5;
|
|
13
|
+
/** Slower drags read as reading/scrolling, not as a page flip. */
|
|
14
|
+
const SWIPE_MAX_DURATION_MS = 800;
|
|
15
|
+
/**
|
|
16
|
+
* Decides whether a drag is a deliberate horizontal swipe. A leftward swipe
|
|
17
|
+
* moves to the next page and a rightward one to the previous page, like
|
|
18
|
+
* turning a calendar page.
|
|
19
|
+
*
|
|
20
|
+
* @param gesture - Pointer travel and duration.
|
|
21
|
+
* @returns The swipe direction, or null when the drag is not a swipe.
|
|
22
|
+
*/
|
|
23
|
+
export function resolveHorizontalSwipe(gesture) {
|
|
24
|
+
const horizontalDistance = Math.abs(gesture.deltaX);
|
|
25
|
+
if (horizontalDistance < SWIPE_MIN_DISTANCE_PX || horizontalDistance < Math.abs(gesture.deltaY) * SWIPE_HORIZONTAL_DOMINANCE_RATIO || gesture.durationMs > SWIPE_MAX_DURATION_MS) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return gesture.deltaX < 0 ? HORIZONTAL_SWIPE_DIRECTION.next : HORIZONTAL_SWIPE_DIRECTION.previous;
|
|
29
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Supplies intrinsic dimensions required by responsive and optimized image adapters. */
|
|
2
|
+
const DEFAULT_IMAGE_DIMENSION_PX = 40;
|
|
3
|
+
/** Converts native image dimensions into a positive numeric value. */
|
|
4
|
+
export function imageDimension(value) {
|
|
5
|
+
const parsed = Number(value);
|
|
6
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_IMAGE_DIMENSION_PX;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Builds avatar initials from display names, shared by account and member avatars. */
|
|
2
|
+
/**
|
|
3
|
+
* Builds up to two uppercase initials from a display name, ignoring repeated spaces.
|
|
4
|
+
* @param name - Display name, possibly blank.
|
|
5
|
+
* @returns The initials, or an empty string for a blank name.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getNameInitials(name: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Builds avatar initials from display names, shared by account and member avatars. */
|
|
2
|
+
const NAME_PART_SEPARATOR = /\s+/;
|
|
3
|
+
const MAX_INITIALS = 2;
|
|
4
|
+
/**
|
|
5
|
+
* Builds up to two uppercase initials from a display name, ignoring repeated spaces.
|
|
6
|
+
* @param name - Display name, possibly blank.
|
|
7
|
+
* @returns The initials, or an empty string for a blank name.
|
|
8
|
+
*/
|
|
9
|
+
export function getNameInitials(name) {
|
|
10
|
+
return name.trim().split(NAME_PART_SEPARATOR).filter(Boolean).slice(0, MAX_INITIALS).map((namePart) => namePart.charAt(0).toUpperCase()).join("");
|
|
11
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for the rich-text link layer.
|
|
3
|
+
*
|
|
4
|
+
* These values back both the read-only renderer (`RichTextContent`) and the
|
|
5
|
+
* rich link editor (`RichLinkEditor` / `useRichLinkEditor`). They are framework
|
|
6
|
+
* safe and free of business rules, so they live under `lib` and can be reused by
|
|
7
|
+
* any feature that needs autolinking plus `[text](url)` markdown support.
|
|
8
|
+
*/
|
|
9
|
+
/** URL protocols accepted when normalizing a markdown link target. */
|
|
10
|
+
export declare const LINK_MARKDOWN_ALLOWED_PROTOCOL: {
|
|
11
|
+
readonly http: "http:";
|
|
12
|
+
readonly https: "https:";
|
|
13
|
+
};
|
|
14
|
+
/** Protocol prepended to bare domains that lack an explicit scheme. */
|
|
15
|
+
export declare const LINK_PROTOCOL_PREFIX: {
|
|
16
|
+
readonly default: "https://";
|
|
17
|
+
};
|
|
18
|
+
/** Tokens used to assemble and recognize `[text](url)` markdown links. */
|
|
19
|
+
export declare const LINK_MARKDOWN_FORMAT: {
|
|
20
|
+
readonly closeLabel: "]";
|
|
21
|
+
readonly closeUrl: ")";
|
|
22
|
+
readonly openLabel: "[";
|
|
23
|
+
readonly openUrl: "](";
|
|
24
|
+
readonly suppressedUrl: "#";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Parentheses that the `[text](url)` markdown URL group cannot represent
|
|
28
|
+
* unescaped, paired with their percent-encoded equivalents. The URL group only
|
|
29
|
+
* accepts balanced single-level `(...)` pairs, so any other paren must be
|
|
30
|
+
* encoded when serializing a link target; browsers decode `%28`/`%29` back to
|
|
31
|
+
* the literal character when the link is opened.
|
|
32
|
+
*/
|
|
33
|
+
export declare const LINK_MARKDOWN_URL_PAREN: {
|
|
34
|
+
readonly close: ")";
|
|
35
|
+
readonly encodedClose: "%29";
|
|
36
|
+
readonly encodedOpen: "%28";
|
|
37
|
+
readonly open: "(";
|
|
38
|
+
};
|
|
39
|
+
/** Patterns matching characters that must be escaped inside link label text. */
|
|
40
|
+
export declare const LINK_MARKDOWN_ESCAPE_PATTERN: {
|
|
41
|
+
readonly backslash: RegExp;
|
|
42
|
+
readonly closeLabel: RegExp;
|
|
43
|
+
readonly lineBreak: RegExp;
|
|
44
|
+
readonly openLabel: RegExp;
|
|
45
|
+
};
|
|
46
|
+
/** Escape sequences paired with `LINK_MARKDOWN_ESCAPE_PATTERN`. */
|
|
47
|
+
export declare const LINK_MARKDOWN_ESCAPE_VALUE: {
|
|
48
|
+
readonly backslash: "\\";
|
|
49
|
+
readonly escapedBackslash: "\\\\";
|
|
50
|
+
readonly escapedCloseLabel: "\\]";
|
|
51
|
+
readonly escapedLineBreak: "\\n";
|
|
52
|
+
readonly escapedOpenLabel: "\\[";
|
|
53
|
+
readonly lineBreakToken: "n";
|
|
54
|
+
};
|
|
55
|
+
/** Discriminant for the parsed rich-text segments (plain text vs. link). */
|
|
56
|
+
export declare const RICH_TEXT_SEGMENT_TYPE: {
|
|
57
|
+
readonly link: "link";
|
|
58
|
+
readonly text: "text";
|
|
59
|
+
};
|
|
60
|
+
/** Whether an editor link is explicit (`[text](url)`) or a suppressed autolink. */
|
|
61
|
+
export declare const RICH_LINK_KIND: {
|
|
62
|
+
readonly explicit: "explicit";
|
|
63
|
+
readonly suppressed: "suppressed";
|
|
64
|
+
};
|
|
65
|
+
/** Origin of a preview link segment: auto-detected URL vs. explicit link. */
|
|
66
|
+
export declare const RICH_PREVIEW_LINK_SOURCE: {
|
|
67
|
+
readonly automatic: "automatic";
|
|
68
|
+
readonly explicit: "explicit";
|
|
69
|
+
};
|
|
70
|
+
/** Editing modes of the link popover. */
|
|
71
|
+
export declare const RICH_LINK_POPOVER_MODE: {
|
|
72
|
+
readonly actions: "actions";
|
|
73
|
+
readonly edit: "edit";
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Regular expressions used to detect links in plain text.
|
|
77
|
+
*
|
|
78
|
+
* The URL character classes exclude both `)` and `]` so a URL wrapped in
|
|
79
|
+
* brackets or parentheses (`[https://example.com/path]`) stops at the closing
|
|
80
|
+
* delimiter instead of swallowing it into the link target. Balanced `(...)`
|
|
81
|
+
* inside the URL is still matched through the dedicated paren-balancing group.
|
|
82
|
+
*/
|
|
83
|
+
export declare const LINK_PATTERN: {
|
|
84
|
+
readonly bareDomain: RegExp;
|
|
85
|
+
readonly containsWhitespace: RegExp;
|
|
86
|
+
readonly bareUrl: RegExp;
|
|
87
|
+
readonly hostBoundary: RegExp;
|
|
88
|
+
readonly markdown: RegExp;
|
|
89
|
+
readonly protocolPrefix: RegExp;
|
|
90
|
+
readonly trailingPunctuation: RegExp;
|
|
91
|
+
readonly whitespace: RegExp;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Public top-level domains recognized when auto-linking a scheme-less bare
|
|
95
|
+
* domain found in prose. `new URL()` accepts any syntactically valid hostname,
|
|
96
|
+
* so without this allowlist Spanish abbreviations like `EE.UU.` or
|
|
97
|
+
* end-of-sentence transitions like `China.Por` would resolve to bogus hosts and
|
|
98
|
+
* become clickable links. It covers the common gTLDs plus every assigned
|
|
99
|
+
* two-letter ccTLD; unknown suffixes such as `uu` or `por` are intentionally
|
|
100
|
+
* absent. This gates only the automatic detection path: explicit `http(s)://`
|
|
101
|
+
* URLs and links the user pastes deliberately bypass it and stay permissive.
|
|
102
|
+
*/
|
|
103
|
+
export declare const KNOWN_TOP_LEVEL_DOMAINS: Set<string>;
|
|
104
|
+
/** Capture group indexes of `LINK_PATTERN.markdown`. */
|
|
105
|
+
export declare const LINK_MARKDOWN_MATCH_GROUP: {
|
|
106
|
+
readonly text: 1;
|
|
107
|
+
readonly url: 2;
|
|
108
|
+
};
|
|
109
|
+
/** Sentinel returned by the text diff when no change is found. */
|
|
110
|
+
export declare const TEXT_DIFF_FALLBACK_INDEX: {
|
|
111
|
+
readonly notFound: -1;
|
|
112
|
+
};
|
|
113
|
+
/** Separator used to build a stable key for preview link segments. */
|
|
114
|
+
export declare const PREVIEW_LINK_KEY_SEPARATOR: {
|
|
115
|
+
readonly value: ":";
|
|
116
|
+
};
|
|
117
|
+
/** Clipboard data type read on paste inside the editor. */
|
|
118
|
+
export declare const RICH_TEXT_CLIPBOARD_DATA_TYPE: {
|
|
119
|
+
readonly plainText: "text/plain";
|
|
120
|
+
};
|
|
121
|
+
/** `InputEvent.inputType` values handled by the editor's `beforeInput`. */
|
|
122
|
+
export declare const RICH_TEXT_EDITOR_INPUT_TYPE: {
|
|
123
|
+
readonly deleteContentBackward: "deleteContentBackward";
|
|
124
|
+
readonly deleteContentForward: "deleteContentForward";
|
|
125
|
+
readonly insertLineBreak: "insertLineBreak";
|
|
126
|
+
readonly insertParagraph: "insertParagraph";
|
|
127
|
+
readonly insertText: "insertText";
|
|
128
|
+
};
|
|
129
|
+
/** Keyboard keys handled by the editor's `keydown`. */
|
|
130
|
+
export declare const RICH_TEXT_EDITOR_KEY: {
|
|
131
|
+
readonly backspace: "Backspace";
|
|
132
|
+
readonly delete: "Delete";
|
|
133
|
+
readonly enter: "Enter";
|
|
134
|
+
};
|
|
135
|
+
/** Direction of a word-wise deletion. */
|
|
136
|
+
export declare const RICH_TEXT_EDITOR_WORD_DIRECTION: {
|
|
137
|
+
readonly backward: "backward";
|
|
138
|
+
readonly forward: "forward";
|
|
139
|
+
};
|
|
140
|
+
/** Length of a single editable character. */
|
|
141
|
+
export declare const RICH_TEXT_EDITOR_KEY_LENGTH: {
|
|
142
|
+
readonly character: 1;
|
|
143
|
+
};
|
|
144
|
+
/** Literal text tokens used by the editor. */
|
|
145
|
+
export declare const RICH_TEXT_EDITOR_TEXT: {
|
|
146
|
+
readonly lineBreak: "\n";
|
|
147
|
+
};
|
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for the rich-text link layer.
|
|
3
|
+
*
|
|
4
|
+
* These values back both the read-only renderer (`RichTextContent`) and the
|
|
5
|
+
* rich link editor (`RichLinkEditor` / `useRichLinkEditor`). They are framework
|
|
6
|
+
* safe and free of business rules, so they live under `lib` and can be reused by
|
|
7
|
+
* any feature that needs autolinking plus `[text](url)` markdown support.
|
|
8
|
+
*/
|
|
9
|
+
/** URL protocols accepted when normalizing a markdown link target. */
|
|
10
|
+
export const LINK_MARKDOWN_ALLOWED_PROTOCOL = {
|
|
11
|
+
http: "http:",
|
|
12
|
+
https: "https:"
|
|
13
|
+
};
|
|
14
|
+
/** Protocol prepended to bare domains that lack an explicit scheme. */
|
|
15
|
+
export const LINK_PROTOCOL_PREFIX = { default: "https://" };
|
|
16
|
+
/** Tokens used to assemble and recognize `[text](url)` markdown links. */
|
|
17
|
+
export const LINK_MARKDOWN_FORMAT = {
|
|
18
|
+
closeLabel: "]",
|
|
19
|
+
closeUrl: ")",
|
|
20
|
+
openLabel: "[",
|
|
21
|
+
openUrl: "](",
|
|
22
|
+
suppressedUrl: "#"
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Parentheses that the `[text](url)` markdown URL group cannot represent
|
|
26
|
+
* unescaped, paired with their percent-encoded equivalents. The URL group only
|
|
27
|
+
* accepts balanced single-level `(...)` pairs, so any other paren must be
|
|
28
|
+
* encoded when serializing a link target; browsers decode `%28`/`%29` back to
|
|
29
|
+
* the literal character when the link is opened.
|
|
30
|
+
*/
|
|
31
|
+
export const LINK_MARKDOWN_URL_PAREN = {
|
|
32
|
+
close: ")",
|
|
33
|
+
encodedClose: "%29",
|
|
34
|
+
encodedOpen: "%28",
|
|
35
|
+
open: "("
|
|
36
|
+
};
|
|
37
|
+
/** Patterns matching characters that must be escaped inside link label text. */
|
|
38
|
+
export const LINK_MARKDOWN_ESCAPE_PATTERN = {
|
|
39
|
+
backslash: /\\/g,
|
|
40
|
+
closeLabel: /\]/g,
|
|
41
|
+
lineBreak: /\n/g,
|
|
42
|
+
openLabel: /\[/g
|
|
43
|
+
};
|
|
44
|
+
/** Escape sequences paired with `LINK_MARKDOWN_ESCAPE_PATTERN`. */
|
|
45
|
+
export const LINK_MARKDOWN_ESCAPE_VALUE = {
|
|
46
|
+
backslash: "\\",
|
|
47
|
+
escapedBackslash: "\\\\",
|
|
48
|
+
escapedCloseLabel: "\\]",
|
|
49
|
+
escapedLineBreak: "\\n",
|
|
50
|
+
escapedOpenLabel: "\\[",
|
|
51
|
+
lineBreakToken: "n"
|
|
52
|
+
};
|
|
53
|
+
/** Discriminant for the parsed rich-text segments (plain text vs. link). */
|
|
54
|
+
export const RICH_TEXT_SEGMENT_TYPE = {
|
|
55
|
+
link: "link",
|
|
56
|
+
text: "text"
|
|
57
|
+
};
|
|
58
|
+
/** Whether an editor link is explicit (`[text](url)`) or a suppressed autolink. */
|
|
59
|
+
export const RICH_LINK_KIND = {
|
|
60
|
+
explicit: "explicit",
|
|
61
|
+
suppressed: "suppressed"
|
|
62
|
+
};
|
|
63
|
+
/** Origin of a preview link segment: auto-detected URL vs. explicit link. */
|
|
64
|
+
export const RICH_PREVIEW_LINK_SOURCE = {
|
|
65
|
+
automatic: "automatic",
|
|
66
|
+
explicit: "explicit"
|
|
67
|
+
};
|
|
68
|
+
/** Editing modes of the link popover. */
|
|
69
|
+
export const RICH_LINK_POPOVER_MODE = {
|
|
70
|
+
actions: "actions",
|
|
71
|
+
edit: "edit"
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Regular expressions used to detect links in plain text.
|
|
75
|
+
*
|
|
76
|
+
* The URL character classes exclude both `)` and `]` so a URL wrapped in
|
|
77
|
+
* brackets or parentheses (`[https://example.com/path]`) stops at the closing
|
|
78
|
+
* delimiter instead of swallowing it into the link target. Balanced `(...)`
|
|
79
|
+
* inside the URL is still matched through the dedicated paren-balancing group.
|
|
80
|
+
*/
|
|
81
|
+
export const LINK_PATTERN = {
|
|
82
|
+
bareDomain: /^(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}[^\s<>)\]]*$/,
|
|
83
|
+
containsWhitespace: /\s/,
|
|
84
|
+
bareUrl: /(?:https?:\/\/[^\s<>)\]]*(?:\([^\s<>()]*\)[^\s<>)\]]*)*|(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}[^\s<>)\]]*(?:\([^\s<>()]*\)[^\s<>)\]]*)*)/g,
|
|
85
|
+
hostBoundary: /[/?#:]/,
|
|
86
|
+
markdown: /\[((?:\\[\s\S]|[^\]\\])+)\]\(((?:[^()\s]+|\([^()\s]*\))+)\)/g,
|
|
87
|
+
protocolPrefix: /^https?:\/\//i,
|
|
88
|
+
trailingPunctuation: /[.,!?;:]+$/,
|
|
89
|
+
whitespace: /^\s+$/
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Public top-level domains recognized when auto-linking a scheme-less bare
|
|
93
|
+
* domain found in prose. `new URL()` accepts any syntactically valid hostname,
|
|
94
|
+
* so without this allowlist Spanish abbreviations like `EE.UU.` or
|
|
95
|
+
* end-of-sentence transitions like `China.Por` would resolve to bogus hosts and
|
|
96
|
+
* become clickable links. It covers the common gTLDs plus every assigned
|
|
97
|
+
* two-letter ccTLD; unknown suffixes such as `uu` or `por` are intentionally
|
|
98
|
+
* absent. This gates only the automatic detection path: explicit `http(s)://`
|
|
99
|
+
* URLs and links the user pastes deliberately bypass it and stay permissive.
|
|
100
|
+
*/
|
|
101
|
+
export const KNOWN_TOP_LEVEL_DOMAINS = new Set([
|
|
102
|
+
"com",
|
|
103
|
+
"net",
|
|
104
|
+
"org",
|
|
105
|
+
"info",
|
|
106
|
+
"biz",
|
|
107
|
+
"name",
|
|
108
|
+
"pro",
|
|
109
|
+
"int",
|
|
110
|
+
"edu",
|
|
111
|
+
"gov",
|
|
112
|
+
"mil",
|
|
113
|
+
"app",
|
|
114
|
+
"dev",
|
|
115
|
+
"io",
|
|
116
|
+
"co",
|
|
117
|
+
"ai",
|
|
118
|
+
"xyz",
|
|
119
|
+
"online",
|
|
120
|
+
"site",
|
|
121
|
+
"tech",
|
|
122
|
+
"store",
|
|
123
|
+
"shop",
|
|
124
|
+
"blog",
|
|
125
|
+
"me",
|
|
126
|
+
"tv",
|
|
127
|
+
"cc",
|
|
128
|
+
"live",
|
|
129
|
+
"life",
|
|
130
|
+
"world",
|
|
131
|
+
"fun",
|
|
132
|
+
"space",
|
|
133
|
+
"website",
|
|
134
|
+
"page",
|
|
135
|
+
"web",
|
|
136
|
+
"link",
|
|
137
|
+
"click",
|
|
138
|
+
"news",
|
|
139
|
+
"media",
|
|
140
|
+
"studio",
|
|
141
|
+
"design",
|
|
142
|
+
"art",
|
|
143
|
+
"email",
|
|
144
|
+
"cloud",
|
|
145
|
+
"digital",
|
|
146
|
+
"network",
|
|
147
|
+
"agency",
|
|
148
|
+
"company",
|
|
149
|
+
"group",
|
|
150
|
+
"team",
|
|
151
|
+
"work",
|
|
152
|
+
"works",
|
|
153
|
+
"today",
|
|
154
|
+
"ltd",
|
|
155
|
+
"inc",
|
|
156
|
+
"llc",
|
|
157
|
+
"academy",
|
|
158
|
+
"school",
|
|
159
|
+
"courses",
|
|
160
|
+
"education",
|
|
161
|
+
"events",
|
|
162
|
+
"social",
|
|
163
|
+
"chat",
|
|
164
|
+
"video",
|
|
165
|
+
"photo",
|
|
166
|
+
"photos",
|
|
167
|
+
"games",
|
|
168
|
+
"game",
|
|
169
|
+
"finance",
|
|
170
|
+
"money",
|
|
171
|
+
"health",
|
|
172
|
+
"fit",
|
|
173
|
+
"run",
|
|
174
|
+
"travel",
|
|
175
|
+
"tours",
|
|
176
|
+
"global",
|
|
177
|
+
"international",
|
|
178
|
+
"solutions",
|
|
179
|
+
"systems",
|
|
180
|
+
"consulting",
|
|
181
|
+
"marketing",
|
|
182
|
+
"software",
|
|
183
|
+
"host",
|
|
184
|
+
"hosting",
|
|
185
|
+
"wiki",
|
|
186
|
+
"ac",
|
|
187
|
+
"ad",
|
|
188
|
+
"ae",
|
|
189
|
+
"af",
|
|
190
|
+
"ag",
|
|
191
|
+
"al",
|
|
192
|
+
"am",
|
|
193
|
+
"ao",
|
|
194
|
+
"aq",
|
|
195
|
+
"ar",
|
|
196
|
+
"as",
|
|
197
|
+
"at",
|
|
198
|
+
"au",
|
|
199
|
+
"aw",
|
|
200
|
+
"ax",
|
|
201
|
+
"az",
|
|
202
|
+
"ba",
|
|
203
|
+
"bb",
|
|
204
|
+
"bd",
|
|
205
|
+
"be",
|
|
206
|
+
"bf",
|
|
207
|
+
"bg",
|
|
208
|
+
"bh",
|
|
209
|
+
"bi",
|
|
210
|
+
"bj",
|
|
211
|
+
"bm",
|
|
212
|
+
"bn",
|
|
213
|
+
"bo",
|
|
214
|
+
"br",
|
|
215
|
+
"bs",
|
|
216
|
+
"bt",
|
|
217
|
+
"bw",
|
|
218
|
+
"by",
|
|
219
|
+
"bz",
|
|
220
|
+
"ca",
|
|
221
|
+
"cd",
|
|
222
|
+
"cf",
|
|
223
|
+
"cg",
|
|
224
|
+
"ch",
|
|
225
|
+
"ci",
|
|
226
|
+
"ck",
|
|
227
|
+
"cl",
|
|
228
|
+
"cm",
|
|
229
|
+
"cn",
|
|
230
|
+
"cr",
|
|
231
|
+
"cu",
|
|
232
|
+
"cv",
|
|
233
|
+
"cw",
|
|
234
|
+
"cx",
|
|
235
|
+
"cy",
|
|
236
|
+
"cz",
|
|
237
|
+
"de",
|
|
238
|
+
"dj",
|
|
239
|
+
"dk",
|
|
240
|
+
"dm",
|
|
241
|
+
"do",
|
|
242
|
+
"dz",
|
|
243
|
+
"ec",
|
|
244
|
+
"ee",
|
|
245
|
+
"eg",
|
|
246
|
+
"er",
|
|
247
|
+
"es",
|
|
248
|
+
"et",
|
|
249
|
+
"eu",
|
|
250
|
+
"fi",
|
|
251
|
+
"fj",
|
|
252
|
+
"fk",
|
|
253
|
+
"fm",
|
|
254
|
+
"fo",
|
|
255
|
+
"fr",
|
|
256
|
+
"ga",
|
|
257
|
+
"gd",
|
|
258
|
+
"ge",
|
|
259
|
+
"gf",
|
|
260
|
+
"gg",
|
|
261
|
+
"gh",
|
|
262
|
+
"gi",
|
|
263
|
+
"gl",
|
|
264
|
+
"gm",
|
|
265
|
+
"gn",
|
|
266
|
+
"gp",
|
|
267
|
+
"gq",
|
|
268
|
+
"gr",
|
|
269
|
+
"gs",
|
|
270
|
+
"gt",
|
|
271
|
+
"gu",
|
|
272
|
+
"gw",
|
|
273
|
+
"gy",
|
|
274
|
+
"hk",
|
|
275
|
+
"hm",
|
|
276
|
+
"hn",
|
|
277
|
+
"hr",
|
|
278
|
+
"ht",
|
|
279
|
+
"hu",
|
|
280
|
+
"id",
|
|
281
|
+
"ie",
|
|
282
|
+
"il",
|
|
283
|
+
"im",
|
|
284
|
+
"in",
|
|
285
|
+
"iq",
|
|
286
|
+
"ir",
|
|
287
|
+
"is",
|
|
288
|
+
"it",
|
|
289
|
+
"je",
|
|
290
|
+
"jm",
|
|
291
|
+
"jo",
|
|
292
|
+
"jp",
|
|
293
|
+
"ke",
|
|
294
|
+
"kg",
|
|
295
|
+
"kh",
|
|
296
|
+
"ki",
|
|
297
|
+
"km",
|
|
298
|
+
"kn",
|
|
299
|
+
"kp",
|
|
300
|
+
"kr",
|
|
301
|
+
"kw",
|
|
302
|
+
"ky",
|
|
303
|
+
"kz",
|
|
304
|
+
"la",
|
|
305
|
+
"lb",
|
|
306
|
+
"lc",
|
|
307
|
+
"li",
|
|
308
|
+
"lk",
|
|
309
|
+
"lr",
|
|
310
|
+
"ls",
|
|
311
|
+
"lt",
|
|
312
|
+
"lu",
|
|
313
|
+
"lv",
|
|
314
|
+
"ly",
|
|
315
|
+
"ma",
|
|
316
|
+
"mc",
|
|
317
|
+
"md",
|
|
318
|
+
"mg",
|
|
319
|
+
"mh",
|
|
320
|
+
"mk",
|
|
321
|
+
"ml",
|
|
322
|
+
"mm",
|
|
323
|
+
"mn",
|
|
324
|
+
"mo",
|
|
325
|
+
"mp",
|
|
326
|
+
"mq",
|
|
327
|
+
"mr",
|
|
328
|
+
"ms",
|
|
329
|
+
"mt",
|
|
330
|
+
"mu",
|
|
331
|
+
"mv",
|
|
332
|
+
"mw",
|
|
333
|
+
"mx",
|
|
334
|
+
"my",
|
|
335
|
+
"mz",
|
|
336
|
+
"na",
|
|
337
|
+
"nc",
|
|
338
|
+
"ne",
|
|
339
|
+
"nf",
|
|
340
|
+
"ng",
|
|
341
|
+
"ni",
|
|
342
|
+
"nl",
|
|
343
|
+
"no",
|
|
344
|
+
"np",
|
|
345
|
+
"nr",
|
|
346
|
+
"nu",
|
|
347
|
+
"nz",
|
|
348
|
+
"om",
|
|
349
|
+
"pa",
|
|
350
|
+
"pe",
|
|
351
|
+
"pf",
|
|
352
|
+
"pg",
|
|
353
|
+
"ph",
|
|
354
|
+
"pk",
|
|
355
|
+
"pl",
|
|
356
|
+
"pm",
|
|
357
|
+
"pn",
|
|
358
|
+
"pr",
|
|
359
|
+
"ps",
|
|
360
|
+
"pt",
|
|
361
|
+
"pw",
|
|
362
|
+
"py",
|
|
363
|
+
"qa",
|
|
364
|
+
"re",
|
|
365
|
+
"ro",
|
|
366
|
+
"rs",
|
|
367
|
+
"ru",
|
|
368
|
+
"rw",
|
|
369
|
+
"sa",
|
|
370
|
+
"sb",
|
|
371
|
+
"sc",
|
|
372
|
+
"sd",
|
|
373
|
+
"se",
|
|
374
|
+
"sg",
|
|
375
|
+
"sh",
|
|
376
|
+
"si",
|
|
377
|
+
"sk",
|
|
378
|
+
"sl",
|
|
379
|
+
"sm",
|
|
380
|
+
"sn",
|
|
381
|
+
"so",
|
|
382
|
+
"sr",
|
|
383
|
+
"ss",
|
|
384
|
+
"st",
|
|
385
|
+
"sv",
|
|
386
|
+
"sx",
|
|
387
|
+
"sy",
|
|
388
|
+
"sz",
|
|
389
|
+
"tc",
|
|
390
|
+
"td",
|
|
391
|
+
"tf",
|
|
392
|
+
"tg",
|
|
393
|
+
"th",
|
|
394
|
+
"tj",
|
|
395
|
+
"tk",
|
|
396
|
+
"tl",
|
|
397
|
+
"tm",
|
|
398
|
+
"tn",
|
|
399
|
+
"to",
|
|
400
|
+
"tr",
|
|
401
|
+
"tt",
|
|
402
|
+
"tw",
|
|
403
|
+
"tz",
|
|
404
|
+
"ua",
|
|
405
|
+
"ug",
|
|
406
|
+
"uk",
|
|
407
|
+
"us",
|
|
408
|
+
"uy",
|
|
409
|
+
"uz",
|
|
410
|
+
"va",
|
|
411
|
+
"vc",
|
|
412
|
+
"ve",
|
|
413
|
+
"vg",
|
|
414
|
+
"vi",
|
|
415
|
+
"vn",
|
|
416
|
+
"vu",
|
|
417
|
+
"wf",
|
|
418
|
+
"ws",
|
|
419
|
+
"ye",
|
|
420
|
+
"yt",
|
|
421
|
+
"za",
|
|
422
|
+
"zm",
|
|
423
|
+
"zw"
|
|
424
|
+
]);
|
|
425
|
+
/** Capture group indexes of `LINK_PATTERN.markdown`. */
|
|
426
|
+
export const LINK_MARKDOWN_MATCH_GROUP = {
|
|
427
|
+
text: 1,
|
|
428
|
+
url: 2
|
|
429
|
+
};
|
|
430
|
+
/** Sentinel returned by the text diff when no change is found. */
|
|
431
|
+
export const TEXT_DIFF_FALLBACK_INDEX = { notFound: -1 };
|
|
432
|
+
/** Separator used to build a stable key for preview link segments. */
|
|
433
|
+
export const PREVIEW_LINK_KEY_SEPARATOR = { value: ":" };
|
|
434
|
+
/** Clipboard data type read on paste inside the editor. */
|
|
435
|
+
export const RICH_TEXT_CLIPBOARD_DATA_TYPE = { plainText: "text/plain" };
|
|
436
|
+
/** `InputEvent.inputType` values handled by the editor's `beforeInput`. */
|
|
437
|
+
export const RICH_TEXT_EDITOR_INPUT_TYPE = {
|
|
438
|
+
deleteContentBackward: "deleteContentBackward",
|
|
439
|
+
deleteContentForward: "deleteContentForward",
|
|
440
|
+
insertLineBreak: "insertLineBreak",
|
|
441
|
+
insertParagraph: "insertParagraph",
|
|
442
|
+
insertText: "insertText"
|
|
443
|
+
};
|
|
444
|
+
/** Keyboard keys handled by the editor's `keydown`. */
|
|
445
|
+
export const RICH_TEXT_EDITOR_KEY = {
|
|
446
|
+
backspace: "Backspace",
|
|
447
|
+
delete: "Delete",
|
|
448
|
+
enter: "Enter"
|
|
449
|
+
};
|
|
450
|
+
/** Direction of a word-wise deletion. */
|
|
451
|
+
export const RICH_TEXT_EDITOR_WORD_DIRECTION = {
|
|
452
|
+
backward: "backward",
|
|
453
|
+
forward: "forward"
|
|
454
|
+
};
|
|
455
|
+
/** Length of a single editable character. */
|
|
456
|
+
export const RICH_TEXT_EDITOR_KEY_LENGTH = { character: 1 };
|
|
457
|
+
/** Literal text tokens used by the editor. */
|
|
458
|
+
export const RICH_TEXT_EDITOR_TEXT = { lineBreak: "\n" };
|