shopify-theme-devtools 1.0.0 → 1.1.1
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 +25 -145
- package/dist/theme-devtools.js +3889 -690
- package/package.json +3 -3
- package/src/liquid/theme-devtools-bridge.liquid +87 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shopify-theme-devtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "In-browser devtools panel for Shopify theme development - inspect Liquid context, metafields, settings, sections, and cart state",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/theme-devtools.js",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"shopify-development",
|
|
39
39
|
"theme-development"
|
|
40
40
|
],
|
|
41
|
-
"author": "",
|
|
41
|
+
"author": "yakohere",
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": ""
|
|
45
|
+
"url": "https://github.com/yakohere/shopify-theme-devtools"
|
|
46
46
|
},
|
|
47
47
|
"bugs": {
|
|
48
48
|
"url": ""
|
|
@@ -1,23 +1,71 @@
|
|
|
1
1
|
{%- comment -%}
|
|
2
2
|
Theme Devtools Bridge
|
|
3
3
|
Renders devtools context and loads JS/CSS only on development/preview themes.
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
Usage: {% render 'theme-devtools-bridge' %}
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
Development: Set devtools_local to true and run `npm run dev`
|
|
8
8
|
Production: Set devtools_local to false and update devtools_cdn_base
|
|
9
|
-
|
|
10
|
-
Metafields:
|
|
9
|
+
|
|
10
|
+
Metafields Schema: Copy content from your theme's metafields.json into devtools_metafields_schema below
|
|
11
11
|
{%- endcomment -%}
|
|
12
12
|
|
|
13
13
|
{%- assign devtools_local = true -%}
|
|
14
14
|
{%- assign devtools_localhost = 'http://localhost:9999' -%}
|
|
15
|
-
{%- assign devtools_cdn_base = 'https://cdn.
|
|
15
|
+
{%- assign devtools_cdn_base = 'https://cdn.jsdelivr.net/npm/shopify-theme-devtools@latest/dist' -%}
|
|
16
16
|
|
|
17
|
-
{%- comment -%}
|
|
18
|
-
|
|
17
|
+
{%- comment -%}
|
|
18
|
+
Metafields Schema: Paste your theme's metafields.json content here.
|
|
19
|
+
This file is auto-generated by Shopify and located at the root of your theme.
|
|
20
|
+
Having this schema enables the devtools to show ALL defined metafields,
|
|
21
|
+
not just ones with values.
|
|
22
|
+
{%- endcomment -%}
|
|
23
|
+
{%- capture devtools_metafields_schema -%}
|
|
24
|
+
{
|
|
25
|
+
"article": [],
|
|
26
|
+
"blog": [],
|
|
27
|
+
"collection": [],
|
|
28
|
+
"company": [],
|
|
29
|
+
"company_location": [],
|
|
30
|
+
"location": [],
|
|
31
|
+
"market": [],
|
|
32
|
+
"order": [],
|
|
33
|
+
"page": [],
|
|
34
|
+
"product": [],
|
|
35
|
+
"variant": [],
|
|
36
|
+
"shop": [],
|
|
37
|
+
"customer": []
|
|
38
|
+
}
|
|
39
|
+
{%- endcapture -%}
|
|
19
40
|
|
|
20
41
|
{%- comment -%}
|
|
42
|
+
Auto-extract namespaces from schema, or use fallback list if schema is empty
|
|
43
|
+
{%- endcomment -%}
|
|
44
|
+
{%- assign devtools_extracted_namespaces = '' -%}
|
|
45
|
+
{%- assign devtools_schema_parts = devtools_metafields_schema | split: '"namespace": "' -%}
|
|
46
|
+
{%- for part in devtools_schema_parts -%}
|
|
47
|
+
{%- unless forloop.first -%}
|
|
48
|
+
{%- assign ns_end = part | split: '"' | first -%}
|
|
49
|
+
{%- if ns_end != blank -%}
|
|
50
|
+
{%- unless devtools_extracted_namespaces contains ns_end -%}
|
|
51
|
+
{%- if devtools_extracted_namespaces == '' -%}
|
|
52
|
+
{%- assign devtools_extracted_namespaces = ns_end -%}
|
|
53
|
+
{%- else -%}
|
|
54
|
+
{%- assign devtools_extracted_namespaces = devtools_extracted_namespaces | append: ',' | append: ns_end -%}
|
|
55
|
+
{%- endif -%}
|
|
56
|
+
{%- endunless -%}
|
|
57
|
+
{%- endif -%}
|
|
58
|
+
{%- endunless -%}
|
|
59
|
+
{%- endfor -%}
|
|
60
|
+
|
|
61
|
+
{%- comment -%} Use extracted namespaces if found, otherwise use fallback {%- endcomment -%}
|
|
62
|
+
{%- if devtools_extracted_namespaces != '' -%}
|
|
63
|
+
{%- assign devtools_metafield_namespaces = devtools_extracted_namespaces | split: ',' -%}
|
|
64
|
+
{%- else -%}
|
|
65
|
+
{%- assign devtools_metafield_namespaces = 'custom,global,shopify' | split: ',' -%}
|
|
66
|
+
{%- endif -%}
|
|
67
|
+
|
|
68
|
+
{%- comment -%}
|
|
21
69
|
Configure your theme settings to expose here.
|
|
22
70
|
Format: setting_id|type|label|group
|
|
23
71
|
Common types: color, text, checkbox, number, range, select, image_picker, font_picker
|
|
@@ -246,14 +294,22 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
246
294
|
{%- else -%}
|
|
247
295
|
"page": null,
|
|
248
296
|
{%- endif -%}
|
|
249
|
-
"cart": {
|
|
297
|
+
"cart": {
|
|
298
|
+
"item_count": {{ cart.item_count | json }},
|
|
299
|
+
"total_price": {{ cart.total_price | json }},
|
|
300
|
+
"currency": {{ cart.currency.iso_code | json }},
|
|
301
|
+
"items_count": {{ cart.items | size | json }},
|
|
302
|
+
"_note": "Full cart data fetched via /cart.js"
|
|
303
|
+
}
|
|
250
304
|
},
|
|
251
305
|
"metafields": {
|
|
252
306
|
{%- comment -%} Shop Metafields {%- endcomment -%}
|
|
253
307
|
"shop": {
|
|
308
|
+
{%- assign mf_first = true -%}
|
|
254
309
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
255
310
|
{%- assign shop_ns = shop.metafields[ns] -%}
|
|
256
311
|
{%- if shop_ns != blank -%}
|
|
312
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
257
313
|
"{{ ns }}": {
|
|
258
314
|
{%- for field in shop_ns -%}
|
|
259
315
|
"{{ field.first }}": {
|
|
@@ -261,16 +317,18 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
261
317
|
"type": {{ field.last.type | json }}
|
|
262
318
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
263
319
|
{%- endfor -%}
|
|
264
|
-
}
|
|
320
|
+
}
|
|
265
321
|
{%- endif -%}
|
|
266
322
|
{%- endfor -%}
|
|
267
323
|
},
|
|
268
324
|
{%- comment -%} Product Metafields {%- endcomment -%}
|
|
269
325
|
{%- if product -%}
|
|
270
326
|
"product": {
|
|
327
|
+
{%- assign mf_first = true -%}
|
|
271
328
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
272
329
|
{%- assign product_ns = product.metafields[ns] -%}
|
|
273
330
|
{%- if product_ns != blank -%}
|
|
331
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
274
332
|
"{{ ns }}": {
|
|
275
333
|
{%- for field in product_ns -%}
|
|
276
334
|
"{{ field.first }}": {
|
|
@@ -278,7 +336,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
278
336
|
"type": {{ field.last.type | json }}
|
|
279
337
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
280
338
|
{%- endfor -%}
|
|
281
|
-
}
|
|
339
|
+
}
|
|
282
340
|
{%- endif -%}
|
|
283
341
|
{%- endfor -%}
|
|
284
342
|
},
|
|
@@ -288,9 +346,11 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
288
346
|
{%- comment -%} Collection Metafields {%- endcomment -%}
|
|
289
347
|
{%- if collection -%}
|
|
290
348
|
"collection": {
|
|
349
|
+
{%- assign mf_first = true -%}
|
|
291
350
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
292
351
|
{%- assign collection_ns = collection.metafields[ns] -%}
|
|
293
352
|
{%- if collection_ns != blank -%}
|
|
353
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
294
354
|
"{{ ns }}": {
|
|
295
355
|
{%- for field in collection_ns -%}
|
|
296
356
|
"{{ field.first }}": {
|
|
@@ -298,7 +358,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
298
358
|
"type": {{ field.last.type | json }}
|
|
299
359
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
300
360
|
{%- endfor -%}
|
|
301
|
-
}
|
|
361
|
+
}
|
|
302
362
|
{%- endif -%}
|
|
303
363
|
{%- endfor -%}
|
|
304
364
|
},
|
|
@@ -308,9 +368,11 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
308
368
|
{%- comment -%} Customer Metafields {%- endcomment -%}
|
|
309
369
|
{%- if customer -%}
|
|
310
370
|
"customer": {
|
|
371
|
+
{%- assign mf_first = true -%}
|
|
311
372
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
312
373
|
{%- assign customer_ns = customer.metafields[ns] -%}
|
|
313
374
|
{%- if customer_ns != blank -%}
|
|
375
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
314
376
|
"{{ ns }}": {
|
|
315
377
|
{%- for field in customer_ns -%}
|
|
316
378
|
"{{ field.first }}": {
|
|
@@ -318,7 +380,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
318
380
|
"type": {{ field.last.type | json }}
|
|
319
381
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
320
382
|
{%- endfor -%}
|
|
321
|
-
}
|
|
383
|
+
}
|
|
322
384
|
{%- endif -%}
|
|
323
385
|
{%- endfor -%}
|
|
324
386
|
},
|
|
@@ -328,9 +390,11 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
328
390
|
{%- comment -%} Article Metafields {%- endcomment -%}
|
|
329
391
|
{%- if article -%}
|
|
330
392
|
"article": {
|
|
393
|
+
{%- assign mf_first = true -%}
|
|
331
394
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
332
395
|
{%- assign article_ns = article.metafields[ns] -%}
|
|
333
396
|
{%- if article_ns != blank -%}
|
|
397
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
334
398
|
"{{ ns }}": {
|
|
335
399
|
{%- for field in article_ns -%}
|
|
336
400
|
"{{ field.first }}": {
|
|
@@ -338,7 +402,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
338
402
|
"type": {{ field.last.type | json }}
|
|
339
403
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
340
404
|
{%- endfor -%}
|
|
341
|
-
}
|
|
405
|
+
}
|
|
342
406
|
{%- endif -%}
|
|
343
407
|
{%- endfor -%}
|
|
344
408
|
},
|
|
@@ -348,9 +412,11 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
348
412
|
{%- comment -%} Page Metafields {%- endcomment -%}
|
|
349
413
|
{%- if page -%}
|
|
350
414
|
"page": {
|
|
415
|
+
{%- assign mf_first = true -%}
|
|
351
416
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
352
417
|
{%- assign page_ns = page.metafields[ns] -%}
|
|
353
418
|
{%- if page_ns != blank -%}
|
|
419
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
354
420
|
"{{ ns }}": {
|
|
355
421
|
{%- for field in page_ns -%}
|
|
356
422
|
"{{ field.first }}": {
|
|
@@ -358,7 +424,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
358
424
|
"type": {{ field.last.type | json }}
|
|
359
425
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
360
426
|
{%- endfor -%}
|
|
361
|
-
}
|
|
427
|
+
}
|
|
362
428
|
{%- endif -%}
|
|
363
429
|
{%- endfor -%}
|
|
364
430
|
},
|
|
@@ -368,9 +434,11 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
368
434
|
{%- comment -%} Blog Metafields {%- endcomment -%}
|
|
369
435
|
{%- if blog -%}
|
|
370
436
|
"blog": {
|
|
437
|
+
{%- assign mf_first = true -%}
|
|
371
438
|
{%- for ns in devtools_metafield_namespaces -%}
|
|
372
439
|
{%- assign blog_ns = blog.metafields[ns] -%}
|
|
373
440
|
{%- if blog_ns != blank -%}
|
|
441
|
+
{%- unless mf_first -%},{%- endunless -%}{%- assign mf_first = false -%}
|
|
374
442
|
"{{ ns }}": {
|
|
375
443
|
{%- for field in blog_ns -%}
|
|
376
444
|
"{{ field.first }}": {
|
|
@@ -378,7 +446,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
378
446
|
"type": {{ field.last.type | json }}
|
|
379
447
|
}{%- unless forloop.last -%},{%- endunless -%}
|
|
380
448
|
{%- endfor -%}
|
|
381
|
-
}
|
|
449
|
+
}
|
|
382
450
|
{%- endif -%}
|
|
383
451
|
{%- endfor -%}
|
|
384
452
|
}
|
|
@@ -423,6 +491,7 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
423
491
|
"sectionSettings": {
|
|
424
492
|
{%- comment -%} Section settings are injected via JS from data attributes {%- endcomment -%}
|
|
425
493
|
},
|
|
494
|
+
"metafieldsSchema": {{ devtools_metafields_schema }},
|
|
426
495
|
"timestamp": {{ 'now' | date: '%s' | json }}
|
|
427
496
|
}
|
|
428
497
|
{%- endcapture -%}
|
|
@@ -437,9 +506,10 @@ checkout_logo|image_picker|Checkout logo|checkout
|
|
|
437
506
|
{%- if devtools_local -%}
|
|
438
507
|
<script type="module" src="{{ devtools_localhost }}/src/scripts/main.js"></script>
|
|
439
508
|
{%- else -%}
|
|
440
|
-
<script>
|
|
509
|
+
<script>
|
|
510
|
+
window.__THEME_DEVTOOLS_CSS_URL__ = '{{ devtools_cdn_base }}/theme-devtools.css';
|
|
511
|
+
</script>
|
|
441
512
|
<script src="{{ devtools_cdn_base }}/theme-devtools.js" defer></script>
|
|
442
513
|
{%- endif -%}
|
|
443
514
|
{% comment %} theme-check-enable RemoteAsset {% endcomment %}
|
|
444
515
|
{%- endif -%}
|
|
445
|
-
|