@cntrl-site/sdk-nextjs 1.6.8 → 1.6.10

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.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,15 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="myValues">
6
+ <value>
7
+ <list size="1">
8
+ <item index="0" class="java.lang.String" itemvalue="jsx" />
9
+ </list>
10
+ </value>
11
+ </option>
12
+ <option name="myCustomValuesEnabled" value="true" />
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
@@ -7,9 +7,9 @@ const sdk_1 = require("@cntrl-site/sdk");
7
7
  const LinkWrapper_1 = require("../../components/items/LinkWrapper");
8
8
  const getFontFamilyValue_1 = require("../getFontFamilyValue");
9
9
  exports.FontStyles = {
10
- 'normal': {},
11
- 'bold': { 'font-weight': 'bold' },
12
- 'italic': { 'font-style': 'italic' }
10
+ normal: { 'font-style': 'normal' },
11
+ bold: { 'font-weight': 'bold' },
12
+ italic: { 'font-style': 'italic' }
13
13
  };
14
14
  class RichTextConverter {
15
15
  toHtml(richText, layouts) {
@@ -20,7 +20,7 @@ class RichTextConverter {
20
20
  rec[layout.id] = [];
21
21
  return rec;
22
22
  }, {});
23
- let currentLineHeight = layouts.reduce((rec, layout) => {
23
+ const currentLineHeight = layouts.reduce((rec, layout) => {
24
24
  var _a;
25
25
  const styles = richText.layoutParams[layout.id].rangeStyles;
26
26
  rec[layout.id] = (_a = styles === null || styles === void 0 ? void 0 : styles.find(s => s.style === 'LINEHEIGHT')) === null || _a === void 0 ? void 0 : _a.value;
@@ -223,18 +223,18 @@ class RichTextConverter {
223
223
  static fromRangeStylesToInline(draftStyle, exemplary) {
224
224
  const { value, name } = draftStyle;
225
225
  const map = {
226
- 'COLOR': { 'color': getResolvedValue(value, name) },
227
- 'TYPEFACE': { 'font-family': `${(0, getFontFamilyValue_1.getFontFamilyValue)(value)}` },
228
- 'FONTSTYLE': value ? Object.assign({}, exports.FontStyles[value]) : {},
229
- 'FONTWEIGHT': { 'font-weight': value },
230
- 'FONTSIZE': { 'font-size': `${parseFloat(value) * exemplary}px` },
231
- 'LINEHEIGHT': { 'line-height': `${parseFloat(value) * exemplary}px` },
232
- 'LETTERSPACING': { 'letter-spacing': `${parseFloat(value) * exemplary}px` },
233
- 'WORDSPACING': { 'word-spacing': `${parseFloat(value) * exemplary}px` },
234
- 'TEXTTRANSFORM': value ? { 'text-transform': value } : { 'text-transform': sdk_1.TextTransform.None },
235
- 'VERTICALALIGN': value ? { 'vertical-align': value } : { 'vertical-align': sdk_1.VerticalAlign.Unset },
236
- 'TEXTDECORATION': { 'text-decoration': value },
237
- 'FONTVARIANT': { 'font-variant': value }
226
+ COLOR: { color: getResolvedValue(value, name) },
227
+ TYPEFACE: { 'font-family': `${(0, getFontFamilyValue_1.getFontFamilyValue)(value)}` },
228
+ FONTSTYLE: value ? Object.assign({}, exports.FontStyles[value]) : {},
229
+ FONTWEIGHT: { 'font-weight': value },
230
+ FONTSIZE: { 'font-size': `${Number.parseFloat(value) * exemplary}px` },
231
+ LINEHEIGHT: { 'line-height': `${Number.parseFloat(value) * exemplary}px` },
232
+ LETTERSPACING: { 'letter-spacing': `${Number.parseFloat(value) * exemplary}px` },
233
+ WORDSPACING: { 'word-spacing': `${Number.parseFloat(value) * exemplary}px` },
234
+ TEXTTRANSFORM: value ? { 'text-transform': value } : { 'text-transform': sdk_1.TextTransform.None },
235
+ VERTICALALIGN: value ? { 'vertical-align': value } : { 'vertical-align': sdk_1.VerticalAlign.Unset },
236
+ TEXTDECORATION: { 'text-decoration': value },
237
+ FONTVARIANT: { 'font-variant': value }
238
238
  };
239
239
  const css = map[name];
240
240
  if (!css) {
@@ -260,8 +260,8 @@ function getResolvedValue(value, name) {
260
260
  return value;
261
261
  return value ? color_1.CntrlColor.parse(value).toCss() : value;
262
262
  }
263
- function sliceSymbols(text, start, end = NaN) {
264
- let startOffset = NaN;
263
+ function sliceSymbols(text, start, end = Number.NaN) {
264
+ let startOffset = Number.NaN;
265
265
  let endOffset = 0;
266
266
  let count = -1;
267
267
  for (const ch of text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.6.8",
3
+ "version": "1.6.10",
4
4
  "description": "SDK for Next.js",
5
5
  "author": "arsen@momdesign.nyc",
6
6
  "license": "MIT",
@@ -6,7 +6,7 @@ import { ItemProps } from '../Item';
6
6
  import { useRichTextItem } from './useRichTextItem';
7
7
  import { useCntrlContext } from '../../../provider/useCntrlContext';
8
8
  import { useRichTextItemValues } from '../useRichTextItemValues';
9
- import { useRegisterResize } from "../../../common/useRegisterResize";
9
+ import { useRegisterResize } from '../../../common/useRegisterResize';
10
10
  import { getFontFamilyValue } from '../../../utils/getFontFamilyValue';
11
11
  import { useExemplary } from '../../../common/useExemplary';
12
12
  import { useItemAngle } from '../useItemAngle';
@@ -32,9 +32,9 @@ interface Style {
32
32
  }
33
33
 
34
34
  export const FontStyles: Record<string, Record<string, string>> = {
35
- 'normal': {},
36
- 'bold': { 'font-weight': 'bold' },
37
- 'italic': { 'font-style': 'italic' }
35
+ normal: { 'font-style': 'normal' },
36
+ bold: { 'font-weight': 'bold' },
37
+ italic: { 'font-style': 'italic' }
38
38
  };
39
39
 
40
40
  export class RichTextConverter {
@@ -48,7 +48,7 @@ export class RichTextConverter {
48
48
  rec[layout.id] = [];
49
49
  return rec;
50
50
  }, {});
51
- let currentLineHeight = layouts.reduce<Record<string, string | undefined>>((rec, layout) => {
51
+ const currentLineHeight = layouts.reduce<Record<string, string | undefined>>((rec, layout) => {
52
52
  const styles = richText.layoutParams[layout.id].rangeStyles;
53
53
  rec[layout.id] = styles?.find(s => s.style === 'LINEHEIGHT')?.value;
54
54
  return rec;
@@ -194,7 +194,7 @@ export class RichTextConverter {
194
194
  start,
195
195
  end,
196
196
  styles: applied.map(s => ({ name: s.style, value: s.value }))
197
- })
197
+ });
198
198
  }
199
199
 
200
200
  return styleGroups;
@@ -262,18 +262,18 @@ export class RichTextConverter {
262
262
  private static fromRangeStylesToInline(draftStyle: Style, exemplary: number): string {
263
263
  const { value, name } = draftStyle;
264
264
  const map: Record<string, Record<string, string | undefined>> = {
265
- 'COLOR': { 'color': getResolvedValue(value, name) },
266
- 'TYPEFACE': { 'font-family': `${getFontFamilyValue(value!)}` },
267
- 'FONTSTYLE': value ? { ...FontStyles[value] } : {},
268
- 'FONTWEIGHT': { 'font-weight': value },
269
- 'FONTSIZE': { 'font-size': `${parseFloat(value!) * exemplary}px` },
270
- 'LINEHEIGHT': { 'line-height': `${parseFloat(value!) * exemplary}px` },
271
- 'LETTERSPACING': { 'letter-spacing': `${parseFloat(value!) * exemplary}px` },
272
- 'WORDSPACING': { 'word-spacing': `${parseFloat(value!) * exemplary}px` },
273
- 'TEXTTRANSFORM': value ? { 'text-transform': value as TextTransform } : { 'text-transform': TextTransform.None },
274
- 'VERTICALALIGN': value ? { 'vertical-align': value as VerticalAlign } : { 'vertical-align': VerticalAlign.Unset },
275
- 'TEXTDECORATION': { 'text-decoration': value },
276
- 'FONTVARIANT': { 'font-variant': value }
265
+ COLOR: { color: getResolvedValue(value, name) },
266
+ TYPEFACE: { 'font-family': `${getFontFamilyValue(value!)}` },
267
+ FONTSTYLE: value ? { ...FontStyles[value] } : {},
268
+ FONTWEIGHT: { 'font-weight': value },
269
+ FONTSIZE: { 'font-size': `${Number.parseFloat(value!) * exemplary}px` },
270
+ LINEHEIGHT: { 'line-height': `${Number.parseFloat(value!) * exemplary}px` },
271
+ LETTERSPACING: { 'letter-spacing': `${Number.parseFloat(value!) * exemplary}px` },
272
+ WORDSPACING: { 'word-spacing': `${Number.parseFloat(value!) * exemplary}px` },
273
+ TEXTTRANSFORM: value ? { 'text-transform': value as TextTransform } : { 'text-transform': TextTransform.None },
274
+ VERTICALALIGN: value ? { 'vertical-align': value as VerticalAlign } : { 'vertical-align': VerticalAlign.Unset },
275
+ TEXTDECORATION: { 'text-decoration': value },
276
+ FONTVARIANT: { 'font-variant': value }
277
277
  };
278
278
  const css = map[name];
279
279
  if (!css) {
@@ -300,8 +300,8 @@ function getResolvedValue(value: string | undefined, name: string) {
300
300
  return value ? CntrlColor.parse(value).toCss() : value;
301
301
  }
302
302
 
303
- function sliceSymbols(text: string, start: number, end: number = NaN): string {
304
- let startOffset = NaN;
303
+ function sliceSymbols(text: string, start: number, end: number = Number.NaN): string {
304
+ let startOffset = Number.NaN;
305
305
  let endOffset = 0;
306
306
  let count = -1;
307
307
  for (const ch of text) {
Binary file