@yoamigo.com/core 0.1.12 → 0.1.13
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 +34 -7
- package/dist/plugin.js +2 -2
- package/dist/prod.d.ts +2 -2
- package/dist/prod.js +3 -2
- 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
|
@@ -2516,6 +2516,16 @@ function getObjectPosition(imageData) {
|
|
|
2516
2516
|
return imageData.objectPosition || "50% 50%";
|
|
2517
2517
|
}
|
|
2518
2518
|
var SMALL_IMAGE_THRESHOLD = 100;
|
|
2519
|
+
var PLACEHOLDER_SVG = `data:image/svg+xml,${encodeURIComponent(`
|
|
2520
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300" viewBox="0 0 400 300">
|
|
2521
|
+
<rect fill="#e5e7eb" width="400" height="300"/>
|
|
2522
|
+
<g fill="#9ca3af" transform="translate(175, 125)">
|
|
2523
|
+
<rect x="3" y="3" width="44" height="44" rx="4" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
2524
|
+
<circle cx="15" cy="15" r="4" fill="currentColor"/>
|
|
2525
|
+
<path d="M47 35 L32 20 L17 35 L12 30 L3 39 L3 43 L47 43 Z" fill="currentColor"/>
|
|
2526
|
+
</g>
|
|
2527
|
+
</svg>
|
|
2528
|
+
`)}`;
|
|
2519
2529
|
function YaImage({
|
|
2520
2530
|
fieldId,
|
|
2521
2531
|
className,
|
|
@@ -2534,7 +2544,7 @@ function YaImage({
|
|
|
2534
2544
|
const [isSmallImage, setIsSmallImage] = useState6(false);
|
|
2535
2545
|
const rawValue = getValue(fieldId);
|
|
2536
2546
|
const imageData = parseImageValue(rawValue);
|
|
2537
|
-
const src = imageData.src || fallbackSrc ||
|
|
2547
|
+
const src = imageData.src || fallbackSrc || PLACEHOLDER_SVG;
|
|
2538
2548
|
const altText = imageData.alt || alt || fallbackAlt || "";
|
|
2539
2549
|
const objectFit = imageData.objectFit || propObjectFit || "cover";
|
|
2540
2550
|
const objectPosition = getObjectPosition(imageData) || propObjectPosition || "50% 50%";
|
|
@@ -2745,6 +2755,12 @@ function isInternalPath(path) {
|
|
|
2745
2755
|
if (path.startsWith("mailto:") || path.startsWith("tel:")) return false;
|
|
2746
2756
|
return path.startsWith("/");
|
|
2747
2757
|
}
|
|
2758
|
+
function isExternalHref(url) {
|
|
2759
|
+
if (!url) return false;
|
|
2760
|
+
if (url.startsWith("//")) return true;
|
|
2761
|
+
if (url.startsWith("http://") || url.startsWith("https://")) return true;
|
|
2762
|
+
return false;
|
|
2763
|
+
}
|
|
2748
2764
|
var FontSize2 = Extension2.create({
|
|
2749
2765
|
name: "fontSize",
|
|
2750
2766
|
addOptions() {
|
|
@@ -2827,7 +2843,7 @@ function discoverSectionsFromDOM() {
|
|
|
2827
2843
|
});
|
|
2828
2844
|
return sections;
|
|
2829
2845
|
}
|
|
2830
|
-
function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "a", children, availablePages, onClick }) {
|
|
2846
|
+
function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Component = "a", children, availablePages, onClick, target, rel }) {
|
|
2831
2847
|
const { getValue, setValue, mode, saveToWorker, getPages } = useContentStore();
|
|
2832
2848
|
const [, navigate] = useLocation();
|
|
2833
2849
|
const pages = availablePages ?? getPages();
|
|
@@ -2840,6 +2856,9 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
2840
2856
|
const isIconMode = children != null && typeof children !== "string";
|
|
2841
2857
|
const text = storeText || (typeof children === "string" ? children : "");
|
|
2842
2858
|
const href = storeHref || defaultHref;
|
|
2859
|
+
const isExternal = isExternalHref(href);
|
|
2860
|
+
const effectiveTarget = target ?? (isExternal ? "_blank" : void 0);
|
|
2861
|
+
const effectiveRel = rel ?? (isExternal ? "noopener noreferrer" : void 0);
|
|
2843
2862
|
const [editingMode, setEditingMode] = useState7(null);
|
|
2844
2863
|
const [showEditPopover, setShowEditPopover] = useState7(false);
|
|
2845
2864
|
const [originalText, setOriginalText] = useState7(text);
|
|
@@ -2894,9 +2913,9 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
2894
2913
|
useEffect7(() => {
|
|
2895
2914
|
if (editingMode !== "link") return;
|
|
2896
2915
|
const handleClickOutside = (event) => {
|
|
2897
|
-
const
|
|
2898
|
-
if (hrefPopoverRef.current?.contains(
|
|
2899
|
-
if (containerRef.current?.contains(
|
|
2916
|
+
const target2 = event.target;
|
|
2917
|
+
if (hrefPopoverRef.current?.contains(target2)) return;
|
|
2918
|
+
if (containerRef.current?.contains(target2)) return;
|
|
2900
2919
|
setCurrentHref(originalHref);
|
|
2901
2920
|
setEditingMode(null);
|
|
2902
2921
|
setIsExternalUrl(false);
|
|
@@ -3072,6 +3091,7 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3072
3091
|
{
|
|
3073
3092
|
href,
|
|
3074
3093
|
className,
|
|
3094
|
+
style,
|
|
3075
3095
|
"data-ya-restricted": "true",
|
|
3076
3096
|
"data-field-id": fieldId,
|
|
3077
3097
|
children: content
|
|
@@ -3083,7 +3103,10 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3083
3103
|
{
|
|
3084
3104
|
ref: containerRef,
|
|
3085
3105
|
href: Component === "a" ? href : void 0,
|
|
3106
|
+
target: Component === "a" ? effectiveTarget : void 0,
|
|
3107
|
+
rel: Component === "a" ? effectiveRel : void 0,
|
|
3086
3108
|
className,
|
|
3109
|
+
style,
|
|
3087
3110
|
"data-ya-restricted": "true",
|
|
3088
3111
|
"data-field-id": fieldId,
|
|
3089
3112
|
children: content
|
|
@@ -3096,7 +3119,10 @@ function YaLink({ fieldId, href: defaultHref = "#", className, as: Component = "
|
|
|
3096
3119
|
{
|
|
3097
3120
|
ref: containerRef,
|
|
3098
3121
|
href: Component === "a" ? href : void 0,
|
|
3122
|
+
target: Component === "a" ? effectiveTarget : void 0,
|
|
3123
|
+
rel: Component === "a" ? effectiveRel : void 0,
|
|
3099
3124
|
className: `${className || ""} ${editingMode ? "ya-link-editing" : "ya-link-editable"}`,
|
|
3125
|
+
style,
|
|
3100
3126
|
"data-ya-restricted": "true",
|
|
3101
3127
|
"data-field-id": fieldId,
|
|
3102
3128
|
onClick: handleClick,
|
|
@@ -3475,7 +3501,7 @@ function Router({ children, base }) {
|
|
|
3475
3501
|
}
|
|
3476
3502
|
|
|
3477
3503
|
// src/router/index.ts
|
|
3478
|
-
import { Route, Switch } from "wouter";
|
|
3504
|
+
import { Route, Switch, useParams } from "wouter";
|
|
3479
3505
|
export {
|
|
3480
3506
|
AIEditProvider,
|
|
3481
3507
|
ContentStoreProvider,
|
|
@@ -3515,5 +3541,6 @@ export {
|
|
|
3515
3541
|
useAnimatedText,
|
|
3516
3542
|
useContentStore,
|
|
3517
3543
|
useContentStore2 as useContentStoreProd,
|
|
3518
|
-
useNavigate
|
|
3544
|
+
useNavigate,
|
|
3545
|
+
useParams
|
|
3519
3546
|
};
|
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,8 +1,8 @@
|
|
|
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 {
|
package/dist/prod.js
CHANGED
|
@@ -340,7 +340,7 @@ function Router({ children, base }) {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
// src/router/index.ts
|
|
343
|
-
import { Route, Switch } from "wouter";
|
|
343
|
+
import { Route, Switch, useParams } from "wouter";
|
|
344
344
|
export {
|
|
345
345
|
ContentStoreProvider,
|
|
346
346
|
Link,
|
|
@@ -363,5 +363,6 @@ export {
|
|
|
363
363
|
resolveAssetUrl,
|
|
364
364
|
setAssetResolver,
|
|
365
365
|
useContentStore,
|
|
366
|
-
useNavigate
|
|
366
|
+
useNavigate,
|
|
367
|
+
useParams
|
|
367
368
|
};
|
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
|
};
|