grr-cli 0.15.0

Google tools from the terminal, at maximum performance: 401 methods across 14 Google APIs in one generated command tree, zero-config, over HTTP/3
Documentation
---
import mascotIdle from '../assets/mascot-idle.svg?raw';
import mascotWave from '../assets/mascot-wave.svg?raw';
import mascotSleep from '../assets/mascot-sleep.svg?raw';
import mascotCelebrate from '../assets/mascot-celebrate.svg?raw';

type Pose = 'idle' | 'wave' | 'sleep' | 'celebrate';

interface Props {
  label?: string;
  variant?: 'single' | 'story';
  pose?: Pose;
  uid?: string;
}

const { label = 'Pixel-art orange crab mascot', variant = 'single', pose = 'idle', uid = 'm' } = Astro.props;
const poses: Record<Pose, string> = {
  idle: mascotIdle,
  wave: mascotWave,
  sleep: mascotSleep,
  celebrate: mascotCelebrate,
};

const scopeIds = (raw: string, scope: string) =>
  raw
    .replace(/\bid="([^"]+)"/g, (_, id: string) => `id="${scope}-${id}"`)
    .replace(
      /\baria-labelledby="([^"]+)"/g,
      (_, refs: string) => `aria-labelledby="${refs.split(' ').map((ref) => `${scope}-${ref}`).join(' ')}"`,
    );
---

{
  variant === 'single' ? (
    <div class="mascot-wrap mascot-single" role="img" aria-label={label} set:html={scopeIds(poses[pose], `${uid}-${pose}`)} />
  ) : (
    <div class="mascot-wrap mascot-story" role="img" aria-label={label}>
      <div class="mascot-sprite" aria-hidden="true">
        <div class="mascot-frame mascot-frame-wave" set:html={scopeIds(poses.wave, `${uid}-wave`)} />
        <div class="mascot-frame mascot-frame-idle" set:html={scopeIds(poses.idle, `${uid}-idle`)} />
        <div class="mascot-frame mascot-frame-sleep" set:html={scopeIds(poses.sleep, `${uid}-sleep`)} />
        <div class="mascot-frame mascot-frame-celebrate" set:html={scopeIds(poses.celebrate, `${uid}-celebrate`)} />
      </div>
    </div>
  )
}