@abraracs/better-shopify-wc-mcp 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.
Files changed (51) hide show
  1. package/README.md +110 -0
  2. package/dist/index.d.ts +10 -0
  3. package/dist/index.js +325 -0
  4. package/docs/avatar.md +481 -0
  5. package/docs/badge.md +266 -0
  6. package/docs/banner.md +350 -0
  7. package/docs/box.md +618 -0
  8. package/docs/button.md +604 -0
  9. package/docs/buttongroup.md +251 -0
  10. package/docs/checkbox.md +346 -0
  11. package/docs/chip.md +261 -0
  12. package/docs/choicelist.md +416 -0
  13. package/docs/clickable.md +703 -0
  14. package/docs/clickablechip.md +377 -0
  15. package/docs/colorfield.md +416 -0
  16. package/docs/colorpicker.md +152 -0
  17. package/docs/datefield.md +706 -0
  18. package/docs/datepicker.md +443 -0
  19. package/docs/divider.md +263 -0
  20. package/docs/dropzone.md +331 -0
  21. package/docs/emailfield.md +377 -0
  22. package/docs/grid.md +1246 -0
  23. package/docs/heading.md +201 -0
  24. package/docs/icon.md +295 -0
  25. package/docs/image.md +517 -0
  26. package/docs/link.md +456 -0
  27. package/docs/menu.md +331 -0
  28. package/docs/modal.md +640 -0
  29. package/docs/moneyfield.md +385 -0
  30. package/docs/numberfield.md +393 -0
  31. package/docs/orderedlist.md +224 -0
  32. package/docs/page.md +319 -0
  33. package/docs/paragraph.md +333 -0
  34. package/docs/passwordfield.md +381 -0
  35. package/docs/popover.md +419 -0
  36. package/docs/querycontainer.md +121 -0
  37. package/docs/searchfield.md +319 -0
  38. package/docs/section.md +267 -0
  39. package/docs/select.md +449 -0
  40. package/docs/spinner.md +121 -0
  41. package/docs/stack.md +748 -0
  42. package/docs/switch.md +365 -0
  43. package/docs/table.md +805 -0
  44. package/docs/text.md +339 -0
  45. package/docs/textarea.md +328 -0
  46. package/docs/textfield.md +425 -0
  47. package/docs/thumbnail.md +245 -0
  48. package/docs/tooltip.md +130 -0
  49. package/docs/unorderedlist.md +135 -0
  50. package/docs/urlfield.md +314 -0
  51. package/package.json +43 -0
package/docs/image.md ADDED
@@ -0,0 +1,517 @@
1
+ ---
2
+ title: Image
3
+ description: >-
4
+ Embeds an image within the interface and controls its presentation. Use to
5
+ visually illustrate concepts, showcase products, or support user tasks and
6
+ interactions.
7
+ api_name: app-home
8
+ source_url:
9
+ html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/media/image'
10
+ md: 'https://shopify.dev/docs/api/app-home/polaris-web-components/media/image.md'
11
+ ---
12
+
13
+ # Image
14
+
15
+ Embeds an image within the interface and controls its presentation. Use to visually illustrate concepts, showcase products, or support user tasks and interactions.
16
+
17
+ ## Properties
18
+
19
+ * accessibilityRole
20
+
21
+ "none" | "presentation" | "img"
22
+
23
+ Default: 'img'
24
+
25
+ Sets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
26
+
27
+ * alt
28
+
29
+ string
30
+
31
+ Default: \`''\`
32
+
33
+ An alternative text description that describe the image for the reader to understand what it is about. It is extremely useful for both users using assistive technology and sighted users. A well written description provides people with visual impairments the ability to participate in consuming non-text content. When a screen readers encounters an `s-image`, the description is read and announced aloud. If an image fails to load, potentially due to a poor connection, the `alt` is displayed on screen instead. This has the benefit of letting a sighted buyer know an image was meant to load here, but as an alternative, they’re still able to consume the text content. Read [considerations when writing alternative text](https://www.shopify.com/ca/blog/image-alt-text#4) to learn more.
34
+
35
+ * aspectRatio
36
+
37
+ \`${number}\` | \`${number}/${number}\` | \`${number}/ ${number}\` | \`${number} /${number}\` | \`${number} / ${number}\`
38
+
39
+ Default: '1/1'
40
+
41
+ The aspect ratio of the image.
42
+
43
+ The rendering of the image will depend on the `inlineSize` value:
44
+
45
+ * `inlineSize="fill"`: the aspect ratio will be respected and the image will take the necessary space.
46
+ * `inlineSize="auto"`: the image will not render until it has loaded and the aspect ratio will be ignored.
47
+
48
+ For example, if the value is set as `50 / 100`, the getter returns `50 / 100`. If the value is set as `0.5`, the getter returns `0.5 / 1`.
49
+
50
+ * border
51
+
52
+ BorderShorthand
53
+
54
+ Default: 'none' - equivalent to \`none base auto\`.
55
+
56
+ Set the border via the shorthand property.
57
+
58
+ This can be a size, optionally followed by a color, optionally followed by a style.
59
+
60
+ If the color is not specified, it will be `base`.
61
+
62
+ If the style is not specified, it will be `auto`.
63
+
64
+ Values can be overridden by `borderWidth`, `borderStyle`, and `borderColor`.
65
+
66
+ * borderColor
67
+
68
+ "" | ColorKeyword
69
+
70
+ Default: '' - meaning no override
71
+
72
+ Adjust the color of the border.
73
+
74
+ * borderRadius
75
+
76
+ MaybeAllValuesShorthandProperty\<BoxBorderRadii>
77
+
78
+ Default: 'none'
79
+
80
+ Adjust the radius of the border.
81
+
82
+ * borderStyle
83
+
84
+ "" | MaybeAllValuesShorthandProperty\<BoxBorderStyles>
85
+
86
+ Default: '' - meaning no override
87
+
88
+ Adjust the style of the border.
89
+
90
+ * borderWidth
91
+
92
+ "" | MaybeAllValuesShorthandProperty<"small" | "small-100" | "base" | "large" | "large-100" | "none">
93
+
94
+ Default: '' - meaning no override
95
+
96
+ Adjust the width of the border.
97
+
98
+ * inlineSize
99
+
100
+ "auto" | "fill"
101
+
102
+ Default: 'fill'
103
+
104
+ The displayed inline width of the image.
105
+
106
+ * `fill`: the image will takes up 100% of the available inline size.
107
+ * `auto`: the image will be displayed at its natural size.
108
+
109
+ * loading
110
+
111
+ "eager" | "lazy"
112
+
113
+ Default: 'eager'
114
+
115
+ Determines the loading behavior of the image:
116
+
117
+ * `eager`: Immediately loads the image, irrespective of its position within the visible viewport.
118
+ * `lazy`: Delays loading the image until it approaches a specified distance from the viewport.
119
+
120
+ * objectFit
121
+
122
+ "contain" | "cover"
123
+
124
+ Default: 'contain'
125
+
126
+ Determines how the content of the image is resized to fit its container. The image is positioned in the center of the container.
127
+
128
+ * sizes
129
+
130
+ string
131
+
132
+ A set of media conditions and their corresponding sizes.
133
+
134
+ * src
135
+
136
+ string
137
+
138
+ The image source (either a remote URL or a local file resource).
139
+
140
+ When the image is loading or no `src` is provided, a placeholder will be rendered.
141
+
142
+ * srcSet
143
+
144
+ string
145
+
146
+ A set of image sources and their width or pixel density descriptors.
147
+
148
+ This overrides the `src` property.
149
+
150
+ ### BorderShorthand
151
+
152
+ Represents a shorthand for defining a border. It can be a combination of size, optionally followed by color, optionally followed by style.
153
+
154
+ ```ts
155
+ BorderSizeKeyword | `${BorderSizeKeyword} ${ColorKeyword}` | `${BorderSizeKeyword} ${ColorKeyword} ${BorderStyleKeyword}`
156
+ ```
157
+
158
+ ### BorderSizeKeyword
159
+
160
+ ```ts
161
+ SizeKeyword | 'none'
162
+ ```
163
+
164
+ ### SizeKeyword
165
+
166
+ ```ts
167
+ 'small-500' | 'small-400' | 'small-300' | 'small-200' | 'small-100' | 'small' | 'base' | 'large' | 'large-100' | 'large-200' | 'large-300' | 'large-400' | 'large-500'
168
+ ```
169
+
170
+ ### ColorKeyword
171
+
172
+ ```ts
173
+ 'subdued' | 'base' | 'strong'
174
+ ```
175
+
176
+ ### BorderStyleKeyword
177
+
178
+ ```ts
179
+ 'none' | 'solid' | 'dashed' | 'dotted' | 'auto'
180
+ ```
181
+
182
+ ### MaybeAllValuesShorthandProperty
183
+
184
+ ```ts
185
+ T | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`
186
+ ```
187
+
188
+ ### BoxBorderRadii
189
+
190
+ ```ts
191
+ 'small' | 'small-200' | 'small-100' | 'base' | 'large' | 'large-100' | 'large-200' | 'none'
192
+ ```
193
+
194
+ ### BoxBorderStyles
195
+
196
+ ```ts
197
+ 'auto' | 'none' | 'solid' | 'dashed'
198
+ ```
199
+
200
+ ## Events
201
+
202
+ Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
203
+
204
+ * error
205
+
206
+ OnErrorEventHandler
207
+
208
+ * load
209
+
210
+ CallbackEventListener\<typeof tagName> | null
211
+
212
+ ### CallbackEventListener
213
+
214
+ ```ts
215
+ (EventListener & {
216
+ (event: CallbackEvent<T>): void;
217
+ }) | null
218
+ ```
219
+
220
+ ### CallbackEvent
221
+
222
+ ```ts
223
+ Event & {
224
+ currentTarget: HTMLElementTagNameMap[T];
225
+ }
226
+ ```
227
+
228
+ Examples
229
+
230
+ ### Examples
231
+
232
+ * #### Code
233
+
234
+ ##### jsx
235
+
236
+ ```jsx
237
+ <s-image
238
+ src="https://cdn.shopify.com/static/images/polaris/image-wc_src.png"
239
+ alt="Four pixelated characters ready to build amazing Shopify apps"
240
+ aspectRatio="59/161"
241
+ inlineSize="auto"
242
+ />
243
+ ```
244
+
245
+ ##### html
246
+
247
+ ```html
248
+ <s-image
249
+ src="https://cdn.shopify.com/static/images/polaris/image-wc_src.png"
250
+ alt="Four pixelated characters ready to build amazing Shopify apps"
251
+ aspectRatio="59/161"
252
+ inlineSize="auto"
253
+ ></s-image>
254
+ ```
255
+
256
+ * #### Basic usage
257
+
258
+ ##### Description
259
+
260
+ Demonstrates the simplest implementation of an image component with a source and alt text.
261
+
262
+ ##### jsx
263
+
264
+ ```jsx
265
+ <s-image src="https://cdn.shopify.com/static/sample-product/House-Plant1.png" alt="Product image" />
266
+ ```
267
+
268
+ ##### html
269
+
270
+ ```html
271
+ <s-image
272
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
273
+ alt="Product image"
274
+ ></s-image>
275
+ ```
276
+
277
+ * #### Responsive layout with aspect ratio
278
+
279
+ ##### Description
280
+
281
+ Shows how to create a responsive image with a fixed 16:9 aspect ratio, set to cover the container, and loaded lazily.
282
+
283
+ ##### jsx
284
+
285
+ ```jsx
286
+ <s-image
287
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
288
+ alt="Featured product"
289
+ aspectRatio="16/9"
290
+ objectFit="cover"
291
+ loading="lazy"
292
+ />
293
+ ```
294
+
295
+ ##### html
296
+
297
+ ```html
298
+ <s-image
299
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
300
+ alt="Featured product"
301
+ aspectRatio="16/9"
302
+ objectFit="cover"
303
+ loading="lazy"
304
+ ></s-image>
305
+ ```
306
+
307
+ * #### Responsive images with srcset
308
+
309
+ ##### Description
310
+
311
+ Illustrates how to provide multiple image sources for different screen sizes and resolutions using srcSet and sizes attributes.
312
+
313
+ ##### jsx
314
+
315
+ ```jsx
316
+ <s-image
317
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
318
+ srcSet="https://cdn.shopify.com/static/sample-product/House-Plant1.png 400w,
319
+ https://cdn.shopify.com/static/sample-product/House-Plant1.png 800w"
320
+ sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 400px"
321
+ alt="Product detail"
322
+ aspectRatio="16/9"
323
+ objectFit="cover"
324
+ />
325
+ ```
326
+
327
+ ##### html
328
+
329
+ ```html
330
+ <s-image
331
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
332
+ srcSet="https://cdn.shopify.com/static/sample-product/House-Plant1.png 400w,
333
+ https://cdn.shopify.com/static/sample-product/House-Plant1.png 800w"
334
+ sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 400px"
335
+ alt="Product detail"
336
+ aspectRatio="16/9"
337
+ objectFit="cover"
338
+ ></s-image>
339
+ ```
340
+
341
+ * #### With border styling
342
+
343
+ ##### Description
344
+
345
+ Demonstrates how to apply border styling to an image, including width, style, color, and radius, using border-related properties.
346
+
347
+ ##### jsx
348
+
349
+ ```jsx
350
+ <s-box inlineSize="300px">
351
+ <s-image
352
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
353
+ alt="Product thumbnail"
354
+ borderWidth="large"
355
+ borderStyle="solid"
356
+ borderColor="strong"
357
+ borderRadius="large"
358
+ objectFit="cover"
359
+ aspectRatio="1/1"
360
+ />
361
+ </s-box>
362
+ ```
363
+
364
+ ##### html
365
+
366
+ ```html
367
+ <s-box inlineSize="300px">
368
+ <s-image
369
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
370
+ alt="Product thumbnail"
371
+ borderWidth="large"
372
+ borderStyle="solid"
373
+ borderColor="strong"
374
+ borderRadius="large"
375
+ objectFit="cover"
376
+ aspectRatio="1/1"
377
+ ></s-image>
378
+ </s-box>
379
+ ```
380
+
381
+ * #### Decorative image
382
+
383
+ ##### Description
384
+
385
+ Shows how to mark an image as decorative, which will make screen readers ignore the image by setting an empty alt text and presentation role.
386
+
387
+ ##### jsx
388
+
389
+ ```jsx
390
+ <s-image
391
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
392
+ alt=""
393
+ accessibilityRole="presentation"
394
+ objectFit="cover"
395
+ />
396
+ ```
397
+
398
+ ##### html
399
+
400
+ ```html
401
+ <s-image
402
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
403
+ alt=""
404
+ accessibilityRole="presentation"
405
+ objectFit="cover"
406
+ ></s-image>
407
+ ```
408
+
409
+ * #### Auto-sized image
410
+
411
+ ##### Description
412
+
413
+ Demonstrates an image with auto-sizing, which allows the image to adjust its size based on its container's width.
414
+
415
+ ##### jsx
416
+
417
+ ```jsx
418
+ <s-image
419
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
420
+ alt="Product image"
421
+ inlineSize="auto"
422
+ />
423
+ ```
424
+
425
+ ##### html
426
+
427
+ ```html
428
+ <s-image
429
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
430
+ alt="Product image"
431
+ inlineSize="auto"
432
+ ></s-image>
433
+ ```
434
+
435
+ * #### Within layout components
436
+
437
+ ##### Description
438
+
439
+ Shows how to use images within a grid layout, creating a consistent grid of images with equal size, aspect ratio, and styling.
440
+
441
+ ##### jsx
442
+
443
+ ```jsx
444
+ <s-grid gridTemplateColumns="repeat(3, 150px)" gap="base" alignItems="center">
445
+ <s-image
446
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
447
+ alt="Main view"
448
+ aspectRatio="1/1"
449
+ objectFit="cover"
450
+ borderRadius="base"
451
+ inlineSize="fill"
452
+ />
453
+ <s-image
454
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
455
+ alt="Side view"
456
+ aspectRatio="1/1"
457
+ objectFit="cover"
458
+ borderRadius="base"
459
+ inlineSize="fill"
460
+ />
461
+ <s-image
462
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
463
+ alt="Detail view"
464
+ aspectRatio="1/1"
465
+ objectFit="cover"
466
+ borderRadius="base"
467
+ inlineSize="fill"
468
+ />
469
+ </s-grid>
470
+ ```
471
+
472
+ ##### html
473
+
474
+ ```html
475
+ <s-grid gridTemplateColumns="repeat(3, 150px)" gap="base" alignItems="center">
476
+ <s-image
477
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
478
+ alt="Main view"
479
+ aspectRatio="1/1"
480
+ objectFit="cover"
481
+ borderRadius="base"
482
+ inlineSize="fill"
483
+ ></s-image>
484
+ <s-image
485
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
486
+ alt="Side view"
487
+ aspectRatio="1/1"
488
+ objectFit="cover"
489
+ borderRadius="base"
490
+ inlineSize="fill"
491
+ ></s-image>
492
+ <s-image
493
+ src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
494
+ alt="Detail view"
495
+ aspectRatio="1/1"
496
+ objectFit="cover"
497
+ borderRadius="base"
498
+ inlineSize="fill"
499
+ ></s-image>
500
+ </s-grid>
501
+ ```
502
+
503
+ ## Useful for
504
+
505
+ * Adding illustrations and photos.
506
+
507
+ ## Best practices
508
+
509
+ * Use high-resolution, optimized images
510
+ * Use intentionally to add clarity and guide users
511
+
512
+ ## Content guidelines
513
+
514
+ Alt text should be accurate, concise, and descriptive:
515
+
516
+ * Indicate it's an image: "Image of", "Photo of"
517
+ * Focus on description: "Image of a woman with curly brown hair smiling"