@nitrogenbuilder/connector-payload 0.1.23 → 0.1.24
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/editor/NitrogenEditorAssetsRoute.d.ts +6 -0
- package/dist/editor/NitrogenEditorAssetsRoute.js +56 -0
- package/dist/editor/NitrogenEditorPage.js +10 -12
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +1 -0
- package/dist/editor-assets/fa620pro/css/all.css +26887 -0
- package/dist/editor-assets/fa620pro/css/all.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/brands.css +1516 -0
- package/dist/editor-assets/fa620pro/css/brands.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/duotone.css +12395 -0
- package/dist/editor-assets/fa620pro/css/duotone.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/fontawesome.css +12880 -0
- package/dist/editor-assets/fa620pro/css/fontawesome.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/light.css +19 -0
- package/dist/editor-assets/fa620pro/css/light.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/regular.css +19 -0
- package/dist/editor-assets/fa620pro/css/regular.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/sharp-solid.css +19 -0
- package/dist/editor-assets/fa620pro/css/sharp-solid.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/solid.css +19 -0
- package/dist/editor-assets/fa620pro/css/solid.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/svg-with-js.css +635 -0
- package/dist/editor-assets/fa620pro/css/svg-with-js.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/thin.css +19 -0
- package/dist/editor-assets/fa620pro/css/thin.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/v4-font-face.css +26 -0
- package/dist/editor-assets/fa620pro/css/v4-font-face.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/v4-shims.css +2194 -0
- package/dist/editor-assets/fa620pro/css/v4-shims.min.css +6 -0
- package/dist/editor-assets/fa620pro/css/v5-font-face.css +34 -0
- package/dist/editor-assets/fa620pro/css/v5-font-face.min.css +6 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-brands-400.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-brands-400.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-duotone-900.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-duotone-900.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-light-300.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-light-300.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-regular-400.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-regular-400.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-sharp-solid-900.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-sharp-solid-900.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-solid-900.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-solid-900.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-thin-100.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-thin-100.woff2 +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-v4compatibility.ttf +0 -0
- package/dist/editor-assets/fa620pro/webfonts/fa-v4compatibility.woff2 +0 -0
- package/dist/editor-assets/logo-white.svg +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { NextResponse } from "next/server";
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
const ASSETS_DIR = path.resolve(__dirname, "..", "editor-assets");
|
|
8
|
+
function getContentType(filePath) {
|
|
9
|
+
switch (path.extname(filePath).toLowerCase()) {
|
|
10
|
+
case ".css":
|
|
11
|
+
return "text/css; charset=utf-8";
|
|
12
|
+
case ".svg":
|
|
13
|
+
return "image/svg+xml";
|
|
14
|
+
case ".woff2":
|
|
15
|
+
return "font/woff2";
|
|
16
|
+
case ".woff":
|
|
17
|
+
return "font/woff";
|
|
18
|
+
case ".ttf":
|
|
19
|
+
return "font/ttf";
|
|
20
|
+
case ".eot":
|
|
21
|
+
return "application/vnd.ms-fontobject";
|
|
22
|
+
case ".otf":
|
|
23
|
+
return "font/otf";
|
|
24
|
+
case ".ico":
|
|
25
|
+
return "image/x-icon";
|
|
26
|
+
default:
|
|
27
|
+
return "application/octet-stream";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function normalizeSlug(slug) {
|
|
31
|
+
return (slug ?? []).filter((segment) => segment && segment !== "." && segment !== "..");
|
|
32
|
+
}
|
|
33
|
+
export async function GET(_request, context) {
|
|
34
|
+
const params = await context.params;
|
|
35
|
+
const slug = normalizeSlug(params.slug);
|
|
36
|
+
if (slug.length === 0) {
|
|
37
|
+
return new NextResponse("Not Found", { status: 404 });
|
|
38
|
+
}
|
|
39
|
+
const filePath = path.join(ASSETS_DIR, ...slug);
|
|
40
|
+
const relativePath = path.relative(ASSETS_DIR, filePath);
|
|
41
|
+
if (relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
|
|
42
|
+
return new NextResponse("Not Found", { status: 404 });
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const data = await fs.readFile(filePath);
|
|
46
|
+
return new NextResponse(new Uint8Array(data), {
|
|
47
|
+
headers: {
|
|
48
|
+
"Content-Type": getContentType(filePath),
|
|
49
|
+
"Cache-Control": "public, max-age=31536000, immutable",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return new NextResponse("Not Found", { status: 404 });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -83,17 +83,11 @@ export function createNitrogenEditorPage(config) {
|
|
|
83
83
|
const editId = params.templateId || params.pageId || "";
|
|
84
84
|
const isEditorDev = isDevelopment && !!settings.instanceUrl;
|
|
85
85
|
const editorOrigin = settings.instanceUrl?.replace(/\/$/, "") || "";
|
|
86
|
+
const editorAssetsBase = isEditorDev
|
|
87
|
+
? editorOrigin
|
|
88
|
+
: "/nitrogen-editor/assets";
|
|
86
89
|
const cdnBase = `https://cdn.jsdelivr.net/npm/@nitrogenbuilder/editor@${EDITOR_CDN_VERSION}`;
|
|
87
|
-
|
|
88
|
-
color: "#ffffff",
|
|
89
|
-
fontFamily: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
90
|
-
fontSize: "2rem",
|
|
91
|
-
fontWeight: 600,
|
|
92
|
-
letterSpacing: "0.08em",
|
|
93
|
-
textTransform: "uppercase",
|
|
94
|
-
animation: "nitrogen-loader-pulse 3s ease-in-out infinite",
|
|
95
|
-
}, children: "Nitrogen" }));
|
|
96
|
-
return (_jsxs(_Fragment, { children: [!isEditorDev && (_jsxs(_Fragment, { children: [_jsx("link", { rel: "preconnect", href: "https://cdn.jsdelivr.net" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "" })] })), isEditorDev ? (_jsxs(_Fragment, { children: [_jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorOrigin}/fa620pro/css/all.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorOrigin}/fa620pro/css/sharp-solid.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorOrigin}/src/index.scss` })] })) : (_jsx(_Fragment, { children: _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${cdnBase}/index.css` }) })), _jsx("script", { dangerouslySetInnerHTML: {
|
|
90
|
+
return (_jsxs(_Fragment, { children: [!isEditorDev && (_jsxs(_Fragment, { children: [_jsx("link", { rel: "preconnect", href: "https://cdn.jsdelivr.net" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "" })] })), isEditorDev ? (_jsxs(_Fragment, { children: [_jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorAssetsBase}/fa620pro/css/all.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorAssetsBase}/fa620pro/css/sharp-solid.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorOrigin}/src/index.scss` })] })) : (_jsxs(_Fragment, { children: [_jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorAssetsBase}/fa620pro/css/all.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${editorAssetsBase}/fa620pro/css/sharp-solid.css` }), _jsx("link", { rel: "stylesheet", crossOrigin: "", href: `${cdnBase}/index.css` })] })), _jsx("script", { dangerouslySetInnerHTML: {
|
|
97
91
|
__html: [
|
|
98
92
|
`window.nitrogenConfig = ${JSON.stringify(builderConfig)};`,
|
|
99
93
|
`window.nitrogenEditId = "${editId}";`,
|
|
@@ -108,11 +102,15 @@ export function createNitrogenEditorPage(config) {
|
|
|
108
102
|
alignItems: "center",
|
|
109
103
|
justifyContent: "center",
|
|
110
104
|
backgroundColor: "#0F1214",
|
|
111
|
-
}, children: isEditorDev ? (_jsx("img", { src: `${
|
|
105
|
+
}, children: isEditorDev ? (_jsx("img", { src: `${editorAssetsBase}/logo-white.svg`, alt: "Loading\u2026", style: {
|
|
112
106
|
width: "24rem",
|
|
113
107
|
maxWidth: "100%",
|
|
114
108
|
animation: "nitrogen-loader-pulse 3s ease-in-out infinite",
|
|
115
|
-
} })) : (
|
|
109
|
+
} })) : (_jsx("img", { src: `${editorAssetsBase}/logo-white.svg`, alt: "Loading\u2026", style: {
|
|
110
|
+
width: "24rem",
|
|
111
|
+
maxWidth: "100%",
|
|
112
|
+
animation: "nitrogen-loader-pulse 3s ease-in-out infinite",
|
|
113
|
+
} })) }), _jsx("style", { dangerouslySetInnerHTML: {
|
|
116
114
|
__html: `@keyframes nitrogen-loader-pulse{0%{transform:scale(1);opacity:0}50%{opacity:1}100%{transform:scale(1.05);opacity:0}}`,
|
|
117
115
|
} })] }), isEditorDev ? (_jsxs(_Fragment, { children: [_jsx("script", { type: "module", dangerouslySetInnerHTML: {
|
|
118
116
|
__html: `import RefreshRuntime from "${editorOrigin}/@react-refresh";RefreshRuntime.injectIntoGlobalHook(window);window.$RefreshReg$ = () => {};window.$RefreshSig$ = () => (type) => type;window.__vite_plugin_react_preamble_installed__ = true;`,
|
package/dist/editor/index.d.ts
CHANGED
package/dist/editor/index.js
CHANGED