@yoamigo.com/core 0.1.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/LICENSE +11 -0
- package/README.md +81 -0
- package/dist/MarkdownText-mylt-QX-.d.ts +106 -0
- package/dist/api-client-D8FkeBAI.d.ts +40 -0
- package/dist/asset-resolver-BnIvDkVv.d.ts +72 -0
- package/dist/builder-selection-CYP91nRu.d.ts +6 -0
- package/dist/index.css +372 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +2579 -0
- package/dist/lib-prod.d.ts +13 -0
- package/dist/lib-prod.js +108 -0
- package/dist/lib.d.ts +84 -0
- package/dist/lib.js +736 -0
- package/dist/plugin.d.ts +47 -0
- package/dist/plugin.js +96 -0
- package/dist/prod.d.ts +31 -0
- package/dist/prod.js +295 -0
- package/dist/router.d.ts +46 -0
- package/dist/router.js +42 -0
- package/package.json +115 -0
- package/src/styles/index.css +5 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
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-mylt-QX-.js';
|
|
4
|
+
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
|
5
|
+
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';
|
|
6
|
+
export { i as initBuilderSelection } from './builder-selection-CYP91nRu.js';
|
|
7
|
+
|
|
8
|
+
type EditMode = 'read-only' | 'inline-edit';
|
|
9
|
+
interface PageInfo {
|
|
10
|
+
path: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
interface ActiveFieldCallbacks {
|
|
14
|
+
close: () => void;
|
|
15
|
+
}
|
|
16
|
+
interface ContentStore {
|
|
17
|
+
getValue: (fieldId: string) => string;
|
|
18
|
+
setValue: (fieldId: string, value: string) => void;
|
|
19
|
+
mode: EditMode;
|
|
20
|
+
setMode: (mode: EditMode) => void;
|
|
21
|
+
subscribe: (listener: () => void) => () => void;
|
|
22
|
+
saveToWorker?: (fieldId: string, value: string) => Promise<void>;
|
|
23
|
+
activeFieldId: string | null;
|
|
24
|
+
setActiveField: (fieldId: string, callbacks: ActiveFieldCallbacks) => void;
|
|
25
|
+
clearActiveField: () => void;
|
|
26
|
+
getPages: () => PageInfo[];
|
|
27
|
+
}
|
|
28
|
+
interface ContentStoreContextType extends ContentStore {
|
|
29
|
+
}
|
|
30
|
+
type ContentStoreMode = EditMode;
|
|
31
|
+
declare function useContentStore(): ContentStoreContextType;
|
|
32
|
+
interface ContentStoreProviderProps {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
initialContent?: Record<string, string>;
|
|
35
|
+
initialMode?: EditMode;
|
|
36
|
+
pages?: PageInfo[];
|
|
37
|
+
}
|
|
38
|
+
declare function ContentStoreProvider({ children, initialContent, initialMode, pages, }: ContentStoreProviderProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
|
|
40
|
+
/** Common HTML elements that YaText can render as */
|
|
41
|
+
type YaTextElement = 'span' | 'div' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label' | 'strong' | 'em';
|
|
42
|
+
interface YaTextProps {
|
|
43
|
+
fieldId: string;
|
|
44
|
+
className?: string;
|
|
45
|
+
as?: YaTextElement;
|
|
46
|
+
/** Optional fallback content (used if fieldId not in store) */
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
declare module '@tiptap/core' {
|
|
50
|
+
interface Commands<ReturnType> {
|
|
51
|
+
fontSize: {
|
|
52
|
+
setFontSize: (fontSize: string) => ReturnType;
|
|
53
|
+
unsetFontSize: () => ReturnType;
|
|
54
|
+
};
|
|
55
|
+
fontWeight: {
|
|
56
|
+
setFontWeight: (fontWeight: string) => ReturnType;
|
|
57
|
+
unsetFontWeight: () => ReturnType;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
declare function YaText({ fieldId, className, as: Component, children }: YaTextProps): react_jsx_runtime.JSX.Element;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* YaImage Component - Inline image editing
|
|
65
|
+
*
|
|
66
|
+
* Features:
|
|
67
|
+
* - Read mode: Renders image statically
|
|
68
|
+
* - Edit mode: Click to open image editor panel in parent
|
|
69
|
+
* - Supports: objectFit, objectPosition, focalPoint
|
|
70
|
+
* - Stores content as JSON in content.json
|
|
71
|
+
* - Protected from AI structural changes (data-ya-restricted="true")
|
|
72
|
+
*/
|
|
73
|
+
interface ImageFieldValue {
|
|
74
|
+
src: string;
|
|
75
|
+
alt?: string;
|
|
76
|
+
objectFit?: 'cover' | 'contain' | 'fill';
|
|
77
|
+
objectPosition?: string;
|
|
78
|
+
focalPoint?: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface YaImageProps {
|
|
84
|
+
fieldId: string;
|
|
85
|
+
className?: string;
|
|
86
|
+
alt?: string;
|
|
87
|
+
objectFit?: 'cover' | 'contain' | 'fill';
|
|
88
|
+
objectPosition?: string;
|
|
89
|
+
loading?: 'lazy' | 'eager';
|
|
90
|
+
/** Fallback for backward compatibility with config.ts images */
|
|
91
|
+
fallbackSrc?: string;
|
|
92
|
+
/** Fallback alt text */
|
|
93
|
+
fallbackAlt?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Serialize image field value for storage
|
|
97
|
+
*/
|
|
98
|
+
declare function serializeImageValue(value: ImageFieldValue): string;
|
|
99
|
+
declare function YaImage({ fieldId, className, alt, objectFit: propObjectFit, objectPosition: propObjectPosition, loading, fallbackSrc, fallbackAlt, }: YaImageProps): react_jsx_runtime.JSX.Element;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* SafeHtml Component - Secure HTML Renderer
|
|
103
|
+
*
|
|
104
|
+
* Renders HTML content safely using DOMPurify sanitization.
|
|
105
|
+
* Only allows specific tags and inline styles for font formatting.
|
|
106
|
+
* In builder mode, shows a hover popover on links for navigation.
|
|
107
|
+
*/
|
|
108
|
+
interface SafeHtmlProps {
|
|
109
|
+
content: string;
|
|
110
|
+
className?: string;
|
|
111
|
+
mode?: 'read-only' | 'inline-edit';
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Sanitize HTML and render it safely
|
|
115
|
+
*/
|
|
116
|
+
declare function SafeHtml({ content, className, mode }: SafeHtmlProps): react_jsx_runtime.JSX.Element;
|
|
117
|
+
|
|
118
|
+
export { type ContentStoreContextType, type ContentStoreMode, ContentStoreProvider, type ImageFieldValue, SafeHtml, type SafeHtmlProps, YaImage, type YaImageProps, YaText, type YaTextProps, serializeImageValue, useContentStore };
|