@lightspeed/crane 2.0.4 → 3.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 (131) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/UPGRADE.md +96 -0
  3. package/dist/cli.mjs +44 -25
  4. package/package.json +6 -3
  5. package/template/blank/sections/blank-section/BlankSection.vue +9 -0
  6. package/template/blank/sections/blank-section/assets/blank_section_showcase_1_preview.jpg +0 -0
  7. package/template/blank/sections/blank-section/client.ts +6 -0
  8. package/template/blank/sections/blank-section/server.ts +6 -0
  9. package/template/blank/sections/blank-section/settings/content.ts +2 -0
  10. package/template/blank/sections/blank-section/settings/design.ts +2 -0
  11. package/template/blank/sections/blank-section/settings/layout.ts +2 -0
  12. package/template/blank/sections/blank-section/settings/translations.ts +8 -0
  13. package/template/blank/sections/blank-section/showcases/1.ts +15 -0
  14. package/template/blank/sections/blank-section/showcases/translations.ts +10 -0
  15. package/template/blank/sections/blank-section/type.ts +5 -0
  16. package/template/collections/assets/collection_cover_image.png +0 -0
  17. package/template/collections/example-collection/configuration.ts +21 -0
  18. package/template/crane.config.json +1 -1
  19. package/template/footers/example-footer/ExampleFooter.vue +4 -4
  20. package/template/footers/example-footer/component/LegalLinks.vue +1 -1
  21. package/template/footers/example-footer/component/MadeWith.vue +1 -1
  22. package/template/footers/example-footer/component/ReportAbuse.vue +1 -1
  23. package/template/footers/example-footer/settings/design.ts +5 -4
  24. package/template/footers/example-footer/settings/translations.ts +4 -3
  25. package/template/footers/example-footer/showcases/1.ts +4 -2
  26. package/template/footers/example-footer/showcases/translations.ts +4 -2
  27. package/template/headers/example-header/ExampleHeader.vue +1 -1
  28. package/template/headers/example-header/component/Account.vue +1 -1
  29. package/template/headers/example-header/component/CategoriesDropdown.vue +1 -1
  30. package/template/headers/example-header/component/Logo.vue +7 -7
  31. package/template/headers/example-header/component/NavigationMenu.vue +1 -1
  32. package/template/headers/example-header/settings/content.ts +8 -1
  33. package/template/headers/example-header/settings/design.ts +7 -1
  34. package/template/headers/example-header/settings/layout.ts +1 -1
  35. package/template/headers/example-header/settings/translations.ts +4 -2
  36. package/template/headers/example-header/showcases/1.ts +15 -11
  37. package/template/headers/example-header/showcases/2.ts +12 -8
  38. package/template/headers/example-header/showcases/translations.ts +4 -2
  39. package/template/layouts/catalog/example-catalog/components/Icon.vue +14 -14
  40. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/CustomBottomBar.vue +1 -1
  41. package/template/package.json +1 -0
  42. package/template/page-templates/example-template/configuration.ts +8 -10
  43. package/template/page-templates/example-template/pages/catalog.ts +3 -6
  44. package/template/page-templates/example-template/pages/category.ts +3 -6
  45. package/template/page-templates/example-template/pages/home.ts +42 -57
  46. package/template/page-templates/example-template/pages/product.ts +3 -6
  47. package/template/preview/sections/preview.html +10 -6
  48. package/template/preview/shared/api-routes.ts +235 -102
  49. package/template/preview/shared/logger.ts +9 -0
  50. package/template/preview/shared/preview.ts +150 -69
  51. package/template/preview/shared/utils.ts +63 -43
  52. package/template/preview/ssr-server.ts +1 -1
  53. package/template/reference/sections/about-us/AboutUs.vue +20 -22
  54. package/template/reference/sections/about-us/component/Image.vue +18 -18
  55. package/template/reference/sections/about-us/component/Stats.vue +42 -42
  56. package/template/reference/sections/about-us/component/Title.vue +1 -1
  57. package/template/reference/sections/about-us/settings/content.ts +15 -19
  58. package/template/reference/sections/about-us/settings/design.ts +14 -18
  59. package/template/reference/sections/about-us/settings/layout.ts +7 -5
  60. package/template/reference/sections/about-us/settings/translations.ts +4 -2
  61. package/template/reference/sections/about-us/showcases/1.ts +48 -62
  62. package/template/reference/sections/about-us/showcases/2.ts +44 -56
  63. package/template/reference/sections/about-us/showcases/translations.ts +4 -2
  64. package/template/reference/sections/featured-products/FeaturedProducts.vue +12 -6
  65. package/template/reference/sections/featured-products/component/ProductItem.vue +18 -1
  66. package/template/reference/sections/featured-products/component/ProductPlaceholder.vue +42 -0
  67. package/template/reference/sections/featured-products/component/Title.vue +1 -1
  68. package/template/reference/sections/featured-products/settings/content.ts +8 -10
  69. package/template/reference/sections/featured-products/settings/design.ts +7 -7
  70. package/template/reference/sections/featured-products/settings/translations.ts +4 -2
  71. package/template/reference/sections/featured-products/showcases/1.ts +8 -12
  72. package/template/reference/sections/featured-products/showcases/translations.ts +4 -2
  73. package/template/reference/sections/intro-slider/IntroSlider.vue +6 -6
  74. package/template/reference/sections/intro-slider/component/Slider.vue +43 -44
  75. package/template/reference/sections/intro-slider/component/Title.vue +9 -9
  76. package/template/reference/sections/intro-slider/settings/content.ts +36 -22
  77. package/template/reference/sections/intro-slider/settings/design.ts +17 -22
  78. package/template/reference/sections/intro-slider/settings/layout.ts +6 -4
  79. package/template/reference/sections/intro-slider/settings/translations.ts +4 -2
  80. package/template/reference/sections/intro-slider/showcases/1.ts +52 -75
  81. package/template/reference/sections/intro-slider/showcases/2.ts +50 -72
  82. package/template/reference/sections/intro-slider/showcases/translations.ts +4 -2
  83. package/template/reference/sections/tag-lines/TagLines.vue +41 -47
  84. package/template/reference/sections/tag-lines/component/HighlightedText.vue +2 -2
  85. package/template/reference/sections/tag-lines/component/SectionImage.vue +18 -18
  86. package/template/reference/sections/tag-lines/component/Title.vue +2 -2
  87. package/template/reference/sections/tag-lines/settings/content.ts +53 -19
  88. package/template/reference/sections/tag-lines/settings/design.ts +15 -19
  89. package/template/reference/sections/tag-lines/settings/layout.ts +6 -4
  90. package/template/reference/sections/tag-lines/settings/translations.ts +4 -2
  91. package/template/reference/sections/tag-lines/showcases/1.ts +40 -50
  92. package/template/reference/sections/tag-lines/showcases/2.ts +40 -50
  93. package/template/reference/sections/tag-lines/showcases/translations.ts +4 -2
  94. package/template/reference/sections/trending-categories/TrendingCategories.vue +1 -1
  95. package/template/reference/sections/trending-categories/component/CategoryItem.vue +18 -1
  96. package/template/reference/sections/trending-categories/component/Title.vue +2 -2
  97. package/template/reference/sections/trending-categories/settings/content.ts +8 -10
  98. package/template/reference/sections/trending-categories/settings/design.ts +7 -7
  99. package/template/reference/sections/trending-categories/settings/translations.ts +4 -2
  100. package/template/reference/sections/trending-categories/showcases/1.ts +14 -15
  101. package/template/reference/sections/trending-categories/showcases/translations.ts +4 -2
  102. package/template/reference/shared/components/Button.vue +6 -6
  103. package/template/reference/shared/components/SectionWrapper.vue +5 -5
  104. package/template/reference/shared/components/Tagline.vue +12 -11
  105. package/template/reference/templates/reference-template-apparel/configuration.ts +8 -8
  106. package/template/reference/templates/reference-template-apparel/pages/catalog.ts +3 -6
  107. package/template/reference/templates/reference-template-apparel/pages/category.ts +3 -6
  108. package/template/reference/templates/reference-template-apparel/pages/home.ts +14 -18
  109. package/template/reference/templates/reference-template-apparel/pages/product.ts +3 -6
  110. package/template/reference/templates/reference-template-bike/configuration.ts +9 -9
  111. package/template/reference/templates/reference-template-bike/pages/catalog.ts +3 -6
  112. package/template/reference/templates/reference-template-bike/pages/category.ts +3 -6
  113. package/template/reference/templates/reference-template-bike/pages/home.ts +14 -18
  114. package/template/reference/templates/reference-template-bike/pages/product.ts +3 -6
  115. package/template/sections/example-section/ExampleSection.vue +3 -5
  116. package/template/sections/example-section/component/button/Button.vue +1 -1
  117. package/template/sections/example-section/component/image/Image.vue +43 -43
  118. package/template/sections/example-section/component/image/ImagesGrid.vue +21 -32
  119. package/template/sections/example-section/component/selectbox/Selectbox.vue +1 -1
  120. package/template/sections/example-section/component/title/Title.vue +1 -1
  121. package/template/sections/example-section/component/toggle/Toggle.vue +4 -4
  122. package/template/sections/example-section/settings/content.ts +25 -34
  123. package/template/sections/example-section/settings/design.ts +15 -19
  124. package/template/sections/example-section/settings/layout.ts +15 -14
  125. package/template/sections/example-section/settings/translations.ts +4 -2
  126. package/template/sections/example-section/showcases/1.ts +52 -79
  127. package/template/sections/example-section/showcases/2.ts +46 -62
  128. package/template/sections/example-section/showcases/3.ts +50 -76
  129. package/template/sections/example-section/showcases/translations.ts +4 -2
  130. package/template/shared/components/LanguageSelector.vue +1 -1
  131. package/template/shared/components/SectionWrapper.vue +5 -5
@@ -1,36 +1,34 @@
1
+ import {
2
+ section,
3
+ content,
4
+ design,
5
+ } from '@lightspeed/crane-api';
6
+
1
7
  export default {
2
8
  sections: [
3
- {
4
- type: 'default',
9
+ section.default({
5
10
  id: 'slider',
6
11
  showcase_id: '001',
7
- },
8
- {
9
- type: 'custom',
12
+ }),
13
+ section.custom({
10
14
  id: 'example-section',
11
15
  showcase_id: '1',
12
- },
13
- {
14
- type: 'custom',
16
+ }),
17
+ section.custom({
15
18
  id: 'example-section',
16
19
  showcase_overrides: {
17
20
  content: {
18
- section_title: {
19
- type: 'INPUTBOX',
21
+ section_title: content.default.inputbox({
20
22
  text: '$label.template_standard_showcase_1.section_title.text',
21
- },
22
-
23
- images: {
24
- type: 'DECK',
23
+ }),
24
+ images: content.default.deck({
25
25
  cards: [
26
26
  {
27
27
  settings: {
28
- image_text: {
29
- type: 'TEXTAREA',
28
+ image_text: content.default.textarea({
30
29
  text: '$label.showcase_2.image_text_1.text',
31
- },
32
- image_content: {
33
- type: 'IMAGE',
30
+ }),
31
+ image_content: content.default.image({
34
32
  imageData: {
35
33
  set: {
36
34
  MOBILE_WEBP_LOW_RES: {
@@ -48,21 +46,18 @@ export default {
48
46
  },
49
47
  borderInfo: {},
50
48
  },
51
- },
52
- image_link: {
53
- type: 'INPUTBOX',
49
+ }),
50
+ image_link: content.default.inputbox({
54
51
  text: '$label.showcase_2.image_link_1.text',
55
- },
52
+ }),
56
53
  },
57
54
  },
58
55
  {
59
56
  settings: {
60
- image_text: {
61
- type: 'TEXTAREA',
57
+ image_text: content.default.textarea({
62
58
  text: '$label.showcase_2.image_text_2.text',
63
- },
64
- image_content: {
65
- type: 'IMAGE',
59
+ }),
60
+ image_content: content.default.image({
66
61
  imageData: {
67
62
  set: {
68
63
  MOBILE_WEBP_LOW_RES: {
@@ -80,18 +75,15 @@ export default {
80
75
  },
81
76
  borderInfo: {},
82
77
  },
83
- },
78
+ }),
84
79
  },
85
80
  },
86
-
87
81
  {
88
82
  settings: {
89
- image_text: {
90
- type: 'TEXTAREA',
83
+ image_text: content.default.textarea({
91
84
  text: '$label.showcase_2.image_text_3.text',
92
- },
93
- image_content: {
94
- type: 'IMAGE',
85
+ }),
86
+ image_content: content.default.image({
95
87
  imageData: {
96
88
  set: {
97
89
  MOBILE_WEBP_LOW_RES: {
@@ -109,18 +101,15 @@ export default {
109
101
  },
110
102
  borderInfo: {},
111
103
  },
112
- },
104
+ }),
113
105
  },
114
106
  },
115
-
116
107
  {
117
108
  settings: {
118
- image_text: {
119
- type: 'TEXTAREA',
109
+ image_text: content.default.textarea({
120
110
  text: '$label.showcase_2.image_text_4.text',
121
- },
122
- image_content: {
123
- type: 'IMAGE',
111
+ }),
112
+ image_content: content.default.image({
124
113
  imageData: {
125
114
  set: {
126
115
  MOBILE_WEBP_LOW_RES: {
@@ -138,41 +127,37 @@ export default {
138
127
  },
139
128
  borderInfo: {},
140
129
  },
141
- },
130
+ }),
142
131
  },
143
132
  },
144
133
  ],
145
- },
134
+ }),
146
135
  },
147
136
  design: {
148
- section_title: {
149
- type: 'TEXT',
137
+ section_title: design.default.text({
150
138
  font: 'global.fontFamily.body',
151
139
  size: 42,
152
140
  bold: true,
153
141
  italic: true,
154
142
  color: '#222',
155
- },
156
- image_text: {
157
- type: 'TEXT',
143
+ }),
144
+ image_text: design.default.text({
158
145
  size: 22,
159
146
  bold: false,
160
147
  italic: true,
161
- },
162
- background: {
163
- type: 'BACKGROUND',
148
+ }),
149
+ background: design.default.background({
164
150
  style: 'COLOR',
165
151
  color: 'global.color.background',
166
- },
167
- image_content: {
168
- type: 'IMAGE',
152
+ }),
153
+ image_content: design.default.image({
169
154
  overlay: 'GRADIENT',
170
155
  color: ['#FFFFFF', '#CCCCCC'],
171
- },
156
+ }),
172
157
  },
173
158
  layoutId: 'Caption_Under_Image',
174
159
  blockName: '$label.showcase_2.blockName',
175
160
  },
176
- },
161
+ }),
177
162
  ],
178
163
  };
@@ -1,10 +1,7 @@
1
- import { StorePageConfiguration } from '@lightspeed/crane-api';
1
+ import { section } from '@lightspeed/crane-api';
2
2
 
3
3
  export default {
4
4
  sections: [
5
- {
6
- type: 'store',
7
- id: undefined,
8
- },
5
+ section.store({}),
9
6
  ],
10
- } satisfies StorePageConfiguration;
7
+ };
@@ -63,7 +63,11 @@
63
63
 
64
64
  setDistFolderPath("../../../dist");
65
65
 
66
- const showcaseModules = import.meta.glob('../../dist/sections/*/js/showcases/*.mjs');
66
+ const showcaseModules = {
67
+ ...import.meta.glob('../../dist/sections/*/js/showcases/*.mjs'),
68
+ ...import.meta.glob('../../dist/headers/*/js/showcases/*.mjs'),
69
+ ...import.meta.glob('../../dist/footers/*/js/showcases/*.mjs'),
70
+ };
67
71
  const select = document.getElementById('showcaseDropdown');
68
72
  const showCaseOptions = dropdownOptions(showcaseModules);
69
73
 
@@ -102,14 +106,14 @@
102
106
 
103
107
  select.addEventListener('change', async (e) => {
104
108
  const showcaseValue = e.target.value;
105
- const [sectionName, showcaseId] = showcaseValue.split(':');
109
+ const [blockType, blockName, showcaseId] = showcaseValue.split(':');
106
110
 
107
111
  // Save the active showcase to sessionStorage
108
112
  saveActiveShowcase(showcaseValue);
109
113
 
110
114
  // Render the showcase
111
- renderShowcase(sectionName, showcaseId);
112
- fetch(`${window.location.origin}/chosen-section/${sectionName}`)
115
+ renderShowcase(blockType, blockName, showcaseId);
116
+ fetch(`${window.location.origin}/chosen-section/${blockName}`)
113
117
  .catch(console.error);
114
118
  });
115
119
 
@@ -131,8 +135,8 @@
131
135
 
132
136
  // Render the initial showcase
133
137
  if (initialShowcase) {
134
- const [sectionName, showcaseId] = initialShowcase.split(':');
135
- renderShowcase(sectionName, showcaseId);
138
+ const [blockType, blockName, showcaseId] = initialShowcase.split(':');
139
+ renderShowcase(blockType, blockName, showcaseId);
136
140
  }
137
141
  </script>
138
142
  </body>