@yoamigo.com/core 0.1.15 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MarkdownText-BUTYfqXS.d.ts → MarkdownText-kV5IiAma.d.ts} +3 -3
- package/dist/index.d.ts +183 -6
- package/dist/index.js +1203 -138
- package/dist/plugin.js +31 -0
- package/dist/prod.d.ts +4 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
type EditMode = 'read-only' | 'inline-edit';
|
|
5
5
|
interface ContentStore {
|
|
@@ -28,9 +28,9 @@ interface YaLinkProps {
|
|
|
28
28
|
href?: string;
|
|
29
29
|
className?: string;
|
|
30
30
|
/** Inline styles to apply to the link element */
|
|
31
|
-
style?:
|
|
31
|
+
style?: React__default.CSSProperties;
|
|
32
32
|
as?: 'a' | 'span';
|
|
33
|
-
children?:
|
|
33
|
+
children?: React__default.ReactNode;
|
|
34
34
|
/** Available pages for href dropdown (injected by template) */
|
|
35
35
|
availablePages?: PageInfo[];
|
|
36
36
|
/** Optional click handler called after navigation */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { ReactNode, CSSProperties } from 'react';
|
|
4
|
+
export { C as ContentStoreProviderProd, d as MarkdownText, e as MarkdownTextProps, P as PageInfo, b as StaticImage, c as StaticImageProps, M as StaticText, S as StaticTextProps, Y as YaLink, f as YaLinkProps, u as useContentStoreProd } from './MarkdownText-kV5IiAma.js';
|
|
4
5
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
|
5
6
|
export { Route, Switch, useParams } from 'wouter';
|
|
6
7
|
export { A as AssetResolverFn, C as ContentRegistry, c as contentRegistry, a as getAllContent, g as getContent, h as hasContent, r as registerContent, b as resolveAssetUrl, s as setAssetResolver } from './asset-resolver-BnIvDkVv.js';
|
|
@@ -26,8 +27,7 @@ interface ContentStore {
|
|
|
26
27
|
clearActiveField: () => void;
|
|
27
28
|
getPages: () => PageInfo[];
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
}
|
|
30
|
+
type ContentStoreContextType = ContentStore;
|
|
31
31
|
type ContentStoreMode = EditMode;
|
|
32
32
|
declare function useContentStore(): ContentStoreContextType;
|
|
33
33
|
interface ContentStoreProviderProps {
|
|
@@ -45,7 +45,7 @@ interface YaTextProps {
|
|
|
45
45
|
className?: string;
|
|
46
46
|
as?: YaTextElement;
|
|
47
47
|
/** Optional fallback content (used if fieldId not in store) */
|
|
48
|
-
children?:
|
|
48
|
+
children?: React__default.ReactNode;
|
|
49
49
|
}
|
|
50
50
|
declare module '@tiptap/core' {
|
|
51
51
|
interface Commands<ReturnType> {
|
|
@@ -89,6 +89,94 @@ interface YaImageProps {
|
|
|
89
89
|
declare function serializeImageValue(value: ImageFieldValue): string;
|
|
90
90
|
declare function YaImage({ fieldId, className, alt, objectFit: propObjectFit, objectPosition: propObjectPosition, loading, fallbackSrc, fallbackAlt, }: YaImageProps): react_jsx_runtime.JSX.Element;
|
|
91
91
|
|
|
92
|
+
interface VideoFieldValue {
|
|
93
|
+
/** Video source type */
|
|
94
|
+
type: 'upload' | 'youtube' | 'vimeo';
|
|
95
|
+
/** Video URL (for upload) or video ID (for embeds) */
|
|
96
|
+
src: string;
|
|
97
|
+
/** Poster image URL */
|
|
98
|
+
poster?: string;
|
|
99
|
+
/** Autoplay video (requires muted for browser policy) */
|
|
100
|
+
autoplay?: boolean;
|
|
101
|
+
/** Mute video audio */
|
|
102
|
+
muted?: boolean;
|
|
103
|
+
/** Loop video playback */
|
|
104
|
+
loop?: boolean;
|
|
105
|
+
/** Show video controls */
|
|
106
|
+
controls?: boolean;
|
|
107
|
+
/** Play inline on mobile (prevent fullscreen hijack) */
|
|
108
|
+
playsinline?: boolean;
|
|
109
|
+
/** Preload strategy */
|
|
110
|
+
preload?: 'none' | 'metadata' | 'auto';
|
|
111
|
+
/** CSS object-fit */
|
|
112
|
+
objectFit?: 'cover' | 'contain' | 'fill';
|
|
113
|
+
/** CSS aspect-ratio (e.g., "16/9") */
|
|
114
|
+
aspectRatio?: string;
|
|
115
|
+
/** Start playback at this time (seconds) */
|
|
116
|
+
startTime?: number;
|
|
117
|
+
/** End playback at this time (seconds) */
|
|
118
|
+
endTime?: number;
|
|
119
|
+
}
|
|
120
|
+
interface YaVideoProps {
|
|
121
|
+
fieldId: string;
|
|
122
|
+
className?: string;
|
|
123
|
+
/** Default aspect ratio from props */
|
|
124
|
+
aspectRatio?: string;
|
|
125
|
+
/** Default object-fit */
|
|
126
|
+
objectFit?: 'cover' | 'contain' | 'fill';
|
|
127
|
+
/** Loading strategy */
|
|
128
|
+
loading?: 'lazy' | 'eager';
|
|
129
|
+
/** Default video value (used when nothing in content store) */
|
|
130
|
+
defaultValue?: VideoFieldValue;
|
|
131
|
+
/** Fallback for backward compatibility (deprecated: use defaultValue) */
|
|
132
|
+
fallbackSrc?: string;
|
|
133
|
+
/** Fallback poster image */
|
|
134
|
+
fallbackPoster?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Serialize video field value for storage
|
|
138
|
+
*/
|
|
139
|
+
declare function serializeVideoValue(value: VideoFieldValue): string;
|
|
140
|
+
declare function YaVideo({ fieldId, className, aspectRatio: propAspectRatio, objectFit: propObjectFit, loading, defaultValue, fallbackSrc, fallbackPoster, }: YaVideoProps): react_jsx_runtime.JSX.Element;
|
|
141
|
+
|
|
142
|
+
interface BackgroundImageConfig {
|
|
143
|
+
src: string;
|
|
144
|
+
objectFit?: 'cover' | 'contain' | 'fill';
|
|
145
|
+
objectPosition?: string;
|
|
146
|
+
focalPoint?: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
interface OverlayConfig {
|
|
152
|
+
color: string;
|
|
153
|
+
opacity: number;
|
|
154
|
+
}
|
|
155
|
+
interface BackgroundConfig {
|
|
156
|
+
type: 'none' | 'color' | 'image';
|
|
157
|
+
backgroundColor?: string;
|
|
158
|
+
backgroundImage?: BackgroundImageConfig;
|
|
159
|
+
overlay?: OverlayConfig;
|
|
160
|
+
}
|
|
161
|
+
interface YaContainerProps {
|
|
162
|
+
fieldId: string;
|
|
163
|
+
className?: string;
|
|
164
|
+
style?: CSSProperties;
|
|
165
|
+
as?: 'section' | 'div' | 'article' | 'header' | 'footer' | 'main' | 'aside';
|
|
166
|
+
children: ReactNode;
|
|
167
|
+
/** Fallback background config if not in store */
|
|
168
|
+
defaultBackground?: BackgroundConfig;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Parse background config from content store
|
|
172
|
+
*/
|
|
173
|
+
declare function parseBackgroundConfig(value: string): BackgroundConfig;
|
|
174
|
+
/**
|
|
175
|
+
* Serialize background config for storage
|
|
176
|
+
*/
|
|
177
|
+
declare function serializeBackgroundConfig(config: BackgroundConfig): string;
|
|
178
|
+
declare function YaContainer({ fieldId, className, style, as: Tag, children, defaultBackground, }: YaContainerProps): react_jsx_runtime.JSX.Element;
|
|
179
|
+
|
|
92
180
|
/**
|
|
93
181
|
* SafeHtml Component - Secure HTML Renderer
|
|
94
182
|
*
|
|
@@ -106,6 +194,39 @@ interface SafeHtmlProps {
|
|
|
106
194
|
*/
|
|
107
195
|
declare function SafeHtml({ content, className, mode }: SafeHtmlProps): react_jsx_runtime.JSX.Element;
|
|
108
196
|
|
|
197
|
+
interface SafeTriangleBelowProps {
|
|
198
|
+
/** Ref to the trigger element */
|
|
199
|
+
triggerRef: React.RefObject<HTMLElement | null>;
|
|
200
|
+
/** Ref to the popover element */
|
|
201
|
+
popoverRef: React.RefObject<HTMLElement | null>;
|
|
202
|
+
/** Whether the popover is currently visible */
|
|
203
|
+
isVisible: boolean;
|
|
204
|
+
/** Called when mouse leaves the safe zone */
|
|
205
|
+
onLeave?: () => void;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* SafeTriangleBelow creates a dynamic SVG triangle between the cursor and a popover
|
|
209
|
+
* that appears below the trigger, preventing the popover from closing when users
|
|
210
|
+
* move diagonally toward it.
|
|
211
|
+
*
|
|
212
|
+
* Based on the "Safe Triangle" pattern:
|
|
213
|
+
* @see https://www.smashingmagazine.com/2023/08/better-context-menus-safe-triangles/
|
|
214
|
+
*
|
|
215
|
+
* This variant is for popovers that appear BELOW the trigger (vs SafeTriangle which
|
|
216
|
+
* is for tooltips appearing to the RIGHT).
|
|
217
|
+
*
|
|
218
|
+
* Usage:
|
|
219
|
+
* ```tsx
|
|
220
|
+
* <SafeTriangleBelow
|
|
221
|
+
* triggerRef={triggerRef}
|
|
222
|
+
* popoverRef={popoverRef}
|
|
223
|
+
* isVisible={isOpen}
|
|
224
|
+
* onLeave={() => setIsOpen(false)}
|
|
225
|
+
* />
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function SafeTriangleBelow({ triggerRef, popoverRef, isVisible, onLeave, }: SafeTriangleBelowProps): React$1.ReactPortal | null;
|
|
229
|
+
|
|
109
230
|
/**
|
|
110
231
|
* Animation state for a single field
|
|
111
232
|
*/
|
|
@@ -495,4 +616,60 @@ interface AnimatedTextOptions {
|
|
|
495
616
|
*/
|
|
496
617
|
declare function useAnimatedText(fieldId: string, content: string, options?: AnimatedTextOptions): AnimatedTextResult;
|
|
497
618
|
|
|
498
|
-
|
|
619
|
+
interface UseSafeTriangleOptions {
|
|
620
|
+
/** Delay before showing popover (ms) */
|
|
621
|
+
showDelay?: number;
|
|
622
|
+
/** Delay before hiding popover after mouse leaves (ms) */
|
|
623
|
+
hideDelay?: number;
|
|
624
|
+
/** Whether the hook is enabled (for edit mode check) */
|
|
625
|
+
enabled?: boolean;
|
|
626
|
+
}
|
|
627
|
+
interface UseSafeTriangleReturn<T extends HTMLElement, U extends HTMLElement> {
|
|
628
|
+
/** Ref to attach to the trigger element */
|
|
629
|
+
triggerRef: React.RefObject<T | null>;
|
|
630
|
+
/** Ref to attach to the popover element */
|
|
631
|
+
popoverRef: React.RefObject<U | null>;
|
|
632
|
+
/** Whether the popover should be visible */
|
|
633
|
+
isVisible: boolean;
|
|
634
|
+
/** Event handlers to spread on the trigger container */
|
|
635
|
+
handlers: {
|
|
636
|
+
onMouseEnter: () => void;
|
|
637
|
+
onMouseLeave: () => void;
|
|
638
|
+
onFocus: () => void;
|
|
639
|
+
};
|
|
640
|
+
/** Props to spread on the SafeTriangleBelow component */
|
|
641
|
+
triangleProps: {
|
|
642
|
+
triggerRef: React.RefObject<T | null>;
|
|
643
|
+
popoverRef: React.RefObject<U | null>;
|
|
644
|
+
isVisible: boolean;
|
|
645
|
+
onLeave: () => void;
|
|
646
|
+
};
|
|
647
|
+
/** Manually show the popover */
|
|
648
|
+
show: () => void;
|
|
649
|
+
/** Manually hide the popover */
|
|
650
|
+
hide: () => void;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Hook for managing safe triangle popover state.
|
|
654
|
+
* Handles show/hide delays and provides all necessary refs and handlers.
|
|
655
|
+
*
|
|
656
|
+
* @example
|
|
657
|
+
* ```tsx
|
|
658
|
+
* const { triggerRef, popoverRef, isVisible, handlers, triangleProps } = useSafeTriangle()
|
|
659
|
+
*
|
|
660
|
+
* return (
|
|
661
|
+
* <div>
|
|
662
|
+
* <a ref={triggerRef} {...handlers}>
|
|
663
|
+
* Hover me
|
|
664
|
+
* </a>
|
|
665
|
+
* {isVisible && (
|
|
666
|
+
* <div ref={popoverRef}>Popover content</div>
|
|
667
|
+
* )}
|
|
668
|
+
* <SafeTriangleBelow {...triangleProps} />
|
|
669
|
+
* </div>
|
|
670
|
+
* )
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
declare function useSafeTriangle<T extends HTMLElement = HTMLElement, U extends HTMLElement = HTMLDivElement>(options?: UseSafeTriangleOptions): UseSafeTriangleReturn<T, U>;
|
|
674
|
+
|
|
675
|
+
export { type AIEditContextValue, AIEditProvider, type AnimatedTextOptions, type AnimatedTextResult, type AnimationConfig, type AnimationMetadata, type AnimationOptions, type AnimationPhase, type AnimationResult, type AnimationState, type AnimationStrategy, type BackgroundConfig, type BackgroundImageConfig, type ContentStoreContextType, type ContentStoreMode, ContentStoreProvider, type ImageFieldValue, type ImageValue, type LinkValue, type OverlayConfig, SafeHtml, type SafeHtmlProps, SafeTriangleBelow, type TextAnimationMetadata, type TextDiff, type VideoFieldValue, YaContainer, type YaContainerProps, YaImage, type YaImageProps, YaText, type YaTextProps, YaVideo, type YaVideoProps, buildIntermediateText, calculateAnimationTiming, computeTextDiff, containsHtml, getTextCursorPosition, imageCrossfadeStrategy, linkTransitionStrategy, parseBackgroundConfig, serializeBackgroundConfig, serializeImageValue, serializeVideoValue, stripHtml, textTypingStrategy, useAIEditAnimation, useAIEditContext, useAIEditContextOptional, useAnimatedText, useContentStore, useSafeTriangle };
|