Variable StyleHelperConst

StyleHelper: {
    JSONToString(style): string;
    penStyleToCSS(penStyle): string;
    penStyleToJSON(penStyleString): TPenStyle;
    stringToJSON(style): {
        [key: string]: string;
    };
    themeToCSS(json): string;
    themeToJSON(style): TTheme;
} = { themeToCSS(json: TTheme): string { return parser.toCSS(json) as string; }, themeToJSON(style: string): TTheme { const theme = parser.toJSON(style) as TTheme; theme[".text"]["font-size"] = Number(theme[".text"]["font-size"]); theme.ink["-myscript-pen-width"] = Number(theme.ink["-myscript-pen-width"]); theme.ink.width = Number(theme.ink.width); return theme; }, penStyleToCSS(penStyle: TPenStyle): string { let css = parser.toCSS({ css: penStyle }) as string; css = css.substring(6, css.length - 3); return css; }, penStyleToJSON(penStyleString: string): TPenStyle { const penStyle = parser.toJSON(`css {${penStyleString}}`).css as TPenStyle; if (penStyle.width) { penStyle.width = Number(penStyle.width); } else { delete penStyle.width; } if (penStyle["-myscript-pen-width"]) { penStyle["-myscript-pen-width"] = Number(penStyle["-myscript-pen-width"]); } else { delete penStyle["-myscript-pen-width"]; } return penStyle; }, stringToJSON(style: string): { [key: string]: string; } { return parser.toJSON(`css {${style}}`).css; }, JSONToString(style: { [key: string]: string; }): string { return Object.entries(style).map(([k, v]) => `${k}:${v}`).join(";"); } }

Type declaration

  • JSONToString:function
    • Parameters

      • style: {
            [key: string]: string;
        }
        • [key: string]: string

      Returns string

  • penStyleToCSS:function
    • Parameters

      Returns string

  • penStyleToJSON:function
    • Parameters

      • penStyleString: string

      Returns TPenStyle

  • stringToJSON:function
    • Parameters

      • style: string

      Returns {
          [key: string]: string;
      }

      • [key: string]: string
  • themeToCSS:function
    • Parameters

      Returns string

  • themeToJSON:function
    • Parameters

      • style: string

      Returns TTheme

Generated using TypeDoc