@quikturn/logos-vue 1.0.0
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/README.md +361 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +200 -0
- package/dist/index.d.ts +200 -0
- package/dist/index.mjs +559 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
# @quikturn/logos-vue
|
|
2
|
+
|
|
3
|
+
> Vue 3 components for the [Quikturn Logos API](https://getquikturn.io) -- drop-in logo display, infinite carousel, and responsive grid.
|
|
4
|
+
|
|
5
|
+
**[Get your API key](https://getquikturn.io)** -- free tier available, no credit card required.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **`<QuikturnLogo>`** -- single logo image with lazy loading, optional link wrapper
|
|
10
|
+
- **`<QuikturnLogoCarousel>`** -- infinite scrolling logo ticker (horizontal or vertical)
|
|
11
|
+
- **`<QuikturnLogoGrid>`** -- responsive CSS grid of logos
|
|
12
|
+
- **`QuikturnPlugin`** -- Vue plugin for token and base URL propagation via `provide`/`inject`
|
|
13
|
+
- **`useLogoUrl()`** -- composable that returns a computed Quikturn logo URL
|
|
14
|
+
- **`useQuikturnContext()`** -- composable to access the injected token and base URL
|
|
15
|
+
- **Zero CSS dependencies** -- inline styles only, no Tailwind or CSS-in-JS required
|
|
16
|
+
- **Tree-shakeable** -- ESM and CJS dual builds; import only what you use
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# pnpm (recommended)
|
|
22
|
+
pnpm add @quikturn/logos-vue @quikturn/logos vue
|
|
23
|
+
|
|
24
|
+
# npm
|
|
25
|
+
npm install @quikturn/logos-vue @quikturn/logos vue
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Peer dependencies:** `vue >= 3.3`, `@quikturn/logos >= 0.1.0`
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### 1. Install the plugin in your app entry
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// main.ts
|
|
36
|
+
import { createApp } from "vue";
|
|
37
|
+
import { QuikturnPlugin } from "@quikturn/logos-vue";
|
|
38
|
+
import App from "./App.vue";
|
|
39
|
+
|
|
40
|
+
const app = createApp(App);
|
|
41
|
+
app.use(QuikturnPlugin, { token: "qt_your_publishable_key" });
|
|
42
|
+
app.mount("#app");
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Use components anywhere in your app
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { QuikturnLogo, QuikturnLogoCarousel } from "@quikturn/logos-vue";
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<!-- Single logo -->
|
|
54
|
+
<QuikturnLogo domain="github.com" :size="64" />
|
|
55
|
+
|
|
56
|
+
<!-- Infinite scrolling carousel -->
|
|
57
|
+
<QuikturnLogoCarousel
|
|
58
|
+
:domains="['github.com', 'stripe.com', 'vercel.com', 'figma.com']"
|
|
59
|
+
:speed="120"
|
|
60
|
+
:logo-height="28"
|
|
61
|
+
:gap="48"
|
|
62
|
+
fade-out
|
|
63
|
+
/>
|
|
64
|
+
</template>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Reference
|
|
68
|
+
|
|
69
|
+
### `QuikturnPlugin`
|
|
70
|
+
|
|
71
|
+
Vue plugin that provides `token` and `baseUrl` to all nested components via `provide`/`inject`. Individual components can override these values with their own props.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
app.use(QuikturnPlugin, {
|
|
75
|
+
token: "qt_abc123",
|
|
76
|
+
baseUrl: "https://custom.api", // optional
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
| Option | Type | Required | Description |
|
|
81
|
+
|--------|------|----------|-------------|
|
|
82
|
+
| `token` | `string` | yes | Publishable API key (`qt_`/`pk_` prefix) |
|
|
83
|
+
| `baseUrl` | `string` | no | Override the Quikturn API base URL |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### `<QuikturnLogo>`
|
|
88
|
+
|
|
89
|
+
Renders a single logo `<img>`. Optionally wraps in an `<a>` tag when `href` is provided.
|
|
90
|
+
|
|
91
|
+
```vue
|
|
92
|
+
<QuikturnLogo
|
|
93
|
+
domain="stripe.com"
|
|
94
|
+
:size="128"
|
|
95
|
+
format="webp"
|
|
96
|
+
greyscale
|
|
97
|
+
theme="dark"
|
|
98
|
+
alt="Stripe"
|
|
99
|
+
href="https://stripe.com"
|
|
100
|
+
loading="lazy"
|
|
101
|
+
class="my-logo"
|
|
102
|
+
:style="{ borderRadius: '8px' }"
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Prop | Type | Default | Description |
|
|
107
|
+
|------|------|---------|-------------|
|
|
108
|
+
| `domain` | `string` | **required** | Domain to fetch logo for |
|
|
109
|
+
| `token` | `string` | from plugin | Publishable API key |
|
|
110
|
+
| `baseUrl` | `string` | from plugin | API base URL override |
|
|
111
|
+
| `size` | `number` | `128` | Logo width in pixels |
|
|
112
|
+
| `format` | `string` | `"image/png"` | `"png"`, `"jpeg"`, `"webp"`, `"avif"`, or MIME type |
|
|
113
|
+
| `greyscale` | `boolean` | `false` | Greyscale transformation |
|
|
114
|
+
| `theme` | `"light" \| "dark"` | -- | Background-optimized rendering |
|
|
115
|
+
| `alt` | `string` | `"<domain> logo"` | Image alt text |
|
|
116
|
+
| `href` | `string` | -- | Wraps the image in a link |
|
|
117
|
+
| `loading` | `"lazy" \| "eager"` | `"lazy"` | Native image loading strategy |
|
|
118
|
+
| `class` | `string` | -- | CSS class on wrapper element |
|
|
119
|
+
| `style` | `CSSProperties` | -- | Inline styles on wrapper element |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### `<QuikturnLogoCarousel>`
|
|
124
|
+
|
|
125
|
+
Infinite scrolling logo ticker powered by `requestAnimationFrame`. Supports horizontal (left/right) and vertical (up/down) scrolling, hover-based speed changes, fade overlays, and per-logo customization.
|
|
126
|
+
|
|
127
|
+
```vue
|
|
128
|
+
<QuikturnLogoCarousel
|
|
129
|
+
:domains="['github.com', 'stripe.com', 'vercel.com', 'figma.com']"
|
|
130
|
+
:speed="120"
|
|
131
|
+
direction="left"
|
|
132
|
+
:logo-height="28"
|
|
133
|
+
:gap="48"
|
|
134
|
+
fade-out
|
|
135
|
+
fade-out-color="#f5f5f5"
|
|
136
|
+
pause-on-hover
|
|
137
|
+
scale-on-hover
|
|
138
|
+
width="100%"
|
|
139
|
+
/>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Using `logos` for per-logo configuration
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<QuikturnLogoCarousel
|
|
146
|
+
:logos="[
|
|
147
|
+
{ domain: 'github.com', href: 'https://github.com', alt: 'GitHub' },
|
|
148
|
+
{ domain: 'stripe.com', size: 256, greyscale: true },
|
|
149
|
+
{ domain: 'vercel.com', theme: 'dark' },
|
|
150
|
+
]"
|
|
151
|
+
/>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| Prop | Type | Default | Description |
|
|
155
|
+
|------|------|---------|-------------|
|
|
156
|
+
| `domains` | `string[]` | -- | Simple list of domains (use this or `logos`) |
|
|
157
|
+
| `logos` | `LogoConfig[]` | -- | Per-logo configuration objects (use this or `domains`) |
|
|
158
|
+
| `token` | `string` | from plugin | Publishable API key |
|
|
159
|
+
| `baseUrl` | `string` | from plugin | API base URL override |
|
|
160
|
+
| `speed` | `number` | `120` | Scroll speed in pixels per second |
|
|
161
|
+
| `direction` | `"left" \| "right" \| "up" \| "down"` | `"left"` | Scroll direction |
|
|
162
|
+
| `pauseOnHover` | `boolean` | `false` | Pause scrolling on mouse hover |
|
|
163
|
+
| `hoverSpeed` | `number` | -- | Custom speed during hover (`0` = pause, overrides `pauseOnHover`) |
|
|
164
|
+
| `logoHeight` | `number` | `28` | Height of each logo image in pixels |
|
|
165
|
+
| `gap` | `number` | `32` | Gap between logos in pixels |
|
|
166
|
+
| `width` | `number \| string` | `"100%"` | Container width (`600`, `"80%"`, etc.) |
|
|
167
|
+
| `fadeOut` | `boolean` | `false` | Show gradient fade overlays at edges |
|
|
168
|
+
| `fadeOutColor` | `string` | `"#ffffff"` | Fade overlay color (match your background) |
|
|
169
|
+
| `scaleOnHover` | `boolean` | `false` | Scale logos on individual hover |
|
|
170
|
+
| `logoSize` | `number` | `128` | Default image fetch width for all logos |
|
|
171
|
+
| `logoFormat` | `string` | -- | Default image format for all logos |
|
|
172
|
+
| `logoGreyscale` | `boolean` | -- | Default greyscale setting for all logos |
|
|
173
|
+
| `logoTheme` | `"light" \| "dark"` | -- | Default theme for all logos |
|
|
174
|
+
| `renderItem` | `(logo: ResolvedLogo, index: number) => VNode` | -- | Custom render function per logo |
|
|
175
|
+
| `class` | `string` | -- | CSS class on root container |
|
|
176
|
+
| `style` | `CSSProperties` | -- | Inline styles on root container |
|
|
177
|
+
| `ariaLabel` | `string` | `"Company logos"` | Accessible label for the region |
|
|
178
|
+
|
|
179
|
+
#### `LogoConfig`
|
|
180
|
+
|
|
181
|
+
Used in the `logos` array prop for per-logo customization:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
interface LogoConfig {
|
|
185
|
+
domain: string; // Required
|
|
186
|
+
href?: string; // Wrap in link
|
|
187
|
+
alt?: string; // Alt text override
|
|
188
|
+
size?: number; // Per-logo image width
|
|
189
|
+
format?: string; // Per-logo format
|
|
190
|
+
greyscale?: boolean; // Per-logo greyscale
|
|
191
|
+
theme?: "light" | "dark";
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### `<QuikturnLogoGrid>`
|
|
198
|
+
|
|
199
|
+
Responsive CSS grid of logos. Each logo is centered in its grid cell.
|
|
200
|
+
|
|
201
|
+
```vue
|
|
202
|
+
<QuikturnLogoGrid
|
|
203
|
+
:domains="['github.com', 'stripe.com', 'vercel.com', 'figma.com']"
|
|
204
|
+
:columns="4"
|
|
205
|
+
:gap="24"
|
|
206
|
+
aria-label="Our partners"
|
|
207
|
+
/>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
| Prop | Type | Default | Description |
|
|
211
|
+
|------|------|---------|-------------|
|
|
212
|
+
| `domains` | `string[]` | -- | Simple list of domains (use this or `logos`) |
|
|
213
|
+
| `logos` | `LogoConfig[]` | -- | Per-logo configuration objects |
|
|
214
|
+
| `token` | `string` | from plugin | Publishable API key |
|
|
215
|
+
| `baseUrl` | `string` | from plugin | API base URL override |
|
|
216
|
+
| `columns` | `number` | `4` | Number of grid columns |
|
|
217
|
+
| `gap` | `number` | `24` | Grid gap in pixels |
|
|
218
|
+
| `logoSize` | `number` | `128` | Default image fetch width |
|
|
219
|
+
| `logoFormat` | `string` | -- | Default image format |
|
|
220
|
+
| `logoGreyscale` | `boolean` | -- | Default greyscale |
|
|
221
|
+
| `logoTheme` | `"light" \| "dark"` | -- | Default theme |
|
|
222
|
+
| `renderItem` | `(logo: ResolvedLogo, index: number) => VNode` | -- | Custom render function per logo |
|
|
223
|
+
| `class` | `string` | -- | CSS class on grid container |
|
|
224
|
+
| `style` | `CSSProperties` | -- | Inline styles on grid container |
|
|
225
|
+
| `ariaLabel` | `string` | `"Company logos"` | Accessible label for the region |
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
### `useLogoUrl(domain, options?)`
|
|
230
|
+
|
|
231
|
+
Composable that returns a `ComputedRef<string>` for a Quikturn logo URL. Pulls `token` and `baseUrl` from the plugin unless overridden. Both arguments accept refs or getters for reactivity.
|
|
232
|
+
|
|
233
|
+
```vue
|
|
234
|
+
<script setup lang="ts">
|
|
235
|
+
import { useLogoUrl } from "@quikturn/logos-vue";
|
|
236
|
+
|
|
237
|
+
const url = useLogoUrl("github.com", { size: 256, format: "webp" });
|
|
238
|
+
</script>
|
|
239
|
+
|
|
240
|
+
<template>
|
|
241
|
+
<img :src="url" alt="GitHub" />
|
|
242
|
+
</template>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
| Parameter | Type | Description |
|
|
246
|
+
|-----------|------|-------------|
|
|
247
|
+
| `domain` | `string \| Ref<string> \| () => string` | Domain to build URL for |
|
|
248
|
+
| `options.token` | `string` | Override plugin token |
|
|
249
|
+
| `options.baseUrl` | `string` | Override plugin base URL |
|
|
250
|
+
| `options.size` | `number` | Image width in pixels |
|
|
251
|
+
| `options.format` | `string` | Output format |
|
|
252
|
+
| `options.greyscale` | `boolean` | Greyscale transformation |
|
|
253
|
+
| `options.theme` | `"light" \| "dark"` | Theme optimization |
|
|
254
|
+
|
|
255
|
+
**Returns:** `ComputedRef<string>` -- fully-qualified, reactive logo URL
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### `useQuikturnContext()`
|
|
260
|
+
|
|
261
|
+
Composable that returns the token and base URL injected by `QuikturnPlugin`. Returns `undefined` if the plugin has not been installed.
|
|
262
|
+
|
|
263
|
+
```vue
|
|
264
|
+
<script setup lang="ts">
|
|
265
|
+
import { useQuikturnContext } from "@quikturn/logos-vue";
|
|
266
|
+
|
|
267
|
+
const ctx = useQuikturnContext();
|
|
268
|
+
// ctx?.token, ctx?.baseUrl
|
|
269
|
+
</script>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Examples
|
|
275
|
+
|
|
276
|
+
### Logo Wall (Marketing Page)
|
|
277
|
+
|
|
278
|
+
```vue
|
|
279
|
+
<script setup lang="ts">
|
|
280
|
+
import { QuikturnLogoCarousel } from "@quikturn/logos-vue";
|
|
281
|
+
|
|
282
|
+
const partners = [
|
|
283
|
+
"github.com", "stripe.com", "vercel.com", "figma.com",
|
|
284
|
+
"linear.app", "notion.so", "slack.com", "discord.com",
|
|
285
|
+
];
|
|
286
|
+
</script>
|
|
287
|
+
|
|
288
|
+
<template>
|
|
289
|
+
<h2>Trusted by industry leaders</h2>
|
|
290
|
+
<QuikturnLogoCarousel
|
|
291
|
+
:domains="partners"
|
|
292
|
+
:speed="80"
|
|
293
|
+
:logo-height="32"
|
|
294
|
+
:gap="64"
|
|
295
|
+
fade-out
|
|
296
|
+
pause-on-hover
|
|
297
|
+
/>
|
|
298
|
+
</template>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Partner Grid with Links
|
|
302
|
+
|
|
303
|
+
```vue
|
|
304
|
+
<script setup lang="ts">
|
|
305
|
+
import { QuikturnLogoGrid } from "@quikturn/logos-vue";
|
|
306
|
+
|
|
307
|
+
const partners = [
|
|
308
|
+
{ domain: "github.com", href: "https://github.com", alt: "GitHub" },
|
|
309
|
+
{ domain: "stripe.com", href: "https://stripe.com", alt: "Stripe" },
|
|
310
|
+
{ domain: "vercel.com", href: "https://vercel.com", alt: "Vercel" },
|
|
311
|
+
{ domain: "figma.com", href: "https://figma.com", alt: "Figma" },
|
|
312
|
+
];
|
|
313
|
+
</script>
|
|
314
|
+
|
|
315
|
+
<template>
|
|
316
|
+
<QuikturnLogoGrid :logos="partners" :columns="2" :gap="32" />
|
|
317
|
+
</template>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Vertical Carousel
|
|
321
|
+
|
|
322
|
+
```vue
|
|
323
|
+
<template>
|
|
324
|
+
<div style="height: 240px">
|
|
325
|
+
<QuikturnLogoCarousel
|
|
326
|
+
:domains="['github.com', 'stripe.com', 'vercel.com']"
|
|
327
|
+
direction="up"
|
|
328
|
+
:speed="60"
|
|
329
|
+
:logo-height="24"
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
</template>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Using the Composable Directly
|
|
336
|
+
|
|
337
|
+
```vue
|
|
338
|
+
<script setup lang="ts">
|
|
339
|
+
import { ref } from "vue";
|
|
340
|
+
import { useLogoUrl } from "@quikturn/logos-vue";
|
|
341
|
+
|
|
342
|
+
const domain = ref("github.com");
|
|
343
|
+
const url = useLogoUrl(domain, { size: 256, format: "webp" });
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
<template>
|
|
347
|
+
<input v-model="domain" placeholder="Enter a domain" />
|
|
348
|
+
<img :src="url" :alt="`${domain} logo`" />
|
|
349
|
+
</template>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Resources
|
|
353
|
+
|
|
354
|
+
- **[Quikturn website](https://getquikturn.io)** -- sign up, manage keys, explore the API
|
|
355
|
+
- **[Dashboard](https://getquikturn.io/dashboard)** -- usage analytics, key management, plan upgrades
|
|
356
|
+
- **[Pricing](https://getquikturn.io/pricing)** -- free tier, pro, and enterprise plans
|
|
357
|
+
- **[Core SDK docs](https://www.npmjs.com/package/@quikturn/logos)** -- `@quikturn/logos` URL builder, browser client, server client
|
|
358
|
+
|
|
359
|
+
## License
|
|
360
|
+
|
|
361
|
+
MIT -- built by [Quikturn](https://getquikturn.io)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),O=require("@quikturn/logos"),D=Symbol("quikturn"),j={install(n,t){n.provide(D,{token:t.token,baseUrl:t.baseUrl})}};function U(){return e.inject(D)}function Y(n,t){const o=U();return e.computed(()=>{const l=t?e.toValue(t):void 0,m=(l==null?void 0:l.token)??(o==null?void 0:o.token),f=(l==null?void 0:l.baseUrl)??(o==null?void 0:o.baseUrl);return O.logoUrl(e.toValue(n),{token:m,baseUrl:f,size:l==null?void 0:l.size,format:l==null?void 0:l.format,greyscale:l==null?void 0:l.greyscale,theme:l==null?void 0:l.theme})})}const P=new Set;function F(n){if(typeof window>"u"||!n||n.startsWith("sk_")||P.has(n))return;P.add(n);const t=new Image;t.src=`${O.BASE_URL}/_beacon?token=${n}&page=${encodeURIComponent(location.href)}`}function N(n){try{const t=new URL(n,"https://placeholder.invalid");return t.protocol==="https:"||t.protocol==="http:"}catch{return!1}}const K=["href"],J=["src","alt","loading"],X=["src","alt","loading"],Z=["src","alt","loading"],ee=e.defineComponent({__name:"QuikturnLogo",props:{domain:{},token:{},baseUrl:{},size:{},format:{},greyscale:{type:Boolean},theme:{},alt:{},href:{},class:{},style:{},loading:{default:"lazy"}},emits:["error","load"],setup(n,{emit:t}){const o=n,l=t,m=U(),f=e.computed(()=>o.token??(m==null?void 0:m.token)??""),v=e.computed(()=>o.baseUrl??(m==null?void 0:m.baseUrl)),i=e.computed(()=>O.logoUrl(o.domain,{token:f.value||void 0,size:o.size,format:o.format,greyscale:o.greyscale,theme:o.theme,baseUrl:v.value})),a=e.computed(()=>o.alt??`${o.domain} logo`);return e.onMounted(()=>{f.value&&F(f.value)}),(u,c)=>n.href&&e.unref(N)(n.href)?(e.openBlock(),e.createElementBlock("a",{key:0,href:n.href,target:"_blank",rel:"noopener noreferrer",class:e.normalizeClass(o.class),style:e.normalizeStyle(o.style)},[e.createElementVNode("img",{src:i.value,alt:a.value,loading:n.loading,onError:c[0]||(c[0]=d=>l("error",d)),onLoad:c[1]||(c[1]=d=>l("load",d))},null,40,J)],14,K)):o.class||o.style?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(o.class),style:e.normalizeStyle(o.style)},[e.createElementVNode("img",{src:i.value,alt:a.value,loading:n.loading,onError:c[2]||(c[2]=d=>l("error",d)),onLoad:c[3]||(c[3]=d=>l("load",d))},null,40,X)],6)):(e.openBlock(),e.createElementBlock("img",{key:2,src:i.value,alt:a.value,loading:n.loading,onError:c[4]||(c[4]=d=>l("error",d)),onLoad:c[5]||(c[5]=d=>l("load",d))},null,40,Z))}}),te=["aria-label"],oe={key:1,style:{display:"flex",alignItems:"center",justifyContent:"center"}},ne=["href","aria-label"],le=["src","alt"],ae=["src","alt"],re=e.defineComponent({__name:"QuikturnLogoGrid",props:{domains:{},logos:{},token:{},baseUrl:{},columns:{default:4},gap:{default:24},logoSize:{},logoFormat:{},logoGreyscale:{type:Boolean},logoTheme:{},renderItem:{},class:{},style:{},ariaLabel:{default:"Company logos"}},setup(n){const t=n,o=U(),l=e.computed(()=>t.token??(o==null?void 0:o.token)??""),m=e.computed(()=>t.baseUrl??(o==null?void 0:o.baseUrl)),f=e.computed(()=>(t.logos??(t.domains??[]).map(a=>({domain:a}))).map(a=>({domain:a.domain,alt:a.alt??`${a.domain} logo`,href:a.href,url:O.logoUrl(a.domain,{token:l.value||void 0,size:a.size??t.logoSize,format:a.format??t.logoFormat,greyscale:a.greyscale??t.logoGreyscale,theme:a.theme??t.logoTheme,baseUrl:m.value})}))),v=e.computed(()=>({display:"grid",gridTemplateColumns:`repeat(${t.columns}, 1fr)`,gap:`${t.gap}px`,alignItems:"center",justifyItems:"center",...t.style??{}}));return e.onMounted(()=>{l.value&&F(l.value)}),(i,a)=>(e.openBlock(),e.createElementBlock("div",{role:"region","aria-label":n.ariaLabel,class:e.normalizeClass(t.class),style:e.normalizeStyle(v.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(u,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:u.domain},[n.renderItem?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.renderItem(u,c)),{key:0})):(e.openBlock(),e.createElementBlock("div",oe,[u.href&&e.unref(N)(u.href)?(e.openBlock(),e.createElementBlock("a",{key:0,href:u.href,target:"_blank",rel:"noopener noreferrer","aria-label":u.alt},[e.createElementVNode("img",{src:u.url,alt:u.alt,loading:"lazy",style:{maxWidth:"100%",height:"auto",display:"block"}},null,8,le)],8,ne)):(e.openBlock(),e.createElementBlock("img",{key:1,src:u.url,alt:u.alt,loading:"lazy",style:{maxWidth:"100%",height:"auto",display:"block"}},null,8,ae))]))],64))),128))],14,te))}}),S={SMOOTH_TAU:.25,MIN_COPIES:2,COPY_HEADROOM:2};function ie(n,t,o){e.watch(o,(l,m,f)=>{if(typeof window>"u")return;if(!window.ResizeObserver){const i=()=>n();window.addEventListener("resize",i),n(),f(()=>window.removeEventListener("resize",i));return}const v=t.map(i=>{const a=i.value;if(!a)return null;const u=new ResizeObserver(n);return u.observe(a),u});n(),f(()=>{v.forEach(i=>i==null?void 0:i.disconnect())})},{immediate:!0})}function se(n,t,o){e.watch(o,(l,m,f)=>{var u;const v=((u=n.value)==null?void 0:u.querySelectorAll("img"))??[];if(v.length===0){t();return}let i=v.length;const a=()=>{i-=1,i===0&&t()};v.forEach(c=>{const d=c;d.complete?a():(d.addEventListener("load",a,{once:!0}),d.addEventListener("error",a,{once:!0}))}),f(()=>{v.forEach(c=>{c.removeEventListener("load",a),c.removeEventListener("error",a)})})},{immediate:!0})}function ue(n,t,o,l,m,f,v){const i=e.ref(null),a=e.ref(null),u=e.ref(0),c=e.ref(0);e.watch(()=>[t(),o(),l(),m(),f(),v()],(d,y,b)=>{var C;const k=n.value;if(!k)return;const x=typeof window<"u"&&((C=window.matchMedia)==null?void 0:C.call(window,"(prefers-reduced-motion: reduce)").matches),z=v(),h=z?l():o();if(h>0&&(u.value=(u.value%h+h)%h,k.style.transform=z?`translate3d(0, ${-u.value}px, 0)`:`translate3d(${-u.value}px, 0, 0)`),x){k.style.transform="translate3d(0, 0, 0)",b(()=>{a.value=null});return}const _=B=>{a.value===null&&(a.value=B);const L=Math.max(0,B-a.value)/1e3;a.value=B;const I=f(),E=m()&&I!==void 0?I:t(),H=1-Math.exp(-L/S.SMOOTH_TAU);if(c.value+=(E-c.value)*H,h>0){let w=u.value+c.value*L;w=(w%h+h)%h,u.value=w,k.style.transform=z?`translate3d(0, ${-u.value}px, 0)`:`translate3d(${-u.value}px, 0, 0)`}i.value=requestAnimationFrame(_)};i.value=requestAnimationFrame(_),b(()=>{i.value!==null&&(cancelAnimationFrame(i.value),i.value=null),a.value=null})},{immediate:!0}),e.onUnmounted(()=>{i.value!==null&&(cancelAnimationFrame(i.value),i.value=null)})}const ce=["aria-label"],de=["aria-hidden"],fe=["href","aria-label"],me=["src","alt"],ve=["src","alt"],ge=e.defineComponent({__name:"QuikturnLogoCarousel",props:{domains:{default:void 0},logos:{default:void 0},token:{default:void 0},baseUrl:{default:void 0},speed:{default:120},direction:{default:"left"},pauseOnHover:{type:Boolean,default:void 0},hoverSpeed:{default:void 0},logoHeight:{default:28},gap:{default:32},width:{default:"100%"},fadeOut:{type:Boolean,default:!1},fadeOutColor:{default:void 0},scaleOnHover:{type:Boolean,default:!1},logoSize:{default:void 0},logoFormat:{default:void 0},logoGreyscale:{type:Boolean,default:void 0},logoTheme:{default:void 0},renderItem:{type:Function,default:void 0},class:{},style:{},ariaLabel:{default:"Company logos"}},setup(n){const t=n,o=U(),l=e.computed(()=>t.token??(o==null?void 0:o.token)??""),m=e.computed(()=>t.baseUrl??(o==null?void 0:o.baseUrl)),f=e.ref(null),v=e.ref(null),i=e.ref(null),a=e.ref(0),u=e.ref(0),c=e.ref(S.MIN_COPIES),d=e.ref(!1),y=e.computed(()=>t.direction==="up"||t.direction==="down"),b=e.computed(()=>(t.logos??(t.domains??[]).map(s=>({domain:s}))).map(s=>({domain:s.domain,alt:s.alt??`${s.domain} logo`,href:s.href,url:O.logoUrl(s.domain,{token:l.value||void 0,size:s.size??t.logoSize,format:s.format??t.logoFormat,greyscale:s.greyscale??t.logoGreyscale,theme:s.theme??t.logoTheme,baseUrl:m.value})}))),k=e.computed(()=>{if(t.hoverSpeed!==void 0)return t.hoverSpeed;if(t.pauseOnHover===!0)return 0}),x=e.computed(()=>{const r=Math.abs(t.speed),s=y.value?t.direction==="up"?1:-1:t.direction==="left"?1:-1,g=t.speed<0?-1:1;return r*s*g}),z=e.computed(()=>{const r=t.width;return typeof r=="number"?`${r}px`:r??void 0}),h=e.computed(()=>({position:"relative",overflow:"hidden",width:y.value?void 0:z.value??"100%",height:y.value?"100%":void 0,display:y.value?"inline-block":void 0})),_=e.computed(()=>({display:"flex",flexDirection:y.value?"column":"row",width:y.value?"100%":"max-content",willChange:"transform",userSelect:"none",position:"relative",zIndex:0})),C=e.computed(()=>Array.from({length:c.value},(r,s)=>s));e.onMounted(()=>{l.value&&F(l.value)});function B(){var M,Q;const r=f.value,s=(M=i.value)==null?void 0:M.getBoundingClientRect(),g=(s==null?void 0:s.width)??0,p=(s==null?void 0:s.height)??0;if(y.value){const $=((Q=r==null?void 0:r.parentElement)==null?void 0:Q.clientHeight)??0;if(r&&$>0&&(r.style.height=`${Math.ceil($)}px`),p>0){u.value=Math.ceil(p);const T=(r==null?void 0:r.clientHeight)??$??p,W=Math.ceil(T/p)+S.COPY_HEADROOM;c.value=Math.max(S.MIN_COPIES,W)}}else if(g>0){a.value=Math.ceil(g);const $=(r==null?void 0:r.clientWidth)??0,T=Math.ceil($/g)+S.COPY_HEADROOM;c.value=Math.max(S.MIN_COPIES,T)}}ie(B,[f,i],()=>[b.value,t.gap,t.logoHeight,y.value]),se(i,B,()=>[b.value,t.gap,t.logoHeight,y.value]),ue(v,()=>x.value,()=>a.value,()=>u.value,()=>d.value,()=>k.value,()=>y.value);function L(){k.value!==void 0&&(d.value=!0)}function I(){k.value!==void 0&&(d.value=!1)}const E={position:"absolute",pointerEvents:"none",zIndex:1};function H(){const r=t.fadeOutColor??"#ffffff";return y.value?{...E,top:"0",left:"0",right:"0",height:"clamp(24px, 8%, 120px)",background:`linear-gradient(to bottom, ${r} 0%, transparent 100%)`}:{...E,top:"0",bottom:"0",left:"0",width:"clamp(24px, 8%, 120px)",background:`linear-gradient(to right, ${r} 0%, transparent 100%)`}}function w(){const r=t.fadeOutColor??"#ffffff";return y.value?{...E,bottom:"0",left:"0",right:"0",height:"clamp(24px, 8%, 120px)",background:`linear-gradient(to top, ${r} 0%, transparent 100%)`}:{...E,top:"0",bottom:"0",right:"0",width:"clamp(24px, 8%, 120px)",background:`linear-gradient(to left, ${r} 0%, transparent 100%)`}}function A(){return{height:`${t.logoHeight}px`,width:"auto",display:"block",objectFit:"contain",userSelect:"none",pointerEvents:"none",...t.scaleOnHover?{transition:"transform 300ms cubic-bezier(0.4, 0, 0.2, 1)"}:{}}}function R(r){if(!t.scaleOnHover)return;const s=r.currentTarget.closest("li"),g=s==null?void 0:s.querySelector("img");g&&(g.style.transform="scale(1.2)")}function V(r){if(!t.scaleOnHover)return;const s=r.currentTarget.closest("li"),g=s==null?void 0:s.querySelector("img");g&&(g.style.transform="")}function q(){return{flex:"none",...y.value?{marginBottom:`${t.gap}px`}:{marginRight:`${t.gap}px`}}}function G(){return{display:"flex",flexDirection:y.value?"column":"row",alignItems:"center",listStyle:"none",margin:"0",padding:"0"}}return(r,s)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:f,role:"region","aria-label":n.ariaLabel,class:e.normalizeClass(r.$props.class),style:e.normalizeStyle([h.value,r.$props.style])},[n.fadeOut?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{"aria-hidden":"true","data-testid":"fade-overlay",style:e.normalizeStyle(H())},null,4),e.createElementVNode("div",{"aria-hidden":"true","data-testid":"fade-overlay",style:e.normalizeStyle(w())},null,4)],64)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"trackRef",ref:v,style:e.normalizeStyle(_.value),onMouseenter:L,onMouseleave:I},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,g=>(e.openBlock(),e.createElementBlock("ul",{key:g,ref_for:!0,ref:p=>{g===0&&(i.value=p)},role:"list","aria-hidden":g>0?!0:void 0,style:e.normalizeStyle(G())},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(p,M)=>(e.openBlock(),e.createElementBlock("li",{key:`${g}-${M}`,role:"listitem",style:e.normalizeStyle(q())},[n.renderItem?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(()=>n.renderItem(p,M)),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[p.href&&e.unref(N)(p.href)?(e.openBlock(),e.createElementBlock("a",{key:0,href:p.href,target:"_blank",rel:"noopener noreferrer","aria-label":p.alt,style:{display:"inline-flex","align-items":"center","text-decoration":"none"},onMouseenter:R,onMouseleave:V},[e.createElementVNode("img",{src:p.url,alt:p.alt,loading:"lazy",decoding:"async",draggable:!1,style:e.normalizeStyle(A())},null,12,me)],40,fe)):(e.openBlock(),e.createElementBlock("span",{key:1,style:{display:"inline-flex","align-items":"center"},onMouseenter:R,onMouseleave:V},[e.createElementVNode("img",{src:p.url,alt:p.alt,loading:"lazy",decoding:"async",draggable:!1,style:e.normalizeStyle(A())},null,12,ve)],32))],64))],4))),128))],12,de))),128))],36)],14,ce))}});exports.QuikturnLogo=ee;exports.QuikturnLogoCarousel=ge;exports.QuikturnLogoGrid=re;exports.QuikturnPlugin=j;exports.useLogoUrl=Y;exports.useQuikturnContext=U;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
3
|
+
import { ComponentProvideOptions } from 'vue';
|
|
4
|
+
import { ComputedRef } from 'vue';
|
|
5
|
+
import { CSSProperties } from 'vue';
|
|
6
|
+
import { DefineComponent } from 'vue';
|
|
7
|
+
import { FormatShorthand } from '@quikturn/logos';
|
|
8
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
9
|
+
import { PublicProps } from 'vue';
|
|
10
|
+
import { SupportedOutputFormat } from '@quikturn/logos';
|
|
11
|
+
import { ThemeOption } from '@quikturn/logos';
|
|
12
|
+
import { VNode } from 'vue';
|
|
13
|
+
|
|
14
|
+
declare type __VLS_Props = {
|
|
15
|
+
domain: string;
|
|
16
|
+
token?: string;
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
size?: number;
|
|
19
|
+
format?: string;
|
|
20
|
+
greyscale?: boolean;
|
|
21
|
+
theme?: string;
|
|
22
|
+
alt?: string;
|
|
23
|
+
href?: string;
|
|
24
|
+
class?: string;
|
|
25
|
+
style?: CSSProperties;
|
|
26
|
+
loading?: "lazy" | "eager";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
declare type __VLS_Props_2 = {
|
|
30
|
+
domains?: string[];
|
|
31
|
+
logos?: LogoConfig[];
|
|
32
|
+
token?: string;
|
|
33
|
+
baseUrl?: string;
|
|
34
|
+
columns?: number;
|
|
35
|
+
gap?: number;
|
|
36
|
+
logoSize?: number;
|
|
37
|
+
logoFormat?: string;
|
|
38
|
+
logoGreyscale?: boolean;
|
|
39
|
+
logoTheme?: string;
|
|
40
|
+
renderItem?: (logo: ResolvedLogo, index: number) => VNode;
|
|
41
|
+
class?: string;
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
ariaLabel?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare type __VLS_Props_3 = QuikturnLogoCarouselProps & {
|
|
47
|
+
class?: string;
|
|
48
|
+
style?: CSSProperties;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { FormatShorthand }
|
|
52
|
+
|
|
53
|
+
/** Per-logo configuration in carousel/grid components. */
|
|
54
|
+
export declare interface LogoConfig extends LogoOptions {
|
|
55
|
+
domain: string;
|
|
56
|
+
href?: string;
|
|
57
|
+
alt?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Options that control logo image generation. */
|
|
61
|
+
export declare interface LogoOptions {
|
|
62
|
+
size?: number;
|
|
63
|
+
format?: SupportedOutputFormat | FormatShorthand;
|
|
64
|
+
greyscale?: boolean;
|
|
65
|
+
theme?: ThemeOption;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare interface QuikturnContextValue {
|
|
69
|
+
token: string;
|
|
70
|
+
baseUrl?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export declare const QuikturnLogo: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
74
|
+
error: (event: Event) => any;
|
|
75
|
+
load: (event: Event) => any;
|
|
76
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
77
|
+
onError?: ((event: Event) => any) | undefined;
|
|
78
|
+
onLoad?: ((event: Event) => any) | undefined;
|
|
79
|
+
}>, {
|
|
80
|
+
loading: "lazy" | "eager";
|
|
81
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
82
|
+
|
|
83
|
+
export declare const QuikturnLogoCarousel: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{}>, {
|
|
84
|
+
token: string;
|
|
85
|
+
baseUrl: string;
|
|
86
|
+
domains: string[];
|
|
87
|
+
logos: LogoConfig[];
|
|
88
|
+
gap: number;
|
|
89
|
+
logoSize: number;
|
|
90
|
+
logoFormat: SupportedOutputFormat | FormatShorthand;
|
|
91
|
+
logoGreyscale: boolean;
|
|
92
|
+
logoTheme: ThemeOption;
|
|
93
|
+
renderItem: (logo: ResolvedLogo, index: number) => VNode;
|
|
94
|
+
ariaLabel: string;
|
|
95
|
+
direction: "left" | "right" | "up" | "down";
|
|
96
|
+
width: number | string;
|
|
97
|
+
speed: number;
|
|
98
|
+
pauseOnHover: boolean;
|
|
99
|
+
hoverSpeed: number;
|
|
100
|
+
logoHeight: number;
|
|
101
|
+
fadeOut: boolean;
|
|
102
|
+
fadeOutColor: string;
|
|
103
|
+
scaleOnHover: boolean;
|
|
104
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
105
|
+
containerRef: HTMLDivElement;
|
|
106
|
+
trackRef: HTMLDivElement;
|
|
107
|
+
}, HTMLDivElement>;
|
|
108
|
+
|
|
109
|
+
/** Props for the QuikturnLogoCarousel component. */
|
|
110
|
+
export declare interface QuikturnLogoCarouselProps {
|
|
111
|
+
domains?: string[];
|
|
112
|
+
logos?: LogoConfig[];
|
|
113
|
+
token?: string;
|
|
114
|
+
baseUrl?: string;
|
|
115
|
+
speed?: number;
|
|
116
|
+
direction?: "left" | "right" | "up" | "down";
|
|
117
|
+
pauseOnHover?: boolean;
|
|
118
|
+
hoverSpeed?: number;
|
|
119
|
+
logoHeight?: number;
|
|
120
|
+
gap?: number;
|
|
121
|
+
width?: number | string;
|
|
122
|
+
fadeOut?: boolean;
|
|
123
|
+
fadeOutColor?: string;
|
|
124
|
+
scaleOnHover?: boolean;
|
|
125
|
+
logoSize?: number;
|
|
126
|
+
logoFormat?: SupportedOutputFormat | FormatShorthand;
|
|
127
|
+
logoGreyscale?: boolean;
|
|
128
|
+
logoTheme?: ThemeOption;
|
|
129
|
+
renderItem?: (logo: ResolvedLogo, index: number) => VNode;
|
|
130
|
+
class?: string;
|
|
131
|
+
style?: CSSProperties;
|
|
132
|
+
ariaLabel?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export declare const QuikturnLogoGrid: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {
|
|
136
|
+
columns: number;
|
|
137
|
+
gap: number;
|
|
138
|
+
ariaLabel: string;
|
|
139
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
140
|
+
|
|
141
|
+
/** Props for the QuikturnLogoGrid component. */
|
|
142
|
+
export declare interface QuikturnLogoGridProps {
|
|
143
|
+
domains?: string[];
|
|
144
|
+
logos?: LogoConfig[];
|
|
145
|
+
token?: string;
|
|
146
|
+
baseUrl?: string;
|
|
147
|
+
columns?: number;
|
|
148
|
+
gap?: number;
|
|
149
|
+
logoSize?: number;
|
|
150
|
+
logoFormat?: SupportedOutputFormat | FormatShorthand;
|
|
151
|
+
logoGreyscale?: boolean;
|
|
152
|
+
logoTheme?: ThemeOption;
|
|
153
|
+
renderItem?: (logo: ResolvedLogo, index: number) => VNode;
|
|
154
|
+
class?: string;
|
|
155
|
+
style?: CSSProperties;
|
|
156
|
+
ariaLabel?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Props for the QuikturnLogo component. */
|
|
160
|
+
export declare interface QuikturnLogoProps extends LogoOptions {
|
|
161
|
+
domain: string;
|
|
162
|
+
token?: string;
|
|
163
|
+
baseUrl?: string;
|
|
164
|
+
alt?: string;
|
|
165
|
+
href?: string;
|
|
166
|
+
class?: string;
|
|
167
|
+
style?: CSSProperties;
|
|
168
|
+
loading?: "lazy" | "eager";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export declare const QuikturnPlugin: {
|
|
172
|
+
install(app: App, options: QuikturnPluginOptions): void;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/** Options for the QuikturnPlugin. */
|
|
176
|
+
export declare interface QuikturnPluginOptions {
|
|
177
|
+
token: string;
|
|
178
|
+
baseUrl?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Internal resolved logo with pre-built URL. */
|
|
182
|
+
export declare interface ResolvedLogo {
|
|
183
|
+
domain: string;
|
|
184
|
+
url: string;
|
|
185
|
+
alt: string;
|
|
186
|
+
href?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { SupportedOutputFormat }
|
|
190
|
+
|
|
191
|
+
export { ThemeOption }
|
|
192
|
+
|
|
193
|
+
export declare function useLogoUrl(domain: MaybeRefOrGetter<string>, options?: MaybeRefOrGetter<(LogoOptions & {
|
|
194
|
+
token?: string;
|
|
195
|
+
baseUrl?: string;
|
|
196
|
+
}) | undefined>): ComputedRef<string>;
|
|
197
|
+
|
|
198
|
+
export declare function useQuikturnContext(): QuikturnContextValue | undefined;
|
|
199
|
+
|
|
200
|
+
export { }
|