@diplodoc/client 2.0.5 → 2.1.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/CHANGELOG.md +13 -0
- package/build/client/app.css +1 -1
- package/build/client/app.css.map +1 -1
- package/build/client/app.js +1 -1
- package/build/client/app.js.map +1 -1
- package/build/client/app.rtl.css +2 -0
- package/build/client/manifest.json +5 -3
- package/build/client/react.js +1 -1
- package/build/client/react.js.map +1 -1
- package/build/client/vendor.css +124 -292
- package/build/client/vendor.css.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/client/vendor.rtl.css +2641 -0
- package/build/constants.d.ts +5 -0
- package/build/server/app.js +67 -45
- package/build/server/app.js.map +1 -1
- package/build/server/manifest.json +2 -2
- package/build/server/react.js +17 -17
- package/build/server/vendor.js +4209 -2870
- package/build/server/vendor.js.map +1 -1
- package/build/utils.d.ts +3 -1
- package/package.json +10 -4
- package/rtl-css.js +66 -0
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Theme } from '@diplodoc/components';
|
|
1
|
+
import { Lang, Theme } from '@diplodoc/components';
|
|
2
|
+
import { TextDirection } from './constants';
|
|
2
3
|
export declare function strToBoolean(str: string | boolean): boolean;
|
|
3
4
|
export declare function updateRootClassName({ theme, mobileView, wideFormat, fullHeader, }: {
|
|
4
5
|
theme: Theme;
|
|
@@ -6,3 +7,4 @@ export declare function updateRootClassName({ theme, mobileView, wideFormat, ful
|
|
|
6
7
|
wideFormat: boolean;
|
|
7
8
|
fullHeader: boolean;
|
|
8
9
|
}): void;
|
|
10
|
+
export declare function getDirection(lang: Lang): TextDirection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diplodoc/client",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/server/app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
".": {
|
|
23
23
|
"types": "./build/index.d.ts",
|
|
24
24
|
"style": "./build/client/app.css",
|
|
25
|
+
"style-rtl": "./build/app.rtl.css",
|
|
25
26
|
"default": "./build/client/app.js"
|
|
26
27
|
},
|
|
27
28
|
"./ssr": {
|
|
@@ -35,13 +36,13 @@
|
|
|
35
36
|
"./styles": "./build/client/app.css"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@diplodoc/components": "^
|
|
39
|
+
"@diplodoc/components": "^4.0.0",
|
|
39
40
|
"@diplodoc/latex-extension": "^1.0.2",
|
|
40
41
|
"@diplodoc/mermaid-extension": "^1.2.1",
|
|
41
|
-
"@diplodoc/openapi-extension": "^
|
|
42
|
+
"@diplodoc/openapi-extension": "^2.0.0",
|
|
42
43
|
"@diplodoc/transform": "^4.10.3",
|
|
43
44
|
"@gravity-ui/page-constructor": "^4.24.0",
|
|
44
|
-
"@gravity-ui/uikit": "
|
|
45
|
+
"@gravity-ui/uikit": "6.0.0",
|
|
45
46
|
"bem-cn-lite": "^4.1.0",
|
|
46
47
|
"react": "^18.2.0",
|
|
47
48
|
"react-dom": "^18.2.0",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"lint-staged": "^13.2.2",
|
|
61
62
|
"mini-css-extract-plugin": "^2.7.6",
|
|
62
63
|
"react-svg-loader": "^3.0.3",
|
|
64
|
+
"rtlcss": "^4.1.1",
|
|
63
65
|
"sass": "^1.69.5",
|
|
64
66
|
"sass-loader": "^13.3.2",
|
|
65
67
|
"style-loader": "^3.3.3",
|
|
@@ -68,5 +70,9 @@
|
|
|
68
70
|
"webpack-bundle-analyzer": "^4.9.0",
|
|
69
71
|
"webpack-cli": "^5.1.1",
|
|
70
72
|
"webpack-manifest-plugin": "^5.0.0"
|
|
73
|
+
},
|
|
74
|
+
"overrides": {
|
|
75
|
+
"@gravity-ui/uikit": "6.0.0",
|
|
76
|
+
"@gravity-ui/components": "3.0.0"
|
|
71
77
|
}
|
|
72
78
|
}
|
package/rtl-css.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
|
|
3
|
+
const rtlcss = require('rtlcss')
|
|
4
|
+
const webpack = require('webpack')
|
|
5
|
+
|
|
6
|
+
const checkIsCss = filename => path.extname(filename) === '.css'
|
|
7
|
+
|
|
8
|
+
class RtlCssPlugin {
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = {
|
|
11
|
+
filename: '[name].rtl.css',
|
|
12
|
+
options: {},
|
|
13
|
+
plugins: [],
|
|
14
|
+
hooks: {},
|
|
15
|
+
...options
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
processAssets = (compilation, callback) => {
|
|
20
|
+
compilation.chunks.forEach(chunk => {
|
|
21
|
+
Array.from(chunk.files)
|
|
22
|
+
.filter(checkIsCss)
|
|
23
|
+
.forEach(filename => {
|
|
24
|
+
// Get the asset source for each file generated by the chunk:
|
|
25
|
+
const assetSource = compilation.assets[filename].source()
|
|
26
|
+
const processedAssetSource = rtlcss.process(assetSource, this.options.options, this.options.plugins, this.options.hooks)
|
|
27
|
+
|
|
28
|
+
let interpolatedFilePath
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(this.options.filename)) {
|
|
31
|
+
if (this.options.filename.length !== 2) {
|
|
32
|
+
throw Error('You should pass two elements and array')
|
|
33
|
+
}
|
|
34
|
+
// also allow save current file destination
|
|
35
|
+
interpolatedFilePath = filename.replace(this.options.filename[0], this.options.filename[1])
|
|
36
|
+
} else {
|
|
37
|
+
interpolatedFilePath = compilation.getPath(this.options.filename, {
|
|
38
|
+
chunk,
|
|
39
|
+
cssFileName: filename,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
compilation.assets[interpolatedFilePath] = new webpack.sources.RawSource(processedAssetSource)
|
|
43
|
+
if (this.options.addToChunkFiles) {
|
|
44
|
+
/* for example: LoadablePlugin will add this chunks to loadable config, but it's not always required */
|
|
45
|
+
chunk.files.add(interpolatedFilePath)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
callback()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
apply(compiler) {
|
|
54
|
+
compiler.hooks.compilation.tap('RtlCssPlugin', compilation => {
|
|
55
|
+
compilation.hooks.processAssets.tapAsync(
|
|
56
|
+
{
|
|
57
|
+
name: 'RtlCssPlugin-processing',
|
|
58
|
+
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
59
|
+
},
|
|
60
|
+
(chunks, callback) => this.processAssets(compilation, callback),
|
|
61
|
+
)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = RtlCssPlugin
|