@cntrl-site/sdk-nextjs 0.30.2 → 0.30.4-0

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,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>
@@ -50,7 +50,15 @@ const CodeEmbedItem = ({ item, sectionId, onResize }) => {
50
50
  ref.appendChild(newScript);
51
51
  }
52
52
  }, [item.commonParams.html]);
53
- return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: { opacity: `${opacity}`, transform: `rotate(${angle}deg)`, filter: `blur(${blur * 100}vw)` }, ref: setRef, children: (0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, style: Object.assign({}, pos), dangerouslySetInnerHTML: { __html: html } }) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
53
+ (0, react_1.useEffect)(() => {
54
+ if (!ref)
55
+ return;
56
+ const iframe = ref.querySelector(`[data-embed="${item.id}"]`);
57
+ if (!iframe)
58
+ return;
59
+ iframe.srcdoc = item.commonParams.html;
60
+ }, [item.commonParams.html, item.commonParams.iframe, ref]);
61
+ return ((0, jsx_runtime_1.jsxs)(LinkWrapper_1.LinkWrapper, { url: (_a = item.link) === null || _a === void 0 ? void 0 : _a.url, target: (_b = item.link) === null || _b === void 0 ? void 0 : _b.target, children: [(0, jsx_runtime_1.jsx)("div", { className: `embed-wrapper-${item.id}`, style: { opacity: `${opacity}`, transform: `rotate(${angle}deg)`, filter: `blur(${blur * 100}vw)` }, ref: setRef, children: item.commonParams.iframe ? ((0, jsx_runtime_1.jsx)("iframe", { "data-embed": item.id, className: `embed-${item.id}`, style: Object.assign(Object.assign({}, pos), { border: 'unset' }) })) : ((0, jsx_runtime_1.jsx)("div", { className: `embed-${item.id}`, style: Object.assign({}, pos), dangerouslySetInnerHTML: { __html: html } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
54
62
  .embed-wrapper-${item.id} {
55
63
  position: absolute;
56
64
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.30.2",
3
+ "version": "0.30.4-0",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -23,9 +23,10 @@
23
23
  "dependencies": {
24
24
  "@cntrl-site/color": "^1.0.0",
25
25
  "@cntrl-site/effects": "^1.2.0",
26
- "@cntrl-site/sdk": "^1.12.1",
26
+ "@cntrl-site/sdk": "^1.12.2",
27
27
  "@types/vimeo__player": "^2.18.0",
28
28
  "@vimeo/player": "^2.20.1",
29
+ "eslint-config-next": "^14.2.3",
29
30
  "html-react-parser": "^3.0.1",
30
31
  "resize-observer-polyfill": "^1.5.1",
31
32
  "styled-jsx": "^5.0.2"
@@ -33,9 +34,9 @@
33
34
  "peerDependencies": {
34
35
  "@types/lodash.isequal": "^4.5.6",
35
36
  "lodash.isequal": "^4.5.0",
36
- "next": "^13.0.0",
37
- "react": "^18.2.0",
38
- "react-dom": "^18.2.0"
37
+ "next": "^14.2.3",
38
+ "react": "^18.3.1",
39
+ "react-dom": "^18.3.1"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@tsconfig/node16": "^1.0.3",
@@ -44,7 +44,14 @@ export const CodeEmbedItem: FC<ItemProps<TCodeEmbedItem>> = ({ item, sectionId,
44
44
  script.parentNode!.removeChild(script);
45
45
  ref.appendChild(newScript);
46
46
  }
47
- }, [item.commonParams.html]);
47
+ }, [item.commonParams.html])
48
+
49
+ useEffect(() => {
50
+ if (!ref) return;
51
+ const iframe: HTMLIFrameElement | null = ref.querySelector(`[data-embed="${item.id}"]`);
52
+ if (!iframe) return;
53
+ iframe.srcdoc = item.commonParams.html;
54
+ }, [item.commonParams.html, item.commonParams.iframe, ref]);
48
55
 
49
56
  return (
50
57
  <LinkWrapper url={item.link?.url} target={item.link?.target}>
@@ -53,11 +60,22 @@ export const CodeEmbedItem: FC<ItemProps<TCodeEmbedItem>> = ({ item, sectionId,
53
60
  style={{ opacity: `${opacity}`, transform: `rotate(${angle}deg)`, filter: `blur(${blur * 100}vw)` }}
54
61
  ref={setRef}
55
62
  >
56
- <div
57
- className={`embed-${item.id}`}
58
- style={{ ...pos }}
59
- dangerouslySetInnerHTML={{ __html: html }}
60
- />
63
+ {item.commonParams.iframe ? (
64
+ <iframe
65
+ data-embed={item.id}
66
+ className={`embed-${item.id}`}
67
+ style={{
68
+ ...pos,
69
+ border: 'unset'
70
+ }}
71
+ />
72
+ ) : (
73
+ <div
74
+ className={`embed-${item.id}`}
75
+ style={{ ...pos }}
76
+ dangerouslySetInnerHTML={{ __html: html }}
77
+ />
78
+ )}
61
79
  </div>
62
80
  <JSXStyle id={id}>{`
63
81
  .embed-wrapper-${item.id} {
Binary file