0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 12:59:12 -05:00
penpot/frontend/vendor/text_editor_v2.js.map

8 lines
165 KiB
Text
Raw Normal View History

2024-10-20 12:03:08 +02:00
{
"version": 3,
"sources": ["../editor/clipboard/copy.js", "../editor/clipboard/cut.js", "../editor/content/dom/Color.js", "../editor/content/dom/Style.js", "../editor/content/dom/Element.js", "../editor/content/dom/LineBreak.js", "../editor/content/dom/Inline.js", "../editor/content/dom/Root.js", "../editor/content/dom/TextNode.js", "../editor/content/dom/Paragraph.js", "../editor/content/dom/Content.js", "../editor/clipboard/paste.js", "../editor/clipboard/index.js", "../editor/commands/insertText.js", "../editor/commands/insertParagraph.js", "../editor/commands/deleteByCut.js", "../editor/commands/deleteContentBackward.js", "../editor/commands/deleteContentForward.js", "../editor/commands/index.js", "../editor/controllers/ChangeController.js", "../editor/content/Text.js", "../editor/content/dom/TextNodeIterator.js", "../editor/commands/CommandMutations.js", "../editor/controllers/SelectionDirection.js", "../editor/controllers/SafeGuard.js", "../editor/controllers/SelectionController.js", "../editor/selection/Imposter.js", "../editor/Event.js", "../editor/layout/LayoutType.js", "../editor/TextEditor.js"],
"sourcesContent": ["/**\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) KALEIDOS INC\n */\n\n/**\n * This event is called when the user copies a text from the\n * editor.\n *\n * TODO: We could transform `--fills` in here to CSS `color`, `background-image`,\n * etc. to be more compatible with other applications.\n *\n * @param {ClipboardEvent} event\n * @param {TextEditor} editor\n */\nexport function copy(event, editor) {}\n", "/**\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) KALEIDOS INC\n */\n\n/**\n * This event is called when the user copies a text from the\n * editor.\n *\n * TODO: We could transform `--fills` in here to CSS `color`, `background-image`,\n * etc. to be more compatible with other applications.\n *\n * @param {ClipboardEvent} event\n * @param {TextEditor} editor\n */\nexport function cut(event, editor) {}\n", "/**\n * Canvas used to retrieve colors as CSS hexadecimals.\n *\n * @type {OffscreenCanvas|HTMLCanvasElement}\n */\nlet canvas = null; // createCanvas(1, 1);\n\n/**\n * Context used to retrieve colors as CSS hexadecimals.\n *\n * @type {CanvasRenderingContext2D}\n */\nlet context = null; // canvas.getContext(\"2d\");\n\n/**\n * Returns the canvas context.\n *\n * @returns {CanvasRenderingContext2D}\n */\nfunction getContext() {\n if (!canvas) {\n canvas = createCanvas(1, 1);\n }\n if (!context) {\n context = canvas.getContext(\"2d\");\n }\n return context\n}\n\n/**\n * Creates a new canvas element.\n *\n * @param {number} width\n * @param {number} height\n * @returns {OffscreenCanvas|HTMLCanvasElement}\n */\nfunction createCanvas(width, height) {\n if (\"OffscreenCanvas\" in globalThis) {\n return new OffscreenCanvas(width, height);\n }\n return document.createElement(\"canvas\");\n}\n\n/**\n * Returns a byte representation as an hex.\n *\n * @param {number} byte\n * @returns {string}\n */\nexport function getByteAsHex(byte) {\n return byte.toString(16).padStart(2, \"0\");\n}\n\n/**\n * Returns a color definition from a fillStyle color.\n *\n * @param {string} fillStyle\n * @returns {[string, number]}\n */\nexport function getColor(fillStyle) {\n const context = getContext();\n context.fillStyle = fillStyle;\n context.fillRect(0, 0, 1, 1);\n const imageData = context.getImageData(0, 0, 1, 1);\n const [r, g, b, a] = imageData.data;\n return [`#${getByteAsHex(r)}${getByteAsHex(g)}${getByteAsHex(b)}`, a / 255.0];\n}\n\n/**\n * Returns a fill from a fillStyle color.\n *\n * @param {string} fillStyle\n * @returns {string}\n */\nexport function getFills(fillStyle) {\n const [color, opacity] = getColor(fillStyle);\n return `[[\"^ \",\"~:fill-color\",\"${color}\",\"~:fill-opacity\",${opacity}]]`;\n}\n", "/**\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n *\n * Copyright (c) KALEIDOS INC\n */\n\nimport { getFills } from \"./Color\";\n\n/**\n * Merges two style declarations. `source` -> `target`.\n *\n * @param {CSSStyleDeclaration} target\n * @param {CSSStyleDeclaration} source\n * @returns {CSSStyleDeclaration}\n */\nexport function mergeStyleDeclarations(target, source) {\n // This is better but it doesn't work in JSDOM\n // for (const styleName of source) {\n for (let index = 0; index < source.length; index++) {\n const styleName = source.item(index);\n target.setProperty(styleName, source.getPropertyValue(styleName));\n }\n return target\n}\n\n/**\n * Computes the styles of an element the same way `window.getComputedStyle` does.\n *\n * @param {Element} element\n * @returns {CSSStyleDeclaration}\n */\nexport function getComputedStyle(element) {\n co
"mappings": "gYAkBO,SAASA,GAAKC,EAAOC,EAAQ,CAAC,CCA9B,SAASC,GAAIC,EAAOC,EAAQ,CAAC,CCbpC,IAAIC,GAAS,KAOTC,GAAU,KAOd,SAASC,IAAa,CACpB,OAAKF,KACHA,GAASG,GAAa,EAAG,CAAC,GAEvBF,KACHA,GAAUD,GAAO,WAAW,IAAI,GAE3BC,EACT,CASA,SAASE,GAAaC,EAAOC,EAAQ,CACnC,MAAI,oBAAqB,WAChB,IAAI,gBAAgBD,EAAOC,CAAM,EAEnC,SAAS,cAAc,QAAQ,CACxC,CAQO,SAASC,GAAaC,EAAM,CACjC,OAAOA,EAAK,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CAC1C,CAQO,SAASC,GAASC,EAAW,CAClC,IAAMR,EAAUC,GAAW,EAC3BD,EAAQ,UAAYQ,EACpBR,EAAQ,SAAS,EAAG,EAAG,EAAG,CAAC,EAC3B,IAAMS,EAAYT,EAAQ,aAAa,EAAG,EAAG,EAAG,CAAC,EAC3C,CAACU,EAAGC,EAAGC,EAAGC,CAAC,EAAIJ,EAAU,KAC/B,MAAO,CAAC,IAAIJ,GAAaK,CAAC,CAAC,GAAGL,GAAaM,CAAC,CAAC,GAAGN,GAAaO,CAAC,CAAC,GA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AAgBD,EAAI,KAC5BE,GAAS,CACpB,CAAC,qBAAqB,EACtB,CAAC,uBAAuB,EACxB,CAAC,WAAW,EACZ,CAAC,mBAAmB,EACpB,CAAC,SAAS,EACV,CAAC,cAAc,EACf,CAAC,aAAa,EACd,CAAC,YAAa,IAAI,EAClB,CAAC,aAAa,EACd,CAAC,YAAY,EACb,CAAC,aAAa,EACd,CAAC,iBAAkB,IAAI,EACvB,CAAC,iBAAiB,EAClB,CAAC
"names": ["copy", "event", "editor", "cut", "event", "editor", "canvas", "context", "getContext", "createCanvas", "width", "height", "getByteAsHex", "byte", "getColor", "fillStyle", "imageData", "r", "g", "b", "a", "getFills", "color", "opacity", "mergeStyleDeclarations", "target", "source", "index", "styleName", "getComputedStyle", "element", "inertElement", "currentElement", "newValue", "normalizeStyles", "styleDeclaration", "color", "getFills", "fontFamily", "fontId", "setStyle", "styleValue", "styleUnit", "getStyleFromDeclaration", "style", "setStylesFromObject", "element", "allowedStyles", "styleObject", "styleName", "styleUnit", "styleValue", "setStyle", "setStylesFromDeclaration", "styleDeclaration", "getStyleFromDeclaration", "setStyles", "styleObjectOrDeclaration", "mergeStyles", "allowedStyles", "styleDeclaration", "newStyles", "mergedStyles", "styleName", "styleUnit", "getStyleFromDeclaration", "isDisplayBlock", "style", "createRandomId", "createElement", "tag", "options", "element", "name", "value", "setStyles", "isElement", "nodeName", "isOffsetAtStart", "node", "offset", "isOffsetAtEnd", "TAG", "createLineBreak", "isLineBreak", "node", "TAG", "TYPE", "QUERY", "STYLES", "isInline", "node", "isElement", "isLikeInline", "element", "createInline", "textOrLineBreak", "styles", "attrs", "createElement", "createRandomId", "createInlineFrom", "inline", "mergeStyles", "createEmptyInline", "createLineBreak", "setInlineStyles", "setStyles", "getInline", "isInlineStart", "offset", "isOffsetAtStart", "isInlineEnd", "isOffsetAtEnd", "splitInline", "textNode", "style", "newTextNode", "getInlinesFrom", "startInline", "inlines", "currentInline", "index", "getInlineLength", "isLineBreak", "TAG", "TYPE", "QUERY", "STYLES", "isRoot", "node", "isElement", "createRoot", "paragraphs", "styles", "attrs", "isParagraph", "createElement", "createRandomId", "createEmptyRoot", "createEmptyParagraph", "setRootStyles", "element", "setStyles", "isTextNode", "node", "isLineBreak", "getTextNodeLength", "node", "isLineBreak", "getClosestTextNode", "isTextNode", "isInline", "isParagraph", "isRoot", "TAG", "TYPE", "QUERY", "STYLES", "isLikeParagraph", "element", "isLikeInline", "isEmptyParagraph", "isParagraph", "inline", "isInline", "isLineBreak", "node", "isElement", "createParagraph", "inlines", "styles", "attrs", "createElement", "createRandomId", "createEmptyParagraph", "createEmptyInline", "setParagraphStyles", "setStyles", "getParagraph", "paragraph", "isParagraphStart", "offset", "getInline", "isOffsetAtStart", "isParagraphEnd", "isOffsetAtEnd", "splitParagraph", "style", "isInlineEnd", "getInlinesFrom", "newInline", "splitInline", "mergeParagraphs", "a", "b", "mapContentFragmentFromDocument", "document", "root", "styleDefaults", "nodeIterator", "fragment", "currentParagraph", "currentNode", "parentStyle", "normalizeStyles", "mergeStyleDeclarations", "getComputedStyle", "isDisplayBlock", "isLikeParagraph", "createParagraph", "createInline", "mapContentFragmentFromHTML", "html", "htmlDocument", "mapContentFragmentFromString", "string", "lines", "line", "createEmptyParagraph", "paste", "event", "editor", "selectionController", "fragment", "html", "mapContentFragmentFromHTML", "plain", "mapContentFragmentFromString", "clipboard_default", "copy", "cut", "paste", "insertText", "event", "editor", "selectionController", "insertParagraph", "event", "editor", "selectionController", "deleteByCut", "event", "editor", "selectionController", "deleteContentBackward", "event", "editor", "selectionController", "deleteContentForward", "event", "editor", "selectionController", "commands_default", "insertText", "insertParagraph", "deleteByCut", "deleteContentBackward", "deleteContentForward", "_timeout", "_time", "_hasPendingChanges", "_onTimeout", "ChangeController", "time", "__privateAdd", "__privateSet", "__privateGet", "ChangeController_default", "tryOffset", "offset", "tryString", "str", "insertInto", "text", "replaceWith", "startOffset", "endOffset", "removeBackward", "removeForward", "removeSlice", "start", "end", "TextNodeIteratorDirection", "
}