@webiny/lexical-theme 5.38.0-beta.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/LICENSE +21 -0
- package/README.md +6 -0
- package/createTheme.d.ts +9 -0
- package/createTheme.js +95 -0
- package/createTheme.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +62 -0
- package/index.js.map +1 -0
- package/package.json +22 -0
- package/theme.css +423 -0
- package/types.d.ts +21 -0
- package/types.js +7 -0
- package/types.js.map +1 -0
- package/utils/findTypographyStyleByHtmlTag.d.ts +8 -0
- package/utils/findTypographyStyleByHtmlTag.js +18 -0
- package/utils/findTypographyStyleByHtmlTag.js.map +1 -0
- package/utils/styleObjectToString.d.ts +2 -0
- package/utils/styleObjectToString.js +24 -0
- package/utils/styleObjectToString.js.map +1 -0
- package/utils/toTypographyEmotionMap.d.ts +3 -0
- package/utils/toTypographyEmotionMap.js +43 -0
- package/utils/toTypographyEmotionMap.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# @webiny/lexical-theme
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@webiny/llexical-lexical-theme)
|
|
4
|
+
[](https://www.npmjs.com/package/@webiny/lexical-theme)
|
|
5
|
+
[](https://github.com/prettier/prettier)
|
|
6
|
+
[](http://makeapullrequest.com)
|
package/createTheme.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EditorThemeClasses } from "lexical";
|
|
2
|
+
import "./theme.css";
|
|
3
|
+
import { ThemeEmotionMap } from "./types";
|
|
4
|
+
export declare type WebinyTheme = {
|
|
5
|
+
styles?: Record<string, any>;
|
|
6
|
+
emotionMap?: ThemeEmotionMap;
|
|
7
|
+
};
|
|
8
|
+
export declare type EditorTheme = WebinyTheme & EditorThemeClasses;
|
|
9
|
+
export declare const createTheme: () => EditorTheme;
|
package/createTheme.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createTheme = void 0;
|
|
7
|
+
require("./theme.css");
|
|
8
|
+
const defaultTheme = {
|
|
9
|
+
styles: undefined,
|
|
10
|
+
emotionMap: undefined,
|
|
11
|
+
characterLimit: "WebinyLexical__characterLimit",
|
|
12
|
+
code: "WebinyLexical__code",
|
|
13
|
+
codeHighlight: {
|
|
14
|
+
atrule: "WebinyLexical__tokenAttr",
|
|
15
|
+
attr: "WebinyLexical__tokenAttr",
|
|
16
|
+
boolean: "WebinyLexical__tokenProperty",
|
|
17
|
+
builtin: "WebinyLexical__tokenSelector",
|
|
18
|
+
cdata: "WebinyLexical__tokenComment",
|
|
19
|
+
char: "WebinyLexical__tokenSelector",
|
|
20
|
+
class: "WebinyLexical__tokenFunction",
|
|
21
|
+
"class-name": "WebinyLexical__tokenFunction",
|
|
22
|
+
comment: "WebinyLexical__tokenComment",
|
|
23
|
+
constant: "WebinyLexical__tokenProperty",
|
|
24
|
+
deleted: "WebinyLexical__tokenProperty",
|
|
25
|
+
doctype: "WebinyLexical__tokenComment",
|
|
26
|
+
entity: "WebinyLexical__tokenOperator",
|
|
27
|
+
function: "WebinyLexical__tokenFunction",
|
|
28
|
+
important: "WebinyLexical__tokenVariable",
|
|
29
|
+
inserted: "WebinyLexical__tokenSelector",
|
|
30
|
+
keyword: "WebinyLexical__tokenAttr",
|
|
31
|
+
namespace: "WebinyLexical__tokenVariable",
|
|
32
|
+
number: "WebinyLexical__tokenProperty",
|
|
33
|
+
operator: "WebinyLexical__tokenOperator",
|
|
34
|
+
prolog: "WebinyLexical__tokenComment",
|
|
35
|
+
property: "WebinyLexical__tokenProperty",
|
|
36
|
+
punctuation: "WebinyLexical__tokenPunctuation",
|
|
37
|
+
regex: "WebinyLexical__tokenVariable",
|
|
38
|
+
selector: "WebinyLexical__tokenSelector",
|
|
39
|
+
string: "WebinyLexical__tokenSelector",
|
|
40
|
+
symbol: "WebinyLexical__tokenProperty",
|
|
41
|
+
tag: "WebinyLexical__tokenProperty",
|
|
42
|
+
url: "WebinyLexical__tokenOperator",
|
|
43
|
+
variable: "WebinyLexical__tokenVariable"
|
|
44
|
+
},
|
|
45
|
+
embedBlock: {
|
|
46
|
+
base: "WebinyLexical__embedBlock",
|
|
47
|
+
focus: "WebinyLexical__embedBlockFocus"
|
|
48
|
+
},
|
|
49
|
+
hashtag: "WebinyLexical__hashtag",
|
|
50
|
+
heading: {
|
|
51
|
+
h1: "WebinyLexical__h1",
|
|
52
|
+
h2: "WebinyLexical__h2",
|
|
53
|
+
h3: "WebinyLexical__h3",
|
|
54
|
+
h4: "WebinyLexical__h4",
|
|
55
|
+
h5: "WebinyLexical__h5",
|
|
56
|
+
h6: "WebinyLexical__h6"
|
|
57
|
+
},
|
|
58
|
+
link: "WebinyLexical__link",
|
|
59
|
+
list: {
|
|
60
|
+
listitem: "WebinyLexical__listItem",
|
|
61
|
+
listitemChecked: "WebinyLexical__listItemChecked",
|
|
62
|
+
listitemUnchecked: "WebinyLexical__listItemUnchecked",
|
|
63
|
+
nested: {
|
|
64
|
+
listitem: "WebinyLexical__nestedListItem"
|
|
65
|
+
},
|
|
66
|
+
olDepth: ["WebinyLexical__ol1", "WebinyLexical__ol2", "WebinyLexical__ol3", "WebinyLexical__ol4", "WebinyLexical__ol5"],
|
|
67
|
+
ul: "WebinyLexical__ul"
|
|
68
|
+
},
|
|
69
|
+
ltr: "WebinyLexical__ltr",
|
|
70
|
+
mark: "WebinyLexical__mark",
|
|
71
|
+
markOverlap: "WebinyLexical__markOverlap",
|
|
72
|
+
paragraph: "WebinyLexical__paragraph",
|
|
73
|
+
quote: "WebinyLexical__quote",
|
|
74
|
+
rtl: "WebinyLexical__rtl",
|
|
75
|
+
text: {
|
|
76
|
+
bold: "WebinyLexical__textBold",
|
|
77
|
+
code: "WebinyLexical__textCode",
|
|
78
|
+
italic: "WebinyLexical__textItalic",
|
|
79
|
+
strikethrough: "WebinyLexical__textStrikethrough",
|
|
80
|
+
subscript: "WebinyLexical__textSubscript",
|
|
81
|
+
superscript: "WebinyLexical__textSuperscript",
|
|
82
|
+
underline: "WebinyLexical__textUnderline",
|
|
83
|
+
underlineStrikethrough: "WebinyLexical__textUnderlineStrikethrough"
|
|
84
|
+
},
|
|
85
|
+
fontColorText: "WebinyLexical__fontColorText",
|
|
86
|
+
image: "editor-image",
|
|
87
|
+
indent: "PlaygroundEditorTheme__indent",
|
|
88
|
+
inlineImage: "inline-editor-image"
|
|
89
|
+
};
|
|
90
|
+
const createTheme = () => {
|
|
91
|
+
return defaultTheme;
|
|
92
|
+
};
|
|
93
|
+
exports.createTheme = createTheme;
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=createTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["require","defaultTheme","styles","undefined","emotionMap","characterLimit","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","hashtag","heading","h1","h2","h3","h4","h5","h6","link","list","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","quote","rtl","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","fontColorText","image","indent","inlineImage","createTheme","exports"],"sources":["createTheme.ts"],"sourcesContent":["import type { EditorThemeClasses } from \"lexical\";\n\nimport \"./theme.css\";\nimport { ThemeEmotionMap } from \"~/types\";\n\nexport type WebinyTheme = {\n styles?: Record<string, any>;\n emotionMap?: ThemeEmotionMap;\n};\n\nexport type EditorTheme = WebinyTheme & EditorThemeClasses;\n\nconst defaultTheme: EditorTheme = {\n styles: undefined,\n emotionMap: undefined,\n characterLimit: \"WebinyLexical__characterLimit\",\n code: \"WebinyLexical__code\",\n codeHighlight: {\n atrule: \"WebinyLexical__tokenAttr\",\n attr: \"WebinyLexical__tokenAttr\",\n boolean: \"WebinyLexical__tokenProperty\",\n builtin: \"WebinyLexical__tokenSelector\",\n cdata: \"WebinyLexical__tokenComment\",\n char: \"WebinyLexical__tokenSelector\",\n class: \"WebinyLexical__tokenFunction\",\n \"class-name\": \"WebinyLexical__tokenFunction\",\n comment: \"WebinyLexical__tokenComment\",\n constant: \"WebinyLexical__tokenProperty\",\n deleted: \"WebinyLexical__tokenProperty\",\n doctype: \"WebinyLexical__tokenComment\",\n entity: \"WebinyLexical__tokenOperator\",\n function: \"WebinyLexical__tokenFunction\",\n important: \"WebinyLexical__tokenVariable\",\n inserted: \"WebinyLexical__tokenSelector\",\n keyword: \"WebinyLexical__tokenAttr\",\n namespace: \"WebinyLexical__tokenVariable\",\n number: \"WebinyLexical__tokenProperty\",\n operator: \"WebinyLexical__tokenOperator\",\n prolog: \"WebinyLexical__tokenComment\",\n property: \"WebinyLexical__tokenProperty\",\n punctuation: \"WebinyLexical__tokenPunctuation\",\n regex: \"WebinyLexical__tokenVariable\",\n selector: \"WebinyLexical__tokenSelector\",\n string: \"WebinyLexical__tokenSelector\",\n symbol: \"WebinyLexical__tokenProperty\",\n tag: \"WebinyLexical__tokenProperty\",\n url: \"WebinyLexical__tokenOperator\",\n variable: \"WebinyLexical__tokenVariable\"\n },\n embedBlock: {\n base: \"WebinyLexical__embedBlock\",\n focus: \"WebinyLexical__embedBlockFocus\"\n },\n hashtag: \"WebinyLexical__hashtag\",\n heading: {\n h1: \"WebinyLexical__h1\",\n h2: \"WebinyLexical__h2\",\n h3: \"WebinyLexical__h3\",\n h4: \"WebinyLexical__h4\",\n h5: \"WebinyLexical__h5\",\n h6: \"WebinyLexical__h6\"\n },\n link: \"WebinyLexical__link\",\n list: {\n listitem: \"WebinyLexical__listItem\",\n listitemChecked: \"WebinyLexical__listItemChecked\",\n listitemUnchecked: \"WebinyLexical__listItemUnchecked\",\n nested: {\n listitem: \"WebinyLexical__nestedListItem\"\n },\n olDepth: [\n \"WebinyLexical__ol1\",\n \"WebinyLexical__ol2\",\n \"WebinyLexical__ol3\",\n \"WebinyLexical__ol4\",\n \"WebinyLexical__ol5\"\n ],\n ul: \"WebinyLexical__ul\"\n },\n ltr: \"WebinyLexical__ltr\",\n mark: \"WebinyLexical__mark\",\n markOverlap: \"WebinyLexical__markOverlap\",\n paragraph: \"WebinyLexical__paragraph\",\n quote: \"WebinyLexical__quote\",\n rtl: \"WebinyLexical__rtl\",\n text: {\n bold: \"WebinyLexical__textBold\",\n code: \"WebinyLexical__textCode\",\n italic: \"WebinyLexical__textItalic\",\n strikethrough: \"WebinyLexical__textStrikethrough\",\n subscript: \"WebinyLexical__textSubscript\",\n superscript: \"WebinyLexical__textSuperscript\",\n underline: \"WebinyLexical__textUnderline\",\n underlineStrikethrough: \"WebinyLexical__textUnderlineStrikethrough\"\n },\n fontColorText: \"WebinyLexical__fontColorText\",\n image: \"editor-image\",\n indent: \"PlaygroundEditorTheme__indent\",\n inlineImage: \"inline-editor-image\"\n};\n\nexport const createTheme = (): EditorTheme => {\n return defaultTheme;\n};\n"],"mappings":";;;;;;AAEAA,OAAA;AAUA,MAAMC,YAAyB,GAAG;EAC9BC,MAAM,EAAEC,SAAS;EACjBC,UAAU,EAAED,SAAS;EACrBE,cAAc,EAAE,+BAA+B;EAC/CC,IAAI,EAAE,qBAAqB;EAC3BC,aAAa,EAAE;IACXC,MAAM,EAAE,0BAA0B;IAClCC,IAAI,EAAE,0BAA0B;IAChCC,OAAO,EAAE,8BAA8B;IACvCC,OAAO,EAAE,8BAA8B;IACvCC,KAAK,EAAE,6BAA6B;IACpCC,IAAI,EAAE,8BAA8B;IACpCC,KAAK,EAAE,8BAA8B;IACrC,YAAY,EAAE,8BAA8B;IAC5CC,OAAO,EAAE,6BAA6B;IACtCC,QAAQ,EAAE,8BAA8B;IACxCC,OAAO,EAAE,8BAA8B;IACvCC,OAAO,EAAE,6BAA6B;IACtCC,MAAM,EAAE,8BAA8B;IACtCC,QAAQ,EAAE,8BAA8B;IACxCC,SAAS,EAAE,8BAA8B;IACzCC,QAAQ,EAAE,8BAA8B;IACxCC,OAAO,EAAE,0BAA0B;IACnCC,SAAS,EAAE,8BAA8B;IACzCC,MAAM,EAAE,8BAA8B;IACtCC,QAAQ,EAAE,8BAA8B;IACxCC,MAAM,EAAE,6BAA6B;IACrCC,QAAQ,EAAE,8BAA8B;IACxCC,WAAW,EAAE,iCAAiC;IAC9CC,KAAK,EAAE,8BAA8B;IACrCC,QAAQ,EAAE,8BAA8B;IACxCC,MAAM,EAAE,8BAA8B;IACtCC,MAAM,EAAE,8BAA8B;IACtCC,GAAG,EAAE,8BAA8B;IACnCC,GAAG,EAAE,8BAA8B;IACnCC,QAAQ,EAAE;EACd,CAAC;EACDC,UAAU,EAAE;IACRC,IAAI,EAAE,2BAA2B;IACjCC,KAAK,EAAE;EACX,CAAC;EACDC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE;IACLC,EAAE,EAAE,mBAAmB;IACvBC,EAAE,EAAE,mBAAmB;IACvBC,EAAE,EAAE,mBAAmB;IACvBC,EAAE,EAAE,mBAAmB;IACvBC,EAAE,EAAE,mBAAmB;IACvBC,EAAE,EAAE;EACR,CAAC;EACDC,IAAI,EAAE,qBAAqB;EAC3BC,IAAI,EAAE;IACFC,QAAQ,EAAE,yBAAyB;IACnCC,eAAe,EAAE,gCAAgC;IACjDC,iBAAiB,EAAE,kCAAkC;IACrDC,MAAM,EAAE;MACJH,QAAQ,EAAE;IACd,CAAC;IACDI,OAAO,EAAE,CACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,CACvB;IACDC,EAAE,EAAE;EACR,CAAC;EACDC,GAAG,EAAE,oBAAoB;EACzBC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EAAE,4BAA4B;EACzCC,SAAS,EAAE,0BAA0B;EACrCC,KAAK,EAAE,sBAAsB;EAC7BC,GAAG,EAAE,oBAAoB;EACzBC,IAAI,EAAE;IACFC,IAAI,EAAE,yBAAyB;IAC/BzD,IAAI,EAAE,yBAAyB;IAC/B0D,MAAM,EAAE,2BAA2B;IACnCC,aAAa,EAAE,kCAAkC;IACjDC,SAAS,EAAE,8BAA8B;IACzCC,WAAW,EAAE,gCAAgC;IAC7CC,SAAS,EAAE,8BAA8B;IACzCC,sBAAsB,EAAE;EAC5B,CAAC;EACDC,aAAa,EAAE,8BAA8B;EAC7CC,KAAK,EAAE,cAAc;EACrBC,MAAM,EAAE,+BAA+B;EACvCC,WAAW,EAAE;AACjB,CAAC;AAEM,MAAMC,WAAW,GAAGA,CAAA,KAAmB;EAC1C,OAAOzE,YAAY;AACvB,CAAC;AAAC0E,OAAA,CAAAD,WAAA,GAAAA,WAAA"}
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _createTheme = require("./createTheme");
|
|
7
|
+
Object.keys(_createTheme).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _createTheme[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _createTheme[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _types = require("./types");
|
|
18
|
+
Object.keys(_types).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _types[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _findTypographyStyleByHtmlTag = require("./utils/findTypographyStyleByHtmlTag");
|
|
29
|
+
Object.keys(_findTypographyStyleByHtmlTag).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _findTypographyStyleByHtmlTag[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _findTypographyStyleByHtmlTag[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _toTypographyEmotionMap = require("./utils/toTypographyEmotionMap");
|
|
40
|
+
Object.keys(_toTypographyEmotionMap).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _toTypographyEmotionMap[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _toTypographyEmotionMap[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _styleObjectToString = require("./utils/styleObjectToString");
|
|
51
|
+
Object.keys(_styleObjectToString).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _styleObjectToString[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _styleObjectToString[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createTheme","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_types","_findTypographyStyleByHtmlTag","_toTypographyEmotionMap","_styleObjectToString"],"sources":["index.ts"],"sourcesContent":["export * from \"./createTheme\";\nexport * from \"./types\";\nexport * from \"./utils/findTypographyStyleByHtmlTag\";\nexport * from \"./utils/toTypographyEmotionMap\";\nexport * from \"./utils/styleObjectToString\";\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,6BAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,6BAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,6BAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,6BAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,uBAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,uBAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,uBAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,uBAAA,CAAAP,GAAA;IAAA;EAAA;AAAA;AACA,IAAAQ,oBAAA,GAAAZ,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,oBAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,oBAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,oBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/lexical-theme",
|
|
3
|
+
"version": "5.38.0-beta.0",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@emotion/react": "11.10.8",
|
|
6
|
+
"lexical": "0.12.2",
|
|
7
|
+
"react-style-object-to-css": "1.1.2"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@webiny/cli": "5.38.0-beta.0",
|
|
11
|
+
"@webiny/project-utils": "5.38.0-beta.0"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"directory": "dist"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "yarn webiny run build",
|
|
19
|
+
"watch": "yarn webiny run watch"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "5746389d4988626b50e2523ccfa0a9a5e398e0ed"
|
|
22
|
+
}
|
package/theme.css
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This are fallback styles for Webiny.
|
|
10
|
+
*/
|
|
11
|
+
.WebinyLexical__ltr {
|
|
12
|
+
text-align: inherit;
|
|
13
|
+
}
|
|
14
|
+
.WebinyLexical__rtl {
|
|
15
|
+
text-align: inherit;
|
|
16
|
+
}
|
|
17
|
+
.WebinyLexical__paragraph {
|
|
18
|
+
margin: 0;
|
|
19
|
+
position: relative;
|
|
20
|
+
text-align: inherit;
|
|
21
|
+
font-size: inherit;
|
|
22
|
+
}
|
|
23
|
+
.WebinyLexical__quote {
|
|
24
|
+
margin: 0;
|
|
25
|
+
margin-left: 20px;
|
|
26
|
+
margin-bottom: 10px;
|
|
27
|
+
font-size: 15px;
|
|
28
|
+
color: rgb(101, 103, 107);
|
|
29
|
+
border-left-color: rgb(206, 208, 212);
|
|
30
|
+
border-left-width: 4px;
|
|
31
|
+
border-left-style: solid;
|
|
32
|
+
padding-left: 16px;
|
|
33
|
+
}
|
|
34
|
+
.WebinyLexical__h1 {
|
|
35
|
+
font-size: 24px;
|
|
36
|
+
font-weight: inherit;
|
|
37
|
+
margin: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.WebinyLexical__h2 {
|
|
41
|
+
font-size: 15px;
|
|
42
|
+
font-weight: inherit;
|
|
43
|
+
margin: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.WebinyLexical__h3 {
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
font-weight: inherit;
|
|
49
|
+
margin: inherit;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.WebinyLexical__textBold {
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.WebinyLexical__textItalic {
|
|
57
|
+
font-style: italic;
|
|
58
|
+
}
|
|
59
|
+
.WebinyLexical__textUnderline {
|
|
60
|
+
text-decoration: underline;
|
|
61
|
+
}
|
|
62
|
+
.WebinyLexical__textStrikethrough {
|
|
63
|
+
text-decoration: line-through;
|
|
64
|
+
}
|
|
65
|
+
.WebinyLexical__textUnderlineStrikethrough {
|
|
66
|
+
text-decoration: underline line-through;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.WebinyLexical__textSubscript {
|
|
70
|
+
font-size: 0.8em;
|
|
71
|
+
vertical-align: sub !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.WebinyLexical__textSuperscript {
|
|
75
|
+
font-size: 0.8em;
|
|
76
|
+
vertical-align: super;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.WebinyLexical__textCode {
|
|
80
|
+
background-color: rgb(240, 242, 245);
|
|
81
|
+
padding: 1px 0.25rem;
|
|
82
|
+
font-family: Menlo, Consolas, Monaco, monospace;
|
|
83
|
+
font-size: 94%;
|
|
84
|
+
}
|
|
85
|
+
.WebinyLexical__hashtag {
|
|
86
|
+
background-color: rgba(88, 144, 255, 0.15);
|
|
87
|
+
border-bottom: 1px solid rgba(88, 144, 255, 0.3);
|
|
88
|
+
}
|
|
89
|
+
.WebinyLexical__link {
|
|
90
|
+
color: rgb(33, 111, 219);
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
.WebinyLexical__link:hover {
|
|
94
|
+
text-decoration: underline;
|
|
95
|
+
}
|
|
96
|
+
.WebinyLexical__code {
|
|
97
|
+
background-color: rgb(240, 242, 245);
|
|
98
|
+
font-family: Menlo, Consolas, Monaco, monospace;
|
|
99
|
+
display: block;
|
|
100
|
+
padding: 8px 8px 8px 52px;
|
|
101
|
+
line-height: 1.53;
|
|
102
|
+
font-size: 13px;
|
|
103
|
+
margin: 0;
|
|
104
|
+
margin-top: 8px;
|
|
105
|
+
margin-bottom: 8px;
|
|
106
|
+
tab-size: 2;
|
|
107
|
+
/* white-space: pre; */
|
|
108
|
+
overflow-x: auto;
|
|
109
|
+
position: relative;
|
|
110
|
+
}
|
|
111
|
+
.WebinyLexical__code:before {
|
|
112
|
+
content: attr(data-gutter);
|
|
113
|
+
position: absolute;
|
|
114
|
+
background-color: #eee;
|
|
115
|
+
left: 0;
|
|
116
|
+
top: 0;
|
|
117
|
+
border-right: 1px solid #ccc;
|
|
118
|
+
padding: 8px;
|
|
119
|
+
color: #777;
|
|
120
|
+
white-space: pre-wrap;
|
|
121
|
+
text-align: right;
|
|
122
|
+
min-width: 25px;
|
|
123
|
+
}
|
|
124
|
+
.WebinyLexical__table {
|
|
125
|
+
border-collapse: collapse;
|
|
126
|
+
border-spacing: 0;
|
|
127
|
+
max-width: 100%;
|
|
128
|
+
overflow-y: scroll;
|
|
129
|
+
table-layout: fixed;
|
|
130
|
+
width: calc(100% - 25px);
|
|
131
|
+
margin: 30px 0;
|
|
132
|
+
}
|
|
133
|
+
.WebinyLexical__tableSelected {
|
|
134
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
135
|
+
}
|
|
136
|
+
.WebinyLexical__tableCell {
|
|
137
|
+
border: 1px solid #bbb;
|
|
138
|
+
min-width: 75px;
|
|
139
|
+
vertical-align: top;
|
|
140
|
+
text-align: start;
|
|
141
|
+
padding: 6px 8px;
|
|
142
|
+
position: relative;
|
|
143
|
+
cursor: default;
|
|
144
|
+
outline: none;
|
|
145
|
+
}
|
|
146
|
+
.WebinyLexical__tableCellSortedIndicator {
|
|
147
|
+
display: block;
|
|
148
|
+
opacity: 0.5;
|
|
149
|
+
position: absolute;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
left: 0;
|
|
152
|
+
width: 100%;
|
|
153
|
+
height: 4px;
|
|
154
|
+
background-color: #999;
|
|
155
|
+
}
|
|
156
|
+
.WebinyLexical__tableCellResizer {
|
|
157
|
+
position: absolute;
|
|
158
|
+
right: -4px;
|
|
159
|
+
height: 100%;
|
|
160
|
+
width: 8px;
|
|
161
|
+
cursor: ew-resize;
|
|
162
|
+
z-index: 10;
|
|
163
|
+
top: 0;
|
|
164
|
+
}
|
|
165
|
+
.WebinyLexical__tableCellHeader {
|
|
166
|
+
background-color: #f2f3f5;
|
|
167
|
+
text-align: start;
|
|
168
|
+
}
|
|
169
|
+
.WebinyLexical__tableCellSelected {
|
|
170
|
+
background-color: #c9dbf0;
|
|
171
|
+
}
|
|
172
|
+
.WebinyLexical__tableCellPrimarySelected {
|
|
173
|
+
border: 2px solid rgb(60, 132, 244);
|
|
174
|
+
display: block;
|
|
175
|
+
height: calc(100% - 2px);
|
|
176
|
+
position: absolute;
|
|
177
|
+
width: calc(100% - 2px);
|
|
178
|
+
left: -1px;
|
|
179
|
+
top: -1px;
|
|
180
|
+
z-index: 2;
|
|
181
|
+
}
|
|
182
|
+
.WebinyLexical__tableCellEditing {
|
|
183
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
|
|
184
|
+
border-radius: 3px;
|
|
185
|
+
}
|
|
186
|
+
.WebinyLexical__tableAddColumns {
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: 0;
|
|
189
|
+
width: 20px;
|
|
190
|
+
background-color: #eee;
|
|
191
|
+
height: 100%;
|
|
192
|
+
right: 0;
|
|
193
|
+
animation: table-controls 0.2s ease;
|
|
194
|
+
border: 0;
|
|
195
|
+
cursor: pointer;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.WebinyLexical__tableAddColumns:hover {
|
|
199
|
+
background-color: #c9dbf0;
|
|
200
|
+
}
|
|
201
|
+
.WebinyLexical__tableAddRows {
|
|
202
|
+
position: absolute;
|
|
203
|
+
bottom: -25px;
|
|
204
|
+
width: calc(100% - 25px);
|
|
205
|
+
background-color: #eee;
|
|
206
|
+
height: 20px;
|
|
207
|
+
left: 0;
|
|
208
|
+
animation: table-controls 0.2s ease;
|
|
209
|
+
border: 0;
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
}
|
|
212
|
+
.WebinyLexical__tableAddRows:hover {
|
|
213
|
+
background-color: #c9dbf0;
|
|
214
|
+
}
|
|
215
|
+
@keyframes table-controls {
|
|
216
|
+
0% {
|
|
217
|
+
opacity: 0;
|
|
218
|
+
}
|
|
219
|
+
100% {
|
|
220
|
+
opacity: 1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
.WebinyLexical__tableCellResizeRuler {
|
|
224
|
+
display: block;
|
|
225
|
+
position: absolute;
|
|
226
|
+
width: 1px;
|
|
227
|
+
background-color: rgb(60, 132, 244);
|
|
228
|
+
height: 100%;
|
|
229
|
+
top: 0;
|
|
230
|
+
}
|
|
231
|
+
.WebinyLexical__tableCellActionButtonContainer {
|
|
232
|
+
display: block;
|
|
233
|
+
right: 5px;
|
|
234
|
+
top: 6px;
|
|
235
|
+
position: absolute;
|
|
236
|
+
z-index: 4;
|
|
237
|
+
width: 20px;
|
|
238
|
+
height: 20px;
|
|
239
|
+
}
|
|
240
|
+
.WebinyLexical__tableCellActionButton {
|
|
241
|
+
background-color: #eee;
|
|
242
|
+
display: block;
|
|
243
|
+
border: 0;
|
|
244
|
+
border-radius: 20px;
|
|
245
|
+
width: 20px;
|
|
246
|
+
height: 20px;
|
|
247
|
+
color: #222;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
}
|
|
250
|
+
.WebinyLexical__tableCellActionButton:hover {
|
|
251
|
+
background-color: #ddd;
|
|
252
|
+
}
|
|
253
|
+
.WebinyLexical__characterLimit {
|
|
254
|
+
display: inline;
|
|
255
|
+
background-color: #ffbbbb !important;
|
|
256
|
+
}
|
|
257
|
+
.WebinyLexical__ol1 {
|
|
258
|
+
list-style: auto;
|
|
259
|
+
padding: 0;
|
|
260
|
+
margin: 0;
|
|
261
|
+
margin-left: 16px;
|
|
262
|
+
list-style-position: inside;
|
|
263
|
+
}
|
|
264
|
+
.WebinyLexical__ol2 {
|
|
265
|
+
list-style: initial;
|
|
266
|
+
padding: 0;
|
|
267
|
+
margin: 0;
|
|
268
|
+
margin-left: 16px;
|
|
269
|
+
list-style-type: upper-alpha;
|
|
270
|
+
list-style-position: inside;
|
|
271
|
+
}
|
|
272
|
+
.WebinyLexical__ol3 {
|
|
273
|
+
list-style: initial;
|
|
274
|
+
list-style: auto;
|
|
275
|
+
padding: 0;
|
|
276
|
+
margin: 0;
|
|
277
|
+
margin-left: 16px;
|
|
278
|
+
list-style-type: lower-alpha;
|
|
279
|
+
list-style-position: inside;
|
|
280
|
+
}
|
|
281
|
+
.WebinyLexical__ol4 {
|
|
282
|
+
list-style: initial;
|
|
283
|
+
padding: 0;
|
|
284
|
+
margin: 0;
|
|
285
|
+
margin-left: 16px;
|
|
286
|
+
list-style-type: upper-roman;
|
|
287
|
+
list-style-position: inside;
|
|
288
|
+
}
|
|
289
|
+
.WebinyLexical__ol5 {
|
|
290
|
+
list-style: initial;
|
|
291
|
+
padding: 0;
|
|
292
|
+
margin: 0;
|
|
293
|
+
margin-left: 16px;
|
|
294
|
+
list-style-type: lower-roman;
|
|
295
|
+
list-style-position: inside;
|
|
296
|
+
}
|
|
297
|
+
.WebinyLexical__ul {
|
|
298
|
+
list-style: initial;
|
|
299
|
+
padding: 0;
|
|
300
|
+
margin: 0;
|
|
301
|
+
margin-left: 16px;
|
|
302
|
+
list-style-position: inside;
|
|
303
|
+
}
|
|
304
|
+
.WebinyLexical__listItem {
|
|
305
|
+
margin: 0 32px;
|
|
306
|
+
}
|
|
307
|
+
.WebinyLexical__listItemChecked,
|
|
308
|
+
.WebinyLexical__listItemUnchecked {
|
|
309
|
+
position: relative;
|
|
310
|
+
margin-left: 8px;
|
|
311
|
+
margin-right: 8px;
|
|
312
|
+
padding-left: 24px;
|
|
313
|
+
padding-right: 24px;
|
|
314
|
+
list-style-type: none;
|
|
315
|
+
outline: none;
|
|
316
|
+
}
|
|
317
|
+
.WebinyLexical__listItemChecked {
|
|
318
|
+
text-decoration: line-through;
|
|
319
|
+
}
|
|
320
|
+
.WebinyLexical__listItemUnchecked:before,
|
|
321
|
+
.WebinyLexical__listItemChecked:before {
|
|
322
|
+
content: '';
|
|
323
|
+
width: 16px;
|
|
324
|
+
height: 16px;
|
|
325
|
+
top: 2px;
|
|
326
|
+
left: 0;
|
|
327
|
+
cursor: pointer;
|
|
328
|
+
display: block;
|
|
329
|
+
background-size: cover;
|
|
330
|
+
position: absolute;
|
|
331
|
+
}
|
|
332
|
+
.WebinyLexical__listItemUnchecked[dir='rtl']:before,
|
|
333
|
+
.WebinyLexical__listItemChecked[dir='rtl']:before {
|
|
334
|
+
left: auto;
|
|
335
|
+
right: 0;
|
|
336
|
+
}
|
|
337
|
+
.WebinyLexical__listItemUnchecked:focus:before,
|
|
338
|
+
.WebinyLexical__listItemChecked:focus:before {
|
|
339
|
+
box-shadow: 0 0 0 2px #a6cdfe;
|
|
340
|
+
border-radius: 2px;
|
|
341
|
+
}
|
|
342
|
+
.WebinyLexical__listItemUnchecked:before {
|
|
343
|
+
border: 1px solid #999;
|
|
344
|
+
border-radius: 2px;
|
|
345
|
+
}
|
|
346
|
+
.WebinyLexical__listItemChecked:before {
|
|
347
|
+
border: 1px solid rgb(61, 135, 245);
|
|
348
|
+
border-radius: 2px;
|
|
349
|
+
background-color: #3d87f5;
|
|
350
|
+
background-repeat: no-repeat;
|
|
351
|
+
}
|
|
352
|
+
.WebinyLexical__listItemChecked:after {
|
|
353
|
+
content: '';
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
border-color: #fff;
|
|
356
|
+
border-style: solid;
|
|
357
|
+
position: absolute;
|
|
358
|
+
display: block;
|
|
359
|
+
top: 6px;
|
|
360
|
+
width: 3px;
|
|
361
|
+
left: 7px;
|
|
362
|
+
height: 6px;
|
|
363
|
+
transform: rotate(45deg);
|
|
364
|
+
border-width: 0 2px 2px 0;
|
|
365
|
+
}
|
|
366
|
+
.WebinyLexical__nestedListItem {
|
|
367
|
+
list-style-type: none;
|
|
368
|
+
}
|
|
369
|
+
.WebinyLexical__nestedListItem:before,
|
|
370
|
+
.WebinyLexical__nestedListItem:after {
|
|
371
|
+
display: none;
|
|
372
|
+
}
|
|
373
|
+
.WebinyLexical__tokenComment {
|
|
374
|
+
color: slategray;
|
|
375
|
+
}
|
|
376
|
+
.WebinyLexical__tokenPunctuation {
|
|
377
|
+
color: #999;
|
|
378
|
+
}
|
|
379
|
+
.WebinyLexical__tokenProperty {
|
|
380
|
+
color: #905;
|
|
381
|
+
}
|
|
382
|
+
.WebinyLexical__tokenSelector {
|
|
383
|
+
color: #690;
|
|
384
|
+
}
|
|
385
|
+
.WebinyLexical__tokenOperator {
|
|
386
|
+
color: #9a6e3a;
|
|
387
|
+
}
|
|
388
|
+
.WebinyLexical__tokenAttr {
|
|
389
|
+
color: #07a;
|
|
390
|
+
}
|
|
391
|
+
.WebinyLexical__tokenVariable {
|
|
392
|
+
color: #e90;
|
|
393
|
+
}
|
|
394
|
+
.WebinyLexical__tokenFunction {
|
|
395
|
+
color: #dd4a68;
|
|
396
|
+
}
|
|
397
|
+
.WebinyLexical__mark {
|
|
398
|
+
background: rgba(255, 212, 0, 0.14);
|
|
399
|
+
border-bottom: 2px solid rgba(255, 212, 0, 0.3);
|
|
400
|
+
padding-bottom: 2px;
|
|
401
|
+
}
|
|
402
|
+
.WebinyLexical__markOverlap {
|
|
403
|
+
background: rgba(255, 212, 0, 0.3);
|
|
404
|
+
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
405
|
+
}
|
|
406
|
+
.WebinyLexical__mark.selected {
|
|
407
|
+
background: rgba(255, 212, 0, 0.5);
|
|
408
|
+
border-bottom: 2px solid rgba(255, 212, 0, 1);
|
|
409
|
+
}
|
|
410
|
+
.WebinyLexical__markOverlap.selected {
|
|
411
|
+
background: rgba(255, 212, 0, 0.7);
|
|
412
|
+
border-bottom: 2px solid rgba(255, 212, 0, 0.7);
|
|
413
|
+
}
|
|
414
|
+
.WebinyLexical__embedBlock {
|
|
415
|
+
user-select: none;
|
|
416
|
+
}
|
|
417
|
+
.WebinyLexical__embedBlockFocus {
|
|
418
|
+
outline: 2px solid rgb(60, 132, 244);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.WebinyLexical__placeholder {
|
|
422
|
+
text-align: left;
|
|
423
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CSSObject } from "@emotion/react";
|
|
2
|
+
export declare type ListHtmlTag = "ol" | "ul";
|
|
3
|
+
export declare type HeadingHtmlTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
|
+
export declare type ParagraphHtmlTag = "p";
|
|
5
|
+
export declare type QuoteBlockHtmlTag = "quoteblock";
|
|
6
|
+
export declare type TypographyHTMLTag = HeadingHtmlTag | ParagraphHtmlTag | ListHtmlTag | QuoteBlockHtmlTag;
|
|
7
|
+
export declare type TypographyValue = {
|
|
8
|
+
css: CSSObject;
|
|
9
|
+
id: string;
|
|
10
|
+
tag: TypographyHTMLTag;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type ThemeEmotionMap = {
|
|
14
|
+
[styleId: string]: {
|
|
15
|
+
id: string;
|
|
16
|
+
tag: TypographyHTMLTag;
|
|
17
|
+
name: string;
|
|
18
|
+
styles: Record<string, any>;
|
|
19
|
+
className: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CSSObject } from \"@emotion/react\";\n\n// Supported HTML tags.\nexport type ListHtmlTag = \"ol\" | \"ul\";\nexport type HeadingHtmlTag = \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\nexport type ParagraphHtmlTag = \"p\";\nexport type QuoteBlockHtmlTag = \"quoteblock\";\n\nexport type TypographyHTMLTag = HeadingHtmlTag | ParagraphHtmlTag | ListHtmlTag | QuoteBlockHtmlTag;\n\nexport type TypographyValue = {\n css: CSSObject;\n id: string;\n tag: TypographyHTMLTag;\n name: string;\n};\n\n/*\n * Contains IDs of the styles and classes generated by Emotion.\n */\nexport type ThemeEmotionMap = {\n [styleId: string]: {\n id: string;\n tag: TypographyHTMLTag;\n name: string;\n styles: Record<string, any>;\n // emotion generated class\n className: string;\n };\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ThemeEmotionMap } from "../types";
|
|
2
|
+
export declare const findTypographyStyleByHtmlTag: (htmlTag: string, themeEmotionMap: ThemeEmotionMap) => {
|
|
3
|
+
id: string;
|
|
4
|
+
tag: import("../types").TypographyHTMLTag;
|
|
5
|
+
name: string;
|
|
6
|
+
styles: Record<string, any>;
|
|
7
|
+
className: string;
|
|
8
|
+
} | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findTypographyStyleByHtmlTag = void 0;
|
|
7
|
+
const findTypographyStyleByHtmlTag = (htmlTag, themeEmotionMap) => {
|
|
8
|
+
for (const styleId in themeEmotionMap) {
|
|
9
|
+
const style = themeEmotionMap[styleId];
|
|
10
|
+
if (style.tag === htmlTag) {
|
|
11
|
+
return style;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
exports.findTypographyStyleByHtmlTag = findTypographyStyleByHtmlTag;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=findTypographyStyleByHtmlTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["findTypographyStyleByHtmlTag","htmlTag","themeEmotionMap","styleId","style","tag","undefined","exports"],"sources":["findTypographyStyleByHtmlTag.ts"],"sourcesContent":["import { ThemeEmotionMap } from \"~/types\";\n\nexport const findTypographyStyleByHtmlTag = (htmlTag: string, themeEmotionMap: ThemeEmotionMap) => {\n for (const styleId in themeEmotionMap) {\n const style = themeEmotionMap[styleId];\n if (style.tag === htmlTag) {\n return style;\n }\n }\n return undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,4BAA4B,GAAGA,CAACC,OAAe,EAAEC,eAAgC,KAAK;EAC/F,KAAK,MAAMC,OAAO,IAAID,eAAe,EAAE;IACnC,MAAME,KAAK,GAAGF,eAAe,CAACC,OAAO,CAAC;IACtC,IAAIC,KAAK,CAACC,GAAG,KAAKJ,OAAO,EAAE;MACvB,OAAOG,KAAK;IAChB;EACJ;EACA,OAAOE,SAAS;AACpB,CAAC;AAACC,OAAA,CAAAP,4BAAA,GAAAA,4BAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.styleObjectToString = void 0;
|
|
8
|
+
var _reactStyleObjectToCss = _interopRequireDefault(require("react-style-object-to-css"));
|
|
9
|
+
// @ts-ignore - There are no types "@types/react-style-object-to-css" for this lib.
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Converts CSS style objects to string
|
|
13
|
+
* Example:
|
|
14
|
+
* { fontSize: '10px' } => "font-size: 10px"
|
|
15
|
+
* */
|
|
16
|
+
const styleObjectToString = styleObject => {
|
|
17
|
+
if (!styleObject) {
|
|
18
|
+
return styleObject;
|
|
19
|
+
}
|
|
20
|
+
return (0, _reactStyleObjectToCss.default)(styleObject);
|
|
21
|
+
};
|
|
22
|
+
exports.styleObjectToString = styleObjectToString;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=styleObjectToString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactStyleObjectToCss","_interopRequireDefault","require","styleObjectToString","styleObject","reactToCSS","exports"],"sources":["styleObjectToString.ts"],"sourcesContent":["// @ts-ignore - There are no types \"@types/react-style-object-to-css\" for this lib.\nimport reactToCSS from \"react-style-object-to-css\";\nimport type { CSSObject } from \"@emotion/react\";\n\n/*\n * Converts CSS style objects to string\n * Example:\n * { fontSize: '10px' } => \"font-size: 10px\"\n * */\nexport const styleObjectToString = (styleObject: CSSObject): string => {\n if (!styleObject) {\n return styleObject;\n }\n return reactToCSS(styleObject);\n};\n"],"mappings":";;;;;;;AACA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AADA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAIC,WAAsB,IAAa;EACnE,IAAI,CAACA,WAAW,EAAE;IACd,OAAOA,WAAW;EACtB;EACA,OAAO,IAAAC,8BAAU,EAACD,WAAW,CAAC;AAClC,CAAC;AAACE,OAAA,CAAAH,mBAAA,GAAAA,mBAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.toTypographyEmotionMap = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
/*
|
|
10
|
+
* Creates a map of style key ID's and typography style objects that include 'className' property which contains the
|
|
11
|
+
* CSS class name generated by the Emotion from typography styles object.
|
|
12
|
+
*/
|
|
13
|
+
const toTypographyEmotionMap = (css, theme, themeStylesTransformer) => {
|
|
14
|
+
var _theme$styles;
|
|
15
|
+
const map = {};
|
|
16
|
+
const typographyStyles = (_theme$styles = theme.styles) === null || _theme$styles === void 0 ? void 0 : _theme$styles.typography;
|
|
17
|
+
if (!typographyStyles) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
for (const key in typographyStyles) {
|
|
21
|
+
const typographyTypeData = typographyStyles[key];
|
|
22
|
+
if (typographyTypeData) {
|
|
23
|
+
typographyTypeData.forEach(styleItem => {
|
|
24
|
+
// 'lx' (abbreviation of lexical) variable will lead to generate shorter class names.
|
|
25
|
+
// for example: instead of default 'css-181qz4b-453f345f'
|
|
26
|
+
// the last segment will always end with 'lx' or 'css-181qz4b-lx'
|
|
27
|
+
|
|
28
|
+
let transformedStyles = styleItem.styles;
|
|
29
|
+
if (themeStylesTransformer) {
|
|
30
|
+
transformedStyles = themeStylesTransformer(styleItem.styles);
|
|
31
|
+
}
|
|
32
|
+
const lx = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, styleItem), {}, {
|
|
33
|
+
className: [css(transformedStyles)].filter(Boolean).join(" ")
|
|
34
|
+
});
|
|
35
|
+
map[styleItem.id] = lx;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return map;
|
|
40
|
+
};
|
|
41
|
+
exports.toTypographyEmotionMap = toTypographyEmotionMap;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=toTypographyEmotionMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toTypographyEmotionMap","css","theme","themeStylesTransformer","_theme$styles","map","typographyStyles","styles","typography","key","typographyTypeData","forEach","styleItem","transformedStyles","lx","_objectSpread2","default","className","filter","Boolean","join","id","exports"],"sources":["toTypographyEmotionMap.ts"],"sourcesContent":["import { ThemeEmotionMap, TypographyHTMLTag } from \"~/types\";\nimport { WebinyTheme } from \"~/createTheme\";\n\n/*\n * Creates a map of style key ID's and typography style objects that include 'className' property which contains the\n * CSS class name generated by the Emotion from typography styles object.\n */\nexport const toTypographyEmotionMap = (\n css: (cssStyle: Record<string, any>) => string,\n theme: WebinyTheme,\n themeStylesTransformer?: any\n): ThemeEmotionMap | {} => {\n const map: ThemeEmotionMap = {};\n const typographyStyles = theme.styles?.typography;\n if (!typographyStyles) {\n return {};\n }\n\n for (const key in typographyStyles) {\n const typographyTypeData = typographyStyles[key] as {\n id: string;\n tag: TypographyHTMLTag;\n name: string;\n styles: Record<string, any>;\n }[];\n if (typographyTypeData) {\n typographyTypeData.forEach(styleItem => {\n // 'lx' (abbreviation of lexical) variable will lead to generate shorter class names.\n // for example: instead of default 'css-181qz4b-453f345f'\n // the last segment will always end with 'lx' or 'css-181qz4b-lx'\n\n let transformedStyles = styleItem.styles;\n if (themeStylesTransformer) {\n transformedStyles = themeStylesTransformer(styleItem.styles);\n }\n\n const lx = {\n ...styleItem,\n className: [css(transformedStyles)].filter(Boolean).join(\" \")\n };\n map[styleItem.id] = lx;\n });\n }\n }\n\n return map;\n};\n"],"mappings":";;;;;;;;AAGA;AACA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAGA,CAClCC,GAA8C,EAC9CC,KAAkB,EAClBC,sBAA4B,KACL;EAAA,IAAAC,aAAA;EACvB,MAAMC,GAAoB,GAAG,CAAC,CAAC;EAC/B,MAAMC,gBAAgB,IAAAF,aAAA,GAAGF,KAAK,CAACK,MAAM,cAAAH,aAAA,uBAAZA,aAAA,CAAcI,UAAU;EACjD,IAAI,CAACF,gBAAgB,EAAE;IACnB,OAAO,CAAC,CAAC;EACb;EAEA,KAAK,MAAMG,GAAG,IAAIH,gBAAgB,EAAE;IAChC,MAAMI,kBAAkB,GAAGJ,gBAAgB,CAACG,GAAG,CAK5C;IACH,IAAIC,kBAAkB,EAAE;MACpBA,kBAAkB,CAACC,OAAO,CAACC,SAAS,IAAI;QACpC;QACA;QACA;;QAEA,IAAIC,iBAAiB,GAAGD,SAAS,CAACL,MAAM;QACxC,IAAIJ,sBAAsB,EAAE;UACxBU,iBAAiB,GAAGV,sBAAsB,CAACS,SAAS,CAACL,MAAM,CAAC;QAChE;QAEA,MAAMO,EAAE,OAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACDJ,SAAS;UACZK,SAAS,EAAE,CAAChB,GAAG,CAACY,iBAAiB,CAAC,CAAC,CAACK,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG;QAAC,EAChE;QACDf,GAAG,CAACO,SAAS,CAACS,EAAE,CAAC,GAAGP,EAAE;MAC1B,CAAC,CAAC;IACN;EACJ;EAEA,OAAOT,GAAG;AACd,CAAC;AAACiB,OAAA,CAAAtB,sBAAA,GAAAA,sBAAA"}
|