@orca-pt/orca-components 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +473 -0
  3. package/dist/components/ContentElement.vue.d.ts +21 -0
  4. package/dist/components/OrcaMarkdown.vue.d.ts +15 -0
  5. package/dist/components/loading/CardLoading.vue.d.ts +9 -0
  6. package/dist/components/loading/GeneralLoading.vue.d.ts +11 -0
  7. package/dist/components/loading/ImageLoading.vue.d.ts +9 -0
  8. package/dist/components/loading/MapLoading.vue.d.ts +9 -0
  9. package/dist/components/loading/VideoLoading.vue.d.ts +9 -0
  10. package/dist/components/renderers/OrcaAudio.vue.d.ts +11 -0
  11. package/dist/components/renderers/OrcaButtons.vue.d.ts +16 -0
  12. package/dist/components/renderers/OrcaCardList.vue.d.ts +11 -0
  13. package/dist/components/renderers/OrcaImage.vue.d.ts +14 -0
  14. package/dist/components/renderers/OrcaLocation.vue.d.ts +13 -0
  15. package/dist/components/renderers/OrcaTracing.vue.d.ts +13 -0
  16. package/dist/components/renderers/OrcaVideo.vue.d.ts +11 -0
  17. package/dist/components/renderers/OrcaYouTube.vue.d.ts +10 -0
  18. package/dist/composables/__tests__/useContentParser.test.d.ts +1 -0
  19. package/dist/composables/core/index.d.ts +3 -0
  20. package/dist/composables/core/matchFinder.d.ts +13 -0
  21. package/dist/composables/core/matchProcessor.d.ts +9 -0
  22. package/dist/composables/core/recursiveParser.d.ts +6 -0
  23. package/dist/composables/parsers/__tests__/parsers.test.d.ts +1 -0
  24. package/dist/composables/parsers/baseParser.d.ts +34 -0
  25. package/dist/composables/parsers/index.d.ts +5 -0
  26. package/dist/composables/parsers/parseAudio.d.ts +2 -0
  27. package/dist/composables/parsers/parseButton.d.ts +2 -0
  28. package/dist/composables/parsers/parseCard.d.ts +2 -0
  29. package/dist/composables/parsers/parseLocation.d.ts +11 -0
  30. package/dist/composables/parsers/parseTracing.d.ts +9 -0
  31. package/dist/composables/parsing/index.d.ts +8 -0
  32. package/dist/composables/parsing/markerCleaner.d.ts +15 -0
  33. package/dist/composables/parsing/markerDefinitions.d.ts +20 -0
  34. package/dist/composables/parsing/markerOperations.d.ts +27 -0
  35. package/dist/composables/parsing/markerUtils.d.ts +58 -0
  36. package/dist/composables/useCodeButtons.d.ts +8 -0
  37. package/dist/composables/useContentParser.d.ts +12 -0
  38. package/dist/composables/useImageModal.d.ts +10 -0
  39. package/dist/composables/useLoadingStates.d.ts +13 -0
  40. package/dist/composables/useMarkdown.d.ts +8 -0
  41. package/dist/constants/loadingTypes.d.ts +9 -0
  42. package/dist/index.d.ts +16 -0
  43. package/dist/orca-components.css +13 -0
  44. package/dist/orca-components.es.js +1851 -0
  45. package/dist/orca-components.es.js.map +1 -0
  46. package/dist/orca-components.umd.js +2 -0
  47. package/dist/orca-components.umd.js.map +1 -0
  48. package/dist/types/index.d.ts +128 -0
  49. package/dist/utils/helpers.d.ts +48 -0
  50. package/package.json +83 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * OrcaYouTube - Renders YouTube video embed
3
+ * Converts YouTube URLs to embed format and displays in iframe
4
+ */
5
+ type __VLS_Props = {
6
+ url: string;
7
+ };
8
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { findMatches, type MatchCandidate, type ValidMatch, } from "./matchFinder";
2
+ export { processMatch } from "./matchProcessor";
3
+ export { parseContentRecursively } from "./recursiveParser";
@@ -0,0 +1,13 @@
1
+ import type { ContentPartType } from "../../types";
2
+ export type MatchCandidate = {
3
+ type: ContentPartType;
4
+ match: RegExpMatchArray | null;
5
+ index: number;
6
+ };
7
+ export type ValidMatch = MatchCandidate & {
8
+ match: RegExpMatchArray;
9
+ };
10
+ /**
11
+ * Find all matches in content
12
+ */
13
+ export declare function findMatches(content: string): ValidMatch[];
@@ -0,0 +1,9 @@
1
+ import type { ContentPart, ContentPartType } from "../../types";
2
+ /**
3
+ * Process match and return content part
4
+ *
5
+ * @param type - Content type to process
6
+ * @param payload - Content payload
7
+ * @returns ContentPart or null for loading types
8
+ */
9
+ export declare function processMatch(type: ContentPartType, payload: string): ContentPart | null;
@@ -0,0 +1,6 @@
1
+ import type { ContentPart } from "../../types";
2
+ /**
3
+ * Parse content recursively to extract all parts
4
+ * Used when extracting content from inside loading markers
5
+ */
6
+ export declare function parseContentRecursively(content: string): ContentPart[];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Base Parser Utilities
3
+ * Common logic for all YAML-like parsers
4
+ */
5
+ /**
6
+ * Field definition for parsing
7
+ */
8
+ export type FieldDef = {
9
+ name: string;
10
+ type?: "string" | "number";
11
+ required?: boolean;
12
+ defaultValue?: any;
13
+ };
14
+ /**
15
+ * Parse YAML-like list format into array of objects
16
+ *
17
+ * @example
18
+ * ```
19
+ * - field1: value1
20
+ * field2: value2
21
+ * - field1: value3 field2: value4
22
+ * ```
23
+ */
24
+ export declare function parseYamlList<T>(payload: string, fields: FieldDef[], mapper: (extracted: Record<string, any>) => T): T[];
25
+ /**
26
+ * Parse simple key-value format
27
+ *
28
+ * @example
29
+ * ```
30
+ * key1: value1
31
+ * key2: value2
32
+ * ```
33
+ */
34
+ export declare function parseKeyValue(payload: string, fields: string[]): Record<string, string>;
@@ -0,0 +1,5 @@
1
+ export { parseCard } from "./parseCard";
2
+ export { parseButton } from "./parseButton";
3
+ export { parseAudio } from "./parseAudio";
4
+ export { parseLocation } from "./parseLocation";
5
+ export { parseTracing } from "./parseTracing";
@@ -0,0 +1,2 @@
1
+ import type { AudioData } from "../../types";
2
+ export declare function parseAudio(payload: string): AudioData[];
@@ -0,0 +1,2 @@
1
+ import type { ButtonData } from "../../types";
2
+ export declare function parseButton(payload: string): ButtonData[];
@@ -0,0 +1,2 @@
1
+ import type { CardData } from "../../types";
2
+ export declare function parseCard(payload: string): CardData[];
@@ -0,0 +1,11 @@
1
+ import type { LocationData } from "../../types";
2
+ /**
3
+ * Parse location data from comma-separated coordinates
4
+ *
5
+ * @template
6
+ * 35.6892, 51.3890
7
+ *
8
+ * @example
9
+ * "35.6892, 51.3890" -> { latitude: 35.6892, longitude: 51.3890 }
10
+ */
11
+ export declare function parseLocation(payload: string): LocationData;
@@ -0,0 +1,9 @@
1
+ import type { TracingData } from "../../types";
2
+ /**
3
+ * Parse tracing data from YAML-like format
4
+ *
5
+ * @template
6
+ * visibility: all
7
+ * content: {"request_id": "req_123", "status": "success"}
8
+ */
9
+ export declare function parseTracing(payload: string): TracingData;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Utils Module Exports
3
+ * Clean separation of concerns
4
+ */
5
+ export { MARKERS, GENERAL_LOADING_TYPES, type MarkerConfig, } from "./markerDefinitions";
6
+ export { escapeRegex, createMarkerPattern, generatePatterns, filterMarkers, getMarkerByType, isLoadingType, isGeneralLoadingType, getMarkersByCategory, getGeneralLoadingMarkers, getContentMarkers, CONTENT_PATTERNS, type PatternDefinition, } from "./markerUtils";
7
+ export { removeMarkers, removeLoadingMarkers, removeContentMarkers, removeAllMarkers, } from "./markerOperations";
8
+ export { removeOnlyLoadingMarkers, removeCompleteMarkers, } from "./markerCleaner";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Marker Cleaner Facade
3
+ * Provides convenient API using pure functions from markerOperations
4
+ */
5
+ /**
6
+ * Remove only loading markers (preserves content between them)
7
+ * Used when processing complete loading blocks
8
+ */
9
+ export declare function removeOnlyLoadingMarkers(content: string): string;
10
+ /**
11
+ * Remove complete markers (with both start and end)
12
+ * Preserves incomplete loading markers (only start, no end)
13
+ * Used for cleaning text before matches
14
+ */
15
+ export declare function removeCompleteMarkers(content: string): string;
@@ -0,0 +1,20 @@
1
+ import type { ContentPartType } from "../../types";
2
+ /**
3
+ * Marker Types - Pure Data
4
+ * No logic, just type definitions
5
+ */
6
+ export type MarkerConfig = {
7
+ type: ContentPartType;
8
+ start: string;
9
+ end: string;
10
+ };
11
+ /**
12
+ * All marker definitions - Single Source of Truth
13
+ * ONLY data, no functions
14
+ */
15
+ export declare const MARKERS: MarkerConfig[];
16
+ /**
17
+ * General loading type names - Derived from MARKERS
18
+ * Single source of truth for general loading types
19
+ */
20
+ export declare const GENERAL_LOADING_TYPES: readonly ["general-loading", "thinking-loading", "searching-loading", "coding-loading", "analyzing-loading", "generating-loading", "custom-loading"];
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Marker Cleaner - Pure Operations
3
+ * All functions are pure, stateless, and composable
4
+ */
5
+ import type { MarkerConfig } from "./markerDefinitions";
6
+ /**
7
+ * Remove markers from content
8
+ * @param content - Content to clean
9
+ * @param markers - Markers to remove
10
+ * @param preserveContent - Keep content between markers or remove entirely
11
+ */
12
+ export declare function removeMarkers(content: string, markers: MarkerConfig[], preserveContent?: boolean): string;
13
+ /**
14
+ * Remove only loading markers (preserves content between them)
15
+ */
16
+ export declare function removeLoadingMarkers(content: string, loadingMarkers: MarkerConfig[]): string;
17
+ /**
18
+ * Remove content markers (removes everything)
19
+ */
20
+ export declare function removeContentMarkers(content: string, contentMarkers: MarkerConfig[]): string;
21
+ /**
22
+ * Remove all markers with different strategies
23
+ * @param content - Content to clean
24
+ * @param loadingMarkers - Loading markers (preserve content)
25
+ * @param contentMarkers - Content markers (remove everything)
26
+ */
27
+ export declare function removeAllMarkers(content: string, loadingMarkers: MarkerConfig[], contentMarkers: MarkerConfig[]): string;
@@ -0,0 +1,58 @@
1
+ import type { ContentPartType } from "../../types";
2
+ import { type MarkerConfig } from "./markerDefinitions";
3
+ /**
4
+ * Marker Utilities - Pure Functions
5
+ * No side effects, stateless
6
+ */
7
+ /**
8
+ * Escape special regex characters
9
+ */
10
+ export declare function escapeRegex(str: string): string;
11
+ /**
12
+ * Create regex pattern from marker config
13
+ */
14
+ export declare function createMarkerPattern(config: MarkerConfig): RegExp;
15
+ /**
16
+ * Pattern definition for matching
17
+ */
18
+ export type PatternDefinition = {
19
+ type: ContentPartType;
20
+ regex: RegExp;
21
+ };
22
+ /**
23
+ * Generate patterns from markers
24
+ */
25
+ export declare function generatePatterns(markers: MarkerConfig[]): PatternDefinition[];
26
+ /**
27
+ * Auto-generated patterns from marker configs
28
+ */
29
+ export declare const CONTENT_PATTERNS: PatternDefinition[];
30
+ /**
31
+ * Filter markers by predicate
32
+ */
33
+ export declare function filterMarkers(markers: MarkerConfig[], predicate: (marker: MarkerConfig) => boolean): MarkerConfig[];
34
+ /**
35
+ * Get marker config by type
36
+ */
37
+ export declare function getMarkerByType(markers: MarkerConfig[], type: ContentPartType): MarkerConfig | undefined;
38
+ /**
39
+ * Check if type is loading type
40
+ */
41
+ export declare function isLoadingType(type: ContentPartType): boolean;
42
+ /**
43
+ * Check if type is general loading type
44
+ * Uses the centralized list from markerDefinitions
45
+ */
46
+ export declare function isGeneralLoadingType(type: ContentPartType): boolean;
47
+ /**
48
+ * Get markers by category
49
+ */
50
+ export declare function getMarkersByCategory(markers: MarkerConfig[], category: "loading" | "content"): MarkerConfig[];
51
+ /**
52
+ * Get general loading markers
53
+ */
54
+ export declare function getGeneralLoadingMarkers(markers: MarkerConfig[]): MarkerConfig[];
55
+ /**
56
+ * Get content markers (non-loading)
57
+ */
58
+ export declare function getContentMarkers(markers: MarkerConfig[]): MarkerConfig[];
@@ -0,0 +1,8 @@
1
+ import { type Ref } from "vue";
2
+ /**
3
+ * Composable for managing code block copy/collapse buttons
4
+ * Optimized with debouncing and efficient DOM manipulation
5
+ */
6
+ export declare function useCodeButtons(containerRef: Ref<HTMLElement | null>, shouldAddButtons: () => boolean): {
7
+ addCodeButtons: () => void;
8
+ };
@@ -0,0 +1,12 @@
1
+ import { type ComputedRef, type MaybeRef } from "vue";
2
+ import type { ContentPart } from "../types";
3
+ /**
4
+ * Composable for parsing Orca content markers
5
+ * Supports both reactive and non-reactive values for streaming compatibility
6
+ */
7
+ export declare function useContentParser(description: MaybeRef<string>): ComputedRef<ContentPart[]>;
8
+ /**
9
+ * Parse content into parts
10
+ * Extracted for testability
11
+ */
12
+ export declare function parseContent(content: string): ContentPart[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Composable for managing image modal state
3
+ * Provides clean API for opening/closing image modals
4
+ */
5
+ export declare function useImageModal(): {
6
+ modalVisible: import("vue").Ref<boolean, boolean>;
7
+ currentImage: import("vue").Ref<string, string>;
8
+ openModal: (imageUrl: string) => void;
9
+ closeModal: () => void;
10
+ };
@@ -0,0 +1,13 @@
1
+ import { type MaybeRef } from "vue";
2
+ /**
3
+ * Composable for managing loading states
4
+ * Optimized with computed properties and memoization
5
+ */
6
+ export declare function useLoadingStates(description: MaybeRef<string>): {
7
+ isLoading: import("vue").Ref<boolean, boolean>;
8
+ isImageLoading: import("vue").Ref<boolean, boolean>;
9
+ isVideoLoading: import("vue").Ref<boolean, boolean>;
10
+ isCardLoading: import("vue").Ref<boolean, boolean>;
11
+ isLocationLoading: import("vue").Ref<boolean, boolean>;
12
+ getLoadingMessage: (loadingType: string) => string;
13
+ };
@@ -0,0 +1,8 @@
1
+ import "highlight.js/styles/stackoverflow-light.css";
2
+ import "katex/dist/katex.min.css";
3
+ /**
4
+ * Composable for rendering markdown with KaTeX support
5
+ */
6
+ export declare function useMarkdown(): {
7
+ render: (text: string) => string;
8
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Loading content part types that should be filtered out
3
+ * These are handled separately in the loading indicators section
4
+ */
5
+ export declare const LOADING_CONTENT_TYPES: readonly ["general-loading", "thinking-loading", "searching-loading", "coding-loading", "analyzing-loading", "generating-loading", "custom-loading", "image-loading", "video-loading", "youtube-loading", "card-loading", "map-loading"];
6
+ /**
7
+ * Type guard to check if a content part is a loading type
8
+ */
9
+ export declare function isLoadingType(type: string): type is (typeof LOADING_CONTENT_TYPES)[number];
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Orca Components
3
+ * Native components for rendering special content markers
4
+ * @packageDocumentation
5
+ */
6
+ import "./styles/tailwind.css";
7
+ export { default as OrcaMarkdown } from "./components/OrcaMarkdown.vue";
8
+ export type { AudioData, ButtonData, CardData, ContentPart, ContentPartType, GetFileNameFromUrlFn, GetYouTubeIdFn, IsImageFileFn, OrcaMarkdownEmits, OrcaMarkdownProps, LocationData, MapboxConfig, SendMessageData, TracingData, VideoPlayerOptions, } from "./types";
9
+ export { cleanOrcaMarkers, generateMapId, getAppendIconStyle, getFileNameFromUrl, getGroupedButtons, getOutlinedButtonStyle, getOutlinedButtonTextStyle, getVuetifyColor, getYouTubeId, hasLoadingMarkers, isImageFile, } from "./utils/helpers";
10
+ export declare const version = "1.0.1";
11
+ export declare const packageInfo: {
12
+ name: string;
13
+ version: string;
14
+ description: string;
15
+ author: string;
16
+ };