@vuecs/gravatar 2.0.3 → 2.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/component.ts","../src/index.ts"],"sourcesContent":["import { extend, useComponentTheme } from '@vuecs/core';\nimport type {\n ComponentThemeDefinition,\n ThemeClassesOverride,\n ThemeElementDefinition,\n VariantValues,\n} from '@vuecs/core';\nimport { VCAvatar } from '@vuecs/elements';\nimport type { AvatarSize } from '@vuecs/elements';\nimport md5 from 'md5';\nimport type { ExtractPublicPropTypes, PropType, SlotsType } from 'vue';\nimport {\n computed,\n defineComponent,\n h,\n} from 'vue';\n\nimport '../assets/gravatar.css';\n\nexport type GravatarThemeClasses = {\n /** Outer wrapper — composed onto `<VCAvatar>`'s `root` slot. */\n root: string;\n};\n\ndeclare module '@vuecs/core' {\n interface ThemeElements {\n gravatar?: ThemeElementDefinition<GravatarThemeClasses>;\n }\n}\n\nexport const gravatarThemeDefaults: ComponentThemeDefinition<GravatarThemeClasses> = { classes: { root: '' } };\n\nexport type GravatarFallbackSlotProps = {\n class: string;\n};\n\nconst gravatarProps = {\n /** Theme-class overrides for this component instance. */\n themeClass: { type: Object as PropType<ThemeClassesOverride<GravatarThemeClasses>>, default: undefined },\n /** Theme-variant values for this component instance. */\n themeVariant: { type: Object as PropType<VariantValues>, default: undefined },\n /** Email address used to derive the Gravatar hash (md5 of trimmed/lowercased value). */\n email: { type: String, default: '' },\n /** Pre-computed Gravatar hash. When set, takes precedence over `email`. */\n hash: { type: String, default: '' },\n /**\n * Image resolution served by Gravatar (drives the URL's `?s=` parameter,\n * range 1–2048). This controls **only** the served-image quality, not\n * the rendered size on the page — visual sizing is owned by `displaySize`\n * (semantic enum) or the theme system (`gravatar.root` / `avatar.root`\n * theme classes, or per-instance `themeClass`). Match `size` to your\n * displayed pixel dimensions (or 2× for retina) to avoid up-/down-scaling.\n */\n size: { type: Number, default: 80 },\n /**\n * Visual size — forwards to `<VCAvatar :size>`. `sm` ≈ 32px, `md` ≈ 40px,\n * `lg` ≈ 56px (theme-defined). Omit to fall back to `<VCAvatar>`'s\n * theme default (`md`) plus the structural `vc-gravatar` class. Pair\n * with a matching `size` (URL resolution, 2× for retina) for crisp\n * rendering — e.g. `<VCGravatar :size=\"80\" display-size=\"md\">`.\n */\n displaySize: { type: String as PropType<AvatarSize>, default: undefined },\n /** Gravatar `d=` parameter — fallback image style or URL (e.g. `retro`, `mp`, `identicon`). */\n defaultImg: { type: String, default: 'retro' },\n /** Gravatar `r=` parameter — content rating filter (`g`, `pg`, `r`, `x`). */\n rating: { type: String, default: 'g' },\n /** `alt` text forwarded to the underlying image. */\n alt: { type: String, default: 'Avatar' },\n /** URL protocol prefix (e.g. `'https'`). Empty means protocol-relative. */\n protocol: { type: String, default: '' },\n /** Gravatar service host (override for self-hosted alternatives). */\n hostname: { type: String, default: 'www.gravatar.com' },\n /**\n * Delay (ms) before the `<VCAvatar>` fallback becomes visible while\n * the Gravatar image is still loading (and persists if it ultimately\n * fails). Useful to avoid a flicker on fast connections by giving the\n * image a brief window to appear before the placeholder shows up.\n * Forwarded to `<VCAvatar>` (Reka's `AvatarFallback`); omit (default)\n * to render the fallback immediately. In practice the fallback most\n * often \"sticks\" on network failure, since Gravatar's `defaultImg`\n * usually returns a deterministic placeholder. Only strictly positive\n * values are forwarded — see `<VCAvatar>` for the Reka `delayMs: 0`\n * quirk handled there.\n */\n delayMs: { type: Number, default: undefined },\n};\n\nexport type GravatarProps = ExtractPublicPropTypes<typeof gravatarProps>;\n\nexport const VCGravatar = defineComponent({\n name: 'VCGravatar',\n inheritAttrs: false,\n props: gravatarProps,\n slots: Object as SlotsType<{\n fallback: GravatarFallbackSlotProps;\n }>,\n setup(props, { attrs, slots }) {\n const theme = useComponentTheme('gravatar', props, gravatarThemeDefaults);\n\n const url = computed(() => {\n const protocol = props.protocol.slice(-1) === ':' ?\n props.protocol :\n `${props.protocol}:`;\n const img = [\n `${protocol === ':' ? '' : protocol}//${props.hostname}/avatar/`,\n props.hash || md5(props.email.trim().toLowerCase()),\n `?s=${props.size}`,\n `&d=${props.defaultImg}`,\n `&r=${props.rating}`,\n ];\n return img.join('');\n });\n\n return () => {\n // The structural `vc-gravatar` class hardcodes a 5rem baseline\n // to preserve the historical default for bare `<VCGravatar>`\n // usages. When `displaySize` is set, skip it — otherwise its\n // dimensions would win the cascade over the avatar size\n // variants (gravatar CSS loads after elements CSS in\n // consumer pipelines).\n const structuralRoot = props.displaySize === undefined ? 'vc-gravatar' : '';\n const composedRoot = [structuralRoot, theme.value.root].filter(Boolean).join(' ');\n return h(\n VCAvatar,\n {\n ...attrs,\n src: url.value,\n alt: props.alt,\n delayMs: props.delayMs,\n size: props.displaySize,\n themeClass: composedRoot ? { root: extend(composedRoot) } : undefined,\n },\n { fallback: (slotProps: { class: string }) => slots.fallback?.(slotProps) ?? '' },\n );\n };\n },\n});\n","import { installDefaultsManager, installThemeManager } from '@vuecs/core';\nimport type { App, Plugin } from 'vue';\n\nimport './vue';\n\nimport { VCGravatar } from './component';\nimport type { Options } from './type';\n\nexport * from './component';\nexport * from './type';\n\nexport function install(instance: App, options: Options = {}): void {\n installThemeManager(instance, options);\n installDefaultsManager(instance, options);\n instance.component('VCGravatar', VCGravatar);\n}\n\nexport default { install } satisfies Plugin<[Options?]>;\n"],"mappings":";;;;;AA8BA,MAAa,wBAAwE,EAAE,SAAS,EAAE,MAAM,GAAG,EAAE;AA2D7G,MAAa,aAAa,gBAAgB;CACtC,MAAM;CACN,cAAc;CACd,OAAO;;EAtDP,YAAY;GAAE,MAAM;GAAgE,SAAS,KAAA;EAAU;;EAEvG,cAAc;GAAE,MAAM;GAAmC,SAAS,KAAA;EAAU;;EAE5E,OAAO;GAAE,MAAM;GAAQ,SAAS;EAAG;;EAEnC,MAAM;GAAE,MAAM;GAAQ,SAAS;EAAG;;;;;;;;;EASlC,MAAM;GAAE,MAAM;GAAQ,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AoB,UAAU,OAAO;CACrC,uBAAuB,UAAU,OAAO;CACxC,SAAS,UAAU,cAAc,UAAU;AAC/C;AAEA,IAAA,cAAe,EAAE,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/component.ts","../src/index.ts"],"sourcesContent":["import { extend, useComponentTheme } from '@vuecs/core';\nimport type {\n ComponentThemeDefinition,\n ThemeClassesOverride,\n ThemeElementDefinition,\n VariantValues,\n} from '@vuecs/core';\nimport { VCAvatar } from '@vuecs/elements';\nimport type { AvatarSize } from '@vuecs/elements';\nimport md5 from 'md5';\nimport type { ExtractPublicPropTypes, PropType, SlotsType } from 'vue';\nimport {\n computed,\n defineComponent,\n h,\n} from 'vue';\n\nimport '../assets/gravatar.css';\n\nexport type GravatarThemeClasses = {\n /** Outer wrapper — composed onto `<VCAvatar>`'s `root` slot. */\n root: string;\n};\n\ndeclare module '@vuecs/core' {\n interface ThemeElements {\n gravatar?: ThemeElementDefinition<GravatarThemeClasses>;\n }\n}\n\nexport const gravatarThemeDefaults: ComponentThemeDefinition<GravatarThemeClasses> = { classes: { root: '' } };\n\nexport type GravatarFallbackSlotProps = {\n class: string;\n};\n\nconst gravatarProps = {\n /** Theme-class overrides for this component instance. */\n themeClass: { type: Object as PropType<ThemeClassesOverride<GravatarThemeClasses>>, default: undefined },\n /** Theme-variant values for this component instance. */\n themeVariant: { type: Object as PropType<VariantValues>, default: undefined },\n /** Email address used to derive the Gravatar hash (md5 of trimmed/lowercased value). */\n email: { type: String, default: '' },\n /** Pre-computed Gravatar hash. When set, takes precedence over `email`. */\n hash: { type: String, default: '' },\n /**\n * Image resolution served by Gravatar (drives the URL's `?s=` parameter,\n * range 1–2048). This controls **only** the served-image quality, not\n * the rendered size on the page — visual sizing is owned by `displaySize`\n * (semantic enum) or the theme system (`gravatar.root` / `avatar.root`\n * theme classes, or per-instance `themeClass`). Match `size` to your\n * displayed pixel dimensions (or 2× for retina) to avoid up-/down-scaling.\n */\n size: { type: Number, default: 80 },\n /**\n * Visual size — forwards to `<VCAvatar :size>`. `sm` ≈ 32px, `md` ≈ 40px,\n * `lg` ≈ 56px (theme-defined). Omit to fall back to `<VCAvatar>`'s\n * theme default (`md`) plus the structural `vc-gravatar` class. Pair\n * with a matching `size` (URL resolution, 2× for retina) for crisp\n * rendering — e.g. `<VCGravatar :size=\"80\" display-size=\"md\">`.\n */\n displaySize: { type: String as PropType<AvatarSize>, default: undefined },\n /** Gravatar `d=` parameter — fallback image style or URL (e.g. `retro`, `mp`, `identicon`). */\n defaultImg: { type: String, default: 'retro' },\n /** Gravatar `r=` parameter — content rating filter (`g`, `pg`, `r`, `x`). */\n rating: { type: String, default: 'g' },\n /** `alt` text forwarded to the underlying image. */\n alt: { type: String, default: 'Avatar' },\n /** URL protocol prefix (e.g. `'https'`). Empty means protocol-relative. */\n protocol: { type: String, default: '' },\n /** Gravatar service host (override for self-hosted alternatives). */\n hostname: { type: String, default: 'www.gravatar.com' },\n /**\n * Delay (ms) before the `<VCAvatar>` fallback becomes visible while\n * the Gravatar image is still loading (and persists if it ultimately\n * fails). Useful to avoid a flicker on fast connections by giving the\n * image a brief window to appear before the placeholder shows up.\n * Forwarded to `<VCAvatar>` (Reka's `AvatarFallback`); omit (default)\n * to render the fallback immediately. In practice the fallback most\n * often \"sticks\" on network failure, since Gravatar's `defaultImg`\n * usually returns a deterministic placeholder. Only strictly positive\n * values are forwarded — see `<VCAvatar>` for the Reka `delayMs: 0`\n * quirk handled there.\n */\n delayMs: { type: Number, default: undefined },\n};\n\nexport type GravatarProps = ExtractPublicPropTypes<typeof gravatarProps>;\n\nexport const VCGravatar = defineComponent({\n name: 'VCGravatar',\n inheritAttrs: false,\n props: gravatarProps,\n slots: Object as SlotsType<{\n fallback: GravatarFallbackSlotProps;\n }>,\n setup(props, { attrs, slots }) {\n const theme = useComponentTheme('gravatar', props, gravatarThemeDefaults);\n\n const url = computed(() => {\n const protocol = props.protocol.slice(-1) === ':' ?\n props.protocol :\n `${props.protocol}:`;\n const img = [\n `${protocol === ':' ? '' : protocol}//${props.hostname}/avatar/`,\n props.hash || md5(props.email.trim().toLowerCase()),\n `?s=${props.size}`,\n `&d=${props.defaultImg}`,\n `&r=${props.rating}`,\n ];\n return img.join('');\n });\n\n return () => {\n // The structural `vc-gravatar` class hardcodes a 5rem baseline\n // to preserve the historical default for bare `<VCGravatar>`\n // usages. When `displaySize` is set, skip it — otherwise its\n // dimensions would win the cascade over the avatar size\n // variants (gravatar CSS loads after elements CSS in\n // consumer pipelines).\n const structuralRoot = props.displaySize === undefined ? 'vc-gravatar' : '';\n const composedRoot = [structuralRoot, theme.value.root].filter(Boolean).join(' ');\n return h(\n VCAvatar,\n {\n ...attrs,\n src: url.value,\n alt: props.alt,\n delayMs: props.delayMs,\n size: props.displaySize,\n themeClass: composedRoot ? { root: extend(composedRoot) } : undefined,\n },\n { fallback: (slotProps: { class: string }) => slots.fallback?.(slotProps) ?? '' },\n );\n };\n },\n});\n","import { installDefaultsManager, installThemeManager } from '@vuecs/core';\nimport type { App, Plugin } from 'vue';\n\nimport './vue';\n\nimport { VCGravatar } from './component';\nimport type { Options } from './type';\n\nexport * from './component';\nexport * from './type';\n\nexport function install(instance: App, options: Options = {}): void {\n installThemeManager(instance, options);\n installDefaultsManager(instance, options);\n instance.component('VCGravatar', VCGravatar);\n}\n\nexport default { install } satisfies Plugin<[Options?]>;\n"],"mappings":";;;;;AA8BA,MAAa,wBAAwE,EAAE,SAAS,EAAE,MAAM,GAAG,EAAE;AA2D7G,MAAa,aAAa,gBAAgB;CACtC,MAAM;CACN,cAAc;CACd,OAAO;;EAtDP,YAAY;GAAE,MAAM;GAAgE,SAAS,KAAA;EAAU;;EAEvG,cAAc;GAAE,MAAM;GAAmC,SAAS,KAAA;EAAU;;EAE5E,OAAO;GAAE,MAAM;GAAQ,SAAS;EAAG;;EAEnC,MAAM;GAAE,MAAM;GAAQ,SAAS;EAAG;;;;;;;;;EASlC,MAAM;GAAE,MAAM;GAAQ,SAAS;EAAG;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S;CAChE,oBAAoB,UAAU,OAAO;CACrC,uBAAuB,UAAU,OAAO;CACxC,SAAS,UAAU,cAAc,UAAU;AAC/C;AAEA,IAAA,cAAe,EAAE,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuecs/gravatar",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "type": "module",
5
5
  "description": "A package containing a gravatar component.",
6
6
  "exports": {
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/md5": "^2.3.5",
48
- "@vuecs/core": "^3.1.1",
49
- "@vuecs/elements": "^1.2.1",
48
+ "@vuecs/core": "^3.1.2",
49
+ "@vuecs/elements": "^1.2.2",
50
50
  "vue": "^3.5.35"
51
51
  },
52
52
  "peerDependencies": {
53
- "@vuecs/core": "^3.1.1",
54
- "@vuecs/elements": "^1.2.1",
53
+ "@vuecs/core": "^3.1.2",
54
+ "@vuecs/elements": "^1.2.2",
55
55
  "vue": "^3.x"
56
56
  },
57
57
  "engines": {