@frontify/guideline-blocks-settings 0.28.3 → 0.28.4

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": "@frontify/guideline-blocks-settings",
3
- "version": "0.28.3",
3
+ "version": "0.28.4",
4
4
  "description": "Provides types and helpers for the guideline block development",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.js",
@@ -22,12 +22,12 @@
22
22
  "./styles": "./dist/styles.css"
23
23
  },
24
24
  "devDependencies": {
25
- "@babel/core": "^7.22.9",
25
+ "@babel/core": "^7.22.10",
26
26
  "@frontify/eslint-config-typescript": "^0.16.1",
27
27
  "@testing-library/react": "^14.0.0",
28
28
  "@types/escape-html": "^1.0.2",
29
- "@types/node": "^20.4.7",
30
- "@types/react": "^18.2.18",
29
+ "@types/node": "^18.17.4",
30
+ "@types/react": "^18.2.20",
31
31
  "@types/react-dom": "^18.2.7",
32
32
  "@types/sinon": "^10.0.16",
33
33
  "@vitejs/plugin-react": "^4.0.4",
@@ -36,19 +36,19 @@
36
36
  "cypress-real-events": "^1.10.0",
37
37
  "eslint": "^8.46.0",
38
38
  "eslint-plugin-notice": "^0.9.10",
39
- "happy-dom": "^10.7.0",
39
+ "happy-dom": "^10.9.0",
40
40
  "mitt": "^3.0.1",
41
41
  "msw": "^1.2.3",
42
42
  "postcss": "^8.4.27",
43
43
  "prettier": "^3.0.1",
44
44
  "react": "^18.2.0",
45
45
  "react-dom": "^18.2.0",
46
- "rollup": "^3.27.2",
46
+ "rollup": "^3.28.0",
47
47
  "sinon": "15.2.0",
48
48
  "tailwindcss": "^3.3.3",
49
49
  "typescript": "^5.1.6",
50
- "vite": "^4.4.8",
51
- "vite-plugin-dts": "^3.5.0",
50
+ "vite": "^4.4.9",
51
+ "vite-plugin-dts": "^3.5.1",
52
52
  "vite-plugin-externals": "^0.6.2",
53
53
  "vitest": "^0.34.1"
54
54
  },
@@ -64,8 +64,8 @@
64
64
  "escape-html": "^1.0.3",
65
65
  "slate": "^0.94.1",
66
66
  "slate-react": "^0.97.1",
67
- "@frontify/app-bridge": "3.0.0-beta.86",
68
- "@frontify/sidebar-settings": "0.6.1"
67
+ "@frontify/app-bridge": "3.0.0-beta.87",
68
+ "@frontify/sidebar-settings": "0.6.2"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": "^18",
@@ -18,6 +18,7 @@ export const buttonNode = (node: TElement, children: string, defaultClassNames:
18
18
 
19
19
  return `<a href="${node.url}"
20
20
  target="${node.target ?? '_blank'}"
21
+ dir="auto"
21
22
  style="${defaultStyles}"
22
23
  class="${defaultClassNames}"
23
24
  onmouseenter="this.setAttribute('style', '${defaultStyles} ${reactCssPropsToCss(buttonStyle?.hover)}');"
@@ -12,17 +12,17 @@ export const checkItemNode = (
12
12
  defaultClassNames: string,
13
13
  styles: Record<string, CSSProperties & { hover?: CSSProperties }>,
14
14
  ) => {
15
- return `<div disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${defaultClassNames}" style="margin-left:${
15
+ return `<div dir="auto" disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${defaultClassNames}" style="margin-left:${
16
16
  ((node.indent as number) ?? 0) * 24
17
17
  }px;">
18
- <div class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
18
+ <div dir="auto" class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
19
19
  <input
20
20
  class="tw-w-4 tw-h-4 tw-m-0"
21
21
  type="checkbox"
22
22
  ${node.checked ? 'checked' : ''}
23
23
  onclick="return false;" />
24
24
  </div>
25
- <span class="${merge([
25
+ <span dir="auto" class="${merge([
26
26
  'tw-flex-1 tw-focus:outline-none',
27
27
  node.checked ? '!tw-line-through' : '',
28
28
  ])}" style="${reactCssPropsToCss(styles[node.children[0].textStyle as string])}">${children}</span>
@@ -11,43 +11,58 @@ export const defaultNode = (node: TElement, children: string, styles: CSSPropert
11
11
  const defaultStyles = reactCssPropsToCss(styles);
12
12
 
13
13
  if (node.type === TextStyles.heading1) {
14
- return `<h1 class="${merge([defaultClassNames, 'a-h1'])}">${getStyledChild(children, defaultStyles)}</h1>`;
14
+ return `<h1 dir="auto" class="${merge([defaultClassNames, 'a-h1'])}">${getStyledChild(
15
+ children,
16
+ defaultStyles,
17
+ )}</h1>`;
15
18
  }
16
19
  if (node.type === TextStyles.heading2) {
17
- return `<h2 class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h2>`;
20
+ return `<h2 dir="auto" class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h2>`;
18
21
  }
19
22
  if (node.type === TextStyles.heading3) {
20
- return `<h3 class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h3>`;
23
+ return `<h3 dir="auto" class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h3>`;
21
24
  }
22
25
  if (node.type === TextStyles.heading4) {
23
- return `<h4 class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h4>`;
26
+ return `<h4 dir="auto" class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</h4>`;
24
27
  }
25
28
  if (node.type === TextStyles.custom1) {
26
- return `<p class="${merge([defaultClassNames, 'a-custom1'])}">${getStyledChild(children, defaultStyles)}</p>`;
29
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-custom1'])}">${getStyledChild(
30
+ children,
31
+ defaultStyles,
32
+ )}</p>`;
27
33
  }
28
34
  if (node.type === TextStyles.custom2) {
29
- return `<p class="${merge([defaultClassNames, 'a-custom2'])}">${getStyledChild(children, defaultStyles)}</p>`;
35
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-custom2'])}">${getStyledChild(
36
+ children,
37
+ defaultStyles,
38
+ )}</p>`;
30
39
  }
31
40
  if (node.type === TextStyles.custom3) {
32
- return `<p class="${merge([defaultClassNames, 'a-custom3'])}">${getStyledChild(children, defaultStyles)}</p>`;
41
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-custom3'])}">${getStyledChild(
42
+ children,
43
+ defaultStyles,
44
+ )}</p>`;
33
45
  }
34
46
  if (node.type === TextStyles.quote) {
35
- return `<p class="${merge([defaultClassNames, 'a-quote'])}">${getStyledChild(children, defaultStyles)}</p>`;
47
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-quote'])}">${getStyledChild(
48
+ children,
49
+ defaultStyles,
50
+ )}</p>`;
36
51
  }
37
52
  if (node.type === TextStyles.imageTitle) {
38
- return `<p class="${merge([defaultClassNames, 'a-image-title'])}">${getStyledChild(
53
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-image-title'])}">${getStyledChild(
39
54
  children,
40
55
  defaultStyles,
41
56
  )}</p>`;
42
57
  }
43
58
  if (node.type === TextStyles.imageCaption) {
44
- return `<p class="${merge([defaultClassNames, 'a-image-caption'])}">${getStyledChild(
59
+ return `<p dir="auto" class="${merge([defaultClassNames, 'a-image-caption'])}">${getStyledChild(
45
60
  children,
46
61
  defaultStyles,
47
62
  )}</p>`;
48
63
  }
49
64
 
50
- return `<p class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</p>`;
65
+ return `<p dir="auto" class="${defaultClassNames}">${getStyledChild(children, defaultStyles)}</p>`;
51
66
  };
52
67
 
53
- const getStyledChild = (children: string, styles: string) => `<span style="${styles}">${children}</span>`;
68
+ const getStyledChild = (children: string, styles: string) => `<span dir="auto" style="${styles}">${children}</span>`;
@@ -16,11 +16,11 @@ export const linkNode = (
16
16
  ) => {
17
17
  if (node.chosenLink) {
18
18
  const { chosenLink } = node as TLinkElement;
19
- return `<a class="${defaultClassNames}" style="${reactCssPropsToCss(styles[LINK_PLUGIN])}" target=${
19
+ return `<a dir="auto" class="${defaultClassNames}" style="${reactCssPropsToCss(styles[LINK_PLUGIN])}" target=${
20
20
  chosenLink?.openInNewTab ? '_blank' : '_self'
21
21
  } href="${escapeHtml(chosenLink?.searchResult?.link)}">${children}</a>`;
22
22
  }
23
- return `<a class="${defaultClassNames}" style="${reactCssPropsToCss(styles[LINK_PLUGIN])}" target="${
23
+ return `<a dir="auto" class="${defaultClassNames}" style="${reactCssPropsToCss(styles[LINK_PLUGIN])}" target="${
24
24
  node?.target ?? '_blank'
25
25
  }" href="${escapeHtml(node.url as string)}">${children}</a>`;
26
26
  };
@@ -105,19 +105,19 @@ type Arguments = {
105
105
  };
106
106
 
107
107
  const MapNodeTypesToHtml: { [key: string]: ({ ...args }: Arguments) => string } = {
108
- [ELEMENT_UL]: (args) => `<ul class="${UL_CLASSES} ${args.classNames}">${args.children}</ul>`,
108
+ [ELEMENT_UL]: (args) => `<ul dir="auto" class="${UL_CLASSES} ${args.classNames}">${args.children}</ul>`,
109
109
  [ELEMENT_OL]: ({ classNames, children, node, rootNestingCount }) => {
110
110
  const nestingLevel = Math.max(rootNestingCount - countNodesOfType([node], ELEMENT_OL), 0);
111
- return `<ol class="${getOrderedListClasses(nestingLevel)} ${classNames}" style="${reactCssPropsToCss(
111
+ return `<ol dir="auto" class="${getOrderedListClasses(nestingLevel)} ${classNames}" style="${reactCssPropsToCss(
112
112
  OL_STYLES,
113
113
  )}">${children}</ol>`;
114
114
  },
115
115
  [ELEMENT_LI]: ({ classNames, children, node, styles }) =>
116
- `<li class="${classNames} ${LI_CLASSNAMES}" style="${reactCssPropsToCss(
116
+ `<li dir="auto" class="${classNames} ${LI_CLASSNAMES}" style="${reactCssPropsToCss(
117
117
  getLiStyles(node, styles),
118
118
  )}">${children}</li>`,
119
119
  [ELEMENT_LIC]: ({ classNames, children, node }) =>
120
- `<p class="${classNames} ${getLicElementClassNames(node)}"><span>${children}</span></p>`,
120
+ `<p dir="auto" class="${classNames} ${getLicElementClassNames(node)}"><span>${children}</span></p>`,
121
121
  [ELEMENT_LINK]: ({ node, children, classNames, styles }) => linkNode(node, children, classNames, styles),
122
122
  [ELEMENT_BUTTON]: ({ node, children, classNames, styles }) =>
123
123
  buttonNode(node, children, classNames, styles as ButtonStylesType),