// In an app: import { setupItemsCard } from '@aparte/plugin-cards/items';
const { setupItemsCard } = window.apartePlugins.cards.items;
// A card shows only http(s) pictures: these are served by this site, which its image
// policy lets load. Without it they wait behind "Show images", as any picture would.
window.aparte.aparteGlobalConfig.setImagePolicy(['self']);
const picture = (name) => new URL('/demo-pictures/' + name + '.svg', location.href).href;
setupItemsCard({ tool: 'search_recipes', variant: 'list' });
document.querySelector('aparte-chat-bubble').setSegments([{
id: 's1', type: 'tool_call', status: 'resolved',
toolCall: { id: 'c-s1', name: 'search_recipes', input: { query: 'quick autumn dinners' } },
structuredResult: {
title: 'Autumn dinners under 40 minutes',
items: [
{ title: 'Roast tomato soup with basil', subtitle: 'Weeknight kitchen', image: picture('dish-tomato'), badge: '35 min',
description: 'Tomatoes, garlic and onion roasted until sweet, blended with stock, finished with basil oil.',
meta: ['4 servings', 'Vegetarian'], url: 'https://recipes.example.org/roast-tomato-soup' },
{ title: 'Butternut risotto with sage', subtitle: 'Weeknight kitchen', image: picture('dish-squash'), badge: '40 min',
description: 'Half the squash roasted, half stirred in until it melts; crisp sage leaves on top.',
meta: ['2 servings', 'Vegetarian'], url: 'https://recipes.example.org/butternut-risotto' },
{ title: 'Pear, walnut and bitter leaf salad', subtitle: 'Market greens', image: picture('dish-greens'), badge: '15 min',
description: 'Chicory and rocket with sliced pear, toasted walnuts and a mustard dressing.',
meta: ['2 servings', 'Vegan'], url: 'https://recipes.example.org/pear-walnut-salad' },
{ title: 'Blackberry almond tart', subtitle: 'Weekend baking', image: picture('dish-berries'), badge: '40 min',
description: 'A press-in almond crust, a thin layer of frangipane and the last blackberries of the year.',
meta: ['8 slices'], url: 'https://recipes.example.org/blackberry-almond-tart' },
],
},
}]);