@weaverse/react 0.3.7 → 0.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.
package/dist/index.js CHANGED
@@ -77,9 +77,11 @@ var base_default = BaseElement;
77
77
  // src/elements/button.tsx
78
78
  var React2 = __toESM(require("react"));
79
79
  var Button = React2.forwardRef((props, ref) => {
80
+ const _a = props, { style } = _a, rest = __objRest(_a, ["style"]);
80
81
  return /* @__PURE__ */ React2.createElement("button", __spreadValues({
81
- ref
82
- }, props), props.value);
82
+ ref,
83
+ style
84
+ }, rest), props.value);
83
85
  });
84
86
  Button.defaultProps = {
85
87
  value: "Click me",
@@ -93,6 +95,28 @@ var schema2 = {
93
95
  title: "Button",
94
96
  type: "button",
95
97
  settings: [
98
+ {
99
+ tab: "Settings",
100
+ label: "Alignment",
101
+ inspectors: [
102
+ {
103
+ binding: "style",
104
+ type: "alignment"
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ tab: "Settings",
110
+ label: "Overlay",
111
+ inspectors: [
112
+ {
113
+ binding: "data",
114
+ key: "applyOverlay",
115
+ label: "Apply Overlay",
116
+ type: "switch"
117
+ }
118
+ ]
119
+ },
96
120
  {
97
121
  tab: "Settings",
98
122
  label: "Group 1",
@@ -100,12 +124,14 @@ var schema2 = {
100
124
  {
101
125
  binding: "data",
102
126
  key: "value",
103
- componentType: "textarea"
127
+ type: "textarea",
128
+ label: "",
129
+ default: ""
104
130
  },
105
131
  {
106
132
  binding: "style",
107
133
  key: "backgroundColor",
108
- componentType: "color"
134
+ type: "color"
109
135
  }
110
136
  ]
111
137
  },
@@ -116,11 +142,12 @@ var schema2 = {
116
142
  {
117
143
  binding: "style",
118
144
  key: "color",
119
- componentType: "color"
145
+ type: "color"
120
146
  }
121
147
  ]
122
148
  }
123
- ]
149
+ ],
150
+ toolbar: []
124
151
  };
125
152
  var button_default = Button;
126
153
 
@@ -173,6 +200,15 @@ var elements = {
173
200
  };
174
201
  var elements_default = elements;
175
202
 
203
+ // src/utils/css.ts
204
+ var shortCssObject = (css) => {
205
+ return {
206
+ "@desktop": css[`@desktop`],
207
+ "@tablet": css[`@tablet`],
208
+ "@mobile": css[`@mobile`]
209
+ };
210
+ };
211
+
176
212
  // src/renderer.tsx
177
213
  var import_core = require("@weaverse/core");
178
214
  var React4 = __toESM(require("react"));
@@ -231,7 +267,8 @@ var Item = ({ itemInstance, elementInstances, context }) => {
231
267
  }, []);
232
268
  let realClassName = className;
233
269
  if (css) {
234
- let selector = context.stitchesInstance.css(css)().className;
270
+ let formattedCss = shortCssObject(css);
271
+ let selector = context.stitchesInstance.css(formattedCss)().className;
235
272
  realClassName = realClassName ? `${selector} ${realClassName}` : selector;
236
273
  }
237
274
  let element = elementInstances.get(type) || elementInstances.get("base");
package/dist/index.mjs CHANGED
@@ -50,9 +50,11 @@ var base_default = BaseElement;
50
50
  // src/elements/button.tsx
51
51
  import * as React2 from "react";
52
52
  var Button = React2.forwardRef((props, ref) => {
53
+ const _a = props, { style } = _a, rest = __objRest(_a, ["style"]);
53
54
  return /* @__PURE__ */ React2.createElement("button", __spreadValues({
54
- ref
55
- }, props), props.value);
55
+ ref,
56
+ style
57
+ }, rest), props.value);
56
58
  });
57
59
  Button.defaultProps = {
58
60
  value: "Click me",
@@ -66,6 +68,28 @@ var schema2 = {
66
68
  title: "Button",
67
69
  type: "button",
68
70
  settings: [
71
+ {
72
+ tab: "Settings",
73
+ label: "Alignment",
74
+ inspectors: [
75
+ {
76
+ binding: "style",
77
+ type: "alignment"
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ tab: "Settings",
83
+ label: "Overlay",
84
+ inspectors: [
85
+ {
86
+ binding: "data",
87
+ key: "applyOverlay",
88
+ label: "Apply Overlay",
89
+ type: "switch"
90
+ }
91
+ ]
92
+ },
69
93
  {
70
94
  tab: "Settings",
71
95
  label: "Group 1",
@@ -73,12 +97,14 @@ var schema2 = {
73
97
  {
74
98
  binding: "data",
75
99
  key: "value",
76
- componentType: "textarea"
100
+ type: "textarea",
101
+ label: "",
102
+ default: ""
77
103
  },
78
104
  {
79
105
  binding: "style",
80
106
  key: "backgroundColor",
81
- componentType: "color"
107
+ type: "color"
82
108
  }
83
109
  ]
84
110
  },
@@ -89,11 +115,12 @@ var schema2 = {
89
115
  {
90
116
  binding: "style",
91
117
  key: "color",
92
- componentType: "color"
118
+ type: "color"
93
119
  }
94
120
  ]
95
121
  }
96
- ]
122
+ ],
123
+ toolbar: []
97
124
  };
98
125
  var button_default = Button;
99
126
 
@@ -146,6 +173,15 @@ var elements = {
146
173
  };
147
174
  var elements_default = elements;
148
175
 
176
+ // src/utils/css.ts
177
+ var shortCssObject = (css) => {
178
+ return {
179
+ "@desktop": css[`@desktop`],
180
+ "@tablet": css[`@tablet`],
181
+ "@mobile": css[`@mobile`]
182
+ };
183
+ };
184
+
149
185
  // src/renderer.tsx
150
186
  import {
151
187
  isBrowser,
@@ -207,7 +243,8 @@ var Item = ({ itemInstance, elementInstances, context }) => {
207
243
  }, []);
208
244
  let realClassName = className;
209
245
  if (css) {
210
- let selector = context.stitchesInstance.css(css)().className;
246
+ let formattedCss = shortCssObject(css);
247
+ let selector = context.stitchesInstance.css(formattedCss)().className;
211
248
  realClassName = realClassName ? `${selector} ${realClassName}` : selector;
212
249
  }
213
250
  let element = elementInstances.get(type) || elementInstances.get("base");
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.7",
2
+ "version": "0.4.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -31,6 +31,6 @@
31
31
  "name": "@weaverse/react",
32
32
  "author": "Weaverse Team",
33
33
  "dependencies": {
34
- "@weaverse/core": "^0.3.6"
34
+ "@weaverse/core": "^0.4.0"
35
35
  }
36
36
  }