@gravity-ui/page-constructor 5.28.1 → 5.28.3

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 CHANGED
@@ -109,6 +109,42 @@ interface NavigationLogo {
109
109
  }
110
110
  ```
111
111
 
112
+ ### Server utils
113
+
114
+ The package provides a set of server utilities for transforming your content.
115
+
116
+ ```ts
117
+ const {fullTransform} = require('@gravity-ui/page-constructor/server');
118
+
119
+ const {html} = fullTransform(content, {
120
+ lang,
121
+ extractTitle: true,
122
+ allowHTML: true,
123
+ path: __dirname,
124
+ plugins,
125
+ });
126
+ ```
127
+
128
+ Under the hood, a package is used to transform Yandex Flavored Markdown into HTML - `diplodoc/transfrom`, so it is also in peer dependencies
129
+
130
+ You can also use useful utilities in the places you need, for example in your custom components
131
+
132
+ ```ts
133
+ const {
134
+ typografToText,
135
+ typografToHTML,
136
+ yfmTransformer,
137
+ } = require('@gravity-ui/page-constructor/server');
138
+
139
+ const post = {
140
+ title: typografToText(title, lang),
141
+ content: typografToHTML(content, lang),
142
+ description: yfmTransformer(lang, description, {plugins}),
143
+ };
144
+ ```
145
+
146
+ You can find more utilities in this [section](https://github.com/gravity-ui/page-constructor/tree/main/src/text-transform)
147
+
112
148
  ### Custom blocks
113
149
 
114
150
  The page constructor lets you use blocks that are user-defined in their app. Blocks are regular React components.
@@ -316,6 +352,24 @@ npm ci
316
352
  npm run dev
317
353
  ```
318
354
 
355
+ #### Note about Vite
356
+
357
+ ```ts
358
+ import react from '@vitejs/plugin-react-swc';
359
+ import dynamicImport from 'vite-plugin-dynamic-import';
360
+
361
+ export default defineConfig({
362
+ plugins: [
363
+ react(),
364
+ dynamicImport({
365
+ filter: (id) => id.includes('/node_modules/@gravity-ui/page-constructor'),
366
+ }),
367
+ ],
368
+ });
369
+ ```
370
+
371
+ For Vite, you need to install the `vite-plugin-dynamic-import` plugin and configure the config so that dynamic imports work
372
+
319
373
  ## Release flow
320
374
 
321
375
  In usual cases we use two types of commits:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "5.28.1",
3
+ "version": "5.28.3",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- @import 'node_modules/@gravity-ui/uikit/styles/mixins.scss';
1
+ @import '@gravity-ui/uikit/styles/mixins.scss';
2
2
  @import './variables.scss';
3
3
 
4
4
  //common