@lightspeed/crane 3.5.1-rc.1 → 3.5.1-rc.2
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/CHANGELOG.md +3 -4
- package/dist/cli.mjs +42 -42
- package/package.json +2 -2
- package/template/announcement-bars/example-announcement-bar/ExampleAnnouncementBar.vue +35 -0
- package/template/announcement-bars/example-announcement-bar/assets/example_announcement_bar_showcase_1_preview.png +0 -0
- package/template/announcement-bars/example-announcement-bar/assets/example_announcement_bar_showcase_2_preview.png +0 -0
- package/template/announcement-bars/example-announcement-bar/client.ts +6 -0
- package/template/announcement-bars/example-announcement-bar/server.ts +6 -0
- package/template/announcement-bars/example-announcement-bar/settings/content.ts +8 -0
- package/template/announcement-bars/example-announcement-bar/settings/design.ts +16 -0
- package/template/announcement-bars/example-announcement-bar/settings/layout.ts +1 -0
- package/template/announcement-bars/example-announcement-bar/settings/translations.ts +17 -0
- package/template/announcement-bars/example-announcement-bar/showcases/1.ts +33 -0
- package/template/announcement-bars/example-announcement-bar/showcases/2.ts +33 -0
- package/template/announcement-bars/example-announcement-bar/showcases/translations.ts +17 -0
- package/template/announcement-bars/example-announcement-bar/type.ts +5 -0
- package/template/preview/sections/preview.html +1 -0
- package/template/preview/shared/preview.ts +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed/crane",
|
|
3
|
-
"version": "3.5.1-rc.
|
|
3
|
+
"version": "3.5.1-rc.2",
|
|
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.5.
|
|
68
|
+
"@lightspeed/crane-api": "2.5.0",
|
|
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,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getContrastTextColor, useBackgroundElementDesign, useInputboxElementContent } from '@lightspeed/crane-api';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
import type { Content, Design } from './type.ts';
|
|
6
|
+
|
|
7
|
+
const messageContent = useInputboxElementContent<Content>('message');
|
|
8
|
+
const backgroundDesign = useBackgroundElementDesign<Design>('background');
|
|
9
|
+
|
|
10
|
+
const backgroundColor = computed(() => backgroundDesign.background?.solid?.color?.hex ?? '#1F2937');
|
|
11
|
+
const textColor = computed(() => getContrastTextColor(backgroundColor.value, '#1F2937', '#FFFFFF'));
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div
|
|
16
|
+
class="announcement-bar"
|
|
17
|
+
:style="{ backgroundColor, color: textColor }"
|
|
18
|
+
>
|
|
19
|
+
<span class="text">{{ messageContent.value }}</span>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.announcement-bar {
|
|
25
|
+
width: 100%;
|
|
26
|
+
padding: 10px 16px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.text {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { design } from '@lightspeed/crane-api';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
aboveHeader: design.toggle({
|
|
5
|
+
label: '$label.aboveHeader.label',
|
|
6
|
+
defaults: { enabled: true },
|
|
7
|
+
}),
|
|
8
|
+
background: design.background({
|
|
9
|
+
label: '$label.background.label',
|
|
10
|
+
colors: ['#1F2937', '#FFFFFF', '#C7352E'],
|
|
11
|
+
defaults: {
|
|
12
|
+
style: 'COLOR',
|
|
13
|
+
color: '#1F2937',
|
|
14
|
+
},
|
|
15
|
+
}),
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default [];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { translation } from '@lightspeed/crane-api';
|
|
2
|
+
|
|
3
|
+
export default translation.init({
|
|
4
|
+
en: {
|
|
5
|
+
'$label.aboveHeader.label': 'Show above header',
|
|
6
|
+
'$label.message.label': 'Announcement message',
|
|
7
|
+
'$label.message.placeholder': 'Free shipping over $50!',
|
|
8
|
+
'$label.background.label': 'Background',
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
nl: {
|
|
12
|
+
'$label.aboveHeader.label': 'Boven koptekst tonen',
|
|
13
|
+
'$label.message.label': 'Aankondigingsbericht',
|
|
14
|
+
'$label.message.placeholder': 'Gratis verzending vanaf $50!',
|
|
15
|
+
'$label.background.label': 'Achtergrond',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
content,
|
|
3
|
+
design,
|
|
4
|
+
showcase,
|
|
5
|
+
} from '@lightspeed/crane-api';
|
|
6
|
+
|
|
7
|
+
export default showcase.init({
|
|
8
|
+
showcaseId: '1',
|
|
9
|
+
previewImage: {
|
|
10
|
+
set: {
|
|
11
|
+
ORIGINAL: {
|
|
12
|
+
url: 'example_announcement_bar_showcase_1_preview.png',
|
|
13
|
+
width: 1280,
|
|
14
|
+
height: 290,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
blockName: '$label.showcase_1.blockName',
|
|
19
|
+
content: {
|
|
20
|
+
message: content.default.inputbox({
|
|
21
|
+
text: '$label.showcase_1.message.text',
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
design: {
|
|
25
|
+
aboveHeader: design.default.toggle({
|
|
26
|
+
enabled: true,
|
|
27
|
+
}),
|
|
28
|
+
background: design.default.background({
|
|
29
|
+
style: 'COLOR',
|
|
30
|
+
color: '#1F2937',
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
content,
|
|
3
|
+
design,
|
|
4
|
+
showcase,
|
|
5
|
+
} from '@lightspeed/crane-api';
|
|
6
|
+
|
|
7
|
+
export default showcase.init({
|
|
8
|
+
showcaseId: '2',
|
|
9
|
+
previewImage: {
|
|
10
|
+
set: {
|
|
11
|
+
ORIGINAL: {
|
|
12
|
+
url: 'example_announcement_bar_showcase_2_preview.png',
|
|
13
|
+
width: 1280,
|
|
14
|
+
height: 290,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
blockName: '$label.showcase_2.blockName',
|
|
19
|
+
content: {
|
|
20
|
+
message: content.default.inputbox({
|
|
21
|
+
text: '$label.showcase_2.message.text',
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
design: {
|
|
25
|
+
aboveHeader: design.default.toggle({
|
|
26
|
+
enabled: false,
|
|
27
|
+
}),
|
|
28
|
+
background: design.default.background({
|
|
29
|
+
style: 'COLOR',
|
|
30
|
+
color: '#C7352E',
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { translation } from '@lightspeed/crane-api';
|
|
2
|
+
|
|
3
|
+
export default translation.init({
|
|
4
|
+
en: {
|
|
5
|
+
'$label.showcase_1.blockName': 'Promo Announcement',
|
|
6
|
+
'$label.showcase_1.message.text': 'Free shipping on orders over $50!',
|
|
7
|
+
'$label.showcase_2.blockName': 'Sale Announcement',
|
|
8
|
+
'$label.showcase_2.message.text': 'Limited time sale: save 20% today!',
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
nl: {
|
|
12
|
+
'$label.showcase_1.blockName': 'Promo aankondiging',
|
|
13
|
+
'$label.showcase_1.message.text': 'Gratis verzending vanaf $50!',
|
|
14
|
+
'$label.showcase_2.blockName': 'Uitverkoop aankondiging',
|
|
15
|
+
'$label.showcase_2.message.text': 'Tijdelijke uitverkoop: bespaar vandaag 20%!',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
...import.meta.glob('../../dist/sections/*/js/showcases/*.mjs'),
|
|
166
166
|
...import.meta.glob('../../dist/headers/*/js/showcases/*.mjs'),
|
|
167
167
|
...import.meta.glob('../../dist/footers/*/js/showcases/*.mjs'),
|
|
168
|
+
...import.meta.glob('../../dist/announcement-bars/*/js/showcases/*.mjs'),
|
|
168
169
|
};
|
|
169
170
|
const select = document.getElementById('showcaseDropdown');
|
|
170
171
|
const showCaseOptions = dropdownOptions(showcaseModules);
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { getExternalContentMock } from './mock';
|
|
3
3
|
import { loadModule, renderServerModule } from './utils';
|
|
4
4
|
|
|
5
|
-
export type BlockType = 'sections' | 'headers' | 'footers';
|
|
6
|
-
export const BLOCK_TYPES: BlockType[] = ['sections', 'headers', 'footers'];
|
|
5
|
+
export type BlockType = 'sections' | 'headers' | 'footers' | 'announcement-bars';
|
|
6
|
+
export const BLOCK_TYPES: BlockType[] = ['sections', 'headers', 'footers', 'announcement-bars'];
|
|
7
7
|
|
|
8
8
|
const BLOCK_TYPE_LABELS: Record<BlockType, string> = {
|
|
9
9
|
sections: 'Section',
|
|
10
10
|
headers: 'Header',
|
|
11
11
|
footers: 'Footer',
|
|
12
|
+
'announcement-bars': 'Announcement Bar',
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
let distFolderPath: string | null = null;
|
|
@@ -490,7 +491,7 @@ function getContentToRender(
|
|
|
490
491
|
|
|
491
492
|
export function dropdownOptions(showcaseModules: Record<string, any>): Array<{ value: string; label: string }> {
|
|
492
493
|
return Object.keys(showcaseModules).map((path) => {
|
|
493
|
-
const match = path.match(/\/(sections|headers|footers)\/([^/]+)\/js\/showcases\/(\d+)\.mjs$/);
|
|
494
|
+
const match = path.match(/\/(sections|headers|footers|announcement-bars)\/([^/]+)\/js\/showcases\/(\d+)\.mjs$/);
|
|
494
495
|
if (!match) return null;
|
|
495
496
|
const blockType = match[1] as BlockType;
|
|
496
497
|
const blockName = match[2];
|