create-nextblock 0.2.43 → 0.2.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -6,7 +6,6 @@ import type { Metadata } from 'next';
6
6
  import PageClientContent from "./PageClientContent";
7
7
  import { getPageDataBySlug } from "./page.utils";
8
8
  import BlockRenderer from "../../components/BlockRenderer";
9
- import type { HeroBlockContent } from '../../lib/blocks/blockRegistry';
10
9
  import { cookies, headers } from "next/headers";
11
10
 
12
11
  export const dynamicParams = true;
@@ -147,31 +146,13 @@ export default async function DynamicPage({ params: paramsPromise }: PageProps)
147
146
  }
148
147
  }
149
148
 
150
- let lcpImageUrl: string | null = null;
151
- const r2BaseUrl = process.env.NEXT_PUBLIC_R2_BASE_URL || "";
152
-
153
- if (pageData && pageData.blocks && r2BaseUrl) {
154
- const heroBlock = pageData.blocks.find(block => block.block_type === 'hero');
155
- if (heroBlock) {
156
- const heroContent = heroBlock.content as unknown as HeroBlockContent;
157
- if (
158
- heroContent.background &&
159
- heroContent.background.type === "image" &&
160
- heroContent.background.image &&
161
- heroContent.background.image.object_key
162
- ) {
163
- lcpImageUrl = `${r2BaseUrl}/${heroContent.background.image.object_key}`;
164
- }
165
- }
166
- }
149
+
167
150
 
168
151
  const pageBlocks = pageData ? <BlockRenderer blocks={pageData.blocks} languageId={pageData.language_id} /> : null;
169
152
 
170
153
  return (
171
154
  <>
172
- {lcpImageUrl && (
173
- <link rel="preload" as="image" href={lcpImageUrl} />
174
- )}
155
+
175
156
  <PageClientContent initialPageData={pageData} currentSlug={params.slug} translatedSlugs={translatedSlugs}>
176
157
  {pageBlocks}
177
158
  </PageClientContent>
@@ -32,6 +32,7 @@ export function Providers({ children, ...props }: { children: React.ReactNode;[k
32
32
  enableSystem
33
33
  disableTransitionOnChange
34
34
  nonce={nonce}
35
+ themes={['light', 'dark', 'vibrant']}
35
36
  >
36
37
  {children}
37
38
  </ThemeProvider>
@@ -16,6 +16,11 @@ const ClientTextBlockRenderer: React.FC<ClientTextBlockRendererProps> = ({ conte
16
16
  const options: HTMLReactParserOptions = {
17
17
  replace: (domNode) => {
18
18
  if (domNode instanceof Element && domNode.attribs) {
19
+ if (domNode.attribs['fetchpriority']) {
20
+ domNode.attribs['fetchPriority'] = domNode.attribs['fetchpriority'];
21
+ delete domNode.attribs['fetchpriority'];
22
+ }
23
+
19
24
  if (domNode.attribs['data-alert-widget'] !== undefined) {
20
25
  const {
21
26
  'data-type': type,
@@ -8,13 +8,15 @@ import {
8
8
  DropdownMenuRadioItem,
9
9
  DropdownMenuTrigger,
10
10
  } from "@nextblock-cms/ui";
11
- import { Laptop, Moon, Sun } from "lucide-react";
11
+ import { Laptop, Moon, Sun, Zap } from "lucide-react";
12
12
  import { useTheme } from "next-themes";
13
13
  import { useEffect, useState } from "react";
14
+ import { useTranslations } from "@nextblock-cms/utils";
14
15
 
15
16
  const ThemeSwitcher = () => {
16
17
  const [mounted, setMounted] = useState(false);
17
18
  const { theme, setTheme } = useTheme();
19
+ const { t } = useTranslations();
18
20
 
19
21
  // useEffect only runs on the client, so now we can safely show the UI
20
22
  useEffect(() => {
@@ -30,7 +32,7 @@ const ThemeSwitcher = () => {
30
32
  return (
31
33
  <DropdownMenu>
32
34
  <DropdownMenuTrigger asChild>
33
- <Button variant="ghost" size={"sm"} aria-label="Theme Switcher">
35
+ <Button variant="ghost" size={"sm"} aria-label={t('theme_switcher')}>
34
36
  {theme === "light" ? (
35
37
  <Sun
36
38
  key="light"
@@ -43,6 +45,12 @@ const ThemeSwitcher = () => {
43
45
  size={ICON_SIZE}
44
46
  className={"text-muted-foreground"}
45
47
  />
48
+ ) : theme === "vibrant" ? (
49
+ <Zap
50
+ key="vibrant"
51
+ size={ICON_SIZE}
52
+ className={"text-muted-foreground"}
53
+ />
46
54
  ) : (
47
55
  <Laptop
48
56
  key="system"
@@ -59,15 +67,19 @@ const ThemeSwitcher = () => {
59
67
  >
60
68
  <DropdownMenuRadioItem className="flex gap-2" value="light">
61
69
  <Sun size={ICON_SIZE} className="text-muted-foreground" />{" "}
62
- <span>Light</span>
70
+ <span>{t('theme_light')}</span>
63
71
  </DropdownMenuRadioItem>
64
72
  <DropdownMenuRadioItem className="flex gap-2" value="dark">
65
73
  <Moon size={ICON_SIZE} className="text-muted-foreground" />{" "}
66
- <span>Dark</span>
74
+ <span>{t('theme_dark')}</span>
75
+ </DropdownMenuRadioItem>
76
+ <DropdownMenuRadioItem className="flex gap-2" value="vibrant">
77
+ <Zap size={ICON_SIZE} className="text-muted-foreground" />{" "}
78
+ <span>{t('theme_vibrant')}</span>
67
79
  </DropdownMenuRadioItem>
68
80
  <DropdownMenuRadioItem className="flex gap-2" value="system">
69
81
  <Laptop size={ICON_SIZE} className="text-muted-foreground" />{" "}
70
- <span>System</span>
82
+ <span>{t('theme_system')}</span>
71
83
  </DropdownMenuRadioItem>
72
84
  </DropdownMenuRadioGroup>
73
85
  </DropdownMenuContent>
@@ -1,6 +1,6 @@
1
1
  /// <reference types="next" />
2
2
  /// <reference types="next/image-types/global" />
3
- import "./.next/types/routes.d.ts";
3
+ import "./.next/dev/types/routes.d.ts";
4
4
 
5
5
  // NOTE: This file should not be edited
6
6
  // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/template",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",
@@ -3,19 +3,17 @@ const { join } = require('path');
3
3
 
4
4
  /** @type {import('tailwindcss').Config} */
5
5
  module.exports = {
6
- presets: [require('../../tailwind.config.js')],
6
+ presets: [require('../../libs/ui/tailwind.config.js')],
7
7
  content: (() => {
8
8
  const projectGlobs = [
9
9
  join(
10
10
  __dirname,
11
- '{src,pages,components,app,lib}/**/*!(*.stories|*.spec).{ts,tsx,js,jsx,md,mdx,html}'
11
+ '{src,pages,components,app,lib}/**/*!(*.stories|*.spec).{ts,tsx,js,jsx,md,mdx,html}',
12
12
  ),
13
13
  ];
14
14
  const libsDir = join(__dirname, '../../libs');
15
15
  if (existsSync(libsDir)) {
16
- projectGlobs.push(
17
- join(libsDir, '**/*.{ts,tsx,js,jsx,md,mdx,html,sql}')
18
- );
16
+ projectGlobs.push(join(libsDir, '**/*.{ts,tsx,js,jsx,md,mdx,html,sql}'));
19
17
  }
20
18
  return projectGlobs;
21
19
  })(),
@@ -38,7 +38,7 @@
38
38
  "next-env.d.ts",
39
39
  ".next/types/**/*.ts",
40
40
  "../../dist/apps/nextblock/.next/types/**/*.ts",
41
- "../../tailwind.config.js"
41
+ "../../libs/ui/tailwind.config.js"
42
42
  ],
43
43
  "exclude": [
44
44
  "node_modules",