@gem-sdk/core 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 (214) hide show
  1. package/dist/cjs/components/AddOn.js +18 -0
  2. package/dist/cjs/components/ComponentWrapper.js +45 -0
  3. package/dist/cjs/components/ComponentWrapperPreview.js +58 -0
  4. package/dist/cjs/components/Empty.js +7 -0
  5. package/dist/cjs/components/Render.js +28 -0
  6. package/dist/cjs/components/RenderBlock.js +21 -0
  7. package/dist/cjs/components/RenderPreview.js +28 -0
  8. package/dist/cjs/components/RenderSection.js +19 -0
  9. package/dist/cjs/contexts/AddonContext.js +25 -0
  10. package/dist/cjs/contexts/BuilderComponent.js +30 -0
  11. package/dist/cjs/contexts/BuilderContext.js +29 -0
  12. package/dist/cjs/contexts/BuilderPreviewContext.js +353 -0
  13. package/dist/cjs/contexts/CartLineContext.js +24 -0
  14. package/dist/cjs/contexts/CollectionContext.js +24 -0
  15. package/dist/cjs/contexts/ProductContext.js +126 -0
  16. package/dist/cjs/contexts/ProductListContext.js +24 -0
  17. package/dist/cjs/contexts/SectionContext.js +49 -0
  18. package/dist/cjs/contexts/ShopContext.js +43 -0
  19. package/dist/cjs/graphql/fragments/analytic.generated.js +11 -0
  20. package/dist/cjs/graphql/fragments/collection-detail.generated.js +13 -0
  21. package/dist/cjs/graphql/fragments/collection-product.generated.js +26 -0
  22. package/dist/cjs/graphql/fragments/data-seo.generated.js +11 -0
  23. package/dist/cjs/graphql/fragments/media.generated.js +14 -0
  24. package/dist/cjs/graphql/fragments/product-little.generated.js +25 -0
  25. package/dist/cjs/graphql/fragments/product-option-value.generated.js +13 -0
  26. package/dist/cjs/graphql/fragments/product-option.generated.js +14 -0
  27. package/dist/cjs/graphql/fragments/product.generated.js +33 -0
  28. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +12 -0
  29. package/dist/cjs/graphql/fragments/published-page-section.generated.js +11 -0
  30. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +27 -0
  31. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +11 -0
  32. package/dist/cjs/graphql/fragments/selected-option.generated.js +11 -0
  33. package/dist/cjs/graphql/fragments/variant.generated.js +35 -0
  34. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +34 -0
  35. package/dist/cjs/graphql/queries/collection.generated.js +52 -0
  36. package/dist/cjs/graphql/queries/preview-page.generated.js +23 -0
  37. package/dist/cjs/graphql/queries/product-little-detail.generated.js +24 -0
  38. package/dist/cjs/graphql/queries/product-medias.generated.js +29 -0
  39. package/dist/cjs/graphql/queries/product-variants.generated.js +33 -0
  40. package/dist/cjs/graphql/queries/products.generated.js +41 -0
  41. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +23 -0
  42. package/dist/cjs/graphql/queries/storeProperty.generated.js +12 -0
  43. package/dist/cjs/helpers/GlobalEvent.js +17 -0
  44. package/dist/cjs/helpers/background.js +104 -0
  45. package/dist/cjs/helpers/borders.js +138 -0
  46. package/dist/cjs/helpers/clone-deep.js +5 -0
  47. package/dist/cjs/helpers/cls.js +20 -0
  48. package/dist/cjs/helpers/colors.js +157 -0
  49. package/dist/cjs/helpers/compose-advance-style.js +132 -0
  50. package/dist/cjs/helpers/constant.js +17 -0
  51. package/dist/cjs/helpers/css-variable.js +7 -0
  52. package/dist/cjs/helpers/email.js +11 -0
  53. package/dist/cjs/helpers/flatten-connection.js +10 -0
  54. package/dist/cjs/helpers/fpixel.js +29 -0
  55. package/dist/cjs/helpers/get-resonsive-value.js +32 -0
  56. package/dist/cjs/helpers/get-shortname.js +92 -0
  57. package/dist/cjs/helpers/gtag.js +48 -0
  58. package/dist/cjs/helpers/is-browser.js +9 -0
  59. package/dist/cjs/helpers/is-defined.js +7 -0
  60. package/dist/cjs/helpers/is-empty-children.js +12 -0
  61. package/dist/cjs/helpers/layout.js +17 -0
  62. package/dist/cjs/helpers/load-script.js +32 -0
  63. package/dist/cjs/helpers/make-style.js +99 -0
  64. package/dist/cjs/helpers/normalize-builder-data.js +17 -0
  65. package/dist/cjs/helpers/prefetch-queries.js +68 -0
  66. package/dist/cjs/helpers/product.js +35 -0
  67. package/dist/cjs/helpers/queries/get-collection.js +173 -0
  68. package/dist/cjs/helpers/queries/get-product-by-slug.js +99 -0
  69. package/dist/cjs/helpers/queries/get-product.js +113 -0
  70. package/dist/cjs/helpers/queries/get-products.js +135 -0
  71. package/dist/cjs/helpers/radius.js +91 -0
  72. package/dist/cjs/helpers/shadow.js +48 -0
  73. package/dist/cjs/helpers/size.js +20 -0
  74. package/dist/cjs/helpers/spacing.js +45 -0
  75. package/dist/cjs/helpers/tiktokpixel.js +17 -0
  76. package/dist/cjs/helpers/typography.js +7 -0
  77. package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -0
  78. package/dist/cjs/hooks/cart/use-cart-data.js +26 -0
  79. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -0
  80. package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -0
  81. package/dist/cjs/hooks/cart/use-create-cart.js +22 -0
  82. package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -0
  83. package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -0
  84. package/dist/cjs/hooks/shop/use-collection-query.js +16 -0
  85. package/dist/cjs/hooks/shop/use-product-query.js +16 -0
  86. package/dist/cjs/hooks/shop/use-products-query.js +16 -0
  87. package/dist/cjs/hooks/shop.js +80 -0
  88. package/dist/cjs/hooks/use-current-device.js +23 -0
  89. package/dist/cjs/hooks/use-lazy-video.js +15 -0
  90. package/dist/cjs/hooks/useCartId.js +36 -0
  91. package/dist/cjs/hooks/useCartLine.js +11 -0
  92. package/dist/cjs/hooks/useCartUI.js +42 -0
  93. package/dist/cjs/hooks/useCollection.js +9 -0
  94. package/dist/cjs/hooks/useFetchHandle.js +13 -0
  95. package/dist/cjs/hooks/useFormatMoney.js +17 -0
  96. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -0
  97. package/dist/cjs/hooks/useLoadScript.js +30 -0
  98. package/dist/cjs/hooks/useMoney.js +52 -0
  99. package/dist/cjs/hooks/usePrevious.js +17 -0
  100. package/dist/cjs/hooks/useProduct.js +90 -0
  101. package/dist/cjs/hooks/useProductList.js +21 -0
  102. package/dist/cjs/hooks/useSuspenseFetch.js +24 -0
  103. package/dist/cjs/hooks/useSwatchesOptions.js +39 -0
  104. package/dist/cjs/index.js +229 -0
  105. package/dist/cjs/types/global-style.js +7 -0
  106. package/dist/cjs/types/shop.js +2 -0
  107. package/dist/esm/components/AddOn.js +14 -0
  108. package/dist/esm/components/ComponentWrapper.js +40 -0
  109. package/dist/esm/components/ComponentWrapperPreview.js +54 -0
  110. package/dist/esm/components/Empty.js +3 -0
  111. package/dist/esm/components/Render.js +24 -0
  112. package/dist/esm/components/RenderBlock.js +17 -0
  113. package/dist/esm/components/RenderPreview.js +24 -0
  114. package/dist/esm/components/RenderSection.js +15 -0
  115. package/dist/esm/contexts/AddonContext.js +21 -0
  116. package/dist/esm/contexts/BuilderComponent.js +27 -0
  117. package/dist/esm/contexts/BuilderContext.js +26 -0
  118. package/dist/esm/contexts/BuilderPreviewContext.js +350 -0
  119. package/dist/esm/contexts/CartLineContext.js +21 -0
  120. package/dist/esm/contexts/CollectionContext.js +20 -0
  121. package/dist/esm/contexts/ProductContext.js +123 -0
  122. package/dist/esm/contexts/ProductListContext.js +20 -0
  123. package/dist/esm/contexts/SectionContext.js +45 -0
  124. package/dist/esm/contexts/ShopContext.js +40 -0
  125. package/dist/esm/graphql/fragments/analytic.generated.js +9 -0
  126. package/dist/esm/graphql/fragments/collection-detail.generated.js +11 -0
  127. package/dist/esm/graphql/fragments/collection-product.generated.js +24 -0
  128. package/dist/esm/graphql/fragments/data-seo.generated.js +9 -0
  129. package/dist/esm/graphql/fragments/media.generated.js +12 -0
  130. package/dist/esm/graphql/fragments/product-little.generated.js +23 -0
  131. package/dist/esm/graphql/fragments/product-option-value.generated.js +11 -0
  132. package/dist/esm/graphql/fragments/product-option.generated.js +12 -0
  133. package/dist/esm/graphql/fragments/product.generated.js +31 -0
  134. package/dist/esm/graphql/fragments/published-custom-section.generated.js +10 -0
  135. package/dist/esm/graphql/fragments/published-page-section.generated.js +9 -0
  136. package/dist/esm/graphql/fragments/published-theme-page.generated.js +25 -0
  137. package/dist/esm/graphql/fragments/published-theme-style.generated.js +9 -0
  138. package/dist/esm/graphql/fragments/selected-option.generated.js +9 -0
  139. package/dist/esm/graphql/fragments/variant.generated.js +33 -0
  140. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +32 -0
  141. package/dist/esm/graphql/queries/collection.generated.js +50 -0
  142. package/dist/esm/graphql/queries/preview-page.generated.js +21 -0
  143. package/dist/esm/graphql/queries/product-little-detail.generated.js +22 -0
  144. package/dist/esm/graphql/queries/product-medias.generated.js +27 -0
  145. package/dist/esm/graphql/queries/product-variants.generated.js +31 -0
  146. package/dist/esm/graphql/queries/products.generated.js +38 -0
  147. package/dist/esm/graphql/queries/published-theme-pages.generated.js +21 -0
  148. package/dist/esm/graphql/queries/storeProperty.generated.js +10 -0
  149. package/dist/esm/helpers/GlobalEvent.js +13 -0
  150. package/dist/esm/helpers/background.js +102 -0
  151. package/dist/esm/helpers/borders.js +133 -0
  152. package/dist/esm/helpers/clone-deep.js +3 -0
  153. package/dist/esm/helpers/cls.js +18 -0
  154. package/dist/esm/helpers/colors.js +145 -0
  155. package/dist/esm/helpers/compose-advance-style.js +130 -0
  156. package/dist/esm/helpers/constant.js +13 -0
  157. package/dist/esm/helpers/css-variable.js +5 -0
  158. package/dist/esm/helpers/email.js +6 -0
  159. package/dist/esm/helpers/flatten-connection.js +8 -0
  160. package/dist/esm/helpers/fpixel.js +25 -0
  161. package/dist/esm/helpers/get-resonsive-value.js +28 -0
  162. package/dist/esm/helpers/get-shortname.js +90 -0
  163. package/dist/esm/helpers/gtag.js +45 -0
  164. package/dist/esm/helpers/is-browser.js +5 -0
  165. package/dist/esm/helpers/is-defined.js +5 -0
  166. package/dist/esm/helpers/is-empty-children.js +7 -0
  167. package/dist/esm/helpers/layout.js +15 -0
  168. package/dist/esm/helpers/load-script.js +30 -0
  169. package/dist/esm/helpers/make-style.js +91 -0
  170. package/dist/esm/helpers/normalize-builder-data.js +15 -0
  171. package/dist/esm/helpers/prefetch-queries.js +66 -0
  172. package/dist/esm/helpers/product.js +32 -0
  173. package/dist/esm/helpers/queries/get-collection.js +170 -0
  174. package/dist/esm/helpers/queries/get-product-by-slug.js +97 -0
  175. package/dist/esm/helpers/queries/get-product.js +109 -0
  176. package/dist/esm/helpers/queries/get-products.js +133 -0
  177. package/dist/esm/helpers/radius.js +86 -0
  178. package/dist/esm/helpers/shadow.js +45 -0
  179. package/dist/esm/helpers/size.js +18 -0
  180. package/dist/esm/helpers/spacing.js +42 -0
  181. package/dist/esm/helpers/tiktokpixel.js +15 -0
  182. package/dist/esm/helpers/typography.js +5 -0
  183. package/dist/esm/hooks/cart/use-add-to-cart.js +18 -0
  184. package/dist/esm/hooks/cart/use-cart-data.js +24 -0
  185. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -0
  186. package/dist/esm/hooks/cart/use-cart-note-update.js +18 -0
  187. package/dist/esm/hooks/cart/use-create-cart.js +20 -0
  188. package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -0
  189. package/dist/esm/hooks/cart/use-update-cart-item.js +18 -0
  190. package/dist/esm/hooks/shop/use-collection-query.js +14 -0
  191. package/dist/esm/hooks/shop/use-product-query.js +14 -0
  192. package/dist/esm/hooks/shop/use-products-query.js +14 -0
  193. package/dist/esm/hooks/shop.js +68 -0
  194. package/dist/esm/hooks/use-current-device.js +21 -0
  195. package/dist/esm/hooks/use-lazy-video.js +13 -0
  196. package/dist/esm/hooks/useCartId.js +32 -0
  197. package/dist/esm/hooks/useCartLine.js +7 -0
  198. package/dist/esm/hooks/useCartUI.js +38 -0
  199. package/dist/esm/hooks/useCollection.js +7 -0
  200. package/dist/esm/hooks/useFetchHandle.js +11 -0
  201. package/dist/esm/hooks/useFormatMoney.js +13 -0
  202. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -0
  203. package/dist/esm/hooks/useLoadScript.js +26 -0
  204. package/dist/esm/hooks/useMoney.js +48 -0
  205. package/dist/esm/hooks/usePrevious.js +15 -0
  206. package/dist/esm/hooks/useProduct.js +78 -0
  207. package/dist/esm/hooks/useProductList.js +16 -0
  208. package/dist/esm/hooks/useSuspenseFetch.js +20 -0
  209. package/dist/esm/hooks/useSwatchesOptions.js +35 -0
  210. package/dist/esm/index.js +82 -0
  211. package/dist/esm/types/global-style.js +4 -0
  212. package/dist/esm/types/shop.js +1 -0
  213. package/dist/types/index.d.ts +7393 -0
  214. package/package.json +50 -0
@@ -0,0 +1,11 @@
1
+ const CollectionDetailSelect = `
2
+ fragment CollectionDetailSelect on Collection {
3
+ id
4
+ baseID
5
+ title
6
+ handle
7
+ description
8
+ }
9
+ `;
10
+
11
+ export { CollectionDetailSelect };
@@ -0,0 +1,24 @@
1
+ const CollectionProductSelect = `
2
+ fragment CollectionProductSelect on Collection {
3
+ ...CollectionDetailSelect
4
+ products(
5
+ first: $firstProduct
6
+ orderBy: $orderByProduct
7
+ after: $productsAfter
8
+ where: $whereProduct
9
+ ) {
10
+ edges {
11
+ cursor
12
+ node {
13
+ ...ProductSelect
14
+ }
15
+ }
16
+ pageInfo {
17
+ endCursor
18
+ hasNextPage
19
+ }
20
+ }
21
+ }
22
+ `;
23
+
24
+ export { CollectionProductSelect };
@@ -0,0 +1,9 @@
1
+ const DataSeoSelect = `
2
+ fragment DataSEOSelect on DataSEO {
3
+ id
4
+ key
5
+ value
6
+ }
7
+ `;
8
+
9
+ export { DataSeoSelect };
@@ -0,0 +1,12 @@
1
+ const MediaSelect = `
2
+ fragment MediaSelect on Media {
3
+ id
4
+ contentType
5
+ src
6
+ width
7
+ height
8
+ alt
9
+ }
10
+ `;
11
+
12
+ export { MediaSelect };
@@ -0,0 +1,23 @@
1
+ const ProductLittleSelect = `
2
+ fragment ProductLittleSelect on Product {
3
+ id
4
+ title
5
+ description
6
+ descriptionHtml
7
+ handle
8
+ averageRating
9
+ isStorefront
10
+ isSample
11
+ baseID
12
+ sku
13
+ options {
14
+ ...ProductOptionSelect
15
+ }
16
+ vendor
17
+ featuredImage {
18
+ ...MediaSelect
19
+ }
20
+ }
21
+ `;
22
+
23
+ export { ProductLittleSelect };
@@ -0,0 +1,11 @@
1
+ const ProductOptionValueSelect = `
2
+ fragment ProductOptionValueSelect on ProductOptionValue {
3
+ id
4
+ label
5
+ sortOrder
6
+ isDefault
7
+ baseID
8
+ }
9
+ `;
10
+
11
+ export { ProductOptionValueSelect };
@@ -0,0 +1,12 @@
1
+ const ProductOptionSelect = `
2
+ fragment ProductOptionSelect on ProductOption {
3
+ id
4
+ name
5
+ optionType
6
+ values {
7
+ ...ProductOptionValueSelect
8
+ }
9
+ }
10
+ `;
11
+
12
+ export { ProductOptionSelect };
@@ -0,0 +1,31 @@
1
+ const ProductSelect = `
2
+ fragment ProductSelect on Product {
3
+ ...ProductLittleSelect
4
+ medias(first: $firstMedia, after: $afterMedia) {
5
+ edges {
6
+ cursor
7
+ node {
8
+ ...MediaSelect
9
+ }
10
+ }
11
+ pageInfo {
12
+ endCursor
13
+ hasNextPage
14
+ }
15
+ }
16
+ variants(first: $firstVariant, after: $afterVariant) {
17
+ edges {
18
+ cursor
19
+ node {
20
+ ...VariantSelect
21
+ }
22
+ }
23
+ pageInfo {
24
+ hasNextPage
25
+ endCursor
26
+ }
27
+ }
28
+ }
29
+ `;
30
+
31
+ export { ProductSelect };
@@ -0,0 +1,10 @@
1
+ const PublishedCustomSectionSelect = `
2
+ fragment PublishedCustomSectionSelect on PublishedCustomSection {
3
+ cid
4
+ component
5
+ id
6
+ type
7
+ }
8
+ `;
9
+
10
+ export { PublishedCustomSectionSelect };
@@ -0,0 +1,9 @@
1
+ const PublishedPageSectionSelect = `
2
+ fragment PublishedPageSectionSelect on PublishedPageSection {
3
+ cid
4
+ component
5
+ id
6
+ }
7
+ `;
8
+
9
+ export { PublishedPageSectionSelect };
@@ -0,0 +1,25 @@
1
+ const PublishedThemePageSelect = `
2
+ fragment PublishedThemePageSelect on PublishedThemePage {
3
+ id
4
+ name
5
+ isMobile
6
+ pageSections {
7
+ ...PublishedPageSectionSelect
8
+ }
9
+ themePageCustomSections {
10
+ ...PublishedCustomSectionSelect
11
+ }
12
+ themePageDataSEO {
13
+ ...DataSEOSelect
14
+ }
15
+ pageStyle {
16
+ ...PublishedThemeStyleSelect
17
+ }
18
+ sectionPosition
19
+ themePageAnalytic {
20
+ ...AnalyticSelect
21
+ }
22
+ }
23
+ `;
24
+
25
+ export { PublishedThemePageSelect };
@@ -0,0 +1,9 @@
1
+ const PublishedThemeStyleSelect = `
2
+ fragment PublishedThemeStyleSelect on PublishedThemeStyle {
3
+ id
4
+ data
5
+ name
6
+ }
7
+ `;
8
+
9
+ export { PublishedThemeStyleSelect };
@@ -0,0 +1,9 @@
1
+ const SelectedOptionSelect = `
2
+ fragment SelectedOptionSelect on SelectedOption {
3
+ name
4
+ value
5
+ optionType
6
+ }
7
+ `;
8
+
9
+ export { SelectedOptionSelect };
@@ -0,0 +1,33 @@
1
+ const VariantSelect = `
2
+ fragment VariantSelect on ProductVariant {
3
+ id
4
+ title
5
+ barcode
6
+ baseID
7
+ costPrice
8
+ height
9
+ inventoryPolicy
10
+ inventoryQuantity
11
+ inventoryStatus
12
+ isDigital
13
+ length
14
+ lowInventoryAmount
15
+ manageInventory
16
+ mediaId
17
+ platform
18
+ price
19
+ salePrice
20
+ sku
21
+ soldIndividually
22
+ weight
23
+ width
24
+ selectedOptions {
25
+ ...SelectedOptionSelect
26
+ }
27
+ media {
28
+ ...MediaSelect
29
+ }
30
+ }
31
+ `;
32
+
33
+ export { VariantSelect };
@@ -0,0 +1,32 @@
1
+ import { CollectionProductSelect } from '../fragments/collection-product.generated.js';
2
+ import { CollectionDetailSelect } from '../fragments/collection-detail.generated.js';
3
+ import { ProductSelect } from '../fragments/product.generated.js';
4
+ import { ProductLittleSelect } from '../fragments/product-little.generated.js';
5
+ import { ProductOptionSelect } from '../fragments/product-option.generated.js';
6
+ import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
7
+ import { MediaSelect } from '../fragments/media.generated.js';
8
+ import { VariantSelect } from '../fragments/variant.generated.js';
9
+ import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
10
+
11
+ const CollectionDetailFilterDocument = `
12
+ query collectionDetailFilter($firstProduct: Int = 10, $orderBy: CollectionOrder, $where: CollectionWhereInput, $orderByProduct: ProductOrder, $productsAfter: Cursor, $firstVariant: Int, $afterVariant: Cursor, $afterMedia: Cursor, $firstMedia: Int, $whereProduct: ProductWhereInput) {
13
+ collections(first: 1, orderBy: $orderBy, where: $where) {
14
+ edges {
15
+ cursor
16
+ node {
17
+ ...CollectionProductSelect
18
+ }
19
+ }
20
+ }
21
+ }
22
+ ${CollectionProductSelect}
23
+ ${CollectionDetailSelect}
24
+ ${ProductSelect}
25
+ ${ProductLittleSelect}
26
+ ${ProductOptionSelect}
27
+ ${ProductOptionValueSelect}
28
+ ${MediaSelect}
29
+ ${VariantSelect}
30
+ ${SelectedOptionSelect}`;
31
+
32
+ export { CollectionDetailFilterDocument };
@@ -0,0 +1,50 @@
1
+ import { ProductSelect } from '../fragments/product.generated.js';
2
+ import { ProductLittleSelect } from '../fragments/product-little.generated.js';
3
+ import { ProductOptionSelect } from '../fragments/product-option.generated.js';
4
+ import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
5
+ import { MediaSelect } from '../fragments/media.generated.js';
6
+ import { VariantSelect } from '../fragments/variant.generated.js';
7
+ import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
8
+
9
+ const CollectionDocument = `
10
+ query collection($first: Int = 5, $firstMedia: Int = 20, $afterMedia: Cursor, $firstVariant: Int = 20, $afterVariant: Cursor, $handle: String, $id: ID) {
11
+ collection(handle: $handle, id: $id) {
12
+ baseID
13
+ createdAt
14
+ deletedAt
15
+ description
16
+ descriptionMeta
17
+ handle
18
+ id
19
+ platform
20
+ products(first: $first) {
21
+ edges {
22
+ cursor
23
+ node {
24
+ ...ProductSelect
25
+ }
26
+ }
27
+ pageInfo {
28
+ endCursor
29
+ hasNextPage
30
+ hasPreviousPage
31
+ startCursor
32
+ }
33
+ totalCount
34
+ }
35
+ tags
36
+ templateSuffix
37
+ title
38
+ titleMeta
39
+ updatedAt
40
+ }
41
+ }
42
+ ${ProductSelect}
43
+ ${ProductLittleSelect}
44
+ ${ProductOptionSelect}
45
+ ${ProductOptionValueSelect}
46
+ ${MediaSelect}
47
+ ${VariantSelect}
48
+ ${SelectedOptionSelect}`;
49
+
50
+ export { CollectionDocument };
@@ -0,0 +1,21 @@
1
+ import { PublishedThemePageSelect } from '../fragments/published-theme-page.generated.js';
2
+ import { PublishedPageSectionSelect } from '../fragments/published-page-section.generated.js';
3
+ import { PublishedCustomSectionSelect } from '../fragments/published-custom-section.generated.js';
4
+ import { DataSeoSelect } from '../fragments/data-seo.generated.js';
5
+ import { PublishedThemeStyleSelect } from '../fragments/published-theme-style.generated.js';
6
+ import { AnalyticSelect } from '../fragments/analytic.generated.js';
7
+
8
+ const PreviewPageDocument = `
9
+ query previewPage($handleURL: String, $pageType: PublishedThemePageType!) {
10
+ previewPage(handleURL: $handleURL, pageType: $pageType) {
11
+ ...PublishedThemePageSelect
12
+ }
13
+ }
14
+ ${PublishedThemePageSelect}
15
+ ${PublishedPageSectionSelect}
16
+ ${PublishedCustomSectionSelect}
17
+ ${DataSeoSelect}
18
+ ${PublishedThemeStyleSelect}
19
+ ${AnalyticSelect}`;
20
+
21
+ export { PreviewPageDocument };
@@ -0,0 +1,22 @@
1
+ import { ProductLittleSelect } from '../fragments/product-little.generated.js';
2
+ import { ProductOptionSelect } from '../fragments/product-option.generated.js';
3
+ import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
4
+ import { MediaSelect } from '../fragments/media.generated.js';
5
+
6
+ const ProductLittleDetailDocument = `
7
+ query productLittleDetail($orderBy: ProductOrder, $where: ProductWhereInput) {
8
+ product: products(first: 1, orderBy: $orderBy, where: $where) {
9
+ edges {
10
+ cursor
11
+ node {
12
+ ...ProductLittleSelect
13
+ }
14
+ }
15
+ }
16
+ }
17
+ ${ProductLittleSelect}
18
+ ${ProductOptionSelect}
19
+ ${ProductOptionValueSelect}
20
+ ${MediaSelect}`;
21
+
22
+ export { ProductLittleDetailDocument };
@@ -0,0 +1,27 @@
1
+ import { MediaSelect } from '../fragments/media.generated.js';
2
+
3
+ const ProductMediasDocument = `
4
+ query productMedias($firstMedia: Int = 50, $afterMedia: Cursor, $orderBy: ProductOrder, $where: ProductWhereInput) {
5
+ medias: products(first: 1, orderBy: $orderBy, where: $where) {
6
+ edges {
7
+ node {
8
+ id
9
+ medias(first: $firstMedia, after: $afterMedia) {
10
+ edges {
11
+ cursor
12
+ node {
13
+ ...MediaSelect
14
+ }
15
+ }
16
+ pageInfo {
17
+ hasNextPage
18
+ endCursor
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ${MediaSelect}`;
26
+
27
+ export { ProductMediasDocument };
@@ -0,0 +1,31 @@
1
+ import { VariantSelect } from '../fragments/variant.generated.js';
2
+ import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
3
+ import { MediaSelect } from '../fragments/media.generated.js';
4
+
5
+ const ProductVariantsDocument = `
6
+ query productVariants($firstVariant: Int = 100, $afterVariant: Cursor, $orderBy: ProductOrder, $where: ProductWhereInput, $first: Int = 1) {
7
+ variants: products(first: $first, orderBy: $orderBy, where: $where) {
8
+ edges {
9
+ node {
10
+ id
11
+ variants(first: $firstVariant, after: $afterVariant) {
12
+ edges {
13
+ cursor
14
+ node {
15
+ ...VariantSelect
16
+ }
17
+ }
18
+ pageInfo {
19
+ hasNextPage
20
+ endCursor
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+ ${VariantSelect}
28
+ ${SelectedOptionSelect}
29
+ ${MediaSelect}`;
30
+
31
+ export { ProductVariantsDocument };
@@ -0,0 +1,38 @@
1
+ import { ProductSelect } from '../fragments/product.generated.js';
2
+ import { ProductLittleSelect } from '../fragments/product-little.generated.js';
3
+ import { ProductOptionSelect } from '../fragments/product-option.generated.js';
4
+ import { ProductOptionValueSelect } from '../fragments/product-option-value.generated.js';
5
+ import { MediaSelect } from '../fragments/media.generated.js';
6
+ import { VariantSelect } from '../fragments/variant.generated.js';
7
+ import { SelectedOptionSelect } from '../fragments/selected-option.generated.js';
8
+
9
+ const ProductsEdgeDetail = `
10
+ fragment ProductsEdgeDetail on ProductEdge {
11
+ cursor
12
+ node {
13
+ ...ProductSelect
14
+ }
15
+ }
16
+ `;
17
+ const ProductsDocument = `
18
+ query products($first: Int, $where: ProductWhereInput, $firstMedia: Int, $orderBy: ProductOrder, $after: Cursor, $firstVariant: Int, $afterVariant: Cursor, $afterMedia: Cursor) {
19
+ products(first: $first, where: $where, orderBy: $orderBy, after: $after) {
20
+ edges {
21
+ ...ProductsEdgeDetail
22
+ }
23
+ pageInfo {
24
+ endCursor
25
+ hasNextPage
26
+ }
27
+ }
28
+ }
29
+ ${ProductsEdgeDetail}
30
+ ${ProductSelect}
31
+ ${ProductLittleSelect}
32
+ ${ProductOptionSelect}
33
+ ${ProductOptionValueSelect}
34
+ ${MediaSelect}
35
+ ${VariantSelect}
36
+ ${SelectedOptionSelect}`;
37
+
38
+ export { ProductsDocument, ProductsEdgeDetail };
@@ -0,0 +1,21 @@
1
+ import { PublishedThemePageSelect } from '../fragments/published-theme-page.generated.js';
2
+ import { PublishedPageSectionSelect } from '../fragments/published-page-section.generated.js';
3
+ import { PublishedCustomSectionSelect } from '../fragments/published-custom-section.generated.js';
4
+ import { DataSeoSelect } from '../fragments/data-seo.generated.js';
5
+ import { PublishedThemeStyleSelect } from '../fragments/published-theme-style.generated.js';
6
+ import { AnalyticSelect } from '../fragments/analytic.generated.js';
7
+
8
+ const PublishedThemePagesDocument = `
9
+ query publishedThemePages($slug: String, $slugType: PublishedThemePageType!) {
10
+ publishedThemePages(slug: $slug, slugType: $slugType) {
11
+ ...PublishedThemePageSelect
12
+ }
13
+ }
14
+ ${PublishedThemePageSelect}
15
+ ${PublishedPageSectionSelect}
16
+ ${PublishedCustomSectionSelect}
17
+ ${DataSeoSelect}
18
+ ${PublishedThemeStyleSelect}
19
+ ${AnalyticSelect}`;
20
+
21
+ export { PublishedThemePagesDocument };
@@ -0,0 +1,10 @@
1
+ const StorePropertyDocument = `
2
+ query storeProperty {
3
+ storeProperty {
4
+ favicon
5
+ swatchesConfig
6
+ }
7
+ }
8
+ `;
9
+
10
+ export { StorePropertyDocument };
@@ -0,0 +1,13 @@
1
+ const globalEvent = {
2
+ subscribe(callback) {
3
+ document.addEventListener('onDispatch', (e) => callback(e.detail));
4
+ },
5
+ dispatch(data) {
6
+ document.dispatchEvent(new CustomEvent('onDispatch', { detail: data }));
7
+ },
8
+ remove(callback) {
9
+ document.removeEventListener('onDispatch', callback);
10
+ },
11
+ };
12
+
13
+ export { globalEvent as default };
@@ -0,0 +1,102 @@
1
+ import { isColor } from './colors.js';
2
+ import { makeStyleResponsive } from './make-style.js';
3
+
4
+ const getStyleBackgroundByDevice = (background) => {
5
+ if (!background) {
6
+ return {};
7
+ }
8
+ return {
9
+ ...getStyleBgColor(background),
10
+ ...getStyleBgImage(background),
11
+ ...getStyleBgPosition(background),
12
+ ...getStyleBgSize(background),
13
+ ...getStyleBgRepeat(background),
14
+ ...getStyleBgAttachment(background),
15
+ };
16
+ };
17
+ const getStyleBgColor = (background) => {
18
+ const bgColor = {
19
+ desktop: getBgColorByDevice(background, 'desktop'),
20
+ tablet: getBgColorByDevice(background, 'tablet'),
21
+ mobile: getBgColorByDevice(background, 'mobile'),
22
+ };
23
+ return makeStyleResponsive('bgc', bgColor);
24
+ };
25
+ const getBgColorByDevice = (background, device) => {
26
+ return getColor(background?.[device]?.color);
27
+ };
28
+ const getColor = (color) => {
29
+ if (!color) {
30
+ return;
31
+ }
32
+ if (isColor(color?.toString())) {
33
+ return color;
34
+ }
35
+ return `var(--g-c-${color})`;
36
+ };
37
+ const getStyleBgImage = (background) => {
38
+ const bgImage = {
39
+ // desktop:
40
+ // background.desktop?.type === 'color' ? 'none' : getBgImageByDevice(background, 'desktop'),
41
+ // tablet: background.tablet?.type === 'color' ? 'none' : getBgImageByDevice(background, 'tablet'),
42
+ // mobile: background.mobile?.type === 'color' ? 'none' : getBgImageByDevice(background, 'mobile'),
43
+ desktop: getBgImageByDevice(background, 'desktop'),
44
+ tablet: getBgImageByDevice(background, 'tablet'),
45
+ mobile: getBgImageByDevice(background, 'mobile'),
46
+ };
47
+ return makeStyleResponsive('bgi', bgImage);
48
+ };
49
+ const getBgImageByDevice = (background, device) => {
50
+ const imageByDevice = background?.[device]?.image?.src;
51
+ if (typeof imageByDevice === 'string') {
52
+ return `url(${imageByDevice})`;
53
+ }
54
+ return;
55
+ };
56
+ const getStyleBgPosition = (background) => {
57
+ const bgPosition = {
58
+ desktop: getBgPositionByDevice(background, 'desktop'),
59
+ tablet: getBgPositionByDevice(background, 'tablet'),
60
+ mobile: getBgPositionByDevice(background, 'mobile'),
61
+ };
62
+ return makeStyleResponsive('bgp', bgPosition);
63
+ };
64
+ const getBgPositionByDevice = (background, device) => {
65
+ const positionByDevice = background?.[device]?.position;
66
+ return positionByDevice && `${positionByDevice.x}% ${positionByDevice.y}%`;
67
+ };
68
+ const getStyleBgSize = (background) => {
69
+ const bgSize = {
70
+ desktop: getBgSizeByDevice(background, 'desktop'),
71
+ tablet: getBgSizeByDevice(background, 'tablet'),
72
+ mobile: getBgSizeByDevice(background, 'mobile'),
73
+ };
74
+ return makeStyleResponsive('bgs', bgSize);
75
+ };
76
+ const getBgSizeByDevice = (background, device) => {
77
+ return background?.[device]?.size;
78
+ };
79
+ const getStyleBgRepeat = (background) => {
80
+ const bgRepeat = {
81
+ desktop: getBgRepeatByDevice(background, 'desktop'),
82
+ tablet: getBgRepeatByDevice(background, 'tablet'),
83
+ mobile: getBgRepeatByDevice(background, 'mobile'),
84
+ };
85
+ return makeStyleResponsive('bgr', bgRepeat);
86
+ };
87
+ const getBgRepeatByDevice = (background, device) => {
88
+ return background?.[device]?.repeat;
89
+ };
90
+ const getStyleBgAttachment = (background) => {
91
+ const bgAttachment = {
92
+ desktop: getBgAttachmentByDevice(background, 'desktop'),
93
+ tablet: getBgAttachmentByDevice(background, 'tablet'),
94
+ mobile: getBgAttachmentByDevice(background, 'mobile'),
95
+ };
96
+ return makeStyleResponsive('bga', bgAttachment);
97
+ };
98
+ const getBgAttachmentByDevice = (background, device) => {
99
+ return background?.[device]?.attachment;
100
+ };
101
+
102
+ export { getStyleBackgroundByDevice };