@dyrected/react 2.5.51 → 2.5.52
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/components/Blocks.d.ts +31 -0
- package/dist/components/Blocks.d.ts.map +1 -0
- package/dist/components/Blocks.js +19 -0
- package/dist/components/Blocks.js.map +1 -0
- package/dist/hooks/useDyPath.d.ts +23 -0
- package/dist/hooks/useDyPath.d.ts.map +1 -0
- package/dist/hooks/useDyPath.js +26 -0
- package/dist/hooks/useDyPath.js.map +1 -0
- package/dist/hooks/useLivePreview.d.ts.map +1 -1
- package/dist/hooks/useLivePreview.js +60 -2
- package/dist/hooks/useLivePreview.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/DyPathProvider.d.ts +14 -0
- package/dist/providers/DyPathProvider.d.ts.map +1 -0
- package/dist/providers/DyPathProvider.js +14 -0
- package/dist/providers/DyPathProvider.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
export interface BlocksItem {
|
|
3
|
+
/** Discriminator selecting which component renders this item. */
|
|
4
|
+
blockType: string;
|
|
5
|
+
/**
|
|
6
|
+
* Selected presentation variant, when the block defines `variants` in its
|
|
7
|
+
* schema. Passed straight through to the component so it can switch layout.
|
|
8
|
+
*/
|
|
9
|
+
variant?: string;
|
|
10
|
+
/** Optional stable id; used as the React key when present. */
|
|
11
|
+
id?: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface BlocksProps {
|
|
15
|
+
/** The array of block items (e.g. a page's `body`). */
|
|
16
|
+
items: BlocksItem[];
|
|
17
|
+
/** Map of `blockType` → component. Unknown types are skipped. */
|
|
18
|
+
components: Record<string, ComponentType<any>>;
|
|
19
|
+
/** RHF-style base path of this array on the document. Defaults to "body". */
|
|
20
|
+
path?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Blocks — renders an array of block items by `blockType`, wrapping each in a
|
|
24
|
+
* `<DyPathProvider>` scoped to its `${path}.${index}` so child components can
|
|
25
|
+
* call `useDyPath('field')` without ever writing an index or full path.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Blocks items={data.body} components={{ hero: HeroBlock, cta: CtaBlock }} />
|
|
29
|
+
*/
|
|
30
|
+
export declare function Blocks({ items, components, path }: BlocksProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=Blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.d.ts","sourceRoot":"","sources":["../../src/components/Blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,UAAU;IACzB,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAa,EAAE,EAAE,WAAW,2CAcvE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DyPathProvider } from '../providers/DyPathProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Blocks — renders an array of block items by `blockType`, wrapping each in a
|
|
5
|
+
* `<DyPathProvider>` scoped to its `${path}.${index}` so child components can
|
|
6
|
+
* call `useDyPath('field')` without ever writing an index or full path.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Blocks items={data.body} components={{ hero: HeroBlock, cta: CtaBlock }} />
|
|
10
|
+
*/
|
|
11
|
+
export function Blocks({ items, components, path = 'body' }) {
|
|
12
|
+
return (_jsx(_Fragment, { children: items.map((item, i) => {
|
|
13
|
+
const Comp = components[item.blockType];
|
|
14
|
+
if (!Comp)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsx(DyPathProvider, { path: `${path}.${i}`, children: _jsx(Comp, { ...item }) }, item.id ?? i));
|
|
17
|
+
}) }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blocks.js","sourceRoot":"","sources":["../../src/components/Blocks.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAwB7D;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,GAAG,MAAM,EAAe;IACtE,OAAO,CACL,4BACG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACrB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YACvB,OAAO,CACL,KAAC,cAAc,IAAoB,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,EAAE,YACrD,KAAC,IAAI,OAAK,IAAI,GAAI,IADC,IAAI,CAAC,EAAE,IAAI,CAAC,CAEhB,CAClB,CAAC;QACJ,CAAC,CAAC,GACD,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient base path for the block/section currently being rendered, e.g.
|
|
3
|
+
* "body.2". `<DyPathProvider>` sets it; `useDyPath` reads it. Empty at the
|
|
4
|
+
* document root.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DyPathContext: import("react").Context<string>;
|
|
7
|
+
/**
|
|
8
|
+
* useDyPath — returns spreadable props that annotate an element with its
|
|
9
|
+
* document value path, so the Dyrected live-preview editor can map a click in
|
|
10
|
+
* the preview back to the exact field.
|
|
11
|
+
*
|
|
12
|
+
* Authors pass only the field name relative to the current block; the ancestor
|
|
13
|
+
* `<Blocks>`/`<DyPathProvider>` supplies the base path, so no index or full
|
|
14
|
+
* dotted path is ever hand-written.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <h1 {...useDyPath('heading')}>{heading}</h1>
|
|
18
|
+
* <a {...useDyPath('cta.url')} href={cta.url}>{cta.label}</a>
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDyPath(field?: string): {
|
|
21
|
+
'data-dy-path': string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useDyPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDyPath.d.ts","sourceRoot":"","sources":["../../src/hooks/useDyPath.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,aAAa,iCAA4B,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAIpE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Ambient base path for the block/section currently being rendered, e.g.
|
|
4
|
+
* "body.2". `<DyPathProvider>` sets it; `useDyPath` reads it. Empty at the
|
|
5
|
+
* document root.
|
|
6
|
+
*/
|
|
7
|
+
export const DyPathContext = createContext('');
|
|
8
|
+
/**
|
|
9
|
+
* useDyPath — returns spreadable props that annotate an element with its
|
|
10
|
+
* document value path, so the Dyrected live-preview editor can map a click in
|
|
11
|
+
* the preview back to the exact field.
|
|
12
|
+
*
|
|
13
|
+
* Authors pass only the field name relative to the current block; the ancestor
|
|
14
|
+
* `<Blocks>`/`<DyPathProvider>` supplies the base path, so no index or full
|
|
15
|
+
* dotted path is ever hand-written.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <h1 {...useDyPath('heading')}>{heading}</h1>
|
|
19
|
+
* <a {...useDyPath('cta.url')} href={cta.url}>{cta.label}</a>
|
|
20
|
+
*/
|
|
21
|
+
export function useDyPath(field) {
|
|
22
|
+
const basePath = useContext(DyPathContext);
|
|
23
|
+
const path = field ? (basePath ? `${basePath}.${field}` : field) : basePath;
|
|
24
|
+
return { 'data-dy-path': path };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=useDyPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDyPath.js","sourceRoot":"","sources":["../../src/hooks/useDyPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAS,EAAE,CAAC,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5E,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLivePreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivePreview.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CAAC,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EACpC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"useLivePreview.d.ts","sourceRoot":"","sources":["../../src/hooks/useLivePreview.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC;;;OAGG;IACH,WAAW,EAAE,CAAC,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EACpC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CA2G9B"}
|
|
@@ -10,8 +10,43 @@ export function useLivePreview(options) {
|
|
|
10
10
|
const [data, setData] = useState(options.initialData);
|
|
11
11
|
const [isLive, setIsLive] = useState(false);
|
|
12
12
|
useEffect(() => {
|
|
13
|
+
const allowedOrigin = options.serverURL || '*';
|
|
14
|
+
let editModeActive = false;
|
|
15
|
+
let hoveredElement = null;
|
|
16
|
+
// Handle clicks on any element with data-dy-path (or its children)
|
|
17
|
+
const handleClick = (e) => {
|
|
18
|
+
if (!editModeActive)
|
|
19
|
+
return;
|
|
20
|
+
const target = e.target;
|
|
21
|
+
const clickable = target?.closest('[data-dy-path]');
|
|
22
|
+
if (clickable) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
const path = clickable.getAttribute('data-dy-path') || '';
|
|
26
|
+
window.parent.postMessage({ type: 'dyrected-element-clicked', path }, allowedOrigin);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
// Track mouse moves to dynamically highlight hovered data-dy-path elements
|
|
30
|
+
const handleMouseMove = (e) => {
|
|
31
|
+
if (!editModeActive)
|
|
32
|
+
return;
|
|
33
|
+
const target = e.target;
|
|
34
|
+
const clickable = target?.closest('[data-dy-path]') || null;
|
|
35
|
+
if (clickable !== hoveredElement) {
|
|
36
|
+
if (hoveredElement) {
|
|
37
|
+
hoveredElement.style.outline = '';
|
|
38
|
+
hoveredElement.style.outlineOffset = '';
|
|
39
|
+
hoveredElement.style.cursor = '';
|
|
40
|
+
}
|
|
41
|
+
if (clickable) {
|
|
42
|
+
clickable.style.outline = '2px solid rgba(99,102,241,0.7)';
|
|
43
|
+
clickable.style.outlineOffset = '2px';
|
|
44
|
+
clickable.style.cursor = 'pointer';
|
|
45
|
+
}
|
|
46
|
+
hoveredElement = clickable;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
function handleMessage(event) {
|
|
14
|
-
const allowedOrigin = options.serverURL || '*';
|
|
15
50
|
// Origin check (skip if '*' is configured)
|
|
16
51
|
if (allowedOrigin !== '*' && event.origin !== allowedOrigin)
|
|
17
52
|
return;
|
|
@@ -24,12 +59,35 @@ export function useLivePreview(options) {
|
|
|
24
59
|
// Admin UI is asking the preview pane if it is ready
|
|
25
60
|
window.parent.postMessage({ type: 'dyrected-live-preview-ack' }, allowedOrigin);
|
|
26
61
|
}
|
|
62
|
+
if (type === 'dyrected-enter-edit-mode') {
|
|
63
|
+
editModeActive = true;
|
|
64
|
+
document.addEventListener('click', handleClick, true);
|
|
65
|
+
document.addEventListener('mousemove', handleMouseMove, true);
|
|
66
|
+
}
|
|
67
|
+
if (type === 'dyrected-exit-edit-mode') {
|
|
68
|
+
editModeActive = false;
|
|
69
|
+
document.removeEventListener('click', handleClick, true);
|
|
70
|
+
document.removeEventListener('mousemove', handleMouseMove, true);
|
|
71
|
+
if (hoveredElement) {
|
|
72
|
+
hoveredElement.style.outline = '';
|
|
73
|
+
hoveredElement.style.outlineOffset = '';
|
|
74
|
+
hoveredElement.style.cursor = '';
|
|
75
|
+
hoveredElement = null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
27
78
|
}
|
|
28
79
|
window.addEventListener('message', handleMessage);
|
|
29
80
|
// Signal the Admin UI that we're ready to receive preview data
|
|
30
|
-
window.parent.postMessage({ type: 'dyrected-live-preview-ready' },
|
|
81
|
+
window.parent.postMessage({ type: 'dyrected-live-preview-ready' }, allowedOrigin);
|
|
31
82
|
return () => {
|
|
32
83
|
window.removeEventListener('message', handleMessage);
|
|
84
|
+
document.removeEventListener('click', handleClick, true);
|
|
85
|
+
document.removeEventListener('mousemove', handleMouseMove, true);
|
|
86
|
+
if (hoveredElement) {
|
|
87
|
+
hoveredElement.style.outline = '';
|
|
88
|
+
hoveredElement.style.outlineOffset = '';
|
|
89
|
+
hoveredElement.style.cursor = '';
|
|
90
|
+
}
|
|
33
91
|
};
|
|
34
92
|
}, [options.serverURL]);
|
|
35
93
|
// Update data if initialData changes externally (e.g. server-side re-fetch)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLivePreview.js","sourceRoot":"","sources":["../../src/hooks/useLivePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgB5C;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA8B;IAE9B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,SAAS,C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,CAAC;gBACxC,cAAc,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAExB,4EAA4E;IAC5E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAElC,OAAO;QACL,sDAAsD;QACtD,IAAI;QACJ,wEAAwE;QACxE,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './hooks/useLivePreview';
|
|
2
2
|
export * from './hooks/useDyrected';
|
|
3
|
+
export * from './hooks/useDyPath';
|
|
3
4
|
export * from './providers/DyrectedProvider';
|
|
5
|
+
export * from './providers/DyPathProvider';
|
|
4
6
|
export * from './components/DyrectedImage';
|
|
5
7
|
export * from './components/DyrectedMedia';
|
|
8
|
+
export * from './components/Blocks';
|
|
6
9
|
export { DyrectedClient, DyrectedError } from '@dyrected/sdk';
|
|
7
10
|
export type { CollectionConfig, GlobalConfig } from '@dyrected/sdk';
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './hooks/useLivePreview';
|
|
2
2
|
export * from './hooks/useDyrected';
|
|
3
|
+
export * from './hooks/useDyPath';
|
|
3
4
|
export * from './providers/DyrectedProvider';
|
|
5
|
+
export * from './providers/DyPathProvider';
|
|
4
6
|
export * from './components/DyrectedImage';
|
|
5
7
|
export * from './components/DyrectedMedia';
|
|
8
|
+
export * from './components/Blocks';
|
|
6
9
|
// Re-export core types and errors from SDK for convenience
|
|
7
10
|
export { DyrectedClient, DyrectedError } from '@dyrected/sdk';
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AAEpC,2DAA2D;AAC3D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* DyPathProvider — scopes the ambient base path for a block/section subtree so
|
|
4
|
+
* `useDyPath(field)` inside it resolves to `${path}.${field}`.
|
|
5
|
+
*
|
|
6
|
+
* `<Blocks>` wraps each item in one of these automatically; use it directly
|
|
7
|
+
* only for a standalone section that isn't rendered through `<Blocks>` (e.g. a
|
|
8
|
+
* singleton object field: `<DyPathProvider path="hero">…</DyPathProvider>`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function DyPathProvider({ path, children }: {
|
|
11
|
+
path: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=DyPathProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DyPathProvider.d.ts","sourceRoot":"","sources":["../../src/providers/DyPathProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAEvF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DyPathContext } from '../hooks/useDyPath';
|
|
3
|
+
/**
|
|
4
|
+
* DyPathProvider — scopes the ambient base path for a block/section subtree so
|
|
5
|
+
* `useDyPath(field)` inside it resolves to `${path}.${field}`.
|
|
6
|
+
*
|
|
7
|
+
* `<Blocks>` wraps each item in one of these automatically; use it directly
|
|
8
|
+
* only for a standalone section that isn't rendered through `<Blocks>` (e.g. a
|
|
9
|
+
* singleton object field: `<DyPathProvider path="hero">…</DyPathProvider>`).
|
|
10
|
+
*/
|
|
11
|
+
export function DyPathProvider({ path, children }) {
|
|
12
|
+
return _jsx(DyPathContext.Provider, { value: path, children: children });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DyPathProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DyPathProvider.js","sourceRoot":"","sources":["../../src/providers/DyPathProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAyC;IACtF,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAAG,QAAQ,GAA0B,CAAC;AAClF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dyrected/react",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"react-dom": ">=18.0.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dyrected/admin": "2.5.
|
|
26
|
-
"@dyrected/sdk": "2.5.
|
|
25
|
+
"@dyrected/admin": "2.5.52",
|
|
26
|
+
"@dyrected/sdk": "2.5.52"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^20.12.12",
|