@yoamigo.com/core 0.3.6 → 0.3.7
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-Nvkeyr1z.d.ts → MarkdownText-DHJo0ofY.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +51 -14
- package/dist/prod.d.ts +1 -1
- package/dist/prod.js +44 -7
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ interface ContentStoreProviderProps {
|
|
|
16
16
|
initialContent?: Record<string, string>;
|
|
17
17
|
initialMode?: EditMode;
|
|
18
18
|
}
|
|
19
|
-
declare function ContentStoreProvider({ children }: ContentStoreProviderProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare function ContentStoreProvider({ children, initialContent }: ContentStoreProviderProps): react_jsx_runtime.JSX.Element;
|
|
20
20
|
|
|
21
21
|
type EmbedType = 'spotify' | 'soundcloud' | 'twitter' | 'instagram' | 'custom';
|
|
22
22
|
interface EmbedFieldValue {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { ReactNode, CSSProperties } from 'react';
|
|
3
|
-
export { C as ContentStoreProviderProd, g as EmbedFieldValue, h as EmbedType, d as MarkdownText, e as MarkdownTextProps, P as PageInfo, b as StaticImage, c as StaticImageProps, M as StaticText, S as StaticTextProps, Y as YaEmbed, f as YaEmbedProps, i as YaLink, j as YaLinkProps, p as parseEmbedUrl, s as serializeEmbedValue, u as useContentStoreProd } from './MarkdownText-
|
|
3
|
+
export { C as ContentStoreProviderProd, g as EmbedFieldValue, h as EmbedType, d as MarkdownText, e as MarkdownTextProps, P as PageInfo, b as StaticImage, c as StaticImageProps, M as StaticText, S as StaticTextProps, Y as YaEmbed, f as YaEmbedProps, i as YaLink, j as YaLinkProps, p as parseEmbedUrl, s as serializeEmbedValue, u as useContentStoreProd } from './MarkdownText-DHJo0ofY.js';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
|
5
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';
|
package/dist/index.js
CHANGED
|
@@ -963,11 +963,10 @@ function ContentStoreProvider({
|
|
|
963
963
|
}
|
|
964
964
|
|
|
965
965
|
// src/components/ContentStoreProvider.prod.tsx
|
|
966
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
966
|
+
import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
|
|
967
967
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
968
|
-
var
|
|
969
|
-
|
|
970
|
-
getValue: (fieldId) => contentMap2.get(fieldId) ?? "",
|
|
968
|
+
var defaultStore = {
|
|
969
|
+
getValue: () => "",
|
|
971
970
|
setValue: () => {
|
|
972
971
|
},
|
|
973
972
|
// No-op in production
|
|
@@ -980,12 +979,50 @@ var staticStore = {
|
|
|
980
979
|
// No-op, return empty unsubscribe
|
|
981
980
|
saveToWorker: void 0
|
|
982
981
|
};
|
|
983
|
-
var ContentStoreContext2 = createContext2(
|
|
982
|
+
var ContentStoreContext2 = createContext2(defaultStore);
|
|
984
983
|
function useContentStore2() {
|
|
985
984
|
return useContext2(ContentStoreContext2);
|
|
986
985
|
}
|
|
987
|
-
function ContentStoreProvider2({ children }) {
|
|
988
|
-
|
|
986
|
+
function ContentStoreProvider2({ children, initialContent }) {
|
|
987
|
+
const parentStore = useContext2(ContentStoreContext2);
|
|
988
|
+
const hasParent = parentStore !== defaultStore;
|
|
989
|
+
const store = useMemo(() => {
|
|
990
|
+
if (initialContent) {
|
|
991
|
+
return {
|
|
992
|
+
getValue: (fieldId) => initialContent[fieldId] ?? "",
|
|
993
|
+
setValue: () => {
|
|
994
|
+
},
|
|
995
|
+
// No-op in production
|
|
996
|
+
mode: "read-only",
|
|
997
|
+
setMode: () => {
|
|
998
|
+
},
|
|
999
|
+
// No-op in production
|
|
1000
|
+
subscribe: () => () => {
|
|
1001
|
+
},
|
|
1002
|
+
// No-op, return empty unsubscribe
|
|
1003
|
+
saveToWorker: void 0
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
if (hasParent) {
|
|
1007
|
+
return parentStore;
|
|
1008
|
+
}
|
|
1009
|
+
const registryContent = getAllContent();
|
|
1010
|
+
return {
|
|
1011
|
+
getValue: (fieldId) => registryContent[fieldId] ?? "",
|
|
1012
|
+
setValue: () => {
|
|
1013
|
+
},
|
|
1014
|
+
// No-op in production
|
|
1015
|
+
mode: "read-only",
|
|
1016
|
+
setMode: () => {
|
|
1017
|
+
},
|
|
1018
|
+
// No-op in production
|
|
1019
|
+
subscribe: () => () => {
|
|
1020
|
+
},
|
|
1021
|
+
// No-op, return empty unsubscribe
|
|
1022
|
+
saveToWorker: void 0
|
|
1023
|
+
};
|
|
1024
|
+
}, [initialContent, hasParent, parentStore]);
|
|
1025
|
+
return /* @__PURE__ */ jsx2(ContentStoreContext2.Provider, { value: store, children });
|
|
989
1026
|
}
|
|
990
1027
|
|
|
991
1028
|
// src/components/YaText.tsx
|
|
@@ -1271,13 +1308,13 @@ function SafeHtml({ content, className, mode = "read-only" }) {
|
|
|
1271
1308
|
}
|
|
1272
1309
|
|
|
1273
1310
|
// src/hooks/useAnimatedText.ts
|
|
1274
|
-
import { useMemo as
|
|
1311
|
+
import { useMemo as useMemo4 } from "react";
|
|
1275
1312
|
|
|
1276
1313
|
// src/hooks/useAIEditAnimation.ts
|
|
1277
|
-
import { useState as useState3, useEffect as useEffect3, useRef as useRef4, useCallback as useCallback4, useMemo as
|
|
1314
|
+
import { useState as useState3, useEffect as useEffect3, useRef as useRef4, useCallback as useCallback4, useMemo as useMemo3 } from "react";
|
|
1278
1315
|
|
|
1279
1316
|
// src/contexts/AIEditContext.tsx
|
|
1280
|
-
import { createContext as createContext3, useContext as useContext3, useCallback as useCallback3, useRef as useRef3, useMemo } from "react";
|
|
1317
|
+
import { createContext as createContext3, useContext as useContext3, useCallback as useCallback3, useRef as useRef3, useMemo as useMemo2 } from "react";
|
|
1281
1318
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1282
1319
|
var AIEditContext = createContext3(null);
|
|
1283
1320
|
function useAIEditContext() {
|
|
@@ -1389,7 +1426,7 @@ function AIEditProvider({ children, staggerDelay = 100 }) {
|
|
|
1389
1426
|
},
|
|
1390
1427
|
[notifyListeners]
|
|
1391
1428
|
);
|
|
1392
|
-
const value =
|
|
1429
|
+
const value = useMemo2(
|
|
1393
1430
|
() => ({
|
|
1394
1431
|
queueAnimation,
|
|
1395
1432
|
cancelAnimation,
|
|
@@ -1508,7 +1545,7 @@ function useAIEditAnimation(fieldId, value, options) {
|
|
|
1508
1545
|
}
|
|
1509
1546
|
};
|
|
1510
1547
|
}, []);
|
|
1511
|
-
const wrapperProps =
|
|
1548
|
+
const wrapperProps = useMemo3(
|
|
1512
1549
|
() => ({
|
|
1513
1550
|
className: phase === "animating" ? "ya-ai-editing" : phase === "complete" ? "ya-ai-complete" : "",
|
|
1514
1551
|
"data-ai-editing": phase === "animating"
|
|
@@ -1730,7 +1767,7 @@ function useAnimatedText(fieldId, content, options = {}) {
|
|
|
1730
1767
|
onStart,
|
|
1731
1768
|
onComplete
|
|
1732
1769
|
} = options;
|
|
1733
|
-
const customStrategy =
|
|
1770
|
+
const customStrategy = useMemo4(() => {
|
|
1734
1771
|
if (charDelay === 50) {
|
|
1735
1772
|
return textTypingStrategy;
|
|
1736
1773
|
}
|
|
@@ -1769,7 +1806,7 @@ function useAnimatedText(fieldId, content, options = {}) {
|
|
|
1769
1806
|
onStart,
|
|
1770
1807
|
onComplete
|
|
1771
1808
|
});
|
|
1772
|
-
const cursorPosition =
|
|
1809
|
+
const cursorPosition = useMemo4(() => {
|
|
1773
1810
|
if (!isAnimating) return null;
|
|
1774
1811
|
const diff = computeTextDiff(content, displayValue);
|
|
1775
1812
|
const { deleteDuration, typeDuration } = calculateAnimationTiming(diff, {
|
package/dist/prod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, p as parseEmbedUrl, 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, p as parseEmbedUrl, u as useContentStore } from './MarkdownText-DHJo0ofY.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import React, { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, useNavigate } from './router.js';
|
package/dist/prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/ContentStoreProvider.prod.tsx
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
3
|
|
|
4
4
|
// src/lib/content-registry.ts
|
|
5
5
|
var contentMap = /* @__PURE__ */ new Map();
|
|
@@ -24,9 +24,8 @@ var contentRegistry = {
|
|
|
24
24
|
|
|
25
25
|
// src/components/ContentStoreProvider.prod.tsx
|
|
26
26
|
import { jsx } from "react/jsx-runtime";
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
getValue: (fieldId) => contentMap2.get(fieldId) ?? "",
|
|
27
|
+
var defaultStore = {
|
|
28
|
+
getValue: () => "",
|
|
30
29
|
setValue: () => {
|
|
31
30
|
},
|
|
32
31
|
// No-op in production
|
|
@@ -39,12 +38,50 @@ var staticStore = {
|
|
|
39
38
|
// No-op, return empty unsubscribe
|
|
40
39
|
saveToWorker: void 0
|
|
41
40
|
};
|
|
42
|
-
var ContentStoreContext = createContext(
|
|
41
|
+
var ContentStoreContext = createContext(defaultStore);
|
|
43
42
|
function useContentStore() {
|
|
44
43
|
return useContext(ContentStoreContext);
|
|
45
44
|
}
|
|
46
|
-
function ContentStoreProvider({ children }) {
|
|
47
|
-
|
|
45
|
+
function ContentStoreProvider({ children, initialContent }) {
|
|
46
|
+
const parentStore = useContext(ContentStoreContext);
|
|
47
|
+
const hasParent = parentStore !== defaultStore;
|
|
48
|
+
const store = useMemo(() => {
|
|
49
|
+
if (initialContent) {
|
|
50
|
+
return {
|
|
51
|
+
getValue: (fieldId) => initialContent[fieldId] ?? "",
|
|
52
|
+
setValue: () => {
|
|
53
|
+
},
|
|
54
|
+
// No-op in production
|
|
55
|
+
mode: "read-only",
|
|
56
|
+
setMode: () => {
|
|
57
|
+
},
|
|
58
|
+
// No-op in production
|
|
59
|
+
subscribe: () => () => {
|
|
60
|
+
},
|
|
61
|
+
// No-op, return empty unsubscribe
|
|
62
|
+
saveToWorker: void 0
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (hasParent) {
|
|
66
|
+
return parentStore;
|
|
67
|
+
}
|
|
68
|
+
const registryContent = getAllContent();
|
|
69
|
+
return {
|
|
70
|
+
getValue: (fieldId) => registryContent[fieldId] ?? "",
|
|
71
|
+
setValue: () => {
|
|
72
|
+
},
|
|
73
|
+
// No-op in production
|
|
74
|
+
mode: "read-only",
|
|
75
|
+
setMode: () => {
|
|
76
|
+
},
|
|
77
|
+
// No-op in production
|
|
78
|
+
subscribe: () => () => {
|
|
79
|
+
},
|
|
80
|
+
// No-op, return empty unsubscribe
|
|
81
|
+
saveToWorker: void 0
|
|
82
|
+
};
|
|
83
|
+
}, [initialContent, hasParent, parentStore]);
|
|
84
|
+
return /* @__PURE__ */ jsx(ContentStoreContext.Provider, { value: store, children });
|
|
48
85
|
}
|
|
49
86
|
|
|
50
87
|
// src/components/StaticText.tsx
|