@weaverse/react 0.7.21 → 0.7.22

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.d.ts CHANGED
@@ -63,6 +63,11 @@ interface BackgroundDataProps {
63
63
  interface LayoutElementProps extends BackgroundDataProps, GridContentElementProps {
64
64
  gridSize: number;
65
65
  }
66
+ interface LayoutBackgroundProps {
67
+ imgUrl?: string;
68
+ bgColor?: string;
69
+ objectFit?: CSSProperties['objectFit'];
70
+ }
66
71
  interface MapElementProps extends WeaverseElementProps {
67
72
  place: string;
68
73
  zoom: number;
@@ -112,4 +117,4 @@ declare type InstagramMedia = {
112
117
 
113
118
  declare let WeaverseRoot: ({ context }: WeaverseRootPropsType) => JSX.Element | null;
114
119
 
115
- export { ButtonElementProps, ContainerElementProps, CountdownElementProps, CountdownTimeKey, CountdownTimerType, Elements, GridContentElementProps, ImageElementProps, InstagramElementProps, InstagramMedia, ItemComponentProps, LayoutElementProps, MapElementProps, PlaceholderProps, SharedComponents, TextElementProps, TimerBlockProps, VideoElementProps, WeaverseContext, WeaverseContextConsumer, WeaverseContextProvider, WeaverseElementProps, WeaverseRoot, WeaverseRootPropsType, createRootContext };
120
+ export { ButtonElementProps, ContainerElementProps, CountdownElementProps, CountdownTimeKey, CountdownTimerType, Elements, GridContentElementProps, ImageElementProps, InstagramElementProps, InstagramMedia, ItemComponentProps, LayoutBackgroundProps, LayoutElementProps, MapElementProps, PlaceholderProps, SharedComponents, TextElementProps, TimerBlockProps, VideoElementProps, WeaverseContext, WeaverseContextConsumer, WeaverseContextProvider, WeaverseElementProps, WeaverseRoot, WeaverseRootPropsType, createRootContext };
package/dist/index.js CHANGED
@@ -681,11 +681,10 @@ function shortCssObject(css10) {
681
681
  }
682
682
  var permanentClasses = {};
683
683
  function generateItemClass(instance, stitchesInstance) {
684
- var _a, _b;
685
684
  let { css: css10, type, className: cls = "" } = instance.data;
686
685
  let className = "";
687
686
  let permanentClass = "";
688
- let perCss = (_a = instance.Element) == null ? void 0 : _a.permanentCss;
687
+ let perCss = instance.Element?.permanentCss;
689
688
  if (perCss) {
690
689
  if (type in permanentClasses) {
691
690
  permanentClass = permanentClasses[type];
@@ -700,7 +699,7 @@ function generateItemClass(instance, stitchesInstance) {
700
699
  let formattedCss = shortCssObject(css10);
701
700
  let { className: newClass = "" } = stitchesInstance.css(formattedCss)();
702
701
  let { stitchesClass } = instance;
703
- let otherClass = (((_b = instance.ref.current) == null ? void 0 : _b.className) || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
702
+ let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
704
703
  className = `${permanentClass} ${cls} ${newClass} ${otherClass}`.trim();
705
704
  instance.stitchesClass = newClass;
706
705
  }
@@ -709,7 +708,6 @@ function generateItemClass(instance, stitchesInstance) {
709
708
 
710
709
  // src/renderer.tsx
711
710
  var WeaverseRoot = ({ context }) => {
712
- var _a, _b;
713
711
  let [, setData] = (0, import_react12.useState)(context.projectData);
714
712
  let rootRef = (0, import_react12.useRef)();
715
713
  let renderRoot = () => setData({});
@@ -720,9 +718,9 @@ var WeaverseRoot = ({ context }) => {
720
718
  context.unsubscribe(renderRoot);
721
719
  };
722
720
  }, []);
723
- let eventHandlers = ((_a = context == null ? void 0 : context.studioBridge) == null ? void 0 : _a.eventHandlers) || {};
721
+ let eventHandlers = context?.studioBridge?.eventHandlers || {};
724
722
  let themeClass = context.stitchesInstance.theme.className;
725
- if ((_b = context.projectData) == null ? void 0 : _b.rootId) {
723
+ if (context.projectData?.rootId) {
726
724
  return /* @__PURE__ */ import_react12.default.createElement("div", {
727
725
  className: `weaverse-content-root ${themeClass}`,
728
726
  ...eventHandlers,
@@ -750,7 +748,7 @@ var ItemComponent = ({ instance }) => {
750
748
  return () => instance.unsubscribe(render);
751
749
  }, []);
752
750
  let Element = elementInstances.get(type);
753
- if (Element == null ? void 0 : Element.Component) {
751
+ if (Element?.Component) {
754
752
  let Component = Element.Component;
755
753
  if (Component.$$typeof === Symbol.for("react.forward_ref")) {
756
754
  rest.ref = instance.ref;
package/dist/index.mjs CHANGED
@@ -642,11 +642,10 @@ function shortCssObject(css10) {
642
642
  }
643
643
  var permanentClasses = {};
644
644
  function generateItemClass(instance, stitchesInstance) {
645
- var _a, _b;
646
645
  let { css: css10, type, className: cls = "" } = instance.data;
647
646
  let className = "";
648
647
  let permanentClass = "";
649
- let perCss = (_a = instance.Element) == null ? void 0 : _a.permanentCss;
648
+ let perCss = instance.Element?.permanentCss;
650
649
  if (perCss) {
651
650
  if (type in permanentClasses) {
652
651
  permanentClass = permanentClasses[type];
@@ -661,7 +660,7 @@ function generateItemClass(instance, stitchesInstance) {
661
660
  let formattedCss = shortCssObject(css10);
662
661
  let { className: newClass = "" } = stitchesInstance.css(formattedCss)();
663
662
  let { stitchesClass } = instance;
664
- let otherClass = (((_b = instance.ref.current) == null ? void 0 : _b.className) || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
663
+ let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
665
664
  className = `${permanentClass} ${cls} ${newClass} ${otherClass}`.trim();
666
665
  instance.stitchesClass = newClass;
667
666
  }
@@ -670,7 +669,6 @@ function generateItemClass(instance, stitchesInstance) {
670
669
 
671
670
  // src/renderer.tsx
672
671
  var WeaverseRoot = ({ context }) => {
673
- var _a, _b;
674
672
  let [, setData] = useState2(context.projectData);
675
673
  let rootRef = useRef();
676
674
  let renderRoot = () => setData({});
@@ -681,9 +679,9 @@ var WeaverseRoot = ({ context }) => {
681
679
  context.unsubscribe(renderRoot);
682
680
  };
683
681
  }, []);
684
- let eventHandlers = ((_a = context == null ? void 0 : context.studioBridge) == null ? void 0 : _a.eventHandlers) || {};
682
+ let eventHandlers = context?.studioBridge?.eventHandlers || {};
685
683
  let themeClass = context.stitchesInstance.theme.className;
686
- if ((_b = context.projectData) == null ? void 0 : _b.rootId) {
684
+ if (context.projectData?.rootId) {
687
685
  return /* @__PURE__ */ React12.createElement("div", {
688
686
  className: `weaverse-content-root ${themeClass}`,
689
687
  ...eventHandlers,
@@ -711,7 +709,7 @@ var ItemComponent = ({ instance }) => {
711
709
  return () => instance.unsubscribe(render);
712
710
  }, []);
713
711
  let Element = elementInstances.get(type);
714
- if (Element == null ? void 0 : Element.Component) {
712
+ if (Element?.Component) {
715
713
  let Component = Element.Component;
716
714
  if (Component.$$typeof === Symbol.for("react.forward_ref")) {
717
715
  rest.ref = instance.ref;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.21",
2
+ "version": "0.7.22",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "name": "@weaverse/react",
32
32
  "author": "Weaverse Team",
33
33
  "dependencies": {
34
- "@weaverse/core": "0.7.21",
34
+ "@weaverse/core": "0.7.22",
35
35
  "nuka-carousel": "^5.4.0"
36
36
  }
37
37
  }