inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/button
*/
import type { ButtonVariant, IUIButton, IUIButtonState, IUIButtonStatePartial, IViewBased } from "../../../../types/index";
import { UIElement } from "../../element";
export declare const UIButtonState: () => IUIButtonState;
export declare class UIButton extends UIElement implements IUIButton {
/** @override */
className(): string;
/**
* Marker for buttons
*/
readonly isButton: true;
readonly state: IUIButtonState;
/**
* Set state
*/
setState(state: IUIButtonStatePartial): this;
/**
* DOM container for text content
*/
get text(): HTMLElement;
/**
* DOM container for icon
*/
get icon(): HTMLElement;
/**
* DOM container for button
*/
protected button: HTMLElement;
protected onChangeSize(): void;
protected onChangeType(): void;
protected onChangeRole(): void;
/**
* Set size from a parent list
*/
protected updateSize(): void;
protected onChangeStatus(): void;
protected onChangeText(): void;
protected onChangeTextSetMode(): void;
protected onChangeDisabled(): void;
protected onChangeActivated(): void;
protected onChangeName(): void;
protected onChangeTooltip(): void;
protected onChangeTabIndex(): void;
protected onChangeIcon(): void;
/**
* Set focus on an element
*/
focus(): void;
/**
* Element has focus
*/
isFocused(): boolean;
/** @override */
protected createContainer(): HTMLElement;
constructor(jodit: IViewBased, state?: IUIButtonStatePartial);
destruct(): any;
private readonly actionHandlers;
/**
* Add action handler
*/
onAction(callback: (originalEvent: MouseEvent) => void): this;
/**
* Fire all click handlers
*/
protected __onActionFire(e: MouseEvent): void;
}
export declare function Button(jodit: IViewBased, icon: string): IUIButton;
export declare function Button(jodit: IViewBased, icon: string, text?: string): IUIButton;
export declare function Button(jodit: IViewBased, icon: string, text: string, variant?: ButtonVariant): IUIButton;
export declare function Button(jodit: IViewBased, state: IUIButtonStatePartial, variant?: ButtonVariant): IUIButton;

269
node_modules/jodit/esm/core/ui/button/button/button.js generated vendored Normal file
View File

@@ -0,0 +1,269 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { STATUSES } from "../../../component/statuses.js";
import { cache, cacheHTML, component, watch } from "../../../decorators/index.js";
import { Dom } from "../../../dom/dom.js";
import { isFunction } from "../../../helpers/checker/is-function.js";
import { isString } from "../../../helpers/checker/is-string.js";
import { assert, attr } from "../../../helpers/utils/index.js";
import { UIElement } from "../../element.js";
import { UIList } from "../../group/list.js";
import { Icon } from "../../icon.js";
export const UIButtonState = () => ({
size: 'middle',
type: 'button',
role: 'button',
name: '',
value: '',
variant: 'initial',
disabled: false,
activated: false,
icon: {
name: 'empty',
fill: '',
iconURL: ''
},
tooltip: '',
text: '',
tabIndex: undefined
});
let UIButton = class UIButton extends UIElement {
/** @override */
className() {
return 'UIButton';
}
/**
* Set state
*/
setState(state) {
Object.assign(this.state, state);
return this;
}
/**
* DOM container for text content
*/
get text() {
const text = this.getElm('text');
assert(text, 'Text element not found');
return text;
}
/**
* DOM container for icon
*/
get icon() {
const icon = this.getElm('icon');
assert(icon, 'Icon element not found');
return icon;
}
onChangeSize() {
this.setMod('size', this.state.size);
}
onChangeType() {
attr(this.container, 'type', this.state.type);
}
onChangeRole() {
attr(this.container, 'role', this.state.role);
}
/**
* Set size from a parent list
*/
updateSize() {
const pe = this.closest(UIList);
if (pe) {
this.state.size = pe.buttonSize;
return;
}
}
onChangeStatus() {
this.setMod('variant', this.state.variant);
}
onChangeText() {
this.text.textContent = this.jodit.i18n(this.state.text);
}
onChangeTextSetMode() {
this.setMod('text-icons', Boolean(this.state.text.trim().length));
}
onChangeDisabled() {
attr(this.container, 'disabled', this.state.disabled || null);
}
onChangeActivated() {
attr(this.container, 'aria-pressed', this.state.activated);
}
onChangeName() {
this.container.classList.add(`${this.componentName}_${this.clearName(this.state.name)}`);
this.name = this.state.name;
attr(this.container, 'data-ref', this.state.name);
attr(this.container, 'ref', this.state.name);
}
onChangeTooltip() {
if (this.get('j.o.useNativeTooltip')) {
attr(this.container, 'title', this.state.tooltip);
}
attr(this.container, 'aria-label', this.state.tooltip);
}
onChangeTabIndex() {
attr(this.container, 'tabindex', this.state.tabIndex);
}
onChangeIcon() {
const textIcons = this.get('j.o.textIcons');
if (textIcons === true ||
(isFunction(textIcons) && textIcons(this.state.name))) {
return;
}
Dom.detach(this.icon);
const iconElement = Icon.makeIcon(this.j, this.state.icon);
iconElement && this.icon.appendChild(iconElement);
}
/**
* Set focus on an element
*/
focus() {
this.container.focus();
}
/**
* Element has focus
*/
isFocused() {
const { activeElement } = this.od;
return Boolean(activeElement && Dom.isOrContains(this.container, activeElement));
}
/** @override */
createContainer() {
const cn = this.componentName;
const button = this.j.c.element('button', {
class: cn,
type: 'button',
role: 'button',
ariaPressed: false
});
const icon = this.j.c.span(cn + '__icon');
const text = this.j.c.span(cn + '__text');
button.appendChild(icon);
button.appendChild(text);
return button;
}
constructor(jodit, state) {
super(jodit);
/**
* Marker for buttons
*/
this.isButton = true;
this.state = UIButtonState();
this.actionHandlers = [];
this.button = this.container;
this.updateSize();
this.onChangeSize();
this.onChangeStatus();
if (state) {
this.hookStatus(STATUSES.ready, () => {
this.setState(state);
});
}
}
destruct() {
this.j.e.off(this.container);
return super.destruct();
}
/**
* Add action handler
*/
onAction(callback) {
this.actionHandlers.push(callback);
return this;
}
/**
* Fire all click handlers
*/
__onActionFire(e) {
e.buffer = {
actionTrigger: this
};
this.actionHandlers.forEach(callback => callback.call(this, e));
}
};
__decorate([
cache
], UIButton.prototype, "text", null);
__decorate([
cache
], UIButton.prototype, "icon", null);
__decorate([
watch('state.size', { immediately: false })
], UIButton.prototype, "onChangeSize", null);
__decorate([
watch('state.type', { immediately: false })
], UIButton.prototype, "onChangeType", null);
__decorate([
watch('state.role', { immediately: false })
], UIButton.prototype, "onChangeRole", null);
__decorate([
watch('parentElement')
], UIButton.prototype, "updateSize", null);
__decorate([
watch('state.variant', { immediately: false })
], UIButton.prototype, "onChangeStatus", null);
__decorate([
watch('state.text', { immediately: false })
], UIButton.prototype, "onChangeText", null);
__decorate([
watch('state.text', { immediately: false })
], UIButton.prototype, "onChangeTextSetMode", null);
__decorate([
watch('state.disabled')
], UIButton.prototype, "onChangeDisabled", null);
__decorate([
watch('state.activated')
], UIButton.prototype, "onChangeActivated", null);
__decorate([
watch('state.name', { immediately: false })
], UIButton.prototype, "onChangeName", null);
__decorate([
watch('state.tooltip', { immediately: false })
], UIButton.prototype, "onChangeTooltip", null);
__decorate([
watch('state.tabIndex', { immediately: false })
], UIButton.prototype, "onChangeTabIndex", null);
__decorate([
watch('state.icon', { immediately: false })
], UIButton.prototype, "onChangeIcon", null);
__decorate([
cacheHTML
], UIButton.prototype, "createContainer", null);
__decorate([
watch('button:click')
], UIButton.prototype, "__onActionFire", null);
UIButton = __decorate([
component
], UIButton);
export { UIButton };
export function Button(jodit, stateOrText, text, variant) {
const button = new UIButton(jodit);
button.state.tabIndex = jodit.o.allowTabNavigation ? 0 : -1;
if (isString(stateOrText)) {
button.state.icon.name = stateOrText;
button.state.name = stateOrText;
if (variant) {
button.state.variant = variant;
}
if (text) {
button.state.text = text;
}
}
else {
button.setState(stateOrText);
}
return button;
}

36
node_modules/jodit/esm/core/ui/button/group/group.d.ts generated vendored Normal file
View File

@@ -0,0 +1,36 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/button
*/
import type { IDictionary, IUIButton, IUIOption, IViewBased } from "../../../../types/index";
import { UIGroup } from "../../group/group";
export declare class UIButtonGroup extends UIGroup {
readonly options: {
name?: string;
value?: string | boolean | number;
label?: string;
onChange?: (values: IUIOption[]) => void;
options?: IUIOption[];
radio: boolean;
};
elements: IUIButton[];
/** @override */
className(): string;
/** @override */
protected render(options: IDictionary): string;
/** @override */
protected appendChildToContainer(childContainer: HTMLElement): void;
constructor(jodit: IViewBased, options?: {
name?: string;
value?: string | boolean | number;
label?: string;
onChange?: (values: IUIOption[]) => void;
options?: IUIOption[];
radio: boolean;
});
protected select(indexOrValue: IUIOption['value'] | number): void;
}

79
node_modules/jodit/esm/core/ui/button/group/group.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { component } from "../../../decorators/component/component.js";
import { assert } from "../../../helpers/utils/assert.js";
import { UIButton } from "../button/button.js";
import { UIGroup } from "../../group/group.js";
let UIButtonGroup = class UIButtonGroup extends UIGroup {
/** @override */
className() {
return 'UIButtonGroup';
}
/** @override */
render(options) {
return `<div>
<div class="&__label">~${options.label}~</div>
<div class="&__options"></div>
</div>`;
}
/** @override */
appendChildToContainer(childContainer) {
const options = this.getElm('options');
assert(options != null, 'Options does not exist');
options.appendChild(childContainer);
}
constructor(jodit, options = {
radio: true
}) {
var _a, _b;
super(jodit, (_a = options.options) === null || _a === void 0 ? void 0 : _a.map(opt => {
const btn = new UIButton(jodit, {
text: opt.text,
value: opt.value,
variant: 'primary'
});
btn.onAction(() => {
this.select(opt.value);
});
return btn;
}), options);
this.options = options;
this.select((_b = options.value) !== null && _b !== void 0 ? _b : 0);
}
select(indexOrValue) {
var _a, _b;
this.elements.forEach((elm, index) => {
if (index === indexOrValue || elm.state.value === indexOrValue) {
elm.state.activated = true;
}
else if (this.options.radio) {
elm.state.activated = false;
}
});
const result = this.elements
.filter(elm => elm.state.activated)
.map(elm => ({
text: elm.state.text,
value: elm.state.value
}));
this.jodit.e.fire(this, 'select', result);
(_b = (_a = this.options).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, result);
}
};
UIButtonGroup = __decorate([
component
], UIButtonGroup);
export { UIButtonGroup };

13
node_modules/jodit/esm/core/ui/button/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/button/README.md]]
* @packageDocumentation
* @module ui/button
*/
export * from "./button/button";
export * from "./group/group";
export * from "./tooltip/tooltip";

13
node_modules/jodit/esm/core/ui/button/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/button/README.md]]
* @packageDocumentation
* @module ui/button
*/
export * from "./button/button.js";
export * from "./group/group.js";
export * from "./tooltip/tooltip.js";

View File

@@ -0,0 +1,33 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/button/tooltip/README.md]]
* @packageDocumentation
* @module ui/button
*/
import type { IViewBased } from "../../../../types/index";
import { UIElement } from "../../element";
export declare class UITooltip extends UIElement {
private __isOpened;
className(): string;
protected render(): string;
constructor(view: IViewBased);
private __attachedContainers;
private __onAttach;
private __listenClose;
private __addListenersOnEnter;
private __removeListenersOnLeave;
private __currentTarget;
private __onMouseLeave;
private __onMouseEnter;
private __delayShowTimeout;
private __hideTimeout;
private __open;
private __show;
private __hide;
private __hideDelay;
destruct(): void;
}

View File

@@ -0,0 +1,199 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UITooltip_1;
import { STATUSES } from "../../../component/index.js";
import { autobind, component } from "../../../decorators/index.js";
import { Dom } from "../../../dom/index.js";
import { getContainer } from "../../../global.js";
import { position } from "../../../helpers/size/position.js";
import { attr, css } from "../../../helpers/utils/index.js";
import { UIElement } from "../../element.js";
const WINDOW_EVENTS_ON_HIDE = [
'scroll.tooltip',
'joditCloseDialog',
'mouseleave.tooltip'
];
const JODIT_EVENTS_ON_HIDE = [
'escape.tooltip',
'change.tooltip',
'changePlace.tooltip',
'afterOpenPopup.tooltip',
'hidePopup.tooltip',
'beforePopupClose.tooltip',
'closeAllPopups.tooltip'
];
let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
className() {
return 'UITooltip';
}
render() {
return '<div><div class="&__content"></div></div>';
}
constructor(view) {
super(view);
this.__isOpened = false;
this.__attachedContainers = new Set();
this.__listenClose = false;
this.__currentTarget = null;
this.__delayShowTimeout = 0;
this.__hideTimeout = 0;
if (!view.o.textIcons &&
view.o.showTooltip &&
!view.o.useNativeTooltip) {
this.j.e.on('getContainer', (box) => {
this.__onAttach(box);
});
view.hookStatus(STATUSES.ready, () => {
this.__onAttach(this.j.container);
});
}
}
__onAttach(container) {
// TODO Move it inside __show method. Now it is here because testcase failed with capturing
getContainer(this.j, UITooltip_1).appendChild(this.container);
this.__attachedContainers.add(container);
this.__attachedContainers.add(this.j.container);
this.j.e
.on(container, 'mouseenter.tooltip', this.__onMouseEnter, {
capture: true
})
.on(container, 'mouseleave.tooltip', this.__onMouseLeave, {
capture: true
})
.on(this.j.container, 'mouseleave.tooltip', this.__onMouseLeave, {
capture: true
});
}
__addListenersOnEnter() {
if (this.__listenClose) {
return;
}
this.__listenClose = true;
const view = this.j;
view.e
.on(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
.on(JODIT_EVENTS_ON_HIDE, this.__hide);
}
__removeListenersOnLeave() {
if (!this.__listenClose) {
return;
}
this.__listenClose = false;
const view = this.j;
view.e
.off(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
.off(JODIT_EVENTS_ON_HIDE, this.__hide);
}
__onMouseLeave(e) {
if (this.__currentTarget === e.target) {
this.__hideDelay();
this.__currentTarget = null;
}
}
__onMouseEnter(e) {
if (!Dom.isHTMLElement(e.target)) {
return;
}
const tooltip = attr(e.target, 'aria-label');
if (!tooltip) {
return;
}
const disabled = Boolean(attr(e.target, 'disabled'));
if (disabled) {
return;
}
const isOwn = e.target.className.includes('jodit');
if (!isOwn) {
return;
}
this.__currentTarget = e.target;
const target = e.target;
this.__open(() => {
const pos = position(target);
return {
x: pos.left + pos.width / 2,
y: pos.top + pos.height
};
}, tooltip);
}
__open(getPoint, content) {
this.__addListenersOnEnter();
this.__isOpened = true;
this.j.async.clearTimeout(this.__hideTimeout);
this.j.async.clearTimeout(this.__delayShowTimeout);
const to = this.j.o.showTooltipDelay || this.j.defaultTimeout;
if (!to) {
this.__show(getPoint, content);
return;
}
this.__delayShowTimeout = this.j.async.setTimeout(() => this.__show(getPoint, content), to);
}
__show(getPoint, content) {
this.setMod('visible', true);
this.getElm('content').innerHTML = content;
const point = getPoint();
css(this.container, {
left: point.x,
top: point.y
});
}
__hide() {
this.j.async.clearTimeout(this.__delayShowTimeout);
this.j.async.clearTimeout(this.__hideTimeout);
this.__removeListenersOnLeave();
if (this.__isOpened) {
this.__isOpened = false;
this.setMod('visible', false);
this.getElm('content').innerHTML = '';
css(this.container, {
left: -5000
});
}
}
__hideDelay() {
this.j.async.clearTimeout(this.__delayShowTimeout);
this.j.async.clearTimeout(this.__hideTimeout);
if (!this.__isOpened) {
return;
}
this.__hideTimeout = this.async.setTimeout(this.__hide, this.j.defaultTimeout);
}
destruct() {
this.__attachedContainers.forEach(container => {
this.j.e
.off(container, 'mouseenter.tooltip', this.__onMouseEnter)
.off(container, 'mouseleave.tooltip', this.__onMouseLeave);
});
this.__hide();
super.destruct();
}
};
__decorate([
autobind
], UITooltip.prototype, "__onMouseLeave", null);
__decorate([
autobind
], UITooltip.prototype, "__onMouseEnter", null);
__decorate([
autobind
], UITooltip.prototype, "__hide", null);
__decorate([
autobind
], UITooltip.prototype, "__hideDelay", null);
UITooltip = UITooltip_1 = __decorate([
component
], UITooltip);
export { UITooltip };

59
node_modules/jodit/esm/core/ui/element.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui
*/
import type { IDictionary, IUIElement, IViewBased, Nullable } from "../../types/index";
import { ViewComponent } from "../component/index";
import { Elms } from "../traits/elms";
import { Mods } from "../traits/mods";
export interface UIElement extends Mods, Elms {
}
export declare abstract class UIElement<T extends IViewBased = IViewBased> extends ViewComponent<T> implements IUIElement, Mods, Elms {
container: HTMLElement;
name: string;
private __parentElement;
get parentElement(): Nullable<IUIElement>;
set parentElement(parentElement: Nullable<IUIElement>);
bubble(callback: (parent: IUIElement) => void): this;
updateParentElement(target: IUIElement): this;
/** @override */
get<T>(chain: string, obj?: IDictionary): Nullable<T>;
/**
* Find match parent
*/
closest<T extends UIElement | typeof UIElement>(type: UIElement | Function): Nullable<T extends typeof UIElement ? InstanceType<T> : T>;
/**
* Find closest UIElement in DOM
*/
static closestElement(node: Node, type: Function): Nullable<IUIElement>;
readonly mods: IDictionary<string | boolean | null>;
/**
* Update UI from state
*/
update(): void;
/**
* Append container to element
*/
appendTo(element: HTMLElement): this;
/**
* Valid name only with valid chars
*/
protected clearName(name: string): string;
/**
* Method create only box
*/
protected render(options?: IDictionary): HTMLElement | string;
/**
* Create main HTML container
*/
protected createContainer(options?: IDictionary): HTMLElement;
protected parseTemplate(result: string): HTMLElement;
/** @override */
constructor(jodit: T, options?: IDictionary);
/** @override */
destruct(): any;
}

151
node_modules/jodit/esm/core/ui/element.js generated vendored Normal file
View File

@@ -0,0 +1,151 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UIElement_1;
import { Component, ViewComponent } from "../component/index.js";
import { derive } from "../decorators/derive/derive.js";
import { Dom } from "../dom/dom.js";
import { isString } from "../helpers/checker/is-string.js";
import { Elms } from "../traits/elms.js";
import { Mods } from "../traits/mods.js";
import { Icon } from "./icon.js";
let UIElement = UIElement_1 = class UIElement extends ViewComponent {
get parentElement() {
return this.__parentElement;
}
set parentElement(parentElement) {
this.__parentElement = parentElement;
if (parentElement) {
parentElement.hookStatus('beforeDestruct', () => this.destruct());
}
this.updateParentElement(this);
}
bubble(callback) {
let parent = this.parentElement;
while (parent) {
callback(parent);
parent = parent.parentElement;
}
return this;
}
updateParentElement(target) {
var _a;
(_a = this.__parentElement) === null || _a === void 0 ? void 0 : _a.updateParentElement(target);
return this;
}
/** @override */
get(chain, obj) {
return super.get(chain, obj) || this.getElm(chain);
}
/**
* Find match parent
*/
closest(type) {
const c = typeof type === 'object'
? (pe) => pe === type
: (pe) => Component.isInstanceOf(pe, type);
let pe = this.__parentElement;
while (pe) {
if (c(pe)) {
return pe;
}
if (!pe.parentElement && pe.container.parentElement) {
pe = UIElement_1.closestElement(pe.container.parentElement, UIElement_1);
}
else {
pe = pe.parentElement;
}
}
return null;
}
/**
* Find closest UIElement in DOM
*/
static closestElement(node, type) {
const elm = Dom.up(node, elm => {
if (elm) {
const { component } = elm;
return component && Component.isInstanceOf(component, type);
}
return false;
});
return elm ? elm === null || elm === void 0 ? void 0 : elm.component : null;
}
/**
* Update UI from state
*/
update() {
// empty
}
/**
* Append container to element
*/
appendTo(element) {
element.appendChild(this.container);
return this;
}
/**
* Valid name only with valid chars
*/
clearName(name) {
return name.replace(/[^a-zA-Z0-9]/g, '_');
}
/**
* Method create only box
*/
render(options) {
return this.j.c.div(this.componentName);
}
/**
* Create main HTML container
*/
createContainer(options) {
const result = this.render(options);
if (isString(result)) {
const elm = this.parseTemplate(result);
elm.classList.add(this.componentName);
return elm;
}
return result;
}
parseTemplate(result) {
return this.j.c.fromHTML(result
.replace(/\*([^*]+?)\*/g, (_, name) => Icon.get(name) || '')
.replace(/&_/g, this.componentName + '_')
.replace(/~([^~]+?)~/g, (_, s) => this.i18n(s)));
}
/** @override */
constructor(jodit, options) {
super(jodit);
this.name = '';
this.__parentElement = null;
this.mods = {};
this.container = this.createContainer(options);
Object.defineProperty(this.container, 'component', {
value: this,
configurable: true
});
}
/** @override */
destruct() {
Dom.safeRemove(this.container);
this.parentElement = null;
return super.destruct();
}
};
UIElement = UIElement_1 = __decorate([
derive(Mods, Elms)
], UIElement);
export { UIElement };

28
node_modules/jodit/esm/core/ui/form/block/block.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIElement, IViewBased } from "../../../../types/index";
import { UIGroup } from "../../group/group";
export declare class UIBlock extends UIGroup {
readonly options: {
className?: string;
align?: 'center' | 'left' | 'right' | 'full';
width?: 'full';
ref?: string;
mod?: string;
};
/** @override */
className(): string;
constructor(jodit: IViewBased, elements?: Array<IUIElement | void | null | false>, options?: {
className?: string;
align?: 'center' | 'left' | 'right' | 'full';
width?: 'full';
ref?: string;
mod?: string;
});
}

41
node_modules/jodit/esm/core/ui/form/block/block.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { component } from "../../../decorators/component/component.js";
import { attr } from "../../../helpers/utils/index.js";
import { UIGroup } from "../../group/group.js";
let UIBlock = class UIBlock extends UIGroup {
/** @override */
className() {
return 'UIBlock';
}
constructor(jodit, elements, options = {
align: 'left'
}) {
super(jodit, elements);
this.options = options;
this.setMod('align', this.options.align || 'left');
this.setMod('width', this.options.width || '');
this.options.mod && this.setMod(this.options.mod, true);
this.options.className &&
this.container.classList.add(this.options.className);
attr(this.container, 'data-ref', options.ref);
attr(this.container, 'ref', options.ref);
}
};
UIBlock = __decorate([
component
], UIBlock);
export { UIBlock };

23
node_modules/jodit/esm/core/ui/form/form.d.ts generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/form/README.md]]
* @packageDocumentation
* @module ui/form
*/
import type { IDictionary, IUIForm } from "../../../types/index";
import { UIGroup } from "../group/group";
export declare class UIForm extends UIGroup implements IUIForm {
/** @override */
className(): string;
container: HTMLFormElement;
submit(): void;
validate(): boolean;
onSubmit(handler: (data: IDictionary) => false | void): this;
/** @override */
protected createContainer(): HTMLElement;
constructor(...args: ConstructorParameters<typeof UIGroup>);
}

78
node_modules/jodit/esm/core/ui/form/form.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component } from "../../component/component.js";
import { component } from "../../decorators/component/component.js";
import { attr } from "../../helpers/utils/index.js";
import { UIInput } from "./inputs/input/input.js";
import { UISelect } from "./inputs/select/select.js";
import { UIGroup } from "../group/group.js";
let UIForm = class UIForm extends UIGroup {
/** @override */
className() {
return 'UIForm';
}
submit() {
this.j.e.fire(this.container, 'submit');
}
validate() {
const inputs = this.allChildren.filter(elm => Component.isInstanceOf(elm, UIInput));
for (const input of inputs) {
if (!input.validate()) {
return false;
}
}
const selects = this.allChildren.filter(elm => Component.isInstanceOf(elm, UISelect));
for (const select of selects) {
if (!select.validate()) {
return false;
}
}
return true;
}
onSubmit(handler) {
this.j.e.on(this.container, 'submit', () => {
const inputs = this.allChildren.filter(elm => Component.isInstanceOf(elm, UIInput));
if (!this.validate()) {
return false;
}
handler(inputs.reduce((res, item) => {
res[item.state.name] = item.value;
return res;
}, {}));
return false;
});
return this;
}
/** @override */
createContainer() {
const form = this.j.c.element('form');
form.classList.add(this.componentName);
attr(form, 'dir', this.j.o.direction || 'auto');
attr(form, 'novalidate', '');
return form;
}
constructor(...args) {
var _a, _b;
super(...args);
if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.className) {
this.container.classList.add((_b = this.options) === null || _b === void 0 ? void 0 : _b.className);
}
}
};
UIForm = __decorate([
component
], UIForm);
export { UIForm };

11
node_modules/jodit/esm/core/ui/form/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * from "./block/block";
export * from "./form";
export * from "./inputs/index";

11
node_modules/jodit/esm/core/ui/form/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * from "./block/block.js";
export * from "./form.js";
export * from "./inputs/index.js";

View File

@@ -0,0 +1,22 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIInput, IUITextArea, IViewBased } from "../../../../../types/index";
import { UIInput } from "../input/input";
export declare class UITextArea extends UIInput implements IUITextArea {
/** @override */
className(): string;
/** @override */
static defaultState: IUITextArea['state'];
nativeInput: HTMLTextAreaElement;
protected createNativeInput(options?: Partial<this['state']>): IUIInput['nativeInput'];
/** @override */
state: IUITextArea['state'];
constructor(jodit: IViewBased, state: Partial<IUITextArea['state']>);
protected onChangeStateSize(): void;
}

View File

@@ -0,0 +1,55 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UITextArea_1;
import { watch } from "../../../../decorators/index.js";
import { component } from "../../../../decorators/component/component.js";
import { UIInput } from "../input/input.js";
let UITextArea = UITextArea_1 = class UITextArea extends UIInput {
/** @override */
className() {
return 'UITextArea';
}
createNativeInput(options) {
return this.j.create.element('textarea');
}
constructor(jodit, state) {
super(jodit, state);
/** @override */
this.state = { ...UITextArea_1.defaultState };
Object.assign(this.state, state);
if (this.state.resizable === false) {
this.nativeInput.style.resize = 'none';
}
}
onChangeStateSize() {
const { size, resizable } = this.state;
this.nativeInput.style.resize = resizable ? 'auto' : 'none';
this.nativeInput.rows = size !== null && size !== void 0 ? size : 5;
}
};
/** @override */
UITextArea.defaultState = {
...UIInput.defaultState,
size: 5,
resizable: true
};
__decorate([
watch(['state.size', 'state.resizable'])
], UITextArea.prototype, "onChangeStateSize", null);
UITextArea = UITextArea_1 = __decorate([
component
], UITextArea);
export { UITextArea };

View File

@@ -0,0 +1,25 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUICheckBox, IViewBased } from "../../../../../types/index";
import { UIInput } from "../input/input";
export declare class UICheckbox extends UIInput implements IUICheckBox {
/** @override */
className(): string;
/** @override */
static defaultState: IUICheckBox['state'];
/** @override */
state: IUICheckBox['state'];
/** @override */
protected render(): HTMLElement;
/** @override **/
constructor(jodit: IViewBased, options: Partial<IUICheckBox['state']>);
protected onChangeChecked(): void;
protected onChangeNativeCheckBox(): void;
protected onChangeSwitch(): void;
}

View File

@@ -0,0 +1,80 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UICheckbox_1;
import { component, hook, watch } from "../../../../decorators/index.js";
import { Dom } from "../../../../dom/dom.js";
import { UIInput } from "../input/input.js";
let UICheckbox = UICheckbox_1 = class UICheckbox extends UIInput {
/** @override */
className() {
return 'UICheckbox';
}
/** @override */
render() {
return this.j.c.element('label', {
className: this.componentName
});
}
/** @override **/
constructor(jodit, options) {
super(jodit, { ...options, type: 'checkbox' });
/** @override */
this.state = { ...UICheckbox_1.defaultState };
Object.assign(this.state, options);
}
onChangeChecked() {
this.value = this.state.checked.toString();
this.nativeInput.checked = this.state.checked;
this.setMod('checked', this.state.checked);
}
onChangeNativeCheckBox() {
this.state.checked = this.nativeInput.checked;
}
onChangeSwitch() {
this.setMod('switch', this.state.switch);
let slider = this.getElm('switch-slider');
if (this.state.switch) {
if (!slider) {
slider = this.j.c.div(this.getFullElName('switch-slider'));
}
Dom.after(this.nativeInput, slider);
}
else {
Dom.safeRemove(slider);
}
}
};
/** @override */
UICheckbox.defaultState = {
...UIInput.defaultState,
checked: false,
switch: false
};
__decorate([
watch('state.checked'),
hook('ready')
], UICheckbox.prototype, "onChangeChecked", null);
__decorate([
watch('nativeInput:change')
], UICheckbox.prototype, "onChangeNativeCheckBox", null);
__decorate([
watch('state.switch'),
hook('ready')
], UICheckbox.prototype, "onChangeSwitch", null);
UICheckbox = UICheckbox_1 = __decorate([
component
], UICheckbox);
export { UICheckbox };

View File

@@ -0,0 +1,22 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIInput, IViewBased } from "../../../../../types/index";
import { UIInput } from "../input/input";
export declare class UIFileInput extends UIInput {
private button;
state: UIInput['state'] & {
onlyImages: boolean;
tooltip?: string;
};
/** @override */
className(): string;
protected createContainer(options: Partial<this['state']>): HTMLElement;
protected createNativeInput(options: Partial<this['state']>): IUIInput['nativeInput'];
constructor(jodit: IViewBased, options: Partial<UIFileInput['state']>);
}

View File

@@ -0,0 +1,65 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { component } from "../../../../decorators/component/component.js";
import { UIButton } from "../../../button/button/button.js";
import { UIInput } from "../input/input.js";
let UIFileInput = class UIFileInput extends UIInput {
/** @override */
className() {
return 'UIFileInput';
}
createContainer(options) {
this.button = new UIButton(this.j, {
tooltip: options.tooltip,
icon: {
name: 'plus'
}
});
const { container } = this.button;
if (!this.nativeInput) {
this.nativeInput = this.createNativeInput(options);
}
const { nativeInput } = this;
nativeInput.classList.add(this.getFullElName('input'));
container.classList.add(this.componentName);
container.appendChild(nativeInput);
return container;
}
createNativeInput(options) {
return this.j.create.fromHTML(`<input
type="file"
accept="${options.onlyImages ? 'image/*' : '*'}"
tabindex="-1"
dir="auto"
multiple=""
/>`);
}
constructor(jodit, options) {
super(jodit, {
type: 'file',
...options
});
this.state = {
...UIInput.defaultState,
type: 'file',
onlyImages: true
};
}
};
UIFileInput = __decorate([
component
], UIFileInput);
export { UIFileInput };

13
node_modules/jodit/esm/core/ui/form/inputs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * from "./area/area";
export * from "./checkbox/checkbox";
export * from "./file/file";
export * from "./input/input";
export * from "./select/select";

13
node_modules/jodit/esm/core/ui/form/inputs/index.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * from "./area/area.js";
export * from "./checkbox/checkbox.js";
export * from "./file/file.js";
export * from "./input/input.js";
export * from "./select/select.js";

View File

@@ -0,0 +1,55 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIInput, IUIInputValidator, IViewBased } from "../../../../../types/index";
import { UIElement } from "../../../element";
export declare class UIInput extends UIElement implements IUIInput {
/** @override */
className(): string;
/** @override */
nativeInput: IUIInput['nativeInput'];
private label;
private icon;
private clearButton;
private wrapper;
static defaultState: IUIInput['state'];
state: IUIInput['state'];
protected onChangeClear(): void;
protected onChangeClassName(ignore?: unknown, oldClassName?: string): void;
protected onChangeState(): void;
protected updateValidators(): void;
private __errorBox;
set error(value: string);
get value(): string;
set value(value: string);
/**
* Call on every state value changed
*/
protected onChangeStateValue(): void;
/**
* Call on every native value changed
*/
protected onChangeValue(): void;
protected validators: Set<IUIInputValidator>;
validate(): boolean;
private __markInputInvalid;
/** @override **/
protected createContainer(options: Partial<this['state']>): HTMLElement;
/**
* Create native input element
*/
protected createNativeInput(options?: Partial<this['state']>): IUIInput['nativeInput'];
/** @override **/
constructor(jodit: IViewBased, options?: Partial<IUIInput['state']>);
focus(): void;
get isFocused(): boolean;
/**
* Set `focused` mod on change focus
*/
private onChangeFocus;
}

View File

@@ -0,0 +1,243 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UIInput_1;
import { autobind, component, debounce, watch } from "../../../../decorators/index.js";
import { Dom } from "../../../../dom/dom.js";
import { toArray } from "../../../../helpers/array/to-array.js";
import { attr } from "../../../../helpers/utils/index.js";
import { UIElement } from "../../../element.js";
import { inputValidators } from "../../validators/index.js";
import { Icon } from "../../../icon.js";
let UIInput = UIInput_1 = class UIInput extends UIElement {
/** @override */
className() {
return 'UIInput';
}
onChangeClear() {
if (this.state.clearButton) {
Dom.after(this.nativeInput, this.clearButton);
}
else {
Dom.safeRemove(this.clearButton);
}
}
onChangeClassName(ignore, oldClassName) {
oldClassName && this.container.classList.remove(oldClassName);
this.state.className &&
this.container.classList.add(this.state.className);
}
onChangeState() {
this.name = this.state.name;
const input = this.nativeInput, { name, icon, type, ref, required, placeholder, autocomplete, label } = this.state;
attr(input, 'name', name);
attr(input, 'type', type);
attr(input, 'data-ref', ref || name);
attr(input, 'ref', ref || name);
attr(input, 'required', required || null);
attr(input, 'autocomplete', !autocomplete ? 'off' : null);
attr(input, 'placeholder', placeholder ? this.j.i18n(placeholder) : '');
if (icon && Icon.exists(icon)) {
Dom.before(input, this.icon);
this.icon.innerHTML = Icon.get(icon);
}
else {
Dom.safeRemove(this.icon);
}
if (label) {
Dom.before(this.wrapper, this.label);
this.label.innerText = this.j.i18n(label);
}
else {
Dom.safeRemove(this.label);
}
this.updateValidators();
}
updateValidators() {
var _a;
this.validators.clear();
if (this.state.required) {
this.validators.add(inputValidators.required);
}
(_a = this.state.validators) === null || _a === void 0 ? void 0 : _a.forEach(name => {
const validator = inputValidators[name];
validator && this.validators.add(validator);
});
}
set error(value) {
this.setMod('has-error', Boolean(value));
if (!value) {
Dom.safeRemove(this.__errorBox);
}
else {
this.__errorBox.innerText = this.j.i18n(value, this.j.i18n(this.state.label || ''));
this.container.appendChild(this.__errorBox);
}
}
get value() {
return this.nativeInput.value;
}
set value(value) {
if (this.value !== value) {
this.nativeInput.value = value;
this.onChangeValue();
}
}
/**
* Call on every state value changed
*/
onChangeStateValue() {
const value = this.state.value.toString();
if (value !== this.value) {
this.value = value;
}
}
/**
* Call on every native value changed
*/
onChangeValue() {
var _a, _b;
const { value } = this;
if (this.state.value !== value) {
this.state.value = value;
this.j.e.fire(this, 'change', value);
(_b = (_a = this.state).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, value);
}
}
validate() {
this.error = '';
const validate = toArray(this.validators).every(validator => validator(this));
this.__markInputInvalid();
return validate;
}
__markInputInvalid() {
var _a, _b, _c, _d;
if (this.error) {
this.nativeInput.setAttribute('aria-invalid', 'true');
(_b = (_a = this.nativeInput).setCustomValidity) === null || _b === void 0 ? void 0 : _b.call(_a, this.error);
}
else {
this.nativeInput.removeAttribute('aria-invalid');
(_d = (_c = this.nativeInput).setCustomValidity) === null || _d === void 0 ? void 0 : _d.call(_c, '');
}
}
/** @override **/
createContainer(options) {
const container = super.createContainer();
this.wrapper = this.j.c.div(this.getFullElName('wrapper'));
if (!this.nativeInput) {
this.nativeInput = this.createNativeInput();
}
const { nativeInput } = this;
nativeInput.classList.add(this.getFullElName('input'));
this.wrapper.appendChild(nativeInput);
container.appendChild(this.wrapper);
attr(nativeInput, 'dir', this.j.o.direction || 'auto');
return container;
}
/**
* Create native input element
*/
createNativeInput(options) {
return this.j.create.element('input');
}
/** @override **/
constructor(jodit, options) {
super(jodit, options);
this.label = this.j.c.span(this.getFullElName('label'));
this.icon = this.j.c.span(this.getFullElName('icon'));
this.clearButton = this.j.c.span(this.getFullElName('clear'), Icon.get('cancel'));
this.state = { ...UIInput_1.defaultState };
this.__errorBox = this.j.c.span(this.getFullElName('error'));
this.validators = new Set([]);
if ((options === null || options === void 0 ? void 0 : options.value) !== undefined) {
options.value = options.value.toString();
}
Object.assign(this.state, options);
if (this.state.clearButton !== undefined) {
this.j.e
.on(this.clearButton, 'click', (e) => {
e.preventDefault();
this.nativeInput.value = '';
this.j.e.fire(this.nativeInput, 'input');
this.focus();
})
.on(this.nativeInput, 'input', () => {
this.state.clearButton = Boolean(this.value.length);
});
this.state.clearButton = Boolean(this.value.length);
}
this.j.e
.on(this.nativeInput, 'focus blur', () => {
this.onChangeFocus();
})
.on(this.nativeInput, 'input change', this.onChangeValue);
this.onChangeState();
this.onChangeClassName();
this.onChangeStateValue();
}
focus() {
this.nativeInput.focus();
}
get isFocused() {
return this.nativeInput === this.j.od.activeElement;
}
/**
* Set `focused` mod on change focus
*/
onChangeFocus() {
this.setMod('focused', this.isFocused);
}
};
UIInput.defaultState = {
className: '',
autocomplete: true,
name: '',
value: '',
icon: '',
label: '',
ref: '',
type: 'text',
placeholder: '',
required: false,
validators: []
};
__decorate([
watch('state.clearButton')
], UIInput.prototype, "onChangeClear", null);
__decorate([
watch('state.className')
], UIInput.prototype, "onChangeClassName", null);
__decorate([
watch([
'state.name',
'state.type',
'state.label',
'state.placeholder',
'state.autocomplete',
'state.icon'
], { immediately: false }),
debounce()
], UIInput.prototype, "onChangeState", null);
__decorate([
watch('state.value')
], UIInput.prototype, "onChangeStateValue", null);
__decorate([
autobind
], UIInput.prototype, "onChangeValue", null);
UIInput = UIInput_1 = __decorate([
component
], UIInput);
export { UIInput };

View File

@@ -0,0 +1,27 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUISelect, IViewBased } from "../../../../../types/index";
import { UIInput } from "../input/input";
export declare class UISelect extends UIInput implements IUISelect {
/** @override */
className(): string;
/** @override */
nativeInput: IUISelect['nativeInput'];
/** @override */
static defaultState: IUISelect['state'];
/** @override */
state: IUISelect['state'];
/** @override **/
protected createContainer(state: Partial<IUISelect['state']>): HTMLElement;
/** @override **/
protected createNativeInput(): IUISelect['nativeInput'];
/** @override **/
protected updateValidators(): void;
constructor(jodit: IViewBased, state: Partial<IUISelect['state']>);
}

View File

@@ -0,0 +1,81 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UISelect_1;
import { component } from "../../../../decorators/component/component.js";
import { attr } from "../../../../helpers/utils/attr.js";
import { UIInput } from "../input/input.js";
import { inputValidators, selectValidators } from "../../validators/index.js";
let UISelect = UISelect_1 = class UISelect extends UIInput {
/** @override */
className() {
return 'UISelect';
}
/** @override **/
createContainer(state) {
var _a;
const container = super.createContainer(state);
const { j } = this, { nativeInput } = this;
const opt = () => j.create.element('option');
if (state.placeholder !== undefined) {
const option = opt();
option.value = '';
option.text = j.i18n(state.placeholder);
nativeInput.add(option);
}
(_a = state.options) === null || _a === void 0 ? void 0 : _a.forEach(element => {
const option = opt();
option.value = element.value.toString();
option.text = j.i18n(element.text);
nativeInput.add(option);
});
if (state.size && state.size > 0) {
attr(nativeInput, 'size', state.size);
}
if (state.multiple) {
attr(nativeInput, 'multiple', '');
}
return container;
}
/** @override **/
createNativeInput() {
return this.j.create.element('select');
}
/** @override **/
updateValidators() {
super.updateValidators();
if (this.state.required) {
this.validators.delete(inputValidators.required);
this.validators.add(selectValidators.required);
}
}
constructor(jodit, state) {
super(jodit, state);
/** @override */
this.state = { ...UISelect_1.defaultState };
Object.assign(this.state, state);
}
};
/** @override */
UISelect.defaultState = {
...UIInput.defaultState,
options: [],
size: 1,
multiple: false
};
UISelect = UISelect_1 = __decorate([
component
], UISelect);
export { UISelect };

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * as inputValidators from "./input";
export * as selectValidators from "./select";

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
export * as inputValidators from "./input.js";
export * as selectValidators from "./select.js";

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIInputValidator } from "../../../../types/index";
/**
* Input is required
*/
export declare const required: IUIInputValidator;
/**
* Input value should be valid URL
*/
export declare const url: IUIInputValidator;

View File

@@ -0,0 +1,27 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isURL } from "../../../helpers/checker/is-url.js";
import { trim } from "../../../helpers/string/trim.js";
/**
* Input is required
*/
export const required = function (input) {
if (!trim(input.value).length) {
input.error = 'Please fill out this field';
return false;
}
return true;
};
/**
* Input value should be valid URL
*/
export const url = function (input) {
if (!isURL(trim(input.value))) {
input.error = 'Please enter a web address';
return false;
}
return true;
};

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/form
*/
import type { IUIInputValidator } from "../../../../types/index";
/**
* Select is required
*/
export declare const required: IUIInputValidator;

View File

@@ -0,0 +1,16 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { trim } from "../../../helpers/string/trim.js";
/**
* Select is required
*/
export const required = function (select) {
if (!trim(select.value).length) {
select.error = 'Please fill out this field';
return false;
}
return true;
};

56
node_modules/jodit/esm/core/ui/group/group.d.ts generated vendored Normal file
View File

@@ -0,0 +1,56 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/group/README.md]]
* @packageDocumentation
* @module ui/group
*/
import type { IDictionary, IUIButtonState, IUIElement, IUIGroup, IViewBased, ModType } from "../../../types/index";
import { UIElement } from "../element";
export declare class UIGroup<T extends IViewBased = IViewBased> extends UIElement<T> implements IUIGroup {
readonly options?: IDictionary | undefined;
className(): string;
/**
* Synchronize mods to all children
*/
syncMod: boolean;
elements: IUIElement[];
/**
* All group children
*/
get allChildren(): IUIElement[];
buttonSize: IUIButtonState['size'];
/**
* Update all children
*/
update(): void;
/**
* Append new element into group
*/
append(elm: IUIElement, index?: number): this;
append(elm: IUIElement, distElement?: string): this;
append(elm: IUIElement[], distElement?: string): this;
/** @override */
afterSetMod(name: string, value: ModType): void;
/**
* Allow set another container for the box of all children
*/
protected appendChildToContainer(childContainer: HTMLElement, index?: number): void;
/**
* Remove element from group
*/
remove(elm: IUIElement): this;
/**
* Clear group
*/
clear(): this;
/**
* @param elements - Items of group
*/
constructor(jodit: T, elements?: Array<IUIElement | void | null | false>, options?: IDictionary | undefined);
/** @override */
destruct(): any;
}

157
node_modules/jodit/esm/core/ui/group/group.js generated vendored Normal file
View File

@@ -0,0 +1,157 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var UIGroup_1;
import { Component } from "../../component/component.js";
import { component, watch } from "../../decorators/index.js";
import { Dom } from "../../dom/dom.js";
import { isArray } from "../../helpers/index.js";
import { UIElement } from "../element.js";
let UIGroup = UIGroup_1 = class UIGroup extends UIElement {
className() {
return 'UIGroup';
}
/**
* All group children
*/
get allChildren() {
const result = [];
const stack = [
...this.elements
];
while (stack.length) {
const elm = stack.shift();
if (isArray(elm)) {
stack.push(...elm);
}
else if (Component.isInstanceOf(elm, UIGroup_1)) {
stack.push(...elm.elements);
}
else {
elm && result.push(elm);
}
}
return result;
}
/**
* Update all children
*/
update() {
this.elements.forEach(elm => elm.update());
this.setMod('size', this.buttonSize);
}
append(elms, distElementOrIndex) {
if (isArray(elms)) {
if (typeof distElementOrIndex === 'number') {
throw new Error('You can not use index when append array of elements');
}
elms.forEach(item => this.append(item, distElementOrIndex));
return this;
}
const elm = elms;
let index = undefined;
if (typeof distElementOrIndex === 'number') {
index = Math.min(Math.max(0, distElementOrIndex), this.elements.length);
this.elements.splice(index, 0, elm);
}
else {
this.elements.push(elm);
}
if (elm.name) {
elm.container.classList.add(this.getFullElName(elm.name));
}
if (distElementOrIndex && typeof distElementOrIndex === 'string') {
const distElm = this.getElm(distElementOrIndex);
if (distElm == null) {
throw new Error('Element does not exist');
}
distElm.appendChild(elm.container);
}
else {
this.appendChildToContainer(elm.container, index);
}
elm.parentElement = this;
return this;
}
/** @override */
afterSetMod(name, value) {
if (this.syncMod) {
this.elements.forEach(elm => elm.setMod(name, value));
}
}
/**
* Allow set another container for the box of all children
*/
appendChildToContainer(childContainer, index) {
if (index === undefined ||
index < 0 ||
index > this.elements.length - 1 ||
this.container.children[index] == null) {
this.container.appendChild(childContainer);
}
else {
this.container.insertBefore(childContainer, this.container.children[index]);
}
}
/**
* Remove element from group
*/
remove(elm) {
const index = this.elements.indexOf(elm);
if (index !== -1) {
this.elements.splice(index, 1);
Dom.safeRemove(elm.container);
elm.parentElement = null;
}
return this;
}
/**
* Clear group
*/
clear() {
this.elements.forEach(elm => elm.destruct());
this.elements.length = 0;
return this;
}
/**
* @param elements - Items of group
*/
constructor(jodit, elements, options) {
super(jodit, options);
this.options = options;
/**
* Synchronize mods to all children
*/
this.syncMod = false;
this.elements = [];
this.buttonSize = 'middle';
elements === null || elements === void 0 ? void 0 : elements.forEach(elm => elm && this.append(elm));
if (options === null || options === void 0 ? void 0 : options.name) {
this.name = options.name;
}
}
/** @override */
destruct() {
this.clear();
return super.destruct();
}
};
__decorate([
watch('buttonSize')
], UIGroup.prototype, "update", null);
UIGroup = UIGroup_1 = __decorate([
component
], UIGroup);
export { UIGroup };

12
node_modules/jodit/esm/core/ui/group/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/group
*/
export * from "./group";
export * from "./list";
export * from "./separator";
export * from "./spacer";

12
node_modules/jodit/esm/core/ui/group/index.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/group
*/
export * from "./group.js";
export * from "./list.js";
export * from "./separator.js";
export * from "./spacer.js";

38
node_modules/jodit/esm/core/ui/group/list.d.ts generated vendored Normal file
View File

@@ -0,0 +1,38 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/group
*/
import type { ButtonsOption, IControlTypeStrong, IUIButton, IUIList, IViewBased, Nullable } from "../../../types/index";
import { UIGroup } from "./group";
export declare class UIList<T extends IViewBased = IViewBased> extends UIGroup<T> implements IUIList {
/** @override */
className(): string;
jodit: T;
mode: IUIList['mode'];
protected __onChangeMode(): void;
constructor(jodit: T);
/**
* Make new group and append it in list of elements
*/
private makeGroup;
/**
* All buttons from list
*/
get buttons(): IUIButton[];
/**
* Helper for getting full plain button list
*/
getButtonsNames(): string[];
protected removeButtons: string[];
setRemoveButtons(removeButtons?: string[]): this;
build(items: ButtonsOption, target?: Nullable<HTMLElement>): IUIList;
protected makeSelect(control: IControlTypeStrong, target: Nullable<HTMLElement>): IUIButton;
/**
* Create button instance
*/
protected makeButton(control: IControlTypeStrong, target: Nullable<HTMLElement>): IUIButton;
}

163
node_modules/jodit/esm/core/ui/group/list.js generated vendored Normal file
View File

@@ -0,0 +1,163 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component } from "../../component/component.js";
import { component, hook, watch } from "../../decorators/index.js";
import { splitArray } from "../../helpers/array/split-array.js";
import { UIButton } from "../button/button/button.js";
import { UIGroup } from "./group.js";
import { UISeparator } from "./separator.js";
import { UISpacer } from "./spacer.js";
import { isButtonGroup } from "../helpers/buttons.js";
import { getControlType } from "../helpers/get-control-type.js";
import { getStrongControlTypes } from "../helpers/get-strong-control-types.js";
let UIList = class UIList extends UIGroup {
/** @override */
className() {
return 'UIList';
}
__onChangeMode() {
this.setMod('mode', this.mode);
}
constructor(jodit) {
super(jodit);
this.mode = 'horizontal';
this.removeButtons = [];
}
/**
* Make new group and append it in list of elements
*/
makeGroup() {
return new UIGroup(this.jodit);
}
/**
* All buttons from list
*/
get buttons() {
return this.allChildren.filter(elm => Component.isInstanceOf(elm, UIButton));
}
/**
* Helper for getting full plain button list
*/
getButtonsNames() {
return this.buttons
.map(a => (a instanceof UIButton && a.state.name) || '')
.filter(a => a !== '');
}
setRemoveButtons(removeButtons) {
this.removeButtons = removeButtons || [];
return this;
}
build(items, target = null) {
items = splitArray(items);
this.clear();
let lastBtnSeparator = false;
let line = this.makeGroup();
this.append(line);
line.setMod('line', true);
let group;
const addButton = (control) => {
let elm = null;
switch (control.name) {
case '\n':
line = this.makeGroup();
line.setMod('line', true);
group = this.makeGroup();
line.append(group);
this.append(line);
break;
case '|':
if (!lastBtnSeparator) {
lastBtnSeparator = true;
elm = new UISeparator(this.j);
}
break;
case '---': {
group.setMod('before-spacer', true);
const space = new UISpacer(this.j);
line.append(space);
group = this.makeGroup();
line.append(group);
lastBtnSeparator = false;
break;
}
default:
lastBtnSeparator = false;
switch (control.component) {
case 'select':
elm = this.makeSelect(control, target);
break;
case 'button':
default:
elm = this.makeButton(control, target);
}
}
if (elm) {
if (!group) {
group = this.makeGroup();
line.append(group);
}
group.append(elm);
}
};
const isNotRemoved = (b) => {
var _a;
return !this.removeButtons.includes(b.name) &&
(!b.isVisible || ((_a = b.isVisible) === null || _a === void 0 ? void 0 : _a.call(b, this.j, b)));
};
items.forEach(item => {
if (isButtonGroup(item)) {
const buttons = item.buttons.filter(b => b);
if (buttons.length) {
group = this.makeGroup();
group.setMod('separated', true).setMod('group', item.group);
line.append(group);
getStrongControlTypes(buttons, this.j.o.controls)
.filter(isNotRemoved)
.forEach(addButton);
}
}
else {
if (!group) {
group = this.makeGroup();
line.append(group);
}
const control = getControlType(item, this.j.o.controls);
isNotRemoved(control) && addButton(control);
}
});
this.update();
return this;
}
makeSelect(control, target) {
throw new Error('Not implemented behaviour');
}
/**
* Create button instance
*/
makeButton(control, target) {
return new UIButton(this.j, {
name: control.name
});
}
};
__decorate([
watch('mode'),
hook('ready')
], UIList.prototype, "__onChangeMode", null);
UIList = __decorate([
component
], UIList);
export { UIList };

9
node_modules/jodit/esm/core/ui/group/separator.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { UIElement } from "../element";
export declare class UISeparator extends UIElement {
className(): string;
}

29
node_modules/jodit/esm/core/ui/group/separator.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
* @module ui/group
*/
import { component } from "../../decorators/component/component.js";
import { UIElement } from "../element.js";
let UISeparator = class UISeparator extends UIElement {
className() {
return 'UISeparator';
}
};
UISeparator = __decorate([
component
], UISeparator);
export { UISeparator };

9
node_modules/jodit/esm/core/ui/group/spacer.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { UIElement } from "../element";
export declare class UISpacer extends UIElement {
className(): string;
}

29
node_modules/jodit/esm/core/ui/group/spacer.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
* @module ui/group
*/
import { component } from "../../decorators/component/component.js";
import { UIElement } from "../element.js";
let UISpacer = class UISpacer extends UIElement {
className() {
return 'UISpacer';
}
};
UISpacer = __decorate([
component
], UISpacer);
export { UISpacer };

17
node_modules/jodit/esm/core/ui/helpers/buttons.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui
*/
import type { ButtonsGroup, ButtonsGroups, IControlType, IJodit } from "../../../types/index";
/**
* @private
*/
export declare const isButtonGroup: (item: ButtonsGroup | string | IControlType) => item is ButtonsGroup;
/**
* @private
*/
export declare function flatButtonsSet(buttons: ButtonsGroups, jodit: IJodit): Set<string | IControlType>;

31
node_modules/jodit/esm/core/ui/helpers/buttons.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isArray } from "../../helpers/checker/is-array.js";
/**
* @private
*/
export const isButtonGroup = (item) => {
return isArray(item.buttons);
};
/**
* @private
*/
export function flatButtonsSet(buttons, jodit) {
const groups = jodit.getRegisteredButtonGroups();
return new Set(buttons.reduce((acc, item) => {
var _a;
if (isButtonGroup(item)) {
acc = acc.concat([
...item.buttons,
...((_a = groups[item.group]) !== null && _a !== void 0 ? _a : [])
]);
}
else {
acc.push(item);
}
return acc;
}, []));
}

View File

@@ -0,0 +1,18 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui
*/
import type { CanUndef, Controls, IControlType, IControlTypeStrong } from "../../../types/index";
/**
* Get control for button name
* @private
*/
export declare function getControlType(button: IControlType | string, controls: CanUndef<Controls>): IControlTypeStrong;
/**
* @private
*/
export declare function findControlType(path: string, controls: Controls): IControlTypeStrong | void;

View File

@@ -0,0 +1,69 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { ConfigFlatten, /*isArray,*/ isString } from "../../helpers/index.js";
import { Config } from "../../../config.js";
/**
* Get control for button name
* @private
*/
export function getControlType(button, controls) {
let buttonControl;
if (!controls) {
controls = Config.defaultOptions.controls;
}
if (!isString(button)) {
buttonControl = { name: 'empty', ...ConfigFlatten(button) };
if (controls[buttonControl.name] !== undefined) {
buttonControl = {
...ConfigFlatten(controls[buttonControl.name]),
...ConfigFlatten(buttonControl)
};
}
}
else {
buttonControl = findControlType(button, controls) || {
name: button,
command: button,
tooltip: button
};
}
return buttonControl;
}
/**
* @private
*/
export function findControlType(path, controls) {
// eslint-disable-next-line prefer-const
let [namespaceOrKey, key] = path.split(/\./);
let store = controls;
if (key != null) {
if (controls[namespaceOrKey] !== undefined) {
store = controls[namespaceOrKey];
}
}
else {
key = namespaceOrKey;
}
// const list = store[key]?.list;
return store[key]
? {
name: key,
...ConfigFlatten(store[key])
// list: isArray(list)
// ? (<Array<string>>list).reduce(
// (
// acc: IDictionary<string | number>,
// k: string | number
// ) => {
// acc[String(k)] = k;
// return acc;
// },
// {}
// )
// : list
}
: undefined;
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui
*/
import type { Buttons, Controls, IControlTypeStrong, IDictionary } from "../../../types/index";
/**
* @private
*/
export declare function getStrongControlTypes(items: Buttons | IDictionary<string>, controls?: Controls): IControlTypeStrong[];

View File

@@ -0,0 +1,21 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isArray } from "../../helpers/checker/is-array.js";
import { ConfigProto, keys } from "../../helpers/utils/index.js";
import { Config } from "../../../config.js";
import { getControlType } from "./get-control-type.js";
/**
* @private
*/
export function getStrongControlTypes(items, controls) {
const elements = isArray(items)
? items
: keys(items, false).map(key => {
const value = items[key] || {};
return ConfigProto({ name: key }, value);
});
return elements.map(item => getControlType(item, controls || Config.defaultOptions.controls));
}

30
node_modules/jodit/esm/core/ui/icon.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui
*/
import type { CanUndef, IUIIconState, IViewBased } from "../../types/index";
export declare class Icon {
private static icons;
private static getIcon;
/**
* Check if icon exist in store
*/
static exists(name: string): boolean;
/**
* Return SVG icon
*/
static get(name: string, defaultValue?: string): string;
/**
* Set SVG in store
*/
static set(name: string, value: string): typeof Icon;
private static __cache;
/**
* Make icon html element
*/
static makeIcon(jodit: IViewBased, icon: IUIIconState): CanUndef<Node>;
}

90
node_modules/jodit/esm/core/ui/icon.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { IS_PROD } from "../constants.js";
import { camelCase, kebabCase } from "../helpers/index.js";
import { css } from "../helpers/utils/css.js";
export class Icon {
static getIcon(name) {
if (/<svg/i.test(name)) {
return name;
}
const icon = Icon.icons[name] ||
Icon.icons[name.replace(/-/g, '_')] ||
Icon.icons[name.replace(/_/g, '-')] ||
Icon.icons[camelCase(name)] ||
Icon.icons[kebabCase(name)] ||
Icon.icons[name.toLowerCase()];
if (!IS_PROD && !icon) {
console.warn(`Icon "${name}" not found`);
}
return icon;
}
/**
* Check if icon exist in store
*/
static exists(name) {
return this.getIcon(name) !== undefined;
}
/**
* Return SVG icon
*/
static get(name, defaultValue = '<span></span>') {
return this.getIcon(name) || defaultValue;
}
/**
* Set SVG in store
*/
static set(name, value) {
this.icons[name.replace('_', '-')] = value;
return this;
}
/**
* Make icon html element
*/
static makeIcon(jodit, icon) {
var _a, _b, _c, _d;
if (!icon) {
return;
}
let iconElement;
const { name, iconURL, fill } = icon;
const clearName = name.replace(/[^a-zA-Z0-9]/g, '_');
let iconFromEvent;
if (!/<svg/.test(name)) {
iconFromEvent = (_b = (_a = jodit.o).getIcon) === null || _b === void 0 ? void 0 : _b.call(_a, name, clearName);
}
const cacheKey = `${name}${iconURL}${fill}${iconFromEvent !== null && iconFromEvent !== void 0 ? iconFromEvent : ''}`;
if (jodit.o.cache && this.__cache.has(cacheKey)) {
return (_c = this.__cache.get(cacheKey)) === null || _c === void 0 ? void 0 : _c.cloneNode(true);
}
if (iconURL) {
iconElement = jodit.c.span();
css(iconElement, 'backgroundImage', 'url(' +
iconURL.replace('{basePath}', (jodit === null || jodit === void 0 ? void 0 : jodit.basePath) || '') +
')');
}
else {
const svg = iconFromEvent ||
Icon.get(name, '') ||
((_d = jodit.o.extraIcons) === null || _d === void 0 ? void 0 : _d[name]);
if (svg) {
iconElement = jodit.c.fromHTML(svg.trim());
if (!/^<svg/i.test(name)) {
iconElement.classList.add('jodit-icon_' + clearName);
}
}
}
if (iconElement) {
iconElement.classList.add('jodit-icon');
iconElement.style.fill = fill;
jodit.o.cache &&
this.__cache.set(cacheKey, iconElement.cloneNode(true));
}
return iconElement;
}
}
Icon.icons = {};
Icon.__cache = new Map();

17
node_modules/jodit/esm/core/ui/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/README.md]]
* @packageDocumentation
* @module ui
*/
export * from "./button/index";
export * from "./element";
export * from "./form/index";
export * from "./group/index";
export * from "./icon";
export * from "./popup/index";
export * from "./progress-bar/progress-bar";

17
node_modules/jodit/esm/core/ui/index.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/README.md]]
* @packageDocumentation
* @module ui
*/
export * from "./button/index.js";
export * from "./element.js";
export * from "./form/index.js";
export * from "./group/index.js";
export * from "./icon.js";
export * from "./popup/index.js";
export * from "./progress-bar/progress-bar.js";

9
node_modules/jodit/esm/core/ui/popup/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/popup
*/
export * from "./popup";

9
node_modules/jodit/esm/core/ui/popup/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module ui/popup
*/
export * from "./popup.js";

70
node_modules/jodit/esm/core/ui/popup/popup.d.ts generated vendored Normal file
View File

@@ -0,0 +1,70 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/popup/README.md]]
* @packageDocumentation
* @module ui/popup
*/
import type { IBound, IPopup, IUIElement, IViewBased, PopupStrategy } from "../../../types/index";
import { UIGroup } from "../group/group";
type getBoundFunc = () => IBound;
export declare class Popup extends UIGroup implements IPopup {
readonly smart: boolean;
className(): string;
isOpened: boolean;
strategy: PopupStrategy;
protected appendChildToContainer(childContainer: HTMLElement): void;
viewBound: () => IBound;
private __targetBound;
private __childrenPopups;
updateParentElement(target: IUIElement): this;
/**
* Set popup content
*/
setContent(content: IUIElement | HTMLElement | string): this;
/**
* Open popup near with some bound
*/
open(getBound: getBoundFunc, keepPosition?: boolean, parentContainer?: HTMLElement): this;
private __calculateZIndex;
/**
* Calculate static bound for point
*/
protected getKeepBound(getBound: getBoundFunc): getBoundFunc;
/**
* Update container position
*/
updatePosition(): this;
private __throttleUpdatePosition;
/**
* Calculate start point
*/
private __calculatePosition;
/**
* Check if one box is inside second
*/
private static boxInView;
/**
* Close popup
*/
close(): this;
/**
* Close popup if click was in outside
*/
private __closeOnOutsideClick;
isOwnClick(e: MouseEvent): boolean;
private __addGlobalListeners;
private __removeGlobalListeners;
/**
* Set ZIndex
*/
setZIndex(index: number | string): void;
constructor(jodit: IViewBased, smart?: boolean);
render(): string;
/** @override **/
destruct(): any;
}
export {};

348
node_modules/jodit/esm/core/ui/popup/popup.js generated vendored Normal file
View File

@@ -0,0 +1,348 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Component } from "../../component/component.js";
import { autobind, throttle } from "../../decorators/index.js";
import { Dom } from "../../dom/dom.js";
import { eventEmitter, getContainer } from "../../global.js";
import { attr, css, isString, kebabCase, markOwner, position, ucfirst } from "../../helpers/index.js";
import { assert } from "../../helpers/utils/assert.js";
import { UIElement } from "../element.js";
import { UIGroup } from "../group/group.js";
const EVENTS_FOR_AUTOCLOSE = [
'escape',
'cut',
'delete',
'backSpaceAfterDelete',
'beforeCommandDelete'
];
export class Popup extends UIGroup {
className() {
return 'Popup';
}
appendChildToContainer(childContainer) {
const content = this.getElm('content');
assert(content, 'Content element should exist');
content.appendChild(childContainer);
}
updateParentElement(target) {
if (target !== this && Component.isInstanceOf(target, Popup)) {
this.__childrenPopups.forEach(popup => {
if (!target.closest(popup) && popup.isOpened) {
popup.close();
}
});
if (!this.__childrenPopups.has(target)) {
this.j.e.on(target, 'beforeClose', () => {
this.__childrenPopups.delete(target);
});
}
this.__childrenPopups.add(target);
}
return super.updateParentElement(target);
}
/**
* Set popup content
*/
setContent(content) {
if (this.allChildren.length) {
throw new Error('Remove children');
}
if (Component.isInstanceOf(content, UIElement)) {
this.append(content);
}
else {
const elm = isString(content)
? this.j.c.fromHTML(content)
: content;
this.appendChildToContainer(elm);
}
this.updatePosition();
return this;
}
/**
* Open popup near with some bound
*/
open(getBound, keepPosition = false, parentContainer) {
markOwner(this.jodit, this.container);
this.container.classList.add(`jodit_theme_${this.jodit.o.theme}`);
this.__calculateZIndex();
this.isOpened = true;
this.__addGlobalListeners();
this.__targetBound = !keepPosition
? getBound
: this.getKeepBound(getBound);
if (parentContainer) {
parentContainer.appendChild(this.container);
}
else {
const popupContainer = getContainer(this.jodit, Popup);
if (parentContainer !== this.container.parentElement) {
popupContainer.appendChild(this.container);
}
}
this.updatePosition();
this.j.e.fire(this, 'afterOpen');
this.j.e.fire('afterOpenPopup', this);
return this;
}
__calculateZIndex() {
if (this.container.style.zIndex) {
return;
}
const checkView = (view) => {
const zIndex = view.container.style.zIndex || view.o.zIndex;
if (zIndex) {
this.setZIndex(1 + parseInt(zIndex.toString(), 10));
return true;
}
return false;
};
const { j } = this;
if (checkView(j)) {
return;
}
let pe = this.parentElement;
while (pe) {
if (checkView(pe.j)) {
return;
}
if (pe.container.style.zIndex) {
this.setZIndex(1 + parseInt(pe.container.style.zIndex.toString(), 10));
return;
}
if (!pe.parentElement && pe.container.parentElement) {
const elm = UIElement.closestElement(pe.container.parentElement, UIElement);
if (elm) {
pe = elm;
continue;
}
}
pe = pe.parentElement;
}
}
/**
* Calculate static bound for point
*/
getKeepBound(getBound) {
const oldBound = getBound();
const elmUnderCursor = this.od.elementFromPoint(oldBound.left, oldBound.top);
if (!elmUnderCursor) {
return getBound;
}
const element = Dom.isHTMLElement(elmUnderCursor)
? elmUnderCursor
: elmUnderCursor.parentElement;
const oldPos = position(element, this.j);
return () => {
const bound = getBound();
const newPos = position(element, this.j);
return {
...bound,
top: bound.top + (newPos.top - oldPos.top),
left: bound.left + (newPos.left - oldPos.left)
};
};
}
/**
* Update container position
*/
updatePosition() {
if (!this.isOpened) {
return this;
}
const [pos, strategy] = this.__calculatePosition(this.__targetBound(), this.viewBound(), position(this.container, this.j));
this.setMod('strategy', strategy);
css(this.container, {
left: pos.left,
top: pos.top
});
this.__childrenPopups.forEach(popup => popup.updatePosition());
return this;
}
__throttleUpdatePosition() {
this.updatePosition();
}
/**
* Calculate start point
*/
__calculatePosition(target, view, container, defaultStrategy = this.strategy) {
const x = {
left: target.left,
right: target.left - (container.width - target.width)
}, y = {
bottom: target.top + target.height,
top: target.top - container.height
};
const list = Object.keys(x).reduce((keys, xKey) => keys.concat(Object.keys(y).map(yKey => `${xKey}${ucfirst(yKey)}`)), []);
const getPointByStrategy = (strategy) => {
const [xKey, yKey] = kebabCase(strategy).split('-');
return {
left: x[xKey],
top: y[yKey],
width: container.width,
height: container.height
};
};
const getMatchStrategy = (inBox) => {
let strategy = null;
if (Popup.boxInView(getPointByStrategy(defaultStrategy), inBox)) {
strategy = defaultStrategy;
}
else {
strategy =
list.find((key) => {
if (Popup.boxInView(getPointByStrategy(key), inBox)) {
return key;
}
return;
}) || null;
}
return strategy;
};
// Try to find match position inside Jodit.container
let strategy = getMatchStrategy(position(this.j.container, this.j));
// If not found or is not inside window view
if (!strategy || !Popup.boxInView(getPointByStrategy(strategy), view)) {
// Find match strategy inside window view
strategy = getMatchStrategy(view) || strategy || defaultStrategy;
}
return [getPointByStrategy(strategy), strategy];
}
/**
* Check if one box is inside second
*/
static boxInView(box, view) {
const accuracy = 2;
return (box.top - view.top >= -accuracy &&
box.left - view.left >= -accuracy &&
view.top + view.height - (box.top + box.height) >= -accuracy &&
view.left + view.width - (box.left + box.width) >= -accuracy);
}
/**
* Close popup
*/
close() {
if (!this.isOpened) {
return this;
}
this.isOpened = false;
this.__childrenPopups.forEach(popup => popup.close());
this.j.e.fire(this, 'beforeClose');
this.j.e.fire('beforePopupClose', this);
this.__removeGlobalListeners();
Dom.safeRemove(this.container);
return this;
}
/**
* Close popup if click was in outside
*/
__closeOnOutsideClick(e) {
if (!this.isOpened || this.isOwnClick(e)) {
return;
}
this.close();
}
isOwnClick(e) {
if (!e.target) {
return false;
}
const box = UIElement.closestElement(e.target, Popup);
return Boolean(box && (this === box || box.closest(this)));
}
__addGlobalListeners() {
const up = this.__throttleUpdatePosition, ow = this.ow;
eventEmitter.on('closeAllPopups', this.close);
if (this.smart) {
this.j.e
.on(EVENTS_FOR_AUTOCLOSE, this.close)
.on('mousedown touchstart', this.__closeOnOutsideClick)
.on(ow, 'mousedown touchstart', this.__closeOnOutsideClick);
}
this.j.e
.on('closeAllPopups', this.close)
.on('resize', up)
.on(this.container, 'scroll mousewheel', up)
.on(ow, 'scroll', up)
.on(ow, 'resize', up);
Dom.up(this.j.container, box => {
box && this.j.e.on(box, 'scroll mousewheel', up);
});
}
__removeGlobalListeners() {
const up = this.__throttleUpdatePosition, ow = this.ow;
eventEmitter.off('closeAllPopups', this.close);
if (this.smart) {
this.j.e
.off(EVENTS_FOR_AUTOCLOSE, this.close)
.off('mousedown touchstart', this.__closeOnOutsideClick)
.off(ow, 'mousedown touchstart', this.__closeOnOutsideClick);
}
this.j.e
.off('closeAllPopups', this.close)
.off('resize', up)
.off(this.container, 'scroll mousewheel', up)
.off(ow, 'scroll', up)
.off(ow, 'resize', up);
if (this.j.container.isConnected) {
Dom.up(this.j.container, box => {
box && this.j.e.off(box, 'scroll mousewheel', up);
});
}
}
/**
* Set ZIndex
*/
setZIndex(index) {
this.container.style.zIndex = index.toString();
}
constructor(jodit, smart = true) {
super(jodit);
this.smart = smart;
this.isOpened = false;
this.strategy = 'leftBottom';
this.viewBound = () => ({
left: 0,
top: 0,
width: this.ow.innerWidth,
height: this.ow.innerHeight
});
this.__childrenPopups = new Set();
attr(this.container, 'role', 'popup');
}
render() {
return `<div>
<div class="&__content"></div>
</div>`;
}
/** @override **/
destruct() {
this.close();
return super.destruct();
}
}
__decorate([
autobind
], Popup.prototype, "updatePosition", null);
__decorate([
throttle(10),
autobind
], Popup.prototype, "__throttleUpdatePosition", null);
__decorate([
autobind
], Popup.prototype, "close", null);
__decorate([
autobind
], Popup.prototype, "__closeOnOutsideClick", null);

View File

@@ -0,0 +1,25 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/ui/progress-bar/README.md]]
* @packageDocumentation
* @module ui/progress-bar
*/
import type { IProgressBar } from "../../../types/index";
import { UIElement } from "../element";
export declare class ProgressBar extends UIElement implements IProgressBar {
/** @override */
className(): string;
/** @override */
protected render(): string;
/**
* Show progress bar
*/
show(): IProgressBar;
hide(): IProgressBar;
progress(percentage: number): IProgressBar;
destruct(): any;
}

View File

@@ -0,0 +1,37 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Dom } from "../../dom/dom.js";
import { UIElement } from "../element.js";
export class ProgressBar extends UIElement {
/** @override */
className() {
return 'ProgressBar';
}
/** @override */
render() {
return '<div><div></div></div>';
}
/**
* Show progress bar
*/
show() {
const container = this.j.workplace || this.j.container;
container.appendChild(this.container);
return this;
}
hide() {
Dom.safeRemove(this.container);
return this;
}
progress(percentage) {
this.container.style.width = percentage.toFixed(2) + '%';
return this;
}
destruct() {
this.hide();
return super.destruct();
}
}