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EAAK,KAAM,YAAIA,EAAK,O,CAG1D,OAAOc,EAAOM,OAAS,WAAIN,EAAOO,KAAK,MAAS,EAClD,EAMMC,EAAS,EAETC,EAAa,CAAEC,GAAI,EAAGC,GAAI,EAAGC,GAAI,EAAGC,GAAI,EAAGC,GAAG,EAAGC,GAAG,EAAGC,GAAI,EAAGR,OAAM,GACpES,EAAe,EAAH,KAAQR,GAAU,CAAEK,GAAI,EAAGI,GAAI,EAAGC,SALnC,aAK6CC,YAF1C,EAEuDZ,OAAM,EAAEa,KAJtE,KAKPC,EAAU,CACdC,MAAO9B,EACP,qBAAsB,WAAIC,GAC1B,qBAAsBe,EACtB,uBAAwBd,GAGpB6B,EAAU,CACdD,MAAO7B,EACP,qBAAsB,WAAID,GAC1B,qBAAsBwB,EACtB,uBAAwBrB,EAExB,sBAAuB,CAAC,SACxB,4BAA6B,CAAC,eAG1B6B,EAAa,CAAC,WAAIhC,GAAU,WAAIC,IACtCP,EAAOuC,GAAG,gBAAgB,SAAAC,GACxB,OAAAF,EAAWG,QAAQD,EAASE,gBAAkB,GAAKF,EAASG,IAAI,UAAW,EAA3E,IAEF,IAEMC,EAAWjC,EAAcwB,GACzBU,EAAYlC,EAAc0B,GAC1BS,EAAW,iBACZxC,EAAM,qMAQJA,EAAM,sDAKPyC,EAAW,iBACZxC,EAAO,oFAMZJ,EAAG6C,IAAI,UAAW,EAAF,CACdC,MA1BY,UA2BZC,SA1Be,QA2BfC,WAAY,CAAEf,MAAO,sBACrBgB,QAAS,yBACER,EAAQ,6BACNC,EAAS,mCACTA,EAAS,+DAGdC,EAAQ,uBACRC,EAAQ,iCAGb7C,EAAImD,cAEV,CDxDC,CAAWrD,EARE,GACXqD,aAAc,CAAC,EACfhD,YAAa,GACbG,SAAU,MACVE,YAAa,UACVT,GAIP,E","sources":["webpack://grapesjs-blocks-flexbox/webpack/universalModuleDefinition","webpack://grapesjs-blocks-flexbox/webpack/bootstrap","webpack://grapesjs-blocks-flexbox/webpack/runtime/define property getters","webpack://grapesjs-blocks-flexbox/webpack/runtime/hasOwnProperty shorthand","webpack://grapesjs-blocks-flexbox/webpack/runtime/make namespace object","webpack://grapesjs-blocks-flexbox/./src/index.ts","webpack://grapesjs-blocks-flexbox/./src/blocks.ts"],"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-blocks-flexbox\"] = factory();\n\telse\n\t\troot[\"grapesjs-blocks-flexbox\"] = factory();\n})(typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : this), () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { BlockProperties, Plugin } from 'grapesjs';\nimport loadBlocks from './blocks';\n\nexport interface PluginOptions {\n /**\n * Use this to extend the default flexbox block.\n * @default {}\n */\n flexboxBlock?: Partial;\n\n /**\n * Classes prefix.\n * @default ''\n */\n stylePrefix?: string;\n\n /**\n * Row label.\n * @default 'Row'\n */\n labelRow?: string;\n\n /**\n * Column label.\n * @default 'Column'\n */\n labelColumn?: string;\n};\n\nconst plugin: Plugin = (editor, opts = {}) => {\n const options: Required = {\n flexboxBlock: {},\n stylePrefix: '',\n labelRow: 'Row',\n labelColumn: 'Column',\n ...opts,\n };\n\n loadBlocks(editor, options);\n};\n\nexport default plugin;\n","import type { Editor } from 'grapesjs';\nimport { PluginOptions } from '.';\n\nexport default (editor: Editor, opt: PluginOptions = {}) => {\n const bm = editor.BlockManager;\n const stylePrefix = opt.stylePrefix;\n const clsRow = `${stylePrefix}row`;\n const clsCell = `${stylePrefix}cell`;\n const labelRow = opt.labelRow;\n const labelCell = opt.labelColumn;\n\n const attrsToString = (attrs: Record) => {\n const result = [];\n\n for (let key in attrs) {\n let value = attrs[key];\n const toParse = value instanceof Array || value instanceof Object;\n value = toParse ? JSON.stringify(value) : value;\n result.push(`${key}=${toParse ? `'${value}'` : `\"${value}\"`}`);\n }\n\n return result.length ? ` ${result.join(' ')}` : '';\n }\n\n // Flex elements do not react on width style change therefore I use\n // 'flex-basis' as keyWidth for the resizer on columns\n const keyWidth = 'flex-basis';\n const step = 0.2;\n const minDim = 1;\n const currentUnit = 1;\n const resizerBtm = { tl: 0, tc: 0, tr: 0, cl: 0, cr:0, bl:0, br: 0, minDim };\n const resizerRight = { ...resizerBtm, cr: 1, bc: 0, keyWidth, currentUnit, minDim, step };\n const rowAttr = {\n class: clsRow,\n 'data-gjs-droppable': `.${clsCell}`,\n 'data-gjs-resizable': resizerBtm,\n 'data-gjs-custom-name': labelRow,\n };\n\n const colAttr = {\n class: clsCell,\n 'data-gjs-draggable': `.${clsRow}`,\n 'data-gjs-resizable': resizerRight,\n 'data-gjs-custom-name': labelCell,\n // X Flex\n 'data-gjs-unstylable': ['width'],\n 'data-gjs-stylable-require': ['flex-basis'],\n };\n\n const privateCls = [`.${clsRow}`, `.${clsCell}`];\n editor.on('selector:add', selector =>\n privateCls.indexOf(selector.getFullName()) >= 0 && selector.set('private', 1))\n\n const label = 'Flexbox';\n const category = 'Basic';\n const attrsRow = attrsToString(rowAttr);\n const attrsCell = attrsToString(colAttr);\n const styleRow = `\n .${clsRow} {\n display: flex;\n justify-content: flex-start;\n align-items: stretch;\n flex-wrap: nowrap;\n padding: 10px;\n }\n @media (max-width: 768px) {\n .${clsRow} {\n flex-wrap: wrap;\n }\n }\n `;\n const styleClm = `\n .${clsCell} {\n min-height: 75px;\n flex-grow: 1;\n flex-basis: 100%;\n }`;\n\n bm.add('flexbox', {\n label,\n category,\n attributes: { class: 'gjs-fonts gjs-f-b2' },\n content: `\n
\n
\n
\n
\n \n `,\n ...opt.flexboxBlock\n });\n}\n"],"names":["root","factory","exports","module","define","amd","globalThis","window","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","editor","opts","opt","bm","BlockManager","stylePrefix","clsRow","clsCell","labelRow","labelCell","labelColumn","attrsToString","attrs","result","toParse","Array","JSON","stringify","push","length","join","minDim","resizerBtm","tl","tc","tr","cl","cr","bl","br","resizerRight","bc","keyWidth","currentUnit","step","rowAttr","class","colAttr","privateCls","on","selector","indexOf","getFullName","set","attrsRow","attrsCell","styleRow","styleClm","add","label","category","attributes","content","flexboxBlock"],"sourceRoot":""}