@nubisco/ui 5.63.0 → 5.64.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.
@@ -1 +1 @@
1
- .nb-image-cropper[data-v-057c9675]{-webkit-user-select:none;user-select:none;max-width:100%;height:auto;display:inline-block;position:relative;overflow:hidden}.nb-image-cropper .canvas-container[data-v-057c9675]{width:100%;height:auto;display:inline-block;position:relative}.nb-image-cropper .canvas-container canvas[data-v-057c9675]{max-width:100%;height:auto;display:block}.nb-image-cropper .resize-handle[data-v-057c9675]{background:var(--nb-c-surface);border:1px solid var(--nb-c-border);z-index:1;width:10px;height:10px;position:absolute}.nb-image-cropper .resize-handle.top-left[data-v-057c9675]{cursor:nwse-resize}.nb-image-cropper .resize-handle.top[data-v-057c9675]{cursor:ns-resize}.nb-image-cropper .resize-handle.top-right[data-v-057c9675]{cursor:nesw-resize}.nb-image-cropper .resize-handle.right[data-v-057c9675]{cursor:ew-resize}.nb-image-cropper .resize-handle.bottom-right[data-v-057c9675]{cursor:nwse-resize}.nb-image-cropper .resize-handle.bottom[data-v-057c9675]{cursor:ns-resize}.nb-image-cropper .resize-handle.bottom-left[data-v-057c9675]{cursor:nesw-resize}.nb-image-cropper .resize-handle.left[data-v-057c9675]{cursor:ew-resize}.nb-image-cropper .cropped-image-preview[data-v-057c9675]{right:calc(var(--nb-base-unit,8px) * 2);bottom:calc(var(--nb-base-unit,8px) * 2);border-radius:var(--nb-radius-control-sm);height:calc(var(--nb-base-unit,8px) * 14);border:dotted 1px var(--nb-c-border);background:var(--nb-c-surface);-webkit-user-select:none;user-select:none;pointer-events:none;margin-top:20px;position:absolute;overflow:hidden}.nb-image-cropper .cropped-image-preview ul[data-v-057c9675]{min-width:calc(var(--nb-base-unit,8px) * 9);background:var(--nb-c-contrast);color:var(--nb-c-surface);font-size:var(--nb-type-body-sm-size);padding:calc(var(--nb-base-unit,8px) / 2);line-height:var(--nb-type-body-sm-line-height)}.nb-image-cropper .cropped-image-preview img[data-v-057c9675]{object-fit:contain;object-position:center;width:100%;height:100%}
1
+ .nb-image-cropper[data-v-8ab6ebaf]{--nb-crop-handle-half:5px}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-image-cropper[data-v-8ab6ebaf]{--nb-crop-handle-half:8px}}.nb-image-cropper[data-v-8ab6ebaf]{-webkit-user-select:none;user-select:none;max-width:100%;height:auto;display:inline-block;position:relative;overflow:hidden}.nb-image-cropper .canvas-container[data-v-8ab6ebaf]{touch-action:none;width:100%;height:auto;display:inline-block;position:relative}.nb-image-cropper .canvas-container canvas[data-v-8ab6ebaf]{max-width:100%;height:auto;display:block}.nb-image-cropper .resize-handle[data-v-8ab6ebaf]{width:calc(var(--nb-crop-handle-half) * 2);height:calc(var(--nb-crop-handle-half) * 2);background:var(--nb-c-surface);border:1px solid var(--nb-c-border);z-index:1;position:absolute}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-image-cropper .resize-handle[data-v-8ab6ebaf]:after{content:"";position:absolute;inset-block:min(0px,50% - 22px);inset-inline:min(0px,50% - 22px)}}.nb-image-cropper .resize-handle.top-left[data-v-8ab6ebaf]{cursor:nwse-resize}.nb-image-cropper .resize-handle.top[data-v-8ab6ebaf]{cursor:ns-resize}.nb-image-cropper .resize-handle.top-right[data-v-8ab6ebaf]{cursor:nesw-resize}.nb-image-cropper .resize-handle.right[data-v-8ab6ebaf]{cursor:ew-resize}.nb-image-cropper .resize-handle.bottom-right[data-v-8ab6ebaf]{cursor:nwse-resize}.nb-image-cropper .resize-handle.bottom[data-v-8ab6ebaf]{cursor:ns-resize}.nb-image-cropper .resize-handle.bottom-left[data-v-8ab6ebaf]{cursor:nesw-resize}.nb-image-cropper .resize-handle.left[data-v-8ab6ebaf]{cursor:ew-resize}.nb-image-cropper--fit-container[data-v-8ab6ebaf]{box-sizing:border-box;width:100%;padding:var(--nb-crop-handle-half);display:block;overflow:visible}.nb-image-cropper--fit-container .canvas-container[data-v-8ab6ebaf]{display:block}.nb-image-cropper .cropped-image-preview[data-v-8ab6ebaf]{right:calc(var(--nb-base-unit,8px) * 2);bottom:calc(var(--nb-base-unit,8px) * 2);border-radius:var(--nb-radius-control-sm);height:calc(var(--nb-base-unit,8px) * 14);border:dotted 1px var(--nb-c-border);background:var(--nb-c-surface);-webkit-user-select:none;user-select:none;pointer-events:none;margin-top:20px;position:absolute;overflow:hidden}.nb-image-cropper .cropped-image-preview ul[data-v-8ab6ebaf]{min-width:calc(var(--nb-base-unit,8px) * 9);background:var(--nb-c-contrast);color:var(--nb-c-surface);font-size:var(--nb-type-body-sm-size);padding:calc(var(--nb-base-unit,8px) / 2);line-height:var(--nb-type-body-sm-line-height)}.nb-image-cropper .cropped-image-preview img[data-v-8ab6ebaf]{object-fit:contain;object-position:center;width:100%;height:100%}
package/dist/ui.css CHANGED
@@ -68,7 +68,7 @@
68
68
  .nb-file-uploader[data-v-7e0b7153]{flex-direction:column;gap:.75rem;display:flex}.nb-file-uploader__heading[data-v-7e0b7153]{font-weight:600;font-size:var(--nb-type-heading-01-size);color:var(--nb-c-text);margin:0}.nb-file-uploader__description[data-v-7e0b7153]{font-size:var(--nb-type-body-compact-size);color:var(--nb-c-text-muted);border-left:3px solid var(--nb-c-border);line-height:var(--nb-type-body-compact-line-height);margin:0;padding-left:.75rem}.nb-file-uploader__input[data-v-7e0b7153]{display:none}.nb-file-uploader__btn[data-v-7e0b7153]{align-self:flex-start}.nb-file-uploader__dropzone[data-v-7e0b7153]{border:2px dashed var(--nb-c-border);border-radius:var(--nb-radius-panel);--nb-radius-context:var(--nb-radius-panel);cursor:pointer;text-align:center;transition:border-color var(--nb-motion-short), background var(--nb-motion-short);justify-content:center;align-items:center;padding:2rem 1.5rem;display:flex}.nb-file-uploader__dropzone--primary[data-v-7e0b7153]{background:color-mix(in srgb, var(--nb-c-primary) 6%, transparent);border-color:color-mix(in srgb, var(--nb-c-primary) 60%, transparent)}.nb-file-uploader__dropzone--primary .nb-file-uploader__drop-label[data-v-7e0b7153]{color:color-mix(in srgb, var(--nb-c-primary), var(--nb-c-ink-toward,var(--nb-c-white)) var(--nb-c-primary-ink-lift,0%))}.nb-file-uploader__dropzone--secondary[data-v-7e0b7153]{background:color-mix(in srgb, var(--nb-c-secondary) 6%, transparent);border-color:color-mix(in srgb, var(--nb-c-secondary) 60%, transparent)}.nb-file-uploader__dropzone--secondary .nb-file-uploader__drop-label[data-v-7e0b7153]{color:color-mix(in srgb, var(--nb-c-secondary), var(--nb-c-ink-toward,var(--nb-c-white)) var(--nb-c-secondary-ink-lift,0%))}.nb-file-uploader__dropzone--danger[data-v-7e0b7153]{background:color-mix(in srgb, var(--nb-c-danger) 6%, transparent);border-color:color-mix(in srgb, var(--nb-c-danger) 60%, transparent)}.nb-file-uploader__dropzone--danger .nb-file-uploader__drop-label[data-v-7e0b7153]{color:color-mix(in srgb, var(--nb-c-danger), var(--nb-c-ink-toward,var(--nb-c-white)) var(--nb-c-danger-ink-lift,0%))}.nb-file-uploader__dropzone--success[data-v-7e0b7153]{background:color-mix(in srgb, var(--nb-c-success) 6%, transparent);border-color:color-mix(in srgb, var(--nb-c-success) 60%, transparent)}.nb-file-uploader__dropzone--success .nb-file-uploader__drop-label[data-v-7e0b7153]{color:color-mix(in srgb, var(--nb-c-success), var(--nb-c-ink-toward,var(--nb-c-white)) var(--nb-c-success-ink-lift,0%))}.nb-file-uploader__dropzone--warning[data-v-7e0b7153]{background:color-mix(in srgb, var(--nb-c-warning) 6%, transparent);border-color:color-mix(in srgb, var(--nb-c-warning) 60%, transparent)}.nb-file-uploader__dropzone--warning .nb-file-uploader__drop-label[data-v-7e0b7153]{color:color-mix(in srgb, var(--nb-c-warning), var(--nb-c-ink-toward,var(--nb-c-white)) var(--nb-c-warning-ink-lift,0%))}.nb-file-uploader__drop-label[data-v-7e0b7153]{text-wrap:balance;max-width:16rem;font-size:var(--nb-type-body-compact-size);line-height:var(--nb-type-body-compact-line-height);pointer-events:none}.nb-file-uploader__list[data-v-7e0b7153]{flex-direction:column;gap:.5rem;margin:0;padding:0;list-style:none;display:flex}.nb-file-uploader__item[data-v-7e0b7153]{background:var(--nb-c-surface);font-size:var(--nb-type-body-compact-size);color:var(--nb-c-text);transition:border-color var(--nb-motion-short);border:1px solid #0000;border-radius:4px;grid-template-rows:auto auto;grid-template-columns:1fr auto;align-items:center;padding:.6rem .875rem;display:grid}.nb-file-uploader__item--error[data-v-7e0b7153]{border-color:var(--nb-c-danger)}.nb-file-uploader__name[data-v-7e0b7153]{white-space:nowrap;text-overflow:ellipsis;grid-area:1/1;padding-right:.5rem;overflow:hidden}.nb-file-uploader__status[data-v-7e0b7153]{grid-area:1/2;align-items:center;gap:.25rem;display:flex}.nb-file-uploader__error[data-v-7e0b7153]{font-size:var(--nb-type-body-compact-size);color:var(--nb-c-danger);border-top:1px solid var(--nb-c-border);grid-area:2/1/auto/-1;margin-top:.35rem;padding-top:.35rem}.nb-file-uploader__remove[data-v-7e0b7153]{flex-shrink:0}.nb-file-uploader--disabled .nb-file-uploader__heading[data-v-7e0b7153],.nb-file-uploader--disabled .nb-file-uploader__description[data-v-7e0b7153],.nb-file-uploader--disabled .nb-file-uploader__list[data-v-7e0b7153]{opacity:var(--nb-field-disabled-opacity,.45)}.nb-file-uploader__spinner[data-v-7e0b7153]{color:var(--nb-c-primary);animation:.8s linear infinite nb-spin-7e0b7153}.nb-file-uploader__check[data-v-7e0b7153]{color:var(--nb-c-primary)}.nb-file-uploader__warn[data-v-7e0b7153]{color:var(--nb-c-danger)}@keyframes nb-spin-7e0b7153{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.nb-file-uploader__spinner[data-v-7e0b7153]{animation:1.6s ease-in-out infinite nb-file-uploader-breathe-7e0b7153}}@keyframes nb-file-uploader-breathe-7e0b7153{0%,to{opacity:.35}50%{opacity:1}}
69
69
  .nb-flag[data-v-7bdc2000]{height:fit-content;line-height:1em;display:flex;position:relative}.nb-flag[data-v-7bdc2000]:not(.box-clickable){pointer-events:none}.nb-flag--lg[data-v-7bdc2000]{width:32px;max-width:32px;max-height:32px}.nb-flag--md[data-v-7bdc2000]{width:20px;max-width:20px;max-height:20px}.nb-flag--sm[data-v-7bdc2000]{width:16px;max-width:16px;max-height:16px}
70
70
  .nb-floating-toolbar[data-v-6a85970b]{z-index:var(--nb-zindex-menu);align-items:center;gap:calc(var(--nb-base-unit) * .5);padding:calc(var(--nb-base-unit) * .5);border:1px solid var(--nb-c-border);border-radius:var(--nb-radius-popover);--nb-radius-context:var(--nb-radius-popover);background:var(--nb-c-surface);color:var(--nb-c-text);box-shadow:0 calc(var(--nb-base-unit) * .5) calc(var(--nb-base-unit) * 2) var(--nb-c-scrim);white-space:nowrap;animation:nb-floating-toolbar-in-6a85970b var(--nb-motion-medium) var(--nb-ease-enter);display:flex;position:fixed}.nb-floating-toolbar--vertical[data-v-6a85970b]{flex-direction:column;align-items:stretch}.nb-floating-toolbar--anchor-hidden[data-v-6a85970b]{visibility:hidden}@media (width<=671.98px),(pointer:coarse) and (hover:none) and (height<=500px){.nb-floating-toolbar--docked[data-v-6a85970b]{inset-inline:0;top:auto;bottom:max(0px, 100% - var(--nb-vvt,0px) - var(--nb-vvh,100%));border-inline:0;padding-bottom:calc(var(--nb-base-unit) * .5 + env(safe-area-inset-bottom));scrollbar-width:none;overscroll-behavior-x:contain;border-bottom:0;border-radius:0;animation:none;overflow-x:auto}.nb-floating-toolbar--docked[data-v-6a85970b]>*{flex-shrink:0}.nb-floating-toolbar--docked[data-v-6a85970b] button,.nb-floating-toolbar--docked[data-v-6a85970b] [role=button]{min-block-size:44px;min-inline-size:44px}}@keyframes nb-floating-toolbar-in-6a85970b{0%{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}@media (prefers-reduced-motion:reduce){.nb-floating-toolbar[data-v-6a85970b]{animation-name:nb-floating-toolbar-fade-6a85970b}}@keyframes nb-floating-toolbar-fade-6a85970b{0%{opacity:0}}
71
- .nb-image-cropper[data-v-057c9675]{-webkit-user-select:none;user-select:none;max-width:100%;height:auto;display:inline-block;position:relative;overflow:hidden}.nb-image-cropper .canvas-container[data-v-057c9675]{width:100%;height:auto;display:inline-block;position:relative}.nb-image-cropper .canvas-container canvas[data-v-057c9675]{max-width:100%;height:auto;display:block}.nb-image-cropper .resize-handle[data-v-057c9675]{background:var(--nb-c-surface);border:1px solid var(--nb-c-border);z-index:1;width:10px;height:10px;position:absolute}.nb-image-cropper .resize-handle.top-left[data-v-057c9675]{cursor:nwse-resize}.nb-image-cropper .resize-handle.top[data-v-057c9675]{cursor:ns-resize}.nb-image-cropper .resize-handle.top-right[data-v-057c9675]{cursor:nesw-resize}.nb-image-cropper .resize-handle.right[data-v-057c9675]{cursor:ew-resize}.nb-image-cropper .resize-handle.bottom-right[data-v-057c9675]{cursor:nwse-resize}.nb-image-cropper .resize-handle.bottom[data-v-057c9675]{cursor:ns-resize}.nb-image-cropper .resize-handle.bottom-left[data-v-057c9675]{cursor:nesw-resize}.nb-image-cropper .resize-handle.left[data-v-057c9675]{cursor:ew-resize}.nb-image-cropper .cropped-image-preview[data-v-057c9675]{right:calc(var(--nb-base-unit,8px) * 2);bottom:calc(var(--nb-base-unit,8px) * 2);border-radius:var(--nb-radius-control-sm);height:calc(var(--nb-base-unit,8px) * 14);border:dotted 1px var(--nb-c-border);background:var(--nb-c-surface);-webkit-user-select:none;user-select:none;pointer-events:none;margin-top:20px;position:absolute;overflow:hidden}.nb-image-cropper .cropped-image-preview ul[data-v-057c9675]{min-width:calc(var(--nb-base-unit,8px) * 9);background:var(--nb-c-contrast);color:var(--nb-c-surface);font-size:var(--nb-type-body-sm-size);padding:calc(var(--nb-base-unit,8px) / 2);line-height:var(--nb-type-body-sm-line-height)}.nb-image-cropper .cropped-image-preview img[data-v-057c9675]{object-fit:contain;object-position:center;width:100%;height:100%}
71
+ .nb-image-cropper[data-v-8ab6ebaf]{--nb-crop-handle-half:5px}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-image-cropper[data-v-8ab6ebaf]{--nb-crop-handle-half:8px}}.nb-image-cropper[data-v-8ab6ebaf]{-webkit-user-select:none;user-select:none;max-width:100%;height:auto;display:inline-block;position:relative;overflow:hidden}.nb-image-cropper .canvas-container[data-v-8ab6ebaf]{touch-action:none;width:100%;height:auto;display:inline-block;position:relative}.nb-image-cropper .canvas-container canvas[data-v-8ab6ebaf]{max-width:100%;height:auto;display:block}.nb-image-cropper .resize-handle[data-v-8ab6ebaf]{width:calc(var(--nb-crop-handle-half) * 2);height:calc(var(--nb-crop-handle-half) * 2);background:var(--nb-c-surface);border:1px solid var(--nb-c-border);z-index:1;position:absolute}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-image-cropper .resize-handle[data-v-8ab6ebaf]:after{content:"";position:absolute;inset-block:min(0px,50% - 22px);inset-inline:min(0px,50% - 22px)}}.nb-image-cropper .resize-handle.top-left[data-v-8ab6ebaf]{cursor:nwse-resize}.nb-image-cropper .resize-handle.top[data-v-8ab6ebaf]{cursor:ns-resize}.nb-image-cropper .resize-handle.top-right[data-v-8ab6ebaf]{cursor:nesw-resize}.nb-image-cropper .resize-handle.right[data-v-8ab6ebaf]{cursor:ew-resize}.nb-image-cropper .resize-handle.bottom-right[data-v-8ab6ebaf]{cursor:nwse-resize}.nb-image-cropper .resize-handle.bottom[data-v-8ab6ebaf]{cursor:ns-resize}.nb-image-cropper .resize-handle.bottom-left[data-v-8ab6ebaf]{cursor:nesw-resize}.nb-image-cropper .resize-handle.left[data-v-8ab6ebaf]{cursor:ew-resize}.nb-image-cropper--fit-container[data-v-8ab6ebaf]{box-sizing:border-box;width:100%;padding:var(--nb-crop-handle-half);display:block;overflow:visible}.nb-image-cropper--fit-container .canvas-container[data-v-8ab6ebaf]{display:block}.nb-image-cropper .cropped-image-preview[data-v-8ab6ebaf]{right:calc(var(--nb-base-unit,8px) * 2);bottom:calc(var(--nb-base-unit,8px) * 2);border-radius:var(--nb-radius-control-sm);height:calc(var(--nb-base-unit,8px) * 14);border:dotted 1px var(--nb-c-border);background:var(--nb-c-surface);-webkit-user-select:none;user-select:none;pointer-events:none;margin-top:20px;position:absolute;overflow:hidden}.nb-image-cropper .cropped-image-preview ul[data-v-8ab6ebaf]{min-width:calc(var(--nb-base-unit,8px) * 9);background:var(--nb-c-contrast);color:var(--nb-c-surface);font-size:var(--nb-type-body-sm-size);padding:calc(var(--nb-base-unit,8px) / 2);line-height:var(--nb-type-body-sm-line-height)}.nb-image-cropper .cropped-image-preview img[data-v-8ab6ebaf]{object-fit:contain;object-position:center;width:100%;height:100%}
72
72
  .nb-image-picker{inline-size:var(--nb-image-picker-size,10rem);max-inline-size:100%;display:block;position:relative}.nb-image-picker__surface{inline-size:100%;aspect-ratio:var(--nb-image-picker-ratio,1/1);cursor:pointer;font:inherit;color:var(--nb-c-text-subtle);background:var(--nb-c-field-bg);border:1px solid var(--nb-c-field-border);border-radius:var(--nb-radius-control);--nb-radius-context:var(--nb-radius-control);transition:border-color var(--nb-motion-short) ease, background var(--nb-motion-short) ease;justify-content:center;align-items:center;padding:0;display:flex;position:relative;overflow:hidden}.nb-image-picker__surface:hover:not(:disabled){border-color:var(--nb-c-primary)}.nb-image-picker__surface:focus-visible{outline:2px solid var(--nb-c-focus-ring);outline-offset:-2px;box-shadow:inset 0 0 0 3px var(--nb-c-surface)}.nb-image-picker__surface:disabled{cursor:not-allowed}.nb-image-picker:not(.nb-image-picker--filled) .nb-image-picker__surface{border-style:dashed;border-color:var(--nb-c-component-plain-border)}.nb-image-picker--dragging .nb-image-picker__surface{border-style:solid;border-color:var(--nb-c-primary);background:color-mix(in srgb, var(--nb-c-primary) 8%, var(--nb-c-field-bg))}.nb-image-picker--disabled{opacity:.5}.nb-image-picker__image{object-fit:var(--nb-image-picker-fit,contain);pointer-events:none;block-size:100%;inline-size:100%;padding:0}.nb-image-picker__empty{text-align:center;font-size:var(--nb-type-body-compact-size);line-height:var(--nb-type-body-compact-line-height);flex-direction:column;align-items:center;gap:6px;padding:8px;display:flex}.nb-image-picker__drop{text-align:center;font-size:var(--nb-type-heading-compact-size);font-weight:var(--nb-font-weight-semibold,600);color:var(--nb-c-text);background:color-mix(in srgb, var(--nb-c-primary) 14%, var(--nb-c-field-bg));justify-content:center;align-items:center;padding:8px;display:flex;position:absolute;inset:0}.nb-image-picker__loading{background:color-mix(in srgb, var(--nb-c-field-bg) 70%, transparent);border-radius:var(--nb-radius-control);--nb-radius-context:var(--nb-radius-control);justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.nb-image-picker__remove{opacity:0;background:var(--nb-c-surface);transition:opacity var(--nb-motion-short) ease;position:absolute;inset-block-start:6px;inset-inline-end:6px;box-shadow:0 1px 4px #0000002e}.nb-image-picker:hover .nb-image-picker__remove,.nb-image-picker:focus-within .nb-image-picker__remove,.nb-image-picker__remove:focus-visible{opacity:1}@media (hover:none){.nb-image-picker__remove{opacity:1}}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-image-picker__remove{inset-block-start:4px;inset-inline-end:4px}}.nb-image-picker__input{clip-path:inset(50%);border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
73
73
  .nb-inline-edit__text[data-v-a0e16528]{align-items:baseline;gap:calc(var(--nb-base-unit) * .75);max-width:100%;padding:calc(var(--nb-base-unit) * .25) calc(var(--nb-base-unit) * .75);margin:0;border-radius:var(--nb-radius-control-sm);--nb-radius-context:var(--nb-radius-control-sm);color:inherit;text-align:start;cursor:text;background:0 0;border:0;margin-inline-start:calc(var(--nb-base-unit) * -.75);display:inline-flex}.nb-inline-edit__text span[data-v-a0e16528]{overflow-wrap:anywhere}.nb-inline-edit__text .nb-inline-edit__pencil[data-v-a0e16528]{color:var(--nb-c-text-subtle);opacity:0;transition:opacity var(--nb-motion-quick) ease;flex:none;align-self:center}.nb-inline-edit__text[data-v-a0e16528]:hover:not(.is-disabled){background:var(--nb-c-surface-hover)}.nb-inline-edit__text:hover:not(.is-disabled) .nb-inline-edit__pencil[data-v-a0e16528]{opacity:1}.nb-inline-edit__text[data-v-a0e16528]:focus-visible{outline:2px solid var(--nb-c-focus-ring,var(--nb-c-primary));outline-offset:1px}.nb-inline-edit__text:focus-visible .nb-inline-edit__pencil[data-v-a0e16528]{opacity:1}.nb-inline-edit__text.is-disabled[data-v-a0e16528]{cursor:default}.nb-inline-edit__placeholder[data-v-a0e16528]{color:var(--nb-c-text-subtle)}.nb-inline-edit__input[data-v-a0e16528]{width:100%;padding:calc(var(--nb-base-unit) * .25) calc(var(--nb-base-unit) * .75);border:1px solid var(--nb-c-primary);border-radius:var(--nb-field-radius,0);background:var(--nb-c-surface);color:inherit;margin:0;margin-inline-start:calc(var(--nb-base-unit) * -.75)}.nb-inline-edit__input[data-v-a0e16528]:focus{box-shadow:0 0 0 2px color-mix(in srgb, var(--nb-c-primary) 30%, transparent);outline:none}.nb-inline-edit__input--multiline[data-v-a0e16528]{resize:none;display:block;overflow:hidden}.nb-inline-edit__text--md[data-v-a0e16528],.nb-inline-edit__input--md[data-v-a0e16528]{font-family:var(--nb-type-body-md-family,var(--nb-font-family-sans));font-size:var(--nb-type-body-md-size);font-weight:var(--nb-type-body-md-weight);line-height:var(--nb-type-body-md-line-height);letter-spacing:var(--nb-type-body-md-letter-spacing,normal)}.nb-inline-edit__text--lg[data-v-a0e16528],.nb-inline-edit__input--lg[data-v-a0e16528]{font-family:var(--nb-type-heading-01-family,var(--nb-font-family-sans));font-size:var(--nb-type-heading-01-size);font-weight:var(--nb-type-heading-01-weight);line-height:var(--nb-type-heading-01-line-height);letter-spacing:var(--nb-type-heading-01-letter-spacing,normal)}.nb-inline-edit__text--xl[data-v-a0e16528],.nb-inline-edit__input--xl[data-v-a0e16528]{font-family:var(--nb-type-heading-02-family,var(--nb-font-family-sans));font-size:var(--nb-type-heading-02-size);font-weight:var(--nb-type-heading-02-weight);line-height:var(--nb-type-heading-02-line-height);letter-spacing:var(--nb-type-heading-02-letter-spacing,normal)}@media (width<=671.98px) and (pointer:coarse),(pointer:coarse) and (hover:none) and (height<=500px){.nb-inline-edit__input--md[data-v-a0e16528]{font-size:max(16px, var(--nb-type-body-md-size))}.nb-inline-edit__input--lg[data-v-a0e16528]{font-size:max(16px, var(--nb-type-heading-01-size))}.nb-inline-edit__input--xl[data-v-a0e16528]{font-size:max(16px, var(--nb-type-heading-02-size))}}
74
74
  .nb-input-group[data-v-ab65cfc9]{gap:var(--nb-field-label-gap);min-width:0;font-family:var(--nb-font-family-sans);--field-h:var(--nb-field-height-md);flex-direction:column;display:flex}.nb-input-group--xs[data-v-ab65cfc9]{--field-h:var(--nb-field-height-xs)}.nb-input-group--sm[data-v-ab65cfc9]{--field-h:var(--nb-field-height-sm)}.nb-input-group--md[data-v-ab65cfc9]{--field-h:var(--nb-field-height-md)}.nb-input-group--lg[data-v-ab65cfc9]{--field-h:var(--nb-field-height-lg)}.nb-input-group__row[data-v-ab65cfc9]{align-items:flex-start;min-width:0;display:flex}.nb-input-group__row[data-v-ab65cfc9]>*{flex:auto;min-width:0}.nb-input-group__row[data-v-ab65cfc9]>.nb-button{height:var(--field-h);flex:none}.nb-input-group__row[data-v-ab65cfc9]>.nb-button--icon-only{width:var(--field-h)}.nb-input-group__row[data-v-ab65cfc9]>:not(:first-child){--nb-field-radius-start:0;margin-inline-start:calc(-1 * var(--nb-field-border-width,0px))}.nb-input-group__row[data-v-ab65cfc9]>:not(:last-child){--nb-field-radius-end:0}.nb-input-group__row[data-v-ab65cfc9]>.nb-button:not(:first-child){border-start-start-radius:0;border-end-start-radius:0}.nb-input-group__row[data-v-ab65cfc9]>.nb-button:not(:last-child){border-start-end-radius:0;border-end-end-radius:0}.nb-input-group__row[data-v-ab65cfc9]>:focus-within,.nb-input-group__row[data-v-ab65cfc9]>:focus-visible{z-index:1;position:relative}.nb-input-group__message[data-v-ab65cfc9]{font-size:var(--nb-type-body-sm-size)}
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){if(!e.width||!e.height||t.width<=0||t.height<=0)return{width:0,height:0};let n=e.width/e.height;return n>t.width/t.height?{width:t.width,height:t.width/n}:{width:t.height*n,height:t.height}}function t(e,t,n){if(n){let t=Math.min(e.width,e.height)*.5;return{x:(e.width-t)/2,y:(e.height-t)/2,width:t,height:t}}return t===`full`?{x:0,y:0,width:e.width,height:e.height}:{x:e.width*.25,y:e.height*.25,width:e.width*.5,height:e.height*.5}}function n(e,t,n){let r=t.width?n.width/t.width:1,i=t.height?n.height/t.height:1;return{x:(e.x-t.left)*r,y:(e.y-t.top)*i}}function r(e,t,n){let r=t.width?n.width/t.width:1,i=t.height?n.height/t.height:1;return{x:e.x*r,y:e.y*i,width:e.width*r,height:e.height*i}}exports.fitImage=e,exports.initialCropRect=t,exports.rescaleRect=r,exports.toCanvasPoint=n;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The arithmetic behind `NbImageCropper`, kept out of the component so it can
3
+ * be tested without a canvas.
4
+ */
5
+ interface ISize {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface IRect {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ /**
16
+ * How large to draw an image so it fits a box, keeping its proportions.
17
+ *
18
+ * @param image The image's natural size.
19
+ * @param box The largest size it may be drawn at.
20
+ */
21
+ export declare function fitImage(image: ISize, box: ISize): ISize;
22
+ /**
23
+ * Where the crop area starts on a drawn image.
24
+ *
25
+ * `center` is half the image, centred, the cropper's long-standing default:
26
+ * a picture to be cut down to one part of it. `full` is the whole image, for
27
+ * a photograph whose edges only need trimming, such as a scanned page.
28
+ * `square` (circle crops and a locked aspect ratio) is half the shorter side,
29
+ * centred, whatever `initial` asks for, so a square never starts stretched.
30
+ *
31
+ * @param drawn The size the image is drawn at.
32
+ * @param initial Where to start.
33
+ * @param square Whether the crop area must be square.
34
+ */
35
+ export declare function initialCropRect(drawn: ISize, initial: 'center' | 'full', square: boolean): IRect;
36
+ /**
37
+ * A pointer position in the canvas's own pixels.
38
+ *
39
+ * The canvas can be drawn at one size and shown at another (CSS shrinks it to
40
+ * fit a narrow container), so a position measured on screen is scaled by the
41
+ * ratio between the two. Without that, a drag on a shrunk canvas lands short
42
+ * of where the finger is.
43
+ *
44
+ * @param client The pointer position, in viewport pixels.
45
+ * @param shown The canvas's on-screen box (`getBoundingClientRect()`).
46
+ * @param drawn The canvas's own size (`canvas.width`, `canvas.height`).
47
+ */
48
+ export declare function toCanvasPoint(client: {
49
+ x: number;
50
+ y: number;
51
+ }, shown: {
52
+ left: number;
53
+ top: number;
54
+ width: number;
55
+ height: number;
56
+ }, drawn: ISize): {
57
+ x: number;
58
+ y: number;
59
+ };
60
+ /**
61
+ * The same crop area on the image drawn at a new size, so resizing the window
62
+ * keeps what the person chose.
63
+ */
64
+ export declare function rescaleRect(rect: IRect, from: ISize, to: ISize): IRect;
65
+ export {};
66
+ //# sourceMappingURL=cropGeometry.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cropGeometry.helper.d.ts","sourceRoot":"","sources":["../../src/utils/cropGeometry.helper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,KAAK;IACb,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,KAAK,CASxD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,QAAQ,GAAG,MAAM,EAC1B,MAAM,EAAE,OAAO,GACd,KAAK,CAmBP;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACnE,KAAK,EAAE,KAAK,GACX;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAI1B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,KAAK,CAStE"}
@@ -0,0 +1,55 @@
1
+ //#region src/utils/cropGeometry.helper.ts
2
+ function e(e, t) {
3
+ if (!e.width || !e.height || t.width <= 0 || t.height <= 0) return {
4
+ width: 0,
5
+ height: 0
6
+ };
7
+ let n = e.width / e.height;
8
+ return n > t.width / t.height ? {
9
+ width: t.width,
10
+ height: t.width / n
11
+ } : {
12
+ width: t.height * n,
13
+ height: t.height
14
+ };
15
+ }
16
+ function t(e, t, n) {
17
+ if (n) {
18
+ let t = Math.min(e.width, e.height) * .5;
19
+ return {
20
+ x: (e.width - t) / 2,
21
+ y: (e.height - t) / 2,
22
+ width: t,
23
+ height: t
24
+ };
25
+ }
26
+ return t === "full" ? {
27
+ x: 0,
28
+ y: 0,
29
+ width: e.width,
30
+ height: e.height
31
+ } : {
32
+ x: e.width * .25,
33
+ y: e.height * .25,
34
+ width: e.width * .5,
35
+ height: e.height * .5
36
+ };
37
+ }
38
+ function n(e, t, n) {
39
+ let r = t.width ? n.width / t.width : 1, i = t.height ? n.height / t.height : 1;
40
+ return {
41
+ x: (e.x - t.left) * r,
42
+ y: (e.y - t.top) * i
43
+ };
44
+ }
45
+ function r(e, t, n) {
46
+ let r = t.width ? n.width / t.width : 1, i = t.height ? n.height / t.height : 1;
47
+ return {
48
+ x: e.x * r,
49
+ y: e.y * i,
50
+ width: e.width * r,
51
+ height: e.height * i
52
+ };
53
+ }
54
+ //#endregion
55
+ export { e as fitImage, t as initialCropRect, r as rescaleRect, n as toCanvasPoint };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubisco/ui",
3
- "version": "5.63.0",
3
+ "version": "5.64.0",
4
4
  "description": "Vue 3 UI component library",
5
5
  "packageManager": "pnpm@12.3.4+sha512.961aa41fb077da3a04a441d9f8e15ebc0c96da8ef710b2eb67bf9ee7cb0610eabd48f1fd85f51cffe73846785fa0f87c56a3a872a1d893f8446741b5cce45457",
6
6
  "repository": {
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The arithmetic behind `NbImageCropper`, kept out of the component so it can
3
+ * be tested without a canvas.
4
+ */
5
+
6
+ interface ISize {
7
+ width: number
8
+ height: number
9
+ }
10
+
11
+ interface IRect {
12
+ x: number
13
+ y: number
14
+ width: number
15
+ height: number
16
+ }
17
+
18
+ /**
19
+ * How large to draw an image so it fits a box, keeping its proportions.
20
+ *
21
+ * @param image The image's natural size.
22
+ * @param box The largest size it may be drawn at.
23
+ */
24
+ export function fitImage(image: ISize, box: ISize): ISize {
25
+ if (!image.width || !image.height || box.width <= 0 || box.height <= 0) {
26
+ return { width: 0, height: 0 }
27
+ }
28
+ const aspect = image.width / image.height
29
+ if (aspect > box.width / box.height) {
30
+ return { width: box.width, height: box.width / aspect }
31
+ }
32
+ return { width: box.height * aspect, height: box.height }
33
+ }
34
+
35
+ /**
36
+ * Where the crop area starts on a drawn image.
37
+ *
38
+ * `center` is half the image, centred, the cropper's long-standing default:
39
+ * a picture to be cut down to one part of it. `full` is the whole image, for
40
+ * a photograph whose edges only need trimming, such as a scanned page.
41
+ * `square` (circle crops and a locked aspect ratio) is half the shorter side,
42
+ * centred, whatever `initial` asks for, so a square never starts stretched.
43
+ *
44
+ * @param drawn The size the image is drawn at.
45
+ * @param initial Where to start.
46
+ * @param square Whether the crop area must be square.
47
+ */
48
+ export function initialCropRect(
49
+ drawn: ISize,
50
+ initial: 'center' | 'full',
51
+ square: boolean,
52
+ ): IRect {
53
+ if (square) {
54
+ const side = Math.min(drawn.width, drawn.height) * 0.5
55
+ return {
56
+ x: (drawn.width - side) / 2,
57
+ y: (drawn.height - side) / 2,
58
+ width: side,
59
+ height: side,
60
+ }
61
+ }
62
+ if (initial === 'full') {
63
+ return { x: 0, y: 0, width: drawn.width, height: drawn.height }
64
+ }
65
+ return {
66
+ x: drawn.width * 0.25,
67
+ y: drawn.height * 0.25,
68
+ width: drawn.width * 0.5,
69
+ height: drawn.height * 0.5,
70
+ }
71
+ }
72
+
73
+ /**
74
+ * A pointer position in the canvas's own pixels.
75
+ *
76
+ * The canvas can be drawn at one size and shown at another (CSS shrinks it to
77
+ * fit a narrow container), so a position measured on screen is scaled by the
78
+ * ratio between the two. Without that, a drag on a shrunk canvas lands short
79
+ * of where the finger is.
80
+ *
81
+ * @param client The pointer position, in viewport pixels.
82
+ * @param shown The canvas's on-screen box (`getBoundingClientRect()`).
83
+ * @param drawn The canvas's own size (`canvas.width`, `canvas.height`).
84
+ */
85
+ export function toCanvasPoint(
86
+ client: { x: number; y: number },
87
+ shown: { left: number; top: number; width: number; height: number },
88
+ drawn: ISize,
89
+ ): { x: number; y: number } {
90
+ const sx = shown.width ? drawn.width / shown.width : 1
91
+ const sy = shown.height ? drawn.height / shown.height : 1
92
+ return { x: (client.x - shown.left) * sx, y: (client.y - shown.top) * sy }
93
+ }
94
+
95
+ /**
96
+ * The same crop area on the image drawn at a new size, so resizing the window
97
+ * keeps what the person chose.
98
+ */
99
+ export function rescaleRect(rect: IRect, from: ISize, to: ISize): IRect {
100
+ const sx = from.width ? to.width / from.width : 1
101
+ const sy = from.height ? to.height / from.height : 1
102
+ return {
103
+ x: rect.x * sx,
104
+ y: rect.y * sy,
105
+ width: rect.width * sx,
106
+ height: rect.height * sy,
107
+ }
108
+ }
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-D0Q0f7-M.cjs`),t=require(`./Grid-tn5_R2fP.cjs`),n=require(`./vue-i18n-BaeznwnA.cjs`);let r=require(`vue`);var i=function(e){return e.TopLeft=`top-left`,e.Top=`top`,e.TopRight=`top-right`,e.Right=`right`,e.BottomRight=`bottom-right`,e.Bottom=`bottom`,e.BottomLeft=`bottom-left`,e.Left=`left`,e}(i||{}),a={class:`nb-image-cropper`},o=[`onMousedown`,`onTouchstart`],s=[`src`,`alt`],c=700,l=400,u=(0,r.defineComponent)({__name:`ImageCropper`,props:{image:{},cropAsCircle:{type:Boolean,default:!1},outputAsCircle:{type:Boolean,default:!1},lockAspectRatio:{type:Boolean,default:!1},showPreview:{type:Boolean,default:!1}},emits:[`crop`],setup(e,{emit:u}){let d={en:{X:`X`,Y:`Y`,WIDTH:`Width`,HEIGHT:`Height`,IMAGE_THUMBNAIL:`Cropped preview`},pt:{X:`X`,Y:`Y`,WIDTH:`Largura`,HEIGHT:`Altura`,IMAGE_THUMBNAIL:`Pré-visualização recortada`}},{t:f,te:p,locale:m}=n.t({useScope:`global`});function h(e){if(p(e))return f(e);let t=e.slice(7);return d[String(m.value).toLowerCase().split(`-`)[0]]?.[t]??d.en[t]??e}let g=e,_=u,v=(0,r.ref)(null),y=null,b=new Image,x=null,S={x:1,y:1},C=(0,r.ref)({x:50,y:50,width:200,height:200}),w=(0,r.ref)(null),T=(0,r.ref)(null),E=!1,D=!1,O={x:0,y:0},k=!1,A={x:0,y:0},j={x:0,y:0,width:0,height:0},M=null,N=!1,P=[{name:i.TopLeft},{name:i.Top},{name:i.TopRight},{name:i.Right},{name:i.BottomRight},{name:i.Bottom},{name:i.BottomLeft},{name:i.Left}],F=()=>{if(!g.image){console.error(`No image file provided`);return}x&&=(URL.revokeObjectURL(x),null),b.onload=()=>{let{drawWidth:e,drawHeight:t}=I();if(v.value){v.value.width=e,v.value.height=t;let n=(v.value.width-b.width*S.x)/2,r=(v.value.height-b.height*S.y)/2;if(g.cropAsCircle||g.lockAspectRatio){let e=Math.min(b.width*S.x,b.height*S.y)*.5;C.value={x:n+(b.width*S.x-e)/2,y:r+(b.height*S.y-e)/2,width:e,height:e}}else C.value={x:n+(b.width*S.x*.5-b.width*S.x*.25),y:r+(b.height*S.y*.5-b.height*S.y*.25),width:b.width*S.x*.5,height:b.height*S.y*.5};L(),Q()}},b.onerror=()=>{console.error(`Failed to load image`)},x=URL.createObjectURL(g.image),b.src=x};(0,r.onMounted)(()=>{v.value&&(y=v.value.getContext(`2d`),y&&(y.imageSmoothingEnabled=!0,y.imageSmoothingQuality=`high`),g.image&&F())}),(0,r.onBeforeUnmount)(()=>{x&&=(URL.revokeObjectURL(x),null);let e=w.value;e&&(URL.revokeObjectURL(e),w.value=null)}),(0,r.watch)(()=>g.image,e=>{e&&F()}),(0,r.watch)(()=>[g.cropAsCircle,g.outputAsCircle,g.lockAspectRatio],()=>{v.value&&y&&L()});let I=()=>{let e=b.width/b.height,t=c,n=l;return e>c/l?n=c/e:t=l*e,S.x=t/b.width,S.y=n/b.height,{drawWidth:t,drawHeight:n}},L=()=>{if(y&&v.value){y.clearRect(0,0,v.value.width,v.value.height);let e=(v.value.width-b.width*S.x)/2,t=(v.value.height-b.height*S.y)/2;y.drawImage(b,0,0,b.width,b.height,e,t,b.width*S.x,b.height*S.y),R()}},R=()=>{y&&v.value&&(y.save(),y.beginPath(),g.cropAsCircle?y.arc(C.value.x+C.value.width/2,C.value.y+C.value.height/2,C.value.width/2,0,Math.PI*2):y.rect(C.value.x,C.value.y,C.value.width,C.value.height),y.rect(0,0,v.value.width,v.value.height),y.clip(`evenodd`),y.fillStyle=`rgba(0, 0, 0, 0.5)`,y.fillRect(0,0,v.value.width,v.value.height),y.restore(),y.save(),y.strokeStyle=`rgba(255, 255, 255, 0.8)`,y.lineWidth=1,y.setLineDash([5,5]),y.imageSmoothingEnabled=!1,g.cropAsCircle?(y.beginPath(),y.arc(C.value.x+C.value.width/2,C.value.y+C.value.height/2,C.value.width/2,0,Math.PI*2),y.stroke()):y.strokeRect(C.value.x,C.value.y,C.value.width,C.value.height),y.restore())},z=(0,r.computed)(()=>{if(g.cropAsCircle){let e=C.value.x+C.value.width/2,t=C.value.y+C.value.height/2,n=C.value.width/2;return{"top-left":{left:`${e-n-5}px`,top:`${t-n-5}px`},top:{left:`${e-5}px`,top:`${t-n-5}px`},"top-right":{left:`${e+n-5}px`,top:`${t-n-5}px`},right:{left:`${e+n-5}px`,top:`${t-5}px`},"bottom-right":{left:`${e+n-5}px`,top:`${t+n-5}px`},bottom:{left:`${e-5}px`,top:`${t+n-5}px`},"bottom-left":{left:`${e-n-5}px`,top:`${t+n-5}px`},left:{left:`${e-n-5}px`,top:`${t-5}px`}}}else return{"top-left":{left:`${C.value.x-5}px`,top:`${C.value.y-5}px`},top:{left:`${C.value.x+C.value.width/2-5}px`,top:`${C.value.y-5}px`},"top-right":{left:`${C.value.x+C.value.width-5}px`,top:`${C.value.y-5}px`},right:{left:`${C.value.x+C.value.width-5}px`,top:`${C.value.y+C.value.height/2-5}px`},"bottom-right":{left:`${C.value.x+C.value.width-5}px`,top:`${C.value.y+C.value.height-5}px`},bottom:{left:`${C.value.x+C.value.width/2-5}px`,top:`${C.value.y+C.value.height-5}px`},"bottom-left":{left:`${C.value.x-5}px`,top:`${C.value.y+C.value.height-5}px`},left:{left:`${C.value.x-5}px`,top:`${C.value.y+C.value.height/2-5}px`}}}),B=e=>{if(`touches`in e&&e.touches.length>0){let t=e.touches[0];return{clientX:t.clientX,clientY:t.clientY}}else if(`clientX`in e&&`clientY`in e)return{clientX:e.clientX,clientY:e.clientY};return{clientX:0,clientY:0}},V=e=>{let t=v.value;if(!t)return null;let{clientX:n,clientY:r}=B(e),{left:i,top:a}=t.getBoundingClientRect();return{x:n-i,y:r-a}},H=e=>{e.preventDefault();let t=V(e);if(!t)return;let{x:n,y:r}=t;X(n,r)&&(D=!0,E=!0,O={x:n-C.value.x,y:r-C.value.y})},U=e=>{D?G(e):k&&J(e)},W=()=>{D&&(K(),D=!1,Q()),k&&(Y(),Q()),E=!1,D=!1},G=e=>{if(E){let t=V(e);if(!t)return;let{x:n,y:r}=t;C.value.x=Math.floor(n-O.x),C.value.y=Math.floor(r-O.y),L()}},K=()=>{E&&=(Z(),L(),!1)},q=(e,t)=>{e.preventDefault();let n=V(e);n&&(k=!0,M=t,A={x:n.x,y:n.y},j={...C.value},N=e instanceof MouseEvent&&e.shiftKey)},J=e=>{if(!k)return;if(g.lockAspectRatio&&v.value){let t=V(e);if(!t)return;let{x:n,y:r}=t,i=j.x+j.width/2,a=j.y+j.height/2;if(g.cropAsCircle){let e=Math.max(Math.abs(n-i),Math.abs(r-a)),t=e*2;C.value={x:i-e,y:a-e,width:t,height:t}}else{let e=j.width/j.height,t=Math.abs(n-i),r=Math.max(t*2,50),o=r/e;C.value={x:i-r/2,y:a-o/2,width:r,height:o}}L();return}let t=V(e);if(!t)return;let{x:n,y:r}=t,i=n-A.x,a=r-A.y;N=e instanceof MouseEvent&&e.shiftKey;let o={...j};switch(M){case`top-left`:o.x+=i,o.y+=a,o.width-=i,o.height-=a;break;case`top`:o.y+=a,o.height-=a;break;case`top-right`:o.y+=a,o.width+=i,o.height-=a;break;case`right`:o.width+=i;break;case`bottom-right`:o.width+=i,o.height+=a;break;case`bottom`:o.height+=a;break;case`bottom-left`:o.x+=i,o.width-=i,o.height+=a;break;case`left`:o.x+=i,o.width-=i;break}if(o.width<50&&(o.width=50),o.height<50&&(o.height=50),N&&M){let e=j.width/j.height;[`left`,`right`].includes(M)?(o.height=o.width/e,M===`left`&&(o.y=j.y-(o.height-j.height)/2)):[`top`,`bottom`].includes(M)&&(o.width=o.height*e,M===`top`&&(o.x=j.x-(o.width-j.width)/2))}C.value=o,L()},Y=()=>{k&&(Z(),L(),k=!1,M=null)},X=(e,t)=>{if(g.cropAsCircle){let n=C.value.x+C.value.width/2,r=C.value.y+C.value.height/2,i=C.value.width/2,a=e-n,o=t-r;return a*a+o*o<=i*i}else return e>=C.value.x-2&&e<=C.value.x+C.value.width+2&&t>=C.value.y-2&&t<=C.value.y+C.value.height+2},Z=()=>{let e=v.value.width,t=v.value.height;if(C.value.width<50&&(C.value.width=50),C.value.height<50&&(C.value.height=50),g.lockAspectRatio)if(g.cropAsCircle)C.value.height=C.value.width;else{let e=j.width/j.height;C.value.height=C.value.width/e}else if(N){let e=j.width/j.height;C.value.height=C.value.width/e}if(g.cropAsCircle||g.lockAspectRatio){let n=C.value.width/C.value.height;(C.value.width>e||C.value.height>t)&&(C.value.width>C.value.height?(C.value.width=e,C.value.height=e/n):(C.value.height=t,C.value.width=t*n)),C.value.x<0&&(C.value.x=0),C.value.y<0&&(C.value.y=0),C.value.x+C.value.width>e&&(C.value.x=e-C.value.width),C.value.y+C.value.height>t&&(C.value.y=t-C.value.height)}else C.value.x<0&&(C.value.x=0),C.value.y<0&&(C.value.y=0),C.value.width>e&&(C.value.width=e,C.value.x=0),C.value.height>t&&(C.value.height=t,C.value.y=0),C.value.x+C.value.width>e&&(C.value.x=e-C.value.width),C.value.y+C.value.height>t&&(C.value.y=t-C.value.height)},Q=()=>{if(v.value&&y){let e=(v.value.width-b.width*S.x)/2,t=(v.value.height-b.height*S.y)/2,n=(C.value.x-e)/S.x,r=(C.value.y-t)/S.y,i=C.value.width/S.x,a=C.value.height/S.y,o={x:Math.round(n),y:Math.round(r),width:Math.round(i),height:Math.round(a)},s=Math.max(0,Math.min(o.x,b.width)),c=Math.max(0,Math.min(o.y,b.height)),l=Math.min(o.width,b.width-s),u=Math.min(o.height,b.height-c),d=document.createElement(`canvas`);d.width=l,d.height=u;let f=d.getContext(`2d`);f&&(f.drawImage(b,s,c,l,u,0,0,l,u),g.cropAsCircle&&g.outputAsCircle&&(f.globalCompositeOperation=`destination-in`,f.beginPath(),f.arc(l/2,u/2,l/2,0,Math.PI*2),f.closePath(),f.fill(),f.globalCompositeOperation=`source-over`),d.toBlob(e=>{if(e){let t=w.value;t&&URL.revokeObjectURL(t),w.value=URL.createObjectURL(e),T.value=o,_(`crop`,{blob:e,geometry:o})}},`image/jpeg`,.8))}};return(0,r.watch)(()=>g,()=>{Q()},{deep:!0}),(n,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,a,[(0,r.createElementVNode)(`div`,{class:`canvas-container`,onMousedown:H,onMousemove:U,onMouseup:W,onMouseleave:W,onTouchstart:H,onTouchmove:U,onTouchend:W},[(0,r.createElementVNode)(`canvas`,{ref_key:`canvas`,ref:v},null,512),((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(P,e=>(0,r.createElementVNode)(`div`,{key:e.name,class:(0,r.normalizeClass)([`resize-handle`,e.name]),style:(0,r.normalizeStyle)(z.value[e.name]),onMousedown:(0,r.withModifiers)(t=>q(t,e.name),[`stop`]),onTouchstart:(0,r.withModifiers)(t=>q(t,e.name),[`stop`])},null,46,o)),64))],32),e.showPreview&&w.value&&T.value?((0,r.openBlock)(),(0,r.createBlock)(t.t,{key:0,class:`cropped-image-preview`},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(t.t,{is:`ul`,dir:`col`,justify:`center`,gap:`sm`},{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)(`li`,null,[(0,r.createElementVNode)(`strong`,null,(0,r.toDisplayString)(h(`common.X`)),1),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(T.value.x.toFixed(0)),1)]),(0,r.createElementVNode)(`li`,null,[(0,r.createElementVNode)(`strong`,null,(0,r.toDisplayString)(h(`common.Y`)),1),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(T.value.y.toFixed(0)),1)]),(0,r.createElementVNode)(`li`,null,[(0,r.createElementVNode)(`strong`,null,(0,r.toDisplayString)(h(`common.WIDTH`)),1),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(T.value.width.toFixed(0)),1)]),(0,r.createElementVNode)(`li`,null,[(0,r.createElementVNode)(`strong`,null,(0,r.toDisplayString)(h(`common.HEIGHT`)),1),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(T.value.height.toFixed(0)),1)])]),_:1}),(0,r.createElementVNode)(`img`,{src:w.value,alt:h(`common.IMAGE_THUMBNAIL`)},null,8,s)]),_:1})):(0,r.createCommentVNode)(``,!0)]))}}),d=e.t(u,[[`__scopeId`,`data-v-057c9675`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}});