@webiny/lexical-theme 0.0.0-unstable.f9f12f52a0 → 0.0.0-unstable.fdd9228b5d
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/lexical-theme",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.fdd9228b5d",
|
|
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": "0.0.0-unstable.
|
|
11
|
+
"@webiny/project-utils": "0.0.0-unstable.fdd9228b5d"
|
|
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": "
|
|
21
|
+
"gitHead": "fdd9228b5d2636463e8a34b6e0d26eea1e29c01d"
|
|
22
22
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
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 BlockQuoteHtmlTag = "blockquote";
|
|
6
|
-
export type TypographyHTMLTag = HeadingHtmlTag | ParagraphHtmlTag | ListHtmlTag | BlockQuoteHtmlTag;
|
|
7
2
|
export type TypographyValue = {
|
|
8
3
|
id: string;
|
|
9
|
-
tag:
|
|
4
|
+
tag: string;
|
|
10
5
|
name: string;
|
|
11
|
-
css
|
|
6
|
+
css?: CSSObject;
|
|
12
7
|
className?: string;
|
|
13
8
|
};
|
|
14
9
|
export type ThemeEmotionMap = {
|
|
15
10
|
[styleId: string]: {
|
|
16
11
|
id: string;
|
|
17
|
-
tag:
|
|
12
|
+
tag: string;
|
|
18
13
|
name: string;
|
|
19
14
|
styles?: Record<string, any>;
|
|
20
15
|
className: string;
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CSSObject } from \"@emotion/react\";\n\
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import type { ThemeEmotionMap } from "../types";
|
|
2
2
|
export declare const findTypographyStyleByHtmlTag: (htmlTag: string | string[], themeEmotionMap: ThemeEmotionMap) => {
|
|
3
3
|
id: string;
|
|
4
|
-
tag:
|
|
4
|
+
tag: string;
|
|
5
5
|
name: string;
|
|
6
6
|
styles?: Record<string, any> | undefined;
|
|
7
7
|
className: string;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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":[]}
|