| 1 |
import { o as e } from "./chunk-CDGyQ605.js"; |
| 2 |
import { Ht as t, tt as n, vn as r } from "./runtime-core.esm-bundler-DrBnbzvJ.js"; |
| 3 |
import { t as i } from "./debounce-CDlgCFbb.js"; |
| 4 |
import { t as a } from "./preload-helper-DYZqtPCf.js"; |
| 5 |
import { t as o } from "./logger-DDCO5Eq-.js"; |
| 6 |
import { n as s, t as c } from "./tippy.esm-BM7Jrbjn.js"; |
| 7 |
import { n as l, t as u } from "./dist-CnmMLal_.js"; |
| 8 |
import { n as d, t as f } from "./highlight-in-textarea-Bd_TO65t.js"; |
| 9 |
import { t as p } from "./tribute.min-Bw2L9-D8.js"; |
| 10 |
import { a as m, i as h, n as g, r as _ } from "./constant-ruqeWy-L.js"; |
| 11 |
(async () => { |
| 12 |
var v = e(p(), 1), y = null; |
| 13 |
(async () => { |
| 14 |
y = await l({ |
| 15 |
themes: [ |
| 16 |
a(() => import("./dark-plus-DFfF31dX.js").then(async (m2) => { |
| 17 |
await m2.__tla; |
| 18 |
return m2; |
| 19 |
}), [], import.meta.url), |
| 20 |
a(() => import("./light-plus-CPnO7ha4.js").then(async (m2) => { |
| 21 |
await m2.__tla; |
| 22 |
return m2; |
| 23 |
}), [], import.meta.url) |
| 24 |
], |
| 25 |
langs: [ |
| 26 |
a(() => import("./css-CfUXbuaZ.js").then(async (m2) => { |
| 27 |
await m2.__tla; |
| 28 |
return m2; |
| 29 |
}), [], import.meta.url) |
| 30 |
], |
| 31 |
engine: u(a(() => import("./wasm-DB77wBvQ.js").then(async (m2) => { |
| 32 |
await m2.__tla; |
| 33 |
return m2; |
| 34 |
}), [], import.meta.url)) |
| 35 |
}); |
| 36 |
})(); |
| 37 |
var b = document.createRange().createContextualFragment(` |
| 38 |
<textarea id="windpressbricks-plc-input" class="windpressbricks-plc-input" rows="2" spellcheck="false"></textarea> |
| 39 |
`).querySelector(`#windpressbricks-plc-input`), x = [], S = document.createRange().createContextualFragment(` |
| 40 |
<span id="windpressbricks-plc-class-sort" class="bricks-svg-wrapper windpressbricks-plc windpressbricks-plc-class-sort" data-balloon="Automatic Class Sorting" data-balloon-pos="left"> |
| 41 |
<svg xmlns="http://www.w3.org/2000/svg" class="bricks-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="bricks-svg icon icon-tabler icons-tabler-outline icon-tabler-reorder"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" /><path d="M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" /><path d="M17 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" /><path d="M5 11v-3a3 3 0 0 1 3 -3h8a3 3 0 0 1 3 3v3" /><path d="M16.5 8.5l2.5 2.5l2.5 -2.5" /></svg> |
| 42 |
</span> |
| 43 |
`).querySelector(`#windpressbricks-plc-class-sort`), C = document.createRange().createContextualFragment(` |
| 44 |
<span id="windpressbricks-plc-class-down" class="bricks-svg-wrapper windpressbricks-plc windpressbricks-plc-class-down" data-balloon="Move Classes to Plain Classes" data-balloon-pos="left"> |
| 45 |
<svg xmlns="http://www.w3.org/2000/svg" class="bricks-svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.5 13h6M2 16l4.5-9l4.5 9m7-9v9m-4-4l4 4l4-4"/></svg> |
| 46 |
</span> |
| 47 |
`).querySelector(`#windpressbricks-plc-class-down`); |
| 48 |
x.push(S), x.push(C); |
| 49 |
var w = r(false), T = r([]), E = r(0), D = null; |
| 50 |
d(b); |
| 51 |
var O = []; |
| 52 |
wp.hooks.addAction(`windpressbricks-autocomplete-items-refresh`, `windpressbricks`, () => { |
| 53 |
O = wp.hooks.applyFilters(`windpressbricks-autocomplete-items`, [], b.value); |
| 54 |
}), wp.hooks.doAction(`windpressbricks-autocomplete-items-refresh`); |
| 55 |
var k = new v.default({ |
| 56 |
containerClass: `windpressbricks-tribute-container`, |
| 57 |
autocompleteMode: true, |
| 58 |
menuItemLimit: 50, |
| 59 |
noMatchTemplate: ``, |
| 60 |
values: async function(e2, t2) { |
| 61 |
if (!m(`module.plain-classes.autocomplete`, true).value) { |
| 62 |
t2([]); |
| 63 |
return; |
| 64 |
} |
| 65 |
t2(await wp.hooks.applyFilters(`windpressbricks-autocomplete-items-query`, O, e2)); |
| 66 |
}, |
| 67 |
lookup: `value`, |
| 68 |
itemClass: `class-item`, |
| 69 |
menuItemTemplate: function(e2) { |
| 70 |
let t2 = ``; |
| 71 |
return e2.original.color !== void 0 && (t2 += `background-color: ${e2.original.color};`), e2.original.fontWeight !== void 0 && (t2 += `font-weight: ${e2.original.fontWeight};`), ` |
| 72 |
<span class="class-name" data-tribute-class-name="${e2.original.value}">${e2.string}</span> |
| 73 |
<span class="class-hint" style="${t2}"></span> |
| 74 |
`; |
| 75 |
} |
| 76 |
}); |
| 77 |
k.setMenuContainer = function(e2) { |
| 78 |
this.menuContainer = e2; |
| 79 |
}; |
| 80 |
var A = k.events.callbacks; |
| 81 |
k.events.callbacks = function() { |
| 82 |
return { |
| 83 |
...A.call(this), |
| 84 |
up: (e2, t2) => { |
| 85 |
if (this.tribute.isActive && this.tribute.current.filteredItems) { |
| 86 |
e2.preventDefault(), e2.stopPropagation(); |
| 87 |
let t3 = this.tribute.current.filteredItems.length, n2 = this.tribute.menuSelected; |
| 88 |
t3 > n2 && n2 > 0 ? (this.tribute.menuSelected--, this.setActiveLi()) : n2 === 0 && (this.tribute.menuSelected = t3 - 1, this.setActiveLi(), this.tribute.menu.scrollTop = this.tribute.menu.scrollHeight), R(); |
| 89 |
} |
| 90 |
}, |
| 91 |
down: (e2, t2) => { |
| 92 |
if (this.tribute.isActive && this.tribute.current.filteredItems) { |
| 93 |
e2.preventDefault(), e2.stopPropagation(); |
| 94 |
let t3 = this.tribute.current.filteredItems.length - 1, n2 = this.tribute.menuSelected; |
| 95 |
t3 > n2 ? (this.tribute.menuSelected++, this.setActiveLi()) : t3 === n2 && (this.tribute.menuSelected = 0, this.setActiveLi(), this.tribute.menu.scrollTop = 0), R(); |
| 96 |
} |
| 97 |
} |
| 98 |
}; |
| 99 |
}, k.attach(b), new MutationObserver(function(e2) { |
| 100 |
e2.forEach(function(e3) { |
| 101 |
e3.type === `attributes` ? e3.target.id === `bricks-panel-element` && e3.attributeName === `style` && (w.value = e3.target.style.display !== `none`) : e3.type === `childList` && e3.addedNodes.length > 0 && e3.target.dataset && e3.target.dataset.controlkey === `_cssClasses` && e3.addedNodes[0].childNodes.length > 0 && document.querySelector(`#_cssClasses`).addEventListener(`input`, function(e4) { |
| 102 |
n(() => { |
| 103 |
b.value = e4.target.value, j(); |
| 104 |
}); |
| 105 |
}); |
| 106 |
}); |
| 107 |
}).observe(document.getElementById(`bricks-panel-element`), { |
| 108 |
subtree: true, |
| 109 |
attributes: true, |
| 110 |
childList: true |
| 111 |
}), new MutationObserver(function(e2) { |
| 112 |
g.$_state.selectedElements.length > 0 ? T.value = g.$_state.selectedElements.map((e3) => e3.id) : g.$_activeElement.value ? T.value = [ |
| 113 |
g.$_activeElement.value.id |
| 114 |
] : T.value = []; |
| 115 |
}).observe(document.querySelector(`#bricks-structure`), { |
| 116 |
subtree: true, |
| 117 |
attributes: true, |
| 118 |
childList: true |
| 119 |
}), new MutationObserver(function(e2) { |
| 120 |
n(() => { |
| 121 |
E.value === g.$_state.historyIndex && (E.value = 0), E.value = g.$_state.historyIndex; |
| 122 |
}); |
| 123 |
}).observe(document.querySelector(`#bricks-toolbar > ul.group-wrapper.end > li.undo`), { |
| 124 |
subtree: false, |
| 125 |
attributeFilter: [ |
| 126 |
`class` |
| 127 |
] |
| 128 |
}), t([ |
| 129 |
T, |
| 130 |
w, |
| 131 |
E |
| 132 |
], (e2, t2) => { |
| 133 |
(e2[0] !== t2[0] || e2[2] !== t2[2]) && n(() => { |
| 134 |
if (e2[0].length > 0) { |
| 135 |
let t3 = e2[0].map((e3) => g.$_state.activeComponent ? g.$_state.components.find((e4) => e4.id === g.$_state.activeComponent.id)?.elements.find((t4) => t4.id === e3)?.settings?._cssClasses || `` : g.$_state[z()].find((t4) => t4.id === e3)?.settings?._cssClasses || ``); |
| 136 |
b.value = t3.every((e3) => e3 === t3[0]) ? t3[0] : ``; |
| 137 |
} else b.value = ``; |
| 138 |
j(); |
| 139 |
}), e2[0] && e2[1] && n(() => { |
| 140 |
let e3 = document.querySelector(`#bricks-panel-sticky`); |
| 141 |
if (m(`module.plain-classes.input-field`, true).value && e3) { |
| 142 |
if (e3.querySelector(`.windpressbricks-plc-input`) === null) { |
| 143 |
let t4 = document.createElement(`div`); |
| 144 |
t4.style.padding = `0 var(--builder-spacing)`, t4.appendChild(b), e3.appendChild(t4), D = new f(b, { |
| 145 |
highlight: [ |
| 146 |
{ |
| 147 |
highlight: /(?<=\s|^)(?:(?!\s).)+(?=\s|$)/g, |
| 148 |
className: `word` |
| 149 |
}, |
| 150 |
{ |
| 151 |
highlight: /(?<=\s)\s/g, |
| 152 |
className: `multispace`, |
| 153 |
blank: true |
| 154 |
} |
| 155 |
] |
| 156 |
}), d.update(b); |
| 157 |
} |
| 158 |
let t3 = document.querySelector(`#bricks-panel-element-classes > div > div.actions-wrapper > div > div.dropdown-wrapper > div`); |
| 159 |
t3.querySelectorAll(`.windpressbricks-plc`).length === 0 && x.forEach((e4) => { |
| 160 |
t3.appendChild(e4); |
| 161 |
}); |
| 162 |
} |
| 163 |
}); |
| 164 |
}), b.addEventListener(`input`, function(e2) { |
| 165 |
T.value.forEach((t2) => { |
| 166 |
if (g.$_state.activeComponent) { |
| 167 |
let n2 = g.$_state.components.find((e3) => e3.id === g.$_state.activeComponent.id); |
| 168 |
if (n2) { |
| 169 |
let r2 = n2.elements.find((e3) => e3.id === t2); |
| 170 |
r2 && (r2.settings._cssClasses = e2.target.value); |
| 171 |
} |
| 172 |
} else { |
| 173 |
let n2 = g.$_state[z()].find((e3) => e3.id === t2); |
| 174 |
n2 && (n2.settings._cssClasses = e2.target.value); |
| 175 |
} |
| 176 |
}); |
| 177 |
}); |
| 178 |
function j() { |
| 179 |
n(() => { |
| 180 |
try { |
| 181 |
D.handleInput(); |
| 182 |
} catch { |
| 183 |
} |
| 184 |
d.update(b), k.hideMenu(); |
| 185 |
}); |
| 186 |
} |
| 187 |
b.addEventListener(`highlights-updated`, function(e2) { |
| 188 |
N(); |
| 189 |
}); |
| 190 |
var M = s(document.createElement(`div`), { |
| 191 |
plugins: [ |
| 192 |
c |
| 193 |
], |
| 194 |
allowHTML: true, |
| 195 |
arrow: false, |
| 196 |
duration: [ |
| 197 |
500, |
| 198 |
0 |
| 199 |
], |
| 200 |
followCursor: true, |
| 201 |
trigger: `manual` |
| 202 |
}); |
| 203 |
function N() { |
| 204 |
let e2 = document.querySelector(`.hit-container`); |
| 205 |
if (e2 === null) return; |
| 206 |
M.reference = e2; |
| 207 |
async function n2(e3) { |
| 208 |
let t2 = e3.textContent, n3 = await _.contentWindow.windpress.module.classnameToCss.generate(t2); |
| 209 |
if (n3 === null || n3.trim() === ``) return null; |
| 210 |
M.setContent(y.codeToHtml(n3, { |
| 211 |
lang: `css`, |
| 212 |
theme: `dark-plus` |
| 213 |
})), M.show(); |
| 214 |
} |
| 215 |
let a2 = r(null), o2 = i(function(e3) { |
| 216 |
if (!m(`module.plain-classes.hover-preview-classes`, true).value) return; |
| 217 |
let t2 = e3.clientX, n3 = e3.clientY; |
| 218 |
a2.value = document.elementsFromPoint(t2, n3).find((e4) => e4.matches(`mark[class="word"]`)) || null; |
| 219 |
}, 10); |
| 220 |
e2.addEventListener(`mousemove`, o2), e2.addEventListener(`mouseleave`, function(e3) { |
| 221 |
o2.cancel(), a2.value = null; |
| 222 |
}), t(a2, (e3, t2) => { |
| 223 |
e3 && e3 !== t2 ? n2(e3) : M.hide(); |
| 224 |
}); |
| 225 |
} |
| 226 |
var P = new MutationObserver(function(e2) { |
| 227 |
e2.forEach(function(e3) { |
| 228 |
e3.type === `childList` && e3.addedNodes.length > 0 && e3.addedNodes.forEach((e4) => { |
| 229 |
let t2 = e4.querySelector(`.class-name`).dataset.tributeClassName; |
| 230 |
e4.addEventListener(`mouseenter`, (e5) => { |
| 231 |
I(t2); |
| 232 |
}), e4.addEventListener(`mouseleave`, (e5) => { |
| 233 |
L(); |
| 234 |
}), e4.addEventListener(`click`, (e5) => { |
| 235 |
L(); |
| 236 |
}); |
| 237 |
}); |
| 238 |
}); |
| 239 |
}), F = null; |
| 240 |
b.addEventListener(`tribute-active-true`, function(e2) { |
| 241 |
F === null && (F = document.querySelector(`.windpressbricks-tribute-container>ul`)), n(() => { |
| 242 |
F && P.observe(F, { |
| 243 |
childList: true, |
| 244 |
subtree: true, |
| 245 |
attributes: true, |
| 246 |
attributeFilter: [ |
| 247 |
`class` |
| 248 |
] |
| 249 |
}); |
| 250 |
}); |
| 251 |
}), S.addEventListener(`click`, async function(e2) { |
| 252 |
b.value = await _.contentWindow.windpress.module.classSorter.sort(b.value); |
| 253 |
let t2 = new Event(`input`, { |
| 254 |
bubbles: true |
| 255 |
}); |
| 256 |
b.dispatchEvent(t2), j(); |
| 257 |
}), C.addEventListener(`click`, async function(e2) { |
| 258 |
let t2 = g.$_activeElement.value, n2 = b.value.split(` `); |
| 259 |
(t2.settings?._cssGlobalClasses ? [ |
| 260 |
...t2.settings._cssGlobalClasses |
| 261 |
] : []).forEach((e3) => { |
| 262 |
let t3 = g.$_getGlobalClassName(e3); |
| 263 |
n2.includes(t3) || n2.push(t3); |
| 264 |
}), b.value = n2.join(` `); |
| 265 |
let r2 = new Event(`input`, { |
| 266 |
bubbles: true |
| 267 |
}); |
| 268 |
b.dispatchEvent(r2), t2.settings._cssGlobalClasses = [], j(); |
| 269 |
}); |
| 270 |
function I(e2) { |
| 271 |
h.$_getElementNode(h.$_activeElement.value).classList.add(e2); |
| 272 |
} |
| 273 |
function L() { |
| 274 |
let e2 = h.$_activeElement.value, t2 = h.$_getElementNode(e2), n2 = h.$_getElementClasses(e2); |
| 275 |
t2.classList.value = n2.join(` `); |
| 276 |
} |
| 277 |
function R() { |
| 278 |
let e2 = k.menu.querySelector(`li.highlight>span.class-name`), t2 = h.$_activeElement.value, n2 = h.$_getElementNode(t2), r2 = h.$_getElementClasses(t2); |
| 279 |
n2.classList.value = r2.join(` `) + ` ` + e2.dataset.tributeClassName; |
| 280 |
} |
| 281 |
function z() { |
| 282 |
let e2 = g.$_state.templateType; |
| 283 |
return [ |
| 284 |
`header`, |
| 285 |
`footer` |
| 286 |
].includes(e2) ? e2 : `content`; |
| 287 |
} |
| 288 |
o(`Module loaded!`, { |
| 289 |
module: `plain-classes` |
| 290 |
}); |
| 291 |
})(); |
| 292 |
|