@happyvertical/smrt-products 0.34.5 → 0.34.7
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/lib/chunks/{ProductForm-p4-xbubZ.js → ProductForm-BLRguem5.js} +268 -148
- package/dist/lib/chunks/ProductForm-BLRguem5.js.map +1 -0
- package/dist/lib/components.js +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/lib/components/ProductCard.svelte +6 -35
- package/dist/lib/lib/components/ProductCard.svelte.d.ts.map +1 -1
- package/dist/lib/lib/components/ProductForm.svelte +96 -148
- package/dist/lib/lib/components/ProductForm.svelte.d.ts.map +1 -1
- package/dist/lib/lib/components/auto-generated/AutoForm.svelte +30 -56
- package/dist/lib/lib/components/auto-generated/AutoForm.svelte.d.ts.map +1 -1
- package/dist/lib/lib/components/auto-generated/FieldRenderer.svelte +8 -37
- package/dist/lib/lib/components/auto-generated/FieldRenderer.svelte.d.ts.map +1 -1
- package/dist/lib/lib/features/ProductCatalog.svelte +27 -45
- package/dist/lib/lib/features/ProductCatalog.svelte.d.ts.map +1 -1
- package/dist/lib/manifest.json +2 -2
- package/dist/lib/smrt-knowledge.json +4 -4
- package/dist/lib/smrt-products.css +9 -91
- package/package.json +8 -7
- package/dist/lib/chunks/ProductForm-p4-xbubZ.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "svelte/internal/disclose-version";
|
|
2
2
|
import * as $ from "svelte/internal/client";
|
|
3
|
+
import { Button } from "@happyvertical/smrt-ui/ui";
|
|
4
|
+
import { Form, Input, Textarea } from "@happyvertical/smrt-ui/forms";
|
|
3
5
|
import { defineMessages, useI18n } from "@happyvertical/smrt-ui/i18n";
|
|
4
6
|
var root_1$1 = $.from_html(`<div class="product-manufacturer svelte-11ja2cl"> </div>`);
|
|
5
7
|
var root_2$1 = $.from_html(`<div class="product-model svelte-11ja2cl"> </div>`);
|
|
@@ -7,8 +9,6 @@ var root_3$1 = $.from_html(`<p class="product-description svelte-11ja2cl"> </p>`
|
|
|
7
9
|
var root_4 = $.from_html(`<div class="product-category svelte-11ja2cl"> </div>`);
|
|
8
10
|
var root_6 = $.from_html(`<span class="tag svelte-11ja2cl"> </span>`);
|
|
9
11
|
var root_5 = $.from_html(`<div class="product-tags svelte-11ja2cl"></div>`);
|
|
10
|
-
var root_7 = $.from_html(`<button type="button" class="edit-btn svelte-11ja2cl">Edit</button>`);
|
|
11
|
-
var root_8 = $.from_html(`<button type="button" class="delete-btn svelte-11ja2cl">Delete</button>`);
|
|
12
12
|
var root$1 = $.from_html(`<div class="product-card svelte-11ja2cl"><div class="product-header svelte-11ja2cl"><h3 class="product-name svelte-11ja2cl"> </h3> <!></div> <!> <!> <div class="product-meta svelte-11ja2cl"><!> <!></div> <div class="product-actions svelte-11ja2cl"><!> <!></div></div>`);
|
|
13
13
|
function ProductCard($$anchor, $$props) {
|
|
14
14
|
$.push($$props, true);
|
|
@@ -94,9 +94,18 @@ function ProductCard($$anchor, $$props) {
|
|
|
94
94
|
var node_5 = $.child(div_7);
|
|
95
95
|
{
|
|
96
96
|
var consequent_5 = ($$anchor2) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
Button($$anchor2, {
|
|
98
|
+
type: "button",
|
|
99
|
+
variant: "secondary",
|
|
100
|
+
size: "sm",
|
|
101
|
+
onclick: () => $$props.onEdit?.($$props.product),
|
|
102
|
+
children: ($$anchor3, $$slotProps) => {
|
|
103
|
+
$.next();
|
|
104
|
+
var text_6 = $.text("Edit");
|
|
105
|
+
$.append($$anchor3, text_6);
|
|
106
|
+
},
|
|
107
|
+
$$slots: { default: true }
|
|
108
|
+
});
|
|
100
109
|
};
|
|
101
110
|
$.if(node_5, ($$render) => {
|
|
102
111
|
if ($$props.onEdit) $$render(consequent_5);
|
|
@@ -105,9 +114,18 @@ function ProductCard($$anchor, $$props) {
|
|
|
105
114
|
var node_6 = $.sibling(node_5, 2);
|
|
106
115
|
{
|
|
107
116
|
var consequent_6 = ($$anchor2) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
Button($$anchor2, {
|
|
118
|
+
type: "button",
|
|
119
|
+
variant: "danger",
|
|
120
|
+
size: "sm",
|
|
121
|
+
onclick: () => $$props.onDelete?.($$props.product.id),
|
|
122
|
+
children: ($$anchor3, $$slotProps) => {
|
|
123
|
+
$.next();
|
|
124
|
+
var text_7 = $.text("Delete");
|
|
125
|
+
$.append($$anchor3, text_7);
|
|
126
|
+
},
|
|
127
|
+
$$slots: { default: true }
|
|
128
|
+
});
|
|
111
129
|
};
|
|
112
130
|
$.if(node_6, ($$render) => {
|
|
113
131
|
if ($$props.onDelete) $$render(consequent_6);
|
|
@@ -119,7 +137,6 @@ function ProductCard($$anchor, $$props) {
|
|
|
119
137
|
$.append($$anchor, div);
|
|
120
138
|
$.pop();
|
|
121
139
|
}
|
|
122
|
-
$.delegate(["click"]);
|
|
123
140
|
const M = defineMessages({
|
|
124
141
|
// App
|
|
125
142
|
"products.app.categories_coming_soon": "Category management coming soon...",
|
|
@@ -208,10 +225,10 @@ const M = defineMessages({
|
|
|
208
225
|
"products.product_catalog.create_first": "Create First Product",
|
|
209
226
|
"products.product_catalog.no_match": "No products match your search criteria."
|
|
210
227
|
});
|
|
211
|
-
var root_1 = $.from_html(`<span class="error-message svelte-1hh5ovx"> </span>`);
|
|
212
228
|
var root_2 = $.from_html(`<span class="error-message svelte-1hh5ovx"> </span>`);
|
|
213
|
-
var root_3 = $.from_html(`<
|
|
214
|
-
var
|
|
229
|
+
var root_3 = $.from_html(`<span class="error-message svelte-1hh5ovx"> </span>`);
|
|
230
|
+
var root_1 = $.from_html(`<div class="form-group svelte-1hh5ovx"><label for="name" class="svelte-1hh5ovx"> </label> <!> <!></div> <div class="form-group svelte-1hh5ovx"><label for="description" class="svelte-1hh5ovx">Description</label> <!></div> <div class="form-row svelte-1hh5ovx"><div class="form-group svelte-1hh5ovx"><label for="price" class="svelte-1hh5ovx">Price *</label> <!> <!></div> <div class="form-group svelte-1hh5ovx"><label for="category" class="svelte-1hh5ovx">Category</label> <!></div></div> <div class="form-group svelte-1hh5ovx"><label for="tags" class="svelte-1hh5ovx">Tags</label> <!> <small class="form-hint svelte-1hh5ovx"> </small></div> <div class="form-group svelte-1hh5ovx"><label class="checkbox-label svelte-1hh5ovx"><input type="checkbox" class="form-checkbox svelte-1hh5ovx"/> </label></div> <div class="form-actions svelte-1hh5ovx"><!> <!></div>`, 1);
|
|
231
|
+
var root = $.from_html(`<div class="product-form-shell svelte-1hh5ovx"><!></div>`);
|
|
215
232
|
function ProductForm($$anchor, $$props) {
|
|
216
233
|
$.push($$props, true);
|
|
217
234
|
const { t } = useI18n();
|
|
@@ -251,147 +268,250 @@ function ProductForm($$anchor, $$props) {
|
|
|
251
268
|
};
|
|
252
269
|
$$props.onSubmit(productData);
|
|
253
270
|
}
|
|
254
|
-
var
|
|
255
|
-
var
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
$.
|
|
325
|
-
|
|
271
|
+
var div = root();
|
|
272
|
+
var node = $.child(div);
|
|
273
|
+
Form(node, {
|
|
274
|
+
onsubmit: handleSubmit,
|
|
275
|
+
class: "product-form",
|
|
276
|
+
children: ($$anchor2, $$slotProps) => {
|
|
277
|
+
var fragment = root_1();
|
|
278
|
+
var div_1 = $.first_child(fragment);
|
|
279
|
+
var label = $.child(div_1);
|
|
280
|
+
var text = $.child(label, true);
|
|
281
|
+
$.reset(label);
|
|
282
|
+
var node_1 = $.sibling(label, 2);
|
|
283
|
+
{
|
|
284
|
+
let $0 = $.derived(() => $.get(errors).name ? "error" : "");
|
|
285
|
+
let $1 = $.derived(() => t(M["products.product_form.name_placeholder"]));
|
|
286
|
+
Input(node_1, {
|
|
287
|
+
id: "name",
|
|
288
|
+
type: "text",
|
|
289
|
+
get disabled() {
|
|
290
|
+
return loading();
|
|
291
|
+
},
|
|
292
|
+
get class() {
|
|
293
|
+
return $.get($0);
|
|
294
|
+
},
|
|
295
|
+
get placeholder() {
|
|
296
|
+
return $.get($1);
|
|
297
|
+
},
|
|
298
|
+
get value() {
|
|
299
|
+
return formData.name;
|
|
300
|
+
},
|
|
301
|
+
set value($$value) {
|
|
302
|
+
formData.name = $$value;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
var node_2 = $.sibling(node_1, 2);
|
|
307
|
+
{
|
|
308
|
+
var consequent = ($$anchor3) => {
|
|
309
|
+
var span = root_2();
|
|
310
|
+
var text_1 = $.child(span, true);
|
|
311
|
+
$.reset(span);
|
|
312
|
+
$.template_effect(() => $.set_text(text_1, $.get(errors).name));
|
|
313
|
+
$.append($$anchor3, span);
|
|
314
|
+
};
|
|
315
|
+
$.if(node_2, ($$render) => {
|
|
316
|
+
if ($.get(errors).name) $$render(consequent);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
$.reset(div_1);
|
|
320
|
+
var div_2 = $.sibling(div_1, 2);
|
|
321
|
+
var node_3 = $.sibling($.child(div_2), 2);
|
|
322
|
+
{
|
|
323
|
+
let $0 = $.derived(() => t(M["products.product_form.description_placeholder"]));
|
|
324
|
+
Textarea(node_3, {
|
|
325
|
+
id: "description",
|
|
326
|
+
get disabled() {
|
|
327
|
+
return loading();
|
|
328
|
+
},
|
|
329
|
+
get placeholder() {
|
|
330
|
+
return $.get($0);
|
|
331
|
+
},
|
|
332
|
+
rows: 3,
|
|
333
|
+
get value() {
|
|
334
|
+
return formData.description;
|
|
335
|
+
},
|
|
336
|
+
set value($$value) {
|
|
337
|
+
formData.description = $$value;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
$.reset(div_2);
|
|
342
|
+
var div_3 = $.sibling(div_2, 2);
|
|
343
|
+
var div_4 = $.child(div_3);
|
|
344
|
+
var node_4 = $.sibling($.child(div_4), 2);
|
|
345
|
+
{
|
|
346
|
+
let $0 = $.derived(() => $.get(errors).price ? "error" : "");
|
|
347
|
+
Input(node_4, {
|
|
348
|
+
id: "price",
|
|
349
|
+
type: "number",
|
|
350
|
+
step: "0.01",
|
|
351
|
+
min: "0",
|
|
352
|
+
get disabled() {
|
|
353
|
+
return loading();
|
|
354
|
+
},
|
|
355
|
+
get class() {
|
|
356
|
+
return $.get($0);
|
|
357
|
+
},
|
|
358
|
+
placeholder: "0.00",
|
|
359
|
+
get value() {
|
|
360
|
+
return formData.price;
|
|
361
|
+
},
|
|
362
|
+
set value($$value) {
|
|
363
|
+
formData.price = $$value;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
var node_5 = $.sibling(node_4, 2);
|
|
368
|
+
{
|
|
369
|
+
var consequent_1 = ($$anchor3) => {
|
|
370
|
+
var span_1 = root_3();
|
|
371
|
+
var text_2 = $.child(span_1, true);
|
|
372
|
+
$.reset(span_1);
|
|
373
|
+
$.template_effect(() => $.set_text(text_2, $.get(errors).price));
|
|
374
|
+
$.append($$anchor3, span_1);
|
|
375
|
+
};
|
|
376
|
+
$.if(node_5, ($$render) => {
|
|
377
|
+
if ($.get(errors).price) $$render(consequent_1);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
$.reset(div_4);
|
|
381
|
+
var div_5 = $.sibling(div_4, 2);
|
|
382
|
+
var node_6 = $.sibling($.child(div_5), 2);
|
|
383
|
+
{
|
|
384
|
+
let $0 = $.derived(() => t(M["products.product_form.category_placeholder"]));
|
|
385
|
+
Input(node_6, {
|
|
386
|
+
id: "category",
|
|
387
|
+
type: "text",
|
|
388
|
+
get disabled() {
|
|
389
|
+
return loading();
|
|
390
|
+
},
|
|
391
|
+
get placeholder() {
|
|
392
|
+
return $.get($0);
|
|
393
|
+
},
|
|
394
|
+
get value() {
|
|
395
|
+
return formData.category;
|
|
396
|
+
},
|
|
397
|
+
set value($$value) {
|
|
398
|
+
formData.category = $$value;
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
$.reset(div_5);
|
|
403
|
+
$.reset(div_3);
|
|
404
|
+
var div_6 = $.sibling(div_3, 2);
|
|
405
|
+
var node_7 = $.sibling($.child(div_6), 2);
|
|
406
|
+
{
|
|
407
|
+
let $0 = $.derived(() => t(M["products.product_form.tags_placeholder"]));
|
|
408
|
+
Input(node_7, {
|
|
409
|
+
id: "tags",
|
|
410
|
+
type: "text",
|
|
411
|
+
get disabled() {
|
|
412
|
+
return loading();
|
|
413
|
+
},
|
|
414
|
+
get placeholder() {
|
|
415
|
+
return $.get($0);
|
|
416
|
+
},
|
|
417
|
+
get value() {
|
|
418
|
+
return formData.tags;
|
|
419
|
+
},
|
|
420
|
+
set value($$value) {
|
|
421
|
+
formData.tags = $$value;
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
var small = $.sibling(node_7, 2);
|
|
426
|
+
var text_3 = $.child(small, true);
|
|
427
|
+
$.reset(small);
|
|
428
|
+
$.reset(div_6);
|
|
429
|
+
var div_7 = $.sibling(div_6, 2);
|
|
430
|
+
var label_1 = $.child(div_7);
|
|
431
|
+
var input = $.child(label_1);
|
|
432
|
+
$.remove_input_defaults(input);
|
|
433
|
+
var text_4 = $.sibling(input);
|
|
434
|
+
$.reset(label_1);
|
|
435
|
+
$.reset(div_7);
|
|
436
|
+
var div_8 = $.sibling(div_7, 2);
|
|
437
|
+
var node_8 = $.child(div_8);
|
|
438
|
+
{
|
|
439
|
+
var consequent_2 = ($$anchor3) => {
|
|
440
|
+
Button($$anchor3, {
|
|
441
|
+
type: "button",
|
|
442
|
+
variant: "secondary",
|
|
443
|
+
get onclick() {
|
|
444
|
+
return $$props.onCancel;
|
|
445
|
+
},
|
|
446
|
+
get disabled() {
|
|
447
|
+
return loading();
|
|
448
|
+
},
|
|
449
|
+
children: ($$anchor4, $$slotProps2) => {
|
|
450
|
+
$.next();
|
|
451
|
+
var text_5 = $.text("Cancel");
|
|
452
|
+
$.append($$anchor4, text_5);
|
|
453
|
+
},
|
|
454
|
+
$$slots: { default: true }
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
$.if(node_8, ($$render) => {
|
|
458
|
+
if ($$props.onCancel) $$render(consequent_2);
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
var node_9 = $.sibling(node_8, 2);
|
|
462
|
+
Button(node_9, {
|
|
463
|
+
type: "submit",
|
|
464
|
+
variant: "primary",
|
|
465
|
+
get disabled() {
|
|
466
|
+
return loading();
|
|
467
|
+
},
|
|
468
|
+
children: ($$anchor3, $$slotProps2) => {
|
|
469
|
+
var fragment_2 = $.comment();
|
|
470
|
+
var node_10 = $.first_child(fragment_2);
|
|
471
|
+
{
|
|
472
|
+
var consequent_3 = ($$anchor4) => {
|
|
473
|
+
var text_6 = $.text("Saving...");
|
|
474
|
+
$.append($$anchor4, text_6);
|
|
475
|
+
};
|
|
476
|
+
var alternate = ($$anchor4) => {
|
|
477
|
+
var text_7 = $.text();
|
|
478
|
+
$.template_effect(() => $.set_text(text_7, product().id ? "Update Product" : "Create Product"));
|
|
479
|
+
$.append($$anchor4, text_7);
|
|
480
|
+
};
|
|
481
|
+
$.if(node_10, ($$render) => {
|
|
482
|
+
if (loading()) $$render(consequent_3);
|
|
483
|
+
else $$render(alternate, -1);
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
$.append($$anchor3, fragment_2);
|
|
487
|
+
},
|
|
488
|
+
$$slots: { default: true }
|
|
326
489
|
});
|
|
327
|
-
$.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
$.
|
|
343
|
-
$.append($$anchor2, text_6);
|
|
344
|
-
};
|
|
345
|
-
$.if(node_3, ($$render) => {
|
|
346
|
-
if (loading()) $$render(consequent_3);
|
|
347
|
-
else $$render(alternate, -1);
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
$.reset(button_1);
|
|
351
|
-
$.reset(div_7);
|
|
352
|
-
$.reset(form);
|
|
353
|
-
$.template_effect(
|
|
354
|
-
($0, $1, $2, $3, $4, $5, $6) => {
|
|
355
|
-
$.set_text(text, $0);
|
|
356
|
-
input.disabled = loading();
|
|
357
|
-
classes = $.set_class(input, 1, "form-input svelte-1hh5ovx", null, classes, { error: $.get(errors).name });
|
|
358
|
-
$.set_attribute(input, "placeholder", $1);
|
|
359
|
-
textarea.disabled = loading();
|
|
360
|
-
$.set_attribute(textarea, "placeholder", $2);
|
|
361
|
-
input_1.disabled = loading();
|
|
362
|
-
classes_1 = $.set_class(input_1, 1, "form-input svelte-1hh5ovx", null, classes_1, { error: $.get(errors).price });
|
|
363
|
-
input_2.disabled = loading();
|
|
364
|
-
$.set_attribute(input_2, "placeholder", $3);
|
|
365
|
-
input_3.disabled = loading();
|
|
366
|
-
$.set_attribute(input_3, "placeholder", $4);
|
|
367
|
-
$.set_text(text_3, $5);
|
|
368
|
-
input_4.disabled = loading();
|
|
369
|
-
$.set_text(text_4, ` ${$6 ?? ""}`);
|
|
370
|
-
button_1.disabled = loading();
|
|
490
|
+
$.reset(div_8);
|
|
491
|
+
$.template_effect(
|
|
492
|
+
($0, $1, $2) => {
|
|
493
|
+
$.set_text(text, $0);
|
|
494
|
+
$.set_text(text_3, $1);
|
|
495
|
+
input.disabled = loading();
|
|
496
|
+
$.set_text(text_4, ` ${$2 ?? ""}`);
|
|
497
|
+
},
|
|
498
|
+
[
|
|
499
|
+
() => t(M["products.product_form.name_label"]),
|
|
500
|
+
() => t(M["products.product_form.tags_hint"]),
|
|
501
|
+
() => t(M["products.product_form.in_stock_label"])
|
|
502
|
+
]
|
|
503
|
+
);
|
|
504
|
+
$.bind_checked(input, () => formData.inStock, ($$value) => formData.inStock = $$value);
|
|
505
|
+
$.append($$anchor2, fragment);
|
|
371
506
|
},
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
() => t(M["products.product_form.category_placeholder"]),
|
|
377
|
-
() => t(M["products.product_form.tags_placeholder"]),
|
|
378
|
-
() => t(M["products.product_form.tags_hint"]),
|
|
379
|
-
() => t(M["products.product_form.in_stock_label"])
|
|
380
|
-
]
|
|
381
|
-
);
|
|
382
|
-
$.event("submit", form, handleSubmit);
|
|
383
|
-
$.bind_value(input, () => formData.name, ($$value) => formData.name = $$value);
|
|
384
|
-
$.bind_value(textarea, () => formData.description, ($$value) => formData.description = $$value);
|
|
385
|
-
$.bind_value(input_1, () => formData.price, ($$value) => formData.price = $$value);
|
|
386
|
-
$.bind_value(input_2, () => formData.category, ($$value) => formData.category = $$value);
|
|
387
|
-
$.bind_value(input_3, () => formData.tags, ($$value) => formData.tags = $$value);
|
|
388
|
-
$.bind_checked(input_4, () => formData.inStock, ($$value) => formData.inStock = $$value);
|
|
389
|
-
$.append($$anchor, form);
|
|
507
|
+
$$slots: { default: true }
|
|
508
|
+
});
|
|
509
|
+
$.reset(div);
|
|
510
|
+
$.append($$anchor, div);
|
|
390
511
|
$.pop();
|
|
391
512
|
}
|
|
392
|
-
$.delegate(["click"]);
|
|
393
513
|
export {
|
|
394
514
|
ProductCard as P,
|
|
395
515
|
ProductForm as a
|
|
396
516
|
};
|
|
397
|
-
//# sourceMappingURL=ProductForm-
|
|
517
|
+
//# sourceMappingURL=ProductForm-BLRguem5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductForm-BLRguem5.js","sources":["../../../src/lib/components/ProductCard.svelte","../../../src/lib/i18n.ts","../../../src/lib/components/ProductForm.svelte"],"sourcesContent":["<script lang=\"ts\">\nimport { Button } from '@happyvertical/smrt-ui/ui';\nimport type { ProductData } from '../types';\n\ninterface Props {\n product: ProductData;\n onEdit?: (product: ProductData) => void;\n onDelete?: (id: string) => void;\n}\n\nconst { product, onEdit, onDelete }: Props = $props();\n</script>\n\n<div class=\"product-card\">\n <div class=\"product-header\">\n <h3 class=\"product-name\">{product.name}</h3>\n {#if product.manufacturer}\n <div class=\"product-manufacturer\">{product.manufacturer}</div>\n {/if}\n </div>\n\n {#if product.model}\n <div class=\"product-model\">Model: {product.model}</div>\n {/if}\n\n {#if product.description}\n <p class=\"product-description\">{product.description}</p>\n {/if}\n\n <div class=\"product-meta\">\n {#if product.category}\n <div class=\"product-category\">Category: {product.category}</div>\n {/if}\n \n {#if product.tags && product.tags.length > 0}\n <div class=\"product-tags\">\n {#each product.tags as tag}\n <span class=\"tag\">{tag}</span>\n {/each}\n </div>\n {/if}\n </div>\n \n <div class=\"product-actions\">\n {#if onEdit}\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onclick={() => onEdit?.(product)}>\n Edit\n </Button>\n {/if}\n\n {#if onDelete}\n <Button type=\"button\" variant=\"danger\" size=\"sm\" onclick={() => onDelete?.(product.id)}>\n Delete\n </Button>\n {/if}\n </div>\n</div>\n\n<style>\n .product-card {\n border: 1px solid var(--smrt-color-outline-variant, #e2e8f0);\n border-radius: var(--smrt-radius-md, 8px);\n padding: 1rem;\n background: var(--smrt-color-surface, #fff);\n box-shadow: var(--smrt-elevation-1, 0 1px 3px color-mix(in srgb, var(--smrt-color-shadow, #000) 10%, transparent));\n transition: box-shadow 0.2s;\n }\n\n .product-card:hover {\n box-shadow: var(--smrt-elevation-2, 0 4px 6px color-mix(in srgb, var(--smrt-color-shadow, #000) 10%, transparent));\n }\n \n .product-header {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n margin-bottom: 0.5rem;\n }\n \n .product-name {\n margin: 0;\n font-size: var(--smrt-typography-title-medium-size, 1.125rem);\n font-weight: var(--smrt-typography-weight-semibold, 600);\n color: var(--smrt-color-on-surface, #1f2937);\n }\n\n .product-manufacturer {\n font-size: var(--smrt-typography-title-small-size, 0.875rem);\n font-weight: var(--smrt-typography-weight-medium, 500);\n color: var(--smrt-color-on-surface-variant, #6b7280);\n }\n\n .product-model {\n font-size: var(--smrt-typography-body-medium-size, 0.875rem);\n color: var(--smrt-color-on-surface-variant, #6b7280);\n margin-bottom: 0.5rem;\n }\n\n .product-category {\n font-size: var(--smrt-typography-label-medium-size, 0.75rem);\n font-weight: var(--smrt-typography-weight-medium, 500);\n color: var(--smrt-color-on-surface, #374151);\n background: var(--smrt-color-surface-container, #f3f4f6);\n padding: 0.25rem 0.5rem;\n border-radius: var(--smrt-radius-sm, 4px);\n display: inline-block;\n margin-bottom: 0.5rem;\n }\n \n .product-description {\n margin: 0.5rem 0;\n color: var(--smrt-color-on-surface-variant, #6b7280);\n font-size: var(--smrt-typography-body-medium-size, 0.875rem);\n line-height: var(--smrt-typography-body-medium-line-height, 1.4);\n }\n \n .product-meta {\n margin: 0.75rem 0;\n }\n \n \n .product-tags {\n margin-top: 0.5rem;\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n }\n \n .tag {\n background: var(--smrt-color-surface-container, #f3f4f6);\n color: var(--smrt-color-on-surface, #374151);\n padding: 0.125rem 0.5rem;\n border-radius: var(--smrt-radius-full, 9999px);\n font-size: var(--smrt-typography-label-medium-size, 0.75rem);\n }\n\n .product-actions {\n display: flex;\n gap: 0.5rem;\n margin-top: 1rem;\n padding-top: 0.75rem;\n border-top: 1px solid var(--smrt-color-outline-variant, #f3f4f6);\n }\n</style>","import { defineMessages } from '@happyvertical/smrt-ui/i18n';\n\nexport const M = defineMessages({\n // App\n 'products.app.categories_coming_soon': 'Category management coming soon...',\n 'products.app.analytics_coming_soon': 'Analytics dashboard coming soon...',\n\n // AppLayout\n 'products.app_layout.service_title': 'Product Service',\n 'products.app_layout.footer_copyright':\n '2024 SMRT Product Service - Auto-generated with ❤️',\n 'products.app_layout.api_docs': 'API Docs',\n 'products.app_layout.mcp_tools': 'MCP Tools',\n\n // DemoPage\n 'products.demo_page.title': 'SMRT Framework Demo',\n 'products.demo_page.subtitle':\n 'Define Once, Consume Everywhere - Progressive Customization',\n 'products.demo_page.custom_components_tab': 'Custom Components',\n 'products.demo_page.auto_generated_heading':\n 'Auto-Generated UI from SMRT Object',\n 'products.demo_page.auto_generated_description':\n 'This form is automatically generated from the Product class definition.\\n The field types, labels, and validation rules are inferred from the TypeScript schema.',\n 'products.demo_page.generated_form_heading': 'Generated Form',\n 'products.demo_page.auto_form_title': 'Auto-Generated Product Form',\n 'products.demo_page.generated_display_heading': 'Generated Display',\n 'products.demo_page.custom_components_heading':\n 'Custom Components with SMRT Integration',\n 'products.demo_page.custom_components_description':\n 'These are hand-crafted components that still leverage the SMRT data structure\\n but provide custom UI/UX for specific business requirements.',\n 'products.demo_page.custom_form_heading': 'Custom Form',\n 'products.demo_page.custom_display_heading': 'Custom Display',\n 'products.demo_page.progressive_heading': 'Progressive Customization',\n 'products.demo_page.progressive_description':\n 'Start with auto-generated components, then progressively customize as needed.\\n Both approaches use the same underlying SMRT Product model.',\n 'products.demo_page.feature_zero_config': '✅ Zero configuration',\n 'products.demo_page.feature_instant_ui': '✅ Instant UI from schema',\n 'products.demo_page.feature_type_safe': '✅ Type-safe by default',\n 'products.demo_page.feature_prototyping': '⚡ Perfect for prototyping',\n 'products.demo_page.custom_components_label': '🎨 Custom Components',\n 'products.demo_page.feature_tailored_ux': '✅ Tailored UX',\n 'products.demo_page.feature_business_workflows':\n '✅ Business-specific workflows',\n 'products.demo_page.feature_advanced_interactions':\n '✅ Advanced interactions',\n 'products.demo_page.simple_auto_form_title': 'Auto Form',\n 'products.demo_page.benefits_heading': 'SMRT Framework Benefits',\n 'products.demo_page.benefit_define_once_label': 'Define Once:',\n 'products.demo_page.benefit_define_once_text':\n 'Product class with @smrt decorator',\n 'products.demo_page.benefit_auto_generate_label': 'Auto-Generate:',\n 'products.demo_page.benefit_auto_generate_text':\n 'REST APIs, MCP tools, TypeScript clients, default UI',\n 'products.demo_page.benefit_progressive_label': 'Progressive Enhancement:',\n 'products.demo_page.benefit_progressive_text':\n 'Start with defaults, customize as needed',\n 'products.demo_page.benefit_type_safety_label': 'Type Safety:',\n 'products.demo_page.benefit_type_safety_text':\n 'End-to-end TypeScript integration',\n 'products.demo_page.benefit_multiple_consumption_label':\n 'Multiple Consumption:',\n 'products.demo_page.benefit_multiple_consumption_text':\n 'Library, federation, standalone',\n\n // ProductsPage\n 'products.products_page.description':\n 'Manage your product catalog with auto-generated CRUD operations, \\n real-time updates, and AI-powered tools via MCP.',\n 'products.products_page.auto_generated_text':\n 'REST API endpoints automatically created from @smrt() decorated Product class',\n 'products.products_page.ai_ready_heading': '🤖 AI Ready',\n 'products.products_page.ai_ready_text':\n 'MCP tools available for Claude and other AI models to interact with products',\n 'products.products_page.federatable_text':\n 'Components can be consumed by other applications via module federation',\n 'products.products_page.library_text':\n 'Install as NPM package: npm install @have/smrt-template',\n\n // ProductForm\n 'products.product_form.name_label': 'Product Name *',\n 'products.product_form.name_placeholder': 'Enter product name',\n 'products.product_form.description_placeholder':\n 'Product description (optional)',\n 'products.product_form.category_placeholder': 'Product category',\n 'products.product_form.tags_placeholder': 'tag1, tag2, tag3',\n 'products.product_form.tags_hint': 'Separate tags with commas',\n 'products.product_form.in_stock_label': 'In Stock',\n\n // TestComponent\n 'products.test_component.title': 'Test Component',\n\n // AutoForm\n 'products.auto_form.subtitle': 'Auto-generated from SMRT Product model',\n 'products.auto_form.debug_summary': 'Form Data (Debug)',\n\n // FieldRenderer\n 'products.field_renderer.array_hint': 'Enter values separated by commas',\n 'products.field_renderer.object_hint': 'Enter valid JSON',\n\n // CategoryManager\n 'products.category_manager.title': 'Category Manager',\n 'products.category_manager.subtitle': 'Manage product categories',\n 'products.category_manager.coming_soon':\n 'Category management feature coming soon...',\n 'products.category_manager.will_include': 'This will include:',\n 'products.category_manager.create_edit': 'Create and edit categories',\n 'products.category_manager.organize_hierarchy': 'Organize category hierarchy',\n 'products.category_manager.manage_permissions': 'Manage category permissions',\n 'products.category_manager.analytics': 'Category analytics',\n\n // ProductCatalog\n 'products.product_catalog.title': 'Product Catalog',\n 'products.product_catalog.in_stock': 'in stock',\n 'products.product_catalog.total_value': 'Total value:',\n 'products.product_catalog.search_placeholder': 'Search products...',\n 'products.product_catalog.all_categories': 'All Categories',\n 'products.product_catalog.add_product': 'Add Product',\n 'products.product_catalog.loading': 'Loading products...',\n 'products.product_catalog.empty':\n 'No products yet. Create your first product to get started!',\n 'products.product_catalog.create_first': 'Create First Product',\n 'products.product_catalog.no_match':\n 'No products match your search criteria.',\n});\n","<script lang=\"ts\">\nimport { Form, Input, Textarea } from '@happyvertical/smrt-ui/forms';\nimport { useI18n } from '@happyvertical/smrt-ui/i18n';\nimport { Button } from '@happyvertical/smrt-ui/ui';\nimport { M } from '../i18n.js';\nimport type { ProductData } from '../types';\n\nconst { t } = useI18n();\n\ninterface Props {\n product?: Partial<ProductData>;\n onSubmit: (product: Partial<ProductData>) => void;\n onCancel?: () => void;\n loading?: boolean;\n}\n\nconst { product = {}, onSubmit, onCancel, loading = false }: Props = $props();\n\nconst formData = $state({\n name: product.name || '',\n description: product.description || '',\n price: product.price || 0,\n inStock: product.inStock ?? true,\n category: product.category || '',\n tags: product.tags?.join(', ') || '',\n});\n\nlet errors = $state<Record<string, string>>({});\n\nfunction validateForm() {\n errors = {};\n\n if (!formData.name.trim()) {\n errors.name = 'Product name is required';\n }\n\n if (formData.price < 0) {\n errors.price = 'Price must be non-negative';\n }\n\n return Object.keys(errors).length === 0;\n}\n\nfunction handleSubmit(event: Event) {\n event.preventDefault();\n\n if (!validateForm()) {\n return;\n }\n\n const productData: Partial<ProductData> = {\n ...product,\n name: formData.name.trim(),\n description: formData.description.trim() || undefined,\n price: formData.price,\n inStock: formData.inStock,\n category: formData.category.trim(),\n tags: formData.tags\n ? formData.tags\n .split(',')\n .map((tag) => tag.trim())\n .filter(Boolean)\n : [],\n };\n\n onSubmit(productData);\n}\n</script>\n\n<div class=\"product-form-shell\">\n <Form onsubmit={handleSubmit} class=\"product-form\">\n <div class=\"form-group\">\n <label for=\"name\">{t(M['products.product_form.name_label'])}</label>\n <Input\n id=\"name\"\n type=\"text\"\n bind:value={formData.name}\n disabled={loading}\n class={errors.name ? 'error' : ''}\n placeholder={t(M['products.product_form.name_placeholder'])}\n />\n {#if errors.name}\n <span class=\"error-message\">{errors.name}</span>\n {/if}\n </div>\n\n <div class=\"form-group\">\n <label for=\"description\">Description</label>\n <Textarea\n id=\"description\"\n bind:value={formData.description}\n disabled={loading}\n placeholder={t(M['products.product_form.description_placeholder'])}\n rows={3}\n ></Textarea>\n </div>\n\n <div class=\"form-row\">\n <div class=\"form-group\">\n <label for=\"price\">Price *</label>\n <Input\n id=\"price\"\n type=\"number\"\n step=\"0.01\"\n min=\"0\"\n bind:value={formData.price}\n disabled={loading}\n class={errors.price ? 'error' : ''}\n placeholder=\"0.00\"\n />\n {#if errors.price}\n <span class=\"error-message\">{errors.price}</span>\n {/if}\n </div>\n\n <div class=\"form-group\">\n <label for=\"category\">Category</label>\n <Input\n id=\"category\"\n type=\"text\"\n bind:value={formData.category}\n disabled={loading}\n placeholder={t(M['products.product_form.category_placeholder'])}\n />\n </div>\n </div>\n\n <div class=\"form-group\">\n <label for=\"tags\">Tags</label>\n <Input\n id=\"tags\"\n type=\"text\"\n bind:value={formData.tags}\n disabled={loading}\n placeholder={t(M['products.product_form.tags_placeholder'])}\n />\n <small class=\"form-hint\">{t(M['products.product_form.tags_hint'])}</small>\n </div>\n\n <div class=\"form-group\">\n <label class=\"checkbox-label\">\n <!-- raw-primitive-allow: native checkbox; no Provider-free checkbox primitive (Toggle is a switch with different semantics, CheckboxInput requires a Provider) -->\n <input\n type=\"checkbox\"\n bind:checked={formData.inStock}\n disabled={loading}\n class=\"form-checkbox\"\n />\n {t(M['products.product_form.in_stock_label'])}\n </label>\n </div>\n\n <div class=\"form-actions\">\n {#if onCancel}\n <Button type=\"button\" variant=\"secondary\" onclick={onCancel} disabled={loading}>\n Cancel\n </Button>\n {/if}\n\n <Button type=\"submit\" variant=\"primary\" disabled={loading}>\n {#if loading}\n Saving...\n {:else}\n {product.id ? 'Update Product' : 'Create Product'}\n {/if}\n </Button>\n </div>\n </Form>\n</div>\n\n<style>\n .product-form-shell :global(.product-form) {\n max-width: 500px;\n padding: 1.5rem;\n background: var(--smrt-color-surface, #fff);\n border-radius: var(--smrt-radius-md, 8px);\n border: 1px solid var(--smrt-color-outline-variant, #e2e8f0);\n }\n\n .form-group {\n margin-bottom: 1rem;\n }\n\n .form-row {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 1rem;\n }\n\n label {\n display: block;\n margin-bottom: 0.25rem;\n font-weight: var(--smrt-typography-weight-medium, 500);\n color: var(--smrt-color-on-surface, #374151);\n font-size: var(--smrt-typography-label-large-size, 0.875rem);\n }\n\n /* Error border on the migrated <Input>. The primitive renders the inner\n <input class=\"input error\"> inside its own component, so the scoped class\n can't reach it without :global (#1589). */\n .product-form-shell :global(.input.error) {\n border-color: var(--smrt-color-error, #dc2626);\n }\n\n .checkbox-label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n cursor: pointer;\n }\n \n .form-checkbox {\n width: auto;\n }\n \n .form-hint {\n color: var(--smrt-color-on-surface-variant, #6b7280);\n font-size: var(--smrt-typography-body-small-size, 0.75rem);\n margin-top: 0.25rem;\n }\n\n .error-message {\n color: var(--smrt-color-error, #dc2626);\n font-size: var(--smrt-typography-label-medium-size, 0.75rem);\n margin-top: 0.25rem;\n display: block;\n }\n\n .form-actions {\n display: flex;\n gap: 0.75rem;\n justify-content: flex-end;\n margin-top: 1.5rem;\n padding-top: 1rem;\n border-top: 1px solid var(--smrt-color-outline-variant, #f3f4f6);\n }\n</style>"],"names":["root","root_1","root_2","root_3","$$anchor"],"mappings":";;;;;;;;;;;;wCAAA;;MAaC,MAAGA,OAAA;AACD,MAAA,gBADF,GAAG;AAEC,MAAA,aADF,KAAG;qBACD,IAAE,IAAA;UAAF,EAAE;uBAAF,IAAE,CAAA;;;UAEA,QAAGC,SAAA;2BAAH,OAAG,IAAA;cAAH,KAAG;iEAAuC,YAAY,CAAA;0BAAtD,KAAG;AAAA;;0BADO,aAAY,UAAA,UAAA;AAAA;;UAF1B,KAAG;yBAAH,OAAG,CAAA;;;UAQD,QAAGC,SAAA;2BAAH,KAAG;cAAH,KAAG;2EAAuC,SAAK,EAAA,EAAA,CAAA;0BAA/C,KAAG;AAAA;;0BADO,MAAK,UAAA,YAAA;AAAA;;;;;UAKf,IAACC,SAAA;2BAAD,GAAC,IAAA;cAAD,CAAC;iEAAsC,WAAW,CAAA;0BAAlD,CAAC;AAAA;;0BADS,YAAW,UAAA,YAAA;AAAA;;MAIvB,QAAG,EAAA,QAAA,QAAA,CAAA;uBAAH,KAAG;;;UAEC,QAAG,OAAA;2BAAH,KAAG;cAAH,KAAG;8EAA6C,YAAQ,EAAA,EAAA,CAAA;0BAAxD,KAAG;AAAA;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rt/routes";
|
|
7
7
|
import { C, M, P, a, S } from "./chunks/SkuCollection-f_a3k93c.js";
|
|
8
8
|
import { ProductAssetCollection } from "./chunks/ProductAssetCollection-B93HdSlX.js";
|
|
9
|
-
import { P as P2, a as a2 } from "./chunks/ProductForm-
|
|
9
|
+
import { P as P2, a as a2 } from "./chunks/ProductForm-BLRguem5.js";
|
|
10
10
|
import { a as a3 } from "./chunks/index-i3-ci1FB.js";
|
|
11
11
|
import { P as Product, C as Category } from "./chunks/Sku-sl6xf1PR.js";
|
|
12
12
|
import { M as M2, a as a4, b, c, S as S2 } from "./chunks/Sku-sl6xf1PR.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { Button } from '@happyvertical/smrt-ui/ui';
|
|
2
3
|
import type { ProductData } from '../types';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
@@ -42,15 +43,15 @@ const { product, onEdit, onDelete }: Props = $props();
|
|
|
42
43
|
|
|
43
44
|
<div class="product-actions">
|
|
44
45
|
{#if onEdit}
|
|
45
|
-
<
|
|
46
|
+
<Button type="button" variant="secondary" size="sm" onclick={() => onEdit?.(product)}>
|
|
46
47
|
Edit
|
|
47
|
-
</
|
|
48
|
+
</Button>
|
|
48
49
|
{/if}
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
{#if onDelete}
|
|
51
|
-
<
|
|
52
|
+
<Button type="button" variant="danger" size="sm" onclick={() => onDelete?.(product.id)}>
|
|
52
53
|
Delete
|
|
53
|
-
</
|
|
54
|
+
</Button>
|
|
54
55
|
{/if}
|
|
55
56
|
</div>
|
|
56
57
|
</div>
|
|
@@ -140,34 +141,4 @@ const { product, onEdit, onDelete }: Props = $props();
|
|
|
140
141
|
padding-top: 0.75rem;
|
|
141
142
|
border-top: 1px solid var(--smrt-color-outline-variant, #f3f4f6);
|
|
142
143
|
}
|
|
143
|
-
|
|
144
|
-
.edit-btn, .delete-btn {
|
|
145
|
-
padding: 0.375rem 0.75rem;
|
|
146
|
-
border-radius: var(--smrt-radius-sm, 4px);
|
|
147
|
-
font-size: var(--smrt-typography-label-large-size, 0.875rem);
|
|
148
|
-
font-weight: var(--smrt-typography-weight-medium, 500);
|
|
149
|
-
border: 1px solid;
|
|
150
|
-
cursor: pointer;
|
|
151
|
-
transition: all 0.2s;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.edit-btn {
|
|
155
|
-
background: var(--smrt-color-surface-container-low, #f9fafb);
|
|
156
|
-
border-color: var(--smrt-color-outline-variant, #d1d5db);
|
|
157
|
-
color: var(--smrt-color-on-surface, #374151);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.edit-btn:hover {
|
|
161
|
-
background: var(--smrt-color-surface-container, #f3f4f6);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.delete-btn {
|
|
165
|
-
background: var(--smrt-color-error-container, #fef2f2);
|
|
166
|
-
border-color: var(--smrt-color-error, #fecaca);
|
|
167
|
-
color: var(--smrt-color-error, #dc2626);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.delete-btn:hover {
|
|
171
|
-
background: var(--smrt-color-error-container, #fee2e2);
|
|
172
|
-
}
|
|
173
144
|
</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCard.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/ProductCard.svelte"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProductCard.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/ProductCard.svelte"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAyDD,QAAA,MAAM,WAAW,2CAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|