@designcrowd/fe-shared-lib 1.8.9-ai-switch → 1.8.9-ai-switch-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/index.js CHANGED
@@ -33,6 +33,7 @@ export { default as DcomIcon } from './src/atoms/components/design-com/Icon/Icon
33
33
  export { default as Modal } from './src/atoms/components/Modal/Modal.vue';
34
34
  export { default as Loader } from './src/atoms/components/Loader/Loader.vue';
35
35
  export { default as AiPoweredLoader } from './src/atoms/components/AiPoweredLoader/AiPoweredLoader.vue';
36
+ export { default as AiSwitch } from './src/atoms/components/AiSwitch/AiSwitch.vue';
36
37
  export { default as Tooltip } from './src/atoms/components/Tooltip/Tooltip.vue';
37
38
  export { default as Picture } from './src/atoms/components/Picture/Picture.vue';
38
39
  export { default as HelloBar } from './src/atoms/components/HelloBar/HelloBar.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.8.9-ai-switch",
3
+ "version": "1.8.9-ai-switch-2",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -41,6 +41,10 @@ const props = withDefaults(defineProps<Props>(), {
41
41
  showStars: false,
42
42
  });
43
43
 
44
+ const emit = defineEmits<{
45
+ toggledSwitch: [value: boolean];
46
+ }>();
47
+
44
48
  const isAi = ref(false);
45
49
 
46
50
  const ANGLE_CONST = 25;
@@ -73,9 +77,6 @@ const stars = ref([
73
77
  ]);
74
78
 
75
79
  const randomizeStars = () => {
76
- if (!isAi.value && !props.showStars) {
77
- return;
78
- }
79
80
  stars.value = Array.from({ length: NUM_STARS }, (_, index) => {
80
81
  const angle = Math.floor(
81
82
  ANGLE_CONST - index * (ANGLE_JITTER / NUM_STARS) - Math.random() * (ANGLE_JITTER / NUM_STARS),
@@ -94,8 +95,10 @@ const toggleSwitch = () => {
94
95
  // toggle left align class
95
96
  // if moving right to left, play star animation after movement
96
97
  isAi.value = !isAi.value;
97
- console.log(`switch clicked, now ${isAi.value}`);
98
- randomizeStars();
98
+ if (isAi.value && props.showStars) {
99
+ randomizeStars();
100
+ }
101
+ emit.toggledSwitch = isAi.value;
99
102
  };
100
103
  </script>
101
104