@adhese/sdk-react 1.3.2-nightly-20241114123923 → 1.3.2
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/CHANGELOG.md +8 -5
- package/dist/AdheseSlot.js +4 -7
- package/dist/AdheseSlot.js.map +1 -1
- package/dist/cjs/AdheseSlot.cjs +3 -6
- package/dist/cjs/AdheseSlot.cjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
# @adhese/sdk-react
|
|
2
2
|
|
|
3
|
-
## 1.3.2
|
|
3
|
+
## 1.3.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
7
|
+
- 448224a: Fix custom render not visible in rendering state of the slot
|
|
8
|
+
- 4e327ce: Make sure placeholder is rendered as the inital render to fix issues in SSR environments
|
|
9
|
+
- 3d76945: Fix license field missing in package.json
|
|
10
|
+
- 3d76945: Connect package version more strictly to better enforce tandem updates
|
|
11
|
+
- Updated dependencies [448224a]
|
|
12
|
+
- Updated dependencies [3d76945]
|
|
13
|
+
- @adhese/sdk@1.3.2
|
|
11
14
|
|
|
12
15
|
## 1.3.1
|
|
13
16
|
|
package/dist/AdheseSlot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { watch } from "@adhese/sdk-shared";
|
|
3
3
|
import { useId, useCallback } from "react";
|
|
4
4
|
import { useAdheseSlot } from "./useAdheseSlot.js";
|
|
@@ -42,10 +42,10 @@ function AdheseSlot({
|
|
|
42
42
|
}, [setup, onChange])
|
|
43
43
|
});
|
|
44
44
|
const { status, name, format: slotFormat } = slotState ?? {};
|
|
45
|
-
if (
|
|
45
|
+
if (["error", "empty"].includes(status ?? "")) {
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
51
51
|
"data-name": name,
|
|
@@ -59,10 +59,7 @@ function AdheseSlot({
|
|
|
59
59
|
...style
|
|
60
60
|
},
|
|
61
61
|
...props,
|
|
62
|
-
children:
|
|
63
|
-
(status === "loading" || status === "initialized" || status === "initializing") && placeholder,
|
|
64
|
-
status === "rendered" && (render == null ? void 0 : render(slotState))
|
|
65
|
-
]
|
|
62
|
+
children: (slotState == null ? void 0 : slotState.data) ? render == null ? void 0 : render(slotState) : placeholder
|
|
66
63
|
}
|
|
67
64
|
);
|
|
68
65
|
}
|
package/dist/AdheseSlot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdheseSlot.js","sources":["../src/AdheseSlot.tsx"],"sourcesContent":["'use client';\n\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { type HTMLAttributes, type ReactNode, useCallback, useId } from 'react';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Placeholder to be shown when the slot is not rendered yet.\n */\n placeholder?: ReactNode;\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n /**\n * Inject custom React elements into the slot when it's rendered.\n */\n render?(slot: Slot): ReactNode;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'> & HTMLAttributes<HTMLDivElement>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n *\n * @warning Make sure to wrap your `setup` function in a `useCallback` as it can trigger an infinite loop if it's not\n * memoized.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode,\n type,\n setup,\n parameters,\n format,\n id,\n render,\n placeholder,\n style,\n ...props\n}: AdheseSlotProps): ReactNode {\n const reactId = useId().replaceAll(':', '');\n const componentId = id ?? `slot-${reactId}`;\n\n const slotState = useAdheseSlot(componentId, {\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode: render ? 'none' : renderMode,\n type,\n parameters,\n format,\n setup: useCallback(((context, hooks): void => {\n setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n }) satisfies AdheseSlotOptions['setup'], [setup, onChange]),\n });\n\n const { status, name, format: slotFormat } = slotState ?? {};\n\n if (
|
|
1
|
+
{"version":3,"file":"AdheseSlot.js","sources":["../src/AdheseSlot.tsx"],"sourcesContent":["'use client';\n\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { type HTMLAttributes, type ReactNode, useCallback, useId } from 'react';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Placeholder to be shown when the slot is not rendered yet.\n */\n placeholder?: ReactNode;\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n /**\n * Inject custom React elements into the slot when it's rendered.\n */\n render?(slot: Slot): ReactNode;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'> & HTMLAttributes<HTMLDivElement>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n *\n * @warning Make sure to wrap your `setup` function in a `useCallback` as it can trigger an infinite loop if it's not\n * memoized.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode,\n type,\n setup,\n parameters,\n format,\n id,\n render,\n placeholder,\n style,\n ...props\n}: AdheseSlotProps): ReactNode {\n const reactId = useId().replaceAll(':', '');\n const componentId = id ?? `slot-${reactId}`;\n\n const slotState = useAdheseSlot(componentId, {\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode: render ? 'none' : renderMode,\n type,\n parameters,\n format,\n setup: useCallback(((context, hooks): void => {\n setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n }) satisfies AdheseSlotOptions['setup'], [setup, onChange]),\n });\n\n const { status, name, format: slotFormat } = slotState ?? {};\n\n if (['error', 'empty'].includes(status ?? '')) {\n return null;\n }\n\n return (\n <div\n data-name={name}\n data-status={status}\n data-format={slotFormat}\n data-slot={slot}\n id={componentId}\n style={{\n width,\n height,\n ...style,\n }}\n {...props}\n >\n {slotState?.data ? render?.(slotState) : placeholder}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AA8BO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA+B;AAC7B,QAAM,UAAU,MAAQ,EAAA,WAAW,KAAK,EAAE;AACpC,QAAA,cAAc,MAAM,QAAQ,OAAO;AAEnC,QAAA,YAAY,cAAc,aAAa;AAAA,IAC3C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,SAAS,SAAS;AAAA,IAC9B;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,YAAa,CAAC,SAAS,UAAgB;AAC5C,qCAAQ,SAAS;AAEX,YAAA,SAAS,CAAC,YAAY;AAC1B,6CAAW;AAAA,SACV,EAAE,WAAW,MAAM,MAAM,KAAM,CAAA;AAAA,IAAA,GACK,CAAC,OAAO,QAAQ,CAAC;AAAA,EAAA,CAC3D;AAED,QAAM,EAAE,QAAQ,MAAM,QAAQ,WAAW,IAAI,aAAa;AAE1D,MAAI,CAAC,SAAS,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG;AACtC,WAAA;AAAA,EACT;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa;AAAA,MACb,eAAa;AAAA,MACb,aAAW;AAAA,MACX,IAAI;AAAA,MACJ,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACL;AAAA,MACC,GAAG;AAAA,MAEH,WAAW,uCAAA,QAAO,iCAAS,aAAa;AAAA,IAAA;AAAA,EAAA;AAG/C;"}
|
package/dist/cjs/AdheseSlot.cjs
CHANGED
|
@@ -44,10 +44,10 @@ function AdheseSlot({
|
|
|
44
44
|
}, [setup, onChange])
|
|
45
45
|
});
|
|
46
46
|
const { status, name, format: slotFormat } = slotState ?? {};
|
|
47
|
-
if (
|
|
47
|
+
if (["error", "empty"].includes(status ?? "")) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
53
|
"data-name": name,
|
|
@@ -61,10 +61,7 @@ function AdheseSlot({
|
|
|
61
61
|
...style
|
|
62
62
|
},
|
|
63
63
|
...props,
|
|
64
|
-
children:
|
|
65
|
-
(status === "loading" || status === "initialized" || status === "initializing") && placeholder,
|
|
66
|
-
status === "rendered" && (render == null ? void 0 : render(slotState))
|
|
67
|
-
]
|
|
64
|
+
children: (slotState == null ? void 0 : slotState.data) ? render == null ? void 0 : render(slotState) : placeholder
|
|
68
65
|
}
|
|
69
66
|
);
|
|
70
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdheseSlot.cjs","sources":["../../src/AdheseSlot.tsx"],"sourcesContent":["'use client';\n\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { type HTMLAttributes, type ReactNode, useCallback, useId } from 'react';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Placeholder to be shown when the slot is not rendered yet.\n */\n placeholder?: ReactNode;\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n /**\n * Inject custom React elements into the slot when it's rendered.\n */\n render?(slot: Slot): ReactNode;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'> & HTMLAttributes<HTMLDivElement>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n *\n * @warning Make sure to wrap your `setup` function in a `useCallback` as it can trigger an infinite loop if it's not\n * memoized.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode,\n type,\n setup,\n parameters,\n format,\n id,\n render,\n placeholder,\n style,\n ...props\n}: AdheseSlotProps): ReactNode {\n const reactId = useId().replaceAll(':', '');\n const componentId = id ?? `slot-${reactId}`;\n\n const slotState = useAdheseSlot(componentId, {\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode: render ? 'none' : renderMode,\n type,\n parameters,\n format,\n setup: useCallback(((context, hooks): void => {\n setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n }) satisfies AdheseSlotOptions['setup'], [setup, onChange]),\n });\n\n const { status, name, format: slotFormat } = slotState ?? {};\n\n if (
|
|
1
|
+
{"version":3,"file":"AdheseSlot.cjs","sources":["../../src/AdheseSlot.tsx"],"sourcesContent":["'use client';\n\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { watch } from '@adhese/sdk-shared';\nimport { type HTMLAttributes, type ReactNode, useCallback, useId } from 'react';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Placeholder to be shown when the slot is not rendered yet.\n */\n placeholder?: ReactNode;\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n /**\n * Inject custom React elements into the slot when it's rendered.\n */\n render?(slot: Slot): ReactNode;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'> & HTMLAttributes<HTMLDivElement>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n *\n * @warning Make sure to wrap your `setup` function in a `useCallback` as it can trigger an infinite loop if it's not\n * memoized.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode,\n type,\n setup,\n parameters,\n format,\n id,\n render,\n placeholder,\n style,\n ...props\n}: AdheseSlotProps): ReactNode {\n const reactId = useId().replaceAll(':', '');\n const componentId = id ?? `slot-${reactId}`;\n\n const slotState = useAdheseSlot(componentId, {\n width,\n height,\n lazyLoading,\n lazyLoadingOptions,\n slot,\n pluginOptions,\n renderMode: render ? 'none' : renderMode,\n type,\n parameters,\n format,\n setup: useCallback(((context, hooks): void => {\n setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n }) satisfies AdheseSlotOptions['setup'], [setup, onChange]),\n });\n\n const { status, name, format: slotFormat } = slotState ?? {};\n\n if (['error', 'empty'].includes(status ?? '')) {\n return null;\n }\n\n return (\n <div\n data-name={name}\n data-status={status}\n data-format={slotFormat}\n data-slot={slot}\n id={componentId}\n style={{\n width,\n height,\n ...style,\n }}\n {...props}\n >\n {slotState?.data ? render?.(slotState) : placeholder}\n </div>\n );\n}\n"],"names":["useId","useAdheseSlot","useCallback","watch","jsx"],"mappings":";;;;;;AA8BO,SAAS,WAAW;A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|
4
|
-
"version": "1.3.2
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"description": "Adhese SDK",
|
|
6
6
|
"license": "GPL-3.0",
|
|
7
7
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"react-dom": ">=16.13"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@adhese/sdk": "1.3.2
|
|
48
|
+
"@adhese/sdk": "1.3.2",
|
|
49
49
|
"@adhese/sdk-shared": "1.2.0"
|
|
50
50
|
}
|
|
51
51
|
}
|