@thunderid/browser 0.6.1 → 0.8.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/dist/cjs/index.cjs +705 -199
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +695 -200
- package/dist/index.js.map +1 -1
- package/dist/utils/SPACryptoUtils.d.ts.map +1 -1
- package/dist/utils/anonymousAnimalIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousAnimalIcons.generated.d.ts.map +1 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts +26 -0
- package/dist/utils/anonymousEntityIcons.generated.d.ts.map +1 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts +61 -0
- package/dist/utils/extractAvatarParamsFromUri.d.ts.map +1 -0
- package/dist/utils/generateAvatarDataUri.d.ts +65 -0
- package/dist/utils/generateAvatarDataUri.d.ts.map +1 -0
- package/dist/utils/hashStr.d.ts +30 -0
- package/dist/utils/hashStr.d.ts.map +1 -0
- package/dist/utils/isAvatarUri.d.ts +34 -0
- package/dist/utils/isAvatarUri.d.ts.map +1 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts +36 -0
- package/dist/utils/pickAnonymousAvatarName.d.ts.map +1 -0
- package/dist/utils/pickAnonymousEntityName.d.ts +37 -0
- package/dist/utils/pickAnonymousEntityName.d.ts.map +1 -0
- package/dist/utils/resolveLogoUri.d.ts +55 -0
- package/dist/utils/resolveLogoUri.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SPACryptoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/SPACryptoUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAyB,MAAM,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"SPACryptoUtils.d.ts","sourceRoot":"","sources":["../../src/utils/SPACryptoUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAyB,MAAM,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAQnF;;GAEG;AACH,cAAM,cAAe,YAAW,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACrD;;;;;OAKG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAItD;;;;;OAKG;IACI,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAIhD;;;;;OAKG;IACI,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAU3D;;;;;;;;;;;;OAYG;IACI,SAAS,CACd,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,EAC1B,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,MAAM,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,OAAO,CAAC;CAgCpB;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export interface AnonymousAnimalIcon {
|
|
19
|
+
/** The animal's curated default background color (hex). */
|
|
20
|
+
color: string;
|
|
21
|
+
/** Inner SVG markup (no outer <svg>/<rect>). Any "%COLOR%" token is the animal's
|
|
22
|
+
* color, substitutable at render time so a custom "bg" recolors accents too. */
|
|
23
|
+
markup: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const ANONYMOUS_ANIMAL_ICONS: Record<string, AnonymousAnimalIcon>;
|
|
26
|
+
//# sourceMappingURL=anonymousAnimalIcons.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anonymousAnimalIcons.generated.d.ts","sourceRoot":"","sources":["../../src/utils/anonymousAnimalIcons.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd;qFACiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAgGtE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export interface AnonymousEntityIcon {
|
|
19
|
+
/** The entity icon's curated default background color (hex). */
|
|
20
|
+
color: string;
|
|
21
|
+
/** Inner SVG markup (no outer <svg>/<rect>). Any "%COLOR%" token is the icon's
|
|
22
|
+
* color, substitutable at render time so a custom "bg" recolors accents too. */
|
|
23
|
+
markup: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const ANONYMOUS_ENTITY_ICONS: Record<string, AnonymousEntityIcon>;
|
|
26
|
+
//# sourceMappingURL=anonymousEntityIcons.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anonymousEntityIcons.generated.d.ts","sourceRoot":"","sources":["../../src/utils/anonymousEntityIcons.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd;qFACiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CA+ItE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export type AvatarShape = 'circle' | 'rounded';
|
|
19
|
+
export type AvatarVariant = 'anonymous_animal' | 'anonymous_entity' | 'blank' | 'one_letter' | 'two_letter';
|
|
20
|
+
export interface AvatarParams {
|
|
21
|
+
/**
|
|
22
|
+
* Explicit flat background color override (e.g. `#FF5733`). When set, replaces the
|
|
23
|
+
* derived gradient (letter variants) or the curated icon color (`anonymous_animal`/
|
|
24
|
+
* `anonymous_entity`).
|
|
25
|
+
*/
|
|
26
|
+
bg?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Gradient rotation index for letter variants (ignored by `anonymous_animal`/`anonymous_entity`).
|
|
29
|
+
*/
|
|
30
|
+
colors: number;
|
|
31
|
+
/**
|
|
32
|
+
* The rendered payload: pre-computed initials (e.g. `"BM"`) for `one_letter`/`two_letter`,
|
|
33
|
+
* a lowercase animal key (e.g. `"jackalope"`) for `anonymous_animal`, a lowercase entity key
|
|
34
|
+
* (e.g. `"hexagon"`) for `anonymous_entity`, or unused (empty) for `blank`.
|
|
35
|
+
*/
|
|
36
|
+
content: string;
|
|
37
|
+
/**
|
|
38
|
+
* Background shape.
|
|
39
|
+
*/
|
|
40
|
+
shape: AvatarShape;
|
|
41
|
+
/**
|
|
42
|
+
* What's drawn on the background.
|
|
43
|
+
*/
|
|
44
|
+
variant: AvatarVariant;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parses the comma-separated `key=value` pairs of an `avatar:` URI, e.g.
|
|
48
|
+
* `"avatar:shape=circle,variant=two_letter,content=BM,colors=2,bg=#FF5733"`.
|
|
49
|
+
*
|
|
50
|
+
* @param uri - A URI string in the form `"avatar:shape=...,variant=...,content=...,colors=...,bg=..."`.
|
|
51
|
+
* @returns The parsed avatar parameters, falling back to defaults for any missing/invalid field.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* extractAvatarParamsFromUri("avatar:shape=circle,variant=anonymous_animal,content=jackalope");
|
|
56
|
+
* // { shape: "circle", variant: "anonymous_animal", content: "jackalope", colors: 0 }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const extractAvatarParamsFromUri: (uri: string) => AvatarParams;
|
|
60
|
+
export default extractAvatarParamsFromUri;
|
|
61
|
+
//# sourceMappingURL=extractAvatarParamsFromUri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractAvatarParamsFromUri.d.ts","sourceRoot":"","sources":["../../src/utils/extractAvatarParamsFromUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,CAAC;AAE5G,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB;AAID;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,0BAA0B,GAAI,KAAK,MAAM,KAAG,YAgCjD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import type { AvatarParams } from './extractAvatarParamsFromUri';
|
|
19
|
+
/**
|
|
20
|
+
* Number of distinct gradient rotations `colors` cycles through for the `blank`,
|
|
21
|
+
* `one_letter`, and `two_letter` variants. Callers that offer a "pick a background" UI
|
|
22
|
+
* (e.g. a shuffleable swatch grid) can sample `colors` indices in `[0, AVATAR_GRADIENT_COUNT)`
|
|
23
|
+
* without needing the actual palette values.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AVATAR_GRADIENT_COUNT: number;
|
|
26
|
+
/**
|
|
27
|
+
* Fills in `params.content` when the spec itself didn't carry one, deriving it from a raw
|
|
28
|
+
* seed name (e.g. an app or user display name) — extracting initials for letter variants,
|
|
29
|
+
* or hash-picking a curated animal key for `anonymous_animal`.
|
|
30
|
+
*
|
|
31
|
+
* Callers that already have a final `content` value (pre-computed initials, or an exact
|
|
32
|
+
* animal key) should skip this and pass it directly instead.
|
|
33
|
+
*
|
|
34
|
+
* @param variant - The avatar variant `content` is being derived for.
|
|
35
|
+
* @param seedText - A raw name/seed to derive `content` from.
|
|
36
|
+
* @returns A ready-to-render `content` value.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* deriveAvatarContent('two_letter', 'Jane Doe'); // "JD"
|
|
41
|
+
* deriveAvatarContent('anonymous_animal', 'session-abc123'); // "otter"
|
|
42
|
+
* deriveAvatarContent('anonymous_entity', 'app-abc123'); // "hexagon"
|
|
43
|
+
* deriveAvatarContent('blank', 'Jane Doe'); // ""
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const deriveAvatarContent: (variant: AvatarParams["variant"], seedText: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Generates an avatar image as an `svg+xml` data URI from a fully-resolved {@link AvatarParams}.
|
|
49
|
+
* `params.content` is assumed final; use {@link deriveAvatarContent} first if it might be
|
|
50
|
+
* empty or otherwise needs deriving from a raw seed name.
|
|
51
|
+
*
|
|
52
|
+
* @param params - Resolved avatar parameters (see {@link AvatarParams}).
|
|
53
|
+
* @returns A `data:image/svg+xml,...` URI rendering the generated avatar.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'two_letter', content: 'BM', colors: 2});
|
|
58
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_animal', content: 'jackalope'});
|
|
59
|
+
* generateAvatarDataUri({shape: 'rounded', variant: 'anonymous_entity', content: 'hexagon'});
|
|
60
|
+
* generateAvatarDataUri({shape: 'circle', variant: 'blank', content: '', colors: 5});
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const generateAvatarDataUri: (params: AvatarParams) => string;
|
|
64
|
+
export default generateAvatarDataUri;
|
|
65
|
+
//# sourceMappingURL=generateAvatarDataUri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateAvatarDataUri.d.ts","sourceRoot":"","sources":["../../src/utils/generateAvatarDataUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAmB/D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAA+B,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,YAAY,CAAC,SAAS,CAAC,EAAE,UAAU,MAAM,KAAG,MAaxF,CAAC;AA4EF;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,qBAAqB,GAAI,QAAQ,YAAY,KAAG,MAQrD,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* 32-bit unsigned polynomial hash (`h = h*31 + charCode`), used to deterministically derive
|
|
20
|
+
* avatar colors/icons from a seed string. Shared by every avatar util that needs the same
|
|
21
|
+
* hash so seeds map identically across them.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* hashStr('session-abc123');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare const hashStr: (str: string) => number;
|
|
29
|
+
export default hashStr;
|
|
30
|
+
//# sourceMappingURL=hashStr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashStr.d.ts","sourceRoot":"","sources":["../../src/utils/hashStr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;GASG;AACH,QAAA,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAM9B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AVATAR_URI_SCHEME = "avatar:";
|
|
19
|
+
/**
|
|
20
|
+
* Checks whether a given URI uses the `avatar:` scheme
|
|
21
|
+
* (e.g. `"avatar:style=rounded,text=Acme,colors=2"`).
|
|
22
|
+
*
|
|
23
|
+
* @param uri - The URI string to check.
|
|
24
|
+
* @returns `true` if the URI starts with `"avatar:"`, `false` otherwise.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* isAvatarUri("avatar:style=circle,text=Acme,colors=0"); // true
|
|
29
|
+
* isAvatarUri("emoji:🐯"); // false
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const isAvatarUri: (uri: string) => boolean;
|
|
33
|
+
export default isAvatarUri;
|
|
34
|
+
//# sourceMappingURL=isAvatarUri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isAvatarUri.d.ts","sourceRoot":"","sources":["../../src/utils/isAvatarUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,OAAuE,CAAC;AAE3G,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Deterministically picks one of the curated anonymous-avatar animal keys for a given seed
|
|
20
|
+
* (e.g. a session or device identifier), so the same seed always maps to the same avatar.
|
|
21
|
+
*
|
|
22
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_animal` spec —
|
|
23
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
24
|
+
*
|
|
25
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
26
|
+
* @returns An anonymous animal key (e.g. `"otter"`) usable as `avatar:` spec's `content` param.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* pickAnonymousAvatarName('session-abc123'); // "otter"
|
|
31
|
+
* `avatar:variant=anonymous_animal,content=${pickAnonymousAvatarName(sessionId)}`;
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
declare const pickAnonymousAvatarName: (seed?: string) => string;
|
|
35
|
+
export default pickAnonymousAvatarName;
|
|
36
|
+
//# sourceMappingURL=pickAnonymousAvatarName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickAnonymousAvatarName.d.ts","sourceRoot":"","sources":["../../src/utils/pickAnonymousAvatarName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAMhD,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Deterministically picks one of the curated anonymous-entity icon keys for a given seed
|
|
20
|
+
* (e.g. an application, organization, or resource server identifier), so the same seed
|
|
21
|
+
* always maps to the same icon.
|
|
22
|
+
*
|
|
23
|
+
* Use this to derive the `content` value for an `avatar:variant=anonymous_entity` spec —
|
|
24
|
+
* the spec parser itself does no hashing, it just looks up whatever key it's given.
|
|
25
|
+
*
|
|
26
|
+
* @param seed - Seed text the pick is derived from. Falls back to a random pick when omitted.
|
|
27
|
+
* @returns An anonymous entity key (e.g. `"hexagon"`) usable as `avatar:` spec's `content` param.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* pickAnonymousEntityName('app-abc123'); // "hexagon"
|
|
32
|
+
* `avatar:variant=anonymous_entity,content=${pickAnonymousEntityName(appId)}`;
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const pickAnonymousEntityName: (seed?: string) => string;
|
|
36
|
+
export default pickAnonymousEntityName;
|
|
37
|
+
//# sourceMappingURL=pickAnonymousEntityName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickAnonymousEntityName.d.ts","sourceRoot":"","sources":["../../src/utils/pickAnonymousEntityName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAMhD,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export type ResolvedLogoKind = 'avatar' | 'emoji' | 'url';
|
|
19
|
+
export interface ResolvedLogo {
|
|
20
|
+
/**
|
|
21
|
+
* Rendered image source (a data URI or plain URL). Absent when `kind` is `"emoji"`.
|
|
22
|
+
*/
|
|
23
|
+
imgSrc?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The emoji glyph to render. Only present when `kind` is `"emoji"`.
|
|
26
|
+
*/
|
|
27
|
+
glyph?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Which logo spec variant was resolved.
|
|
30
|
+
*/
|
|
31
|
+
kind: ResolvedLogoKind;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolves an application logo spec string — `emoji:<glyph>`, `avatar:shape=...,variant=...,
|
|
35
|
+
* content=...,colors=...,bg=...`, or a bare URL — into a renderable representation.
|
|
36
|
+
*
|
|
37
|
+
* A spec in none of the recognized schemes falls back to treating it as a plain URL so
|
|
38
|
+
* callers can always render *something* without special-casing.
|
|
39
|
+
*
|
|
40
|
+
* @param spec - The stored logo spec string.
|
|
41
|
+
* @param fallbackSeedText - Raw seed name (e.g. an app or user display name) used to derive
|
|
42
|
+
* an `avatar:` spec's `content` when the spec itself doesn't carry one (e.g. an app name
|
|
43
|
+
* to keep the avatar in sync as it changes).
|
|
44
|
+
* @returns The resolved logo, ready to render.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* resolveLogoUri("emoji:🛡️"); // { kind: "emoji", glyph: "🛡️" }
|
|
49
|
+
* resolveLogoUri("avatar:shape=circle,variant=two_letter,content=BM"); // { kind: "avatar", imgSrc: "data:image/svg+xml,..." }
|
|
50
|
+
* resolveLogoUri("https://example.com/logo.png"); // { kind: "url", imgSrc: "https://example.com/logo.png" }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare const resolveLogoUri: (spec: string, fallbackSeedText?: string) => ResolvedLogo;
|
|
54
|
+
export default resolveLogoUri;
|
|
55
|
+
//# sourceMappingURL=resolveLogoUri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveLogoUri.d.ts","sourceRoot":"","sources":["../../src/utils/resolveLogoUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1D,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,yBAAqB,KAAG,YAY7D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Browser runtime SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"buffer": "6.0.3",
|
|
51
51
|
"core-js": "3.42.0",
|
|
52
52
|
"fast-sha256": "1.3.0",
|
|
53
|
-
"jose": "
|
|
53
|
+
"jose": "6.2.3",
|
|
54
54
|
"process": "0.11.10",
|
|
55
55
|
"randombytes": "2.1.0",
|
|
56
56
|
"stream-browserify": "3.0.0",
|
|
57
57
|
"tslib": "2.8.1",
|
|
58
|
-
"@thunderid/javascript": "^0.
|
|
58
|
+
"@thunderid/javascript": "^0.8.0"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|