@lightspeed/crane 1.1.2 → 1.2.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 (134) hide show
  1. package/bin/crane.js +0 -1
  2. package/dist/app.d.mts +20 -2
  3. package/dist/app.d.ts +20 -2
  4. package/dist/app.mjs +1 -1
  5. package/dist/cli.mjs +10 -23
  6. package/package.json +10 -5
  7. package/template/footers/example-footer/ExampleFooter.vue +6 -1
  8. package/template/footers/example-footer/assets/cart.svg +19 -0
  9. package/template/footers/example-footer/component/LegalLinks.vue +2 -2
  10. package/template/footers/example-footer/component/MadeWith.vue +23 -0
  11. package/template/footers/example-footer/component/ReportAbuse.vue +4 -3
  12. package/template/footers/example-footer/showcases/1.ts +1 -1
  13. package/template/headers/example-header/ExampleHeader.vue +17 -2
  14. package/template/headers/example-header/component/Account.vue +4 -4
  15. package/template/headers/example-header/component/Cart.vue +14 -33
  16. package/template/headers/example-header/settings/content.ts +1 -9
  17. package/template/headers/example-header/settings/design.ts +1 -23
  18. package/template/package.json +1 -1
  19. package/template/reference/sections/about-us/AboutUs.vue +73 -0
  20. package/template/reference/sections/about-us/assets/our_company_in_numbers.jpg +0 -0
  21. package/template/reference/sections/about-us/assets/our_company_in_numbers_preview.jpg +0 -0
  22. package/template/reference/sections/about-us/assets/our_team.jpg +0 -0
  23. package/template/reference/sections/about-us/assets/our_team_preview.jpg +0 -0
  24. package/template/reference/sections/about-us/client.ts +6 -0
  25. package/template/reference/sections/about-us/component/Image.vue +94 -0
  26. package/template/reference/sections/about-us/component/Stats.vue +155 -0
  27. package/template/reference/sections/about-us/component/Title.vue +32 -0
  28. package/template/reference/sections/about-us/server.ts +6 -0
  29. package/template/reference/sections/about-us/settings/content.ts +64 -0
  30. package/template/reference/sections/about-us/settings/design.ts +74 -0
  31. package/template/reference/sections/about-us/settings/layout.ts +12 -0
  32. package/template/reference/sections/about-us/settings/translations.ts +151 -0
  33. package/template/reference/sections/about-us/showcases/1.ts +155 -0
  34. package/template/reference/sections/about-us/showcases/2.ts +143 -0
  35. package/template/reference/sections/about-us/showcases/translations.ts +259 -0
  36. package/template/reference/sections/about-us/type.ts +5 -0
  37. package/template/reference/sections/about-us/util/visibility-provider.ts +27 -0
  38. package/template/reference/sections/intro-slider/IntroSlider.vue +77 -0
  39. package/template/reference/sections/intro-slider/assets/bike_1.jpg +0 -0
  40. package/template/reference/sections/intro-slider/assets/bike_1@2x.jpg +0 -0
  41. package/template/reference/sections/intro-slider/assets/bike_2.jpg +0 -0
  42. package/template/reference/sections/intro-slider/assets/bike_2@2x.jpg +0 -0
  43. package/template/reference/sections/intro-slider/assets/bike_3.jpg +0 -0
  44. package/template/reference/sections/intro-slider/assets/bike_3@2x.jpg +0 -0
  45. package/template/reference/sections/intro-slider/assets/bike_4.jpg +0 -0
  46. package/template/reference/sections/intro-slider/assets/bike_4@2x.jpg +0 -0
  47. package/template/reference/sections/intro-slider/assets/bike_5.jpg +0 -0
  48. package/template/reference/sections/intro-slider/assets/bike_5@2x.jpg +0 -0
  49. package/template/reference/sections/intro-slider/assets/bike_6.jpg +0 -0
  50. package/template/reference/sections/intro-slider/assets/bike_6@2x.jpg +0 -0
  51. package/template/reference/sections/intro-slider/assets/category_1.jpg +0 -0
  52. package/template/reference/sections/intro-slider/assets/category_1@2x.jpg +0 -0
  53. package/template/reference/sections/intro-slider/assets/category_2.jpg +0 -0
  54. package/template/reference/sections/intro-slider/assets/category_2@2x.jpg +0 -0
  55. package/template/reference/sections/intro-slider/assets/category_3.jpg +0 -0
  56. package/template/reference/sections/intro-slider/assets/category_3@2x.jpg +0 -0
  57. package/template/reference/sections/intro-slider/assets/category_5.jpg +0 -0
  58. package/template/reference/sections/intro-slider/assets/category_5@2x.jpg +0 -0
  59. package/template/reference/sections/intro-slider/assets/category_6.jpg +0 -0
  60. package/template/reference/sections/intro-slider/assets/category_6@2x.jpg +0 -0
  61. package/template/reference/sections/intro-slider/assets/custom_section_showcase_1_preview.png +0 -0
  62. package/template/reference/sections/intro-slider/assets/custom_section_showcase_2_preview.png +0 -0
  63. package/template/reference/sections/intro-slider/client.ts +5 -0
  64. package/template/reference/sections/intro-slider/component/Slider.vue +235 -0
  65. package/template/reference/sections/intro-slider/component/Title.vue +106 -0
  66. package/template/reference/sections/intro-slider/entity/color.ts +4 -0
  67. package/template/reference/sections/intro-slider/server.ts +5 -0
  68. package/template/reference/sections/intro-slider/settings/content.ts +43 -0
  69. package/template/reference/sections/intro-slider/settings/design.ts +88 -0
  70. package/template/reference/sections/intro-slider/settings/layout.ts +12 -0
  71. package/template/reference/sections/intro-slider/settings/translations.ts +53 -0
  72. package/template/reference/sections/intro-slider/showcases/1.ts +275 -0
  73. package/template/reference/sections/intro-slider/showcases/2.ts +271 -0
  74. package/template/reference/sections/intro-slider/showcases/translations.ts +88 -0
  75. package/template/reference/sections/intro-slider/type.ts +5 -0
  76. package/template/reference/sections/tag-lines/TagLines.vue +158 -0
  77. package/template/reference/sections/tag-lines/assets/explore_our_holiday_gift_guide.jpg +0 -0
  78. package/template/reference/sections/tag-lines/assets/fall_is_here.jpg +0 -0
  79. package/template/reference/sections/tag-lines/assets/fall_is_here_preview.jpg +0 -0
  80. package/template/reference/sections/tag-lines/assets/folding_bikes.jpg +0 -0
  81. package/template/reference/sections/tag-lines/assets/hybrid_bikes.jpg +0 -0
  82. package/template/reference/sections/tag-lines/assets/mountain_and_road_bikes.jpg +0 -0
  83. package/template/reference/sections/tag-lines/assets/shop_chelsea_boots.jpg +0 -0
  84. package/template/reference/sections/tag-lines/assets/sweater_weather.jpg +0 -0
  85. package/template/reference/sections/tag-lines/assets/what_we_sell.jpg +0 -0
  86. package/template/reference/sections/tag-lines/assets/what_we_sell_preview.jpg +0 -0
  87. package/template/reference/sections/tag-lines/client.ts +5 -0
  88. package/template/reference/sections/tag-lines/component/HighlightedText.vue +50 -0
  89. package/template/reference/sections/tag-lines/component/SectionImage.vue +78 -0
  90. package/template/reference/sections/tag-lines/component/Title.vue +51 -0
  91. package/template/reference/sections/tag-lines/composables/highlighted-text-image-list.ts +34 -0
  92. package/template/reference/sections/tag-lines/server.ts +5 -0
  93. package/template/reference/sections/tag-lines/settings/content.ts +37 -0
  94. package/template/reference/sections/tag-lines/settings/design.ts +81 -0
  95. package/template/reference/sections/tag-lines/settings/layout.ts +12 -0
  96. package/template/reference/sections/tag-lines/settings/translations.ts +61 -0
  97. package/template/reference/sections/tag-lines/showcases/1.ts +190 -0
  98. package/template/reference/sections/tag-lines/showcases/2.ts +190 -0
  99. package/template/reference/sections/tag-lines/showcases/translations.ts +49 -0
  100. package/template/reference/sections/tag-lines/type.ts +5 -0
  101. package/template/reference/shared/components/Button.vue +151 -0
  102. package/template/reference/shared/components/SectionWrapper.vue +26 -0
  103. package/template/reference/shared/components/Tagline.vue +45 -0
  104. package/template/reference/shared/utils/color.ts +16 -0
  105. package/template/reference/shared/utils/styles.ts +12 -0
  106. package/template/reference/templates/assets/reference_template_apparel_cover_image.jpg +0 -0
  107. package/template/reference/templates/assets/reference_template_bike_cover_image.jpg +0 -0
  108. package/template/reference/templates/reference-template-apparel.ts +44 -0
  109. package/template/reference/templates/reference-template-bike.ts +44 -0
  110. package/template/sections/example-section/ExampleSection.vue +21 -24
  111. package/template/sections/example-section/assets/arrow.svg +3 -0
  112. package/template/sections/example-section/assets/bike_accessories_high.jpg +0 -0
  113. package/template/sections/example-section/assets/bike_accessories_low.jpg +0 -0
  114. package/template/sections/example-section/assets/bike_new_arrivals_high.jpg +0 -0
  115. package/template/sections/example-section/assets/bike_new_arrivals_low.jpg +0 -0
  116. package/template/sections/example-section/assets/custom_section_showcase_3_preview.jpg +0 -0
  117. package/template/sections/example-section/assets/fixed_gears_high.jpg +0 -0
  118. package/template/sections/example-section/assets/fixed_gears_low.jpg +0 -0
  119. package/template/sections/example-section/assets/repair_service_high.jpg +0 -0
  120. package/template/sections/example-section/assets/repair_service_low.jpg +0 -0
  121. package/template/sections/example-section/component/button/Button.vue +87 -0
  122. package/template/sections/example-section/component/selectbox/Selectbox.vue +45 -0
  123. package/template/sections/example-section/component/toggle/Toggle.vue +110 -0
  124. package/template/sections/example-section/settings/content.ts +45 -0
  125. package/template/sections/example-section/settings/translations.ts +87 -7
  126. package/template/sections/example-section/showcases/1.ts +43 -0
  127. package/template/sections/example-section/showcases/2.ts +43 -0
  128. package/template/sections/example-section/showcases/3.ts +241 -0
  129. package/template/sections/example-section/showcases/translations.ts +205 -1
  130. package/template/shared/{LanguageSelector.vue → components/LanguageSelector.vue} +5 -5
  131. package/template/shared/components/SectionWrapper.vue +26 -0
  132. package/template/shared/utils.ts +28 -0
  133. package/template/templates/template.ts +2 -1
  134. package/types.d.ts +96 -70
@@ -3,7 +3,7 @@ export default {
3
3
  previewImage: {
4
4
  set: {
5
5
  ORIGINAL: {
6
- url: 'example_footer_showcase_1_preview.jpg',
6
+ url: 'example_footer_showcase_1_preview.png',
7
7
  },
8
8
  },
9
9
  },
@@ -15,7 +15,7 @@
15
15
 
16
16
  <script setup lang="ts">
17
17
  import NavigationMenu from './component/NavigationMenu.vue';
18
- import LanguageSelector from '../../shared/LanguageSelector.vue';
18
+ import LanguageSelector from '../../shared/components/LanguageSelector.vue';
19
19
  import CartIcon from './component/Cart.vue';
20
20
  import Logo from './component/Logo.vue';
21
21
  import SearchForm from './component/SearchForm.vue';
@@ -27,16 +27,31 @@ import Account from './component/Account.vue';
27
27
  display: flex;
28
28
  justify-content: space-between;
29
29
  padding: 5px 10px;
30
+
30
31
  .custom-header__right{
31
32
  display: flex;
32
33
  flex: 0 0 auto;
33
34
  gap: 10px;
34
35
  align-items: center;
35
- justify-content: flex-end;
36
+ justify-content: flex-start;
37
+ }
38
+
39
+ .custom-header__right {
36
40
  order: 3;
37
41
  text-align: right;
38
42
  }
43
+
44
+ .custom-header__left{
45
+ display: flex;
46
+ flex: 0 0 auto;
47
+ gap: 10px;
48
+ align-items: center;
49
+ justify-content: flex-end;
50
+ order: 3;
51
+ text-align: left;
52
+ }
39
53
  }
54
+
40
55
  .header-content {
41
56
  padding: 0 12px;
42
57
  height: 48px;
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <div v-if="externalContent?.account">
3
- <a :href="externalContent.account?.url" :target="externalContent.account?.target">
2
+ <div v-if="account">
3
+ <a :href="account?.url" :target="account?.target">
4
4
  <img :src="accountIcon" alt="account icon" />
5
5
  </a>
6
6
  </div>
@@ -8,12 +8,12 @@
8
8
 
9
9
  <script setup lang="ts">
10
10
  import { useVueBaseProps } from '@lightspeed/crane';
11
- import { computed } from 'vue';
12
11
  import { Design } from '../type.ts';
13
12
  import accountIcon from '../assets/account_icon.svg';
14
13
 
15
14
  const baseProps = useVueBaseProps<unknown, Design>();
16
- const externalContent: ExternalContentData = computed(() => baseProps.externalContent).value as ExternalContentData;
15
+ const siteContent: SiteContent = baseProps.site.value satisfies SiteContent;
16
+ const account = siteContent.account;
17
17
  </script>
18
18
 
19
19
  <style lang="scss" scoped>
@@ -1,47 +1,28 @@
1
1
  <template>
2
2
  <div class="cart-icon">
3
- <a href="/products/cart" role="button">
3
+ <a :href="cart.url" role="button">
4
4
  <img alt="cart" src="../assets/cart.svg">
5
5
  <span
6
- v-if="cartItemCount > 0"
6
+ v-if="cart.count > 0"
7
7
  class="item-count"
8
8
  >
9
- {{ cartItemCount > 99 ? '99+' : cartItemCount }}
9
+ {{ cart.count > 99 ? '99+' : cart.count }}
10
10
  </span>
11
11
  </a>
12
12
  </div>
13
13
  </template>
14
14
 
15
- <script setup>
16
- import Ecommerce from '@ecwid/sdk';
17
- import { ref } from 'vue';
18
-
19
- const cartItemCount = ref(0);
20
- const ecommerce = new Ecommerce({
21
- storeId: window.Ecwid.getOwnerId(),
22
- });
23
-
24
- function setCartItemCount() {
25
- ecommerce.cart.get().then((result) => {
26
- cartItemCount.value = result?.productsQuantity ?? 0;
27
- });
28
- }
29
-
30
- function subscribeOnCartChange() {
31
- if (typeof document === 'undefined') {
32
- return;
33
- }
34
-
35
- document.addEventListener('visibilitychange', () => {
36
- if (document.visibilityState !== 'hidden') {
37
- setCartItemCount();
38
- }
39
- }, false);
40
-
41
- setCartItemCount();
42
- }
43
-
44
- subscribeOnCartChange();
15
+ <script setup lang="ts">
16
+ import { useVueBaseProps } from '@lightspeed/crane';
17
+ import { computed } from 'vue';
18
+ import { Design } from '../type.ts';
19
+
20
+ const baseProps = useVueBaseProps<unknown, Design>();
21
+ const siteContent = computed(() => baseProps.site?.value satisfies SiteContent);
22
+ const cart = computed(() => ({
23
+ count: siteContent.value?.cart?.count ?? 0,
24
+ url: siteContent.value?.cart?.url ?? '',
25
+ }));
45
26
  </script>
46
27
 
47
28
  <style scoped>
@@ -1,9 +1 @@
1
- export default {
2
- menu: {
3
- type: 'NAVIGATION_MENU',
4
- },
5
- logo: {
6
- type: 'LOGO',
7
- label: '$label.logo.label',
8
- },
9
- } as const;
1
+ export default {} as const;
@@ -1,23 +1 @@
1
- export default {
2
- logo: {
3
- type: 'LOGO',
4
- label: '$label.logo.label',
5
- colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
6
- sizes: [18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60],
7
- defaults: {
8
- font: 'global.fontFamily.body',
9
- size: 20,
10
- bold: true,
11
- italic: false,
12
- color: '#313131',
13
- visible: true,
14
- spacing: 2,
15
- capitalization: 'all',
16
- frame: {
17
- visible: true,
18
- width: 3,
19
- color: '#313131',
20
- },
21
- },
22
- },
23
- } as const;
1
+ export default {} as const;
@@ -7,7 +7,7 @@
7
7
  "deploy": "crane build && crane deploy"
8
8
  },
9
9
  "dependencies": {
10
- "@lightspeed/crane": "1.1.2",
10
+ "@lightspeed/crane": "1.2.0",
11
11
  "@lightspeed/eslint-config-crane": "1.0.2",
12
12
  "vue": "^3.4.0",
13
13
  "@ecwid/sdk": "^0.8.0"
@@ -0,0 +1,73 @@
1
+ <template>
2
+ <SectionWrapper class="about-us-section" :style="backgroundStyle">
3
+ <div class="about-us-section__wrapper">
4
+ <Image
5
+ v-if="isImageVisible"
6
+ class="about-us-section__image"
7
+ />
8
+
9
+ <div class="about-us-section__content">
10
+ <Title v-if="isTitleVisible" />
11
+ <Stats />
12
+ </div>
13
+ </div>
14
+ </SectionWrapper>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ import { useBackgroundElementDesign } from '@lightspeed/crane';
19
+ import { computed, CSSProperties } from 'vue';
20
+
21
+ import Image from './component/Image.vue';
22
+ import type { Design } from './type.ts';
23
+ import { useVisibilityProvider } from './util/visibility-provider.ts';
24
+ import Stats from './component/Stats.vue';
25
+ import Title from './component/Title.vue';
26
+ import SectionWrapper from '../../shared/components/SectionWrapper.vue';
27
+
28
+ const { isImageVisible, isTitleVisible } = useVisibilityProvider();
29
+
30
+ const backgroundDesign = useBackgroundElementDesign<Design>('background');
31
+ const background = computed(() => ({
32
+ type: backgroundDesign.background?.type,
33
+ solidColor: backgroundDesign.background?.solid?.color as Color,
34
+ fromColor: backgroundDesign.background?.gradient?.fromColor as Color,
35
+ toColor: backgroundDesign.background?.gradient?.toColor as Color,
36
+ }));
37
+
38
+ const backgroundStyle = computed<CSSProperties>(() => {
39
+ if (background.value.type === 'gradient') {
40
+ return { 'background-image': `linear-gradient(to right, ${background.value.fromColor.hex}, ${background.value.toColor.hex})` };
41
+ }
42
+ return { 'background-color': background.value.solidColor.hex };
43
+ });
44
+ </script>
45
+
46
+ <style lang="scss" scoped>
47
+ .about-us-section {
48
+ &__wrapper {
49
+ display: grid;
50
+ grid-template-columns: 1fr;
51
+ gap: 75px;
52
+
53
+ @media screen and (min-width: 900px) {
54
+ grid-template-columns: 1fr 1fr;
55
+ align-items: center;
56
+ gap: 100px;
57
+ }
58
+ }
59
+
60
+ &__image {
61
+ max-width: 479px;
62
+ max-height: 610px;
63
+ margin: 0 auto;
64
+ }
65
+
66
+ &__content {
67
+ flex: 1;
68
+ display: flex;
69
+ flex-direction: column;
70
+ align-self: center;
71
+ }
72
+ }
73
+ </style>
@@ -0,0 +1,6 @@
1
+ import { createVueClientApp } from '@lightspeed/crane';
2
+
3
+ import ExampleSection from './AboutUs.vue';
4
+ import type { Content, Design } from './type.ts';
5
+
6
+ export default createVueClientApp<Content, Design>(ExampleSection);
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div class="image-section">
3
+ <div
4
+ :class="overlayClass"
5
+ class="image-section__overlay"
6
+ :style="overlayStyle"
7
+ >
8
+ <img
9
+ class="image-section__content"
10
+ :src="imageContent.highResolutionMobileImage"
11
+ loading="lazy"
12
+ alt=""
13
+ />
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script setup lang="ts">
19
+ import {
20
+ useImageElementContent,
21
+ useImageElementDesign,
22
+ useLayoutElementDesign,
23
+ } from '@lightspeed/crane';
24
+ import { computed, CSSProperties } from 'vue';
25
+
26
+ import type { Content, Design } from '../type.ts';
27
+
28
+ function getColor(color: string) {
29
+ return `${color}20`;
30
+ }
31
+
32
+ const imageContent = useImageElementContent<Content>('image');
33
+ const imageDesign = useImageElementDesign<Design>('image');
34
+ const layoutDesign = useLayoutElementDesign();
35
+
36
+ const overlayConfig = computed(() => ({
37
+ solidOverlay: getColor((imageDesign.overlay?.solid?.color as Color).raw),
38
+ gradientOverlay: 'linear-gradient(180deg, '
39
+ + `${getColor((imageDesign.overlay?.gradient?.fromColor as Color).raw)} 0%, `
40
+ + `${getColor((imageDesign.overlay?.gradient?.toColor as Color).raw)} 100%)`,
41
+ }));
42
+
43
+ const overlayClass = computed(() => ([
44
+ 'image-section__overlay',
45
+ {
46
+ 'image-section__overlay--border-radius': layoutDesign.layout === 'Images_With_Border_Radius',
47
+ },
48
+ ]));
49
+
50
+ const overlayStyle = computed(() => {
51
+ const style: CSSProperties = {};
52
+
53
+ if (imageDesign.visible && imageDesign.overlay?.type === 'gradient') {
54
+ style.background = overlayConfig.value.gradientOverlay;
55
+ }
56
+ if (imageDesign.visible && imageDesign.overlay?.type === 'solid') {
57
+ style.background = overlayConfig.value.solidOverlay;
58
+ }
59
+
60
+ return style;
61
+ });
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ .image-section {
66
+ height: 100%;
67
+ position: relative;
68
+ width: 100%;
69
+ display: flex;
70
+ z-index: 999;
71
+
72
+ &__overlay {
73
+ display: flex;
74
+ width: 100%;
75
+ height: 100%;
76
+ overflow: hidden;
77
+
78
+ &--border-radius {
79
+ border-radius: 24px;
80
+
81
+ @media screen and (min-width: 900px) {
82
+ border-radius: 32px;
83
+ }
84
+ }
85
+ }
86
+
87
+ &__content {
88
+ height: 100%;
89
+ width: 100%;
90
+ object-fit: cover;
91
+ z-index: -1;
92
+ }
93
+ }
94
+ </style>
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <div class="stats">
3
+ <div
4
+ v-for="stat in stats"
5
+ :key="stat.value?.value"
6
+ class="stats__element"
7
+ >
8
+ <div
9
+ v-if="isValueVisible && stat.value?.value"
10
+ class="stats__number"
11
+ >
12
+ {{ stat.value?.value }}
13
+ </div>
14
+
15
+ <div
16
+ v-if="isCaptionVisible && stat.caption?.value"
17
+ class="stats__caption"
18
+ >
19
+ {{ stat.caption?.value }}
20
+ </div>
21
+ </div>
22
+
23
+ <Button
24
+ v-if="isButtonVisible"
25
+ class="stats__button"
26
+ :design="buttonDesign"
27
+ :content="buttonContent"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script setup lang="ts">
33
+ import type { Card, InputBoxContent, ButtonContent } from '@lightspeed/crane';
34
+ import {
35
+ useTextElementDesign,
36
+ EditorTypes,
37
+ useDeckElementContent,
38
+ useButtonElementContent,
39
+ useButtonElementDesign,
40
+ } from '@lightspeed/crane';
41
+ import { computed, CSSProperties } from 'vue';
42
+
43
+ import type { Content, Design } from '../type.ts';
44
+ import Button from '../../../shared/components/Button.vue';
45
+ import { useVisibilityProvider } from '../util/visibility-provider.ts';
46
+
47
+ const buttonContent = useButtonElementContent<Content>('button') as ButtonContent;
48
+ const buttonDesign = useButtonElementDesign<Design>('button') as ButtonDesignData;
49
+
50
+ const { isButtonVisible } = useVisibilityProvider();
51
+
52
+ const statsDesk = useDeckElementContent<Content>('stats');
53
+ const stats = computed(() => (
54
+ statsDesk?.cards?.map((card: Card) => ({
55
+ value: statsDesk.getReactiveRef(card, EditorTypes.INPUTBOX, 'stat_value') as unknown as InputBoxContent | undefined,
56
+ caption: statsDesk.getReactiveRef(card, EditorTypes.INPUTBOX, 'stat_caption') as unknown as InputBoxContent | undefined,
57
+ }))
58
+ .filter((stat) => {
59
+ const hasValue = stat.value !== undefined && stat.value.hasContent;
60
+ const hasCaption = stat.caption !== undefined && stat.caption.hasContent;
61
+ return hasValue || hasCaption;
62
+ })
63
+ ));
64
+
65
+ const valueDesign = useTextElementDesign<Design>('value');
66
+ const captionDesign = useTextElementDesign<Design>('caption');
67
+
68
+ const isValueVisible = computed<boolean>(() => valueDesign.visible ?? false);
69
+ const isCaptionVisible = computed<boolean>(() => captionDesign.visible ?? false);
70
+
71
+ const valueStyle = computed<CSSProperties>(() => ({
72
+ fontSize: `${valueDesign.size}px`,
73
+ fontFamily: valueDesign.font,
74
+ color: (valueDesign.color as Color).hex,
75
+ fontStyle: valueDesign.italic ? 'italic' : 'normal',
76
+ fontWeight: valueDesign.bold ? 'bold' : 'normal',
77
+ }));
78
+
79
+ const captionStyle = computed<CSSProperties>(() => ({
80
+ fontSize: `${captionDesign.size}px`,
81
+ fontFamily: captionDesign.font,
82
+ color: (captionDesign.color as Color).hex,
83
+ fontStyle: captionDesign.italic ? 'italic' : 'normal',
84
+ fontWeight: captionDesign.bold ? 'bold' : 'normal',
85
+ }));
86
+ </script>
87
+
88
+ <style scoped lang="scss">
89
+ .stats {
90
+ --value-font-size: v-bind(valueStyle.fontSize);
91
+ --value-font-family: v-bind(valueStyle.fontFamily);
92
+ --value-color: v-bind(valueStyle.color);
93
+ --value-font-style: v-bind(valueStyle.fontStyle);
94
+ --value-font-weight: v-bind(valueStyle.fontWeight);
95
+ --value-font-modifier: 1;
96
+
97
+ --caption-font-size: v-bind(captionStyle.fontSize);
98
+ --caption-font-family: v-bind(captionStyle.fontFamily);
99
+ --caption-color: v-bind(captionStyle.color);
100
+ --caption-font-style: v-bind(captionStyle.fontStyle);
101
+ --caption-font-weight: v-bind(captionStyle.fontWeight);
102
+ --caption-font-modifier: 1;
103
+
104
+ display: grid;
105
+ grid-template-columns: 1fr 1fr;
106
+ gap: 20px;
107
+ margin: 20px 0;
108
+
109
+ &__element {
110
+ display: flex;
111
+ flex-direction: column;
112
+ align-items: flex-start;
113
+ }
114
+
115
+ &__button {
116
+ align-self: start;
117
+ margin-top: 20px;
118
+ width: fit-content;
119
+ max-width: 360px;
120
+
121
+ @media screen and (max-width: 700px) {
122
+ align-self: center;
123
+ }
124
+ }
125
+
126
+ &__number {
127
+ --value-font-modifier: 0.8;
128
+
129
+ max-width: 100%;
130
+ margin-bottom: 8px;
131
+ overflow: hidden;
132
+ word-wrap: break-word;
133
+ font-size: var(--value-font-size);
134
+ font-family: calc(var(--value-font-family) * var(--value-font-modifier));
135
+ color: var(--value-color);
136
+ font-style: var(--value-font-style);
137
+ font-weight: var(--value-font-weight);
138
+
139
+ @media screen and (min-width: 700px) {
140
+ --value-font-modifier: 1;
141
+ }
142
+ }
143
+
144
+ &__caption {
145
+ max-width: 100%;
146
+ overflow: hidden;
147
+ word-wrap: break-word;
148
+ font-size: var(--caption-font-size);
149
+ font-family: calc(var(--caption-font-family) * var(--caption-font-modifier));
150
+ color: var(--caption-color);
151
+ font-style: var(--caption-font-style);
152
+ font-weight: var(--caption-font-weight);
153
+ }
154
+ }
155
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <h1
3
+ class="section-title"
4
+ :style="titleStyle"
5
+ >
6
+ {{ titleContent.value }}
7
+ </h1>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import { useInputboxElementContent, useTextElementDesign } from '@lightspeed/crane';
12
+ import { computed, CSSProperties } from 'vue';
13
+
14
+ import type { Content, Design } from '../type.ts';
15
+
16
+ const titleContent = useInputboxElementContent<Content>('title');
17
+ const titleDesign = useTextElementDesign<Design>('title');
18
+
19
+ const titleStyle = computed<CSSProperties>(() => ({
20
+ 'font-size': `${titleDesign.size}px`,
21
+ 'font-family': titleDesign.font,
22
+ color: (titleDesign.color as Color).hex,
23
+ 'font-style': titleDesign.italic ? 'italic' : 'normal',
24
+ 'font-weight': titleDesign.bold ? 'bold' : 'normal',
25
+ }));
26
+ </script>
27
+
28
+ <style lang="scss" scoped>
29
+ .section-title {
30
+ margin-bottom: 20px;
31
+ }
32
+ </style>
@@ -0,0 +1,6 @@
1
+ import { createVueServerApp } from '@lightspeed/crane';
2
+
3
+ import ExampleSection from './AboutUs.vue';
4
+ import type { Content, Design } from './type.ts';
5
+
6
+ export default createVueServerApp<Content, Design>(ExampleSection);
@@ -0,0 +1,64 @@
1
+ const content: ContentEditor = {
2
+ title: {
3
+ type: 'INPUTBOX',
4
+ label: '$label.section_title.label',
5
+ placeholder: '$label.section_title.placeholder',
6
+ },
7
+ stats: {
8
+ type: 'DECK',
9
+ label: '$label.stats.deck_title',
10
+ addButtonLabel: '$label.stats.add_card_button',
11
+ maxCards: 5,
12
+ cards: {
13
+ defaultCardContent: {
14
+ label: '$label.images.card_title',
15
+ settings: {
16
+ stat_value: {
17
+ type: 'INPUTBOX',
18
+ label: '$label.stat_value.label',
19
+ placeholder: '$label.stat_value.placeholder',
20
+ text: '$label.stat_value.default.text',
21
+ title: '$label.stat_value.default.text',
22
+ },
23
+ stat_caption: {
24
+ type: 'INPUTBOX',
25
+ label: '$label.stat_caption.label',
26
+ placeholder: '$label.stat_caption.placeholder',
27
+ text: '$label.stat_caption.default.text',
28
+ title: '$label.stat_caption.default.text',
29
+ },
30
+ },
31
+ },
32
+ },
33
+ },
34
+ button: {
35
+ type: 'BUTTON',
36
+ label: '$label.button_content.label',
37
+ title: '$label.button_content.title',
38
+ },
39
+ image: {
40
+ type: 'IMAGE',
41
+ label: '$label.image_content.label',
42
+ defaults: {
43
+ set: {
44
+ LOW_RES: {
45
+ url: 'section_picture.jpg',
46
+ },
47
+ MOBILE_WEBP_LOW_RES: {
48
+ url: 'section_picture.jpg',
49
+ },
50
+ MOBILE_WEBP_HI_RES: {
51
+ url: 'section_picture@2x.jpg',
52
+ },
53
+ WEBP_LOW_RES: {
54
+ url: 'section_picture@2x.jpg',
55
+ },
56
+ WEBP_HI_2X_RES: {
57
+ url: 'section_picture@2x.jpg',
58
+ },
59
+ },
60
+ borderInfo: {},
61
+ },
62
+ },
63
+ };
64
+ export default content;