@webiny/lexical-theme 6.0.0-alpha.0 → 6.0.0-alpha.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,5 +1,5 @@
1
1
  import type { EditorThemeClasses } from "lexical";
2
- import { ThemeEmotionMap } from "./types";
2
+ import type { ThemeEmotionMap } from "./types";
3
3
  export type EditorTheme = {
4
4
  styles: Record<string, any>;
5
5
  emotionMap: ThemeEmotionMap;
@@ -1 +1 @@
1
- {"version":3,"names":["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\";\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-unused-vars\n emotionMap,\n ...theme\n}: Partial<EditorTheme>): EditorTheme => {\n return { ...defaultTheme, ...theme };\n};\n"],"mappings":";;;;;;AAQA,MAAMA,YAAyB,GAAG;EAC9BC,MAAM,EAAE,CAAC,CAAC;EACVC,UAAU,EAAE,CAAC,CAAC;EACdC,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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DC,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,CAAC;EACxB;EACAvE,MAAM;EACN;EACAC,UAAU;EACV,GAAGuE;AACe,CAAC,KAAkB;EACrC,OAAO;IAAE,GAAGzE,YAAY;IAAE,GAAGyE;EAAM,CAAC;AACxC,CAAC;AAACC,OAAA,CAAAF,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["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\";\nimport type { 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-unused-vars\n emotionMap,\n ...theme\n}: Partial<EditorTheme>): EditorTheme => {\n return { ...defaultTheme, ...theme };\n};\n"],"mappings":";;;;;;AAQA,MAAMA,YAAyB,GAAG;EAC9BC,MAAM,EAAE,CAAC,CAAC;EACVC,UAAU,EAAE,CAAC,CAAC;EACdC,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;IAC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FC,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,CAAC;EACxB;EACAvE,MAAM;EACN;EACAC,UAAU;EACV,GAAGuE;AACe,CAAC,KAAkB;EACrC,OAAO;IAAE,GAAGzE,YAAY;IAAE,GAAGyE;EAAM,CAAC;AACxC,CAAC;AAACC,OAAA,CAAAF,WAAA,GAAAA,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/lexical-theme",
3
- "version": "6.0.0-alpha.0",
3
+ "version": "6.0.0-alpha.1",
4
4
  "dependencies": {
5
5
  "@emotion/react": "11.10.8",
6
6
  "emotion": "10.0.27",
@@ -8,7 +8,7 @@
8
8
  "react-style-object-to-css": "1.1.2"
9
9
  },
10
10
  "devDependencies": {
11
- "@webiny/project-utils": "6.0.0-alpha.0"
11
+ "@webiny/project-utils": "6.0.0-alpha.1"
12
12
  },
13
13
  "publishConfig": {
14
14
  "access": "public",
@@ -18,5 +18,5 @@
18
18
  "build": "node ../cli/bin.js run build",
19
19
  "watch": "node ../cli/bin.js run watch"
20
20
  },
21
- "gitHead": "a5b28fed7a242d8f56712197a8ea83aa6d2ed101"
21
+ "gitHead": "9bd236cf5e689f209a11bec089207dcc2d41a53c"
22
22
  }
package/types.d.ts CHANGED
@@ -1,21 +1,17 @@
1
1
  import type { CSSObject } from "@emotion/react";
2
- export type ListHtmlTag = "ol" | "ul";
3
- export type HeadingHtmlTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4
- export type ParagraphHtmlTag = "p";
5
- export type QuoteBlockHtmlTag = "quoteblock";
6
- export type TypographyHTMLTag = HeadingHtmlTag | ParagraphHtmlTag | ListHtmlTag | QuoteBlockHtmlTag;
7
2
  export type TypographyValue = {
8
- css: CSSObject;
9
3
  id: string;
10
- tag: TypographyHTMLTag;
4
+ tag: string;
11
5
  name: string;
6
+ css?: CSSObject;
7
+ className?: string;
12
8
  };
13
9
  export type ThemeEmotionMap = {
14
10
  [styleId: string]: {
15
11
  id: string;
16
- tag: TypographyHTMLTag;
12
+ tag: string;
17
13
  name: string;
18
- styles: Record<string, any>;
14
+ styles?: Record<string, any>;
19
15
  className: string;
20
16
  };
21
17
  };
package/types.js.map CHANGED
@@ -1 +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":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CSSObject } from \"@emotion/react\";\n\nexport type TypographyValue = {\n id: string;\n tag: string;\n name: string;\n css?: CSSObject;\n className?: 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: string;\n name: string;\n styles?: Record<string, any>;\n // emotion generated class or user provided class\n className: string;\n };\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,8 +1,8 @@
1
- import { ThemeEmotionMap } from "../types";
2
- export declare const findTypographyStyleByHtmlTag: (htmlTag: string, themeEmotionMap: ThemeEmotionMap) => {
1
+ import type { ThemeEmotionMap } from "../types";
2
+ export declare const findTypographyStyleByHtmlTag: (htmlTag: string | string[], themeEmotionMap: ThemeEmotionMap) => {
3
3
  id: string;
4
- tag: import("../types").TypographyHTMLTag;
4
+ tag: string;
5
5
  name: string;
6
- styles: Record<string, any>;
6
+ styles?: Record<string, any> | undefined;
7
7
  className: string;
8
8
  } | undefined;
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.findTypographyStyleByHtmlTag = void 0;
7
7
  const findTypographyStyleByHtmlTag = (htmlTag, themeEmotionMap) => {
8
+ const tags = Array.isArray(htmlTag) ? htmlTag : [htmlTag];
8
9
  for (const styleId in themeEmotionMap) {
9
10
  const style = themeEmotionMap[styleId];
10
- if (style.tag === htmlTag) {
11
+ if (tags.includes(style.tag)) {
11
12
  return style;
12
13
  }
13
14
  }
@@ -1 +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","ignoreList":[]}
1
+ {"version":3,"names":["findTypographyStyleByHtmlTag","htmlTag","themeEmotionMap","tags","Array","isArray","styleId","style","includes","tag","undefined","exports"],"sources":["findTypographyStyleByHtmlTag.ts"],"sourcesContent":["import type { ThemeEmotionMap } from \"~/types\";\n\nexport const findTypographyStyleByHtmlTag = (\n htmlTag: string | string[],\n themeEmotionMap: ThemeEmotionMap\n) => {\n const tags = Array.isArray(htmlTag) ? htmlTag : [htmlTag];\n\n for (const styleId in themeEmotionMap) {\n const style = themeEmotionMap[styleId];\n if (tags.includes(style.tag)) {\n return style;\n }\n }\n return undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,4BAA4B,GAAGA,CACxCC,OAA0B,EAC1BC,eAAgC,KAC/B;EACD,MAAMC,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAG,CAACA,OAAO,CAAC;EAEzD,KAAK,MAAMK,OAAO,IAAIJ,eAAe,EAAE;IACnC,MAAMK,KAAK,GAAGL,eAAe,CAACI,OAAO,CAAC;IACtC,IAAIH,IAAI,CAACK,QAAQ,CAACD,KAAK,CAACE,GAAG,CAAC,EAAE;MAC1B,OAAOF,KAAK;IAChB;EACJ;EACA,OAAOG,SAAS;AACpB,CAAC;AAACC,OAAA,CAAAX,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ThemeEmotionMap } from "../types";
2
- import { EditorTheme } from "../createTheme";
3
- import { css as EmotionCSS } from "emotion";
1
+ import type { css as EmotionCSS } from "emotion";
2
+ import type { ThemeEmotionMap } from "../types";
3
+ import type { EditorTheme } from "../createTheme";
4
4
  export declare const toTypographyEmotionMap: (css: typeof EmotionCSS, theme: EditorTheme, themeStylesTransformer?: any) => ThemeEmotionMap;
@@ -18,19 +18,23 @@ const toTypographyEmotionMap = (css, theme, themeStylesTransformer) => {
18
18
  const typographyTypeData = typographyStyles[key];
19
19
  if (typographyTypeData) {
20
20
  typographyTypeData.forEach(styleItem => {
21
+ // If `className` is already defined, use the style as is.
22
+ if (styleItem.className !== undefined) {
23
+ map[styleItem.id] = styleItem;
24
+ return;
25
+ }
26
+
21
27
  // 'lx' (abbreviation of lexical) variable will lead to generate shorter class names.
22
28
  // for example: instead of default 'css-181qz4b-453f345f'
23
29
  // the last segment will always end with 'lx' or 'css-181qz4b-lx'
24
-
25
30
  let transformedStyles = styleItem.styles;
26
31
  if (themeStylesTransformer) {
27
32
  transformedStyles = themeStylesTransformer(styleItem.styles);
28
33
  }
29
- const lx = {
34
+ map[styleItem.id] = {
30
35
  ...styleItem,
31
36
  className: [css(transformedStyles)].filter(Boolean).join(" ")
32
37
  };
33
- map[styleItem.id] = lx;
34
38
  });
35
39
  }
36
40
  }
@@ -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 { 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":[]}
1
+ {"version":3,"names":["toTypographyEmotionMap","css","theme","themeStylesTransformer","map","typographyStyles","styles","typography","key","typographyTypeData","forEach","styleItem","className","undefined","id","transformedStyles","filter","Boolean","join","exports"],"sources":["toTypographyEmotionMap.ts"],"sourcesContent":["import type { css as EmotionCSS } from \"emotion\";\nimport type { ThemeEmotionMap } from \"~/types\";\nimport type { EditorTheme } from \"~/createTheme\";\n\ntype StyleItem = {\n id: string;\n tag: string;\n name: string;\n styles?: Record<string, any>;\n className?: string;\n};\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 StyleItem[];\n if (typographyTypeData) {\n typographyTypeData.forEach(styleItem => {\n // If `className` is already defined, use the style as is.\n if (styleItem.className !== undefined) {\n map[styleItem.id] = styleItem as StyleItem & { className: string };\n return;\n }\n\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 let transformedStyles = styleItem.styles;\n if (themeStylesTransformer) {\n transformedStyles = themeStylesTransformer(styleItem.styles);\n }\n\n map[styleItem.id] = {\n ...styleItem,\n className: [css(transformedStyles)].filter(Boolean).join(\" \")\n };\n });\n }\n }\n\n return map;\n};\n"],"mappings":";;;;;;AAYA;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,CAAgB;IAC/D,IAAIC,kBAAkB,EAAE;MACpBA,kBAAkB,CAACC,OAAO,CAACC,SAAS,IAAI;QACpC;QACA,IAAIA,SAAS,CAACC,SAAS,KAAKC,SAAS,EAAE;UACnCT,GAAG,CAACO,SAAS,CAACG,EAAE,CAAC,GAAGH,SAA8C;UAClE;QACJ;;QAEA;QACA;QACA;QACA,IAAII,iBAAiB,GAAGJ,SAAS,CAACL,MAAM;QACxC,IAAIH,sBAAsB,EAAE;UACxBY,iBAAiB,GAAGZ,sBAAsB,CAACQ,SAAS,CAACL,MAAM,CAAC;QAChE;QAEAF,GAAG,CAACO,SAAS,CAACG,EAAE,CAAC,GAAG;UAChB,GAAGH,SAAS;UACZC,SAAS,EAAE,CAACX,GAAG,CAACc,iBAAiB,CAAC,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG;QAChE,CAAC;MACL,CAAC,CAAC;IACN;EACJ;EAEA,OAAOd,GAAG;AACd,CAAC;AAACe,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA","ignoreList":[]}