@weaverse/react 0.7.71 → 1.0.1
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/dist/index.js +27 -18
- package/dist/index.mjs +27 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1928,7 +1928,7 @@ function initUploadCareAdaptiveDelivery(baseUrl) {
|
|
|
1928
1928
|
// src/context.ts
|
|
1929
1929
|
var createRootContext = (configs) => {
|
|
1930
1930
|
let rootContext = new import_core2.Weaverse(configs);
|
|
1931
|
-
initUploadCareAdaptiveDelivery(configs.
|
|
1931
|
+
initUploadCareAdaptiveDelivery(configs.weaverseHost);
|
|
1932
1932
|
Object.keys(Elements).forEach((key) => {
|
|
1933
1933
|
rootContext.registerElement(Elements[key]);
|
|
1934
1934
|
});
|
|
@@ -2198,7 +2198,7 @@ var SliderComponents = {
|
|
|
2198
2198
|
var import_core3 = require("@weaverse/core");
|
|
2199
2199
|
var import_react38 = __toESM(require("react"));
|
|
2200
2200
|
var WeaverseRoot = ({ context }) => {
|
|
2201
|
-
let [, setData] = (0, import_react38.useState)(context.
|
|
2201
|
+
let [, setData] = (0, import_react38.useState)(context.data);
|
|
2202
2202
|
let rootRef = (0, import_react38.useRef)();
|
|
2203
2203
|
let renderRoot = () => setData({});
|
|
2204
2204
|
(0, import_react38.useEffect)(() => {
|
|
@@ -2210,7 +2210,7 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2210
2210
|
}, []);
|
|
2211
2211
|
let eventHandlers = context?.studioBridge?.eventHandlers || {};
|
|
2212
2212
|
let themeClass = context.stitchesInstance.theme.className;
|
|
2213
|
-
if (context.
|
|
2213
|
+
if (context.data?.rootId) {
|
|
2214
2214
|
return /* @__PURE__ */ import_react38.default.createElement(
|
|
2215
2215
|
"div",
|
|
2216
2216
|
{
|
|
@@ -2218,7 +2218,8 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2218
2218
|
...eventHandlers,
|
|
2219
2219
|
ref: rootRef
|
|
2220
2220
|
},
|
|
2221
|
-
/* @__PURE__ */ import_react38.default.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { id: context.
|
|
2221
|
+
/* @__PURE__ */ import_react38.default.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { id: context.data.rootId })),
|
|
2222
|
+
context.platformType === "react-ssr" ? /* @__PURE__ */ import_react38.default.createElement(StitchesSSR, { stitchesInstance: context.stitchesInstance }) : null
|
|
2222
2223
|
);
|
|
2223
2224
|
}
|
|
2224
2225
|
return null;
|
|
@@ -2243,25 +2244,33 @@ var ItemComponent = ({ instance }) => {
|
|
|
2243
2244
|
if (Component.$$typeof === Symbol.for("react.forward_ref")) {
|
|
2244
2245
|
rest.ref = instance.ref;
|
|
2245
2246
|
}
|
|
2246
|
-
return (
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
childIds.map((id2) => /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { key: id2, id: id2 }))
|
|
2258
|
-
)
|
|
2259
|
-
);
|
|
2247
|
+
return /* @__PURE__ */ import_react38.default.createElement(import_react38.default.Fragment, null, /* @__PURE__ */ import_react38.default.createElement(
|
|
2248
|
+
Component,
|
|
2249
|
+
{
|
|
2250
|
+
key: id,
|
|
2251
|
+
"data-wv-type": type,
|
|
2252
|
+
"data-wv-id": id,
|
|
2253
|
+
className: generateItemClassName(instance, stitchesInstance),
|
|
2254
|
+
...rest
|
|
2255
|
+
},
|
|
2256
|
+
childIds.map((id2) => /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { key: id2, id: id2 }))
|
|
2257
|
+
));
|
|
2260
2258
|
} else {
|
|
2261
2259
|
console.log(`Unknown element: ${type}`);
|
|
2262
2260
|
return null;
|
|
2263
2261
|
}
|
|
2264
2262
|
};
|
|
2263
|
+
var StitchesSSR = ({ stitchesInstance }) => {
|
|
2264
|
+
const stitchesCss2 = stitchesInstance.getCssText();
|
|
2265
|
+
return /* @__PURE__ */ import_react38.default.createElement(
|
|
2266
|
+
"style",
|
|
2267
|
+
{
|
|
2268
|
+
"data-style": "weaverse-stitches",
|
|
2269
|
+
dangerouslySetInnerHTML: { __html: stitchesCss2 },
|
|
2270
|
+
suppressHydrationWarning: true
|
|
2271
|
+
}
|
|
2272
|
+
);
|
|
2273
|
+
};
|
|
2265
2274
|
var ItemInstance = ({ id }) => {
|
|
2266
2275
|
let context = (0, import_react38.useContext)(WeaverseContext);
|
|
2267
2276
|
let { itemInstances } = context;
|
package/dist/index.mjs
CHANGED
|
@@ -1892,7 +1892,7 @@ function initUploadCareAdaptiveDelivery(baseUrl) {
|
|
|
1892
1892
|
// src/context.ts
|
|
1893
1893
|
var createRootContext = (configs) => {
|
|
1894
1894
|
let rootContext = new Weaverse(configs);
|
|
1895
|
-
initUploadCareAdaptiveDelivery(configs.
|
|
1895
|
+
initUploadCareAdaptiveDelivery(configs.weaverseHost);
|
|
1896
1896
|
Object.keys(Elements).forEach((key) => {
|
|
1897
1897
|
rootContext.registerElement(Elements[key]);
|
|
1898
1898
|
});
|
|
@@ -2162,7 +2162,7 @@ var SliderComponents = {
|
|
|
2162
2162
|
import { isBrowser as isBrowser2 } from "@weaverse/core";
|
|
2163
2163
|
import React29, { useContext as useContext6, useEffect as useEffect4, useRef, useState as useState3 } from "react";
|
|
2164
2164
|
var WeaverseRoot = ({ context }) => {
|
|
2165
|
-
let [, setData] = useState3(context.
|
|
2165
|
+
let [, setData] = useState3(context.data);
|
|
2166
2166
|
let rootRef = useRef();
|
|
2167
2167
|
let renderRoot = () => setData({});
|
|
2168
2168
|
useEffect4(() => {
|
|
@@ -2174,7 +2174,7 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2174
2174
|
}, []);
|
|
2175
2175
|
let eventHandlers = context?.studioBridge?.eventHandlers || {};
|
|
2176
2176
|
let themeClass = context.stitchesInstance.theme.className;
|
|
2177
|
-
if (context.
|
|
2177
|
+
if (context.data?.rootId) {
|
|
2178
2178
|
return /* @__PURE__ */ React29.createElement(
|
|
2179
2179
|
"div",
|
|
2180
2180
|
{
|
|
@@ -2182,7 +2182,8 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2182
2182
|
...eventHandlers,
|
|
2183
2183
|
ref: rootRef
|
|
2184
2184
|
},
|
|
2185
|
-
/* @__PURE__ */ React29.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ React29.createElement(ItemInstance, { id: context.
|
|
2185
|
+
/* @__PURE__ */ React29.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ React29.createElement(ItemInstance, { id: context.data.rootId })),
|
|
2186
|
+
context.platformType === "react-ssr" ? /* @__PURE__ */ React29.createElement(StitchesSSR, { stitchesInstance: context.stitchesInstance }) : null
|
|
2186
2187
|
);
|
|
2187
2188
|
}
|
|
2188
2189
|
return null;
|
|
@@ -2207,25 +2208,33 @@ var ItemComponent = ({ instance }) => {
|
|
|
2207
2208
|
if (Component.$$typeof === Symbol.for("react.forward_ref")) {
|
|
2208
2209
|
rest.ref = instance.ref;
|
|
2209
2210
|
}
|
|
2210
|
-
return (
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
childIds.map((id2) => /* @__PURE__ */ React29.createElement(ItemInstance, { key: id2, id: id2 }))
|
|
2222
|
-
)
|
|
2223
|
-
);
|
|
2211
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
2212
|
+
Component,
|
|
2213
|
+
{
|
|
2214
|
+
key: id,
|
|
2215
|
+
"data-wv-type": type,
|
|
2216
|
+
"data-wv-id": id,
|
|
2217
|
+
className: generateItemClassName(instance, stitchesInstance),
|
|
2218
|
+
...rest
|
|
2219
|
+
},
|
|
2220
|
+
childIds.map((id2) => /* @__PURE__ */ React29.createElement(ItemInstance, { key: id2, id: id2 }))
|
|
2221
|
+
));
|
|
2224
2222
|
} else {
|
|
2225
2223
|
console.log(`Unknown element: ${type}`);
|
|
2226
2224
|
return null;
|
|
2227
2225
|
}
|
|
2228
2226
|
};
|
|
2227
|
+
var StitchesSSR = ({ stitchesInstance }) => {
|
|
2228
|
+
const stitchesCss2 = stitchesInstance.getCssText();
|
|
2229
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2230
|
+
"style",
|
|
2231
|
+
{
|
|
2232
|
+
"data-style": "weaverse-stitches",
|
|
2233
|
+
dangerouslySetInnerHTML: { __html: stitchesCss2 },
|
|
2234
|
+
suppressHydrationWarning: true
|
|
2235
|
+
}
|
|
2236
|
+
);
|
|
2237
|
+
};
|
|
2229
2238
|
var ItemInstance = ({ id }) => {
|
|
2230
2239
|
let context = useContext6(WeaverseContext);
|
|
2231
2240
|
let { itemInstances } = context;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "1.0.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@radix-ui/react-dialog": "^1.0.2",
|
|
36
36
|
"@stitches/react": "^1.2.8",
|
|
37
|
-
"@weaverse/core": "0.
|
|
37
|
+
"@weaverse/core": "1.0.1",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"keen-slider": "^6.8.5"
|
|
40
40
|
}
|