@yoamigo.com/core 0.1.12 → 0.1.14
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-mylt-QX-.d.ts → MarkdownText-BUTYfqXS.d.ts} +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -8
- package/dist/plugin.js +2 -2
- package/dist/prod.d.ts +5 -3
- package/dist/prod.js +5 -3
- package/dist/router.d.ts +1 -1
- package/dist/router.js +3 -2
- package/package.json +1 -1
|
@@ -27,12 +27,18 @@ interface YaLinkProps {
|
|
|
27
27
|
/** Default href if not set in content store */
|
|
28
28
|
href?: string;
|
|
29
29
|
className?: string;
|
|
30
|
+
/** Inline styles to apply to the link element */
|
|
31
|
+
style?: React$1.CSSProperties;
|
|
30
32
|
as?: 'a' | 'span';
|
|
31
33
|
children?: React$1.ReactNode;
|
|
32
34
|
/** Available pages for href dropdown (injected by template) */
|
|
33
35
|
availablePages?: PageInfo[];
|
|
34
36
|
/** Optional click handler called after navigation */
|
|
35
37
|
onClick?: () => void;
|
|
38
|
+
/** Target attribute for the link (e.g., "_blank" to open in new tab) */
|
|
39
|
+
target?: string;
|
|
40
|
+
/** Rel attribute for the link (e.g., "noopener noreferrer" for security) */
|
|
41
|
+
rel?: string;
|
|
36
42
|
}
|
|
37
43
|
declare module '@tiptap/core' {
|
|
38
44
|
interface Commands<ReturnType> {
|
|
@@ -46,7 +52,7 @@ declare module '@tiptap/core' {
|
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
|
-
declare function YaLink({ fieldId, href: defaultHref, className, as: Component, children, availablePages, onClick }: YaLinkProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare function YaLink({ fieldId, href: defaultHref, className, style, as: Component, children, availablePages, onClick, target, rel }: YaLinkProps): react_jsx_runtime.JSX.Element;
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
58
|
* StaticText Component - Production-only static text renderer
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
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-
|
|
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-BUTYfqXS.js';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
|
5
|
-
export { Route, Switch } from 'wouter';
|
|
5
|
+
export { Route, Switch, useParams } from 'wouter';
|
|
6
6
|
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';
|
|
7
7
|
export { i as initBuilderSelection } from './builder-selection-CYP91nRu.js';
|
|
8
8
|
|
package/dist/index.js
CHANGED
|
@@ -1824,7 +1824,8 @@ body.builder-selector-active .ya-text-editable:hover {
|
|
|
1824
1824
|
color: var(--color-secondary, #5C4033);
|
|
1825
1825
|
}
|
|
1826
1826
|
.ProseMirror ::selection {
|
|
1827
|
-
background: rgba(212, 165, 116, 0.3);
|
|
1827
|
+
background: rgba(212, 165, 116, 0.3) !important;
|
|
1828
|
+
color: inherit !important;
|
|
1828
1829
|
}
|
|
1829
1830
|
.ProseMirror p.is-editor-empty:first-child::before {
|
|
1830
1831
|
content: attr(data-placeholder);
|
|
@@ -2516,6 +2517,16 @@ function getObjectPosition(imageData) {
|
|
|
2516
2517
|
return imageData.objectPosition || "50% 50%";
|
|
2517
2518
|
}
|
|
2518
2519
|
var SMALL_IMAGE_THRESHOLD = 100;
|
|
2520
|
+
var PLACEHOLDER_SVG = `data:image/svg+xml,${encodeURIComponent(`
|
|
2521
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300" viewBox="0 0 400 300">
|
|
2522
|
+
<rect fill="#e5e7eb" width="400" height="300"/>
|
|
2523
|
+
<g fill="#9ca3af" transform="translate(175, 125)">
|
|
2524
|
+
<rect x="3" y="3" width="44" height="44" rx="4" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
2525
|
+
<circle cx="15" cy="15" r="4" fill="currentColor"/>
|
|
2526
|
+
<path d="M47 35 L32 20 L17 35 L12 30 L3 39 L3 43 L47 43 Z" fill="currentColor"/>
|
|
2527
|
+
</g>
|
|
2528
|
+
</svg>
|
|
2529
|
+
`)}`;
|
|
2519
2530
|
function YaImage({
|
|
2520
2531
|
fieldId,
|
|
2521
2532
|
className,
|
|
@@ -2534,7 +2545,7 @@ function YaImage({
|
|
|
2534
2545
|
const [isSmallImage, setIsSmallImage] = useState6(false);
|
|
2535
2546
|
const rawValue = getValue(fieldId);
|
|
2536
2547
|
const imageData = parseImageValue(rawValue);
|
|
2537
|
-
const src = imageData.src || fallbackSrc ||
|
|
2548
|
+
const src = imageData.src || fallbackSrc || PLACEHOLDER_SVG;
|
|
2538
2549
|
const altText = imageData.alt || alt || fallbackAlt || "";
|
|
2539
2550
|
const objectFit = imageData.objectFit || propObjectFit || "cover";
|
|
2540
2551
|
const objectPosition = getObjectPosition(imageData) || propObjectPosition || "50% 50%";
|
|
@@ -2745,6 +2756,12 @@ function isInternalPath(path) {
|
|
|
2745
2756
|
if (path.startsWith("mailto:") || path.startsWith("tel:")) return false;
|
|
2746
2757
|
return path.startsWith("/");
|
|
2747
2758
|
}
|
|
2759
|
+
function isExternalHref(url) {
|
|
2760
|
+
if (!url) return false;
|
|
2761
|
+
if (url.startsWith("//")) return true;
|
|
2762
|
+
if (url.startsWith("http://") || url.startsWith("https://")) return true;
|
|
2763
|
+
return false;
|
|
2764
|
+
}
|
|
2748
2765
|
var FontSize2 = Extension2.create({
|
|
2749
2766
|
name: "fontSize",
|
|
2750
2767
|
addOptions() {
|
|
@@ -2827,7 +2844,7 @@ function discoverSectionsFromDOM() {
|
|
|
2827
2844
|
});
|
|
2828
2845
|
return sections;
|
|
2829
2846
|
}
|
|
2830
|
-
function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "a", children, availablePages, onClick }) {
|
|
2847
|
+
function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Component = "a", children, availablePages, onClick, target, rel }) {
|
|
2831
2848
|
const { getValue, setValue, mode, saveToWorker, getPages } = useContentStore();
|
|
2832
2849
|
const [, navigate] = useLocation();
|
|
2833
2850
|
const pages = availablePages ?? getPages();
|
|
@@ -2840,6 +2857,9 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
2840
2857
|
const isIconMode = children != null && typeof children !== "string";
|
|
2841
2858
|
const text = storeText || (typeof children === "string" ? children : "");
|
|
2842
2859
|
const href = storeHref || defaultHref;
|
|
2860
|
+
const isExternal = isExternalHref(href);
|
|
2861
|
+
const effectiveTarget = target ?? (isExternal ? "_blank" : void 0);
|
|
2862
|
+
const effectiveRel = rel ?? (isExternal ? "noopener noreferrer" : void 0);
|
|
2843
2863
|
const [editingMode, setEditingMode] = useState7(null);
|
|
2844
2864
|
const [showEditPopover, setShowEditPopover] = useState7(false);
|
|
2845
2865
|
const [originalText, setOriginalText] = useState7(text);
|
|
@@ -2894,9 +2914,9 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
2894
2914
|
useEffect7(() => {
|
|
2895
2915
|
if (editingMode !== "link") return;
|
|
2896
2916
|
const handleClickOutside = (event) => {
|
|
2897
|
-
const
|
|
2898
|
-
if (hrefPopoverRef.current?.contains(
|
|
2899
|
-
if (containerRef.current?.contains(
|
|
2917
|
+
const target2 = event.target;
|
|
2918
|
+
if (hrefPopoverRef.current?.contains(target2)) return;
|
|
2919
|
+
if (containerRef.current?.contains(target2)) return;
|
|
2900
2920
|
setCurrentHref(originalHref);
|
|
2901
2921
|
setEditingMode(null);
|
|
2902
2922
|
setIsExternalUrl(false);
|
|
@@ -3072,6 +3092,7 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3072
3092
|
{
|
|
3073
3093
|
href,
|
|
3074
3094
|
className,
|
|
3095
|
+
style,
|
|
3075
3096
|
"data-ya-restricted": "true",
|
|
3076
3097
|
"data-field-id": fieldId,
|
|
3077
3098
|
children: content
|
|
@@ -3083,7 +3104,10 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3083
3104
|
{
|
|
3084
3105
|
ref: containerRef,
|
|
3085
3106
|
href: Component === "a" ? href : void 0,
|
|
3107
|
+
target: Component === "a" ? effectiveTarget : void 0,
|
|
3108
|
+
rel: Component === "a" ? effectiveRel : void 0,
|
|
3086
3109
|
className,
|
|
3110
|
+
style,
|
|
3087
3111
|
"data-ya-restricted": "true",
|
|
3088
3112
|
"data-field-id": fieldId,
|
|
3089
3113
|
children: content
|
|
@@ -3096,7 +3120,10 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3096
3120
|
{
|
|
3097
3121
|
ref: containerRef,
|
|
3098
3122
|
href: Component === "a" ? href : void 0,
|
|
3123
|
+
target: Component === "a" ? effectiveTarget : void 0,
|
|
3124
|
+
rel: Component === "a" ? effectiveRel : void 0,
|
|
3099
3125
|
className: `${className || ""} ${editingMode ? "ya-link-editing" : "ya-link-editable"}`,
|
|
3126
|
+
style,
|
|
3100
3127
|
"data-ya-restricted": "true",
|
|
3101
3128
|
"data-field-id": fieldId,
|
|
3102
3129
|
onClick: handleClick,
|
|
@@ -3475,7 +3502,7 @@ function Router({ children, base }) {
|
|
|
3475
3502
|
}
|
|
3476
3503
|
|
|
3477
3504
|
// src/router/index.ts
|
|
3478
|
-
import { Route, Switch } from "wouter";
|
|
3505
|
+
import { Route, Switch, useParams } from "wouter";
|
|
3479
3506
|
export {
|
|
3480
3507
|
AIEditProvider,
|
|
3481
3508
|
ContentStoreProvider,
|
|
@@ -3515,5 +3542,6 @@ export {
|
|
|
3515
3542
|
useAnimatedText,
|
|
3516
3543
|
useContentStore,
|
|
3517
3544
|
useContentStore2 as useContentStoreProd,
|
|
3518
|
-
useNavigate
|
|
3545
|
+
useNavigate,
|
|
3546
|
+
useParams
|
|
3519
3547
|
};
|
package/dist/plugin.js
CHANGED
|
@@ -69,9 +69,9 @@ function yoamigoPlugin(options = {}) {
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
// Dynamic base URL for different deployment contexts:
|
|
72
|
-
// -
|
|
72
|
+
// - Dev server: Use --base CLI arg (config option is less reliable)
|
|
73
|
+
// - Production builds: Uses YA_BASE_URL env var (passed via additionalEnv)
|
|
73
74
|
// - Published builds: / (default, served from subdomain root)
|
|
74
|
-
// - Dev server: ignored (base only affects production builds)
|
|
75
75
|
base: process.env.YA_BASE_URL || "/",
|
|
76
76
|
build: {
|
|
77
77
|
outDir: "dist",
|
package/dist/prod.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
export { a as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, d as MarkdownText, e as MarkdownTextProps, P as PageInfo, b as StaticImage, c as StaticImageProps, M as StaticText, S as StaticTextProps, b as YaImage, c as YaImageProps, M as YaText, S as YaTextProps, u as useContentStore } from './MarkdownText-
|
|
1
|
+
export { a as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, d as MarkdownText, e as MarkdownTextProps, P as PageInfo, b as StaticImage, c as StaticImageProps, M as StaticText, S as StaticTextProps, b as YaImage, c as YaImageProps, M as YaText, S as YaTextProps, u as useContentStore } from './MarkdownText-BUTYfqXS.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
|
5
|
-
export { Route, Switch } from 'wouter';
|
|
5
|
+
export { Route, Switch, useParams } from 'wouter';
|
|
6
6
|
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';
|
|
7
7
|
|
|
8
8
|
interface StaticLinkProps {
|
|
9
9
|
fieldId: string;
|
|
10
10
|
href?: string;
|
|
11
11
|
className?: string;
|
|
12
|
+
/** Inline styles to apply to the link element */
|
|
13
|
+
style?: React.CSSProperties;
|
|
12
14
|
as?: 'a' | 'span';
|
|
13
15
|
children?: React.ReactNode;
|
|
14
16
|
/** Optional click handler called after navigation */
|
|
15
17
|
onClick?: () => void;
|
|
16
18
|
}
|
|
17
|
-
declare function StaticLink({ fieldId, href: defaultHref, className, as: Component, children, onClick }: StaticLinkProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function StaticLink({ fieldId, href: defaultHref, className, style, as: Component, children, onClick }: StaticLinkProps): react_jsx_runtime.JSX.Element;
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* SafeHtml (Production) - Renders trusted HTML without sanitization.
|
package/dist/prod.js
CHANGED
|
@@ -152,7 +152,7 @@ function isInternalPath(path) {
|
|
|
152
152
|
if (path.startsWith("mailto:") || path.startsWith("tel:")) return false;
|
|
153
153
|
return path.startsWith("/");
|
|
154
154
|
}
|
|
155
|
-
function StaticLink({ fieldId, href: defaultHref = "#", className, as: Component = "a", children, onClick }) {
|
|
155
|
+
function StaticLink({ fieldId, href: defaultHref = "#", className, style, as: Component = "a", children, onClick }) {
|
|
156
156
|
const { getValue, mode } = useContentStore();
|
|
157
157
|
const [, navigate] = useLocation();
|
|
158
158
|
const textFieldId = `${fieldId}.text`;
|
|
@@ -193,6 +193,7 @@ function StaticLink({ fieldId, href: defaultHref = "#", className, as: Component
|
|
|
193
193
|
href: Component === "a" ? href : void 0,
|
|
194
194
|
onClick: handleClick,
|
|
195
195
|
className,
|
|
196
|
+
style,
|
|
196
197
|
"data-ya-restricted": "true",
|
|
197
198
|
"data-field-id": fieldId,
|
|
198
199
|
children: hasStoreText || hasStringChildren ? /* @__PURE__ */ jsx5(SafeHtml, { content: storeText || children || "", mode }) : hasReactChildren ? children : null
|
|
@@ -340,7 +341,7 @@ function Router({ children, base }) {
|
|
|
340
341
|
}
|
|
341
342
|
|
|
342
343
|
// src/router/index.ts
|
|
343
|
-
import { Route, Switch } from "wouter";
|
|
344
|
+
import { Route, Switch, useParams } from "wouter";
|
|
344
345
|
export {
|
|
345
346
|
ContentStoreProvider,
|
|
346
347
|
Link,
|
|
@@ -363,5 +364,6 @@ export {
|
|
|
363
364
|
resolveAssetUrl,
|
|
364
365
|
setAssetResolver,
|
|
365
366
|
useContentStore,
|
|
366
|
-
useNavigate
|
|
367
|
+
useNavigate,
|
|
368
|
+
useParams
|
|
367
369
|
};
|
package/dist/router.d.ts
CHANGED
package/dist/router.js
CHANGED
|
@@ -41,11 +41,12 @@ function Router({ children, base }) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// src/router/index.ts
|
|
44
|
-
import { Route, Switch } from "wouter";
|
|
44
|
+
import { Route, Switch, useParams } from "wouter";
|
|
45
45
|
export {
|
|
46
46
|
Link,
|
|
47
47
|
Route,
|
|
48
48
|
Router,
|
|
49
49
|
Switch,
|
|
50
|
-
useNavigate
|
|
50
|
+
useNavigate,
|
|
51
|
+
useParams
|
|
51
52
|
};
|