@inlaylab/opaline-angular 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Inlaylab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # Temporary Holding Version
1
+ # @inlaylab/opaline-angular
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Seeded avatars for Angular: a standalone, zoneless, SSR-safe component with signal inputs.
4
+
5
+ ```sh
6
+ npm i @inlaylab/opaline-angular
7
+ ```
8
+
9
+ ```ts
10
+ import { Component } from '@angular/core'
11
+ import { OpalineAvatar } from '@inlaylab/opaline-angular'
12
+ import { clay } from '@inlaylab/opaline/clay'
13
+
14
+ @Component({
15
+ selector: 'app-user-avatar',
16
+ imports: [OpalineAvatar],
17
+ template: `<op-avatar [seed]="email" [look]="clay" [src]="photo" alt="Ada" />`,
18
+ })
19
+ export class UserAvatar {
20
+ protected readonly clay = clay
21
+ email = 'ada@inlay.dev'
22
+ photo?: string
23
+ }
24
+ ```
25
+
26
+ Inputs: `seed`, `look`, `size`, `src`, `alt`, `palette`, `finish`, `expression`, `mood`, `face`, `family`, `backdrop`, `shape`, `body` and `ears`. Works with Angular 22 and inside Ivorie's `<iv-avatar-fallback>`.
27
+
28
+ Same seed, same avatar: from 1.0, the same seed and options give a byte-identical SVG in every 1.x release.
29
+
30
+ [Playground and docs](https://inlaylab.github.io/Opaline/) · [GitHub](https://github.com/Inlaylab/Opaline) · MIT for code and art.
@@ -0,0 +1,427 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Injectable, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
3
+ import { DomSanitizer } from "@angular/platform-browser";
4
+ import { createAvatar } from "@inlaylab/opaline";
5
+ var OpalineIds = class OpalineIds {
6
+ count = 0;
7
+ next() {
8
+ return `n${++this.count}`;
9
+ }
10
+ static ɵfac = i0.ɵɵngDeclareFactory({
11
+ minVersion: "12.0.0",
12
+ version: "22.2.4",
13
+ ngImport: i0,
14
+ type: OpalineIds,
15
+ deps: [],
16
+ target: i0.ɵɵFactoryTarget.Injectable
17
+ });
18
+ static ɵprov = i0.ɵɵngDeclareInjectable({
19
+ minVersion: "12.0.0",
20
+ version: "22.2.4",
21
+ ngImport: i0,
22
+ type: OpalineIds,
23
+ providedIn: "root"
24
+ });
25
+ };
26
+ i0.ɵɵngDeclareClassMetadata({
27
+ minVersion: "12.0.0",
28
+ version: "22.2.4",
29
+ ngImport: i0,
30
+ type: OpalineIds,
31
+ decorators: [{
32
+ type: Injectable,
33
+ args: [{ providedIn: "root" }]
34
+ }]
35
+ });
36
+ var OpalineAvatar = class OpalineAvatar {
37
+ sanitizer = inject(DomSanitizer);
38
+ instance = inject(OpalineIds).next();
39
+ img = viewChild("img", ...ngDevMode ? [{ debugName: "img" }] : /* istanbul ignore next */ []);
40
+ seed = input(...ngDevMode ? [void 0, { debugName: "seed" }] : /* istanbul ignore next */ []);
41
+ look = input.required(...ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []);
42
+ size = input(64, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
43
+ src = input(...ngDevMode ? [void 0, { debugName: "src" }] : /* istanbul ignore next */ []);
44
+ alt = input(...ngDevMode ? [void 0, { debugName: "alt" }] : /* istanbul ignore next */ []);
45
+ palette = input(...ngDevMode ? [void 0, { debugName: "palette" }] : /* istanbul ignore next */ []);
46
+ family = input(...ngDevMode ? [void 0, { debugName: "family" }] : /* istanbul ignore next */ []);
47
+ face = input(...ngDevMode ? [void 0, { debugName: "face" }] : /* istanbul ignore next */ []);
48
+ mood = input(...ngDevMode ? [void 0, { debugName: "mood" }] : /* istanbul ignore next */ []);
49
+ expression = input(...ngDevMode ? [void 0, { debugName: "expression" }] : /* istanbul ignore next */ []);
50
+ backdrop = input(...ngDevMode ? [void 0, { debugName: "backdrop" }] : /* istanbul ignore next */ []);
51
+ shape = input(...ngDevMode ? [void 0, { debugName: "shape" }] : /* istanbul ignore next */ []);
52
+ finish = input(...ngDevMode ? [void 0, { debugName: "finish" }] : /* istanbul ignore next */ []);
53
+ body = input(...ngDevMode ? [void 0, { debugName: "body" }] : /* istanbul ignore next */ []);
54
+ ears = input(...ngDevMode ? [void 0, { debugName: "ears" }] : /* istanbul ignore next */ []);
55
+ state = signal("loading", ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
56
+ svg = computed(() => {
57
+ const svg = createAvatar(this.look(), {
58
+ seed: this.seed(),
59
+ size: this.size(),
60
+ instance: this.instance,
61
+ palette: this.palette(),
62
+ family: this.family(),
63
+ face: this.face(),
64
+ mood: this.mood(),
65
+ expression: this.expression(),
66
+ backdrop: this.backdrop(),
67
+ shape: this.shape(),
68
+ finish: this.finish(),
69
+ body: this.body(),
70
+ ears: this.ears()
71
+ }).svg;
72
+ return this.sanitizer.bypassSecurityTrustHtml(svg);
73
+ }, ...ngDevMode ? [{ debugName: "svg" }] : /* istanbul ignore next */ []);
74
+ constructor() {
75
+ effect(() => {
76
+ this.src();
77
+ untracked(() => this.state.set("loading"));
78
+ });
79
+ afterNextRender(() => {
80
+ const img = this.img()?.nativeElement;
81
+ if (img?.complete) this.state.set(img.naturalWidth > 0 ? "loaded" : "error");
82
+ });
83
+ }
84
+ static ɵfac = i0.ɵɵngDeclareFactory({
85
+ minVersion: "12.0.0",
86
+ version: "22.2.4",
87
+ ngImport: i0,
88
+ type: OpalineAvatar,
89
+ deps: [],
90
+ target: i0.ɵɵFactoryTarget.Component
91
+ });
92
+ static ɵcmp = i0.ɵɵngDeclareComponent({
93
+ minVersion: "17.0.0",
94
+ version: "22.2.4",
95
+ type: OpalineAvatar,
96
+ isStandalone: true,
97
+ selector: "op-avatar",
98
+ inputs: {
99
+ seed: {
100
+ classPropertyName: "seed",
101
+ publicName: "seed",
102
+ isSignal: true,
103
+ isRequired: false,
104
+ transformFunction: null
105
+ },
106
+ look: {
107
+ classPropertyName: "look",
108
+ publicName: "look",
109
+ isSignal: true,
110
+ isRequired: true,
111
+ transformFunction: null
112
+ },
113
+ size: {
114
+ classPropertyName: "size",
115
+ publicName: "size",
116
+ isSignal: true,
117
+ isRequired: false,
118
+ transformFunction: null
119
+ },
120
+ src: {
121
+ classPropertyName: "src",
122
+ publicName: "src",
123
+ isSignal: true,
124
+ isRequired: false,
125
+ transformFunction: null
126
+ },
127
+ alt: {
128
+ classPropertyName: "alt",
129
+ publicName: "alt",
130
+ isSignal: true,
131
+ isRequired: false,
132
+ transformFunction: null
133
+ },
134
+ palette: {
135
+ classPropertyName: "palette",
136
+ publicName: "palette",
137
+ isSignal: true,
138
+ isRequired: false,
139
+ transformFunction: null
140
+ },
141
+ family: {
142
+ classPropertyName: "family",
143
+ publicName: "family",
144
+ isSignal: true,
145
+ isRequired: false,
146
+ transformFunction: null
147
+ },
148
+ face: {
149
+ classPropertyName: "face",
150
+ publicName: "face",
151
+ isSignal: true,
152
+ isRequired: false,
153
+ transformFunction: null
154
+ },
155
+ mood: {
156
+ classPropertyName: "mood",
157
+ publicName: "mood",
158
+ isSignal: true,
159
+ isRequired: false,
160
+ transformFunction: null
161
+ },
162
+ expression: {
163
+ classPropertyName: "expression",
164
+ publicName: "expression",
165
+ isSignal: true,
166
+ isRequired: false,
167
+ transformFunction: null
168
+ },
169
+ backdrop: {
170
+ classPropertyName: "backdrop",
171
+ publicName: "backdrop",
172
+ isSignal: true,
173
+ isRequired: false,
174
+ transformFunction: null
175
+ },
176
+ shape: {
177
+ classPropertyName: "shape",
178
+ publicName: "shape",
179
+ isSignal: true,
180
+ isRequired: false,
181
+ transformFunction: null
182
+ },
183
+ finish: {
184
+ classPropertyName: "finish",
185
+ publicName: "finish",
186
+ isSignal: true,
187
+ isRequired: false,
188
+ transformFunction: null
189
+ },
190
+ body: {
191
+ classPropertyName: "body",
192
+ publicName: "body",
193
+ isSignal: true,
194
+ isRequired: false,
195
+ transformFunction: null
196
+ },
197
+ ears: {
198
+ classPropertyName: "ears",
199
+ publicName: "ears",
200
+ isSignal: true,
201
+ isRequired: false,
202
+ transformFunction: null
203
+ }
204
+ },
205
+ host: {
206
+ attributes: { "data-opaline": "" },
207
+ properties: {
208
+ "style.width.px": "size()",
209
+ "style.height.px": "size()",
210
+ "attr.role": "alt() ? \"img\" : null",
211
+ "attr.aria-label": "alt() || null",
212
+ "attr.aria-hidden": "alt() ? null : \"true\"",
213
+ "attr.seed": "null",
214
+ "attr.look": "null",
215
+ "attr.size": "null",
216
+ "attr.src": "null",
217
+ "attr.alt": "null",
218
+ "attr.palette": "null",
219
+ "attr.family": "null",
220
+ "attr.face": "null",
221
+ "attr.mood": "null",
222
+ "attr.expression": "null",
223
+ "attr.backdrop": "null",
224
+ "attr.shape": "null"
225
+ },
226
+ styleAttribute: "display:inline-block;position:relative"
227
+ },
228
+ viewQueries: [{
229
+ propertyName: "img",
230
+ first: true,
231
+ predicate: ["img"],
232
+ descendants: true,
233
+ isSignal: true
234
+ }],
235
+ ngImport: i0,
236
+ template: `<span style="display:contents" [innerHTML]="svg()"></span>
237
+ @if (src() && state() !== 'error') {
238
+ <img
239
+ #img
240
+ [src]="src()"
241
+ alt=""
242
+ style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"
243
+ [hidden]="state() !== 'loaded'"
244
+ (load)="state.set('loaded')"
245
+ (error)="state.set('error')"
246
+ />
247
+ }`,
248
+ isInline: true,
249
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
250
+ });
251
+ };
252
+ i0.ɵɵngDeclareClassMetadata({
253
+ minVersion: "12.0.0",
254
+ version: "22.2.4",
255
+ ngImport: i0,
256
+ type: OpalineAvatar,
257
+ decorators: [{
258
+ type: Component,
259
+ args: [{
260
+ selector: "op-avatar",
261
+ changeDetection: ChangeDetectionStrategy.OnPush,
262
+ host: {
263
+ "data-opaline": "",
264
+ style: "display:inline-block;position:relative",
265
+ "[style.width.px]": "size()",
266
+ "[style.height.px]": "size()",
267
+ "[attr.role]": "alt() ? \"img\" : null",
268
+ "[attr.aria-label]": "alt() || null",
269
+ "[attr.aria-hidden]": "alt() ? null : \"true\"",
270
+ "[attr.seed]": "null",
271
+ "[attr.look]": "null",
272
+ "[attr.size]": "null",
273
+ "[attr.src]": "null",
274
+ "[attr.alt]": "null",
275
+ "[attr.palette]": "null",
276
+ "[attr.family]": "null",
277
+ "[attr.face]": "null",
278
+ "[attr.mood]": "null",
279
+ "[attr.expression]": "null",
280
+ "[attr.backdrop]": "null",
281
+ "[attr.shape]": "null"
282
+ },
283
+ template: `<span style="display:contents" [innerHTML]="svg()"></span>
284
+ @if (src() && state() !== 'error') {
285
+ <img
286
+ #img
287
+ [src]="src()"
288
+ alt=""
289
+ style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit"
290
+ [hidden]="state() !== 'loaded'"
291
+ (load)="state.set('loaded')"
292
+ (error)="state.set('error')"
293
+ />
294
+ }`
295
+ }]
296
+ }],
297
+ ctorParameters: () => [],
298
+ propDecorators: {
299
+ img: [{
300
+ type: i0.ViewChild,
301
+ args: ["img", { isSignal: true }]
302
+ }],
303
+ seed: [{
304
+ type: i0.Input,
305
+ args: [{
306
+ isSignal: true,
307
+ alias: "seed",
308
+ required: false
309
+ }]
310
+ }],
311
+ look: [{
312
+ type: i0.Input,
313
+ args: [{
314
+ isSignal: true,
315
+ alias: "look",
316
+ required: true
317
+ }]
318
+ }],
319
+ size: [{
320
+ type: i0.Input,
321
+ args: [{
322
+ isSignal: true,
323
+ alias: "size",
324
+ required: false
325
+ }]
326
+ }],
327
+ src: [{
328
+ type: i0.Input,
329
+ args: [{
330
+ isSignal: true,
331
+ alias: "src",
332
+ required: false
333
+ }]
334
+ }],
335
+ alt: [{
336
+ type: i0.Input,
337
+ args: [{
338
+ isSignal: true,
339
+ alias: "alt",
340
+ required: false
341
+ }]
342
+ }],
343
+ palette: [{
344
+ type: i0.Input,
345
+ args: [{
346
+ isSignal: true,
347
+ alias: "palette",
348
+ required: false
349
+ }]
350
+ }],
351
+ family: [{
352
+ type: i0.Input,
353
+ args: [{
354
+ isSignal: true,
355
+ alias: "family",
356
+ required: false
357
+ }]
358
+ }],
359
+ face: [{
360
+ type: i0.Input,
361
+ args: [{
362
+ isSignal: true,
363
+ alias: "face",
364
+ required: false
365
+ }]
366
+ }],
367
+ mood: [{
368
+ type: i0.Input,
369
+ args: [{
370
+ isSignal: true,
371
+ alias: "mood",
372
+ required: false
373
+ }]
374
+ }],
375
+ expression: [{
376
+ type: i0.Input,
377
+ args: [{
378
+ isSignal: true,
379
+ alias: "expression",
380
+ required: false
381
+ }]
382
+ }],
383
+ backdrop: [{
384
+ type: i0.Input,
385
+ args: [{
386
+ isSignal: true,
387
+ alias: "backdrop",
388
+ required: false
389
+ }]
390
+ }],
391
+ shape: [{
392
+ type: i0.Input,
393
+ args: [{
394
+ isSignal: true,
395
+ alias: "shape",
396
+ required: false
397
+ }]
398
+ }],
399
+ finish: [{
400
+ type: i0.Input,
401
+ args: [{
402
+ isSignal: true,
403
+ alias: "finish",
404
+ required: false
405
+ }]
406
+ }],
407
+ body: [{
408
+ type: i0.Input,
409
+ args: [{
410
+ isSignal: true,
411
+ alias: "body",
412
+ required: false
413
+ }]
414
+ }],
415
+ ears: [{
416
+ type: i0.Input,
417
+ args: [{
418
+ isSignal: true,
419
+ alias: "ears",
420
+ required: false
421
+ }]
422
+ }]
423
+ }
424
+ });
425
+ export { OpalineAvatar, OpalineIds };
426
+
427
+ //# sourceMappingURL=inlaylab-opaline-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlaylab-opaline-angular.mjs","names":[],"sources":["../../src/ids.ts","../../src/avatar.ts"],"sourcesContent":["import { Injectable } from '@angular/core'\n\n/** Per-app counter. Server and client render in the same order, so IDs match on hydration. */\n@Injectable({ providedIn: 'root' })\nexport class OpalineIds {\n private count = 0\n\n next(): string {\n return `n${++this.count}`\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core'\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser'\nimport {\n createAvatar,\n type AuraOptions,\n type BlobOptions,\n type ClayOptions,\n type Finish,\n type Expression,\n type Family,\n type Mood,\n type PaletteName,\n type Style,\n} from '@inlaylab/opaline'\nimport { OpalineIds } from './ids'\n\ntype ImageState = 'loading' | 'loaded' | 'error'\n\n/** `<op-avatar seed=\"ada@inlay.dev\" [look]=\"morph\" />`: a seeded avatar with an optional photo. */\n@Component({\n selector: 'op-avatar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'data-opaline': '',\n style: 'display:inline-block;position:relative',\n '[style.width.px]': 'size()',\n '[style.height.px]': 'size()',\n '[attr.role]': 'alt() ? \"img\" : null',\n '[attr.aria-label]': 'alt() || null',\n '[attr.aria-hidden]': 'alt() ? null : \"true\"',\n // Static template attributes (`seed=\"ada@inlay.dev\"`) stay on the host; the seed is often an\n // email. Clear them so the root carries only the markup contract, on the server too.\n '[attr.seed]': 'null',\n '[attr.look]': 'null',\n '[attr.size]': 'null',\n '[attr.src]': 'null',\n '[attr.alt]': 'null',\n '[attr.palette]': 'null',\n '[attr.family]': 'null',\n '[attr.face]': 'null',\n '[attr.mood]': 'null',\n '[attr.expression]': 'null',\n '[attr.backdrop]': 'null',\n '[attr.shape]': 'null',\n },\n template: `<span style=\"display:contents\" [innerHTML]=\"svg()\"></span>\n @if (src() && state() !== 'error') {\n <img\n #img\n [src]=\"src()\"\n alt=\"\"\n style=\"position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit\"\n [hidden]=\"state() !== 'loaded'\"\n (load)=\"state.set('loaded')\"\n (error)=\"state.set('error')\"\n />\n }`,\n})\nexport class OpalineAvatar {\n private readonly sanitizer = inject(DomSanitizer)\n // Unique per instance, so the same avatar twice on a page never shares gradient IDs.\n private readonly instance = inject(OpalineIds).next()\n private readonly img = viewChild<ElementRef<HTMLImageElement>>('img')\n\n readonly seed = input<string | number | null | undefined>()\n readonly look = input.required<Style<any>>()\n readonly size = input(64)\n readonly src = input<string>()\n readonly alt = input<string>()\n readonly palette = input<PaletteName>()\n readonly family = input<Family>()\n readonly face = input<boolean>()\n readonly mood = input<Mood>()\n readonly expression = input<Expression>()\n readonly backdrop = input<BlobOptions['backdrop']>()\n readonly shape = input<AuraOptions['shape']>()\n readonly finish = input<Finish>()\n readonly body = input<ClayOptions['body']>()\n readonly ears = input<ClayOptions['ears']>()\n\n protected readonly state = signal<ImageState>('loading')\n\n protected readonly svg = computed<SafeHtml>(() => {\n const svg = createAvatar(this.look(), {\n seed: this.seed(),\n size: this.size(),\n instance: this.instance,\n palette: this.palette(),\n family: this.family(),\n face: this.face(),\n mood: this.mood(),\n expression: this.expression(),\n backdrop: this.backdrop(),\n shape: this.shape(),\n finish: this.finish(),\n body: this.body(),\n ears: this.ears(),\n }).svg\n // Safe: the core escapes every input that reaches the SVG, and the default sanitizer strips SVG.\n return this.sanitizer.bypassSecurityTrustHtml(svg)\n })\n\n constructor() {\n // A new src is a new image: hide it until it loads.\n effect(() => {\n this.src()\n untracked(() => this.state.set('loading'))\n })\n // With SSR the image can finish before hydration, so its load event is missed. Read it once.\n afterNextRender(() => {\n const img = this.img()?.nativeElement\n if (img?.complete) this.state.set(img.naturalWidth > 0 ? 'loaded' : 'error')\n })\n }\n}\n"],"mappings":";;;;AAIA,IAAa,aAAb,MAAa,WAAU;CACb,QAAQ;CAEhB,OAAI;EACF,OAAO,IAAI,EAAE,KAAK;CACpB;CALW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,YADG;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EADtB,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;ACmElC,IAAa,gBAAb,MAAa,cAAa;CACP,YAAY,OAAO,YAAY;CAE/B,WAAW,OAAO,UAAU,CAAC,CAAC,KAAI;CAClC,MAAM,UAAwC,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAE5D,OAAO,MAA2C,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAClD,OAAO,MAAM,SAAsB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;C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AA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@inlaylab/opaline-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Seeded avatars for Angular: a standalone, zoneless, SSR-safe component.",
5
+ "keywords": [
6
+ "avatar",
7
+ "avatars",
8
+ "svg",
9
+ "seed",
10
+ "deterministic",
11
+ "identicon",
12
+ "profile-picture",
13
+ "placeholder",
14
+ "angular",
15
+ "angular-component",
16
+ "ssr",
17
+ "zoneless"
18
+ ],
19
+ "homepage": "https://inlaylab.github.io/Opaline/",
20
+ "bugs": {
21
+ "url": "https://github.com/Inlaylab/Opaline/issues"
22
+ },
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/Inlaylab/Opaline.git",
27
+ "directory": "packages/angular"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "directory": "dist"
32
+ },
33
+ "sideEffects": false,
34
+ "peerDependencies": {
35
+ "@angular/core": ">=22.0.0 <23.0.0",
36
+ "@angular/platform-browser": ">=22.0.0 <23.0.0"
37
+ },
38
+ "dependencies": {
39
+ "@inlaylab/opaline": "1.0.0",
40
+ "tslib": "^2.3.0"
41
+ },
42
+ "module": "fesm2022/inlaylab-opaline-angular.mjs",
43
+ "typings": "types/inlaylab-opaline-angular.d.ts",
44
+ "exports": {
45
+ "./package.json": {
46
+ "default": "./package.json"
47
+ },
48
+ ".": {
49
+ "types": "./types/inlaylab-opaline-angular.d.ts",
50
+ "default": "./fesm2022/inlaylab-opaline-angular.mjs"
51
+ }
52
+ },
53
+ "type": "module"
6
54
  }
@@ -0,0 +1,115 @@
1
+ import { SafeHtml } from "@angular/platform-browser";
2
+ import { Expression, Family, Finish, Mood, PaletteName, Style } from "@inlaylab/opaline";
3
+ import * as i0 from "@angular/core";
4
+ type ImageState = 'loading' | 'loaded' | 'error';
5
+ /** `<op-avatar seed="ada@inlay.dev" [look]="morph" />`: a seeded avatar with an optional photo. */
6
+ export declare class OpalineAvatar {
7
+ private readonly sanitizer;
8
+ private readonly instance;
9
+ private readonly img;
10
+ readonly seed: import("@angular/core").InputSignal<string | number | null | undefined>;
11
+ readonly look: import("@angular/core").InputSignal<Style<any>>;
12
+ readonly size: import("@angular/core").InputSignal<number>;
13
+ readonly src: import("@angular/core").InputSignal<string | undefined>;
14
+ readonly alt: import("@angular/core").InputSignal<string | undefined>;
15
+ readonly palette: import("@angular/core").InputSignal<PaletteName | undefined>;
16
+ readonly family: import("@angular/core").InputSignal<Family | undefined>;
17
+ readonly face: import("@angular/core").InputSignal<boolean | undefined>;
18
+ readonly mood: import("@angular/core").InputSignal<Mood | undefined>;
19
+ readonly expression: import("@angular/core").InputSignal<Expression | undefined>;
20
+ readonly backdrop: import("@angular/core").InputSignal<"none" | "tint" | undefined>;
21
+ readonly shape: import("@angular/core").InputSignal<"circle" | "squircle" | undefined>;
22
+ readonly finish: import("@angular/core").InputSignal<Finish | undefined>;
23
+ readonly body: import("@angular/core").InputSignal<"jelly" | "hood" | undefined>;
24
+ readonly ears: import("@angular/core").InputSignal<"cat" | "bear" | "bunny" | undefined>;
25
+ protected readonly state: import("@angular/core").WritableSignal<ImageState>;
26
+ protected readonly svg: import("@angular/core").Signal<SafeHtml>;
27
+ constructor();
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<OpalineAvatar, never>;
29
+ static ɵcmp: i0.ɵɵComponentDeclaration<OpalineAvatar, "op-avatar", never, {
30
+ "seed": {
31
+ "alias": "seed";
32
+ "required": false;
33
+ "isSignal": true;
34
+ };
35
+ "look": {
36
+ "alias": "look";
37
+ "required": true;
38
+ "isSignal": true;
39
+ };
40
+ "size": {
41
+ "alias": "size";
42
+ "required": false;
43
+ "isSignal": true;
44
+ };
45
+ "src": {
46
+ "alias": "src";
47
+ "required": false;
48
+ "isSignal": true;
49
+ };
50
+ "alt": {
51
+ "alias": "alt";
52
+ "required": false;
53
+ "isSignal": true;
54
+ };
55
+ "palette": {
56
+ "alias": "palette";
57
+ "required": false;
58
+ "isSignal": true;
59
+ };
60
+ "family": {
61
+ "alias": "family";
62
+ "required": false;
63
+ "isSignal": true;
64
+ };
65
+ "face": {
66
+ "alias": "face";
67
+ "required": false;
68
+ "isSignal": true;
69
+ };
70
+ "mood": {
71
+ "alias": "mood";
72
+ "required": false;
73
+ "isSignal": true;
74
+ };
75
+ "expression": {
76
+ "alias": "expression";
77
+ "required": false;
78
+ "isSignal": true;
79
+ };
80
+ "backdrop": {
81
+ "alias": "backdrop";
82
+ "required": false;
83
+ "isSignal": true;
84
+ };
85
+ "shape": {
86
+ "alias": "shape";
87
+ "required": false;
88
+ "isSignal": true;
89
+ };
90
+ "finish": {
91
+ "alias": "finish";
92
+ "required": false;
93
+ "isSignal": true;
94
+ };
95
+ "body": {
96
+ "alias": "body";
97
+ "required": false;
98
+ "isSignal": true;
99
+ };
100
+ "ears": {
101
+ "alias": "ears";
102
+ "required": false;
103
+ "isSignal": true;
104
+ };
105
+ }, {}, never, never, true, never>;
106
+ }
107
+ /** Per-app counter. Server and client render in the same order, so IDs match on hydration. */
108
+ export declare class OpalineIds {
109
+ private count;
110
+ next(): string;
111
+ static ɵfac: i0.ɵɵFactoryDeclaration<OpalineIds, never>;
112
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
113
+ }
114
+ export {};
115
+ //# sourceMappingURL=inlaylab-opaline-angular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlaylab-opaline-angular.d.ts","names":[],"sources":["../../src/avatar.ts","../../src/ids.ts"],"mappings":";;;KA4BK;;qBA0CQ;mBACM;mBAEA;mBACA;WAER,8BAAI;WACJ,8BAAI,YAAA;WACJ,8BAAI;WACJ,6BAAG;WACH,6BAAG;WACH,iCAAO,YAAA;WACP,gCAAM,YAAA;WACN,8BAAI;WACJ,8BAAI,YAAA;WACJ,oCAAU,YAAA;WACV,kCAAQ;WACR,+BAAK;WACL,gCAAM,YAAA;WACN,8BAAI;WACJ,8BAAI;qBAEM,+BAAK,eAAA;qBAEL,6BAAG,OAAA;;SAxBX,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAa;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;;;qBClEb;UACH;EAER;SAHW,MAAA,GAAA,qBAAA"}