@tamagui/avatar 2.7.7 → 3.0.0-beta.1093.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.
@@ -7,40 +7,33 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
14
  };
15
15
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
23
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
25
+ value: mod,
26
+ enumerable: true
32
27
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
29
  var Avatar_exports = {};
37
30
  __export(Avatar_exports, {
38
- Avatar: () => Avatar,
39
- AvatarFallback: () => AvatarFallback,
40
- AvatarFallbackFrame: () => AvatarFallbackFrame,
41
- AvatarFrame: () => AvatarFrame,
42
- AvatarImage: () => AvatarImage,
43
- createAvatarScope: () => createAvatarScope
31
+ Avatar: () => Avatar,
32
+ AvatarFallback: () => AvatarFallback,
33
+ AvatarFallbackFrame: () => AvatarFallbackFrame,
34
+ AvatarFrame: () => AvatarFrame,
35
+ AvatarImage: () => AvatarImage,
36
+ createAvatarScope: () => createAvatarScope
44
37
  });
45
38
  module.exports = __toCommonJS(Avatar_exports);
46
39
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -51,134 +44,105 @@ var import_image = require("@tamagui/image");
51
44
  var import_shapes = require("@tamagui/shapes");
52
45
  var import_stacks = require("@tamagui/stacks");
53
46
  var React = __toESM(require("react"), 1);
54
- function _type_of(obj) {
55
- "@swc/helpers - typeof";
56
-
57
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
58
- }
59
47
  var AVATAR_NAME = "Avatar";
60
48
  var [createAvatarContext, createAvatarScope] = (0, import_create_context.createContextScope)(AVATAR_NAME);
61
49
  var [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);
62
50
  var IMAGE_NAME = "AvatarImage";
63
- var AvatarImage = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
64
- var {
65
- __scopeAvatar,
66
- src,
67
- source,
68
- onLoadingStatusChange = function () {},
69
- ...imageProps
70
- } = props;
71
- var context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
72
- var [status, setStatus] = React.useState("idle");
73
- var resolvedSrc = src || (source && (typeof source === "undefined" ? "undefined" : _type_of(source)) === "object" && "uri" in source ? source.uri : source);
74
- React.useEffect(function () {
75
- if (!resolvedSrc) {
76
- setStatus("error");
77
- } else {
78
- setStatus("idle");
79
- }
80
- }, [resolvedSrc]);
81
- React.useEffect(function () {
82
- onLoadingStatusChange(status);
83
- context.onImageLoadingStatusChange(status);
84
- }, [status]);
85
- if (!resolvedSrc) {
86
- return null;
87
- }
88
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.YStack, {
89
- fullscreen: true,
90
- zIndex: 1,
91
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_image.Image, {
92
- position: "absolute",
93
- top: 0,
94
- left: 0,
95
- right: 0,
96
- bottom: 0,
97
- objectFit: "cover",
98
- // fill the frame. previously the image was sized to
99
- // getShapeSize(context.size) — but that resolves a numeric `size`
100
- // (e.g. <Avatar size={16} />) as a size-TOKEN index (tokens.size[16]),
101
- // so it got the token-scale value (~224px) instead of 16px, blowing
102
- // the image far past its frame; object-fit:cover then showed a
103
- // blurry mis-cropped corner. the frame already owns the size, so the
104
- // image just fills it — correct for numeric and token sizes alike.
105
- width: "100%",
106
- height: "100%",
107
- ...imageProps,
108
- // @ts-ignore
109
- ref: forwardedRef,
110
- // @ts-ignore
111
- src: resolvedSrc,
112
- // onLoadStart={() => {
113
- // // setStatus('loading')
114
- // }}
115
- onError: function () {
116
- setStatus("error");
117
- },
118
- onLoad: function () {
119
- setStatus("loaded");
120
- }
121
- })
122
- });
51
+ var AvatarImage = (0, import_core.createRefComponent)(function(props, forwardedRef) {
52
+ var { __scopeAvatar, src, source, onLoadingStatusChange = function() {}, ...imageProps } = props;
53
+ var context = useAvatarContext(IMAGE_NAME, __scopeAvatar);
54
+ var [status, setStatus] = React.useState("idle");
55
+ var resolvedSrc = src || (source && typeof source === "object" && "uri" in source ? source.uri : source);
56
+ React.useEffect(function() {
57
+ if (!resolvedSrc) {
58
+ setStatus("error");
59
+ } else {
60
+ setStatus("idle");
61
+ }
62
+ }, [resolvedSrc]);
63
+ React.useEffect(function() {
64
+ onLoadingStatusChange(status);
65
+ context.onImageLoadingStatusChange(status);
66
+ }, [status]);
67
+ if (!resolvedSrc) {
68
+ return null;
69
+ }
70
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
71
+ position: "absolute",
72
+ inset: 0,
73
+ zIndex: 1,
74
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.Image, {
75
+ position: "absolute",
76
+ top: 0,
77
+ left: 0,
78
+ right: 0,
79
+ bottom: 0,
80
+ objectFit: "cover",
81
+ width: "100%",
82
+ height: "100%",
83
+ ...imageProps,
84
+ ref: forwardedRef,
85
+ src: resolvedSrc,
86
+ onError: function() {
87
+ setStatus("error");
88
+ },
89
+ onLoad: function() {
90
+ setStatus("loaded");
91
+ }
92
+ })
93
+ });
123
94
  });
124
95
  AvatarImage.displayName = IMAGE_NAME;
125
96
  var FALLBACK_NAME = "AvatarFallback";
126
97
  var AvatarFallbackFrame = (0, import_core.styled)(import_stacks.YStack, {
127
- name: FALLBACK_NAME,
128
- position: "absolute",
129
- fullscreen: true,
130
- zIndex: 0
98
+ displayName: FALLBACK_NAME,
99
+ position: "absolute",
100
+ inset: 0,
101
+ zIndex: 0
131
102
  });
132
- var AvatarFallback = AvatarFallbackFrame.styleable(function (props, forwardedRef) {
133
- var {
134
- __scopeAvatar,
135
- delayMs,
136
- ...fallbackProps
137
- } = props;
138
- var context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
139
- var [canRender, setCanRender] = React.useState(delayMs === void 0);
140
- React.useEffect(function () {
141
- if (delayMs !== void 0) {
142
- var timerId = setTimeout(function () {
143
- return setCanRender(true);
144
- }, delayMs);
145
- return function () {
146
- return clearTimeout(timerId);
147
- };
148
- }
149
- }, [delayMs]);
150
- return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(AvatarFallbackFrame, {
151
- ...fallbackProps,
152
- ref: forwardedRef
153
- }) : null;
103
+ var AvatarFallback = (0, import_core.createStyledHOC)(AvatarFallbackFrame, function(props, forwardedRef) {
104
+ var { __scopeAvatar, delay, ...fallbackProps } = props;
105
+ var context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);
106
+ var [canRender, setCanRender] = React.useState(delay === void 0);
107
+ React.useEffect(function() {
108
+ if (delay !== void 0) {
109
+ var timerId = setTimeout(function() {
110
+ return setCanRender(true);
111
+ }, delay);
112
+ return function() {
113
+ return clearTimeout(timerId);
114
+ };
115
+ }
116
+ }, [delay]);
117
+ return canRender && context.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallbackFrame, {
118
+ ...fallbackProps,
119
+ ref: forwardedRef
120
+ }) : null;
154
121
  });
155
122
  AvatarFallback.displayName = FALLBACK_NAME;
156
123
  var AvatarFrame = (0, import_core.styled)(import_shapes.Square, {
157
- name: AVATAR_NAME,
158
- position: "relative",
159
- overflow: "hidden"
124
+ displayName: AVATAR_NAME,
125
+ position: "relative",
126
+ overflow: "hidden"
160
127
  });
161
- var Avatar = (0, import_helpers.withStaticProperties)(/* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
162
- var {
163
- __scopeAvatar,
164
- size = "$true",
165
- ...avatarProps
166
- } = props;
167
- var [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
168
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(AvatarProvider, {
169
- size,
170
- scope: __scopeAvatar,
171
- imageLoadingStatus,
172
- onImageLoadingStatusChange: setImageLoadingStatus,
173
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AvatarFrame, {
174
- size,
175
- ...avatarProps,
176
- ref: forwardedRef
177
- })
178
- });
128
+ var Avatar = (0, import_helpers.withStaticProperties)((0, import_core.createRefComponent)(function(props, forwardedRef) {
129
+ var { __scopeAvatar, size = true, ...avatarProps } = props;
130
+ var [imageLoadingStatus, setImageLoadingStatus] = React.useState("idle");
131
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarProvider, {
132
+ size,
133
+ scope: __scopeAvatar,
134
+ imageLoadingStatus,
135
+ onImageLoadingStatusChange: setImageLoadingStatus,
136
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFrame, {
137
+ size,
138
+ ...avatarProps,
139
+ ref: forwardedRef
140
+ })
141
+ });
179
142
  }), {
180
- Image: AvatarImage,
181
- Fallback: AvatarFallback
143
+ Image: AvatarImage,
144
+ Fallback: AvatarFallback
182
145
  });
183
146
  Avatar.displayName = AVATAR_NAME;
147
+
184
148
  //# sourceMappingURL=Avatar.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","Avatar_exports","__export","Avatar","AvatarFallback","AvatarFallbackFrame","AvatarFrame","AvatarImage","createAvatarScope","module","exports","import_jsx_runtime","require","import_core","import_create_context","import_helpers","import_image","import_shapes","import_stacks","React","__toESM","_type_of","obj","Symbol","constructor","AVATAR_NAME","createAvatarContext","createContextScope","AvatarProvider","useAvatarContext","IMAGE_NAME","forwardRef","props","forwardedRef","__scopeAvatar","src","source","onLoadingStatusChange","imageProps","context","status","setStatus","useState","resolvedSrc","uri","useEffect","onImageLoadingStatusChange","jsx","YStack","fullscreen","zIndex","children","Image","position","top","left","right","bottom","objectFit","width","height","ref","onError","onLoad","displayName","FALLBACK_NAME","styled","name","styleable","delayMs","fallbackProps","canRender","setCanRender","timerId","setTimeout","clearTimeout","imageLoadingStatus","Square","overflow"],"sources":["../../src/Avatar.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,MAAA,EAAAA,CAAA,KAAAA,MAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA,cAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA,mBAAA;EAAAC,WAAA,EA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AAAC;EAAA,IAAAtC,KAAA;EACV,IAAAO,OAAU,GAAAV,gBAAA,CAAAoC,aAAA,EAAA/B,aAAA;EACX,KAAAqC,SAAA,EAAAC,YAAA,IAAArD,KAAA,CAAAuB,QAAA,CAAA2B,OAAA;EAmBDlD,KAAM,CAAA0B,SAAA,aAAS;IACb,IAAMwB,OAAA;MACH,IAAAI,OAAiC,GAAAC,UAAiB;QACjD,OAAQF,YAAA,KAAe;MACvB,GAAAH,OAAO;MAEP,OACE;QAAC,OAAAM,YAAA,CAAAF,OAAA;MAAA;IAAA;EACC,IACOJ,OACP;EAC4B,OAAAE,SAE5B,IAAAhC,OAAA,CAAAqC,kBAAA,gBAAC,eAAY,IAAAjE,kBAA6B,CAAAoC,GAAK,EAAA1C,mBAAc;IAAA,GAAAiE,aAAA;IAAAT,GAC/D,EAAA5B;EAAA,EAEJ;AAAA,EACF;AAAA7B,cACA,CAAA4D,WAAA,GAAAC,aAAA;AAAA,IACE3D,WAAO,OAAAO,WAAA,CAAAqD,MAAA,EAAAjD,aAAA,CAAA4D,MAAA;EAAAV,IACP,EAAA1C,WAAU;EACZ4B,QAAA;EACFyB,QAAA;AAEA","ignoreList":[]}
1
+ {"version":3,"file":"Avatar.native.js","names":[],"sources":["cjs/Avatar.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Avatar_exports = {};\n__export(Avatar_exports, {\n Avatar: () => Avatar,\n AvatarFallback: () => AvatarFallback,\n AvatarFallbackFrame: () => AvatarFallbackFrame,\n AvatarFrame: () => AvatarFrame,\n AvatarImage: () => AvatarImage,\n createAvatarScope: () => createAvatarScope\n});\nmodule.exports = __toCommonJS(Avatar_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_create_context = require(\"@tamagui/create-context\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_image = require(\"@tamagui/image\");\nvar import_shapes = require(\"@tamagui/shapes\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar React = __toESM(require(\"react\"), 1);\nvar AVATAR_NAME = \"Avatar\";\nvar [createAvatarContext, createAvatarScope] = (0, import_create_context.createContextScope)(AVATAR_NAME);\nvar [AvatarProvider, useAvatarContext] = createAvatarContext(AVATAR_NAME);\nvar IMAGE_NAME = \"AvatarImage\";\nvar AvatarImage = (0, import_core.createRefComponent)(function(props, forwardedRef) {\n var { __scopeAvatar, src, source, onLoadingStatusChange = function() {\n }, ...imageProps } = props;\n var context = useAvatarContext(IMAGE_NAME, __scopeAvatar);\n var [status, setStatus] = React.useState(\"idle\");\n var resolvedSrc = src || (source && typeof source === \"object\" && \"uri\" in source ? source.uri : source);\n React.useEffect(function() {\n if (!resolvedSrc) {\n setStatus(\"error\");\n } else {\n setStatus(\"idle\");\n }\n }, [\n resolvedSrc\n ]);\n React.useEffect(function() {\n onLoadingStatusChange(status);\n context.onImageLoadingStatusChange(status);\n }, [\n status\n ]);\n if (!resolvedSrc) {\n return null;\n }\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {\n position: \"absolute\",\n inset: 0,\n zIndex: 1,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.Image, {\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n objectFit: \"cover\",\n // fill the frame. previously the image was sized to\n // getShapeSize(context.size) — but that resolves a numeric `size`\n // (e.g. <Avatar size={16} />) as a size-TOKEN index (tokens.size[16]),\n // so it got the token-scale value (~224px) instead of 16px, blowing\n // the image far past its frame; object-fit:cover then showed a\n // blurry mis-cropped corner. the frame already owns the size, so the\n // image just fills it — correct for numeric and token sizes alike.\n width: \"100%\",\n height: \"100%\",\n ...imageProps,\n // @ts-ignore\n ref: forwardedRef,\n // @ts-ignore\n src: resolvedSrc,\n // onLoadStart={() => {\n // // setStatus('loading')\n // }}\n onError: function() {\n setStatus(\"error\");\n },\n onLoad: function() {\n setStatus(\"loaded\");\n }\n })\n });\n});\nAvatarImage.displayName = IMAGE_NAME;\nvar FALLBACK_NAME = \"AvatarFallback\";\nvar AvatarFallbackFrame = (0, import_core.styled)(import_stacks.YStack, {\n displayName: FALLBACK_NAME,\n position: \"absolute\",\n inset: 0,\n zIndex: 0\n});\nvar AvatarFallback = (0, import_core.createStyledHOC)(AvatarFallbackFrame, function(props, forwardedRef) {\n var { __scopeAvatar, delay, ...fallbackProps } = props;\n var context = useAvatarContext(FALLBACK_NAME, __scopeAvatar);\n var [canRender, setCanRender] = React.useState(delay === void 0);\n React.useEffect(function() {\n if (delay !== void 0) {\n var timerId = setTimeout(function() {\n return setCanRender(true);\n }, delay);\n return function() {\n return clearTimeout(timerId);\n };\n }\n }, [\n delay\n ]);\n return canRender && context.imageLoadingStatus !== \"loaded\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallbackFrame, {\n ...fallbackProps,\n ref: forwardedRef\n }) : null;\n});\nAvatarFallback.displayName = FALLBACK_NAME;\nvar AvatarFrame = (0, import_core.styled)(import_shapes.Square, {\n displayName: AVATAR_NAME,\n position: \"relative\",\n overflow: \"hidden\"\n});\nvar Avatar = (0, import_helpers.withStaticProperties)((0, import_core.createRefComponent)(function(props, forwardedRef) {\n var { __scopeAvatar, size = true, ...avatarProps } = props;\n var [imageLoadingStatus, setImageLoadingStatus] = React.useState(\"idle\");\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarProvider, {\n size,\n scope: __scopeAvatar,\n imageLoadingStatus,\n onImageLoadingStatusChange: setImageLoadingStatus,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFrame, {\n size,\n ...avatarProps,\n ref: forwardedRef\n })\n });\n}), {\n Image: AvatarImage,\n Fallback: AvatarFallback\n});\nAvatar.displayName = AVATAR_NAME;\n//# sourceMappingURL=Avatar.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;C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C7B;EACF;CACF,GAAG,CACD,KACF,CAAC;CACD,OAAO,aAAa,QAAQ,uBAAuB,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,qBAAqB;EAC7H,GAAG;EACH,KAAK;CACP,CAAC,IAAI;AACP,CAAC;AACD,eAAe,cAAc;AAC7B,IAAI,eAAe,GAAG,YAAY,OAAM,CAAE,cAAc,QAAQ;CAC9D,aAAa;CACb,UAAU;CACV,UAAU;AACZ,CAAC;AACD,IAAI,UAAU,GAAG,eAAe,qBAAoB,EAAG,GAAG,YAAY,mBAAkB,CAAE,SAAS,OAAO,cAAc;CACtH,IAAI,EAAE,eAAe,OAAO,MAAM,GAAG,gBAAgB;CACrD,IAAI,CAAC,oBAAoB,yBAAyB,MAAM,SAAS,MAAM;CACvE,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,gBAAgB;EACjE;EACA,OAAO;EACP;EACA,4BAA4B;EAC5B,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;GACjE;GACA,GAAG;GACH,KAAK;EACP,CAAC;CACH,CAAC;AACH,CAAC,GAAG;CACF,OAAO;CACP,UAAU;AACZ,CAAC;AACD,OAAO,cAAc"}
@@ -3,18 +3,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
13
  };
14
14
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
16
  var index_exports = {};
19
17
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./Avatar.cjs"), module.exports);
18
+ __reExport(index_exports, require("./Avatar.cjs"), module.exports);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./Avatar.native.js"), module.exports);
@@ -5,19 +5,18 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
15
  };
16
16
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
18
  var index_exports = {};
21
19
  module.exports = __toCommonJS(index_exports);
22
20
  __reExport(index_exports, require("./Avatar.native.js"), module.exports);
21
+
23
22
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Avatar\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO"}