@neurodyn/react-ai-try-on 0.0.3 → 0.0.5

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/index.d.ts CHANGED
@@ -52,6 +52,7 @@ declare const resources: {
52
52
  readonly download: "Download";
53
53
  readonly errorBadge: "Little error";
54
54
  readonly errorDifferentPhoto: "Change photo";
55
+ readonly errorFileTooLarge: "File is too large. Maximum file size is 10 MB";
55
56
  readonly errorGuidance: "Try again with a different photo. Make sure it shows your full body.";
56
57
  readonly errorRetry: "Try again";
57
58
  readonly errorSubtitle: "It happens — let's try again";
@@ -164,6 +165,7 @@ declare const resources: {
164
165
  readonly download: "Скачать";
165
166
  readonly errorBadge: "Небольшая ошибка";
166
167
  readonly errorDifferentPhoto: "Изменить фото";
168
+ readonly errorFileTooLarge: "Файл слишком большой. Максимальный размер файла — 10 МБ";
167
169
  readonly errorGuidance: "Попробуйте другое фото. Убедитесь, что вы видны в полный рост.";
168
170
  readonly errorRetry: "Попробовать снова";
169
171
  readonly errorSubtitle: "Так бывает — попробуем еще раз";
package/dist/index.js CHANGED
@@ -935,6 +935,10 @@ var __webpack_modules__ = {
935
935
  height: auto;
936
936
  }
937
937
 
938
+ .h-dvh {
939
+ height: 100dvh;
940
+ }
941
+
938
942
  .h-full {
939
943
  height: 100%;
940
944
  }
@@ -943,10 +947,6 @@ var __webpack_modules__ = {
943
947
  height: 1px;
944
948
  }
945
949
 
946
- .h-svh {
947
- height: 100svh;
948
- }
949
-
950
950
  .max-h-\\(--radix-select-content-available-height\\) {
951
951
  max-height: var(--radix-select-content-available-height);
952
952
  }
@@ -955,12 +955,12 @@ var __webpack_modules__ = {
955
955
  max-height: calc(var(--spacing) * 179);
956
956
  }
957
957
 
958
- .max-h-none {
959
- max-height: none;
958
+ .max-h-dvh {
959
+ max-height: 100dvh;
960
960
  }
961
961
 
962
- .max-h-svh {
963
- max-height: 100svh;
962
+ .max-h-none {
963
+ max-height: none;
964
964
  }
965
965
 
966
966
  .min-h-0 {
@@ -10161,6 +10161,7 @@ const ns1 = {
10161
10161
  download: 'Download',
10162
10162
  errorBadge: 'Little error',
10163
10163
  errorDifferentPhoto: 'Change photo',
10164
+ errorFileTooLarge: 'File is too large. Maximum file size is 10 MB',
10164
10165
  errorGuidance: 'Try again with a different photo. Make sure it shows your full body.',
10165
10166
  errorRetry: 'Try again',
10166
10167
  errorSubtitle: 'It happens — let\'s try again',
@@ -10271,6 +10272,7 @@ const ru_ns1 = {
10271
10272
  download: 'Скачать',
10272
10273
  errorBadge: 'Небольшая ошибка',
10273
10274
  errorDifferentPhoto: 'Изменить фото',
10275
+ errorFileTooLarge: 'Файл слишком большой. Максимальный размер файла — 10 МБ',
10274
10276
  errorGuidance: 'Попробуйте другое фото. Убедитесь, что вы видны в полный рост.',
10275
10277
  errorRetry: 'Попробовать снова',
10276
10278
  errorSubtitle: 'Так бывает — попробуем еще раз',
@@ -10387,18 +10389,28 @@ function createAiTryOnI18n(language) {
10387
10389
  return instance;
10388
10390
  }
10389
10391
  const PROPERTY_BLOCK_RE = /@property\s+(--[^{\s]+)\s*\{([^}]*)\}/g;
10390
- const INITIAL_VALUE_RE = /initial-value:([^;\n]+);/i;
10392
+ const INITIAL_VALUE_RE = /initial-value:([^;}]+)/i;
10393
+ const NON_INHERITING_RE = /inherits:\s*false(?:\s*;|\s*$)/i;
10391
10394
  const ROOT_TO_HOST_SELECTOR_RE = /:root\s*,\s*:host|:root/g;
10392
10395
  function createShadowRootCssText(cssText) {
10393
10396
  const cssForHost = cssText.replace(ROOT_TO_HOST_SELECTOR_RE, ':host');
10394
10397
  const propertyBlocks = Array.from(cssText.matchAll(PROPERTY_BLOCK_RE));
10395
10398
  const propertyDefaults = propertyBlocks.map(([, name, body])=>{
10396
- const match = body.match(INITIAL_VALUE_RE);
10397
- if (!match) return null;
10398
- const initialValue = match[1].trim();
10399
- return ` ${name}: ${initialValue};`;
10399
+ if (!NON_INHERITING_RE.test(body)) return null;
10400
+ const initialValue = body.match(INITIAL_VALUE_RE)?.[1].trim() ?? 'initial';
10401
+ return ` ${name}: ${initialValue};`;
10400
10402
  }).filter((value)=>null !== value).join('\n');
10401
- return propertyDefaults ? `:host {\n${propertyDefaults}\n}\n\n${cssForHost}` : cssForHost;
10403
+ if (!propertyDefaults) return cssForHost;
10404
+ return `${cssForHost}\n\n@layer base {
10405
+ :host,
10406
+ *,
10407
+ ::before,
10408
+ ::after,
10409
+ ::backdrop,
10410
+ ::file-selector-button {
10411
+ ${propertyDefaults}
10412
+ }
10413
+ }`;
10402
10414
  }
10403
10415
  var styleinline = __webpack_require__("./src/style.css?inline");
10404
10416
  const shadowRootCssText = createShadowRootCssText(styleinline.A);
@@ -18195,7 +18207,7 @@ function ComparisonDialog({ onAddToCart, onClose, onDeleteResult, onSaveResult,
18195
18207
  open: true,
18196
18208
  onOpenChange: (open)=>!open && onClose(),
18197
18209
  children: /*#__PURE__*/ jsxs(DialogContent, {
18198
- className: `dark fixed inset-0 left-0 top-0 flex h-svh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none ${COMPARISON_DIALOG_BACKGROUND_CLASS_NAME} p-0 text-text-dark duration-200 sm:max-w-none sm:p-0`,
18210
+ className: `dark fixed inset-0 left-0 top-0 flex h-dvh max-h-none w-svw max-w-none translate-x-0 translate-y-0 flex-col rounded-none ${COMPARISON_DIALOG_BACKGROUND_CLASS_NAME} p-0 text-text-dark duration-200 sm:max-w-none sm:p-0`,
18199
18211
  portalContainer: portalContainer,
18200
18212
  showCloseButton: false,
18201
18213
  children: [
@@ -18390,7 +18402,7 @@ function Badge({ className, variant, size, asChild = false, ...props }) {
18390
18402
  }
18391
18403
  function TryOnShell({ className, ...props }) {
18392
18404
  return /*#__PURE__*/ jsx_runtime_jsx("div", {
18393
- className: utils_cn('flex max-h-svh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl', className),
18405
+ className: utils_cn('flex max-h-dvh w-svw flex-col overflow-hidden rounded-t-3xl rounded-b-none bg-background-containers text-foreground shadow-2xl sm:max-h-[min(calc(100svh-var(--spacing)*8),--spacing(176))] sm:w-120 sm:rounded-3xl', className),
18394
18406
  ...props
18395
18407
  });
18396
18408
  }
@@ -19091,11 +19103,12 @@ function ProcessingScreen({ view }) {
19091
19103
  }
19092
19104
  function ErrorScreen({ view }) {
19093
19105
  const { t } = useTranslation();
19106
+ const isFileTooLarge = 'upload-validation' === view.error.kind && 'file-too-large' === view.error.code;
19094
19107
  return /*#__PURE__*/ jsxs(ScreenLayout, {
19095
- title: t('errorTitle'),
19096
- subtitle: t('errorSubtitle'),
19108
+ title: t(isFileTooLarge ? 'errorFileTooLarge' : 'errorTitle'),
19109
+ subtitle: isFileTooLarge ? void 0 : t('errorSubtitle'),
19097
19110
  children: [
19098
- /*#__PURE__*/ jsxs(TryOnImagePanel, {
19111
+ !isFileTooLarge && /*#__PURE__*/ jsxs(TryOnImagePanel, {
19099
19112
  className: "mt-3",
19100
19113
  children: [
19101
19114
  /*#__PURE__*/ jsx_runtime_jsx(BlurredPhotoBackdrop, {
@@ -20694,7 +20707,7 @@ function AiTryOnRoot({ dialogPortalContainer, language, onClose, processPhoto, p
20694
20707
  ]
20695
20708
  }) : null;
20696
20709
  return /*#__PURE__*/ jsxs(TryOnShell, {
20697
- className: isMyFitsActive ? 'h-svh max-h-svh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]' : void 0,
20710
+ className: isMyFitsActive ? 'h-dvh max-h-dvh sm:h-230 sm:max-h-[calc(100svh-var(--spacing)*8)]' : void 0,
20698
20711
  "data-ai-try-on-stage": stage,
20699
20712
  children: [
20700
20713
  /*#__PURE__*/ jsx_runtime_jsx(TryOnHeader, {
@@ -20866,7 +20879,7 @@ function AiTryOnDialogContent({ language, onRequestClose, portalContainer, produ
20866
20879
  return /*#__PURE__*/ jsx_runtime_jsx(Dialog, {
20867
20880
  ...props,
20868
20881
  children: /*#__PURE__*/ jsxs(DialogContent, {
20869
- className: "inset-x-0 bottom-0 top-auto block max-h-svh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",
20882
+ className: "inset-x-0 bottom-0 top-auto block max-h-dvh w-svw max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-t-3xl rounded-b-none p-0 sm:inset-x-auto sm:right-4 sm:bottom-4 sm:left-auto sm:max-h-230 sm:w-120 sm:max-w-120 sm:rounded-3xl sm:p-0",
20870
20883
  contentInsideOverlay: true,
20871
20884
  portalContainer: portalContainer,
20872
20885
  showCloseButton: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neurodyn/react-ai-try-on",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },