inline-style-editor 1.5.6 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inline-style-editor.css +1 -1
- package/dist/inline-style-editor.js +2 -2
- package/dist/inline-style-editor.js.map +1 -1
- package/dist/inline-style-editor.mjs +45 -2
- package/dist/inline-style-editor.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/style.scss +0 -1
- package/src/components/InlineStyleEditor.svelte +5 -3
|
@@ -3406,6 +3406,16 @@ function to_class(value, hash, directives) {
|
|
|
3406
3406
|
return classname === '' ? null : classname;
|
|
3407
3407
|
}
|
|
3408
3408
|
|
|
3409
|
+
/**
|
|
3410
|
+
* @param {any} value
|
|
3411
|
+
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
|
|
3412
|
+
* @returns {string | null}
|
|
3413
|
+
*/
|
|
3414
|
+
function to_style(value, styles) {
|
|
3415
|
+
|
|
3416
|
+
return value == null ? null : String(value);
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3409
3419
|
/**
|
|
3410
3420
|
* @param {Element} dom
|
|
3411
3421
|
* @param {boolean | number} is_html
|
|
@@ -3452,6 +3462,34 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
|
|
|
3452
3462
|
return next_classes;
|
|
3453
3463
|
}
|
|
3454
3464
|
|
|
3465
|
+
/**
|
|
3466
|
+
* @param {Element & ElementCSSInlineStyle} dom
|
|
3467
|
+
* @param {string | null} value
|
|
3468
|
+
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]
|
|
3469
|
+
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]
|
|
3470
|
+
*/
|
|
3471
|
+
function set_style(dom, value, prev_styles, next_styles) {
|
|
3472
|
+
// @ts-expect-error
|
|
3473
|
+
var prev = dom.__style;
|
|
3474
|
+
|
|
3475
|
+
if (prev !== value) {
|
|
3476
|
+
var next_style_attr = to_style(value);
|
|
3477
|
+
|
|
3478
|
+
{
|
|
3479
|
+
if (next_style_attr == null) {
|
|
3480
|
+
dom.removeAttribute('style');
|
|
3481
|
+
} else {
|
|
3482
|
+
dom.style.cssText = next_style_attr;
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
// @ts-expect-error
|
|
3487
|
+
dom.__style = value;
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3490
|
+
return next_styles;
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3455
3493
|
/**
|
|
3456
3494
|
* Selects the correct option(s) (depending on whether this is a multiple select)
|
|
3457
3495
|
* @template V
|
|
@@ -5634,7 +5672,7 @@ function deleteElem(__2, currentElement, close) {
|
|
|
5634
5672
|
|
|
5635
5673
|
var root_2 = from_html(`<span> </span>`);
|
|
5636
5674
|
var root_1 = from_html(`<div class="select-tab"><b>Element</b> <!></div>`);
|
|
5637
|
-
var on_change = (e, selectRule) => selectRule(e.target.value);
|
|
5675
|
+
var on_change = (e, selectRule) => selectRule(+e.target.value);
|
|
5638
5676
|
var root_5 = from_html(`<option> </option>`);
|
|
5639
5677
|
var root_4 = from_html(`<select></select>`);
|
|
5640
5678
|
var root_7 = from_html(`<span> </span>`);
|
|
@@ -5828,6 +5866,7 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
5828
5866
|
let allCurrentPropDefs = state(proxy({})); // propName => selectorDef
|
|
5829
5867
|
let bringableToFront = state(proxy([])); // null = not bringable, true = bringable, false = was bringed
|
|
5830
5868
|
let hasDisplayedCustom = state(false);
|
|
5869
|
+
let baseUrl = state(proxy(window.location.href.replace(/#.*$/, "")));
|
|
5831
5870
|
// Reactive derived values
|
|
5832
5871
|
const currentElement = user_derived(() => get(targetsToSearch)[get(selectedElemIndex)]?.[0]);
|
|
5833
5872
|
const currentRule = user_derived(() => get(allRules)[get(selectedElemIndex)]?.[get(selectedRuleIndex)]);
|
|
@@ -6067,6 +6106,7 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
6067
6106
|
|
|
6068
6107
|
async function open(el, x, y) {
|
|
6069
6108
|
set(clickedElement, el, true);
|
|
6109
|
+
set(baseUrl, window.location.href.replace(/#.*$/, ""), true);
|
|
6070
6110
|
udpatePageDimensions();
|
|
6071
6111
|
if (el.classList.contains("overlay-over")) return overlayClicked(); else if (get(self).contains(el)) return;
|
|
6072
6112
|
set(selectedElemIndex, 0);
|
|
@@ -6139,7 +6179,7 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
6139
6179
|
let matching;
|
|
6140
6180
|
|
|
6141
6181
|
if (get(currentRule) === "inline") matching = [get(currentElement)]; else {
|
|
6142
|
-
const selector = get(currentRule).selectorText.replace(/(:hover)|:focus/g, "");
|
|
6182
|
+
const selector = get(currentRule).selectorText.replace(/(:hover)|:focus|\.hovered/g, "");
|
|
6143
6183
|
|
|
6144
6184
|
matching = Array.from(document.querySelectorAll(selector));
|
|
6145
6185
|
}
|
|
@@ -6312,6 +6352,8 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
6312
6352
|
|
|
6313
6353
|
var clipPath = child(svg);
|
|
6314
6354
|
var path = child(clipPath);
|
|
6355
|
+
|
|
6356
|
+
var rect_1 = sibling(clipPath);
|
|
6315
6357
|
bind_this(svg, ($$value) => set(helperElemWrapper, $$value), () => get(helperElemWrapper));
|
|
6316
6358
|
|
|
6317
6359
|
var div_1 = sibling(svg, 2);
|
|
@@ -6741,6 +6783,7 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
6741
6783
|
set_attribute(svg, 'width', get(pageDimensions).width);
|
|
6742
6784
|
set_attribute(svg, 'height', get(pageDimensions).height);
|
|
6743
6785
|
set_attribute(path, 'd', get(pathWithHoles));
|
|
6786
|
+
set_style(rect_1, `clip-path: url(${get(baseUrl) ?? ''}#overlay-clip)`);
|
|
6744
6787
|
});
|
|
6745
6788
|
|
|
6746
6789
|
append($$anchor, fragment);
|