{"version":3,"sources":["webpack://grapesjs-tooltip/webpack/universalModuleDefinition","webpack://grapesjs-tooltip/webpack/bootstrap","webpack://grapesjs-tooltip/./src/index.js","webpack://grapesjs-tooltip/./src/components.js","webpack://grapesjs-tooltip/./src/blocks.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","editor","opts","arguments","length","undefined","options","id","labelTooltip","blockTooltip","propsTooltip","extendTraits","traits","attrTooltip","classTooltip","style","styleAdditional","privateClasses","stylableTooltip","showTooltipOnStyle","_components2","default","_blocks2","dc","DomComponents","defaultType","getType","defaultModel","model","defaultView","view","cssc","CssComposer","classTooltipBody","classTooltipEmpty","attrTooltipVis","attrTooltipPos","attrTooltipLen","SelectorManager","getAll","add","private","on","target","selected","getSelected","el","getEl","is","getTrait","getTargetValue","getSelectors","getFullString","trim","setAttribute","once","removeAttribute","addType","extend","defaults","classes","attributes","style-signature","label","type","valueTrue","labelButton","full","command","trait","openSm","Panels","getButton","set","StyleManager","setTarget","targetIsClass","stylable","init","this","listenTo","components","checkEmpty","isComponent","hasAttribute","getClassRule","css","createCssStyles","BlockManager","_extends","category","select","content"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,oBAAAD,IAEAD,EAAA,oBAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAT,YAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA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AAKsD,aAAavE,IA3LD,WACtB,IAAIwE,EAAMvE,eACLD,EADK,oHAOLoB,EAPK,sEAYLD,EAZK,aAaLpB,EAbK,yMAmBUA,EAnBV,qfAsCLsB,EAtCK,0BAuCLtB,EAvCK,2BAwCLA,EAxCK,0GA6CLuB,EA7CK,yHAmDLA,EAnDK,iCAoDLA,EApDK,iCAqDLD,EArDK,UAqDmBC,EArDnB,mFAyDLA,EAzDK,2HA+DLA,EA/DK,kCAgELA,EAhEK,kCAiELD,EAjEK,UAiEmBC,EAjEnB,qFAqELA,EArEK,8IA4ELA,EA5EK,gCA6ELA,EA7EK,gCA8ELD,EA9EK,UA8EmBC,EA9EnB,mFAkFLC,EAlFK,2FAuFLA,EAvFK,6FA4FLA,EA5FK,4FAiGLA,EAjGK,sHAuGCxB,EAvGD,iDA2GVkB,EAAKQ,SAASC,IAAI8C,EAAMtE,GA+EgBuE,0QCjP7B,SAACtF,GAAsB,IAAdC,EAAcC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,MAC5BM,EAAmCP,EAAnCO,aAAcD,EAAqBN,EAArBM,aAAcD,EAAOL,EAAPK,GAEpCE,GAAgBR,EAAOuF,aAAahD,IAAIjC,EAAxBkF,GACd1B,qNAGSvD,EAHT,SAIAkF,SAAU,QACVC,QAAQ,EACRC,SAAW5B,KAAMzD,IACdE","file":"dist/grapesjs-tooltip.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"grapesjs-tooltip\"] = factory();\n\telse\n\t\troot[\"grapesjs-tooltip\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","import loadComponents from './components';\nimport loadBlocks from './blocks';\n\nexport default (editor, opts = {}) => {\n const options = { ...{\n // The ID used to create tooltip block and component\n id: 'tooltip',\n\n // Label of the tooltip. Used for the block and component name\n labelTooltip: 'Tooltip',\n\n // Object to extend the default tooltip block, eg. { label: 'Tooltip', category: 'Extra', ... }.\n // Pass a falsy value to avoid adding the block\n blockTooltip: {},\n\n // Object to extend the default tooltip properties, eg. `{ name: 'Tooltip', droppable: false, ... }`\n propsTooltip: {},\n\n // A function which allows to extend default traits by receiving the original array and returning a new one\n extendTraits: traits => traits,\n\n // Tooltip attribute prefix\n attrTooltip: 'data-tooltip',\n\n // Tooltip class prefix\n classTooltip: 'tooltip-component',\n\n // Custom CSS styles, this will replace the default one\n style: '',\n\n // Additional CSS styles\n styleAdditional: '',\n\n // Make all tooltip relative classes private\n privateClasses: 1,\n\n // Indicate if the tooltip can be styled. You can also pass an array\n // of which proprties can be styled. Eg. `['color', 'background-color']`\n stylableTooltip: [\n 'background-color',\n 'padding',\n 'padding-top',\n 'padding-right',\n 'padding-bottom',\n 'padding-left',\n 'font-family',\n 'font-size',\n 'font-weight',\n 'letter-spacing',\n 'color',\n 'line-height',\n 'text-align',\n 'border-radius',\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-bottom-left-radius',\n 'border-bottom-right-radius',\n 'border',\n 'border-width',\n 'border-style',\n 'border-color',\n ],\n\n // If true, force the tooltip to be shown\n showTooltipOnStyle: 1,\n }, ...opts };\n\n // Add components\n loadComponents(editor, options);\n\n // Add blocks\n loadBlocks(editor, options);\n};\n","export default (editor, opts = {}) => {\n const dc = editor.DomComponents;\n const defaultType = dc.getType('default');\n const defaultModel = defaultType.model;\n const defaultView = defaultType.view;\n const cssc = editor.CssComposer;\n const {\n id,\n labelTooltip,\n propsTooltip,\n attrTooltip,\n classTooltip,\n style,\n styleAdditional,\n privateClasses,\n stylableTooltip,\n showTooltipOnStyle,\n extendTraits,\n } = opts;\n const classTooltipBody = `${classTooltip}__body`;\n const classTooltipEmpty = `${classTooltip}--empty`;\n const attrTooltipVis = `${attrTooltip}-visible`;\n const attrTooltipPos = `${attrTooltip}-pos`;\n const attrTooltipLen = `${attrTooltip}-length`;\n const traitIdStyleTooltip = 'style-tooltip';\n\n if (privateClasses) {\n editor.SelectorManager.getAll().add([\n { private: 1, name: classTooltip },\n { private: 1, name: classTooltipBody },\n { private: 1, name: classTooltipEmpty },\n ])\n }\n\n if (showTooltipOnStyle) {\n editor.on('styleManager:update:target', target => {\n const selected = editor.getSelected();\n\n if (selected) {\n const el = selected.getEl();\n\n if (selected.is(id) &&\n !selected.getTrait(attrTooltipVis).getTargetValue() &&\n target.getSelectors().getFullString().trim() == `.${classTooltipBody}`) {\n el.setAttribute(attrTooltipVis, 'true');\n\n editor.once('styleManager:update:target', () => {\n el.removeAttribute(attrTooltipVis);\n })\n }\n }\n })\n }\n\n const createCssStyles = () => {\n let css = style || `\n .${classTooltip} {\n position: relative;\n display: inline-block;\n vertical-align: top;\n }\n\n .${classTooltipEmpty} {\n width: 50px;\n height: 50px;\n }\n\n .${classTooltipBody},\n [${attrTooltip}]::after {\n font-family: Helvetica, sans-serif;\n background: rgba(55, 61, 73, 0.95);\n border-radius: 3px;\n bottom: 100%;\n color: #fff;\n content: attr(${attrTooltip});\n display: block;\n font-size: 12px;\n left: 50%;\n line-height: normal;\n max-width: 32rem;\n opacity: 0;\n overflow: hidden;\n padding: 8px 16px;\n pointer-events: none;\n position: absolute;\n text-overflow: ellipsis;\n transform: translate(-50%, 0);\n transition: opacity 0.25s, transform 0.25s;\n white-space: nowrap;\n box-sizing: border-box;\n z-index: 10;\n }\n\n [${attrTooltipVis}=true]::after,\n [${attrTooltip}]:focus::after,\n [${attrTooltip}]:hover::after {\n opacity: 1;\n transform: translate(-50%, -0.5rem);\n }\n\n [${attrTooltipPos}=right]::after {\n bottom: 50%;\n left: 100%;\n transform: translate(0, 50%);\n }\n\n [${attrTooltipPos}=right]:focus::after,\n [${attrTooltipPos}=right]:hover::after,\n [${attrTooltipVis}=true][${attrTooltipPos}=right]::after {\n transform: translate(0.5rem, 50%);\n }\n\n [${attrTooltipPos}=bottom]::after {\n bottom: auto;\n top: 100%;\n transform: translate(-50%, 0);\n }\n\n [${attrTooltipPos}=bottom]:focus::after,\n [${attrTooltipPos}=bottom]:hover::after,\n [${attrTooltipVis}=true][${attrTooltipPos}=bottom]::after {\n transform: translate(-50%, 0.5rem);\n }\n\n [${attrTooltipPos}=left]::after {\n bottom: 50%;\n left: auto;\n right: 100%;\n transform: translate(0, 50%);\n }\n\n [${attrTooltipPos}=left]:focus::after,\n [${attrTooltipPos}=left]:hover::after,\n [${attrTooltipVis}=true][${attrTooltipPos}=left]::after {\n transform: translate(-0.5rem, 50%);\n }\n\n [${attrTooltipLen}=small]::after {\n white-space: normal;\n width: 80px;\n }\n\n [${attrTooltipLen}=medium]::after {\n white-space: normal;\n width: 150px;\n }\n\n [${attrTooltipLen}=large]::after {\n white-space: normal;\n width: 300px;\n }\n\n [${attrTooltipLen}=fit]::after {\n white-space: normal;\n width: 100%;\n }\n\n // IE 11 bugfix\n button[${attrTooltip}] {\n overflow: visible;\n }\n `;\n cssc.getAll().add(css + styleAdditional);\n }\n\n dc.addType(id, {\n model: defaultModel.extend({\n defaults: {\n ...defaultModel.prototype.defaults,\n name: labelTooltip,\n classes: [classTooltip],\n attributes: {\n [attrTooltip]: labelTooltip,\n },\n 'style-signature': [`[${attrTooltip}`, `.${classTooltip}`],\n traits: extendTraits([\n {\n name: attrTooltip,\n label: 'Text',\n }, {\n name: attrTooltipPos,\n label: 'Position',\n type: 'select',\n options: [\n { value: 'top', name: 'Top' },\n { value: 'right', name: 'Right' },\n { value: 'bottom', name: 'Bottom' },\n { value: 'left', name: 'Left' },\n ]\n }, {\n name: attrTooltipLen,\n label: 'Length',\n type: 'select',\n options: [\n { value: '', name: 'One line' },\n { value: 'small', name: 'Small' },\n { value: 'medium', name: 'Medium' },\n { value: 'large', name: 'Large' },\n { value: 'fit', name: 'Fit' },\n ]\n }, {\n name: attrTooltipVis,\n label: 'Visible',\n type: 'checkbox',\n valueTrue: 'true',\n }, {\n name: traitIdStyleTooltip,\n labelButton: 'Style tooltip',\n type: 'button',\n full: 1,\n command: (editor, trait) => {\n const openSm = editor.Panels.getButton('views', 'open-sm');\n openSm && openSm.set('active', 1);\n editor.StyleManager.setTarget(`.${classTooltipBody}`, {\n targetIsClass: 1,\n stylable: stylableTooltip,\n })\n },\n },\n ]),\n ...propsTooltip,\n },\n\n init() {\n this.listenTo(this.components(), 'add remove', this.checkEmpty);\n this.checkEmpty();\n },\n\n checkEmpty() {\n const empty = !this.components().length;\n this[empty ? 'addClass' : 'removeClass'](`${classTooltipEmpty}`);\n }\n }, {\n isComponent(el) {\n if (el.hasAttribute && el.hasAttribute(attrTooltip)) {\n return { type: id };\n }\n }\n }),\n view: defaultView.extend({\n init() {\n !cssc.getClassRule(classTooltip) && createCssStyles();\n }\n }),\n });\n}\n","export default (editor, opts = {}) => {\n const { blockTooltip, labelTooltip, id } = opts;\n\n blockTooltip && editor.BlockManager.add(id, {\n label: `\n \n \n
${labelTooltip}
`,\n category: 'Extra',\n select: true,\n content: { type: id },\n ...blockTooltip\n });\n}\n"],"sourceRoot":""}