@lightspeed/crane 3.4.0 → 3.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@jridgewell/sourcemap-codec": "^1.5.4",
68
- "@lightspeed/crane-api": "2.3.0",
68
+ "@lightspeed/crane-api": "2.3.1",
69
69
  "@lightspeed/eslint-config-crane": "1.1.3",
70
70
  "@types/micromatch": "^4.0.8",
71
71
  "@types/prompts": "^2.4.2",
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M1.4 14L0 12.6L5.6 7L0 1.4L1.4 0L7 5.6L12.6 0L14 1.4L8.4 7L14 12.6L12.6 14L7 8.4L1.4 14Z" fill="#69696D"/>
3
+ </svg>
@@ -0,0 +1,16 @@
1
+ <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_5165_10169)">
3
+ <path d="M-5.54181 -5.54102H33.5415V33.5423H-5.54181V-5.54102Z" fill="#191513"/>
4
+ <path d="M7 0.466797H21C24.6083 0.466797 27.5332 3.39174 27.5332 7V21C27.5332 24.6083 24.6083 27.5332 21 27.5332H7C3.39174 27.5332 0.466797 24.6083 0.466797 21V7C0.466797 3.39174 3.39174 0.466797 7 0.466797Z" fill="black" fill-opacity="0.01" stroke="url(#paint0_linear_5165_10169)" stroke-width="0.933333"/>
5
+ <path d="M14 5.25L14.8041 6.65321C14.9651 6.94359 14.9651 7.29841 14.8041 7.58868L10.0112 15.9274L12.279 19.8629C12.6328 20.4758 13.2923 20.8629 14 20.8629C14.7077 20.8629 15.3671 20.4758 15.721 19.8629L17.9888 15.9274L17.3936 14.8629L14.8203 19.3306C14.6595 19.6209 14.3378 19.7983 14.0161 19.7983C13.6783 19.7983 13.3727 19.6209 13.2119 19.3306L11.2335 15.9274L15.6888 8.18553L16.493 9.58873C16.6538 9.87903 16.6538 10.2338 16.493 10.5242L13.3888 15.9274L14 16.9919L17.3776 11.121L19.5972 14.9757C19.9349 15.5726 19.9349 16.2984 19.5972 16.8952L17.3454 20.8145C17.0076 21.4112 15.93 22.75 14 22.75C12.0699 22.75 11.0083 21.4112 10.6545 20.8145L8.4028 16.8952C8.06512 16.2984 8.06512 15.5726 8.4028 14.9757L14 5.25Z" fill="white"/>
6
+ </g>
7
+ <defs>
8
+ <linearGradient id="paint0_linear_5165_10169" x1="0" y1="0" x2="28" y2="28" gradientUnits="userSpaceOnUse">
9
+ <stop stop-color="white" stop-opacity="0.5"/>
10
+ <stop offset="1" stop-color="white" stop-opacity="0.16"/>
11
+ </linearGradient>
12
+ <clipPath id="clip0_5165_10169">
13
+ <rect width="28" height="28" rx="7" fill="white"/>
14
+ </clipPath>
15
+ </defs>
16
+ </svg>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <!-- Bootstrap and Fonts -->
12
12
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
13
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
13
+ <link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
14
14
 
15
15
  <style>
16
16
  .top-bar {
@@ -31,10 +31,108 @@
31
31
  font-size: 30px;
32
32
  margin: 0;
33
33
  }
34
+
35
+ .extension-banner {
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: space-between;
39
+ width: 100%;
40
+ height: 56px;
41
+ box-sizing: border-box;
42
+ border-bottom: 1px solid #3A1AFE;
43
+ background: rgba(134, 157, 255, 0.16);
44
+ padding: 10px 40px;
45
+ }
46
+
47
+ .extension-banner-left {
48
+ display: flex;
49
+ width: 180px;
50
+ align-items: center;
51
+ gap: 10px;
52
+ }
53
+
54
+ .extension-banner-close {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ background: none;
59
+ border: none;
60
+ cursor: pointer;
61
+ padding: 4px;
62
+ }
63
+
64
+ .extension-banner-close:hover {
65
+ opacity: 0.7;
66
+ }
67
+
68
+ .extension-banner-center {
69
+ flex: 1;
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ gap: 8px;
74
+ }
75
+
76
+ .extension-banner-text {
77
+ color: #1E1E21;
78
+ text-align: center;
79
+ font-variant-numeric: lining-nums tabular-nums;
80
+ font-family: 'Lato', sans-serif;
81
+ font-size: 14px;
82
+ font-style: normal;
83
+ font-weight: 400;
84
+ line-height: 20px;
85
+ }
86
+
87
+ .extension-banner .btn-install {
88
+ flex-shrink: 0;
89
+ width: 131px;
90
+ height: 36px;
91
+ min-width: 80px;
92
+ background: #3A1AFE;
93
+ color:#FFF;
94
+ border: none;
95
+ border-radius: 8px;
96
+ padding: 8px 12px;
97
+ font-variant-numeric: lining-nums tabular-nums;
98
+ font-family: 'Lato', sans-serif;
99
+ font-size: 14px;
100
+ font-style: normal;
101
+ font-weight: 700;
102
+ line-height: 20px;
103
+ cursor: pointer;
104
+ white-space: nowrap;
105
+ text-decoration: none;
106
+ text-align: center;
107
+ display: inline-flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ gap: 2px;
111
+ }
112
+
113
+ .extension-banner .btn-install:hover {
114
+ opacity: 0.9;
115
+ }
34
116
  </style>
35
117
  </head>
36
118
  <body>
37
119
 
120
+ <!-- Extension Install Banner -->
121
+ <div id="extensionBanner" class="extension-banner">
122
+ <div class="extension-banner-left">
123
+ <button class="extension-banner-close" onclick="document.getElementById('extensionBanner').style.display='none'" aria-label="Close banner">
124
+ <img src="../assets/close.svg" alt="Close" width="14" height="14">
125
+ </button>
126
+ </div>
127
+ <div class="extension-banner-center">
128
+ <img src="../assets/crane-logo.svg" alt="Crane" width="28" height="28">
129
+ <span class="extension-banner-text">
130
+ Install the Crane DevTools by Lightspeed from the Chrome Web Store and preview the full theme or selected sections live in the Instant Site Editor with no deployment needed.
131
+ </span>
132
+ </div>
133
+ <a class="btn-install" href="https://chromewebstore.google.com/detail/crane-devtools/dlfmlicbfjebcgpboleillocookdkifo" target="_blank" rel="noopener noreferrer">Install Extension</a>
134
+ </div>
135
+
38
136
  <!-- Top Bar -->
39
137
  <div class="top-bar">
40
138
  <span class="label-text">Section Preview |</span>
@@ -343,20 +343,22 @@ function processImage(component: any, blockType: BlockType, blockName: string, k
343
343
  `http://${distFolderPath}/${blockType}/${blockName}/assets/` :
344
344
  `${distFolderPath}/${blockType}/${blockName}/assets/`;
345
345
 
346
- const set = component.defaults?.imageData?.set || component.imageData?.set;
346
+ const imageData = component.defaults?.imageData || component.imageData;
347
+ const set = imageData?.set;
347
348
  const newSet = {
348
349
  'cropped-webp-100x200': { url: assetLocation + set?.MOBILE_WEBP_LOW_RES.url },
349
350
  'cropped-webp-1000x2000': { url: assetLocation + set?.MOBILE_WEBP_HI_RES.url },
350
351
  'webp-200x200': { url: assetLocation + set?.WEBP_LOW_RES.url },
351
352
  'webp-2000x2000': { url: assetLocation + set?.WEBP_HI_2X_RES.url },
352
353
  };
353
- return {
354
+ const result = {
354
355
  [key]: {
355
356
  set: newSet,
356
- ...(component.imageData?.borderInfo && { borderInfo: component.imageData.borderInfo }),
357
- ...(component.imageData && { bucket: {} }),
357
+ ...(imageData?.borderInfo && { borderInfo: imageData.borderInfo }),
358
+ ...(imageData && { bucket: {} }),
358
359
  },
359
360
  };
361
+ return result;
360
362
  } catch (error) {
361
363
  console.error(`[Preview] Failed to process image "${key}":`, error);
362
364
  return {};
@@ -23,6 +23,7 @@ export default defineConfig({
23
23
  server.httpServer?.once('listening', () => {
24
24
  const baseUrl = `http://localhost:${server.config.server.port || 5173}`;
25
25
  console.log('Preview URL: ', baseUrl + '/preview/sections/preview.html\n');
26
+ console.log('To preview changes live in the IS Editor, make sure Crane Extension is installed.');
26
27
  console.log('🛑 Press Ctrl+C to stop the local server 🛑\n');
27
28
  });
28
29
  },
@@ -9,6 +9,7 @@ export default translation.init({
9
9
  '$label.section_tagline.label': 'Tagline',
10
10
  '$label.section_tagline.placeholder': 'This label will be displayed above the title',
11
11
  '$label.section_button.label': 'Button',
12
+ '$label.section_button.title': 'Button title',
12
13
  '$label.section_image_text.label': 'Image title',
13
14
  '$label.section_image.label': 'Image',
14
15
 
@@ -38,12 +38,12 @@
38
38
  <script setup lang="ts">
39
39
  import { computed, toRefs } from 'vue';
40
40
  import {
41
+ OverlayType,
41
42
  useImageElementDesign,
42
43
  useTextareaElementDesign,
43
44
  useLayoutElementDesign,
44
45
  } from '@lightspeed/crane-api';
45
46
  import { Design } from '../../type.ts';
46
- import { ColorType } from '../../entity/color.ts';
47
47
 
48
48
  function getColor(color: string) {
49
49
  return `${color}20`;
@@ -75,10 +75,11 @@ const overlayConfig = computed(() => ({
75
75
  }));
76
76
 
77
77
  const overlayStyle = computed(() => {
78
- if (imageDesign.visible && imageDesign.overlay?.type === ColorType.GRADIENT) {
78
+ const overlayType: OverlayType | undefined = imageDesign.overlay?.type;
79
+ if (imageDesign.visible && overlayType === OverlayType.GRADIENT) {
79
80
  return { background: overlayConfig.value.gradientOverlay };
80
81
  }
81
- if (imageDesign.visible && imageDesign.overlay?.type === ColorType.SOLID) {
82
+ if (imageDesign.visible && overlayType === OverlayType.SOLID) {
82
83
  return { background: overlayConfig.value.solidOverlay };
83
84
  }
84
85
  return {};
@@ -1,4 +0,0 @@
1
- export enum ColorType {
2
- SOLID = 'solid',
3
- GRADIENT = 'gradient',
4
- }
@@ -1,4 +0,0 @@
1
- export enum ColorType {
2
- SOLID = 'solid',
3
- GRADIENT = 'gradient',
4
- }
@@ -1,4 +0,0 @@
1
- export enum ColorType {
2
- SOLID = 'solid',
3
- GRADIENT = 'gradient',
4
- }
@@ -1,4 +0,0 @@
1
- export enum ColorType {
2
- SOLID = 'solid',
3
- GRADIENT = 'gradient',
4
- }
@@ -1,4 +0,0 @@
1
- export enum ColorType {
2
- SOLID = 'solid',
3
- GRADIENT = 'gradient',
4
- }