From e75ec1ce07f0035b63e993426aa6e1070c18f0b3 Mon Sep 17 00:00:00 2001 From: Aavishkar Mishra Date: Thu, 15 Aug 2024 02:35:04 +0530 Subject: [PATCH 1/5] Migrate to typescript --- package.json | 13 +- src/index.js | 310 ---------------------- src/index.ts | 477 +++++++++++++++++++++++++++++++++ src/types/icons.d.ts | 6 + tsconfig.json | 17 ++ vite.config.js | 5 +- yarn.lock | 612 +++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 1100 insertions(+), 340 deletions(-) delete mode 100644 src/index.js create mode 100644 src/index.ts create mode 100644 src/types/icons.d.ts create mode 100644 tsconfig.json diff --git a/package.json b/package.json index d3b9f39..fab90ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/quote", - "version": "2.6.0", + "version": "2.6.1", "keywords": [ "codex editor", "quote", @@ -21,19 +21,24 @@ "require": "./dist/quote.umd.js" } }, + "types": "./dist/index.d.ts", "scripts": { "dev": "vite", - "build": "vite build" + "build": "vite build", + "preview": "vite preview" }, "author": { "name": "CodeX", "email": "team@codex.so" }, "devDependencies": { + "@editorjs/editorjs": "^2.29.1", + "typescript": "^5.4.5", "vite": "^4.5.0", - "vite-plugin-css-injected-by-js": "^3.3.0" + "vite-plugin-css-injected-by-js": "^3.3.0", + "vite-plugin-dts": "^3.9.1" }, "dependencies": { "@codexteam/icons": "^0.0.5" } -} \ No newline at end of file +} diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 05be257..0000000 --- a/src/index.js +++ /dev/null @@ -1,310 +0,0 @@ -/** - * Build styles - */ -import './index.css'; - -import { IconAlignLeft, IconAlignCenter, IconQuote } from '@codexteam/icons'; - -/** - * @class Quote - * @classdesc Quote Tool for Editor.js - * @property {QuoteData} data - Tool`s input and output data - * @propert {object} api - Editor.js API instance - * - * @typedef {object} QuoteData - * @description Quote Tool`s input and output data - * @property {string} text - quote`s text - * @property {string} caption - quote`s caption - * @property {'center'|'left'} alignment - quote`s alignment - * - * @typedef {object} QuoteConfig - * @description Quote Tool`s initial configuration - * @property {string} quotePlaceholder - placeholder to show in quote`s text input - * @property {string} captionPlaceholder - placeholder to show in quote`s caption input - * @property {'center'|'left'} defaultAlignment - alignment to use as default - * - * @typedef {object} TunesMenuConfig - * @property {string} icon - menu item icon - * @property {string} label - menu item label - * @property {boolean} isActive - true if item should be in active state - * @property {boolean} closeOnActivate - if true tunes menu should close once any item is selected - * @property {() => void} onActivate - item activation callback - */ -export default class Quote { - /** - * Notify core that read-only mode is supported - * - * @returns {boolean} - */ - static get isReadOnlySupported() { - return true; - } - - /** - * Get Tool toolbox settings - * icon - Tool icon's SVG - * title - title to show in toolbox - * - * @returns {{icon: string, title: string}} - */ - static get toolbox() { - return { - icon: IconQuote, - title: 'Quote', - }; - } - - /** - * Empty Quote is not empty Block - * - * @public - * @returns {boolean} - */ - static get contentless() { - return true; - } - - /** - * Allow to press Enter inside the Quote - * - * @public - * @returns {boolean} - */ - static get enableLineBreaks() { - return true; - } - - /** - * Default placeholder for quote text - * - * @public - * @returns {string} - */ - static get DEFAULT_QUOTE_PLACEHOLDER() { - return 'Enter a quote'; - } - - /** - * Default placeholder for quote caption - * - * @public - * @returns {string} - */ - static get DEFAULT_CAPTION_PLACEHOLDER() { - return 'Enter a caption'; - } - - /** - * Allowed quote alignments - * - * @public - * @returns {{left: string, center: string}} - */ - static get ALIGNMENTS() { - return { - left: 'left', - center: 'center', - }; - } - - /** - * Default quote alignment - * - * @public - * @returns {string} - */ - static get DEFAULT_ALIGNMENT() { - return Quote.ALIGNMENTS.left; - } - - /** - * Allow Quote to be converted to/from other blocks - */ - static get conversionConfig() { - return { - /** - * To create Quote data from string, simple fill 'text' property - */ - import: 'text', - /** - * To create string from Quote data, concatenate text and caption - * - * @param {QuoteData} quoteData - * @returns {string} - */ - export: function (quoteData) { - return quoteData.caption ? `${quoteData.text} — ${quoteData.caption}` : quoteData.text; - }, - }; - } - - /** - * Tool`s styles - * - * @returns {{baseClass: string, wrapper: string, quote: string, input: string, caption: string}} - */ - get CSS() { - return { - baseClass: this.api.styles.block, - wrapper: 'cdx-quote', - text: 'cdx-quote__text', - input: this.api.styles.input, - caption: 'cdx-quote__caption', - }; - } - - /** - * Tool`s settings properties - * - * @returns {*[]} - */ - get settings() { - return [ - { - name: 'left', - icon: IconAlignLeft, - }, - { - name: 'center', - icon: IconAlignCenter, - }, - ]; - } - - /** - * Render plugin`s main Element and fill it with saved data - * - * @param {{data: QuoteData, config: QuoteConfig, api: object}} - * data — previously saved data - * config - user config for Tool - * api - Editor.js API - * readOnly - read-only mode flag - */ - constructor({ data, config, api, readOnly }) { - const { ALIGNMENTS, DEFAULT_ALIGNMENT } = Quote; - - this.api = api; - this.readOnly = readOnly; - - this.quotePlaceholder = config.quotePlaceholder || Quote.DEFAULT_QUOTE_PLACEHOLDER; - this.captionPlaceholder = config.captionPlaceholder || Quote.DEFAULT_CAPTION_PLACEHOLDER; - - this.data = { - text: data.text || '', - caption: data.caption || '', - alignment: Object.values(ALIGNMENTS).includes(data.alignment) && data.alignment || - config.defaultAlignment || - DEFAULT_ALIGNMENT, - }; - } - - /** - * Create Quote Tool container with inputs - * - * @returns {Element} - */ - render() { - const container = this._make('blockquote', [this.CSS.baseClass, this.CSS.wrapper]); - const quote = this._make('div', [this.CSS.input, this.CSS.text], { - contentEditable: !this.readOnly, - innerHTML: this.data.text, - }); - const caption = this._make('div', [this.CSS.input, this.CSS.caption], { - contentEditable: !this.readOnly, - innerHTML: this.data.caption, - }); - - quote.dataset.placeholder = this.quotePlaceholder; - caption.dataset.placeholder = this.captionPlaceholder; - - container.appendChild(quote); - container.appendChild(caption); - - return container; - } - - /** - * Extract Quote data from Quote Tool element - * - * @param {HTMLDivElement} quoteElement - element to save - * @returns {QuoteData} - */ - save(quoteElement) { - const text = quoteElement.querySelector(`.${this.CSS.text}`); - const caption = quoteElement.querySelector(`.${this.CSS.caption}`); - - return Object.assign(this.data, { - text: text.innerHTML, - caption: caption.innerHTML, - }); - } - - /** - * Sanitizer rules - */ - static get sanitize() { - return { - text: { - br: true, - }, - caption: { - br: true, - }, - alignment: {}, - }; - } - - /** - * Create wrapper for Tool`s settings buttons: - * 1. Left alignment - * 2. Center alignment - * - * @returns {TunesMenuConfig} - * - */ - renderSettings() { - const capitalize = str => str[0].toUpperCase() + str.substr(1); - - return this.settings.map(item => ({ - icon: item.icon, - label: this.api.i18n.t(`Align ${capitalize(item.name)}`), - onActivate: () => this._toggleTune(item.name), - isActive: this.data.alignment === item.name, - closeOnActivate: true, - })); - }; - - /** - * Toggle quote`s alignment - * - * @param {string} tune - alignment - * @private - */ - _toggleTune(tune) { - this.data.alignment = tune; - } - - /** - * Helper for making Elements with attributes - * - * @param {string} tagName - new Element tag name - * @param {Array|string} classNames - list or name of CSS classname(s) - * @param {object} attributes - any attributes - * @returns {Element} - */ - _make(tagName, classNames = null, attributes = {}) { - const el = document.createElement(tagName); - - if (Array.isArray(classNames)) { - el.classList.add(...classNames); - } else if (classNames) { - el.classList.add(classNames); - } - - for (const attrName in attributes) { - el[attrName] = attributes[attrName]; - } - - return el; - } -} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..464e956 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,477 @@ +/** + * Build styles + */ +import "./index.css"; + +import { IconAlignLeft, IconAlignCenter, IconQuote } from "@codexteam/icons"; +import type { API, ToolConfig } from "@editorjs/editorjs"; + +/** + * @typedef {object} QuoteConfig + * @description Quote Tool`s initial configuration + * @property {string} quotePlaceholder - placeholder to show in quote`s text input + * @property {string} captionPlaceholder - placeholder to show in quote`s caption input + * @property {'center'|'left'} defaultAlignment - alignment to use as default + */ +export interface QuoteConfig extends ToolConfig { + /** + * Placeholder text to display in the quote's text input. + */ + quotePlaceholder: string; + + /** + * Placeholder text to display in the quote's caption input. + */ + captionPlaceholder: string; + + /** + * Default alignment for the quote. + */ + defaultAlignment: "center" | "left"; +} + +/** + * @typedef {object} QuoteData + * @description Quote Tool`s input and output data + * @property {string} text - quote`s text + * @property {string} caption - quote`s caption + * @property {'center'|'left'} alignment - quote`s alignment + */ +export interface QuoteData { + /** + * The text of the quote. + */ + text: string; + + /** + * The caption for the quote. + */ + caption: string; + + /** + * The alignment of the quote. + */ + alignment: "center" | "left"; +} + +/** + * @typedef {object} TunesMenuConfig + * @property {string} icon - menu item icon + * @property {string} label - menu item label + * @property {boolean} isActive - true if item should be in active state + * @property {boolean} closeOnActivate - if true tunes menu should close once any item is selected + * @property {() => void} onActivate - item activation callback + */ +interface TunesMenuConfig { + /** + * Icon for the menu item. + */ + icon: string; + + /** + * Label for the menu item. + */ + label: string; + + /** + * Indicates if the item should be in an active state. + */ + isActive: boolean; + + /** + * Determines if the tunes menu should close after an item is selected. + */ + closeOnActivate: boolean; + + /** + * Callback function to be called when the item is activated. + */ + onActivate: () => void; +} + +/** + * @typedef {object} QuoteParams + * @description Constructor params for the Quote tool, use to pass initial data and settings + * @property {QuoteData} data - Preload data for the quote. + * @property {QuoteConfig} config - The configuration for the quote. + * @property {API} api - The Editor.js API. + * @property {boolean} readOnly - Is quote is read-only. + */ +interface QuoteParams { + /** + * Initial data for the quote + */ + data: QuoteData; + /** + * Quote tool configuration + */ + config: QuoteConfig; + /** + * Editor.js API + */ + api: API; + /** + * Is quote read-only. + */ + readOnly: boolean; +} + +/** + * @typedef {object} QuoteCSS + * @description CSS classes names + * @property {string} block - Editor.js CSS Class for block + * @property {string} wrapper - Quote CSS Class + */ +interface QuoteCSS { + /** + * Editor.js CSS Class for block + */ + baseClass: string; + /** + * Quote CSS Class + */ + wrapper: string; + /** + * Quote CSS Class + */ + input: string; + /** + * Quote CSS Class + */ + text: string; + /** + * Quote CSS Class + */ + caption: string; +} + +/** + * @class Quote + * @classdesc Quote Tool for Editor.js + * @property {QuoteData} data - Tool`s input and output data + * @propert {API} api - Editor.js API instance + */ +export default class Quote { + /** + * The Editor.js API + */ + api: API; + /** + * Is Quote Tool read-only + */ + readOnly: boolean; + /** + * Placeholder for Quote Tool + */ + private _quotePlaceholder: string; + /** + * Caption placeholder for Quote Tool + */ + private _captionPlaceholder: string; + /** + * Quote's data + */ + private _data: QuoteData; + /** + * Quote Tool's CSS classes + */ + private _CSS: QuoteCSS; + + /** + * Render plugin`s main Element and fill it with saved data + * + * @param {object} params - constructor params + * @param {QuoteData} params.data - previously saved data + * @param {QuoteConfig} params.config - user config for Tool + * @param {API} params.api - editor.js api + * @param {boolean} params.readOnly - read only mode flag + */ + constructor({ data, config, api, readOnly }: QuoteParams) { + const { ALIGNMENTS, DEFAULT_ALIGNMENT } = Quote; + + this.api = api; + this.readOnly = readOnly; + + this._quotePlaceholder = + config.quotePlaceholder || Quote.DEFAULT_QUOTE_PLACEHOLDER; + this._captionPlaceholder = + config.captionPlaceholder || Quote.DEFAULT_CAPTION_PLACEHOLDER; + + this._data = { + text: data.text || "", + caption: data.caption || "", + alignment: + (Object.values(ALIGNMENTS).includes(data.alignment) && + data.alignment) || + config.defaultAlignment || + DEFAULT_ALIGNMENT, + }; + this._CSS = { + baseClass: this.api.styles.block, + wrapper: "cdx-quote", + text: "cdx-quote__text", + input: this.api.styles.input, + caption: "cdx-quote__caption", + }; + } + + /** + * Notify core that read-only mode is supported + * + * @returns {boolean} + */ + static get isReadOnlySupported(): boolean { + return true; + } + + /** + * Get Tool toolbox settings + * icon - Tool icon's SVG + * title - title to show in toolbox + * + * @returns {{icon: string, title: string}} + */ + static get toolbox(): { icon: string; title: "Quote" } { + return { + icon: IconQuote, + title: "Quote", + }; + } + + /** + * Empty Quote is not empty Block + * + * @public + * @returns {boolean} + */ + static get contentless(): boolean { + return true; + } + + /** + * Allow to press Enter inside the Quote + * + * @public + * @returns {boolean} + */ + static get enableLineBreaks(): boolean { + return true; + } + + /** + * Default placeholder for quote text + * + * @public + * @returns {string} + */ + static get DEFAULT_QUOTE_PLACEHOLDER(): string { + return "Enter a quote"; + } + + /** + * Default placeholder for quote caption + * + * @public + * @returns {string} + */ + static get DEFAULT_CAPTION_PLACEHOLDER(): string { + return "Enter a caption"; + } + + /** + * Allowed quote alignments + * + * @public + * @returns {{left: string, center: string}} + */ + static get ALIGNMENTS(): { left: "left"; center: "center" } { + return { + left: "left", + center: "center", + }; + } + + /** + * Default quote alignment + * + * @public + * @returns {string} + */ + static get DEFAULT_ALIGNMENT(): "left" { + return Quote.ALIGNMENTS.left; + } + + /** + * Allow Quote to be converted to/from other blocks + */ + static get conversionConfig() { + return { + /** + * To create Quote data from string, simple fill 'text' property + */ + import: "text", + /** + * To create string from Quote data, concatenate text and caption + * + * @param {QuoteData} quoteData + * @returns {string} + */ + export: function (quoteData: QuoteData): string { + return quoteData.caption + ? `${quoteData.text} — ${quoteData.caption}` + : quoteData.text; + }, + }; + } + + /** + * Tool`s styles + * + * @returns {QuoteCSS} + */ + get CSS(): QuoteCSS { + return { + baseClass: this.api.styles.block, + wrapper: "cdx-quote", + text: "cdx-quote__text", + input: this.api.styles.input, + caption: "cdx-quote__caption", + }; + } + + /** + * Tool`s settings properties + * + * @returns {*[]} + */ + get settings(): { name: "left" | "center"; icon: string }[] { + return [ + { + name: "left", + icon: IconAlignLeft, + }, + { + name: "center", + icon: IconAlignCenter, + }, + ]; + } + + /** + * Create Quote Tool container with inputs + * + * @returns {Element} + */ + render(): HTMLElement { + const container = this._make("blockquote", [ + this._CSS.baseClass, + this._CSS.wrapper, + ]); + const quote = this._make("div", [this._CSS.input, this._CSS.text], { + contentEditable: !this.readOnly, + innerHTML: this._data.text, + }); + const caption = this._make("div", [this._CSS.input, this._CSS.caption], { + contentEditable: !this.readOnly, + innerHTML: this._data.caption, + }); + + quote.dataset.placeholder = this._quotePlaceholder; + caption.dataset.placeholder = this._captionPlaceholder; + + container.appendChild(quote); + container.appendChild(caption); + + return container; + } + + /** + * Extract Quote data from Quote Tool element + * + * @param {HTMLDivElement} quoteElement - element to save + * @returns {QuoteData} + */ + save(quoteElement: HTMLDivElement): QuoteData { + const text = quoteElement.querySelector(`.${this._CSS.text}`); + const caption = quoteElement.querySelector(`.${this._CSS.caption}`); + + return Object.assign(this._data, { + text: text?.innerHTML ?? "", + caption: caption?.innerHTML ?? "", + }); + } + + /** + * Sanitizer rules + */ + static get sanitize() { + return { + text: { + br: true, + }, + caption: { + br: true, + }, + alignment: {}, + }; + } + + /** + * Create wrapper for Tool`s settings buttons: + * 1. Left alignment + * 2. Center alignment + * + * @returns {TunesMenuConfig} + * + */ + renderSettings(): TunesMenuConfig[] { + const capitalize = (str: string) => + str ? str[0].toUpperCase() + str.slice(1) : str; + + return this.settings.map((item) => ({ + icon: item.icon, + label: this.api.i18n.t(`Align ${capitalize(item.name)}`), + onActivate: () => this._toggleTune(item.name), + isActive: this._data.alignment === item.name, + closeOnActivate: true, + })); + } + + /** + * Toggle quote`s alignment + * + * @param {string} tune - alignment + * @private + */ + _toggleTune(tune: "left" | "center") { + this._data.alignment = tune; + } + + /** + * Helper for making Elements with attributes + * + * @param {string} tagName - new Element tag name + * @param {Array|string} classNames - list or name of CSS classname(s) + * @param {object} attributes - any attributes + * @returns {Element} + */ + _make( + tagName: string, + classNames: string | string[] | null = null, + attributes: { [key: string]: any } = {} + ): HTMLElement { + const el = document.createElement(tagName); + + if (Array.isArray(classNames)) { + el.classList.add(...classNames); + } else if (classNames) { + el.classList.add(classNames); + } + + for (const attrName in attributes) { + (el as any)[attrName] = attributes[attrName]; + } + + return el; + } +} diff --git a/src/types/icons.d.ts b/src/types/icons.d.ts new file mode 100644 index 0000000..69735e1 --- /dev/null +++ b/src/types/icons.d.ts @@ -0,0 +1,6 @@ +// temporary fix for the missing types +declare module "@codexteam/icons" { + export const IconAlignLeft: string; + export const IconAlignCenter: string; + export const IconQuote: string; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..8d07ec4 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "lib": ["dom", "es2017"], + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "declaration": true, + "declarationDir": "./dist/types", + "isolatedModules": true + }, + "include": ["src"], + "exclude": ["node_modules", "**/*.spec.ts"] +} diff --git a/vite.config.js b/vite.config.js index 9dc09ba..4140298 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,7 @@ import path from "path"; import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"; import * as pkg from "./package.json"; +import dts from "vite-plugin-dts"; const NODE_ENV = process.argv.mode || "development"; const VERSION = pkg.version; @@ -9,7 +10,7 @@ export default { build: { copyPublicDir: false, lib: { - entry: path.resolve(__dirname, "src", "index.js"), + entry: path.resolve(__dirname, "src", "index.ts"), name: "Quote", fileName: "quote", }, @@ -19,5 +20,5 @@ export default { VERSION: JSON.stringify(VERSION), }, - plugins: [cssInjectedByJsPlugin()], + plugins: [cssInjectedByJsPlugin(), dts()], }; diff --git a/yarn.lock b/yarn.lock index 4ed47a8..5c4072f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,9 +2,41 @@ # yarn lockfile v1 +"@babel/helper-string-parser@^7.24.8": + version "7.24.8" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz#5b3329c9a58803d5df425e5785865881a81ca48d" + integrity sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ== + +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + +"@babel/parser@^7.24.7": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" + integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== + dependencies: + "@babel/types" "^7.25.2" + +"@babel/types@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" + integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== + dependencies: + "@babel/helper-string-parser" "^7.24.8" + "@babel/helper-validator-identifier" "^7.24.7" + to-fast-properties "^2.0.0" + "@codexteam/icons@^0.0.5": version "0.0.5" resolved "https://registry.yarnpkg.com/@codexteam/icons/-/icons-0.0.5.tgz#d17f39b6a0497c6439f57dd42711817a3dd3679c" + integrity sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA== + +"@editorjs/editorjs@^2.29.1": + version "2.30.5" + resolved "https://registry.yarnpkg.com/@editorjs/editorjs/-/editorjs-2.30.5.tgz#c1a6fc2b99f567a0271408c0edd51d3da21b4534" + integrity sha512-sE7m/UPbuf+nSGjv9cmWggFsfvtYlgEX7PCby2lZWvOsOLbRxuLT+ZYlwbWshD+8BFJwiAmBj9e+ScZcOjCzeg== "@esbuild/android-arm64@0.18.20": version "0.18.20" @@ -116,6 +148,241 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== +"@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@microsoft/api-extractor-model@7.28.13": + version "7.28.13" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.28.13.tgz#96fbc52155e0d07e0eabbd9699065b77702fe33a" + integrity sha512-39v/JyldX4MS9uzHcdfmjjfS6cYGAoXV+io8B5a338pkHiSt+gy2eXQ0Q7cGFJ7quSa1VqqlMdlPrB6sLR/cAw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "4.0.2" + +"@microsoft/api-extractor@7.43.0": + version "7.43.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.43.0.tgz#41c42677bc71cd8e0f23c63c56802d85044e65cd" + integrity sha512-GFhTcJpB+MI6FhvXEI9b2K0snulNLWHqC/BbcJtyNYcKUiw7l3Lgis5ApsYncJ0leALX7/of4XfmXk+maT111w== + dependencies: + "@microsoft/api-extractor-model" "7.28.13" + "@microsoft/tsdoc" "0.14.2" + "@microsoft/tsdoc-config" "~0.16.1" + "@rushstack/node-core-library" "4.0.2" + "@rushstack/rig-package" "0.5.2" + "@rushstack/terminal" "0.10.0" + "@rushstack/ts-command-line" "4.19.1" + lodash "~4.17.15" + minimatch "~3.0.3" + resolve "~1.22.1" + semver "~7.5.4" + source-map "~0.6.1" + typescript "5.4.2" + +"@microsoft/tsdoc-config@~0.16.1": + version "0.16.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.16.2.tgz#b786bb4ead00d54f53839a458ce626c8548d3adf" + integrity sha512-OGiIzzoBLgWWR0UdRJX98oYO+XKGf7tiK4Zk6tQ/E4IJqGCe7dvkTvgDZV5cFJUzLGDOjeAXrnZoA6QkVySuxw== + dependencies: + "@microsoft/tsdoc" "0.14.2" + ajv "~6.12.6" + jju "~1.4.0" + resolve "~1.19.0" + +"@microsoft/tsdoc@0.14.2": + version "0.14.2" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" + integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== + +"@rollup/pluginutils@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + +"@rushstack/node-core-library@4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-4.0.2.tgz#e26854a3314b279d57e8abdb4acce7797d02f554" + integrity sha512-hyES82QVpkfQMeBMteQUnrhASL/KHPhd7iJ8euduwNJG4mu2GSOKybf0rOEjOm1Wz7CwJEUm9y0yD7jg2C1bfg== + dependencies: + fs-extra "~7.0.1" + import-lazy "~4.0.0" + jju "~1.4.0" + resolve "~1.22.1" + semver "~7.5.4" + z-schema "~5.0.2" + +"@rushstack/rig-package@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.5.2.tgz#0e23a115904678717a74049661931c0b37dd5495" + integrity sha512-mUDecIJeH3yYGZs2a48k+pbhM6JYwWlgjs2Ca5f2n1G2/kgdgP9D/07oglEGf6mRyXEnazhEENeYTSNDRCwdqA== + dependencies: + resolve "~1.22.1" + strip-json-comments "~3.1.1" + +"@rushstack/terminal@0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@rushstack/terminal/-/terminal-0.10.0.tgz#e81909fa0e5c8016b6df4739f0f381f44358269f" + integrity sha512-UbELbXnUdc7EKwfH2sb8ChqNgapUOdqcCIdQP4NGxBpTZV2sQyeekuK3zmfQSa/MN+/7b4kBogl2wq0vpkpYGw== + dependencies: + "@rushstack/node-core-library" "4.0.2" + supports-color "~8.1.1" + +"@rushstack/ts-command-line@4.19.1": + version "4.19.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.19.1.tgz#288ee54dd607e558a8be07705869c16c31b5c3ef" + integrity sha512-J7H768dgcpG60d7skZ5uSSwyCZs/S2HrWP1Ds8d1qYAyaaeJmpmmLr9BVw97RjFzmQPOYnoXcKA4GkqDCkduQg== + dependencies: + "@rushstack/terminal" "0.10.0" + "@types/argparse" "1.0.38" + argparse "~1.0.9" + string-argv "~0.3.1" + +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== + +"@types/estree@^1.0.0": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" + integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== + +"@volar/language-core@1.11.1", "@volar/language-core@~1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-1.11.1.tgz#ecdf12ea8dc35fb8549e517991abcbf449a5ad4f" + integrity sha512-dOcNn3i9GgZAcJt43wuaEykSluAuOkQgzni1cuxLxTV0nJKanQztp7FxyswdRILaKH+P2XZMPRp2S4MV/pElCw== + dependencies: + "@volar/source-map" "1.11.1" + +"@volar/source-map@1.11.1", "@volar/source-map@~1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-1.11.1.tgz#535b0328d9e2b7a91dff846cab4058e191f4452f" + integrity sha512-hJnOnwZ4+WT5iupLRnuzbULZ42L7BWWPMmruzwtLhJfpDVoZLjNBxHDi2sY2bgZXCKlpU5XcsMFoYrsQmPhfZg== + dependencies: + muggle-string "^0.3.1" + +"@volar/typescript@~1.11.1": + version "1.11.1" + resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-1.11.1.tgz#ba86c6f326d88e249c7f5cfe4b765be3946fd627" + integrity sha512-iU+t2mas/4lYierSnoFOeRFQUhAEMgsFuQxoxvwn5EdQopw43j+J27a4lt9LMInx1gLJBC6qL14WYGlgymaSMQ== + dependencies: + "@volar/language-core" "1.11.1" + path-browserify "^1.0.1" + +"@vue/compiler-core@3.4.37": + version "3.4.37" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.37.tgz#55db3900e09424c65c39111a05a3c6e698f371e3" + integrity sha512-ZDDT/KiLKuCRXyzWecNzC5vTcubGz4LECAtfGPENpo0nrmqJHwuWtRLxk/Sb9RAKtR9iFflFycbkjkY+W/PZUQ== + dependencies: + "@babel/parser" "^7.24.7" + "@vue/shared" "3.4.37" + entities "^5.0.0" + estree-walker "^2.0.2" + source-map-js "^1.2.0" + +"@vue/compiler-dom@^3.3.0": + version "3.4.37" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.37.tgz#a1fcf79e287cb828545082ff1afa8630480a3044" + integrity sha512-rIiSmL3YrntvgYV84rekAtU/xfogMUJIclUMeIKEtVBFngOL3IeZHhsH3UaFEgB5iFGpj6IW+8YuM/2Up+vVag== + dependencies: + "@vue/compiler-core" "3.4.37" + "@vue/shared" "3.4.37" + +"@vue/language-core@1.8.27", "@vue/language-core@^1.8.27": + version "1.8.27" + resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-1.8.27.tgz#2ca6892cb524e024a44e554e4c55d7a23e72263f" + integrity sha512-L8Kc27VdQserNaCUNiSFdDl9LWT24ly8Hpwf1ECy3aFb9m6bDhBGQYOujDm21N7EW3moKIOKEanQwe1q5BK+mA== + dependencies: + "@volar/language-core" "~1.11.1" + "@volar/source-map" "~1.11.1" + "@vue/compiler-dom" "^3.3.0" + "@vue/shared" "^3.3.0" + computeds "^0.0.1" + minimatch "^9.0.3" + muggle-string "^0.3.1" + path-browserify "^1.0.1" + vue-template-compiler "^2.7.14" + +"@vue/shared@3.4.37", "@vue/shared@^3.3.0": + version "3.4.37" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.37.tgz#4f4c08a2e73da512a77b47165cf59ffbc1b5ade8" + integrity sha512-nIh8P2fc3DflG8+5Uw8PT/1i17ccFn0xxN/5oE9RfV5SVnd7G0XEFRwakrnNFE/jlS95fpGXDVG5zDETS26nmg== + +ajv@~6.12.6: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +argparse@~1.0.9: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +commander@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + +computeds@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/computeds/-/computeds-0.0.1.tgz#215b08a4ba3e08a11ff6eee5d6d8d7166a97ce2e" + integrity sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +de-indent@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" + integrity sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg== + +debug@^4.3.4: + version "4.3.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b" + integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg== + dependencies: + ms "2.1.2" + +entities@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-5.0.0.tgz#b2ab51fe40d995817979ec79dd621154c3c0f62b" + integrity sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA== + esbuild@^0.18.10: version "0.18.20" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6" @@ -144,29 +411,204 @@ esbuild@^0.18.10: "@esbuild/win32-ia32" "0.18.20" "@esbuild/win32-x64" "0.18.20" +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + +fast-deep-equal@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fs-extra@~7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -nanoid@^3.3.6: - version "3.3.6" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" - integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +graceful-fs@^4.1.2, graceful-fs@^4.1.6: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +import-lazy@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" + integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== + +is-core-module@^2.1.0, is-core-module@^2.13.0: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== + dependencies: + hasown "^2.0.2" + +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== + optionalDependencies: + graceful-fs "^4.1.6" -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +kolorist@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/kolorist/-/kolorist-1.8.0.tgz#edddbbbc7894bc13302cdf740af6374d4a04743c" + integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ== + +lodash.get@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + +lodash@~4.17.15: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +magic-string@^0.30.8: + version "0.30.11" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.11.tgz#301a6f93b3e8c2cb13ac1a7a673492c0dfd12954" + integrity sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.0" + +minimatch@^9.0.3: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + +minimatch@~3.0.3: + version "3.0.8" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" + integrity sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q== + dependencies: + brace-expansion "^1.1.7" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +muggle-string@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.3.1.tgz#e524312eb1728c63dd0b2ac49e3282e6ed85963a" + integrity sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg== + +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + +path-parse@^1.0.6, path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== postcss@^8.4.27: - version "8.4.31" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.31.tgz#92b451050a9f914da6755af352bdc0192508656d" - integrity sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ== + version "8.4.41" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.41.tgz#d6104d3ba272d882fe18fc07d15dc2da62fa2681" + integrity sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ== dependencies: - nanoid "^3.3.6" - picocolors "^1.0.0" - source-map-js "^1.0.2" + nanoid "^3.3.7" + picocolors "^1.0.1" + source-map-js "^1.2.0" + +punycode@^2.1.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== + +resolve@~1.19.0: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +resolve@~1.22.1: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" rollup@^3.27.1: version "3.29.4" @@ -175,23 +617,145 @@ rollup@^3.27.1: optionalDependencies: fsevents "~2.3.2" -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== +semver@^7.5.4: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + +semver@~7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + +source-map-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" + integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== + +source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== + +string-argv@~0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" + integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== + +strip-json-comments@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@~8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== + +typescript@5.4.2: + version "5.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" + integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== + +typescript@^5.4.5: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +validator@^13.7.0: + version "13.12.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f" + integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg== vite-plugin-css-injected-by-js@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.3.0.tgz#c19480a9e42a95c5bced976a9dde1446f9bd91ff" - integrity sha512-xG+jyHNCmUqi/TXp6q88wTJGeAOrNLSyUUTp4qEQ9QZLGcHWQQsCsSSKa59rPMQr8sOzfzmWDd8enGqfH/dBew== + version "3.5.1" + resolved "https://registry.yarnpkg.com/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.5.1.tgz#b9c568c21b131d08e31aa6d368ee39c9d6c1b6c1" + integrity sha512-9ioqwDuEBxW55gNoWFEDhfLTrVKXEEZgl5adhWmmqa88EQGKfTmexy4v1Rh0pAS6RhKQs2bUYQArprB32JpUZQ== + +vite-plugin-dts@^3.9.1: + version "3.9.1" + resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-3.9.1.tgz#625ad388ec3956708ccec7960550a7b0a8e8909e" + integrity sha512-rVp2KM9Ue22NGWB8dNtWEr+KekN3rIgz1tWD050QnRGlriUCmaDwa7qA5zDEjbXg5lAXhYMSBJtx3q3hQIJZSg== + dependencies: + "@microsoft/api-extractor" "7.43.0" + "@rollup/pluginutils" "^5.1.0" + "@vue/language-core" "^1.8.27" + debug "^4.3.4" + kolorist "^1.8.0" + magic-string "^0.30.8" + vue-tsc "^1.8.27" vite@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.0.tgz#ec406295b4167ac3bc23e26f9c8ff559287cff26" - integrity sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw== + version "4.5.3" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.3.tgz#d88a4529ea58bae97294c7e2e6f0eab39a50fb1a" + integrity sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg== dependencies: esbuild "^0.18.10" postcss "^8.4.27" rollup "^3.27.1" optionalDependencies: fsevents "~2.3.2" + +vue-template-compiler@^2.7.14: + version "2.7.16" + resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz#c81b2d47753264c77ac03b9966a46637482bb03b" + integrity sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ== + dependencies: + de-indent "^1.0.2" + he "^1.2.0" + +vue-tsc@^1.8.27: + version "1.8.27" + resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-1.8.27.tgz#feb2bb1eef9be28017bb9e95e2bbd1ebdd48481c" + integrity sha512-WesKCAZCRAbmmhuGl3+VrdWItEvfoFIPXOvUJkjULi+x+6G/Dy69yO3TBRJDr9eUlmsNAwVmxsNZxvHKzbkKdg== + dependencies: + "@volar/typescript" "~1.11.1" + "@vue/language-core" "1.8.27" + semver "^7.5.4" + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +z-schema@~5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-5.0.6.tgz#46d6a687b15e4a4369e18d6cb1c7b8618fc256c5" + integrity sha512-+XR1GhnWklYdfr8YaZv/iu+vY+ux7V5DS5zH1DQf6bO5ufrt/5cgNhVO5qyhsjFXvsqQb/f08DWE9b6uPscyAg== + dependencies: + lodash.get "^4.4.2" + lodash.isequal "^4.5.0" + validator "^13.7.0" + optionalDependencies: + commander "^10.0.0" From faa3ad31193397400569000b10b0abdeb8d16f92 Mon Sep 17 00:00:00 2001 From: Aavishkar Mishra Date: Thu, 15 Aug 2024 03:21:16 +0530 Subject: [PATCH 2/5] Bump icons from @0.0.5 to @0.3.2 and resolve comments --- package.json | 10 +++--- src/index.ts | 79 +++++++++++++++++--------------------------- src/types/icons.d.ts | 6 ---- yarn.lock | 20 ++++++++--- 4 files changed, 53 insertions(+), 62 deletions(-) delete mode 100644 src/types/icons.d.ts diff --git a/package.json b/package.json index fab90ce..4445af5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/quote", - "version": "2.6.1", + "version": "2.7.0", "keywords": [ "codex editor", "quote", @@ -18,7 +18,8 @@ "exports": { ".": { "import": "./dist/quote.mjs", - "require": "./dist/quote.umd.js" + "require": "./dist/quote.umd.js", + "types": "./dist/index.d.ts" } }, "types": "./dist/index.d.ts", @@ -36,9 +37,10 @@ "typescript": "^5.4.5", "vite": "^4.5.0", "vite-plugin-css-injected-by-js": "^3.3.0", - "vite-plugin-dts": "^3.9.1" + "vite-plugin-dts": "^3.9.1", + "@editorjs/dom": "^0.0.1" }, "dependencies": { - "@codexteam/icons": "^0.0.5" + "@codexteam/icons": "^0.3.2" } } diff --git a/src/index.ts b/src/index.ts index 464e956..4d8b5d3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,8 @@ import "./index.css"; import { IconAlignLeft, IconAlignCenter, IconQuote } from "@codexteam/icons"; -import type { API, ToolConfig } from "@editorjs/editorjs"; +import { make } from "@editorjs/dom"; +import type { API, BlockTool, ToolConfig } from "@editorjs/editorjs"; /** * @typedef {object} QuoteConfig @@ -27,7 +28,7 @@ export interface QuoteConfig extends ToolConfig { /** * Default alignment for the quote. */ - defaultAlignment: "center" | "left"; + defaultAlignment: Alignment; } /** @@ -51,18 +52,18 @@ export interface QuoteData { /** * The alignment of the quote. */ - alignment: "center" | "left"; + alignment: Alignment; } /** - * @typedef {object} TunesMenuConfig + * @typedef {object} MenuConfig * @property {string} icon - menu item icon * @property {string} label - menu item label * @property {boolean} isActive - true if item should be in active state * @property {boolean} closeOnActivate - if true tunes menu should close once any item is selected * @property {() => void} onActivate - item activation callback */ -interface TunesMenuConfig { +interface MenuConfig { /** * Icon for the menu item. */ @@ -145,13 +146,22 @@ interface QuoteCSS { caption: string; } +/** + * @typedef {Enum} Alignment + * @description Enum for Quote Alignment + */ +enum Alignment { + left = "left", + center = "center", +} + /** * @class Quote * @classdesc Quote Tool for Editor.js * @property {QuoteData} data - Tool`s input and output data * @propert {API} api - Editor.js API instance */ -export default class Quote { +export default class Quote implements BlockTool { /** * The Editor.js API */ @@ -160,6 +170,7 @@ export default class Quote { * Is Quote Tool read-only */ readOnly: boolean; + /** * Placeholder for Quote Tool */ @@ -282,12 +293,12 @@ export default class Quote { * Allowed quote alignments * * @public - * @returns {{left: string, center: string}} + * @returns {Record } */ - static get ALIGNMENTS(): { left: "left"; center: "center" } { + static get ALIGNMENTS(): Record { return { - left: "left", - center: "center", + left: Alignment.left, + center: Alignment.center, }; } @@ -297,7 +308,7 @@ export default class Quote { * @public * @returns {string} */ - static get DEFAULT_ALIGNMENT(): "left" { + static get DEFAULT_ALIGNMENT(): Alignment { return Quote.ALIGNMENTS.left; } @@ -344,14 +355,14 @@ export default class Quote { * * @returns {*[]} */ - get settings(): { name: "left" | "center"; icon: string }[] { + get settings(): { name: Alignment; icon: string }[] { return [ { - name: "left", + name: Alignment.left, icon: IconAlignLeft, }, { - name: "center", + name: Alignment.center, icon: IconAlignCenter, }, ]; @@ -363,15 +374,15 @@ export default class Quote { * @returns {Element} */ render(): HTMLElement { - const container = this._make("blockquote", [ + const container = make("blockquote", [ this._CSS.baseClass, this._CSS.wrapper, ]); - const quote = this._make("div", [this._CSS.input, this._CSS.text], { + const quote = make("div", [this._CSS.input, this._CSS.text], { contentEditable: !this.readOnly, innerHTML: this._data.text, }); - const caption = this._make("div", [this._CSS.input, this._CSS.caption], { + const caption = make("div", [this._CSS.input, this._CSS.caption], { contentEditable: !this.readOnly, innerHTML: this._data.caption, }); @@ -421,10 +432,10 @@ export default class Quote { * 1. Left alignment * 2. Center alignment * - * @returns {TunesMenuConfig} + * @returns {MenuConfig} * */ - renderSettings(): TunesMenuConfig[] { + renderSettings(): MenuConfig[] { const capitalize = (str: string) => str ? str[0].toUpperCase() + str.slice(1) : str; @@ -443,35 +454,7 @@ export default class Quote { * @param {string} tune - alignment * @private */ - _toggleTune(tune: "left" | "center") { + _toggleTune(tune: Alignment) { this._data.alignment = tune; } - - /** - * Helper for making Elements with attributes - * - * @param {string} tagName - new Element tag name - * @param {Array|string} classNames - list or name of CSS classname(s) - * @param {object} attributes - any attributes - * @returns {Element} - */ - _make( - tagName: string, - classNames: string | string[] | null = null, - attributes: { [key: string]: any } = {} - ): HTMLElement { - const el = document.createElement(tagName); - - if (Array.isArray(classNames)) { - el.classList.add(...classNames); - } else if (classNames) { - el.classList.add(classNames); - } - - for (const attrName in attributes) { - (el as any)[attrName] = attributes[attrName]; - } - - return el; - } } diff --git a/src/types/icons.d.ts b/src/types/icons.d.ts deleted file mode 100644 index 69735e1..0000000 --- a/src/types/icons.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// temporary fix for the missing types -declare module "@codexteam/icons" { - export const IconAlignLeft: string; - export const IconAlignCenter: string; - export const IconQuote: string; -} diff --git a/yarn.lock b/yarn.lock index 5c4072f..e8e3017 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,16 +28,28 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@codexteam/icons@^0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@codexteam/icons/-/icons-0.0.5.tgz#d17f39b6a0497c6439f57dd42711817a3dd3679c" - integrity sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA== +"@codexteam/icons@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@codexteam/icons/-/icons-0.3.2.tgz#b7aed0ba7b344e07953101f5476cded570d4f150" + integrity sha512-P1ep2fHoy0tv4wx85eic+uee5plDnZQ1Qa6gDfv7eHPkCXorMtVqJhzMb75o1izogh6G7380PqmFDXV3bW3Pig== + +"@editorjs/dom@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@editorjs/dom/-/dom-0.0.1.tgz#62297e0b597509598d4829aeaeb4b6a8a59a5d03" + integrity sha512-cFTVjsCKUFZHDjG9jFeooqkMchlWjkNbIJjWUYEA4DeK8VOc6VYiW3GJCjw4J2BXSkzwm3T4O7r6ra2dZxTx2w== + dependencies: + "@editorjs/helpers" "workspace:*" "@editorjs/editorjs@^2.29.1": version "2.30.5" resolved "https://registry.yarnpkg.com/@editorjs/editorjs/-/editorjs-2.30.5.tgz#c1a6fc2b99f567a0271408c0edd51d3da21b4534" integrity sha512-sE7m/UPbuf+nSGjv9cmWggFsfvtYlgEX7PCby2lZWvOsOLbRxuLT+ZYlwbWshD+8BFJwiAmBj9e+ScZcOjCzeg== +"@editorjs/helpers@workspace:*": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@editorjs/helpers/-/helpers-0.0.1.tgz#580eadca9b3a646d7466434579cee90ebebdc0a8" + integrity sha512-oEp8pqqvvx1Yut4KyvEoYKroAe5TFRNdXOPGIerleIB/6HA/n5hvARa8HRNQtOlMJH40vcRTT3Z+74J3NjlQlQ== + "@esbuild/android-arm64@0.18.20": version "0.18.20" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" From 159cb0be0cf3d24c7116e7bf94b0b0b075a04dab Mon Sep 17 00:00:00 2001 From: Aavishkar Mishra Date: Thu, 15 Aug 2024 03:21:16 +0530 Subject: [PATCH 3/5] Bump icons from @0.0.5 to @0.3.2 and resolve comments --- package.json | 10 ++-- src/index.ts | 111 ++++++++++++------------------------------- src/types/icons.d.ts | 6 --- yarn.lock | 20 ++++++-- 4 files changed, 52 insertions(+), 95 deletions(-) delete mode 100644 src/types/icons.d.ts diff --git a/package.json b/package.json index fab90ce..4445af5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/quote", - "version": "2.6.1", + "version": "2.7.0", "keywords": [ "codex editor", "quote", @@ -18,7 +18,8 @@ "exports": { ".": { "import": "./dist/quote.mjs", - "require": "./dist/quote.umd.js" + "require": "./dist/quote.umd.js", + "types": "./dist/index.d.ts" } }, "types": "./dist/index.d.ts", @@ -36,9 +37,10 @@ "typescript": "^5.4.5", "vite": "^4.5.0", "vite-plugin-css-injected-by-js": "^3.3.0", - "vite-plugin-dts": "^3.9.1" + "vite-plugin-dts": "^3.9.1", + "@editorjs/dom": "^0.0.1" }, "dependencies": { - "@codexteam/icons": "^0.0.5" + "@codexteam/icons": "^0.3.2" } } diff --git a/src/index.ts b/src/index.ts index 464e956..b987451 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,9 @@ import "./index.css"; import { IconAlignLeft, IconAlignCenter, IconQuote } from "@codexteam/icons"; -import type { API, ToolConfig } from "@editorjs/editorjs"; +import { make } from "@editorjs/dom"; +import type { API, BlockTool, ToolConfig } from "@editorjs/editorjs"; +import { MenuConfig } from "@editorjs/editorjs/types/tools"; /** * @typedef {object} QuoteConfig @@ -27,7 +29,7 @@ export interface QuoteConfig extends ToolConfig { /** * Default alignment for the quote. */ - defaultAlignment: "center" | "left"; + defaultAlignment: Alignment; } /** @@ -51,42 +53,7 @@ export interface QuoteData { /** * The alignment of the quote. */ - alignment: "center" | "left"; -} - -/** - * @typedef {object} TunesMenuConfig - * @property {string} icon - menu item icon - * @property {string} label - menu item label - * @property {boolean} isActive - true if item should be in active state - * @property {boolean} closeOnActivate - if true tunes menu should close once any item is selected - * @property {() => void} onActivate - item activation callback - */ -interface TunesMenuConfig { - /** - * Icon for the menu item. - */ - icon: string; - - /** - * Label for the menu item. - */ - label: string; - - /** - * Indicates if the item should be in an active state. - */ - isActive: boolean; - - /** - * Determines if the tunes menu should close after an item is selected. - */ - closeOnActivate: boolean; - - /** - * Callback function to be called when the item is activated. - */ - onActivate: () => void; + alignment: Alignment; } /** @@ -145,13 +112,22 @@ interface QuoteCSS { caption: string; } +/** + * @typedef {Enum} Alignment + * @description Enum for Quote Alignment + */ +enum Alignment { + left = "left", + center = "center", +} + /** * @class Quote * @classdesc Quote Tool for Editor.js * @property {QuoteData} data - Tool`s input and output data * @propert {API} api - Editor.js API instance */ -export default class Quote { +export default class Quote implements BlockTool { /** * The Editor.js API */ @@ -160,6 +136,7 @@ export default class Quote { * Is Quote Tool read-only */ readOnly: boolean; + /** * Placeholder for Quote Tool */ @@ -282,12 +259,12 @@ export default class Quote { * Allowed quote alignments * * @public - * @returns {{left: string, center: string}} + * @returns {Record } */ - static get ALIGNMENTS(): { left: "left"; center: "center" } { + static get ALIGNMENTS(): Record { return { - left: "left", - center: "center", + left: Alignment.left, + center: Alignment.center, }; } @@ -297,7 +274,7 @@ export default class Quote { * @public * @returns {string} */ - static get DEFAULT_ALIGNMENT(): "left" { + static get DEFAULT_ALIGNMENT(): Alignment { return Quote.ALIGNMENTS.left; } @@ -344,14 +321,14 @@ export default class Quote { * * @returns {*[]} */ - get settings(): { name: "left" | "center"; icon: string }[] { + get settings(): { name: Alignment; icon: string }[] { return [ { - name: "left", + name: Alignment.left, icon: IconAlignLeft, }, { - name: "center", + name: Alignment.center, icon: IconAlignCenter, }, ]; @@ -363,15 +340,15 @@ export default class Quote { * @returns {Element} */ render(): HTMLElement { - const container = this._make("blockquote", [ + const container = make("blockquote", [ this._CSS.baseClass, this._CSS.wrapper, ]); - const quote = this._make("div", [this._CSS.input, this._CSS.text], { + const quote = make("div", [this._CSS.input, this._CSS.text], { contentEditable: !this.readOnly, innerHTML: this._data.text, }); - const caption = this._make("div", [this._CSS.input, this._CSS.caption], { + const caption = make("div", [this._CSS.input, this._CSS.caption], { contentEditable: !this.readOnly, innerHTML: this._data.caption, }); @@ -421,10 +398,10 @@ export default class Quote { * 1. Left alignment * 2. Center alignment * - * @returns {TunesMenuConfig} + * @returns {MenuConfig} * */ - renderSettings(): TunesMenuConfig[] { + renderSettings(): HTMLElement | MenuConfig { const capitalize = (str: string) => str ? str[0].toUpperCase() + str.slice(1) : str; @@ -443,35 +420,7 @@ export default class Quote { * @param {string} tune - alignment * @private */ - _toggleTune(tune: "left" | "center") { + _toggleTune(tune: Alignment) { this._data.alignment = tune; } - - /** - * Helper for making Elements with attributes - * - * @param {string} tagName - new Element tag name - * @param {Array|string} classNames - list or name of CSS classname(s) - * @param {object} attributes - any attributes - * @returns {Element} - */ - _make( - tagName: string, - classNames: string | string[] | null = null, - attributes: { [key: string]: any } = {} - ): HTMLElement { - const el = document.createElement(tagName); - - if (Array.isArray(classNames)) { - el.classList.add(...classNames); - } else if (classNames) { - el.classList.add(classNames); - } - - for (const attrName in attributes) { - (el as any)[attrName] = attributes[attrName]; - } - - return el; - } } diff --git a/src/types/icons.d.ts b/src/types/icons.d.ts deleted file mode 100644 index 69735e1..0000000 --- a/src/types/icons.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -// temporary fix for the missing types -declare module "@codexteam/icons" { - export const IconAlignLeft: string; - export const IconAlignCenter: string; - export const IconQuote: string; -} diff --git a/yarn.lock b/yarn.lock index 5c4072f..e8e3017 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,16 +28,28 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@codexteam/icons@^0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@codexteam/icons/-/icons-0.0.5.tgz#d17f39b6a0497c6439f57dd42711817a3dd3679c" - integrity sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA== +"@codexteam/icons@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@codexteam/icons/-/icons-0.3.2.tgz#b7aed0ba7b344e07953101f5476cded570d4f150" + integrity sha512-P1ep2fHoy0tv4wx85eic+uee5plDnZQ1Qa6gDfv7eHPkCXorMtVqJhzMb75o1izogh6G7380PqmFDXV3bW3Pig== + +"@editorjs/dom@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@editorjs/dom/-/dom-0.0.1.tgz#62297e0b597509598d4829aeaeb4b6a8a59a5d03" + integrity sha512-cFTVjsCKUFZHDjG9jFeooqkMchlWjkNbIJjWUYEA4DeK8VOc6VYiW3GJCjw4J2BXSkzwm3T4O7r6ra2dZxTx2w== + dependencies: + "@editorjs/helpers" "workspace:*" "@editorjs/editorjs@^2.29.1": version "2.30.5" resolved "https://registry.yarnpkg.com/@editorjs/editorjs/-/editorjs-2.30.5.tgz#c1a6fc2b99f567a0271408c0edd51d3da21b4534" integrity sha512-sE7m/UPbuf+nSGjv9cmWggFsfvtYlgEX7PCby2lZWvOsOLbRxuLT+ZYlwbWshD+8BFJwiAmBj9e+ScZcOjCzeg== +"@editorjs/helpers@workspace:*": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@editorjs/helpers/-/helpers-0.0.1.tgz#580eadca9b3a646d7466434579cee90ebebdc0a8" + integrity sha512-oEp8pqqvvx1Yut4KyvEoYKroAe5TFRNdXOPGIerleIB/6HA/n5hvARa8HRNQtOlMJH40vcRTT3Z+74J3NjlQlQ== + "@esbuild/android-arm64@0.18.20": version "0.18.20" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622" From ee57038f3c49af3452d8316547a0bc9d21eb681f Mon Sep 17 00:00:00 2001 From: Aavishkar Mishra Date: Thu, 15 Aug 2024 22:37:17 +0530 Subject: [PATCH 4/5] Rename Alignment -> ALIGNMENT and update dependecies --- package.json | 6 +++--- src/index.ts | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 4445af5..110c293 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,10 @@ "typescript": "^5.4.5", "vite": "^4.5.0", "vite-plugin-css-injected-by-js": "^3.3.0", - "vite-plugin-dts": "^3.9.1", - "@editorjs/dom": "^0.0.1" + "vite-plugin-dts": "^3.9.1" }, "dependencies": { - "@codexteam/icons": "^0.3.2" + "@codexteam/icons": "^0.3.2", + "@editorjs/dom": "^0.0.1" } } diff --git a/src/index.ts b/src/index.ts index b987451..c0e4c86 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,7 +29,7 @@ export interface QuoteConfig extends ToolConfig { /** * Default alignment for the quote. */ - defaultAlignment: Alignment; + defaultAlignment: ALIGNMENT; } /** @@ -53,7 +53,7 @@ export interface QuoteData { /** * The alignment of the quote. */ - alignment: Alignment; + alignment: ALIGNMENT; } /** @@ -113,10 +113,10 @@ interface QuoteCSS { } /** - * @typedef {Enum} Alignment + * @typedef {Enum} ALIGNMENT * @description Enum for Quote Alignment */ -enum Alignment { +enum ALIGNMENT { left = "left", center = "center", } @@ -259,12 +259,12 @@ export default class Quote implements BlockTool { * Allowed quote alignments * * @public - * @returns {Record } + * @returns {Record } */ - static get ALIGNMENTS(): Record { + static get ALIGNMENTS(): Record { return { - left: Alignment.left, - center: Alignment.center, + left: ALIGNMENT.left, + center: ALIGNMENT.center, }; } @@ -274,7 +274,7 @@ export default class Quote implements BlockTool { * @public * @returns {string} */ - static get DEFAULT_ALIGNMENT(): Alignment { + static get DEFAULT_ALIGNMENT(): ALIGNMENT { return Quote.ALIGNMENTS.left; } @@ -321,14 +321,14 @@ export default class Quote implements BlockTool { * * @returns {*[]} */ - get settings(): { name: Alignment; icon: string }[] { + get settings(): { name: ALIGNMENT; icon: string }[] { return [ { - name: Alignment.left, + name: ALIGNMENT.left, icon: IconAlignLeft, }, { - name: Alignment.center, + name: ALIGNMENT.center, icon: IconAlignCenter, }, ]; @@ -420,7 +420,7 @@ export default class Quote implements BlockTool { * @param {string} tune - alignment * @private */ - _toggleTune(tune: Alignment) { + _toggleTune(tune: ALIGNMENT) { this._data.alignment = tune; } } From 2e45c09de4634fd1820deeec5c535005051a3616 Mon Sep 17 00:00:00 2001 From: Aavishkar Mishra Date: Fri, 16 Aug 2024 21:21:25 +0530 Subject: [PATCH 5/5] Fix enum --- src/index.ts | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/index.ts b/src/index.ts index c0e4c86..0b4943b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,7 +29,7 @@ export interface QuoteConfig extends ToolConfig { /** * Default alignment for the quote. */ - defaultAlignment: ALIGNMENT; + defaultAlignment: Alignment; } /** @@ -53,7 +53,7 @@ export interface QuoteData { /** * The alignment of the quote. */ - alignment: ALIGNMENT; + alignment: Alignment; } /** @@ -113,12 +113,12 @@ interface QuoteCSS { } /** - * @typedef {Enum} ALIGNMENT + * @typedef {Enum} Alignment * @description Enum for Quote Alignment */ -enum ALIGNMENT { - left = "left", - center = "center", +enum Alignment { + Left = "left", + Center = "center", } /** @@ -164,7 +164,7 @@ export default class Quote implements BlockTool { * @param {boolean} params.readOnly - read only mode flag */ constructor({ data, config, api, readOnly }: QuoteParams) { - const { ALIGNMENTS, DEFAULT_ALIGNMENT } = Quote; + const { DEFAULT_ALIGNMENT } = Quote; this.api = api; this.readOnly = readOnly; @@ -178,7 +178,7 @@ export default class Quote implements BlockTool { text: data.text || "", caption: data.caption || "", alignment: - (Object.values(ALIGNMENTS).includes(data.alignment) && + (Object.values(Alignment).includes(data.alignment as Alignment) && data.alignment) || config.defaultAlignment || DEFAULT_ALIGNMENT, @@ -255,18 +255,6 @@ export default class Quote implements BlockTool { return "Enter a caption"; } - /** - * Allowed quote alignments - * - * @public - * @returns {Record } - */ - static get ALIGNMENTS(): Record { - return { - left: ALIGNMENT.left, - center: ALIGNMENT.center, - }; - } /** * Default quote alignment @@ -274,8 +262,8 @@ export default class Quote implements BlockTool { * @public * @returns {string} */ - static get DEFAULT_ALIGNMENT(): ALIGNMENT { - return Quote.ALIGNMENTS.left; + static get DEFAULT_ALIGNMENT(): Alignment { + return Alignment.Left; } /** @@ -321,14 +309,14 @@ export default class Quote implements BlockTool { * * @returns {*[]} */ - get settings(): { name: ALIGNMENT; icon: string }[] { + get settings(): { name: Alignment; icon: string }[] { return [ { - name: ALIGNMENT.left, + name: Alignment.Left, icon: IconAlignLeft, }, { - name: ALIGNMENT.center, + name: Alignment.Center, icon: IconAlignCenter, }, ]; @@ -420,7 +408,7 @@ export default class Quote implements BlockTool { * @param {string} tune - alignment * @private */ - _toggleTune(tune: ALIGNMENT) { + _toggleTune(tune: Alignment) { this._data.alignment = tune; } }