@thunderid/browser 0.8.0 → 0.8.1

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.
@@ -3385,6 +3385,28 @@ const extractAvatarParamsFromUri = (uri) => {
3385
3385
  };
3386
3386
  var extractAvatarParamsFromUri_default = extractAvatarParamsFromUri;
3387
3387
 
3388
+ //#endregion
3389
+ //#region src/utils/buildAvatarSpec.ts
3390
+ /**
3391
+ * Serializes {@link AvatarParams} into an `avatar:` URI, the inverse of
3392
+ * {@link extractAvatarParamsFromUri}.
3393
+ *
3394
+ * @param params - The avatar parameters to serialize.
3395
+ * @returns An `"avatar:shape=...,variant=...,content=...,colors=..."` spec string, with a
3396
+ * trailing `,bg=...` when {@link AvatarParams.bg} is set.
3397
+ *
3398
+ * @example
3399
+ * ```typescript
3400
+ * buildAvatarSpec({shape: 'circle', variant: 'two_letter', content: 'BM', colors: 2});
3401
+ * // "avatar:shape=circle,variant=two_letter,content=BM,colors=2"
3402
+ * ```
3403
+ */
3404
+ const buildAvatarSpec = ({ shape, variant, content, colors, bg }) => {
3405
+ const base = `${AVATAR_URI_SCHEME}shape=${shape},variant=${variant},content=${content},colors=${colors}`;
3406
+ return bg ? `${base},bg=${bg}` : base;
3407
+ };
3408
+ var buildAvatarSpec_default = buildAvatarSpec;
3409
+
3388
3410
  //#endregion
3389
3411
  //#region src/utils/anonymousAnimalIcons.generated.ts
3390
3412
  const ANONYMOUS_ANIMAL_ICONS = {
@@ -3973,6 +3995,7 @@ exports.STATE_QUERY = STATE_QUERY;
3973
3995
  exports.SessionStore = SessionStore_default;
3974
3996
  exports.TOKEN_REQUEST_CONFIG_KEY = TOKEN_REQUEST_CONFIG_KEY;
3975
3997
  exports.ThunderIDBrowserClient = ThunderIDBrowserClient_default;
3998
+ exports.buildAvatarSpec = buildAvatarSpec_default;
3976
3999
  exports.createClassObserver = createClassObserver;
3977
4000
  exports.createMediaQueryListener = createMediaQueryListener;
3978
4001
  exports.createSessionManagementHelper = SessionManagementHelper_default;