styllar-react-plugin 1.0.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/README.md +8 -0
- package/dist/styllar-react-plugin.js +784 -0
- package/dist/styllar-react-plugin.umd.cjs +30 -0
- package/dist/vite.svg +1 -0
- package/eslint.config.js +38 -0
- package/index.html +13 -0
- package/package.json +38 -0
- package/postcss.config.js +6 -0
- package/public/vite.svg +1 -0
- package/src/StyllarPlugin.jsx +214 -0
- package/src/assets/react.svg +1 -0
- package/src/index.js +1 -0
- package/tailwind.config.js +10 -0
- package/vite.config.js +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# React + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
import $e, { useState as F } from "react";
|
|
2
|
+
var ue = { exports: {} }, B = {};
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
5
|
+
* react-jsx-runtime.production.min.js
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the MIT license found in the
|
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/
|
|
12
|
+
var Ae;
|
|
13
|
+
function fr() {
|
|
14
|
+
if (Ae) return B;
|
|
15
|
+
Ae = 1;
|
|
16
|
+
var $ = $e, O = Symbol.for("react.element"), k = Symbol.for("react.fragment"), y = Object.prototype.hasOwnProperty, W = $.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, L = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function S(w, d, P) {
|
|
18
|
+
var v, E = {}, j = null, Y = null;
|
|
19
|
+
P !== void 0 && (j = "" + P), d.key !== void 0 && (j = "" + d.key), d.ref !== void 0 && (Y = d.ref);
|
|
20
|
+
for (v in d) y.call(d, v) && !L.hasOwnProperty(v) && (E[v] = d[v]);
|
|
21
|
+
if (w && w.defaultProps) for (v in d = w.defaultProps, d) E[v] === void 0 && (E[v] = d[v]);
|
|
22
|
+
return { $$typeof: O, type: w, key: j, ref: Y, props: E, _owner: W.current };
|
|
23
|
+
}
|
|
24
|
+
return B.Fragment = k, B.jsx = S, B.jsxs = S, B;
|
|
25
|
+
}
|
|
26
|
+
var J = {};
|
|
27
|
+
/**
|
|
28
|
+
* @license React
|
|
29
|
+
* react-jsx-runtime.development.js
|
|
30
|
+
*
|
|
31
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the MIT license found in the
|
|
34
|
+
* LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
var Ie;
|
|
37
|
+
function dr() {
|
|
38
|
+
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
+
var $ = $e, O = Symbol.for("react.element"), k = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), w = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), j = Symbol.for("react.lazy"), Y = Symbol.for("react.offscreen"), U = Symbol.iterator, Q = "@@iterator";
|
|
40
|
+
function ee(e) {
|
|
41
|
+
if (e === null || typeof e != "object")
|
|
42
|
+
return null;
|
|
43
|
+
var r = U && e[U] || e[Q];
|
|
44
|
+
return typeof r == "function" ? r : null;
|
|
45
|
+
}
|
|
46
|
+
var N = $.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function p(e) {
|
|
48
|
+
{
|
|
49
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
50
|
+
t[n - 1] = arguments[n];
|
|
51
|
+
re("error", e, t);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function re(e, r, t) {
|
|
55
|
+
{
|
|
56
|
+
var n = N.ReactDebugCurrentFrame, i = n.getStackAddendum();
|
|
57
|
+
i !== "" && (r += "%s", t = t.concat([i]));
|
|
58
|
+
var c = t.map(function(o) {
|
|
59
|
+
return String(o);
|
|
60
|
+
});
|
|
61
|
+
c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var l = !1, x = !1, g = !1, T = !1, C = !1, R;
|
|
65
|
+
R = Symbol.for("react.module.reference");
|
|
66
|
+
function b(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === y || e === L || C || e === W || e === P || e === v || T || e === Y || l || x || g || typeof e == "object" && e !== null && (e.$$typeof === j || e.$$typeof === E || e.$$typeof === S || e.$$typeof === w || e.$$typeof === d || // This needs to include all possible module reference object
|
|
68
|
+
// types supported by any Flight configuration anywhere since
|
|
69
|
+
// we don't know which Flight build this will end up being used
|
|
70
|
+
// with.
|
|
71
|
+
e.$$typeof === R || e.getModuleId !== void 0));
|
|
72
|
+
}
|
|
73
|
+
function K(e, r, t) {
|
|
74
|
+
var n = e.displayName;
|
|
75
|
+
if (n)
|
|
76
|
+
return n;
|
|
77
|
+
var i = r.displayName || r.name || "";
|
|
78
|
+
return i !== "" ? t + "(" + i + ")" : t;
|
|
79
|
+
}
|
|
80
|
+
function fe(e) {
|
|
81
|
+
return e.displayName || "Context";
|
|
82
|
+
}
|
|
83
|
+
function D(e) {
|
|
84
|
+
if (e == null)
|
|
85
|
+
return null;
|
|
86
|
+
if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
|
+
return e.displayName || e.name || null;
|
|
88
|
+
if (typeof e == "string")
|
|
89
|
+
return e;
|
|
90
|
+
switch (e) {
|
|
91
|
+
case y:
|
|
92
|
+
return "Fragment";
|
|
93
|
+
case k:
|
|
94
|
+
return "Portal";
|
|
95
|
+
case L:
|
|
96
|
+
return "Profiler";
|
|
97
|
+
case W:
|
|
98
|
+
return "StrictMode";
|
|
99
|
+
case P:
|
|
100
|
+
return "Suspense";
|
|
101
|
+
case v:
|
|
102
|
+
return "SuspenseList";
|
|
103
|
+
}
|
|
104
|
+
if (typeof e == "object")
|
|
105
|
+
switch (e.$$typeof) {
|
|
106
|
+
case w:
|
|
107
|
+
var r = e;
|
|
108
|
+
return fe(r) + ".Consumer";
|
|
109
|
+
case S:
|
|
110
|
+
var t = e;
|
|
111
|
+
return fe(t._context) + ".Provider";
|
|
112
|
+
case d:
|
|
113
|
+
return K(e, e.render, "ForwardRef");
|
|
114
|
+
case E:
|
|
115
|
+
var n = e.displayName || null;
|
|
116
|
+
return n !== null ? n : D(e.type) || "Memo";
|
|
117
|
+
case j: {
|
|
118
|
+
var i = e, c = i._payload, o = i._init;
|
|
119
|
+
try {
|
|
120
|
+
return D(o(c));
|
|
121
|
+
} catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var A = Object.assign, V = 0, de, ve, pe, ge, he, me, be;
|
|
129
|
+
function ye() {
|
|
130
|
+
}
|
|
131
|
+
ye.__reactDisabledLog = !0;
|
|
132
|
+
function We() {
|
|
133
|
+
{
|
|
134
|
+
if (V === 0) {
|
|
135
|
+
de = console.log, ve = console.info, pe = console.warn, ge = console.error, he = console.group, me = console.groupCollapsed, be = console.groupEnd;
|
|
136
|
+
var e = {
|
|
137
|
+
configurable: !0,
|
|
138
|
+
enumerable: !0,
|
|
139
|
+
value: ye,
|
|
140
|
+
writable: !0
|
|
141
|
+
};
|
|
142
|
+
Object.defineProperties(console, {
|
|
143
|
+
info: e,
|
|
144
|
+
log: e,
|
|
145
|
+
warn: e,
|
|
146
|
+
error: e,
|
|
147
|
+
group: e,
|
|
148
|
+
groupCollapsed: e,
|
|
149
|
+
groupEnd: e
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
V++;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function Le() {
|
|
156
|
+
{
|
|
157
|
+
if (V--, V === 0) {
|
|
158
|
+
var e = {
|
|
159
|
+
configurable: !0,
|
|
160
|
+
enumerable: !0,
|
|
161
|
+
writable: !0
|
|
162
|
+
};
|
|
163
|
+
Object.defineProperties(console, {
|
|
164
|
+
log: A({}, e, {
|
|
165
|
+
value: de
|
|
166
|
+
}),
|
|
167
|
+
info: A({}, e, {
|
|
168
|
+
value: ve
|
|
169
|
+
}),
|
|
170
|
+
warn: A({}, e, {
|
|
171
|
+
value: pe
|
|
172
|
+
}),
|
|
173
|
+
error: A({}, e, {
|
|
174
|
+
value: ge
|
|
175
|
+
}),
|
|
176
|
+
group: A({}, e, {
|
|
177
|
+
value: he
|
|
178
|
+
}),
|
|
179
|
+
groupCollapsed: A({}, e, {
|
|
180
|
+
value: me
|
|
181
|
+
}),
|
|
182
|
+
groupEnd: A({}, e, {
|
|
183
|
+
value: be
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
V < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var te = N.ReactCurrentDispatcher, ne;
|
|
191
|
+
function X(e, r, t) {
|
|
192
|
+
{
|
|
193
|
+
if (ne === void 0)
|
|
194
|
+
try {
|
|
195
|
+
throw Error();
|
|
196
|
+
} catch (i) {
|
|
197
|
+
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
+
ne = n && n[1] || "";
|
|
199
|
+
}
|
|
200
|
+
return `
|
|
201
|
+
` + ne + e;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var ae = !1, G;
|
|
205
|
+
{
|
|
206
|
+
var Ye = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
G = new Ye();
|
|
208
|
+
}
|
|
209
|
+
function xe(e, r) {
|
|
210
|
+
if (!e || ae)
|
|
211
|
+
return "";
|
|
212
|
+
{
|
|
213
|
+
var t = G.get(e);
|
|
214
|
+
if (t !== void 0)
|
|
215
|
+
return t;
|
|
216
|
+
}
|
|
217
|
+
var n;
|
|
218
|
+
ae = !0;
|
|
219
|
+
var i = Error.prepareStackTrace;
|
|
220
|
+
Error.prepareStackTrace = void 0;
|
|
221
|
+
var c;
|
|
222
|
+
c = te.current, te.current = null, We();
|
|
223
|
+
try {
|
|
224
|
+
if (r) {
|
|
225
|
+
var o = function() {
|
|
226
|
+
throw Error();
|
|
227
|
+
};
|
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
229
|
+
set: function() {
|
|
230
|
+
throw Error();
|
|
231
|
+
}
|
|
232
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
+
try {
|
|
234
|
+
Reflect.construct(o, []);
|
|
235
|
+
} catch (m) {
|
|
236
|
+
n = m;
|
|
237
|
+
}
|
|
238
|
+
Reflect.construct(e, [], o);
|
|
239
|
+
} else {
|
|
240
|
+
try {
|
|
241
|
+
o.call();
|
|
242
|
+
} catch (m) {
|
|
243
|
+
n = m;
|
|
244
|
+
}
|
|
245
|
+
e.call(o.prototype);
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
try {
|
|
249
|
+
throw Error();
|
|
250
|
+
} catch (m) {
|
|
251
|
+
n = m;
|
|
252
|
+
}
|
|
253
|
+
e();
|
|
254
|
+
}
|
|
255
|
+
} catch (m) {
|
|
256
|
+
if (m && n && typeof m.stack == "string") {
|
|
257
|
+
for (var a = m.stack.split(`
|
|
258
|
+
`), h = n.stack.split(`
|
|
259
|
+
`), u = a.length - 1, f = h.length - 1; u >= 1 && f >= 0 && a[u] !== h[f]; )
|
|
260
|
+
f--;
|
|
261
|
+
for (; u >= 1 && f >= 0; u--, f--)
|
|
262
|
+
if (a[u] !== h[f]) {
|
|
263
|
+
if (u !== 1 || f !== 1)
|
|
264
|
+
do
|
|
265
|
+
if (u--, f--, f < 0 || a[u] !== h[f]) {
|
|
266
|
+
var _ = `
|
|
267
|
+
` + a[u].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, _), _;
|
|
269
|
+
}
|
|
270
|
+
while (u >= 1 && f >= 0);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} finally {
|
|
275
|
+
ae = !1, te.current = c, Le(), Error.prepareStackTrace = i;
|
|
276
|
+
}
|
|
277
|
+
var M = e ? e.displayName || e.name : "", I = M ? X(M) : "";
|
|
278
|
+
return typeof e == "function" && G.set(e, I), I;
|
|
279
|
+
}
|
|
280
|
+
function ze(e, r, t) {
|
|
281
|
+
return xe(e, !1);
|
|
282
|
+
}
|
|
283
|
+
function Me(e) {
|
|
284
|
+
var r = e.prototype;
|
|
285
|
+
return !!(r && r.isReactComponent);
|
|
286
|
+
}
|
|
287
|
+
function H(e, r, t) {
|
|
288
|
+
if (e == null)
|
|
289
|
+
return "";
|
|
290
|
+
if (typeof e == "function")
|
|
291
|
+
return xe(e, Me(e));
|
|
292
|
+
if (typeof e == "string")
|
|
293
|
+
return X(e);
|
|
294
|
+
switch (e) {
|
|
295
|
+
case P:
|
|
296
|
+
return X("Suspense");
|
|
297
|
+
case v:
|
|
298
|
+
return X("SuspenseList");
|
|
299
|
+
}
|
|
300
|
+
if (typeof e == "object")
|
|
301
|
+
switch (e.$$typeof) {
|
|
302
|
+
case d:
|
|
303
|
+
return ze(e.render);
|
|
304
|
+
case E:
|
|
305
|
+
return H(e.type, r, t);
|
|
306
|
+
case j: {
|
|
307
|
+
var n = e, i = n._payload, c = n._init;
|
|
308
|
+
try {
|
|
309
|
+
return H(c(i), r, t);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
var q = Object.prototype.hasOwnProperty, _e = {}, Ee = N.ReactDebugCurrentFrame;
|
|
317
|
+
function Z(e) {
|
|
318
|
+
if (e) {
|
|
319
|
+
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
|
|
320
|
+
Ee.setExtraStackFrame(t);
|
|
321
|
+
} else
|
|
322
|
+
Ee.setExtraStackFrame(null);
|
|
323
|
+
}
|
|
324
|
+
function Ue(e, r, t, n, i) {
|
|
325
|
+
{
|
|
326
|
+
var c = Function.call.bind(q);
|
|
327
|
+
for (var o in e)
|
|
328
|
+
if (c(e, o)) {
|
|
329
|
+
var a = void 0;
|
|
330
|
+
try {
|
|
331
|
+
if (typeof e[o] != "function") {
|
|
332
|
+
var h = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw h.name = "Invariant Violation", h;
|
|
334
|
+
}
|
|
335
|
+
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
+
} catch (u) {
|
|
337
|
+
a = u;
|
|
338
|
+
}
|
|
339
|
+
a && !(a instanceof Error) && (Z(i), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, o, typeof a), Z(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, Z(i), p("Failed %s type: %s", t, a.message), Z(null));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
var Ve = Array.isArray;
|
|
344
|
+
function oe(e) {
|
|
345
|
+
return Ve(e);
|
|
346
|
+
}
|
|
347
|
+
function qe(e) {
|
|
348
|
+
{
|
|
349
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
|
+
return t;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function Be(e) {
|
|
354
|
+
try {
|
|
355
|
+
return Re(e), !1;
|
|
356
|
+
} catch {
|
|
357
|
+
return !0;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
function Re(e) {
|
|
361
|
+
return "" + e;
|
|
362
|
+
}
|
|
363
|
+
function we(e) {
|
|
364
|
+
if (Be(e))
|
|
365
|
+
return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", qe(e)), Re(e);
|
|
366
|
+
}
|
|
367
|
+
var je = N.ReactCurrentOwner, Je = {
|
|
368
|
+
key: !0,
|
|
369
|
+
ref: !0,
|
|
370
|
+
__self: !0,
|
|
371
|
+
__source: !0
|
|
372
|
+
}, Se, Te;
|
|
373
|
+
function Ke(e) {
|
|
374
|
+
if (q.call(e, "ref")) {
|
|
375
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
|
+
if (r && r.isReactWarning)
|
|
377
|
+
return !1;
|
|
378
|
+
}
|
|
379
|
+
return e.ref !== void 0;
|
|
380
|
+
}
|
|
381
|
+
function Xe(e) {
|
|
382
|
+
if (q.call(e, "key")) {
|
|
383
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
|
+
if (r && r.isReactWarning)
|
|
385
|
+
return !1;
|
|
386
|
+
}
|
|
387
|
+
return e.key !== void 0;
|
|
388
|
+
}
|
|
389
|
+
function Ge(e, r) {
|
|
390
|
+
typeof e.ref == "string" && je.current;
|
|
391
|
+
}
|
|
392
|
+
function He(e, r) {
|
|
393
|
+
{
|
|
394
|
+
var t = function() {
|
|
395
|
+
Se || (Se = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
396
|
+
};
|
|
397
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
|
+
get: t,
|
|
399
|
+
configurable: !0
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
function Ze(e, r) {
|
|
404
|
+
{
|
|
405
|
+
var t = function() {
|
|
406
|
+
Te || (Te = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
407
|
+
};
|
|
408
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
|
+
get: t,
|
|
410
|
+
configurable: !0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
var Qe = function(e, r, t, n, i, c, o) {
|
|
415
|
+
var a = {
|
|
416
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
+
$$typeof: O,
|
|
418
|
+
// Built-in properties that belong on the element
|
|
419
|
+
type: e,
|
|
420
|
+
key: r,
|
|
421
|
+
ref: t,
|
|
422
|
+
props: o,
|
|
423
|
+
// Record the component responsible for creating this element.
|
|
424
|
+
_owner: c
|
|
425
|
+
};
|
|
426
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
427
|
+
configurable: !1,
|
|
428
|
+
enumerable: !1,
|
|
429
|
+
writable: !0,
|
|
430
|
+
value: !1
|
|
431
|
+
}), Object.defineProperty(a, "_self", {
|
|
432
|
+
configurable: !1,
|
|
433
|
+
enumerable: !1,
|
|
434
|
+
writable: !1,
|
|
435
|
+
value: n
|
|
436
|
+
}), Object.defineProperty(a, "_source", {
|
|
437
|
+
configurable: !1,
|
|
438
|
+
enumerable: !1,
|
|
439
|
+
writable: !1,
|
|
440
|
+
value: i
|
|
441
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
|
+
};
|
|
443
|
+
function er(e, r, t, n, i) {
|
|
444
|
+
{
|
|
445
|
+
var c, o = {}, a = null, h = null;
|
|
446
|
+
t !== void 0 && (we(t), a = "" + t), Xe(r) && (we(r.key), a = "" + r.key), Ke(r) && (h = r.ref, Ge(r, i));
|
|
447
|
+
for (c in r)
|
|
448
|
+
q.call(r, c) && !Je.hasOwnProperty(c) && (o[c] = r[c]);
|
|
449
|
+
if (e && e.defaultProps) {
|
|
450
|
+
var u = e.defaultProps;
|
|
451
|
+
for (c in u)
|
|
452
|
+
o[c] === void 0 && (o[c] = u[c]);
|
|
453
|
+
}
|
|
454
|
+
if (a || h) {
|
|
455
|
+
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
a && He(o, f), h && Ze(o, f);
|
|
457
|
+
}
|
|
458
|
+
return Qe(e, a, h, i, n, je.current, o);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
var ie = N.ReactCurrentOwner, Ce = N.ReactDebugCurrentFrame;
|
|
462
|
+
function z(e) {
|
|
463
|
+
if (e) {
|
|
464
|
+
var r = e._owner, t = H(e.type, e._source, r ? r.type : null);
|
|
465
|
+
Ce.setExtraStackFrame(t);
|
|
466
|
+
} else
|
|
467
|
+
Ce.setExtraStackFrame(null);
|
|
468
|
+
}
|
|
469
|
+
var se;
|
|
470
|
+
se = !1;
|
|
471
|
+
function le(e) {
|
|
472
|
+
return typeof e == "object" && e !== null && e.$$typeof === O;
|
|
473
|
+
}
|
|
474
|
+
function Oe() {
|
|
475
|
+
{
|
|
476
|
+
if (ie.current) {
|
|
477
|
+
var e = D(ie.current.type);
|
|
478
|
+
if (e)
|
|
479
|
+
return `
|
|
480
|
+
|
|
481
|
+
Check the render method of \`` + e + "`.";
|
|
482
|
+
}
|
|
483
|
+
return "";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function rr(e) {
|
|
487
|
+
return "";
|
|
488
|
+
}
|
|
489
|
+
var ke = {};
|
|
490
|
+
function tr(e) {
|
|
491
|
+
{
|
|
492
|
+
var r = Oe();
|
|
493
|
+
if (!r) {
|
|
494
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
|
+
t && (r = `
|
|
496
|
+
|
|
497
|
+
Check the top-level render call using <` + t + ">.");
|
|
498
|
+
}
|
|
499
|
+
return r;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function Pe(e, r) {
|
|
503
|
+
{
|
|
504
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
505
|
+
return;
|
|
506
|
+
e._store.validated = !0;
|
|
507
|
+
var t = tr(r);
|
|
508
|
+
if (ke[t])
|
|
509
|
+
return;
|
|
510
|
+
ke[t] = !0;
|
|
511
|
+
var n = "";
|
|
512
|
+
e && e._owner && e._owner !== ie.current && (n = " It was passed a child from " + D(e._owner.type) + "."), z(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), z(null);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function Ne(e, r) {
|
|
516
|
+
{
|
|
517
|
+
if (typeof e != "object")
|
|
518
|
+
return;
|
|
519
|
+
if (oe(e))
|
|
520
|
+
for (var t = 0; t < e.length; t++) {
|
|
521
|
+
var n = e[t];
|
|
522
|
+
le(n) && Pe(n, r);
|
|
523
|
+
}
|
|
524
|
+
else if (le(e))
|
|
525
|
+
e._store && (e._store.validated = !0);
|
|
526
|
+
else if (e) {
|
|
527
|
+
var i = ee(e);
|
|
528
|
+
if (typeof i == "function" && i !== e.entries)
|
|
529
|
+
for (var c = i.call(e), o; !(o = c.next()).done; )
|
|
530
|
+
le(o.value) && Pe(o.value, r);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
function nr(e) {
|
|
535
|
+
{
|
|
536
|
+
var r = e.type;
|
|
537
|
+
if (r == null || typeof r == "string")
|
|
538
|
+
return;
|
|
539
|
+
var t;
|
|
540
|
+
if (typeof r == "function")
|
|
541
|
+
t = r.propTypes;
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
|
|
543
|
+
// Inner props are checked in the reconciler.
|
|
544
|
+
r.$$typeof === E))
|
|
545
|
+
t = r.propTypes;
|
|
546
|
+
else
|
|
547
|
+
return;
|
|
548
|
+
if (t) {
|
|
549
|
+
var n = D(r);
|
|
550
|
+
Ue(t, e.props, "prop", n, e);
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !se) {
|
|
552
|
+
se = !0;
|
|
553
|
+
var i = D(r);
|
|
554
|
+
p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
555
|
+
}
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function ar(e) {
|
|
560
|
+
{
|
|
561
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
|
+
var n = r[t];
|
|
563
|
+
if (n !== "children" && n !== "key") {
|
|
564
|
+
z(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), z(null);
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
e.ref !== null && (z(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
var De = {};
|
|
572
|
+
function Fe(e, r, t, n, i, c) {
|
|
573
|
+
{
|
|
574
|
+
var o = b(e);
|
|
575
|
+
if (!o) {
|
|
576
|
+
var a = "";
|
|
577
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
578
|
+
var h = rr();
|
|
579
|
+
h ? a += h : a += Oe();
|
|
580
|
+
var u;
|
|
581
|
+
e === null ? u = "null" : oe(e) ? u = "array" : e !== void 0 && e.$$typeof === O ? (u = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", u, a);
|
|
582
|
+
}
|
|
583
|
+
var f = er(e, r, t, i, c);
|
|
584
|
+
if (f == null)
|
|
585
|
+
return f;
|
|
586
|
+
if (o) {
|
|
587
|
+
var _ = r.children;
|
|
588
|
+
if (_ !== void 0)
|
|
589
|
+
if (n)
|
|
590
|
+
if (oe(_)) {
|
|
591
|
+
for (var M = 0; M < _.length; M++)
|
|
592
|
+
Ne(_[M], e);
|
|
593
|
+
Object.freeze && Object.freeze(_);
|
|
594
|
+
} else
|
|
595
|
+
p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
|
+
else
|
|
597
|
+
Ne(_, e);
|
|
598
|
+
}
|
|
599
|
+
if (q.call(r, "key")) {
|
|
600
|
+
var I = D(e), m = Object.keys(r).filter(function(ur) {
|
|
601
|
+
return ur !== "key";
|
|
602
|
+
}), ce = m.length > 0 ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!De[I + ce]) {
|
|
604
|
+
var cr = m.length > 0 ? "{" + m.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
p(`A props object containing a "key" prop is being spread into JSX:
|
|
606
|
+
let props = %s;
|
|
607
|
+
<%s {...props} />
|
|
608
|
+
React keys must be passed directly to JSX without using spread:
|
|
609
|
+
let props = %s;
|
|
610
|
+
<%s key={someKey} {...props} />`, ce, I, cr, I), De[I + ce] = !0;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return e === y ? ar(f) : nr(f), f;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function or(e, r, t) {
|
|
617
|
+
return Fe(e, r, t, !0);
|
|
618
|
+
}
|
|
619
|
+
function ir(e, r, t) {
|
|
620
|
+
return Fe(e, r, t, !1);
|
|
621
|
+
}
|
|
622
|
+
var sr = ir, lr = or;
|
|
623
|
+
J.Fragment = y, J.jsx = sr, J.jsxs = lr;
|
|
624
|
+
}()), J;
|
|
625
|
+
}
|
|
626
|
+
process.env.NODE_ENV === "production" ? ue.exports = fr() : ue.exports = dr();
|
|
627
|
+
var s = ue.exports;
|
|
628
|
+
const pr = () => {
|
|
629
|
+
const [$, O] = F(!1), [k, y] = F("idle"), [W, L] = F(""), [S, w] = F(null), [d, P] = F(""), [v, E] = F(""), [j, Y] = F(null), [U, Q] = F(null), ee = "http://136.113.197.77:5000/predict/size-from-chart";
|
|
630
|
+
function N() {
|
|
631
|
+
var R;
|
|
632
|
+
let l = 0, x = 0;
|
|
633
|
+
const g = ["pant", "jeans", "trouser", "skirt", "short", "legging", "jogger", "bottom", "denim", "cargo"], T = ["shirt", "top", "tee", "blouse", "jacket", "coat", "hoodie", "sweater", "vest", "cardigan", "dress", "t-shirt"], C = (document.title + " " + (((R = document.querySelector("h1")) == null ? void 0 : R.innerText) || "")).toLowerCase();
|
|
634
|
+
return g.forEach((b) => {
|
|
635
|
+
C.includes(b) && (x += 2);
|
|
636
|
+
}), T.forEach((b) => {
|
|
637
|
+
C.includes(b) && (l += 2);
|
|
638
|
+
}), x > l ? "bottom" : "top";
|
|
639
|
+
}
|
|
640
|
+
function p() {
|
|
641
|
+
const l = { chart_type: "none", chart_content: null, available_sizes: [] }, x = document.querySelector("table");
|
|
642
|
+
if (x && /chest|waist|bust|hip|size/i.test(x.innerText))
|
|
643
|
+
return l.chart_type = "html_table", l.chart_content = x.outerHTML, l;
|
|
644
|
+
const g = document.querySelectorAll("img");
|
|
645
|
+
for (let R of g) {
|
|
646
|
+
const b = R.src.toLowerCase(), K = (R.alt || "").toLowerCase();
|
|
647
|
+
if (b.includes("size") && b.includes("chart") || K.includes("size") && K.includes("guide"))
|
|
648
|
+
return l.chart_type = "image_url", l.chart_content = R.src, l;
|
|
649
|
+
}
|
|
650
|
+
const T = document.querySelector('.size-guide, #size-chart, .measurement-guide, [class*="SizeGuide"]');
|
|
651
|
+
return T ? (l.chart_type = "raw_text", l.chart_content = T.innerText, l) : (document.querySelectorAll("button, span, li").forEach((R) => {
|
|
652
|
+
const b = R.innerText.trim();
|
|
653
|
+
/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(b) && b.length < 4 && (l.available_sizes.includes(b) || l.available_sizes.push(b));
|
|
654
|
+
}), l);
|
|
655
|
+
}
|
|
656
|
+
const re = async () => {
|
|
657
|
+
if (!j || !U || !d || !v) {
|
|
658
|
+
alert("Please fill all fields.");
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
y("loading");
|
|
662
|
+
const l = N(), x = p(), g = new FormData();
|
|
663
|
+
g.append("front_image", j), g.append("side_image", U), g.append("height", d), g.append("weight", v), g.append("product_type", l), g.append("chart_type", x.chart_type), g.append("chart_content", x.chart_content), g.append("available_sizes", JSON.stringify(x.available_sizes));
|
|
664
|
+
try {
|
|
665
|
+
const C = await (await fetch(ee, { method: "POST", body: g })).json();
|
|
666
|
+
if (C.error) throw new Error(C.error);
|
|
667
|
+
w(C), y("success");
|
|
668
|
+
} catch (T) {
|
|
669
|
+
L(T.message), y("error");
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
return /* @__PURE__ */ s.jsxs("div", { className: "fixed bottom-6 right-6 z-[999999]", children: [
|
|
673
|
+
/* @__PURE__ */ s.jsx(
|
|
674
|
+
"button",
|
|
675
|
+
{
|
|
676
|
+
onClick: () => O(!$),
|
|
677
|
+
className: "bg-black text-white px-7 py-3.5 rounded-full shadow-xl font-bold text-sm hover:opacity-80 transition-opacity",
|
|
678
|
+
children: "Styllar"
|
|
679
|
+
}
|
|
680
|
+
),
|
|
681
|
+
$ && /* @__PURE__ */ s.jsxs("div", { className: "absolute bottom-20 right-0 w-[330px] bg-white rounded-2xl p-6 shadow-2xl border border-gray-100 text-black", children: [
|
|
682
|
+
/* @__PURE__ */ s.jsxs("div", { className: "flex justify-between items-center mb-4", children: [
|
|
683
|
+
/* @__PURE__ */ s.jsx("h3", { className: "m-0 text-lg font-bold", children: "Smart Fit Assistant" }),
|
|
684
|
+
/* @__PURE__ */ s.jsx("button", { onClick: () => O(!1), className: "text-gray-400 hover:text-black text-2xl leading-none", children: "×" })
|
|
685
|
+
] }),
|
|
686
|
+
k === "loading" && /* @__PURE__ */ s.jsxs("div", { className: "flex flex-col items-center justify-center py-8", children: [
|
|
687
|
+
/* @__PURE__ */ s.jsx("div", { className: "w-8 h-8 border-4 border-gray-200 border-t-black rounded-full animate-spin mb-4" }),
|
|
688
|
+
/* @__PURE__ */ s.jsx("p", { className: "text-sm text-gray-600", children: "Analyzing body & page data..." })
|
|
689
|
+
] }),
|
|
690
|
+
k === "success" && S && /* @__PURE__ */ s.jsxs("div", { className: "text-center py-6", children: [
|
|
691
|
+
/* @__PURE__ */ s.jsx("div", { className: "text-sm text-green-600 font-bold tracking-wider", children: "MATCH FOUND" }),
|
|
692
|
+
/* @__PURE__ */ s.jsx("div", { className: "text-5xl font-black my-4 text-black", children: S.recommended_size }),
|
|
693
|
+
/* @__PURE__ */ s.jsxs("div", { className: "text-xs text-gray-500 mb-6", children: [
|
|
694
|
+
"Confidence: ",
|
|
695
|
+
S.confidence
|
|
696
|
+
] }),
|
|
697
|
+
/* @__PURE__ */ s.jsx(
|
|
698
|
+
"button",
|
|
699
|
+
{
|
|
700
|
+
onClick: () => {
|
|
701
|
+
y("idle"), w(null);
|
|
702
|
+
},
|
|
703
|
+
className: "text-blue-600 text-sm underline hover:text-blue-800",
|
|
704
|
+
children: "Run New Scan"
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
] }),
|
|
708
|
+
k === "error" && /* @__PURE__ */ s.jsxs("div", { className: "py-4", children: [
|
|
709
|
+
/* @__PURE__ */ s.jsxs("p", { className: "text-red-500 text-sm mb-4", children: [
|
|
710
|
+
"Error: ",
|
|
711
|
+
W
|
|
712
|
+
] }),
|
|
713
|
+
/* @__PURE__ */ s.jsx(
|
|
714
|
+
"button",
|
|
715
|
+
{
|
|
716
|
+
onClick: () => y("idle"),
|
|
717
|
+
className: "w-full bg-black text-white py-3 rounded-xl font-bold text-sm",
|
|
718
|
+
children: "Try Again"
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
] }),
|
|
722
|
+
k === "idle" && /* @__PURE__ */ s.jsxs("div", { children: [
|
|
723
|
+
/* @__PURE__ */ s.jsx("p", { className: "text-sm text-gray-600 mb-5 leading-relaxed", children: "Upload photos for a precision body scan." }),
|
|
724
|
+
/* @__PURE__ */ s.jsxs("div", { className: "flex gap-3 mb-4", children: [
|
|
725
|
+
/* @__PURE__ */ s.jsx(
|
|
726
|
+
"input",
|
|
727
|
+
{
|
|
728
|
+
type: "number",
|
|
729
|
+
placeholder: "Height (cm)",
|
|
730
|
+
value: d,
|
|
731
|
+
onChange: (l) => P(l.target.value),
|
|
732
|
+
className: "w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
/* @__PURE__ */ s.jsx(
|
|
736
|
+
"input",
|
|
737
|
+
{
|
|
738
|
+
type: "number",
|
|
739
|
+
placeholder: "Weight (kg)",
|
|
740
|
+
value: v,
|
|
741
|
+
onChange: (l) => E(l.target.value),
|
|
742
|
+
className: "w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
743
|
+
}
|
|
744
|
+
)
|
|
745
|
+
] }),
|
|
746
|
+
/* @__PURE__ */ s.jsxs("div", { className: "mb-3", children: [
|
|
747
|
+
/* @__PURE__ */ s.jsx("label", { className: "text-[11px] font-bold text-gray-400 uppercase block mb-1", children: "Front Image" }),
|
|
748
|
+
/* @__PURE__ */ s.jsx(
|
|
749
|
+
"input",
|
|
750
|
+
{
|
|
751
|
+
type: "file",
|
|
752
|
+
accept: "image/*",
|
|
753
|
+
onChange: (l) => Y(l.target.files[0]),
|
|
754
|
+
className: "w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
] }),
|
|
758
|
+
/* @__PURE__ */ s.jsxs("div", { className: "mb-5", children: [
|
|
759
|
+
/* @__PURE__ */ s.jsx("label", { className: "text-[11px] font-bold text-gray-400 uppercase block mb-1", children: "Side Image" }),
|
|
760
|
+
/* @__PURE__ */ s.jsx(
|
|
761
|
+
"input",
|
|
762
|
+
{
|
|
763
|
+
type: "file",
|
|
764
|
+
accept: "image/*",
|
|
765
|
+
onChange: (l) => Q(l.target.files[0]),
|
|
766
|
+
className: "w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
767
|
+
}
|
|
768
|
+
)
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ s.jsx(
|
|
771
|
+
"button",
|
|
772
|
+
{
|
|
773
|
+
onClick: re,
|
|
774
|
+
className: "w-full bg-black text-white py-3.5 rounded-xl font-bold text-sm hover:opacity-80 transition-opacity",
|
|
775
|
+
children: "Run Body Scan"
|
|
776
|
+
}
|
|
777
|
+
)
|
|
778
|
+
] })
|
|
779
|
+
] })
|
|
780
|
+
] });
|
|
781
|
+
};
|
|
782
|
+
export {
|
|
783
|
+
pr as StyllarPlugin
|
|
784
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function(A,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],b):(A=typeof globalThis<"u"?globalThis:A||self,b(A.StyllarReactPlugin={},A.React))})(this,function(A,b){"use strict";var ee={exports:{}},B={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var de;function Le(){if(de)return B;de=1;var L=b,P=Symbol.for("react.element"),k=Symbol.for("react.fragment"),x=Object.prototype.hasOwnProperty,Y=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,z={key:!0,ref:!0,__self:!0,__source:!0};function T(w,d,N){var p,R={},j=null,M=null;N!==void 0&&(j=""+N),d.key!==void 0&&(j=""+d.key),d.ref!==void 0&&(M=d.ref);for(p in d)x.call(d,p)&&!z.hasOwnProperty(p)&&(R[p]=d[p]);if(w&&w.defaultProps)for(p in d=w.defaultProps,d)R[p]===void 0&&(R[p]=d[p]);return{$$typeof:P,type:w,key:j,ref:M,props:R,_owner:Y.current}}return B.Fragment=k,B.jsx=T,B.jsxs=T,B}var J={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var pe;function Ye(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var L=b,P=Symbol.for("react.element"),k=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),Y=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),w=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),K=Symbol.iterator,re="@@iterator";function te(e){if(e===null||typeof e!="object")return null;var r=K&&e[K]||e[re];return typeof r=="function"?r:null}var D=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];ne("error",e,t)}}function ne(e,r,t){{var n=D.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var c=t.map(function(o){return String(o)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var l=!1,_=!1,g=!1,C=!1,O=!1,S;S=Symbol.for("react.module.reference");function y(e){return!!(typeof e=="string"||typeof e=="function"||e===x||e===z||O||e===Y||e===N||e===p||C||e===M||l||_||g||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===R||e.$$typeof===T||e.$$typeof===w||e.$$typeof===d||e.$$typeof===S||e.getModuleId!==void 0))}function H(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ve(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case x:return"Fragment";case k:return"Portal";case z:return"Profiler";case Y:return"StrictMode";case N:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ve(r)+".Consumer";case T:var t=e;return ve(t._context)+".Provider";case d:return H(e,e.render,"ForwardRef");case R:var n=e.displayName||null;return n!==null?n:F(e.type)||"Memo";case j:{var i=e,c=i._payload,o=i._init;try{return F(o(c))}catch{return null}}}return null}var I=Object.assign,X=0,ge,he,be,me,ye,xe,_e;function Ee(){}Ee.__reactDisabledLog=!0;function Me(){{if(X===0){ge=console.log,he=console.info,be=console.warn,me=console.error,ye=console.group,xe=console.groupCollapsed,_e=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}X++}}function Ue(){{if(X--,X===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:ge}),info:I({},e,{value:he}),warn:I({},e,{value:be}),error:I({},e,{value:me}),group:I({},e,{value:ye}),groupCollapsed:I({},e,{value:xe}),groupEnd:I({},e,{value:_e})})}X<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ae=D.ReactCurrentDispatcher,oe;function $(e,r,t){{if(oe===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);oe=n&&n[1]||""}return`
|
|
18
|
+
`+oe+e}}var ie=!1,q;{var Ve=typeof WeakMap=="function"?WeakMap:Map;q=new Ve}function Re(e,r){if(!e||ie)return"";{var t=q.get(e);if(t!==void 0)return t}var n;ie=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=ae.current,ae.current=null,Me();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(m){n=m}Reflect.construct(e,[],o)}else{try{o.call()}catch(m){n=m}e.call(o.prototype)}}else{try{throw Error()}catch(m){n=m}e()}}catch(m){if(m&&n&&typeof m.stack=="string"){for(var a=m.stack.split(`
|
|
19
|
+
`),h=n.stack.split(`
|
|
20
|
+
`),u=a.length-1,f=h.length-1;u>=1&&f>=0&&a[u]!==h[f];)f--;for(;u>=1&&f>=0;u--,f--)if(a[u]!==h[f]){if(u!==1||f!==1)do if(u--,f--,f<0||a[u]!==h[f]){var E=`
|
|
21
|
+
`+a[u].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&q.set(e,E),E}while(u>=1&&f>=0);break}}}finally{ie=!1,ae.current=c,Ue(),Error.prepareStackTrace=i}var V=e?e.displayName||e.name:"",W=V?$(V):"";return typeof e=="function"&&q.set(e,W),W}function Be(e,r,t){return Re(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Z(e,r,t){if(e==null)return"";if(typeof e=="function")return Re(e,Je(e));if(typeof e=="string")return $(e);switch(e){case N:return $("Suspense");case p:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Be(e.render);case R:return Z(e.type,r,t);case j:{var n=e,i=n._payload,c=n._init;try{return Z(c(i),r,t)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,Se={},we=D.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,t=Z(e.type,e._source,r?r.type:null);we.setExtraStackFrame(t)}else we.setExtraStackFrame(null)}function Ke(e,r,t,n,i){{var c=Function.call.bind(G);for(var o in e)if(c(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){a=u}a&&!(a instanceof Error)&&(Q(i),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),Q(null)),a instanceof Error&&!(a.message in Se)&&(Se[a.message]=!0,Q(i),v("Failed %s type: %s",t,a.message),Q(null))}}}var Xe=Array.isArray;function se(e){return Xe(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return je(e),!1}catch{return!0}}function je(e){return""+e}function Te(e){if(He(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),je(e)}var Ce=D.ReactCurrentOwner,$e={key:!0,ref:!0,__self:!0,__source:!0},Oe,Pe;function qe(e){if(G.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if(G.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){typeof e.ref=="string"&&Ce.current}function er(e,r){{var t=function(){Oe||(Oe=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function rr(e,r){{var t=function(){Pe||(Pe=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var tr=function(e,r,t,n,i,c,o){var a={$$typeof:P,type:e,key:r,ref:t,props:o,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,i){{var c,o={},a=null,h=null;t!==void 0&&(Te(t),a=""+t),Ze(r)&&(Te(r.key),a=""+r.key),qe(r)&&(h=r.ref,Qe(r,i));for(c in r)G.call(r,c)&&!$e.hasOwnProperty(c)&&(o[c]=r[c]);if(e&&e.defaultProps){var u=e.defaultProps;for(c in u)o[c]===void 0&&(o[c]=u[c])}if(a||h){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(o,f),h&&rr(o,f)}return tr(e,a,h,i,n,Ce.current,o)}}var le=D.ReactCurrentOwner,ke=D.ReactDebugCurrentFrame;function U(e){if(e){var r=e._owner,t=Z(e.type,e._source,r?r.type:null);ke.setExtraStackFrame(t)}else ke.setExtraStackFrame(null)}var ce;ce=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===P}function Ne(){{if(le.current){var e=F(le.current.type);if(e)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function ar(e){return""}var De={};function or(e){{var r=Ne();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),U(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),U(null)}}function Ae(e,r){{if(typeof e!="object")return;if(se(e))for(var t=0;t<e.length;t++){var n=e[t];ue(n)&&Fe(n,r)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var i=te(e);if(typeof i=="function"&&i!==e.entries)for(var c=i.call(e),o;!(o=c.next()).done;)ue(o.value)&&Fe(o.value,r)}}}function ir(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===R))t=r.propTypes;else return;if(t){var n=F(r);Ke(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ce){ce=!0;var i=F(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){U(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),U(null);break}}e.ref!==null&&(U(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),U(null))}}var Ie={};function We(e,r,t,n,i,c){{var o=y(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=ar();h?a+=h:a+=Ne();var u;e===null?u="null":se(e)?u="array":e!==void 0&&e.$$typeof===P?(u="<"+(F(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a)}var f=nr(e,r,t,i,c);if(f==null)return f;if(o){var E=r.children;if(E!==void 0)if(n)if(se(E)){for(var V=0;V<E.length;V++)Ae(E[V],e);Object.freeze&&Object.freeze(E)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(E,e)}if(G.call(r,"key")){var W=F(e),m=Object.keys(r).filter(function(pr){return pr!=="key"}),fe=m.length>0?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}";if(!Ie[W+fe]){var dr=m.length>0?"{"+m.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,fe,W,dr,W),Ie[W+fe]=!0}}return e===x?sr(f):ir(f),f}}function lr(e,r,t){return We(e,r,t,!0)}function cr(e,r,t){return We(e,r,t,!1)}var ur=cr,fr=lr;J.Fragment=x,J.jsx=ur,J.jsxs=fr}()),J}process.env.NODE_ENV==="production"?ee.exports=Le():ee.exports=Ye();var s=ee.exports;const ze=()=>{const[L,P]=b.useState(!1),[k,x]=b.useState("idle"),[Y,z]=b.useState(""),[T,w]=b.useState(null),[d,N]=b.useState(""),[p,R]=b.useState(""),[j,M]=b.useState(null),[K,re]=b.useState(null),te="http://136.113.197.77:5000/predict/size-from-chart";function D(){var S;let l=0,_=0;const g=["pant","jeans","trouser","skirt","short","legging","jogger","bottom","denim","cargo"],C=["shirt","top","tee","blouse","jacket","coat","hoodie","sweater","vest","cardigan","dress","t-shirt"],O=(document.title+" "+(((S=document.querySelector("h1"))==null?void 0:S.innerText)||"")).toLowerCase();return g.forEach(y=>{O.includes(y)&&(_+=2)}),C.forEach(y=>{O.includes(y)&&(l+=2)}),_>l?"bottom":"top"}function v(){const l={chart_type:"none",chart_content:null,available_sizes:[]},_=document.querySelector("table");if(_&&/chest|waist|bust|hip|size/i.test(_.innerText))return l.chart_type="html_table",l.chart_content=_.outerHTML,l;const g=document.querySelectorAll("img");for(let S of g){const y=S.src.toLowerCase(),H=(S.alt||"").toLowerCase();if(y.includes("size")&&y.includes("chart")||H.includes("size")&&H.includes("guide"))return l.chart_type="image_url",l.chart_content=S.src,l}const C=document.querySelector('.size-guide, #size-chart, .measurement-guide, [class*="SizeGuide"]');return C?(l.chart_type="raw_text",l.chart_content=C.innerText,l):(document.querySelectorAll("button, span, li").forEach(S=>{const y=S.innerText.trim();/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(y)&&y.length<4&&(l.available_sizes.includes(y)||l.available_sizes.push(y))}),l)}const ne=async()=>{if(!j||!K||!d||!p){alert("Please fill all fields.");return}x("loading");const l=D(),_=v(),g=new FormData;g.append("front_image",j),g.append("side_image",K),g.append("height",d),g.append("weight",p),g.append("product_type",l),g.append("chart_type",_.chart_type),g.append("chart_content",_.chart_content),g.append("available_sizes",JSON.stringify(_.available_sizes));try{const O=await(await fetch(te,{method:"POST",body:g})).json();if(O.error)throw new Error(O.error);w(O),x("success")}catch(C){z(C.message),x("error")}};return s.jsxs("div",{className:"fixed bottom-6 right-6 z-[999999]",children:[s.jsx("button",{onClick:()=>P(!L),className:"bg-black text-white px-7 py-3.5 rounded-full shadow-xl font-bold text-sm hover:opacity-80 transition-opacity",children:"Styllar"}),L&&s.jsxs("div",{className:"absolute bottom-20 right-0 w-[330px] bg-white rounded-2xl p-6 shadow-2xl border border-gray-100 text-black",children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("h3",{className:"m-0 text-lg font-bold",children:"Smart Fit Assistant"}),s.jsx("button",{onClick:()=>P(!1),className:"text-gray-400 hover:text-black text-2xl leading-none",children:"×"})]}),k==="loading"&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[s.jsx("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-black rounded-full animate-spin mb-4"}),s.jsx("p",{className:"text-sm text-gray-600",children:"Analyzing body & page data..."})]}),k==="success"&&T&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx("div",{className:"text-sm text-green-600 font-bold tracking-wider",children:"MATCH FOUND"}),s.jsx("div",{className:"text-5xl font-black my-4 text-black",children:T.recommended_size}),s.jsxs("div",{className:"text-xs text-gray-500 mb-6",children:["Confidence: ",T.confidence]}),s.jsx("button",{onClick:()=>{x("idle"),w(null)},className:"text-blue-600 text-sm underline hover:text-blue-800",children:"Run New Scan"})]}),k==="error"&&s.jsxs("div",{className:"py-4",children:[s.jsxs("p",{className:"text-red-500 text-sm mb-4",children:["Error: ",Y]}),s.jsx("button",{onClick:()=>x("idle"),className:"w-full bg-black text-white py-3 rounded-xl font-bold text-sm",children:"Try Again"})]}),k==="idle"&&s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-gray-600 mb-5 leading-relaxed",children:"Upload photos for a precision body scan."}),s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsx("input",{type:"number",placeholder:"Height (cm)",value:d,onChange:l=>N(l.target.value),className:"w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"}),s.jsx("input",{type:"number",placeholder:"Weight (kg)",value:p,onChange:l=>R(l.target.value),className:"w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"})]}),s.jsxs("div",{className:"mb-3",children:[s.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase block mb-1",children:"Front Image"}),s.jsx("input",{type:"file",accept:"image/*",onChange:l=>M(l.target.files[0]),className:"w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"})]}),s.jsxs("div",{className:"mb-5",children:[s.jsx("label",{className:"text-[11px] font-bold text-gray-400 uppercase block mb-1",children:"Side Image"}),s.jsx("input",{type:"file",accept:"image/*",onChange:l=>re(l.target.files[0]),className:"w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"})]}),s.jsx("button",{onClick:ne,className:"w-full bg-black text-white py-3.5 rounded-xl font-bold text-sm hover:opacity-80 transition-opacity",children:"Run Body Scan"})]})]})]})};A.StyllarPlugin=ze,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import react from 'eslint-plugin-react'
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
5
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{js,jsx}'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
globals: globals.browser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
ecmaFeatures: { jsx: true },
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
settings: { react: { version: '18.3' } },
|
|
21
|
+
plugins: {
|
|
22
|
+
react,
|
|
23
|
+
'react-hooks': reactHooks,
|
|
24
|
+
'react-refresh': reactRefresh,
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...js.configs.recommended.rules,
|
|
28
|
+
...react.configs.recommended.rules,
|
|
29
|
+
...react.configs['jsx-runtime'].rules,
|
|
30
|
+
...reactHooks.configs.recommended.rules,
|
|
31
|
+
'react/jsx-no-target-blank': 'off',
|
|
32
|
+
'react-refresh/only-export-components': [
|
|
33
|
+
'warn',
|
|
34
|
+
{ allowConstantExport: true },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "styllar-react-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/styllar-react-plugin.umd.cjs",
|
|
6
|
+
"module": "dist/styllar-react-plugin.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/styllar-react-plugin.js",
|
|
10
|
+
"require": "./dist/styllar-react-plugin.umd.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"build": "vite build",
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"preview": "vite preview"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^18.3.1",
|
|
21
|
+
"react-dom": "^18.3.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^9.13.0",
|
|
25
|
+
"@types/react": "^18.3.12",
|
|
26
|
+
"@types/react-dom": "^18.3.1",
|
|
27
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
28
|
+
"autoprefixer": "^10.4.24",
|
|
29
|
+
"eslint": "^9.13.0",
|
|
30
|
+
"eslint-plugin-react": "^7.37.2",
|
|
31
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
32
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
33
|
+
"globals": "^15.11.0",
|
|
34
|
+
"postcss": "^8.5.6",
|
|
35
|
+
"tailwindcss": "^4.2.0",
|
|
36
|
+
"vite": "^5.4.10"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
const StyllarPlugin = () => {
|
|
4
|
+
// --- 1. REACT STATE MANAGEMENT ---
|
|
5
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6
|
+
const [status, setStatus] = useState('idle'); // 'idle' | 'loading' | 'success' | 'error'
|
|
7
|
+
const [errorMsg, setErrorMsg] = useState('');
|
|
8
|
+
const [result, setResult] = useState(null);
|
|
9
|
+
|
|
10
|
+
// Form states
|
|
11
|
+
const [height, setHeight] = useState('');
|
|
12
|
+
const [weight, setWeight] = useState('');
|
|
13
|
+
const [frontImage, setFrontImage] = useState(null);
|
|
14
|
+
const [sideImage, setSideImage] = useState(null);
|
|
15
|
+
|
|
16
|
+
const API_ENDPOINT = "http://136.113.197.77:5000/predict/size-from-chart";
|
|
17
|
+
|
|
18
|
+
// --- 2. INTELLIGENCE & SCRAPING (Unchanged logic) ---
|
|
19
|
+
function detectProductCategory() {
|
|
20
|
+
let scoreTop = 0; let scoreBottom = 0;
|
|
21
|
+
const bottomKeywords = ['pant', 'jeans', 'trouser', 'skirt', 'short', 'legging', 'jogger', 'bottom', 'denim', 'cargo'];
|
|
22
|
+
const topKeywords = ['shirt', 'top', 'tee', 'blouse', 'jacket', 'coat', 'hoodie', 'sweater', 'vest', 'cardigan', 'dress', 't-shirt'];
|
|
23
|
+
const textToScan = (document.title + " " + (document.querySelector('h1')?.innerText || "")).toLowerCase();
|
|
24
|
+
bottomKeywords.forEach(word => { if(textToScan.includes(word)) scoreBottom += 2; });
|
|
25
|
+
topKeywords.forEach(word => { if(textToScan.includes(word)) scoreTop += 2; });
|
|
26
|
+
return (scoreBottom > scoreTop) ? 'bottom' : 'top';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function scanPageForSizeData() {
|
|
30
|
+
const data = { chart_type: 'none', chart_content: null, available_sizes: [] };
|
|
31
|
+
const table = document.querySelector('table');
|
|
32
|
+
if (table && /chest|waist|bust|hip|size/i.test(table.innerText)) {
|
|
33
|
+
data.chart_type = 'html_table';
|
|
34
|
+
data.chart_content = table.outerHTML;
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
const allImages = document.querySelectorAll('img');
|
|
38
|
+
for (let img of allImages) {
|
|
39
|
+
const src = img.src.toLowerCase();
|
|
40
|
+
const alt = (img.alt || "").toLowerCase();
|
|
41
|
+
if ((src.includes('size') && src.includes('chart')) || (alt.includes('size') && alt.includes('guide'))) {
|
|
42
|
+
data.chart_type = 'image_url';
|
|
43
|
+
data.chart_content = img.src;
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const sizeGuideDiv = document.querySelector('.size-guide, #size-chart, .measurement-guide, [class*="SizeGuide"]');
|
|
49
|
+
if (sizeGuideDiv) {
|
|
50
|
+
data.chart_type = 'raw_text';
|
|
51
|
+
data.chart_content = sizeGuideDiv.innerText;
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const buttons = document.querySelectorAll('button, span, li');
|
|
56
|
+
buttons.forEach(el => {
|
|
57
|
+
const txt = el.innerText.trim();
|
|
58
|
+
if (/^(XS|S|M|L|XL|XXL|[0-9]{2})$/i.test(txt) && txt.length < 4) {
|
|
59
|
+
if (!data.available_sizes.includes(txt)) data.available_sizes.push(txt);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// --- 3. SUBMIT HANDLER ---
|
|
66
|
+
const runBodyScan = async () => {
|
|
67
|
+
if (!frontImage || !sideImage || !height || !weight) {
|
|
68
|
+
alert("Please fill all fields.");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setStatus('loading');
|
|
73
|
+
const category = detectProductCategory();
|
|
74
|
+
const pageData = scanPageForSizeData();
|
|
75
|
+
|
|
76
|
+
const fd = new FormData();
|
|
77
|
+
fd.append('front_image', frontImage);
|
|
78
|
+
fd.append('side_image', sideImage);
|
|
79
|
+
fd.append('height', height);
|
|
80
|
+
fd.append('weight', weight);
|
|
81
|
+
fd.append('product_type', category);
|
|
82
|
+
fd.append('chart_type', pageData.chart_type);
|
|
83
|
+
fd.append('chart_content', pageData.chart_content);
|
|
84
|
+
fd.append('available_sizes', JSON.stringify(pageData.available_sizes));
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
const res = await fetch(API_ENDPOINT, { method: 'POST', body: fd });
|
|
88
|
+
const data = await res.json();
|
|
89
|
+
if(data.error) throw new Error(data.error);
|
|
90
|
+
|
|
91
|
+
setResult(data);
|
|
92
|
+
setStatus('success');
|
|
93
|
+
} catch (e) {
|
|
94
|
+
setErrorMsg(e.message);
|
|
95
|
+
setStatus('error');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// --- 4. REACT JSX UI (Using Tailwind CSS for styling) ---
|
|
100
|
+
return (
|
|
101
|
+
<div className="fixed bottom-6 right-6 z-[999999]">
|
|
102
|
+
{/* The Trigger Button */}
|
|
103
|
+
<button
|
|
104
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
105
|
+
className="bg-black text-white px-7 py-3.5 rounded-full shadow-xl font-bold text-sm hover:opacity-80 transition-opacity"
|
|
106
|
+
>
|
|
107
|
+
Styllar
|
|
108
|
+
</button>
|
|
109
|
+
|
|
110
|
+
{/* The Modal Window */}
|
|
111
|
+
{isOpen && (
|
|
112
|
+
<div className="absolute bottom-20 right-0 w-[330px] bg-white rounded-2xl p-6 shadow-2xl border border-gray-100 text-black">
|
|
113
|
+
|
|
114
|
+
{/* Header */}
|
|
115
|
+
<div className="flex justify-between items-center mb-4">
|
|
116
|
+
<h3 className="m-0 text-lg font-bold">Smart Fit Assistant</h3>
|
|
117
|
+
<button onClick={() => setIsOpen(false)} className="text-gray-400 hover:text-black text-2xl leading-none">×</button>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{/* Loading State */}
|
|
121
|
+
{status === 'loading' && (
|
|
122
|
+
<div className="flex flex-col items-center justify-center py-8">
|
|
123
|
+
<div className="w-8 h-8 border-4 border-gray-200 border-t-black rounded-full animate-spin mb-4"></div>
|
|
124
|
+
<p className="text-sm text-gray-600">Analyzing body & page data...</p>
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
|
|
128
|
+
{/* Success State */}
|
|
129
|
+
{status === 'success' && result && (
|
|
130
|
+
<div className="text-center py-6">
|
|
131
|
+
<div className="text-sm text-green-600 font-bold tracking-wider">MATCH FOUND</div>
|
|
132
|
+
<div className="text-5xl font-black my-4 text-black">{result.recommended_size}</div>
|
|
133
|
+
<div className="text-xs text-gray-500 mb-6">Confidence: {result.confidence}</div>
|
|
134
|
+
<button
|
|
135
|
+
onClick={() => { setStatus('idle'); setResult(null); }}
|
|
136
|
+
className="text-blue-600 text-sm underline hover:text-blue-800"
|
|
137
|
+
>
|
|
138
|
+
Run New Scan
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
|
|
143
|
+
{/* Error State */}
|
|
144
|
+
{status === 'error' && (
|
|
145
|
+
<div className="py-4">
|
|
146
|
+
<p className="text-red-500 text-sm mb-4">Error: {errorMsg}</p>
|
|
147
|
+
<button
|
|
148
|
+
onClick={() => setStatus('idle')}
|
|
149
|
+
className="w-full bg-black text-white py-3 rounded-xl font-bold text-sm"
|
|
150
|
+
>
|
|
151
|
+
Try Again
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
|
|
156
|
+
{/* Input Form State */}
|
|
157
|
+
{status === 'idle' && (
|
|
158
|
+
<div>
|
|
159
|
+
<p className="text-sm text-gray-600 mb-5 leading-relaxed">
|
|
160
|
+
Upload photos for a precision body scan.
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<div className="flex gap-3 mb-4">
|
|
164
|
+
<input
|
|
165
|
+
type="number"
|
|
166
|
+
placeholder="Height (cm)"
|
|
167
|
+
value={height}
|
|
168
|
+
onChange={(e) => setHeight(e.target.value)}
|
|
169
|
+
className="w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
170
|
+
/>
|
|
171
|
+
<input
|
|
172
|
+
type="number"
|
|
173
|
+
placeholder="Weight (kg)"
|
|
174
|
+
value={weight}
|
|
175
|
+
onChange={(e) => setWeight(e.target.value)}
|
|
176
|
+
className="w-1/2 p-2.5 border border-gray-300 rounded-lg outline-none focus:border-black text-sm"
|
|
177
|
+
/>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div className="mb-3">
|
|
181
|
+
<label className="text-[11px] font-bold text-gray-400 uppercase block mb-1">Front Image</label>
|
|
182
|
+
<input
|
|
183
|
+
type="file"
|
|
184
|
+
accept="image/*"
|
|
185
|
+
onChange={(e) => setFrontImage(e.target.files[0])}
|
|
186
|
+
className="w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
187
|
+
/>
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<div className="mb-5">
|
|
191
|
+
<label className="text-[11px] font-bold text-gray-400 uppercase block mb-1">Side Image</label>
|
|
192
|
+
<input
|
|
193
|
+
type="file"
|
|
194
|
+
accept="image/*"
|
|
195
|
+
onChange={(e) => setSideImage(e.target.files[0])}
|
|
196
|
+
className="w-full text-xs file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:text-xs file:bg-gray-100 file:text-black hover:file:bg-gray-200"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<button
|
|
201
|
+
onClick={runBodyScan}
|
|
202
|
+
className="w-full bg-black text-white py-3.5 rounded-xl font-bold text-sm hover:opacity-80 transition-opacity"
|
|
203
|
+
>
|
|
204
|
+
Run Body Scan
|
|
205
|
+
</button>
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
)}
|
|
210
|
+
</div>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export default StyllarPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as StyllarPlugin } from './StyllarPlugin';
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import { resolve } from 'path'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [react()],
|
|
7
|
+
build: {
|
|
8
|
+
lib: {
|
|
9
|
+
// This tells the bundler where your "front door" is
|
|
10
|
+
entry: resolve(__dirname, 'src/index.js'),
|
|
11
|
+
name: 'StyllarReactPlugin',
|
|
12
|
+
fileName: 'styllar-react-plugin'
|
|
13
|
+
},
|
|
14
|
+
rollupOptions: {
|
|
15
|
+
// Make sure it doesn't bundle React itself, since the client already has React!
|
|
16
|
+
external: ['react', 'react-dom'],
|
|
17
|
+
output: {
|
|
18
|
+
globals: {
|
|
19
|
+
react: 'React',
|
|
20
|
+
'react-dom': 'ReactDOM'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|