@reframejs/unframer 4.2.0-reframe.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/README.md +389 -0
- package/bin.js +5 -0
- package/dist/babel-jsx.d.ts +24 -0
- package/dist/babel-jsx.js +299 -0
- package/dist/babel-plugin-imports.d.ts +15 -0
- package/dist/babel-plugin-imports.js +211 -0
- package/dist/babel-typedoc.d.ts +39 -0
- package/dist/babel-typedoc.js +76 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +3 -0
- package/dist/cli.d.ts +59 -0
- package/dist/cli.js +821 -0
- package/dist/compat.d.ts +2 -0
- package/dist/compat.js +23 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.js +27 -0
- package/dist/css-core.d.ts +50 -0
- package/dist/css-core.js +231 -0
- package/dist/css.d.ts +15 -0
- package/dist/css.js +36 -0
- package/dist/esbuild.d.ts +31 -0
- package/dist/esbuild.js +317 -0
- package/dist/exporter.d.ts +96 -0
- package/dist/exporter.js +1151 -0
- package/dist/flat-cache-interceptor.d.ts +24 -0
- package/dist/flat-cache-interceptor.js +87 -0
- package/dist/framer-chunks/chunk-IKQSD2QC.js +10 -0
- package/dist/framer-chunks/fontshare-PZLWRK4B-MHMZIGTX.js +7 -0
- package/dist/framer-chunks/fontshare-SXU5BGFE-OWTMMPGS.js +7 -0
- package/dist/framer-chunks/fontshare-TIA7QUPT-PUDLUTQ7.js +7 -0
- package/dist/framer-chunks/framer-font-RD2SUPQH-Q4MS7WS6.js +7 -0
- package/dist/framer-chunks/google-EGNT223R-P4DUHBW2.js +7 -0
- package/dist/framer-chunks/google-H6SFY4F5-5JSJCGDR.js +7 -0
- package/dist/framer-chunks/google-YSYBFRE6-L7YAHH7V.js +7 -0
- package/dist/framer-client.server.d.ts +4 -0
- package/dist/framer-client.server.js +45 -0
- package/dist/framer-package-versions.d.ts +781 -0
- package/dist/framer-package-versions.js +782 -0
- package/dist/framer-types.d.ts +30 -0
- package/dist/framer-types.js +35 -0
- package/dist/framer.d.ts +4990 -0
- package/dist/framer.js +64296 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +13 -0
- package/dist/package-manager.d.ts +10 -0
- package/dist/package-manager.js +138 -0
- package/dist/plugin-mcp-dist/lib/client-websocket.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/client-websocket.js +103 -0
- package/dist/plugin-mcp-dist/lib/cms.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/cms.js +58 -0
- package/dist/plugin-mcp-dist/lib/errors.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/errors.js +48 -0
- package/dist/plugin-mcp-dist/lib/framer-client.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/framer-client.js +4 -0
- package/dist/plugin-mcp-dist/lib/framer-client.server.d.ts +3 -0
- package/dist/plugin-mcp-dist/lib/framer-client.server.js +46 -0
- package/dist/plugin-mcp-dist/lib/framer.d.ts +30 -0
- package/dist/plugin-mcp-dist/lib/framer.js +1084 -0
- package/dist/plugin-mcp-dist/lib/hooks.d.ts +6 -0
- package/dist/plugin-mcp-dist/lib/hooks.js +46 -0
- package/dist/plugin-mcp-dist/lib/mcp-client.d.ts +142 -0
- package/dist/plugin-mcp-dist/lib/mcp-client.js +40 -0
- package/dist/plugin-mcp-dist/lib/mcp-handlers.d.ts +385 -0
- package/dist/plugin-mcp-dist/lib/mcp-handlers.js +1924 -0
- package/dist/plugin-mcp-dist/lib/mcp-tools.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/mcp-tools.js +5 -0
- package/dist/plugin-mcp-dist/lib/mcp-websocket.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/mcp-websocket.js +88 -0
- package/dist/plugin-mcp-dist/lib/plugin-websocket.d.ts +5 -0
- package/dist/plugin-mcp-dist/lib/plugin-websocket.js +170 -0
- package/dist/plugin-mcp-dist/lib/react-export.d.ts +51 -0
- package/dist/plugin-mcp-dist/lib/react-export.js +358 -0
- package/dist/plugin-mcp-dist/lib/schema.d.ts +276 -0
- package/dist/plugin-mcp-dist/lib/schema.js +907 -0
- package/dist/plugin-mcp-dist/lib/store.d.ts +2 -0
- package/dist/plugin-mcp-dist/lib/store.js +10 -0
- package/dist/plugin-mcp-dist/lib/tree-utils.d.ts +6 -0
- package/dist/plugin-mcp-dist/lib/tree-utils.js +141 -0
- package/dist/plugin-mcp-dist/lib/tunnel.d.ts +46 -0
- package/dist/plugin-mcp-dist/lib/tunnel.js +117 -0
- package/dist/plugin-mcp-dist/lib/types.d.ts +110 -0
- package/dist/plugin-mcp-dist/lib/types.js +188 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts +13 -0
- package/dist/plugin-mcp-dist/lib/upstream-socket.js +56 -0
- package/dist/plugin-mcp-dist/lib/utils.d.ts +13 -0
- package/dist/plugin-mcp-dist/lib/utils.js +57 -0
- package/dist/plugin-mcp-dist/lib/websocket-server.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/websocket-server.js +88 -0
- package/dist/plugin-mcp-dist/lib/xml.d.ts +10 -0
- package/dist/plugin-mcp-dist/lib/xml.js +395 -0
- package/dist/react.d.ts +76 -0
- package/dist/react.js +280 -0
- package/dist/renamer.d.ts +11 -0
- package/dist/renamer.js +139 -0
- package/dist/sentry.d.ts +2 -0
- package/dist/sentry.js +5 -0
- package/dist/stackblitz.d.ts +9 -0
- package/dist/stackblitz.js +179 -0
- package/dist/styles/framer.css +920 -0
- package/dist/styles/reset.css +37 -0
- package/dist/typescript.d.ts +24 -0
- package/dist/typescript.js +197 -0
- package/dist/undici-dispatcher.d.ts +2 -0
- package/dist/undici-dispatcher.js +10 -0
- package/dist/unframer-loader.d.ts +2 -0
- package/dist/unframer-loader.js +12 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +81 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +131 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentType } from 'react';
|
|
2
|
+
import { defaultBreakpointSizes } from './css-core.js';
|
|
3
|
+
export type UnframerBreakpoint = keyof typeof defaultBreakpointSizes;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use styles.css import instead
|
|
6
|
+
*/
|
|
7
|
+
export declare function FramerStyles({ Components }: {
|
|
8
|
+
Components?: any[] | undefined;
|
|
9
|
+
}): any;
|
|
10
|
+
export declare const WithFramerBreakpoints: <T extends ComponentType<{
|
|
11
|
+
variant?: any;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
}>>({ Component, variants: _breakpointsMap, ...rest }: {
|
|
14
|
+
Component: T;
|
|
15
|
+
variants: Record<"2xl" | "base" | "lg" | "md" | "sm" | "xl", ComponentPropsWithoutRef<T>["variant"]>;
|
|
16
|
+
} & Omit<ComponentPropsWithoutRef<T>, "variant">) => any;
|
|
17
|
+
import React from 'react';
|
|
18
|
+
export declare function ResolveLinksAdapted({ links, children }: {
|
|
19
|
+
children: any;
|
|
20
|
+
links: any;
|
|
21
|
+
}): any;
|
|
22
|
+
export declare function AdaptedLink({ href, nodeId, openInNewTab, smoothScroll, children, ...rest }: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
children: any;
|
|
25
|
+
href: any;
|
|
26
|
+
nodeId: any;
|
|
27
|
+
openInNewTab: any;
|
|
28
|
+
smoothScroll: any;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
export declare function ContextProviders({ locale: locale_, children, framerSiteId, routes, locales }: {
|
|
31
|
+
children: any;
|
|
32
|
+
framerSiteId: any;
|
|
33
|
+
locale: any;
|
|
34
|
+
locales: any;
|
|
35
|
+
routes: any;
|
|
36
|
+
}): React.JSX.Element;
|
|
37
|
+
type UnframerProviderProps = {
|
|
38
|
+
/**
|
|
39
|
+
* Optional function to handle client-side navigation.
|
|
40
|
+
* You can provide a navigation function such as one from React Router's `useNavigate`
|
|
41
|
+
* or Next.js's `useRouter().push`, for example:
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Using React Router:
|
|
45
|
+
* import { useNavigate } from "react-router-dom";
|
|
46
|
+
* const navigate = useNavigate();
|
|
47
|
+
*
|
|
48
|
+
* <UnframerProvider navigate={navigate}>...</UnframerProvider>
|
|
49
|
+
*
|
|
50
|
+
* // Using Next.js:
|
|
51
|
+
* import { useRouter } from "next/navigation";
|
|
52
|
+
* const router = useRouter();
|
|
53
|
+
* const navigate = (url: string) => router.push(url);
|
|
54
|
+
*
|
|
55
|
+
* <UnframerProvider navigate={navigate}>...</UnframerProvider>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
navigate?: (url: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* The locale slug for the language, e.g. "de" for German, "it" for Italian, etc.
|
|
61
|
+
* This should be a short identifier (typically two or more lowercase letters)
|
|
62
|
+
* that uniquely identifies the active language/region. Used for language resolution,
|
|
63
|
+
* translations, routing, etc.
|
|
64
|
+
* Examples:
|
|
65
|
+
* - "en" for English
|
|
66
|
+
* - "de" for German
|
|
67
|
+
* - "it" for Italian
|
|
68
|
+
* - "fr" for French
|
|
69
|
+
* - "es" for Spanish
|
|
70
|
+
*/
|
|
71
|
+
locale?: string;
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
};
|
|
74
|
+
export declare function UnframerProvider(props: UnframerProviderProps): React.JSX.Element;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { combinedCSSRules } from './framer.js';
|
|
4
|
+
import { preconnect, prefetchDNS } from 'react-dom';
|
|
5
|
+
import { createContext, useContext, useMemo, useSyncExternalStore, } from 'react';
|
|
6
|
+
import { breakpointsStylesLegacy, defaultBreakpointSizes, getFontsStyles, } from './css-core.js';
|
|
7
|
+
import { version } from './version.js';
|
|
8
|
+
function classNames(...args) {
|
|
9
|
+
return args.filter(Boolean).join(' ');
|
|
10
|
+
}
|
|
11
|
+
function Hints() {
|
|
12
|
+
prefetchDNS('https://fonts.gstatic.com');
|
|
13
|
+
preconnect('https://fonts.gstatic.com');
|
|
14
|
+
preconnect('https://framerusercontent.com');
|
|
15
|
+
return null; // nothing to render
|
|
16
|
+
}
|
|
17
|
+
// breakpoints from the higher to the lower
|
|
18
|
+
const defaultBreakpoints = Object.keys(defaultBreakpointSizes).reverse();
|
|
19
|
+
function getBreakpointNameFromWindowWidth(windowWidth) {
|
|
20
|
+
return defaultBreakpoints.find((name) => windowWidth >= defaultBreakpointSizes[name]);
|
|
21
|
+
}
|
|
22
|
+
function fillBreakpoints(breakpoints) {
|
|
23
|
+
const breakpointsOrder = ['base', 'sm', 'md', 'lg', 'xl', '2xl'];
|
|
24
|
+
const filledBreakpoints = { ...breakpoints };
|
|
25
|
+
for (let i = 1; i < breakpointsOrder.length; i++) {
|
|
26
|
+
const currentBreakpoint = breakpointsOrder[i];
|
|
27
|
+
const previousBreakpoint = breakpointsOrder[i - 1];
|
|
28
|
+
if (!filledBreakpoints[currentBreakpoint]) {
|
|
29
|
+
filledBreakpoints[currentBreakpoint] =
|
|
30
|
+
filledBreakpoints[previousBreakpoint];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return filledBreakpoints;
|
|
34
|
+
}
|
|
35
|
+
const nothing = () => {
|
|
36
|
+
return () => { };
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use styles.css import instead
|
|
40
|
+
*/
|
|
41
|
+
export function FramerStyles({ Components = [] }) {
|
|
42
|
+
const isClient = useSyncExternalStore(nothing, () => true, () => false);
|
|
43
|
+
const breakpoints = (_jsx("style", { dangerouslySetInnerHTML: {
|
|
44
|
+
__html: breakpointsStylesLegacy(defaultBreakpointSizes),
|
|
45
|
+
}, suppressHydrationWarning: true, hidden: true }, 'breakpointsStyles'));
|
|
46
|
+
const fonts = (_jsx("style", { dangerouslySetInnerHTML: {
|
|
47
|
+
__html: getFontsStyles(Components.map((x) => x.fonts || []).flat()),
|
|
48
|
+
}, suppressHydrationWarning: true, hidden: true }, 'fonts'));
|
|
49
|
+
// if (isClient) {
|
|
50
|
+
// // on client framer injects the styles by itself
|
|
51
|
+
// return (
|
|
52
|
+
// <>
|
|
53
|
+
// {breakpoints}
|
|
54
|
+
// {fonts}
|
|
55
|
+
// </>
|
|
56
|
+
// )
|
|
57
|
+
// }
|
|
58
|
+
return (_jsxs(_Fragment, { children: [breakpoints, fonts, _jsx("style", { dangerouslySetInnerHTML: {
|
|
59
|
+
__html: combinedCSSRules.join('\n'),
|
|
60
|
+
}, suppressHydrationWarning: true, hidden: true }, 'combinedCSSRules')
|
|
61
|
+
] }));
|
|
62
|
+
}
|
|
63
|
+
function removeInactiveUnframerHiddenElements() {
|
|
64
|
+
// Remove all elements with the 'unframer-hidden' class that are not for the current breakpoint
|
|
65
|
+
const windowWidth = window.innerWidth;
|
|
66
|
+
const activeBreakpoint = getBreakpointNameFromWindowWidth(windowWidth);
|
|
67
|
+
const activeClass = activeBreakpoint ? `unframer-${activeBreakpoint}` : null;
|
|
68
|
+
document.querySelectorAll('.unframer-hidden').forEach((el) => {
|
|
69
|
+
if (el.classList.contains('unframer-hidden') &&
|
|
70
|
+
activeClass &&
|
|
71
|
+
!el.classList.contains(activeClass)) {
|
|
72
|
+
el.parentNode?.removeChild(el);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (typeof window !== 'undefined') {
|
|
77
|
+
removeInactiveUnframerHiddenElements();
|
|
78
|
+
}
|
|
79
|
+
export const WithFramerBreakpoints = ({ Component, variants: _breakpointsMap, ...rest }) => {
|
|
80
|
+
// getServerSnapshot must always return '' to match what the server rendered.
|
|
81
|
+
// During hydration React calls getServerSnapshot on the client too; if it
|
|
82
|
+
// returned the real breakpoint, the tree structure would differ from the
|
|
83
|
+
// server (server renders all variants, client would render only one).
|
|
84
|
+
const currentBreakpoint = useSyncExternalStore(onResize, () => {
|
|
85
|
+
return getBreakpointNameFromWindowWidth(window.innerWidth);
|
|
86
|
+
}, () => '');
|
|
87
|
+
if (isEmpty(_breakpointsMap)) {
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
return _jsx(Component, { ...rest });
|
|
90
|
+
}
|
|
91
|
+
const allBreakpoints = fillBreakpoints(_breakpointsMap);
|
|
92
|
+
const variants = new Map();
|
|
93
|
+
for (let breakpointName of Object.keys(allBreakpoints)) {
|
|
94
|
+
const realVariant = allBreakpoints[breakpointName];
|
|
95
|
+
if (!realVariant) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const existingVariant = variants.get(realVariant);
|
|
99
|
+
if (existingVariant) {
|
|
100
|
+
existingVariant.breakpoints.push(breakpointName);
|
|
101
|
+
existingVariant.className = classNames(existingVariant.className, `unframer-${breakpointName}`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
variants.set(realVariant, {
|
|
105
|
+
className: classNames('unframer unframer-hidden', `unframer-${breakpointName}`),
|
|
106
|
+
variant: realVariant,
|
|
107
|
+
breakpoints: [breakpointName],
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const parts = [...variants.values()].map(({ className, breakpoints, variant }, i) => {
|
|
112
|
+
const shouldShow = !currentBreakpoint || breakpoints.includes(currentBreakpoint);
|
|
113
|
+
if (!shouldShow) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
const c = classNames(className, rest.className);
|
|
117
|
+
return (
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
_jsx(Component, { suppressHydrationWarning: true,
|
|
120
|
+
// LayoutGroup is used internally
|
|
121
|
+
layoutId: variant, ...rest, className: c, variant: variant }, variant));
|
|
122
|
+
});
|
|
123
|
+
parts.push(_jsx(DebugUnframerVersion, {}, 'debug-unframer-version'));
|
|
124
|
+
return parts;
|
|
125
|
+
};
|
|
126
|
+
const onResize = (callback) => {
|
|
127
|
+
window.addEventListener('resize', callback);
|
|
128
|
+
return () => window.removeEventListener('resize', callback);
|
|
129
|
+
};
|
|
130
|
+
const onResizeWithDebounce = (callback) => {
|
|
131
|
+
let timeoutId;
|
|
132
|
+
const debouncedCallback = () => {
|
|
133
|
+
clearTimeout(timeoutId);
|
|
134
|
+
timeoutId = setTimeout(() => {
|
|
135
|
+
callback();
|
|
136
|
+
}, 16);
|
|
137
|
+
};
|
|
138
|
+
window.addEventListener('resize', debouncedCallback);
|
|
139
|
+
return () => {
|
|
140
|
+
clearTimeout(timeoutId);
|
|
141
|
+
window.removeEventListener('resize', debouncedCallback);
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
import React from 'react';
|
|
145
|
+
import {
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
CustomCursorHost,
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
FetchClientProvider,
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
FormContext,
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
FramerLink as Link,
|
|
154
|
+
// @ts-ignore
|
|
155
|
+
LocaleInfoContext, } from './framer.js';
|
|
156
|
+
const routesContext = React.createContext({});
|
|
157
|
+
function replacePathParams(path, params) {
|
|
158
|
+
const paramRegex = /:[a-zA-Z]+/g;
|
|
159
|
+
const matches = path.match(paramRegex);
|
|
160
|
+
// If there is only one match
|
|
161
|
+
if (matches?.length === 1) {
|
|
162
|
+
const paramValue = Object.values(params)[0];
|
|
163
|
+
let res = path.replace(paramRegex, paramValue);
|
|
164
|
+
// console.log({ matches, params, paramValue, res })
|
|
165
|
+
return res;
|
|
166
|
+
}
|
|
167
|
+
return path.replace(paramRegex, (match) => {
|
|
168
|
+
const param = match.slice(1); // Remove the : prefix
|
|
169
|
+
return params[param] || match; // Replace with param value or keep original if not found
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
export function ResolveLinksAdapted({ links, children }) {
|
|
173
|
+
// TODO add ref
|
|
174
|
+
return children(links.map((x) => x.href));
|
|
175
|
+
}
|
|
176
|
+
function isRelativeLink(url) {
|
|
177
|
+
if (!url) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return url?.startsWith?.('/') || url?.startsWith?.('#');
|
|
181
|
+
}
|
|
182
|
+
function isMailto(url) {
|
|
183
|
+
if (!url) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
return url?.startsWith?.('mailto:');
|
|
187
|
+
}
|
|
188
|
+
export function AdaptedLink({ href, nodeId, openInNewTab, smoothScroll, children, ...rest }) {
|
|
189
|
+
const context = useContext(unframerContext);
|
|
190
|
+
let navigateClientSide = context.navigate && !openInNewTab
|
|
191
|
+
? (e) => {
|
|
192
|
+
if (!context.navigate)
|
|
193
|
+
return;
|
|
194
|
+
const href = e.currentTarget?.getAttribute('href');
|
|
195
|
+
if (!href || !isRelativeLink(href))
|
|
196
|
+
return;
|
|
197
|
+
e.preventDefault();
|
|
198
|
+
if (rest.onClick)
|
|
199
|
+
rest.onClick(e);
|
|
200
|
+
context.navigate(href);
|
|
201
|
+
}
|
|
202
|
+
: null;
|
|
203
|
+
const onlyForFramer = { children, nodeId, openInNewTab, smoothScroll };
|
|
204
|
+
const routes = React.useContext(routesContext);
|
|
205
|
+
const webPageId = href?.webPageId;
|
|
206
|
+
const pathVariables = href?.pathVariables;
|
|
207
|
+
const route = routes?.[webPageId];
|
|
208
|
+
const target = openInNewTab ? '_blank' : undefined;
|
|
209
|
+
if (isRelativeLink(href) || isMailto(href)) {
|
|
210
|
+
return (_jsx(_Fragment, { children: React.cloneElement(children, {
|
|
211
|
+
...rest,
|
|
212
|
+
suppressHydrationWarning: true,
|
|
213
|
+
onClick: navigateClientSide,
|
|
214
|
+
href,
|
|
215
|
+
target,
|
|
216
|
+
}) }));
|
|
217
|
+
}
|
|
218
|
+
if (!webPageId) {
|
|
219
|
+
return (_jsx(Link, { suppressHydrationWarning: true, href: href, ...rest, ...onlyForFramer }));
|
|
220
|
+
}
|
|
221
|
+
if (!route || !route.path) {
|
|
222
|
+
return (_jsx(Link, { suppressHydrationWarning: true, href: href, ...rest, ...onlyForFramer }));
|
|
223
|
+
}
|
|
224
|
+
let resolvedPath = route.path;
|
|
225
|
+
if (pathVariables) {
|
|
226
|
+
resolvedPath = replacePathParams(resolvedPath, pathVariables);
|
|
227
|
+
}
|
|
228
|
+
if (isRelativeLink(resolvedPath) || isMailto(href)) {
|
|
229
|
+
return (_jsx(_Fragment, { children: React.cloneElement(children, {
|
|
230
|
+
...rest,
|
|
231
|
+
suppressHydrationWarning: true,
|
|
232
|
+
onClick: navigateClientSide,
|
|
233
|
+
href: resolvedPath,
|
|
234
|
+
target,
|
|
235
|
+
}) }));
|
|
236
|
+
}
|
|
237
|
+
return (_jsx(Link, { href: resolvedPath, suppressHydrationWarning: true, ...rest, ...onlyForFramer }));
|
|
238
|
+
}
|
|
239
|
+
export function ContextProviders({ locale: locale_, children, framerSiteId, routes,
|
|
240
|
+
// collectionUtils,
|
|
241
|
+
locales, }) {
|
|
242
|
+
const context = useContext(unframerContext);
|
|
243
|
+
const locale = locale_ || context?.locale;
|
|
244
|
+
const activeLocale = locales?.find((l) => l.slug === locale || l.code === locale || l.id === locale);
|
|
245
|
+
const localeInfo = useMemo(() => {
|
|
246
|
+
return {
|
|
247
|
+
activeLocale,
|
|
248
|
+
locales,
|
|
249
|
+
setLocale: async (localeOrLocaleId) => {
|
|
250
|
+
console.log('setLocale', localeOrLocaleId);
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}, [activeLocale, locales]);
|
|
254
|
+
return (_jsxs(FetchClientProvider, { children: [
|
|
255
|
+
_jsx(Hints, {}), _jsx(CustomCursorHost, { children: _jsx(FormContext.Provider, { value: framerSiteId, children: _jsx(LocaleInfoContext, { value: localeInfo, children: _jsx(routesContext.Provider, { value: routes, children: children }) }) }) })
|
|
256
|
+
] }));
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Add Unframer debug information to debug websites using Unframer
|
|
260
|
+
*/
|
|
261
|
+
function DebugUnframerVersion() {
|
|
262
|
+
return null;
|
|
263
|
+
return (_jsxs("details", { style: { display: 'none' }, children: ["Using", ' ', _jsx("a", { href: 'https://unframer.co', className: '', children: "Framer React Export" }), ' ', "version ", version] }));
|
|
264
|
+
}
|
|
265
|
+
function isEmpty(obj) {
|
|
266
|
+
for (let key in obj) {
|
|
267
|
+
if (obj.hasOwnProperty(key)) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
const unframerContext = createContext({
|
|
274
|
+
navigate: undefined,
|
|
275
|
+
});
|
|
276
|
+
export function UnframerProvider(props) {
|
|
277
|
+
return (_jsxs(unframerContext.Provider, { value: props, children: [
|
|
278
|
+
_jsx(Hints, {}), props.children] }));
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import traverse, { type Scope } from '@babel/traverse';
|
|
2
|
+
import { NodePath } from '@babel/core';
|
|
3
|
+
export default class BatchRenamer {
|
|
4
|
+
constructor(scope: Scope, map: Map<string, string>);
|
|
5
|
+
map: Map<string, string>;
|
|
6
|
+
scope: Scope;
|
|
7
|
+
maybeConvertFromExportDeclaration(parentDeclar: NodePath): void;
|
|
8
|
+
maybeConvertFromClassFunctionExpression(path: NodePath): NodePath<traverse.Node>;
|
|
9
|
+
rename(): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=renamer.d.ts.map
|
package/dist/renamer.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// original https://github.com/babel/babel/blob/9c77558234c87b9220604fbc1519089e2d6334e2/packages/babel-traverse/src/scope/lib/renamer.ts#L61
|
|
2
|
+
import splitExportDeclaration from '@babel/helper-split-export-declaration';
|
|
3
|
+
import traverse, { visitors, } from '@babel/traverse';
|
|
4
|
+
import * as t from '@babel/types';
|
|
5
|
+
// ESM import of CommonJS module - traverse.default contains the actual traverse function
|
|
6
|
+
const traverseNode = traverse.default?.node || traverse.node;
|
|
7
|
+
const renameVisitor = {
|
|
8
|
+
ReferencedIdentifier({ node }, state) {
|
|
9
|
+
for (let [oldName, newName] of state.map) {
|
|
10
|
+
// console.log(node.name, oldName, newName)
|
|
11
|
+
if (node.name === oldName) {
|
|
12
|
+
node.name = newName;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
// Scope(path, state) {
|
|
17
|
+
// if (
|
|
18
|
+
// !path.scope.bindingIdentifierEquals(
|
|
19
|
+
// state.oldName,
|
|
20
|
+
// state.binding.identifier,
|
|
21
|
+
// )
|
|
22
|
+
// ) {
|
|
23
|
+
// path.skip()
|
|
24
|
+
// if (path.isMethod()) {
|
|
25
|
+
// requeueComputedKeyAndDecorators(path)
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
28
|
+
// },
|
|
29
|
+
ObjectProperty({ node, scope }, state) {
|
|
30
|
+
const { name } = node.key;
|
|
31
|
+
if (node.shorthand &&
|
|
32
|
+
// In destructuring the identifier is already renamed by the
|
|
33
|
+
// AssignmentExpression|Declaration|VariableDeclarator visitor,
|
|
34
|
+
// while in object literals it's renamed later by the
|
|
35
|
+
// ReferencedIdentifier visitor.
|
|
36
|
+
// (name === state.oldName || name === state.newName) &&
|
|
37
|
+
(state.map.has(name) || inverseMap(state.map).has(name)) &&
|
|
38
|
+
// Ignore shadowed bindings
|
|
39
|
+
[...state.map.keys()].some((oldName) => state.scope.getBindingIdentifier(oldName) ===
|
|
40
|
+
scope.getBindingIdentifier(name))) {
|
|
41
|
+
node.shorthand = false;
|
|
42
|
+
if (node.extra?.shorthand)
|
|
43
|
+
node.extra.shorthand = false;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
'AssignmentExpression|Declaration|VariableDeclarator'(path, state) {
|
|
48
|
+
if (path.isVariableDeclaration())
|
|
49
|
+
return;
|
|
50
|
+
const ids = path.getOuterBindingIdentifiers();
|
|
51
|
+
for (const name in ids) {
|
|
52
|
+
for (let [oldName, newName] of state.map) {
|
|
53
|
+
// console.log(name, oldName, newName)
|
|
54
|
+
if (name === oldName)
|
|
55
|
+
ids[name].name = newName;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
let cache = new WeakMap();
|
|
61
|
+
function inverseMap(map) {
|
|
62
|
+
if (cache.has(map))
|
|
63
|
+
return cache.get(map);
|
|
64
|
+
const inverse = new Map();
|
|
65
|
+
for (let [key, value] of map) {
|
|
66
|
+
inverse.set(value, key);
|
|
67
|
+
}
|
|
68
|
+
cache.set(map, inverse);
|
|
69
|
+
return inverse;
|
|
70
|
+
}
|
|
71
|
+
export default class BatchRenamer {
|
|
72
|
+
constructor(scope, map) {
|
|
73
|
+
this.map = map;
|
|
74
|
+
this.scope = scope;
|
|
75
|
+
}
|
|
76
|
+
maybeConvertFromExportDeclaration(parentDeclar) {
|
|
77
|
+
const maybeExportDeclar = parentDeclar.parentPath;
|
|
78
|
+
if (!maybeExportDeclar?.isExportDeclaration()) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (maybeExportDeclar.isExportDefaultDeclaration()) {
|
|
82
|
+
const { declaration } = maybeExportDeclar.node;
|
|
83
|
+
if (t.isDeclaration(declaration) && !declaration.id) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (maybeExportDeclar.isExportAllDeclaration()) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
splitExportDeclaration(maybeExportDeclar);
|
|
91
|
+
}
|
|
92
|
+
maybeConvertFromClassFunctionExpression(path) {
|
|
93
|
+
return path;
|
|
94
|
+
}
|
|
95
|
+
rename( /* Babel 7 - block?: t.Pattern | t.Scopable */ /* Babel 7 - block?: t.Pattern | t.Scopable */) {
|
|
96
|
+
const { scope, map } = this;
|
|
97
|
+
for (let binding of [...map.keys()].map((name) => scope.getBinding(name))) {
|
|
98
|
+
if (!binding) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const path = binding.path;
|
|
102
|
+
const parentDeclar = path.find((path) => path.isDeclaration() ||
|
|
103
|
+
path.isFunctionExpression() ||
|
|
104
|
+
path.isClassExpression());
|
|
105
|
+
if (parentDeclar) {
|
|
106
|
+
const bindingIds = parentDeclar.getOuterBindingIdentifiers();
|
|
107
|
+
const oldNames = Object.keys(bindingIds);
|
|
108
|
+
for (let oldName of oldNames) {
|
|
109
|
+
const binding = scope.getBinding(oldName);
|
|
110
|
+
if (binding && bindingIds[oldName] === binding.identifier) {
|
|
111
|
+
// When we are renaming an exported identifier, we need to ensure that
|
|
112
|
+
// the exported binding keeps the old name.
|
|
113
|
+
this.maybeConvertFromExportDeclaration(parentDeclar);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
traverseNode(scope.block, visitors.explode(renameVisitor), scope, this, scope.path,
|
|
119
|
+
// When blockToTraverse is a SwitchStatement, the discriminant
|
|
120
|
+
// is not part of the current scope and thus should be skipped.
|
|
121
|
+
{ discriminant: true });
|
|
122
|
+
for (let [oldName, newName] of map) {
|
|
123
|
+
if (oldName === newName)
|
|
124
|
+
continue;
|
|
125
|
+
if (!arguments[0]) {
|
|
126
|
+
scope.removeOwnBinding(oldName);
|
|
127
|
+
const binding = scope.getBinding(oldName);
|
|
128
|
+
if (binding) {
|
|
129
|
+
binding.identifier.name = newName;
|
|
130
|
+
scope.bindings[newName] = binding;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// logger.log(`binding not found for ${oldName}`)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=renamer.js.map
|
package/dist/sentry.d.ts
ADDED
package/dist/sentry.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function generateStackblitzFiles({ projectId, appComponentCode, title }: {
|
|
2
|
+
appComponentCode?: string | undefined;
|
|
3
|
+
projectId: any;
|
|
4
|
+
title?: string | undefined;
|
|
5
|
+
}): {
|
|
6
|
+
relativePath: string;
|
|
7
|
+
contents: string;
|
|
8
|
+
}[];
|
|
9
|
+
//# sourceMappingURL=stackblitz.d.ts.map
|