auto-component 0.0.25 → 0.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-component",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "main": "src/index.jsx",
5
5
  "peerDependencies": {
6
6
  "react": "^18.2.0",
@@ -19,7 +19,8 @@
19
19
  height: 40px;
20
20
  border-radius: 5px;
21
21
  color: #444;
22
- font-size: 20px;
22
+ font-size: 20px;background: #eee;
23
+ border: 3px solid #ddd;
23
24
  padding-left: 10px;
24
25
  }
25
26
  #content-creator button {
@@ -50,16 +51,19 @@
50
51
  .tab {
51
52
  margin: 0 10%;
52
53
  background: #444;
54
+ color: #aaa;
53
55
  border-radius: 5px 5px 0 0;
54
56
  cursor: pointer;
55
57
  }
56
58
  .tab:hover {
57
59
  background: #666;
60
+ color: #eee;
58
61
  }
59
62
  .selected {
60
-
61
- background: #888;
62
- color: #111;
63
+ background: #c6c7d3;
64
+ color: #fff;
65
+ font-size: 1.2rem;
66
+ pointer-events: none;
63
67
  }
64
68
  #content-creator pre {
65
69
  position: relative;
@@ -67,13 +71,14 @@
67
71
  max-width: 90%;
68
72
  min-width: 90%;
69
73
  max-height: 60vh;
70
- background: #aaa;
74
+ background: #cdd1d9;
71
75
  color: #111;
72
76
  padding: 40px 10px 40px 10px;
73
77
  overflow: auto;
74
78
  border: 2px solid black;
75
79
  border-radius: 10px;
76
80
  box-shadow: 0px 0px 5px #fff;
81
+ white-space: pre-wrap;
77
82
  }
78
83
  .copy-btn {
79
84
  position: absolute;
package/src/index.jsx CHANGED
@@ -125,7 +125,8 @@ const AutoComponent = ({ exclusions }) => {
125
125
  const resData = await sendRequest();
126
126
 
127
127
  if (resData) {
128
- setResponseData(formatHtml(resData.response.content));
128
+ // setResponseData(formatHtml(resData.response.content));
129
+ setResponseData(resData.response.content);
129
130
  setActiveTab('response');
130
131
  }
131
132
  } catch (err) {
@@ -171,7 +172,8 @@ const AutoComponent = ({ exclusions }) => {
171
172
  }
172
173
 
173
174
  const copyToClipboard = async () => {
174
- const text = activeTab
175
+ const text = activeTab === 'response' ? responseData : ''
176
+
175
177
  await navigator.clipboard.writeText(text)
176
178
  }
177
179
 
@@ -180,15 +182,15 @@ const AutoComponent = ({ exclusions }) => {
180
182
  //**-------------**/
181
183
 
182
184
  const requestHTML = currentHtml ? (
183
- `Review the details below for accuracy and privacy concerns.
184
- If the contents of an element should be excluded, add the 'exclude' class to the element.
185
- Click Generate to send the request and receive the auto component AI generated code.
186
-
187
- User Request:\n `
188
- + currentRequest
189
- + "\n\nUser HTML:\n"
190
- + currentHtml
191
- ) : 'There was an error collecting your HTML. Ensure no top level elements are assigned the class "exclude"'
185
+ `Review the details below for accuracy and privacy concerns.
186
+ If the contents of an element should be excluded, add the 'exclude' class to the element.
187
+ Click Generate to send the request and receive the auto component AI generated code.
188
+
189
+ User Request:\n `
190
+ + currentRequest
191
+ + "\n\nUser HTML:\n"
192
+ + currentHtml
193
+ ) : 'There was an error collecting your HTML. Ensure no top level elements are assigned the class "exclude"'
192
194
 
193
195
  const responseHtml = responseData ? (
194
196
  responseData
@@ -217,7 +219,7 @@ const AutoComponent = ({ exclusions }) => {
217
219
  {activeTab === 'request' ? requestHTML : responseHtml}
218
220
  </pre>
219
221
  </div>
220
- <div className="copy-btn">
222
+ <div className="copy-btn" onClick={copyToClipboard}>
221
223
  copy
222
224
  </div>
223
225
  </div>