mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-08-31 19:27:24 +00:00
feat: add image mask options and update related schemas and styles
This commit is contained in:
parent
afa6fc8235
commit
bda11b7ddc
3 changed files with 23 additions and 4 deletions
|
@ -28,6 +28,13 @@ import { BrowserExtensionAPI } from './browserExtension';
|
|||
import { Clipboard } from './clipboard';
|
||||
import * as OAuth from './oauth';
|
||||
|
||||
const Image = {
|
||||
Mask: {
|
||||
Circle: 'circle',
|
||||
RoundedRectangle: 'roundedRectangle'
|
||||
}
|
||||
};
|
||||
|
||||
let currentPluginName: string | null = null;
|
||||
let currentPluginPreferences: Array<{
|
||||
name: string;
|
||||
|
@ -55,6 +62,7 @@ export const getRaycastApi = () => {
|
|||
Color,
|
||||
Cache,
|
||||
Icon,
|
||||
Image,
|
||||
LaunchType,
|
||||
Toast,
|
||||
OAuth,
|
||||
|
|
|
@ -16,9 +16,18 @@
|
|||
);
|
||||
const iconInfo = $derived(resolveIcon(icon, assetsPath));
|
||||
|
||||
const maskStyles = $derived(
|
||||
iconInfo?.type === 'image' && iconInfo.mask === 'Circle' ? 'border-radius: 50%;' : ''
|
||||
);
|
||||
const maskStyles = $derived.by(() => {
|
||||
if (iconInfo?.type !== 'image' || !iconInfo.mask) {
|
||||
return '';
|
||||
}
|
||||
if (iconInfo.mask === 'circle') {
|
||||
return 'border-radius: 50%;';
|
||||
}
|
||||
if (iconInfo.mask === 'roundedRectangle') {
|
||||
return 'border-radius: 0.375rem;';
|
||||
}
|
||||
return '';
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if iconInfo}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { z } from 'zod/v4';
|
||||
|
||||
export const ImageMaskSchema = z.enum(['circle', 'roundedRectangle']);
|
||||
|
||||
export const RaycastIconSchema = z.templateLiteral([z.string(), '-16']);
|
||||
|
||||
export const ImageLikeSchema = z.union([
|
||||
|
@ -7,7 +9,7 @@ export const ImageLikeSchema = z.union([
|
|||
z.string(),
|
||||
z.object({
|
||||
source: z.union([z.string(), z.object({ light: z.string(), dark: z.string() })]),
|
||||
mask: z.string().optional()
|
||||
mask: ImageMaskSchema.optional()
|
||||
})
|
||||
]);
|
||||
export type ImageLike = z.infer<typeof ImageLikeSchema>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue