@webiny/lexical-theme 5.41.1 → 5.41.2-beta.1

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/createTheme.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import type { EditorThemeClasses } from "lexical";
2
2
  import "./theme.css";
3
3
  import { ThemeEmotionMap } from "./types";
4
- export type WebinyTheme = {
5
- styles?: Record<string, any>;
6
- emotionMap?: ThemeEmotionMap;
7
- };
8
- export type EditorTheme = WebinyTheme & EditorThemeClasses;
9
- export declare const createTheme: () => EditorTheme;
4
+ export type EditorTheme = {
5
+ styles: Record<string, any>;
6
+ emotionMap: ThemeEmotionMap;
7
+ } & EditorThemeClasses;
8
+ export declare const createTheme: ({ styles, emotionMap, ...theme }: Partial<EditorTheme>) => EditorTheme;
package/createTheme.js CHANGED
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createTheme = void 0;
7
7
  require("./theme.css");
8
8
  const defaultTheme = {
9
- styles: undefined,
10
- emotionMap: undefined,
9
+ styles: {},
10
+ emotionMap: {},
11
11
  characterLimit: "WebinyLexical__characterLimit",
12
12
  code: "WebinyLexical__code",
13
13
  codeHighlight: {
@@ -87,8 +87,17 @@ const defaultTheme = {
87
87
  indent: "PlaygroundEditorTheme__indent",
88
88
  inlineImage: "inline-editor-image"
89
89
  };
90
- const createTheme = () => {
91
- return defaultTheme;
90
+ const createTheme = ({
91
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
+ styles,
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
+ emotionMap,
95
+ ...theme
96
+ }) => {
97
+ return {
98
+ ...defaultTheme,
99
+ ...theme
100
+ };
92
101
  };
93
102
  exports.createTheme = createTheme;
94
103
 
@@ -1 +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 createT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B;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","ignoreList":[]}
1
+ {"version":3,"names":["require","defaultTheme","styles","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","theme","exports"],"sources":["createTheme.ts"],"sourcesContent":["import type { EditorThemeClasses } from \"lexical\";\n\nimport \"./theme.css\";\nimport { ThemeEmotionMap } from \"~/types\";\n\nexport type EditorTheme = {\n styles: Record<string, any>;\n emotionMap: ThemeEmotionMap;\n} & EditorThemeClasses;\n\nconst defaultTheme: EditorTheme = {\n styles: {},\n emotionMap: {},\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 = ({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n styles,\n // eslint-disable-next-line @typescript-eslint/no-un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json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/lexical-theme",
3
- "version": "5.41.1",
3
+ "version": "5.41.2-beta.1",
4
4
  "dependencies": {
5
5
  "@emotion/react": "11.10.8",
6
6
  "emotion": "10.0.27",
@@ -8,8 +8,8 @@
8
8
  "react-style-object-to-css": "1.1.2"
9
9
  },
10
10
  "devDependencies": {
11
- "@webiny/cli": "5.41.1",
12
- "@webiny/project-utils": "5.41.1"
11
+ "@webiny/cli": "5.41.2-beta.1",
12
+ "@webiny/project-utils": "5.41.2-beta.1"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public",
@@ -19,5 +19,5 @@
19
19
  "build": "yarn webiny run build",
20
20
  "watch": "yarn webiny run watch"
21
21
  },
22
- "gitHead": "4d34943dbfc5a776afc74fffd2cfd2dca60bffcd"
22
+ "gitHead": "69a78b382b4de30846edfc2a9d5f73ca223fcc10"
23
23
  }
@@ -1,4 +1,4 @@
1
1
  import { ThemeEmotionMap } from "../types";
2
- import { WebinyTheme } from "../createTheme";
2
+ import { EditorTheme } from "../createTheme";
3
3
  import { css as EmotionCSS } from "emotion";
4
- export declare const toTypographyEmotionMap: (css: typeof EmotionCSS, theme: WebinyTheme, themeStylesTransformer?: any) => ThemeEmotionMap;
4
+ export declare const toTypographyEmotionMap: (css: typeof EmotionCSS, theme: EditorTheme, themeStylesTransformer?: any) => ThemeEmotionMap;
@@ -1 +1 @@
1
- {"version":3,"names":["toTypographyEmotionMap","css","theme","themeStylesTransformer","map","typographyStyles","styles","typography","key","typographyTypeData","forEach","styleItem","transformedStyles","lx","className","filter","Boolean","join","id","exports"],"sources":["toTypographyEmotionMap.ts"],"sourcesContent":["import { ThemeEmotionMap, TypographyHTMLTag } from \"~/types\";\nimport { WebinyTheme } from \"~/createTheme\";\nimport { css as EmotionCSS } from \"emotion\";\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: typeof EmotionCSS,\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":";;;;;;AAIA;AACA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAGA,CAClCC,GAAsB,EACtBC,KAAkB,EAClBC,sBAA4B,KACV;EAClB,MAAMC,GAAoB,GAAG,CAAC,CAAC;EAC/B,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,MAAM,EAAEC,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,IAAIH,sBAAsB,EAAE;UACxBS,iBAAiB,GAAGT,sBAAsB,CAACQ,SAAS,CAACL,MAAM,CAAC;QAChE;QAEA,MAAMO,EAAE,GAAG;UACP,GAAGF,SAAS;UACZG,SAAS,EAAE,CAACb,GAAG,CAACW,iBAAiB,CAAC,CAAC,CAACG,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG;QAChE,CAAC;QACDb,GAAG,CAACO,SAAS,CAACO,EAAE,CAAC,GAAGL,EAAE;MAC1B,CAAC,CAAC;IACN;EACJ;EAEA,OAAOT,GAAG;AACd,CAAC;AAACe,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["toTypographyEmotionMap","css","theme","themeStylesTransformer","map","typographyStyles","styles","typography","key","typographyTypeData","forEach","styleItem","transformedStyles","lx","className","filter","Boolean","join","id","exports"],"sources":["toTypographyEmotionMap.ts"],"sourcesContent":["import { ThemeEmotionMap, TypographyHTMLTag } from \"~/types\";\nimport { EditorTheme } from \"~/createTheme\";\nimport { css as EmotionCSS } from \"emotion\";\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: typeof EmotionCSS,\n theme: EditorTheme,\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":";;;;;;AAIA;AACA;AACA;AACA;AACO,MAAMA,sBAAsB,GAAGA,CAClCC,GAAsB,EACtBC,KAAkB,EAClBC,sBAA4B,KACV;EAClB,MAAMC,GAAoB,GAAG,CAAC,CAAC;EAC/B,MAAMC,gBAAgB,GAAGH,KAAK,CAACI,MAAM,EAAEC,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,IAAIH,sBAAsB,EAAE;UACxBS,iBAAiB,GAAGT,sBAAsB,CAACQ,SAAS,CAACL,MAAM,CAAC;QAChE;QAEA,MAAMO,EAAE,GAAG;UACP,GAAGF,SAAS;UACZG,SAAS,EAAE,CAACb,GAAG,CAACW,iBAAiB,CAAC,CAAC,CAACG,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG;QAChE,CAAC;QACDb,GAAG,CAACO,SAAS,CAACO,EAAE,CAAC,GAAGL,EAAE;MAC1B,CAAC,CAAC;IACN;EACJ;EAEA,OAAOT,GAAG;AACd,CAAC;AAACe,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA","ignoreList":[]}