@webround/editor 0.3.2 → 0.3.4

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.
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // packages/editor/src/context/WrAppContext.tsx
3
3
  import { createContext, useContext, useState, useCallback, useMemo, useEffect, useSyncExternalStore, lazy, Suspense } from 'react';
4
4
  import { createBrowserRouter, RouterProvider, useLocation, useParams } from 'react-router-dom';
5
+ import { WrScroll } from '@webround/core/scroll';
5
6
  import { wrResolveRoutes, wrBuildRegistry, wrBuildLazyRegistry, wrBuildPageConfigMap, wrExpandRoutesForLangs, wrExtractLang, wrBuildLangPath, wrSharedScopes, } from '@webround/core/routing';
6
7
  import { WrPageProvider } from './WrPageContext';
7
8
  import { WrLayout } from './WrLayout';
@@ -55,7 +56,7 @@ function WrRouteElement({ route, lazyFallback: LazyFallback, Header, Footer, })
55
56
  const Component = route.Component;
56
57
  return _jsx(Component, {});
57
58
  })();
58
- return (_jsxs(WrPageProvider, { config: config, pageName: pageName, file: file, children: [_jsx(WrSeoHead, { site: site, config: config, pathname: pathname, lang: lang, langs: langs }), _jsx(WrLayout, { Header: Header, Footer: Footer, showHeader: route.header, showFooter: route.footer, children: body })] }, pageName));
59
+ return (_jsxs(WrPageProvider, { config: config, pageName: pageName, file: file, children: [_jsx(WrScroll, {}), _jsx(WrSeoHead, { site: site, config: config, pathname: pathname, lang: lang, langs: langs }), _jsx(WrLayout, { Header: Header, Footer: Footer, showHeader: route.header, showFooter: route.footer, children: body })] }, pageName));
59
60
  }
60
61
  export function WrAppProvider({ routesFile, eagerModules, lazyModules, configModules, langs, initialLang = 'default', lazyFallback = WrDefaultPageFallback, Header, Footer, seo, shared, children, }) {
61
62
  // Config delle pagine: stato live, indipendente dal router.
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import postcss from 'postcss';
4
- import { WR_THEME_START_PROPERTY } from '@webround/core/theme';
4
+ import { WR_THEME_START_PROPERTY, wrGoogleFamilyParam, wrGoogleWeightsOfParam } from '@webround/core/theme';
5
5
  import { defineOperation, invalid, object, requiredText } from '../define.js';
6
6
  // The site's theme: custom properties (`--wr-*`), Google fonts and custom fonts, all in `src/theme.css`. Read and written with postcss, so
7
7
  // what the user wrote around them stays as it was.
@@ -75,15 +75,12 @@ function parseGoogleImport(rule) {
75
75
  const entries = [];
76
76
  for (const family of url.searchParams.getAll('family')) {
77
77
  const [name, rest] = family.split(':');
78
- const weights = rest?.startsWith('wght@') ? rest.slice('wght@'.length) : rest;
79
- entries.push({ family: name.replace(/\+/g, ' '), weights });
78
+ entries.push({ family: name.replace(/\+/g, ' '), weights: wrGoogleWeightsOfParam(rest) });
80
79
  }
81
80
  return entries;
82
81
  }
83
82
  function buildGoogleImportRule(entries) {
84
- const params = entries
85
- .map(({ family, weights }) => `family=${family.replace(/ /g, '+')}${weights ? `:wght@${weights}` : ''}`)
86
- .join('&');
83
+ const params = entries.map(({ family, weights }) => wrGoogleFamilyParam(family, weights)).join('&');
87
84
  return `url('https://fonts.googleapis.com/css2?${params}&display=swap')`;
88
85
  }
89
86
  function getThemeItems(root) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webround/editor",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -65,7 +65,7 @@
65
65
  "@lexical/selection": "^0.51.0",
66
66
  "@lexical/utils": "^0.51.0",
67
67
  "@monaco-editor/react": "^4.7.0",
68
- "@webround/core": "^0.3.0",
68
+ "@webround/core": "^0.3.4",
69
69
  "highlight.js": "^11.12.0",
70
70
  "hls.js": "^1.5.0",
71
71
  "lexical": "^0.51.0",