polotno 3.5.2 → 3.7.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.
Files changed (128) hide show
  1. package/LICENSE.md +22 -7
  2. package/README.md +1 -1
  3. package/blueprint/toolbar/image-toolbar.d.ts +2 -2
  4. package/blueprint/toolbar/sketch.js +1 -1
  5. package/blueprint.polotno.css +116 -116
  6. package/canvas/apply-filters.d.ts +1 -1
  7. package/canvas/audio.js +1 -1
  8. package/canvas/context-menu/context-menu.d.ts +2 -2
  9. package/canvas/figure-element.js +1 -1
  10. package/canvas/gif-element.js +1 -1
  11. package/canvas/html-element.js +1 -1
  12. package/canvas/image-element.d.ts +11 -0
  13. package/canvas/image-element.js +1 -1
  14. package/canvas/page-controls.d.ts +1 -1
  15. package/canvas/page.js +1 -1
  16. package/canvas/render-tag-element.js +1 -1
  17. package/canvas/rich-editor.d.ts +0 -4
  18. package/canvas/rich-editor.js +2 -2
  19. package/canvas/rules.d.ts +1 -1
  20. package/canvas/text-element.js +1 -1
  21. package/canvas/tooltip.d.ts +2 -2
  22. package/canvas/use-mediabunny-video.js +1 -1
  23. package/canvas/video-element.js +1 -1
  24. package/hooks/use-event.js +1 -1
  25. package/icons/meronex.js +1 -1
  26. package/icons/registry.d.ts +1 -0
  27. package/icons/registry.js +1 -1
  28. package/model/audio-model.d.ts +2 -0
  29. package/model/audio-model.js +1 -1
  30. package/model/image-model.js +1 -1
  31. package/model/store.d.ts +3 -0
  32. package/model/store.js +1 -1
  33. package/package.json +30 -30
  34. package/pages-timeline/audio-track.d.ts +3 -2
  35. package/pages-timeline/audio-track.js +1 -1
  36. package/pages-timeline/audios.js +1 -1
  37. package/pages-timeline/current-time.js +1 -1
  38. package/pages-timeline/element-track.js +1 -1
  39. package/pages-timeline/index.d.ts +1 -1
  40. package/pages-timeline/index.js +1 -1
  41. package/pages-timeline/page-preview.js +1 -1
  42. package/pages-timeline/pages-timeline.js +1 -1
  43. package/pages-timeline/pages.js +1 -1
  44. package/pages-timeline/play-button.d.ts +1 -1
  45. package/pages-timeline/play-button.js +1 -1
  46. package/pages-timeline/time-ruler.js +1 -1
  47. package/pages-timeline/track-styles.d.ts +9 -0
  48. package/pages-timeline/track-styles.js +1 -1
  49. package/polotno.bundle.js +200 -201
  50. package/primitives/button-group.d.ts +2 -2
  51. package/primitives/button.d.ts +2 -2
  52. package/primitives/dialog.d.ts +2 -2
  53. package/primitives/dropdown-menu.d.ts +2 -2
  54. package/primitives/field-group.d.ts +1 -1
  55. package/primitives/field-row.d.ts +1 -1
  56. package/primitives/floating-control.js +2 -2
  57. package/primitives/index.d.ts +27 -27
  58. package/primitives/input-group.d.ts +2 -2
  59. package/primitives/input.d.ts +1 -1
  60. package/primitives/navbar.d.ts +5 -5
  61. package/primitives/numeric-input.d.ts +1 -1
  62. package/primitives/overflow-list.d.ts +1 -1
  63. package/primitives/panel-header.d.ts +1 -1
  64. package/primitives/popover.d.ts +2 -2
  65. package/primitives/portal-scope.d.ts +3 -3
  66. package/primitives/search-input.d.ts +1 -1
  67. package/primitives/select.d.ts +3 -3
  68. package/primitives/separator.d.ts +1 -1
  69. package/primitives/slider-field.d.ts +1 -1
  70. package/primitives/slider.d.ts +2 -2
  71. package/primitives/spinner.d.ts +1 -1
  72. package/primitives/switch.d.ts +1 -1
  73. package/primitives/tabs.d.ts +2 -2
  74. package/primitives/textarea.d.ts +1 -1
  75. package/primitives/toggle-group.d.ts +4 -4
  76. package/primitives/toggle.d.ts +3 -3
  77. package/primitives/tooltip-icon-button.d.ts +4 -4
  78. package/primitives/tooltip.d.ts +2 -2
  79. package/side-panel/background-panel.d.ts +2 -2
  80. package/side-panel/draw-panel.d.ts +2 -2
  81. package/side-panel/elements-panel.d.ts +2 -2
  82. package/side-panel/images-grid.js +1 -1
  83. package/side-panel/index.d.ts +35 -35
  84. package/side-panel/photos-panel.d.ts +1 -1
  85. package/side-panel/select-gif.d.ts +1 -1
  86. package/side-panel/side-panel.d.ts +5 -5
  87. package/side-panel/size-panel.d.ts +3 -3
  88. package/side-panel/tab-button.d.ts +1 -1
  89. package/side-panel/tab-button.js +2 -2
  90. package/side-panel/templates-panel.d.ts +2 -2
  91. package/side-panel/unsplash-credit.d.ts +1 -1
  92. package/side-panel/upload-panel.d.ts +3 -3
  93. package/side-panel/upload-panel.js +1 -1
  94. package/side-panel/videos-grid.js +1 -1
  95. package/themes/blueprint.css +1 -1
  96. package/themes/carbon.css +127 -128
  97. package/toolbar/download-button.d.ts +2 -2
  98. package/toolbar/element-container.d.ts +1 -1
  99. package/toolbar/filters-picker.d.ts +1 -1
  100. package/toolbar/group-toolbar.d.ts +2 -2
  101. package/toolbar/history-buttons.d.ts +1 -1
  102. package/toolbar/image-remove-background-button.d.ts +1 -1
  103. package/toolbar/image-toolbar.d.ts +1 -1
  104. package/toolbar/index.d.ts +34 -34
  105. package/toolbar/many-toolbar.d.ts +2 -2
  106. package/toolbar/opacity-picker.d.ts +1 -1
  107. package/toolbar/page-toolbar.d.ts +3 -3
  108. package/toolbar/toolbar.d.ts +3 -3
  109. package/toolbar/video-toolbar.js +1 -1
  110. package/toolbar/zoom-buttons.d.ts +1 -1
  111. package/ui-types.d.ts +8 -8
  112. package/ui.css +2 -2
  113. package/utils/array.js +1 -1
  114. package/utils/file.d.ts +3 -0
  115. package/utils/file.js +1 -1
  116. package/utils/html-to-svg/svg-builder.d.ts +1 -1
  117. package/utils/insert-file.d.ts +3 -2
  118. package/utils/insert-file.js +1 -1
  119. package/utils/l10n.d.ts +4 -0
  120. package/utils/l10n.js +1 -1
  121. package/utils/media.d.ts +6 -0
  122. package/utils/media.js +1 -0
  123. package/utils/pointer-drag.d.ts +13 -0
  124. package/utils/pointer-drag.js +1 -0
  125. package/utils/px.d.ts +2 -0
  126. package/utils/px.js +1 -1
  127. package/utils/text-format-state.js +1 -1
  128. package/utils/validate-key.js +1 -1
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  declare const ButtonGroup: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
4
4
  orientation?: "horizontal" | "vertical" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  declare const buttonVariants: (props?: ({
4
4
  variant?: "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
5
5
  size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | null | undefined;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
1
+ import * as React from 'react';
2
+ import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
3
3
  declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
4
4
  declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): React.JSX.Element;
5
5
  declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): React.JSX.Element;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Menu as MenuPrimitive } from "@base-ui/react/menu";
1
+ import * as React from 'react';
2
+ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
3
3
  declare function DropdownMenu({ ...props }: React.ComponentProps<typeof MenuPrimitive.Root>): React.JSX.Element;
4
4
  declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof MenuPrimitive.Portal>): React.JSX.Element;
5
5
  declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof MenuPrimitive.Trigger>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare function FieldGroup({ label, enabled, onEnabledChange, visible, disabled, className, children, }: {
3
3
  label: React.ReactNode;
4
4
  enabled?: boolean;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const FieldRow: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
3
3
  label: React.ReactNode;
4
4
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,2 +1,2 @@
1
- import { cva } from "class-variance-authority";
2
- export const floatingControl = cva("pn:h-[35px] pn:rounded-md pn:bg-background pn:shadow-md");
1
+ import { cva } from 'class-variance-authority';
2
+ export const floatingControl = cva('pn:h-[35px] pn:rounded-md pn:bg-background pn:shadow-md');
@@ -1,27 +1,27 @@
1
- export { Button, buttonVariants } from "./button.js";
2
- export { Input } from "./input.js";
3
- export { Textarea } from "./textarea.js";
4
- export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, } from "./select.js";
5
- export { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
6
- export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./tooltip.js";
7
- export { Slider } from "./slider.js";
8
- export { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
9
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./dialog.js";
10
- export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./dropdown-menu.js";
11
- export { Switch } from "./switch.js";
12
- export { Separator } from "./separator.js";
13
- export { Toggle, toggleVariants } from "./toggle.js";
14
- export { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
15
- export { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
16
- export { SearchInput } from "./search-input.js";
17
- export { Navbar, NavbarGroup, NavbarDivider } from "./navbar.js";
18
- export { NumericInput, NumberInput } from "./numeric-input.js";
19
- export { SliderField } from "./slider-field.js";
20
- export { FieldGroup } from "./field-group.js";
21
- export { FieldRow } from "./field-row.js";
22
- export { TooltipIconButton } from "./tooltip-icon-button.js";
23
- export { ButtonGroup } from "./button-group.js";
24
- export { Spinner } from "./spinner.js";
25
- export { OverflowList } from "./overflow-list.js";
26
- export { PanelHeader } from "./panel-header.js";
27
- export { cn } from "../lib/utils.js";
1
+ export { Button, buttonVariants } from './button.js';
2
+ export { Input } from './input.js';
3
+ export { Textarea } from './textarea.js';
4
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, } from './select.js';
5
+ export { Popover, PopoverContent, PopoverTrigger } from './popover.js';
6
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from './tooltip.js';
7
+ export { Slider } from './slider.js';
8
+ export { Tabs, TabsContent, TabsList, TabsTrigger } from './tabs.js';
9
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from './dialog.js';
10
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from './dropdown-menu.js';
11
+ export { Switch } from './switch.js';
12
+ export { Separator } from './separator.js';
13
+ export { Toggle, toggleVariants } from './toggle.js';
14
+ export { ToggleGroup, ToggleGroupItem } from './toggle-group.js';
15
+ export { InputGroup, InputGroupAddon, InputGroupInput } from './input-group.js';
16
+ export { SearchInput } from './search-input.js';
17
+ export { Navbar, NavbarGroup, NavbarDivider } from './navbar.js';
18
+ export { NumericInput, NumberInput } from './numeric-input.js';
19
+ export { SliderField } from './slider-field.js';
20
+ export { FieldGroup } from './field-group.js';
21
+ export { FieldRow } from './field-row.js';
22
+ export { TooltipIconButton } from './tooltip-icon-button.js';
23
+ export { ButtonGroup } from './button-group.js';
24
+ export { Spinner } from './spinner.js';
25
+ export { OverflowList } from './overflow-list.js';
26
+ export { PanelHeader } from './panel-header.js';
27
+ export { cn } from '../lib/utils.js';
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  declare const InputGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  declare const InputGroupAddon: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
5
5
  align?: "inline-end" | "inline-start" | "block-end" | "block-start" | null | undefined;
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
3
3
  export { Input };
@@ -1,12 +1,12 @@
1
- import * as React from "react";
2
- type NavbarProps = React.ComponentProps<"div"> & {
1
+ import * as React from 'react';
2
+ type NavbarProps = React.ComponentProps<'div'> & {
3
3
  height?: number;
4
4
  elevated?: boolean;
5
5
  floating?: boolean;
6
- attached?: "top" | "bottom";
6
+ attached?: 'top' | 'bottom';
7
7
  };
8
- type NavbarGroupProps = React.ComponentProps<"div"> & {
9
- align?: "left" | "right";
8
+ type NavbarGroupProps = React.ComponentProps<'div'> & {
9
+ align?: 'left' | 'right';
10
10
  };
11
11
  declare const NavbarGroup: React.ForwardRefExoticComponent<Omit<NavbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
12
12
  declare const NavbarDivider: React.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "orientation">, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const NumericInput: React.ForwardRefExoticComponent<Omit<{
3
3
  [key: string]: any;
4
4
  value: number | string;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  type ItemRender = (item: string) => React.ReactNode;
3
3
  declare const OverflowList: ({ items, itemRender, overflowBtnWidth, gap, }: {
4
4
  items: Array<string>;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare function PanelHeader({ title, onClose, }: {
3
3
  title: React.ReactNode;
4
4
  onClose: () => void;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
1
+ import * as React from 'react';
2
+ import { Popover as PopoverPrimitive } from '@base-ui/react/popover';
3
3
  declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
4
4
  declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
5
5
  type PositionerProps = React.ComponentProps<typeof PopoverPrimitive.Positioner>;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- type Scheme = "dark" | "light";
1
+ import * as React from 'react';
2
+ type Scheme = 'dark' | 'light';
3
3
  export declare function PolotnoScope({ elementRef, children, }: {
4
4
  elementRef: React.RefObject<HTMLElement | null>;
5
5
  children: React.ReactNode;
@@ -7,7 +7,7 @@ export declare function PolotnoScope({ elementRef, children, }: {
7
7
  type PortalScopeProps = {
8
8
  container?: HTMLElement;
9
9
  className: string;
10
- "data-polotno-theme"?: Scheme;
10
+ 'data-polotno-theme'?: Scheme;
11
11
  };
12
12
  export declare function usePortalScope(): PortalScopeProps;
13
13
  export {};
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  type SearchInputProps = {
3
3
  placeholder: string;
4
4
  onChange?: React.ChangeEventHandler<HTMLInputElement>;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Select as SelectPrimitive } from "@base-ui/react/select";
1
+ import * as React from 'react';
2
+ import { Select as SelectPrimitive } from '@base-ui/react/select';
3
3
  declare const Select: typeof SelectPrimitive.Root;
4
4
  declare const SelectGroup: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
@@ -15,7 +15,7 @@ declare const SelectContent: React.ForwardRefExoticComponent<Omit<Omit<import("@
15
15
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  declare const SelectLabel: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectGroupLabelProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
17
  declare const SelectItem: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectItemProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
18
- declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
+ declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
19
  declare const SelectScrollUpButton: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectScrollUpArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
20
  declare const SelectScrollDownButton: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SelectScrollDownArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
21
21
  export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const Separator: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
3
  export { Separator };
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  type SliderFieldProps = {
3
3
  label: React.ReactNode;
4
4
  value: number;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Slider as SliderPrimitive } from "@base-ui/react/slider";
1
+ import * as React from 'react';
2
+ import { Slider as SliderPrimitive } from '@base-ui/react/slider';
3
3
  declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.Root.Props<number | readonly number[]> & {
4
4
  ref?: React.Ref<HTMLDivElement> | undefined;
5
5
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const Spinner: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
3
  export { Spinner };
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const Switch: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").SwitchRootProps, "ref"> & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
3
3
  export { Switch };
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  declare const TabsList: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react").TabsListProps, "ref"> & React.RefAttributes<HTMLDivElement> & VariantProps<(props?: ({
5
5
  variant?: "default" | "line" | null | undefined;
@@ -1,3 +1,3 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  declare const Textarea: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
3
3
  export { Textarea };
@@ -1,7 +1,7 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
3
- import { ToggleGroup as ToggleGroupPrimitive } from "@base-ui/react/toggle-group";
4
- import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ import { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group';
4
+ import { Toggle as TogglePrimitive } from '@base-ui/react/toggle';
5
5
  declare const ToggleGroup: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.Props<string> & React.RefAttributes<HTMLDivElement> & VariantProps<(props?: ({
6
6
  variant?: "default" | "outline" | null | undefined;
7
7
  size?: "default" | null | undefined;
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
3
- import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ import { Toggle as TogglePrimitive } from '@base-ui/react/toggle';
4
4
  declare const toggleVariants: (props?: ({
5
5
  variant?: "default" | "outline" | null | undefined;
6
6
  size?: "default" | null | undefined;
@@ -1,10 +1,10 @@
1
- import * as React from "react";
2
- import { Button } from "./button.js";
3
- import { TooltipContent } from "./tooltip.js";
1
+ import * as React from 'react';
2
+ import { Button } from './button.js';
3
+ import { TooltipContent } from './tooltip.js';
4
4
  type TooltipIconButtonProps = React.ComponentProps<typeof Button> & {
5
5
  label: string;
6
6
  active?: boolean;
7
- side?: React.ComponentProps<typeof TooltipContent>["side"];
7
+ side?: React.ComponentProps<typeof TooltipContent>['side'];
8
8
  hideTooltipWhenDisabled?: boolean;
9
9
  };
10
10
  declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
1
+ import * as React from 'react';
2
+ import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';
3
3
  declare function TooltipProvider({ delay, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
4
4
  declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
5
5
  declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
3
  export declare const setDefaultQuery: (query: string) => void;
4
4
  export declare const setBackgroundColorsPreset: (newColors: string[]) => void;
5
5
  export declare const BackgroundPanel: (({ store }: {
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
3
  export declare const DrawPanel: (({ store }: {
4
4
  store: StoreType;
5
5
  }) => React.JSX.Element) & {
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
3
  export declare const NounprojectPanel: ({ store, query, }: {
4
4
  store: StoreType;
5
5
  query: string;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import t from"react";import{registerNextDomDrop as r}from"../canvas/page.js";import{t as l}from"../utils/l10n.js";import{cn as o}from"../lib/utils.js";import{Spinner as a}from"../primitives/spinner.js";const i=({url:t,credit:l,onSelect:a,crossOrigin:i,shadowEnabled:s,itemHeight:p,className:c,onLoad:d,alt:m})=>{const u=null==s||s;return e("div",{role:"button",onClick:()=>{a()},className:"polotno-close-panel pn:group/img-wrap pn:p-[5px] pn:w-full pn:md:[&_.credit]:opacity-0 pn:md:hover:[&_.credit]:opacity-100 pn:[&_.credit]:opacity-100",children:n("div",{"data-shadowenabled":u,className:o("pn:relative pn:overflow-hidden pn:rounded-[5px]",u?"pn:shadow-[0_0_5px_rgba(16,22,26,0.3),0_0_0_1px_rgba(16,22,26,0.12)] pn:dark:shadow-[0_0_0_1px_rgba(255,255,255,0.16)]":""),children:[e("img",{className:o("pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:object-contain",c),style:{height:null!=p?p:"auto"},src:t,draggable:!0,loading:"lazy",crossOrigin:i,alt:m,onDragStart:()=>{r(({x:e,y:n},t,r)=>{a({x:e,y:n},t,r)})},onDragEnd:()=>{r(null)},onLoad:d}),l&&e("div",{className:"credit pn:absolute pn:bottom-0 pn:left-0 pn:w-full pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:pt-[10px] pn:text-center pn:text-[10px] pn:text-white pn:[&_a]:text-white pn:[&_a]:underline",children:l})]})})};export const ImagesGrid=({images:r,onSelect:o,isLoading:s,getPreview:p,loadMore:c,getCredit:d,getAlt:m,getImageClassName:u,rowsNumber:g,crossOrigin:h="anonymous",shadowEnabled:f,itemHeight:x,error:w,hideNoResults:b=!1})=>{const v=g||2,_=t.useRef(null),N=[];for(var y=0;y<v;y++){N.push((r||[]).filter((e,n)=>n%v===y))}const j=t.useRef(null),H=()=>{var e;const n=_.current,t=!!n&&n.scrollHeight>n.offsetHeight+5,l=r&&r.length,o=Array.from(null!==(e=null==n?void 0:n.querySelectorAll("img"))&&void 0!==e?e:[]).every(e=>e.complete);!t&&c&&!s&&l&&o&&(j.current||(j.current=window.setTimeout(()=>{j.current=null,c&&c()},100)))},S=()=>{H()};return t.useEffect(()=>(H(),()=>{null!==j.current&&window.clearTimeout(j.current),j.current=null}),[r&&r.length,s]),n("div",{onScroll:e=>{const n=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;c&&!s&&n<200&&c()},ref:_,className:"pn:h-full pn:overflow-auto",children:[N.map((t,r)=>n("div",{className:"pn:float-left",style:{width:100/v+"%"},children:[t.map((n,t)=>e(i,{url:p(n),onSelect:(e,t,r)=>o(n,e,t,r),credit:d&&d(n),crossOrigin:h,shadowEnabled:f,itemHeight:x,className:u&&u(n),onLoad:S,alt:m&&m(n)||""},t)),s&&e("div",{style:{padding:"30px"},children:e(a,{className:"pn:size-5 pn:mx-auto pn:text-muted-foreground"})})]},r)),!s&&(!r||!r.length)&&!w&&!b&&e("p",{className:"pn:p-[30px] pn:text-center",children:l("sidePanel.noResults")}),w&&e("p",{className:"pn:p-[30px] pn:text-center",children:l("sidePanel.error")})]})};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import t from"react";import{registerNextDomDrop as r}from"../canvas/page.js";import{t as l}from"../utils/l10n.js";import{cn as o}from"../lib/utils.js";import{Spinner as a}from"../primitives/spinner.js";const s=({url:t,credit:l,onSelect:a,crossOrigin:s,shadowEnabled:p,itemHeight:i,className:c,onLoad:d,alt:m})=>{const u=null==p||p;return e("div",{role:"button",onClick:()=>{a()},className:"polotno-close-panel pn:group/img-wrap pn:p-[5px] pn:w-full pn:md:[&_.credit]:opacity-0 pn:md:hover:[&_.credit]:opacity-100 pn:[&_.credit]:opacity-100",children:n("div",{"data-shadowenabled":u,className:o("pn:relative pn:overflow-hidden pn:rounded-[5px]",u?"pn:shadow-[0_0_5px_rgba(16,22,26,0.3),0_0_0_1px_rgba(16,22,26,0.12)] pn:dark:shadow-[0_0_0_1px_rgba(255,255,255,0.16)]":""),children:[e("img",{className:o("pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:object-contain",c),style:{height:null!=i?i:"auto"},src:t,draggable:!0,loading:"lazy",crossOrigin:s,alt:m,onDragStart:()=>{r(({x:e,y:n},t,r)=>{a({x:e,y:n},t,r)})},onDragEnd:()=>{r(null)},onLoad:d}),l&&e("div",{className:"credit pn:absolute pn:bottom-0 pn:left-0 pn:w-full pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:pt-[10px] pn:text-center pn:text-[10px] pn:text-white pn:[&_a]:text-white pn:[&_a]:underline",children:l})]})})};export const ImagesGrid=({images:r,onSelect:o,isLoading:p,getPreview:i,loadMore:c,getCredit:d,getAlt:m,getImageClassName:u,rowsNumber:g,crossOrigin:h="anonymous",shadowEnabled:f,itemHeight:x,error:b,hideNoResults:w=!1})=>{const v=g||2,_=t.useRef(null),N=[];for(var y=0;y<v;y++){N.push((r||[]).filter((e,n)=>n%v===y))}const j=t.useRef(null),H=()=>{var e;const n=_.current,t=!!n&&n.scrollHeight>n.offsetHeight+5,l=r&&r.length,o=Array.from(null!==(e=null==n?void 0:n.querySelectorAll("img"))&&void 0!==e?e:[]).every(e=>e.complete);!t&&c&&!p&&l&&o&&(j.current||(j.current=window.setTimeout(()=>{j.current=null,c&&c()},100)))},S=()=>{H()};return t.useEffect(()=>(H(),()=>{null!==j.current&&window.clearTimeout(j.current),j.current=null}),[r&&r.length,p]),n("div",{onScroll:e=>{const n=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;c&&!p&&n<200&&c()},ref:_,className:"pn:h-full pn:overflow-auto",children:[N.map((n,t)=>e("div",{className:"pn:float-left",style:{width:100/v+"%"},children:n.map((n,t)=>e(s,{url:i(n),onSelect:(e,t,r)=>o(n,e,t,r),credit:d&&d(n),crossOrigin:h,shadowEnabled:f,itemHeight:x,className:u&&u(n),onLoad:S,alt:m&&m(n)||""},t))},t)),p&&e("div",{className:"pn:clear-both pn:flex pn:justify-center pn:p-[30px]",children:e(a,{className:"pn:size-5 pn:text-muted-foreground"})}),!p&&(!r||!r.length)&&!b&&!w&&e("p",{className:"pn:p-[30px] pn:text-center",children:l("sidePanel.noResults")}),b&&e("p",{className:"pn:clear-both pn:p-[30px] pn:text-center",children:l("sidePanel.error")})]})};
@@ -1,35 +1,35 @@
1
- export { SidePanel, DEFAULT_SECTIONS, INTERNAL_SECTIONS, TemplatesSection, TextSection, PhotosSection, ElementsSection, UploadSection, BackgroundSection, PagesSection, LayersSection, SizeSection, DrawSection, VideosSection, } from "./side-panel.js";
2
- export type { SidePanelProps } from "./side-panel.js";
3
- export type { Section } from "./side-panel.js";
4
- export { SectionTab } from "./tab-button.js";
5
- export { TextPanel, setFontUploadFunc } from "./text-panel.js";
6
- export type { TextPanelProps } from "./text-panel.js";
7
- export { PhotosPanel } from "./photos-panel.js";
8
- export type { PhotosPanelProps } from "./photos-panel.js";
9
- export { ElementsPanel } from "./elements-panel.js";
10
- export type { ElementsPanelProps } from "./elements-panel.js";
11
- export { UploadPanel } from "./upload-panel.js";
12
- export type { UploadPanelProps } from "./upload-panel.js";
13
- export { setUploadFunc } from "./upload-panel.js";
14
- export { BackgroundPanel } from "./background-panel.js";
15
- export type { BackgroundPanelProps } from "./background-panel.js";
16
- export { SizePanel } from "./size-panel.js";
17
- export type { SizePanelProps } from "./size-panel.js";
18
- export { PagesPanel } from "./pages-panel.js";
19
- export { LayersPanel } from "./layers-panel.js";
20
- export { DrawPanel } from "./draw-panel.js";
21
- export type { DrawPanelProps } from "./draw-panel.js";
22
- export { TemplatesPanel } from "./templates-panel.js";
23
- export type { TemplatesPanelProps } from "./templates-panel.js";
24
- export { ImagesGrid } from "./images-grid.js";
25
- export { VideosPanel } from "./videos-panel.js";
26
- export { VideosGrid } from "./videos-grid.js";
27
- export { AiImagesPanel } from "./ai-images-panel.js";
28
- export { AnimationsPanel } from "./animations-panel.js";
29
- export { EffectsPanel } from "./effects-panel.js";
30
- export { EffectCard } from "./effect-card.js";
31
- export { ImageClipPanel } from "./image-clip-panel.js";
32
- export { selectImage } from "./select-image.js";
33
- export { selectGif } from "./select-gif.js";
34
- export { selectSvg } from "./select-svg.js";
35
- export { selectVideo } from "./select-video.js";
1
+ export { SidePanel, DEFAULT_SECTIONS, INTERNAL_SECTIONS, TemplatesSection, TextSection, PhotosSection, ElementsSection, UploadSection, BackgroundSection, PagesSection, LayersSection, SizeSection, DrawSection, VideosSection, } from './side-panel.js';
2
+ export type { SidePanelProps } from './side-panel.js';
3
+ export type { Section } from './side-panel.js';
4
+ export { SectionTab } from './tab-button.js';
5
+ export { TextPanel, setFontUploadFunc } from './text-panel.js';
6
+ export type { TextPanelProps } from './text-panel.js';
7
+ export { PhotosPanel } from './photos-panel.js';
8
+ export type { PhotosPanelProps } from './photos-panel.js';
9
+ export { ElementsPanel } from './elements-panel.js';
10
+ export type { ElementsPanelProps } from './elements-panel.js';
11
+ export { UploadPanel } from './upload-panel.js';
12
+ export type { UploadPanelProps } from './upload-panel.js';
13
+ export { setUploadFunc } from './upload-panel.js';
14
+ export { BackgroundPanel } from './background-panel.js';
15
+ export type { BackgroundPanelProps } from './background-panel.js';
16
+ export { SizePanel } from './size-panel.js';
17
+ export type { SizePanelProps } from './size-panel.js';
18
+ export { PagesPanel } from './pages-panel.js';
19
+ export { LayersPanel } from './layers-panel.js';
20
+ export { DrawPanel } from './draw-panel.js';
21
+ export type { DrawPanelProps } from './draw-panel.js';
22
+ export { TemplatesPanel } from './templates-panel.js';
23
+ export type { TemplatesPanelProps } from './templates-panel.js';
24
+ export { ImagesGrid } from './images-grid.js';
25
+ export { VideosPanel } from './videos-panel.js';
26
+ export { VideosGrid } from './videos-grid.js';
27
+ export { AiImagesPanel } from './ai-images-panel.js';
28
+ export { AnimationsPanel } from './animations-panel.js';
29
+ export { EffectsPanel } from './effects-panel.js';
30
+ export { EffectCard } from './effect-card.js';
31
+ export { ImageClipPanel } from './image-clip-panel.js';
32
+ export { selectImage } from './select-image.js';
33
+ export { selectGif } from './select-gif.js';
34
+ export { selectSvg } from './select-svg.js';
35
+ export { selectVideo } from './select-video.js';
@@ -1,4 +1,4 @@
1
- import type { StoreType } from "../ui-types.js";
1
+ import type { StoreType } from '../ui-types.js';
2
2
  export declare const PhotosPanel: ({ store }: {
3
3
  store: StoreType;
4
4
  }) => import("react").JSX.Element;
@@ -8,5 +8,5 @@ type Props = {
8
8
  };
9
9
  targetElement?: any;
10
10
  };
11
- export declare const selectGif: ({ src, droppedPos, store, }: Props) => Promise<void>;
11
+ export declare const selectGif: ({ src, droppedPos, store }: Props) => Promise<void>;
12
12
  export {};
@@ -1,8 +1,8 @@
1
- import * as React from "react";
2
- import type { StoreType, Section } from "../ui-types.js";
3
- export type { Section } from "../ui-types.js";
4
- export { SectionTab } from "./tab-button.js";
5
- export { ImagesGrid } from "./images-grid.js";
1
+ import * as React from 'react';
2
+ import type { StoreType, Section } from '../ui-types.js';
3
+ export type { Section } from '../ui-types.js';
4
+ export { SectionTab } from './tab-button.js';
5
+ export { ImagesGrid } from './images-grid.js';
6
6
  export declare const TemplatesSection: Section;
7
7
  export declare const TextSection: Section;
8
8
  export declare const PhotosSection: Section;
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
3
- import { type UnitType } from "../utils/unit.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
+ import { type UnitType } from '../utils/unit.js';
4
4
  export declare const SIZE_CATEGORIES: Array<{
5
5
  name: string;
6
6
  icon?: React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  interface SectionTabProps {
3
3
  children: React.ReactNode;
4
4
  name: string;
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { cn } from "../lib/utils.js";
3
- export const SectionTab = ({ children, name, onClick, active, iconSize, }) => (_jsxs("div", { role: "button", onClick: onClick, className: cn("polotno-side-panel-tab pn-section-tab pn:w-full pn:cursor-pointer pn:whitespace-pre pn:text-center pn:text-[12px]", "pn:pt-[15px] pn:pl-[5px] pn:pr-[5px] pn:h-[72px]", "pn:max-md:h-[54px] pn:max-md:pt-[9px] pn:max-md:min-w-[72px] pn:max-md:w-min", "pn:pn-mobile:h-[54px] pn:pn-mobile:pt-[9px] pn:pn-mobile:min-w-[72px] pn:pn-mobile:w-min", "pn:hover:bg-sidebar-accent pn:hover:text-sidebar-accent-foreground", active && "active pn:bg-sidebar-accent pn:text-sidebar-accent-foreground"), children: [_jsx("div", { style: { fontSize: (iconSize || 14) + "px" }, children: children }), _jsx("div", { style: { paddingTop: "5px" }, children: name })] }));
2
+ import { cn } from '../lib/utils.js';
3
+ export const SectionTab = ({ children, name, onClick, active, iconSize, }) => (_jsxs("div", { role: "button", onClick: onClick, className: cn('polotno-side-panel-tab pn-section-tab pn:w-full pn:cursor-pointer pn:whitespace-pre pn:text-center pn:text-[12px]', 'pn:pt-[15px] pn:pl-[5px] pn:pr-[5px] pn:h-[72px]', 'pn:max-md:h-[54px] pn:max-md:pt-[9px] pn:max-md:min-w-[72px] pn:max-md:w-min', 'pn:pn-mobile:h-[54px] pn:pn-mobile:pt-[9px] pn:pn-mobile:min-w-[72px] pn:pn-mobile:w-min', 'pn:hover:bg-sidebar-accent pn:hover:text-sidebar-accent-foreground', active && 'active pn:bg-sidebar-accent pn:text-sidebar-accent-foreground'), children: [_jsx("div", { style: { fontSize: (iconSize || 14) + 'px' }, children: children }), _jsx("div", { style: { paddingTop: '5px' }, children: name })] }));
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
3
  export declare const TemplatesPanel: (({ store }: {
4
4
  store: StoreType;
5
5
  }) => React.JSX.Element) & {
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  export declare function unsplashCredit(image: any): React.JSX.Element;
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import type { StoreType } from "../ui-types.js";
3
- export { setUploadFunc } from "../utils/file.js";
1
+ import * as React from 'react';
2
+ import type { StoreType } from '../ui-types.js';
3
+ export { setUploadFunc } from '../utils/file.js';
4
4
  export declare const UploadPanel: ({ store }: {
5
5
  store: StoreType;
6
6
  }) => React.JSX.Element;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{PolotnoIcon as r}from"../icons/registry.js";import{getVideoPreview as o}from"../utils/video.js";import{getType as l,getUploadFunc as s}from"../utils/file.js";import{insertMediaIntoPage as n}from"../utils/insert-file.js";import{ImagesGrid as a}from"./images-grid.js";import{t as c}from"../utils/l10n.js";import{Button as p}from"../primitives/button.js";export{setUploadFunc}from"../utils/file.js";let d=[];function m(){const e=new Blob(['\n <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">\n <circle cx="50" cy="50" r="45" fill="#f0f0f0" stroke="#ccc" stroke-width="2"/>\n <path d="M40,35 L40,65 L55,50 L70,50 M70,35 Q80,50 70,65" fill="none" stroke="#666" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n '],{type:"image/svg+xml"});return URL.createObjectURL(e)}export const UploadPanel=({store:u})=>{const[f,g]=i.useState(d),[h,v]=i.useState(!1),y=i.useRef(null);return i.useEffect(()=>{d=f},[f]),t("div",{className:"pn:flex pn:h-full pn:flex-col",children:[e("div",{style:{height:"45px",paddingTop:"5px"},children:c("sidePanel.uploadTip")}),e("div",{style:{marginBottom:"20px"},children:t("label",{htmlFor:"input-file",children:[t(p,{variant:"outline",style:{width:"100%"},onClick:()=>{var e;null===(e=y.current)||void 0===e||e.click()},children:[e(r,{name:"action.add"}),c("sidePanel.uploadImage")]}),e("input",{type:"file",ref:y,style:{display:"none"},onChange:async e=>{var t;const{target:i}=e;v(!0);try{for(const e of Array.from(null!==(t=i.files)&&void 0!==t?t:[])){const t=await s()(e),i=l(e);let r=t;"video"===i?r=await o(t):"audio"===i&&(r=m()),g(e=>e.concat([{url:t,type:i,preview:r}]))}}catch(e){console.error(e)}v(!1),i.value=""},multiple:!0})]})}),e(a,{images:f,isLoading:h,getPreview:e=>e.preview,hideNoResults:!0,onSelect:async(e,t,i)=>{n({url:e.url,type:e.type,store:u,droppedPos:t,targetElement:i})}})]})};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{PolotnoIcon as n}from"../icons/registry.js";import{getVideoPreview as r}from"../utils/video.js";import{getMediaType as o,getUploadFunc as l,MEDIA_ACCEPT as s}from"../utils/file.js";import{insertMediaIntoPage as a}from"../utils/insert-file.js";import{ImagesGrid as p}from"./images-grid.js";import{t as c}from"../utils/l10n.js";import{cn as d}from"../lib/utils.js";import{Button as u}from"../primitives/button.js";export{setUploadFunc}from"../utils/file.js";let m=[],f=0;function g(){const e=new Blob(['\n <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100">\n <circle cx="50" cy="50" r="45" fill="#f0f0f0" stroke="#ccc" stroke-width="2"/>\n <path d="M40,35 L40,65 L55,50 L70,50 M70,35 Q80,50 70,65" fill="none" stroke="#666" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n '],{type:"image/svg+xml"});return URL.createObjectURL(e)}async function v(e,t){if("audio"===t){return g()}const i=URL.createObjectURL(e);if("video"!==t){return i}try{return await r(i)}finally{URL.revokeObjectURL(i)}}const h=e=>{e.startsWith("blob:")&&URL.revokeObjectURL(e)};export const UploadPanel=({store:y})=>{const[w,x]=i.useState(m),[j,L]=i.useState([]),[b,U]=i.useState(null),k=i.useRef(null);i.useEffect(()=>{m=w},[w]);const R=[...j,...w];return t("div",{className:"pn:flex pn:h-full pn:flex-col",children:[e("div",{style:{height:"45px",paddingTop:"5px"},children:c("sidePanel.uploadTip")}),e("div",{style:{marginBottom:"20px"},children:t("label",{htmlFor:"input-file",children:[t(u,{variant:"outline",style:{width:"100%"},onClick:()=>{var e;null===(e=k.current)||void 0===e||e.click()},children:[e(n,{name:"action.add"}),c("sidePanel.uploadImage")]}),e("input",{type:"file",ref:k,style:{display:"none"},accept:s,onChange:async e=>{var t;const{target:i}=e,n=Array.from(null!==(t=i.files)&&void 0!==t?t:[]);i.value="",U(null);const s=[];for(const r of n){const e=o(r);e&&s.push({file:r,type:e})}s.length<n.length&&U(c("sidePanel.uploadUnsupported"));const a=await Promise.all(s.map(async({file:e,type:t})=>({id:f++,preview:await v(e,t),pending:!0})));L(e=>[...a,...e]);for(const[o,{file:p,type:d}]of s.entries()){const t=a[o];try{const e=await l()(p);let t=e;"video"===d?t=await r(e):"audio"===d&&(t=g()),x(i=>[{url:e,type:d,preview:t,name:p.name},...i])}catch(e){console.error(e),U(c("sidePanel.uploadFailed"))}finally{L(e=>e.filter(e=>e.id!==t.id)),h(t.preview)}}},multiple:!0})]})}),b&&e("div",{className:"pn:pb-[10px] pn:text-center pn:text-xs pn:text-muted-foreground",children:b}),e(p,{images:R,isLoading:!1,getPreview:e=>e.preview,getImageClassName:e=>"pending"in e?d("pn:animate-pulse pn:opacity-50"):"",hideNoResults:!0,onSelect:async(e,t,i)=>{"pending"in e||a({url:e.url,type:e.type,store:y,droppedPos:t,targetElement:i,name:e.name})}})]})};
@@ -1 +1 @@
1
- import{jsx as n,jsxs as e}from"react/jsx-runtime";import{useCallback as r,useRef as t}from"react";import{registerNextDomDrop as i}from"../canvas/page.js";import{Spinner as p}from"../primitives/spinner.js";export const VideosGrid=({items:a,onSelect:l,loadMore:s,isLoading:c,error:d,getCredit:u})=>{const m=t(null),v=r(n=>{c||(m.current&&m.current.disconnect(),m.current=new IntersectionObserver(n=>{n[0].isIntersecting&&s()}),n&&m.current.observe(n))},[c]);if(d){return n("div",{children:d.message})}if(!a||0===a.length){return null}const g=a.filter((n,e)=>e%2==1),x=a.filter((n,e)=>e%2==0);return n("div",{className:"pn:h-full pn:overflow-auto",children:[g,x].map((r,t)=>e("div",{className:"pn:float-left pn:w-1/2",children:[r.map(e=>n(o,{item:e,onClick:()=>l(e),onDragStart:()=>{i((n,r)=>{l(e,n,r)})},onDragEnd:()=>i(null),getCredit:u},e.id)),n("div",{ref:v,className:"pn:p-12",children:c&&n(p,{className:"pn:size-5 pn:mx-auto pn:text-muted-foreground"})})]},t))})};const o=({item:r,onClick:i,onDragEnd:p,onDragStart:o,getCredit:a})=>{var l;const s=t(null),c=(null===(l=r.video_files.find(n=>"sd"===n.quality))||void 0===l?void 0:l.link)||"";if(!c){return null}const d=new Date(1e3*r.duration).toISOString();let u;return u=r.duration>3600?d.substring(11,19):d.substring(14,19),n("div",{className:"pn:group/video pn:w-full pn:p-[5px] pn:hover:[&_.video-grid__item-credit]:opacity-100",children:e("div",{className:"pn:relative",draggable:!0,onClick:i,onDragEnd:p,onDragStart:o,onMouseEnter:()=>{var n,e;null===(e=null===(n=s.current)||void 0===n?void 0:n.play())||void 0===e||e.catch(()=>{})},onMouseLeave:()=>{var n;null===(n=s.current)||void 0===n||n.pause(),s.current&&(s.current.currentTime=0)},children:[n("video",{poster:r.video_pictures[0].picture,controls:!1,ref:s,muted:!0,preload:"none",playsInline:!0,className:"pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:rounded-[5px] pn:object-cover pn:shadow-[0_0_5px_rgba(16,22,26,0.3)]",children:n("source",{src:c})}),n("div",{className:"pn:absolute pn:right-2 pn:top-2 pn:flex pn:items-center pn:justify-center pn:rounded-full pn:bg-black/50 pn:px-[7px] pn:py-[2px] pn:text-center pn:text-white",children:n("span",{className:"pn:text-xs",children:u})}),a&&n("div",{className:"video-grid__item-credit pn:absolute pn:inset-x-0 pn:bottom-0 pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:text-center pn:text-[10px] pn:text-white pn:opacity-0 pn:[&_a]:text-white pn:[&_a]:underline",children:a(r)})]})})};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useCallback as r,useRef as t}from"react";import{registerNextDomDrop as i}from"../canvas/page.js";import{Spinner as p}from"../primitives/spinner.js";export const VideosGrid=({items:l,onSelect:a,loadMore:s,isLoading:c,error:d,getCredit:u})=>{const m=t(null),v=r(e=>{c||(m.current&&m.current.disconnect(),m.current=new IntersectionObserver(e=>{e[0].isIntersecting&&s()}),e&&m.current.observe(e))},[c]);if(d){return e("div",{children:d.message})}if(!l||0===l.length){return null}const g=l.filter((e,n)=>n%2==1),x=l.filter((e,n)=>n%2==0);return n("div",{className:"pn:h-full pn:overflow-auto",children:[[g,x].map((n,r)=>e("div",{className:"pn:float-left pn:w-1/2",children:n.map(n=>e(o,{item:n,onClick:()=>a(n),onDragStart:()=>{i((e,r)=>{a(n,e,r)})},onDragEnd:()=>i(null),getCredit:u},n.id))},r)),e("div",{ref:v,className:"pn:clear-both pn:flex pn:justify-center pn:p-12",children:c&&e(p,{className:"pn:size-5 pn:text-muted-foreground"})})]})};const o=({item:r,onClick:i,onDragEnd:p,onDragStart:o,getCredit:l})=>{var a;const s=t(null),c=(null===(a=r.video_files.find(e=>"sd"===e.quality))||void 0===a?void 0:a.link)||"";if(!c){return null}const d=new Date(1e3*r.duration).toISOString();let u;return u=r.duration>3600?d.substring(11,19):d.substring(14,19),e("div",{className:"pn:group/video pn:w-full pn:p-[5px] pn:hover:[&_.video-grid__item-credit]:opacity-100",children:n("div",{className:"pn:relative",draggable:!0,onClick:i,onDragEnd:p,onDragStart:o,onMouseEnter:()=>{var e,n;null===(n=null===(e=s.current)||void 0===e?void 0:e.play())||void 0===n||n.catch(()=>{})},onMouseLeave:()=>{var e;null===(e=s.current)||void 0===e||e.pause(),s.current&&(s.current.currentTime=0)},children:[e("video",{poster:r.video_pictures[0].picture,controls:!1,ref:s,muted:!0,preload:"none",playsInline:!0,className:"pn:block pn:max-h-[300px] pn:min-h-[50px] pn:w-full pn:cursor-pointer pn:rounded-[5px] pn:object-cover pn:shadow-[0_0_5px_rgba(16,22,26,0.3)]",children:e("source",{src:c})}),e("div",{className:"pn:absolute pn:right-2 pn:top-2 pn:flex pn:items-center pn:justify-center pn:rounded-full pn:bg-black/50 pn:px-[7px] pn:py-[2px] pn:text-center pn:text-white",children:e("span",{className:"pn:text-xs",children:u})}),l&&e("div",{className:"video-grid__item-credit pn:absolute pn:inset-x-0 pn:bottom-0 pn:bg-gradient-to-b pn:from-transparent pn:via-black/40 pn:to-black/60 pn:p-[3px] pn:text-center pn:text-[10px] pn:text-white pn:opacity-0 pn:[&_a]:text-white pn:[&_a]:underline",children:l(r)})]})})};
@@ -69,7 +69,7 @@
69
69
  */
70
70
  .polotno-ui.dark,
71
71
  .dark .polotno-ui,
72
- [data-polotno-theme="dark"] {
72
+ [data-polotno-theme='dark'] {
73
73
  --pn-background: oklch(0.24 0.02 256);
74
74
  --pn-foreground: oklch(0.95 0.005 247);
75
75
  --pn-card: oklch(0.28 0.02 256);