@weaverse/react 0.7.69 → 0.7.71
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 +35 -4
- package/dist/index.mjs +33 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
44
44
|
__reExport(src_exports, require("@weaverse/core"), module.exports);
|
|
45
45
|
|
|
46
46
|
// src/context.ts
|
|
47
|
-
var
|
|
47
|
+
var import_core2 = require("@weaverse/core");
|
|
48
48
|
var import_react30 = require("react");
|
|
49
49
|
|
|
50
50
|
// src/elements/button.tsx
|
|
@@ -1895,9 +1895,40 @@ var Elements = {
|
|
|
1895
1895
|
}
|
|
1896
1896
|
};
|
|
1897
1897
|
|
|
1898
|
+
// src/utils/uploadcare.ts
|
|
1899
|
+
var import_core = require("@weaverse/core");
|
|
1900
|
+
function initUploadCareAdaptiveDelivery(baseUrl) {
|
|
1901
|
+
try {
|
|
1902
|
+
Promise.resolve().then(() => {
|
|
1903
|
+
if (import_core.isBrowser && !window.Blinkloader) {
|
|
1904
|
+
;
|
|
1905
|
+
(function(src, cb) {
|
|
1906
|
+
let s = document.createElement("script");
|
|
1907
|
+
s.setAttribute("src", src);
|
|
1908
|
+
s.onload = cb;
|
|
1909
|
+
(document.head || document.body).appendChild(s);
|
|
1910
|
+
})(baseUrl + "/static/blinkloader.min.js", function() {
|
|
1911
|
+
window.Blinkloader.optimize({
|
|
1912
|
+
pubkey: "1a22133d1a1bdc089d4c",
|
|
1913
|
+
fadeIn: true,
|
|
1914
|
+
lazyload: true,
|
|
1915
|
+
smartCompression: true,
|
|
1916
|
+
responsive: true,
|
|
1917
|
+
retina: true,
|
|
1918
|
+
webp: true
|
|
1919
|
+
});
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
});
|
|
1923
|
+
} catch (e) {
|
|
1924
|
+
console.error(e);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1898
1928
|
// src/context.ts
|
|
1899
1929
|
var createRootContext = (configs) => {
|
|
1900
|
-
let rootContext = new
|
|
1930
|
+
let rootContext = new import_core2.Weaverse(configs);
|
|
1931
|
+
initUploadCareAdaptiveDelivery(configs.appUrl);
|
|
1901
1932
|
Object.keys(Elements).forEach((key) => {
|
|
1902
1933
|
rootContext.registerElement(Elements[key]);
|
|
1903
1934
|
});
|
|
@@ -2164,7 +2195,7 @@ var SliderComponents = {
|
|
|
2164
2195
|
};
|
|
2165
2196
|
|
|
2166
2197
|
// src/renderer.tsx
|
|
2167
|
-
var
|
|
2198
|
+
var import_core3 = require("@weaverse/core");
|
|
2168
2199
|
var import_react38 = __toESM(require("react"));
|
|
2169
2200
|
var WeaverseRoot = ({ context }) => {
|
|
2170
2201
|
let [, setData] = (0, import_react38.useState)(context.projectData);
|
|
@@ -2199,7 +2230,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
2199
2230
|
(0, import_react38.useEffect)(() => {
|
|
2200
2231
|
let render = (data2) => setData({ ...data2 });
|
|
2201
2232
|
instance.subscribe(render);
|
|
2202
|
-
if (
|
|
2233
|
+
if (import_core3.isBrowser && !instance.ref.current) {
|
|
2203
2234
|
Object.assign(instance.ref, {
|
|
2204
2235
|
current: document.querySelector(`[data-wv-id="${id}"]`)
|
|
2205
2236
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1859,9 +1859,40 @@ var Elements = {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
};
|
|
1861
1861
|
|
|
1862
|
+
// src/utils/uploadcare.ts
|
|
1863
|
+
import { isBrowser } from "@weaverse/core";
|
|
1864
|
+
function initUploadCareAdaptiveDelivery(baseUrl) {
|
|
1865
|
+
try {
|
|
1866
|
+
Promise.resolve().then(() => {
|
|
1867
|
+
if (isBrowser && !window.Blinkloader) {
|
|
1868
|
+
;
|
|
1869
|
+
(function(src, cb) {
|
|
1870
|
+
let s = document.createElement("script");
|
|
1871
|
+
s.setAttribute("src", src);
|
|
1872
|
+
s.onload = cb;
|
|
1873
|
+
(document.head || document.body).appendChild(s);
|
|
1874
|
+
})(baseUrl + "/static/blinkloader.min.js", function() {
|
|
1875
|
+
window.Blinkloader.optimize({
|
|
1876
|
+
pubkey: "1a22133d1a1bdc089d4c",
|
|
1877
|
+
fadeIn: true,
|
|
1878
|
+
lazyload: true,
|
|
1879
|
+
smartCompression: true,
|
|
1880
|
+
responsive: true,
|
|
1881
|
+
retina: true,
|
|
1882
|
+
webp: true
|
|
1883
|
+
});
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
});
|
|
1887
|
+
} catch (e) {
|
|
1888
|
+
console.error(e);
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1862
1892
|
// src/context.ts
|
|
1863
1893
|
var createRootContext = (configs) => {
|
|
1864
1894
|
let rootContext = new Weaverse(configs);
|
|
1895
|
+
initUploadCareAdaptiveDelivery(configs.appUrl);
|
|
1865
1896
|
Object.keys(Elements).forEach((key) => {
|
|
1866
1897
|
rootContext.registerElement(Elements[key]);
|
|
1867
1898
|
});
|
|
@@ -2128,7 +2159,7 @@ var SliderComponents = {
|
|
|
2128
2159
|
};
|
|
2129
2160
|
|
|
2130
2161
|
// src/renderer.tsx
|
|
2131
|
-
import { isBrowser } from "@weaverse/core";
|
|
2162
|
+
import { isBrowser as isBrowser2 } from "@weaverse/core";
|
|
2132
2163
|
import React29, { useContext as useContext6, useEffect as useEffect4, useRef, useState as useState3 } from "react";
|
|
2133
2164
|
var WeaverseRoot = ({ context }) => {
|
|
2134
2165
|
let [, setData] = useState3(context.projectData);
|
|
@@ -2163,7 +2194,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
2163
2194
|
useEffect4(() => {
|
|
2164
2195
|
let render = (data2) => setData({ ...data2 });
|
|
2165
2196
|
instance.subscribe(render);
|
|
2166
|
-
if (
|
|
2197
|
+
if (isBrowser2 && !instance.ref.current) {
|
|
2167
2198
|
Object.assign(instance.ref, {
|
|
2168
2199
|
current: document.querySelector(`[data-wv-id="${id}"]`)
|
|
2169
2200
|
});
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.
|
|
2
|
+
"version": "0.7.71",
|
|
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.7.
|
|
37
|
+
"@weaverse/core": "0.7.71",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"keen-slider": "^6.8.5"
|
|
40
40
|
}
|