@depict-ai/utilishared 2.4.5 → 2.4.7
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/ES10/index.cjs +28 -32
- package/ES10/index.d.ts +6 -1
- package/ES10/index.js +28 -32
- package/latest/index.cjs +24 -24
- package/latest/index.d.ts +6 -1
- package/latest/index.js +24 -24
- package/package.json +2 -2
- package/server/ES10/index.cjs +28 -32
- package/server/ES10/index.d.ts +6 -1
- package/server/ES10/index.js +28 -32
- package/server/latest/index.cjs +24 -24
- package/server/latest/index.d.ts +6 -1
- package/server/latest/index.js +24 -24
package/latest/index.js
CHANGED
|
@@ -5,7 +5,7 @@ register_es_version("utilishared", "latest");
|
|
|
5
5
|
function $parcel$interopDefault(a) {
|
|
6
6
|
return a && a.__esModule ? a.default : a;
|
|
7
7
|
}
|
|
8
|
-
const $0766c85d387a9765$export$83d89fbfd8236492 = "2.4.
|
|
8
|
+
const $0766c85d387a9765$export$83d89fbfd8236492 = "2.4.7";
|
|
9
9
|
const $571bce04eb920cd8$export$55fe61489d2c7417 = /*@__PURE__*/(() => process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
|
|
10
10
|
const $649f456f663da9fc$var$browser_prefix_styling = "color: #fff;";
|
|
11
11
|
let $649f456f663da9fc$var$browser_prefix = "[Depict]";
|
|
@@ -2151,12 +2151,12 @@ var $ef9394fafebd5eab$var$_tmpl$ = /*#__PURE__*/$qgKv4$template(`<div class="dep
|
|
|
2151
2151
|
class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
2152
2152
|
// this is just here because it's often needed together with the slider
|
|
2153
2153
|
container = $qgKv4$getNextElement($ef9394fafebd5eab$var$_tmpl$);
|
|
2154
|
-
|
|
2154
|
+
elements_ = {
|
|
2155
2155
|
sliding_el_: $qgKv4$getNextElement($ef9394fafebd5eab$var$_tmpl$2),
|
|
2156
2156
|
left_: $qgKv4$getNextElement($ef9394fafebd5eab$var$_tmpl$3),
|
|
2157
2157
|
right_: $qgKv4$getNextElement($ef9394fafebd5eab$var$_tmpl$4)
|
|
2158
2158
|
};
|
|
2159
|
-
insert_here = this
|
|
2159
|
+
insert_here = this.elements_.sliding_el_;
|
|
2160
2160
|
intersecting_items_object = {};
|
|
2161
2161
|
#mutation_plugins = [];
|
|
2162
2162
|
stepstoslide = 2;
|
|
@@ -2177,7 +2177,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2177
2177
|
} = this;
|
|
2178
2178
|
const {
|
|
2179
2179
|
sliding_el_: sliding_el_
|
|
2180
|
-
} = this
|
|
2180
|
+
} = this.elements_;
|
|
2181
2181
|
for (const record of records) {
|
|
2182
2182
|
for (const node of record.addedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.observe(node);
|
|
2183
2183
|
for (const node of record.removedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.unobserve(node);
|
|
@@ -2200,7 +2200,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2200
2200
|
for (let i = 0; i < mutation_plugins.length; i++) $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(mutation_plugins[i]).call(this, entries, intersecting_items);
|
|
2201
2201
|
}
|
|
2202
2202
|
observer = new IntersectionObserver(this.#observer_callback.bind(this), {
|
|
2203
|
-
root: this
|
|
2203
|
+
root: this.elements_.sliding_el_,
|
|
2204
2204
|
threshold: $9ab9ecb74920f343$export$f8ea2e7b15b5d129(100)
|
|
2205
2205
|
});
|
|
2206
2206
|
observe = this.observer.observe.bind(this.observer);
|
|
@@ -2220,7 +2220,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2220
2220
|
}
|
|
2221
2221
|
#hide_buttons_if_needed() {
|
|
2222
2222
|
// it should be correct that this routine is using sliding_el because for the buttons the position of the first and last element to the main container is relevant
|
|
2223
|
-
const cont = this
|
|
2223
|
+
const cont = this.elements_.sliding_el_,
|
|
2224
2224
|
lastel = this.index_of_last_element,
|
|
2225
2225
|
cont_rect = cont.getBoundingClientRect(),
|
|
2226
2226
|
is = this.intersecting_items_object;
|
|
@@ -2234,12 +2234,12 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2234
2234
|
// slider is empty
|
|
2235
2235
|
dist_to_left = 0;
|
|
2236
2236
|
}
|
|
2237
|
-
if (dist_to_left >= -this.dist_to_hide_left) this.#visibility(this
|
|
2238
|
-
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this
|
|
2237
|
+
if (dist_to_left >= -this.dist_to_hide_left) this.#visibility(this.elements_.left_, 0);else this.#visibility(this.elements_.left_, 1);
|
|
2238
|
+
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this.elements_.sliding_el_).getBoundingClientRect().right);
|
|
2239
2239
|
const rightmost_edge_of_container = cont_rect.right,
|
|
2240
2240
|
dist_to_right = rightmost_edge_of_last_card - rightmost_edge_of_container;
|
|
2241
2241
|
// dlog("dist to right", dist_to_right, "dist to left", dist_to_left);
|
|
2242
|
-
if (dist_to_right <= this.dist_to_hide_right) this.#visibility(this
|
|
2242
|
+
if (dist_to_right <= this.dist_to_hide_right) this.#visibility(this.elements_.right_, 0);else this.#visibility(this.elements_.right_, 1);
|
|
2243
2243
|
}
|
|
2244
2244
|
first_intersecting_index(min_ratio = 0.5) {
|
|
2245
2245
|
return parseInt(Object.keys(this.intersecting_items_object).find(i => this.intersecting_items_object[i].intersectionRatio > min_ratio) || "");
|
|
@@ -2250,7 +2250,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2250
2250
|
get index_of_last_element() {
|
|
2251
2251
|
return this.#index_cache.last_el_ ??= (this.first_intersecting?.target?.parentElement?.children?.length ??
|
|
2252
2252
|
// this is for plantagen which has a double whammy slider
|
|
2253
|
-
this
|
|
2253
|
+
this.elements_?.sliding_el_?.children?.length) - 1;
|
|
2254
2254
|
}
|
|
2255
2255
|
get currently_selected() {
|
|
2256
2256
|
// this tries to be what distance_to assumes is the current card when converting a relative offset into an absolute one, available for plugins
|
|
@@ -2260,7 +2260,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2260
2260
|
visible_sizes: visible_sizes
|
|
2261
2261
|
} = this;
|
|
2262
2262
|
let left_offset = 0;
|
|
2263
|
-
const rectangle_of_container = this
|
|
2263
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2264
2264
|
const middle_of_container = rectangle_of_container.width / 2;
|
|
2265
2265
|
for (const [element, info] of visible_sizes) {
|
|
2266
2266
|
left_offset += info.total_visible;
|
|
@@ -2322,13 +2322,13 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
}
|
|
2324
2324
|
} else {
|
|
2325
|
-
$649f456f663da9fc$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this
|
|
2325
|
+
$649f456f663da9fc$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this.elements_.sliding_el_);
|
|
2326
2326
|
return 0;
|
|
2327
2327
|
}
|
|
2328
2328
|
}
|
|
2329
2329
|
const rectangle_of_target = target_element.getBoundingClientRect();
|
|
2330
2330
|
const distance_of_li = rectangle_of_target.left + target % 1 * rectangle_of_target.width;
|
|
2331
|
-
const rectangle_of_container = this
|
|
2331
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2332
2332
|
const distance_of_container = rectangle_of_container.left;
|
|
2333
2333
|
dist = distance_of_li - distance_of_container;
|
|
2334
2334
|
if (this.center_target) try {
|
|
@@ -2357,7 +2357,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2357
2357
|
const visible_sizes = new Map();
|
|
2358
2358
|
const visible_cards = Object.keys(this.intersecting_items_object).map(key => +key);
|
|
2359
2359
|
const to_calculate = [visible_cards[0] - 1, ...visible_cards, visible_cards[visible_cards.length - 1] + 1].map(index => this.element_by_index(+index)).filter(e => e);
|
|
2360
|
-
const root_el = this
|
|
2360
|
+
const root_el = this.elements_.sliding_el_;
|
|
2361
2361
|
const root = root_el.getBoundingClientRect();
|
|
2362
2362
|
const root_computed_style = getComputedStyle(root_el);
|
|
2363
2363
|
const root_left = root.left - parseInt(root_computed_style.marginLeft);
|
|
@@ -2425,7 +2425,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2425
2425
|
if (from_cache) return from_cache;
|
|
2426
2426
|
const {
|
|
2427
2427
|
sliding_el_: sliding_el_
|
|
2428
|
-
} = this
|
|
2428
|
+
} = this.elements_;
|
|
2429
2429
|
let maybe_el = [...(sliding_el_?.children || [])]?.[index];
|
|
2430
2430
|
if (!maybe_el)
|
|
2431
2431
|
// this is for plantagen which has a double whammy slider
|
|
@@ -2443,7 +2443,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2443
2443
|
const {
|
|
2444
2444
|
right_: right_,
|
|
2445
2445
|
left_: left_
|
|
2446
|
-
} = this
|
|
2446
|
+
} = this.elements_;
|
|
2447
2447
|
left_.addEventListener("click", goleft);
|
|
2448
2448
|
right_.addEventListener("click", goright);
|
|
2449
2449
|
[left_, right_].forEach(button => {
|
|
@@ -2451,7 +2451,7 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2451
2451
|
});
|
|
2452
2452
|
}
|
|
2453
2453
|
#create_element_structure(autoinvalidate = true) {
|
|
2454
|
-
const es = this
|
|
2454
|
+
const es = this.elements_;
|
|
2455
2455
|
this.#setup_buttons();
|
|
2456
2456
|
this.container.append(es.left_, es.right_);
|
|
2457
2457
|
this.container.append(es.sliding_el_);
|
|
@@ -2485,12 +2485,12 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2485
2485
|
#scroll_to(offset, is_absolute = false, fallback_scroll_distance = 500, harsh = false) {
|
|
2486
2486
|
const left = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.#distance_to).call(this, offset, is_absolute);
|
|
2487
2487
|
const distance_after_fallback_applied = Math.round(left ?? fallback_scroll_distance);
|
|
2488
|
-
if (getComputedStyle(this
|
|
2488
|
+
if (getComputedStyle(this.elements_.sliding_el_).scrollSnapType !== "none" && Math.abs(distance_after_fallback_applied) < 10) {
|
|
2489
2489
|
$649f456f663da9fc$export$de56f1198d121036("Not scrolling because snapping is enabled and distance not over threshold", distance_after_fallback_applied);
|
|
2490
2490
|
return;
|
|
2491
2491
|
}
|
|
2492
2492
|
$649f456f663da9fc$export$de56f1198d121036("Trying to scroll by", left, "px", "before fallback,", distance_after_fallback_applied, "after");
|
|
2493
|
-
this
|
|
2493
|
+
this.elements_.sliding_el_.scrollBy({
|
|
2494
2494
|
left: distance_after_fallback_applied,
|
|
2495
2495
|
top: 0,
|
|
2496
2496
|
behavior: harsh ? "auto" : "smooth"
|
|
@@ -2521,14 +2521,14 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
|
|
|
2521
2521
|
mutation_plugins && (this.#mutation_plugins = mutation_plugins);
|
|
2522
2522
|
correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
|
|
2523
2523
|
if (button_elems) {
|
|
2524
|
-
this
|
|
2525
|
-
this
|
|
2524
|
+
this.elements_.right_ = button_elems.right;
|
|
2525
|
+
this.elements_.left_ = button_elems.left;
|
|
2526
2526
|
}
|
|
2527
|
-
if (button_contents?.right) this
|
|
2528
|
-
if (button_contents?.left) this
|
|
2527
|
+
if (button_contents?.right) this.elements_.right_.append(...button_contents.right);
|
|
2528
|
+
if (button_contents?.left) this.elements_.left_.append(...button_contents.left);
|
|
2529
2529
|
$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.#create_element_structure).call(this, autoinvalidate_cache);
|
|
2530
2530
|
// @ts-ignore
|
|
2531
|
-
this
|
|
2531
|
+
this.elements_.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
|
|
2532
2532
|
// plugin functionality i.e. for dots
|
|
2533
2533
|
const constructor_args = arguments;
|
|
2534
2534
|
constructor_plugins?.forEach?.(mplugin => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/utilishared",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "ES10/index.d.ts",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
],
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@babel/core": "latest",
|
|
142
|
-
"@depict-ai/types": "^5.4.
|
|
142
|
+
"@depict-ai/types": "^5.4.5",
|
|
143
143
|
"@parcel/resolver-default": "^2.10.3",
|
|
144
144
|
"@sentry/cli": "^2.21.2",
|
|
145
145
|
"@sentry/types": "^7.75.1",
|
package/server/ES10/index.cjs
CHANGED
|
@@ -207,7 +207,7 @@ $parcel$export(module.exports, "version", () => $ce0ab19b284b64fa$export$83d89fb
|
|
|
207
207
|
$parcel$export(module.exports, "add_to_version_info", () => $045fb30107c9eecc$export$2cefb7e61fcbae00);
|
|
208
208
|
$parcel$export(module.exports, "sync_el_content_with_accessor", () => $84d13ab567309a50$export$c3f56a35e076f139);
|
|
209
209
|
$parcel$export(module.exports, "use_href_accessor", () => $59b7011b96010a8e$export$e35115e6d0715f77);
|
|
210
|
-
const $ce0ab19b284b64fa$export$83d89fbfd8236492 = "2.4.
|
|
210
|
+
const $ce0ab19b284b64fa$export$83d89fbfd8236492 = "2.4.7";
|
|
211
211
|
const $9e9538f4aff6f83c$export$55fe61489d2c7417 = /*@__PURE__*/((_globalThis$document, _globalThis$document$, _globalThis$document$2, _globalThis$localStor, _globalThis$localStor2) => process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : (_globalThis$document$ = _globalThis$document.currentScript) === null || _globalThis$document$ === void 0 ? void 0 : (_globalThis$document$2 = _globalThis$document$.dataset) === null || _globalThis$document$2 === void 0 ? void 0 : _globalThis$document$2.debug) === "true" || (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$localStor = globalThis.localStorage) === null || _globalThis$localStor === void 0 ? void 0 : (_globalThis$localStor2 = _globalThis$localStor.getItem) === null || _globalThis$localStor2 === void 0 ? void 0 : _globalThis$localStor2.call(_globalThis$localStor, "debug")) === "true"))();
|
|
212
212
|
const $7f95f77417d06249$var$browser_prefix_styling = "color: #fff;";
|
|
213
213
|
let $7f95f77417d06249$var$browser_prefix = "[Depict]";
|
|
@@ -2687,7 +2687,6 @@ function $08a94efe56c2b35f$var$_classPrivateMethodGet(receiver, privateSet, fn)
|
|
|
2687
2687
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
2688
2688
|
return fn;
|
|
2689
2689
|
}
|
|
2690
|
-
var $08a94efe56c2b35f$var$_elements = /*#__PURE__*/new WeakMap();
|
|
2691
2690
|
var $08a94efe56c2b35f$var$_mutation_plugins = /*#__PURE__*/new WeakMap();
|
|
2692
2691
|
var $08a94efe56c2b35f$var$_index_cache = /*#__PURE__*/new WeakMap();
|
|
2693
2692
|
var $08a94efe56c2b35f$var$_cached_visible_sizes = /*#__PURE__*/new WeakMap();
|
|
@@ -2725,8 +2724,8 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2725
2724
|
return this.intersecting_items_object[this.first_intersecting_index()];
|
|
2726
2725
|
}
|
|
2727
2726
|
get index_of_last_element() {
|
|
2728
|
-
var _classPrivateFieldGet2, _classPrivateFieldGet3, _this$first_intersect, _this$first_intersect2, _this$first_intersect3, _this$first_intersect4, _this$first_intersect5,
|
|
2729
|
-
return (_classPrivateFieldGet3 = (_classPrivateFieldGet2 = $parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldGet)(this, $08a94efe56c2b35f$var$_index_cache)).last_el_) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _classPrivateFieldGet2.last_el_ = ((_this$first_intersect = (_this$first_intersect2 = this.first_intersecting) === null || _this$first_intersect2 === void 0 ? void 0 : (_this$first_intersect3 = _this$first_intersect2.target) === null || _this$first_intersect3 === void 0 ? void 0 : (_this$first_intersect4 = _this$first_intersect3.parentElement) === null || _this$first_intersect4 === void 0 ? void 0 : (_this$first_intersect5 = _this$first_intersect4.children) === null || _this$first_intersect5 === void 0 ? void 0 : _this$first_intersect5.length) !== null && _this$first_intersect !== void 0 ? _this$first_intersect : (
|
|
2727
|
+
var _classPrivateFieldGet2, _classPrivateFieldGet3, _this$first_intersect, _this$first_intersect2, _this$first_intersect3, _this$first_intersect4, _this$first_intersect5, _this$elements_, _this$elements_$slidi, _this$elements_$slidi2;
|
|
2728
|
+
return (_classPrivateFieldGet3 = (_classPrivateFieldGet2 = $parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldGet)(this, $08a94efe56c2b35f$var$_index_cache)).last_el_) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _classPrivateFieldGet2.last_el_ = ((_this$first_intersect = (_this$first_intersect2 = this.first_intersecting) === null || _this$first_intersect2 === void 0 ? void 0 : (_this$first_intersect3 = _this$first_intersect2.target) === null || _this$first_intersect3 === void 0 ? void 0 : (_this$first_intersect4 = _this$first_intersect3.parentElement) === null || _this$first_intersect4 === void 0 ? void 0 : (_this$first_intersect5 = _this$first_intersect4.children) === null || _this$first_intersect5 === void 0 ? void 0 : _this$first_intersect5.length) !== null && _this$first_intersect !== void 0 ? _this$first_intersect : (_this$elements_ = this.elements_) === null || _this$elements_ === void 0 ? void 0 : (_this$elements_$slidi = _this$elements_.sliding_el_) === null || _this$elements_$slidi === void 0 ? void 0 : (_this$elements_$slidi2 = _this$elements_$slidi.children) === null || _this$elements_$slidi2 === void 0 ? void 0 : _this$elements_$slidi2.length) - 1;
|
|
2730
2729
|
}
|
|
2731
2730
|
get currently_selected() {
|
|
2732
2731
|
// this tries to be what distance_to assumes is the current card when converting a relative offset into an absolute one, available for plugins
|
|
@@ -2736,7 +2735,7 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2736
2735
|
visible_sizes: visible_sizes
|
|
2737
2736
|
} = this;
|
|
2738
2737
|
let left_offset = 0;
|
|
2739
|
-
const rectangle_of_container =
|
|
2738
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2740
2739
|
const middle_of_container = rectangle_of_container.width / 2;
|
|
2741
2740
|
for (const [element, info] of visible_sizes) {
|
|
2742
2741
|
left_offset += info.total_visible;
|
|
@@ -2751,7 +2750,7 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2751
2750
|
const visible_sizes = new Map();
|
|
2752
2751
|
const visible_cards = Object.keys(this.intersecting_items_object).map(key => +key);
|
|
2753
2752
|
const to_calculate = [visible_cards[0] - 1, ...visible_cards, visible_cards[visible_cards.length - 1] + 1].map(index => this.element_by_index(+index)).filter(e => e);
|
|
2754
|
-
const root_el =
|
|
2753
|
+
const root_el = this.elements_.sliding_el_;
|
|
2755
2754
|
const root = root_el.getBoundingClientRect();
|
|
2756
2755
|
const root_computed_style = getComputedStyle(root_el);
|
|
2757
2756
|
const root_left = root.left - parseInt(root_computed_style.marginLeft);
|
|
@@ -2820,7 +2819,7 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2820
2819
|
if (from_cache) return from_cache;
|
|
2821
2820
|
const {
|
|
2822
2821
|
sliding_el_: sliding_el_
|
|
2823
|
-
} =
|
|
2822
|
+
} = this.elements_;
|
|
2824
2823
|
let maybe_el = (_ref = [...((sliding_el_ === null || sliding_el_ === void 0 ? void 0 : sliding_el_.children) || [])], _ref === void 0) ? void 0 : _ref[index];
|
|
2825
2824
|
if (!maybe_el) {
|
|
2826
2825
|
var _ref2, _this$first_intersect6, _this$first_intersect7, _this$first_intersect8;
|
|
@@ -2867,15 +2866,12 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2867
2866
|
$08a94efe56c2b35f$var$_classPrivateMethodInitSpec(this, $08a94efe56c2b35f$var$_observer_callback);
|
|
2868
2867
|
$08a94efe56c2b35f$var$_classPrivateMethodInitSpec(this, $08a94efe56c2b35f$var$_observe_element);
|
|
2869
2868
|
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "container", $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$, $lMD39$solidjsweb.ssrHydrationKey()));
|
|
2870
|
-
$
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
left_: $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$3, $lMD39$solidjsweb.ssrHydrationKey()),
|
|
2875
|
-
right_: $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$4, $lMD39$solidjsweb.ssrHydrationKey())
|
|
2876
|
-
}
|
|
2869
|
+
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "elements_", {
|
|
2870
|
+
sliding_el_: $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$2, $lMD39$solidjsweb.ssrHydrationKey()),
|
|
2871
|
+
left_: $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$3, $lMD39$solidjsweb.ssrHydrationKey()),
|
|
2872
|
+
right_: $lMD39$solidjsweb.ssr($08a94efe56c2b35f$var$_tmpl$4, $lMD39$solidjsweb.ssrHydrationKey())
|
|
2877
2873
|
});
|
|
2878
|
-
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "insert_here",
|
|
2874
|
+
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "insert_here", this.elements_.sliding_el_);
|
|
2879
2875
|
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "intersecting_items_object", {});
|
|
2880
2876
|
$08a94efe56c2b35f$var$_classPrivateFieldInitSpec(this, $08a94efe56c2b35f$var$_mutation_plugins, {
|
|
2881
2877
|
writable: true,
|
|
@@ -2901,7 +2897,7 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2901
2897
|
value: void 0
|
|
2902
2898
|
});
|
|
2903
2899
|
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "observer", new IntersectionObserver($08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_observer_callback, $08a94efe56c2b35f$var$_observer_callback2).bind(this), {
|
|
2904
|
-
root:
|
|
2900
|
+
root: this.elements_.sliding_el_,
|
|
2905
2901
|
threshold: $4e1f5263dceb9802$export$f8ea2e7b15b5d129(100)
|
|
2906
2902
|
}));
|
|
2907
2903
|
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "observe", this.observer.observe.bind(this.observer));
|
|
@@ -2912,14 +2908,14 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2912
2908
|
_mutation_plugins2 && $parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldSet)(this, $08a94efe56c2b35f$var$_mutation_plugins, _mutation_plugins2);
|
|
2913
2909
|
correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
|
|
2914
2910
|
if (button_elems) {
|
|
2915
|
-
|
|
2916
|
-
|
|
2911
|
+
this.elements_.right_ = button_elems.right;
|
|
2912
|
+
this.elements_.left_ = button_elems.left;
|
|
2917
2913
|
}
|
|
2918
|
-
if (button_contents !== null && button_contents !== void 0 && button_contents.right)
|
|
2919
|
-
if (button_contents !== null && button_contents !== void 0 && button_contents.left)
|
|
2914
|
+
if (button_contents !== null && button_contents !== void 0 && button_contents.right) this.elements_.right_.append(...button_contents.right);
|
|
2915
|
+
if (button_contents !== null && button_contents !== void 0 && button_contents.left) this.elements_.left_.append(...button_contents.left);
|
|
2920
2916
|
$3b52ccc10510b32a$export$b3bbfd758f11cfa9($08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_create_element_structure, $08a94efe56c2b35f$var$_create_element_structure2)).call(this, autoinvalidate_cache);
|
|
2921
2917
|
// @ts-ignore
|
|
2922
|
-
|
|
2918
|
+
this.elements_.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
|
|
2923
2919
|
// plugin functionality i.e. for dots
|
|
2924
2920
|
const constructor_args = arguments;
|
|
2925
2921
|
constructor_plugins === null || constructor_plugins === void 0 || (_constructor_plugins$ = constructor_plugins.forEach) === null || _constructor_plugins$ === void 0 || _constructor_plugins$.call(constructor_plugins, mplugin => {
|
|
@@ -2933,7 +2929,7 @@ function $08a94efe56c2b35f$var$_observe_element2(records) {
|
|
|
2933
2929
|
} = this;
|
|
2934
2930
|
const {
|
|
2935
2931
|
sliding_el_: sliding_el_
|
|
2936
|
-
} =
|
|
2932
|
+
} = this.elements_;
|
|
2937
2933
|
for (const record of records) {
|
|
2938
2934
|
for (const node of record.addedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.observe(node);
|
|
2939
2935
|
for (const node of record.removedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.unobserve(node);
|
|
@@ -2958,7 +2954,7 @@ function $08a94efe56c2b35f$var$_observer_callback2(entries) {
|
|
|
2958
2954
|
function $08a94efe56c2b35f$var$_hide_buttons_if_needed2() {
|
|
2959
2955
|
var _is$;
|
|
2960
2956
|
// it should be correct that this routine is using sliding_el because for the buttons the position of the first and last element to the main container is relevant
|
|
2961
|
-
const cont =
|
|
2957
|
+
const cont = this.elements_.sliding_el_,
|
|
2962
2958
|
lastel = this.index_of_last_element,
|
|
2963
2959
|
cont_rect = cont.getBoundingClientRect(),
|
|
2964
2960
|
is = this.intersecting_items_object;
|
|
@@ -2972,12 +2968,12 @@ function $08a94efe56c2b35f$var$_hide_buttons_if_needed2() {
|
|
|
2972
2968
|
// slider is empty
|
|
2973
2969
|
dist_to_left = 0;
|
|
2974
2970
|
}
|
|
2975
|
-
if (dist_to_left >= -this.dist_to_hide_left) $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this,
|
|
2976
|
-
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) ||
|
|
2971
|
+
if (dist_to_left >= -this.dist_to_hide_left) $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this, this.elements_.left_, 0);else $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this, this.elements_.left_, 1);
|
|
2972
|
+
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this.elements_.sliding_el_).getBoundingClientRect().right);
|
|
2977
2973
|
const rightmost_edge_of_container = cont_rect.right,
|
|
2978
2974
|
dist_to_right = rightmost_edge_of_last_card - rightmost_edge_of_container;
|
|
2979
2975
|
// dlog("dist to right", dist_to_right, "dist to left", dist_to_left);
|
|
2980
|
-
if (dist_to_right <= this.dist_to_hide_right) $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this,
|
|
2976
|
+
if (dist_to_right <= this.dist_to_hide_right) $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this, this.elements_.right_, 0);else $08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_visibility, $08a94efe56c2b35f$var$_visibility2).call(this, this.elements_.right_, 1);
|
|
2981
2977
|
}
|
|
2982
2978
|
function $08a94efe56c2b35f$var$_distance_to2(offset) {
|
|
2983
2979
|
let is_absolute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -3032,13 +3028,13 @@ function $08a94efe56c2b35f$var$_distance_to2(offset) {
|
|
|
3032
3028
|
}
|
|
3033
3029
|
}
|
|
3034
3030
|
} else {
|
|
3035
|
-
$7f95f77417d06249$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of",
|
|
3031
|
+
$7f95f77417d06249$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this.elements_.sliding_el_);
|
|
3036
3032
|
return 0;
|
|
3037
3033
|
}
|
|
3038
3034
|
}
|
|
3039
3035
|
const rectangle_of_target = target_element.getBoundingClientRect();
|
|
3040
3036
|
const distance_of_li = rectangle_of_target.left + target % 1 * rectangle_of_target.width;
|
|
3041
|
-
const rectangle_of_container =
|
|
3037
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
3042
3038
|
const distance_of_container = rectangle_of_container.left;
|
|
3043
3039
|
dist = distance_of_li - distance_of_container;
|
|
3044
3040
|
if (this.center_target) try {
|
|
@@ -3072,7 +3068,7 @@ function $08a94efe56c2b35f$var$_setup_buttons2() {
|
|
|
3072
3068
|
const {
|
|
3073
3069
|
right_: right_,
|
|
3074
3070
|
left_: left_
|
|
3075
|
-
} =
|
|
3071
|
+
} = this.elements_;
|
|
3076
3072
|
left_.addEventListener("click", goleft);
|
|
3077
3073
|
right_.addEventListener("click", goright);
|
|
3078
3074
|
[left_, right_].forEach(button => {
|
|
@@ -3081,7 +3077,7 @@ function $08a94efe56c2b35f$var$_setup_buttons2() {
|
|
|
3081
3077
|
}
|
|
3082
3078
|
function $08a94efe56c2b35f$var$_create_element_structure2() {
|
|
3083
3079
|
let autoinvalidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
3084
|
-
const es =
|
|
3080
|
+
const es = this.elements_;
|
|
3085
3081
|
$08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_setup_buttons, $08a94efe56c2b35f$var$_setup_buttons2).call(this);
|
|
3086
3082
|
this.container.append(es.left_, es.right_);
|
|
3087
3083
|
this.container.append(es.sliding_el_);
|
|
@@ -3113,12 +3109,12 @@ function $08a94efe56c2b35f$var$_scroll_to2(offset) {
|
|
|
3113
3109
|
let harsh = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
3114
3110
|
const left = $3b52ccc10510b32a$export$b3bbfd758f11cfa9($08a94efe56c2b35f$var$_classPrivateMethodGet(this, $08a94efe56c2b35f$var$_distance_to, $08a94efe56c2b35f$var$_distance_to2)).call(this, offset, is_absolute);
|
|
3115
3111
|
const distance_after_fallback_applied = Math.round(left !== null && left !== void 0 ? left : fallback_scroll_distance);
|
|
3116
|
-
if (getComputedStyle(
|
|
3112
|
+
if (getComputedStyle(this.elements_.sliding_el_).scrollSnapType !== "none" && Math.abs(distance_after_fallback_applied) < 10) {
|
|
3117
3113
|
$7f95f77417d06249$export$de56f1198d121036("Not scrolling because snapping is enabled and distance not over threshold", distance_after_fallback_applied);
|
|
3118
3114
|
return;
|
|
3119
3115
|
}
|
|
3120
3116
|
$7f95f77417d06249$export$de56f1198d121036("Trying to scroll by", left, "px", "before fallback,", distance_after_fallback_applied, "after");
|
|
3121
|
-
|
|
3117
|
+
this.elements_.sliding_el_.scrollBy({
|
|
3122
3118
|
left: distance_after_fallback_applied,
|
|
3123
3119
|
top: 0,
|
|
3124
3120
|
behavior: harsh ? "auto" : "smooth"
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX, Accessor } from "solid-js";
|
|
2
|
-
export const version = "2.4.
|
|
2
|
+
export const version = "2.4.7";
|
|
3
3
|
export const is_debug: boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Sets the prefix of dlog, dwarn, and derror messages in the browser console. Defaults to `[Depict]`.
|
|
@@ -639,6 +639,11 @@ export interface Slider_Options {
|
|
|
639
639
|
export class Amazing_Slider {
|
|
640
640
|
#private;
|
|
641
641
|
container: HTMLDivElement;
|
|
642
|
+
elements_: {
|
|
643
|
+
sliding_el_: HTMLDivElement;
|
|
644
|
+
left_: HTMLElement;
|
|
645
|
+
right_: HTMLElement;
|
|
646
|
+
};
|
|
642
647
|
insert_here: HTMLDivElement;
|
|
643
648
|
intersecting_items_object: {
|
|
644
649
|
[key: string]: IntersectionObserverEntry;
|
package/server/ES10/index.js
CHANGED
|
@@ -8,7 +8,7 @@ register_es_version("utilishared", "ES10");
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
9
9
|
return a && a.__esModule ? a.default : a;
|
|
10
10
|
}
|
|
11
|
-
const $b9e07ce3c67aa344$export$83d89fbfd8236492 = "2.4.
|
|
11
|
+
const $b9e07ce3c67aa344$export$83d89fbfd8236492 = "2.4.7";
|
|
12
12
|
const $a5a2bdb4ae93374b$export$55fe61489d2c7417 = /*@__PURE__*/((_globalThis$document, _globalThis$document$, _globalThis$document$2, _globalThis$localStor, _globalThis$localStor2) => process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : (_globalThis$document$ = _globalThis$document.currentScript) === null || _globalThis$document$ === void 0 ? void 0 : (_globalThis$document$2 = _globalThis$document$.dataset) === null || _globalThis$document$2 === void 0 ? void 0 : _globalThis$document$2.debug) === "true" || (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$localStor = globalThis.localStorage) === null || _globalThis$localStor === void 0 ? void 0 : (_globalThis$localStor2 = _globalThis$localStor.getItem) === null || _globalThis$localStor2 === void 0 ? void 0 : _globalThis$localStor2.call(_globalThis$localStor, "debug")) === "true"))();
|
|
13
13
|
const $241f2f02cc612a49$var$browser_prefix_styling = "color: #fff;";
|
|
14
14
|
let $241f2f02cc612a49$var$browser_prefix = "[Depict]";
|
|
@@ -2488,7 +2488,6 @@ function $be288a83d9eabf2a$var$_classPrivateMethodGet(receiver, privateSet, fn)
|
|
|
2488
2488
|
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
2489
2489
|
return fn;
|
|
2490
2490
|
}
|
|
2491
|
-
var $be288a83d9eabf2a$var$_elements = /*#__PURE__*/new WeakMap();
|
|
2492
2491
|
var $be288a83d9eabf2a$var$_mutation_plugins = /*#__PURE__*/new WeakMap();
|
|
2493
2492
|
var $be288a83d9eabf2a$var$_index_cache = /*#__PURE__*/new WeakMap();
|
|
2494
2493
|
var $be288a83d9eabf2a$var$_cached_visible_sizes = /*#__PURE__*/new WeakMap();
|
|
@@ -2526,8 +2525,8 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2526
2525
|
return this.intersecting_items_object[this.first_intersecting_index()];
|
|
2527
2526
|
}
|
|
2528
2527
|
get index_of_last_element() {
|
|
2529
|
-
var _classPrivateFieldGet2, _classPrivateFieldGet3, _this$first_intersect, _this$first_intersect2, _this$first_intersect3, _this$first_intersect4, _this$first_intersect5,
|
|
2530
|
-
return (_classPrivateFieldGet3 = (_classPrivateFieldGet2 = $hrhbO$babelruntimehelpersclassPrivateFieldGet(this, $be288a83d9eabf2a$var$_index_cache)).last_el_) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _classPrivateFieldGet2.last_el_ = ((_this$first_intersect = (_this$first_intersect2 = this.first_intersecting) === null || _this$first_intersect2 === void 0 ? void 0 : (_this$first_intersect3 = _this$first_intersect2.target) === null || _this$first_intersect3 === void 0 ? void 0 : (_this$first_intersect4 = _this$first_intersect3.parentElement) === null || _this$first_intersect4 === void 0 ? void 0 : (_this$first_intersect5 = _this$first_intersect4.children) === null || _this$first_intersect5 === void 0 ? void 0 : _this$first_intersect5.length) !== null && _this$first_intersect !== void 0 ? _this$first_intersect : (
|
|
2528
|
+
var _classPrivateFieldGet2, _classPrivateFieldGet3, _this$first_intersect, _this$first_intersect2, _this$first_intersect3, _this$first_intersect4, _this$first_intersect5, _this$elements_, _this$elements_$slidi, _this$elements_$slidi2;
|
|
2529
|
+
return (_classPrivateFieldGet3 = (_classPrivateFieldGet2 = $hrhbO$babelruntimehelpersclassPrivateFieldGet(this, $be288a83d9eabf2a$var$_index_cache)).last_el_) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : _classPrivateFieldGet2.last_el_ = ((_this$first_intersect = (_this$first_intersect2 = this.first_intersecting) === null || _this$first_intersect2 === void 0 ? void 0 : (_this$first_intersect3 = _this$first_intersect2.target) === null || _this$first_intersect3 === void 0 ? void 0 : (_this$first_intersect4 = _this$first_intersect3.parentElement) === null || _this$first_intersect4 === void 0 ? void 0 : (_this$first_intersect5 = _this$first_intersect4.children) === null || _this$first_intersect5 === void 0 ? void 0 : _this$first_intersect5.length) !== null && _this$first_intersect !== void 0 ? _this$first_intersect : (_this$elements_ = this.elements_) === null || _this$elements_ === void 0 ? void 0 : (_this$elements_$slidi = _this$elements_.sliding_el_) === null || _this$elements_$slidi === void 0 ? void 0 : (_this$elements_$slidi2 = _this$elements_$slidi.children) === null || _this$elements_$slidi2 === void 0 ? void 0 : _this$elements_$slidi2.length) - 1;
|
|
2531
2530
|
}
|
|
2532
2531
|
get currently_selected() {
|
|
2533
2532
|
// this tries to be what distance_to assumes is the current card when converting a relative offset into an absolute one, available for plugins
|
|
@@ -2537,7 +2536,7 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2537
2536
|
visible_sizes: visible_sizes
|
|
2538
2537
|
} = this;
|
|
2539
2538
|
let left_offset = 0;
|
|
2540
|
-
const rectangle_of_container =
|
|
2539
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2541
2540
|
const middle_of_container = rectangle_of_container.width / 2;
|
|
2542
2541
|
for (const [element, info] of visible_sizes) {
|
|
2543
2542
|
left_offset += info.total_visible;
|
|
@@ -2552,7 +2551,7 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2552
2551
|
const visible_sizes = new Map();
|
|
2553
2552
|
const visible_cards = Object.keys(this.intersecting_items_object).map(key => +key);
|
|
2554
2553
|
const to_calculate = [visible_cards[0] - 1, ...visible_cards, visible_cards[visible_cards.length - 1] + 1].map(index => this.element_by_index(+index)).filter(e => e);
|
|
2555
|
-
const root_el =
|
|
2554
|
+
const root_el = this.elements_.sliding_el_;
|
|
2556
2555
|
const root = root_el.getBoundingClientRect();
|
|
2557
2556
|
const root_computed_style = getComputedStyle(root_el);
|
|
2558
2557
|
const root_left = root.left - parseInt(root_computed_style.marginLeft);
|
|
@@ -2621,7 +2620,7 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2621
2620
|
if (from_cache) return from_cache;
|
|
2622
2621
|
const {
|
|
2623
2622
|
sliding_el_: sliding_el_
|
|
2624
|
-
} =
|
|
2623
|
+
} = this.elements_;
|
|
2625
2624
|
let maybe_el = (_ref = [...((sliding_el_ === null || sliding_el_ === void 0 ? void 0 : sliding_el_.children) || [])], _ref === void 0) ? void 0 : _ref[index];
|
|
2626
2625
|
if (!maybe_el) {
|
|
2627
2626
|
var _ref2, _this$first_intersect6, _this$first_intersect7, _this$first_intersect8;
|
|
@@ -2668,15 +2667,12 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2668
2667
|
$be288a83d9eabf2a$var$_classPrivateMethodInitSpec(this, $be288a83d9eabf2a$var$_observer_callback);
|
|
2669
2668
|
$be288a83d9eabf2a$var$_classPrivateMethodInitSpec(this, $be288a83d9eabf2a$var$_observe_element);
|
|
2670
2669
|
$hrhbO$babelruntimehelpersdefineProperty(this, "container", $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$, $hrhbO$ssrHydrationKey()));
|
|
2671
|
-
$
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
left_: $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$3, $hrhbO$ssrHydrationKey()),
|
|
2676
|
-
right_: $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$4, $hrhbO$ssrHydrationKey())
|
|
2677
|
-
}
|
|
2670
|
+
$hrhbO$babelruntimehelpersdefineProperty(this, "elements_", {
|
|
2671
|
+
sliding_el_: $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$2, $hrhbO$ssrHydrationKey()),
|
|
2672
|
+
left_: $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$3, $hrhbO$ssrHydrationKey()),
|
|
2673
|
+
right_: $hrhbO$ssr($be288a83d9eabf2a$var$_tmpl$4, $hrhbO$ssrHydrationKey())
|
|
2678
2674
|
});
|
|
2679
|
-
$hrhbO$babelruntimehelpersdefineProperty(this, "insert_here",
|
|
2675
|
+
$hrhbO$babelruntimehelpersdefineProperty(this, "insert_here", this.elements_.sliding_el_);
|
|
2680
2676
|
$hrhbO$babelruntimehelpersdefineProperty(this, "intersecting_items_object", {});
|
|
2681
2677
|
$be288a83d9eabf2a$var$_classPrivateFieldInitSpec(this, $be288a83d9eabf2a$var$_mutation_plugins, {
|
|
2682
2678
|
writable: true,
|
|
@@ -2702,7 +2698,7 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2702
2698
|
value: void 0
|
|
2703
2699
|
});
|
|
2704
2700
|
$hrhbO$babelruntimehelpersdefineProperty(this, "observer", new IntersectionObserver($be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_observer_callback, $be288a83d9eabf2a$var$_observer_callback2).bind(this), {
|
|
2705
|
-
root:
|
|
2701
|
+
root: this.elements_.sliding_el_,
|
|
2706
2702
|
threshold: $ab9c3dbf2bb2fbf7$export$f8ea2e7b15b5d129(100)
|
|
2707
2703
|
}));
|
|
2708
2704
|
$hrhbO$babelruntimehelpersdefineProperty(this, "observe", this.observer.observe.bind(this.observer));
|
|
@@ -2713,14 +2709,14 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2713
2709
|
_mutation_plugins2 && $hrhbO$babelruntimehelpersclassPrivateFieldSet(this, $be288a83d9eabf2a$var$_mutation_plugins, _mutation_plugins2);
|
|
2714
2710
|
correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
|
|
2715
2711
|
if (button_elems) {
|
|
2716
|
-
|
|
2717
|
-
|
|
2712
|
+
this.elements_.right_ = button_elems.right;
|
|
2713
|
+
this.elements_.left_ = button_elems.left;
|
|
2718
2714
|
}
|
|
2719
|
-
if (button_contents !== null && button_contents !== void 0 && button_contents.right)
|
|
2720
|
-
if (button_contents !== null && button_contents !== void 0 && button_contents.left)
|
|
2715
|
+
if (button_contents !== null && button_contents !== void 0 && button_contents.right) this.elements_.right_.append(...button_contents.right);
|
|
2716
|
+
if (button_contents !== null && button_contents !== void 0 && button_contents.left) this.elements_.left_.append(...button_contents.left);
|
|
2721
2717
|
$5e1f45affc1d7def$export$b3bbfd758f11cfa9($be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_create_element_structure, $be288a83d9eabf2a$var$_create_element_structure2)).call(this, autoinvalidate_cache);
|
|
2722
2718
|
// @ts-ignore
|
|
2723
|
-
|
|
2719
|
+
this.elements_.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
|
|
2724
2720
|
// plugin functionality i.e. for dots
|
|
2725
2721
|
const constructor_args = arguments;
|
|
2726
2722
|
constructor_plugins === null || constructor_plugins === void 0 || (_constructor_plugins$ = constructor_plugins.forEach) === null || _constructor_plugins$ === void 0 || _constructor_plugins$.call(constructor_plugins, mplugin => {
|
|
@@ -2734,7 +2730,7 @@ function $be288a83d9eabf2a$var$_observe_element2(records) {
|
|
|
2734
2730
|
} = this;
|
|
2735
2731
|
const {
|
|
2736
2732
|
sliding_el_: sliding_el_
|
|
2737
|
-
} =
|
|
2733
|
+
} = this.elements_;
|
|
2738
2734
|
for (const record of records) {
|
|
2739
2735
|
for (const node of record.addedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.observe(node);
|
|
2740
2736
|
for (const node of record.removedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.unobserve(node);
|
|
@@ -2759,7 +2755,7 @@ function $be288a83d9eabf2a$var$_observer_callback2(entries) {
|
|
|
2759
2755
|
function $be288a83d9eabf2a$var$_hide_buttons_if_needed2() {
|
|
2760
2756
|
var _is$;
|
|
2761
2757
|
// it should be correct that this routine is using sliding_el because for the buttons the position of the first and last element to the main container is relevant
|
|
2762
|
-
const cont =
|
|
2758
|
+
const cont = this.elements_.sliding_el_,
|
|
2763
2759
|
lastel = this.index_of_last_element,
|
|
2764
2760
|
cont_rect = cont.getBoundingClientRect(),
|
|
2765
2761
|
is = this.intersecting_items_object;
|
|
@@ -2773,12 +2769,12 @@ function $be288a83d9eabf2a$var$_hide_buttons_if_needed2() {
|
|
|
2773
2769
|
// slider is empty
|
|
2774
2770
|
dist_to_left = 0;
|
|
2775
2771
|
}
|
|
2776
|
-
if (dist_to_left >= -this.dist_to_hide_left) $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this,
|
|
2777
|
-
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) ||
|
|
2772
|
+
if (dist_to_left >= -this.dist_to_hide_left) $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this, this.elements_.left_, 0);else $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this, this.elements_.left_, 1);
|
|
2773
|
+
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this.elements_.sliding_el_).getBoundingClientRect().right);
|
|
2778
2774
|
const rightmost_edge_of_container = cont_rect.right,
|
|
2779
2775
|
dist_to_right = rightmost_edge_of_last_card - rightmost_edge_of_container;
|
|
2780
2776
|
// dlog("dist to right", dist_to_right, "dist to left", dist_to_left);
|
|
2781
|
-
if (dist_to_right <= this.dist_to_hide_right) $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this,
|
|
2777
|
+
if (dist_to_right <= this.dist_to_hide_right) $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this, this.elements_.right_, 0);else $be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_visibility, $be288a83d9eabf2a$var$_visibility2).call(this, this.elements_.right_, 1);
|
|
2782
2778
|
}
|
|
2783
2779
|
function $be288a83d9eabf2a$var$_distance_to2(offset) {
|
|
2784
2780
|
let is_absolute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -2833,13 +2829,13 @@ function $be288a83d9eabf2a$var$_distance_to2(offset) {
|
|
|
2833
2829
|
}
|
|
2834
2830
|
}
|
|
2835
2831
|
} else {
|
|
2836
|
-
$241f2f02cc612a49$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of",
|
|
2832
|
+
$241f2f02cc612a49$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this.elements_.sliding_el_);
|
|
2837
2833
|
return 0;
|
|
2838
2834
|
}
|
|
2839
2835
|
}
|
|
2840
2836
|
const rectangle_of_target = target_element.getBoundingClientRect();
|
|
2841
2837
|
const distance_of_li = rectangle_of_target.left + target % 1 * rectangle_of_target.width;
|
|
2842
|
-
const rectangle_of_container =
|
|
2838
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2843
2839
|
const distance_of_container = rectangle_of_container.left;
|
|
2844
2840
|
dist = distance_of_li - distance_of_container;
|
|
2845
2841
|
if (this.center_target) try {
|
|
@@ -2873,7 +2869,7 @@ function $be288a83d9eabf2a$var$_setup_buttons2() {
|
|
|
2873
2869
|
const {
|
|
2874
2870
|
right_: right_,
|
|
2875
2871
|
left_: left_
|
|
2876
|
-
} =
|
|
2872
|
+
} = this.elements_;
|
|
2877
2873
|
left_.addEventListener("click", goleft);
|
|
2878
2874
|
right_.addEventListener("click", goright);
|
|
2879
2875
|
[left_, right_].forEach(button => {
|
|
@@ -2882,7 +2878,7 @@ function $be288a83d9eabf2a$var$_setup_buttons2() {
|
|
|
2882
2878
|
}
|
|
2883
2879
|
function $be288a83d9eabf2a$var$_create_element_structure2() {
|
|
2884
2880
|
let autoinvalidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2885
|
-
const es =
|
|
2881
|
+
const es = this.elements_;
|
|
2886
2882
|
$be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_setup_buttons, $be288a83d9eabf2a$var$_setup_buttons2).call(this);
|
|
2887
2883
|
this.container.append(es.left_, es.right_);
|
|
2888
2884
|
this.container.append(es.sliding_el_);
|
|
@@ -2914,12 +2910,12 @@ function $be288a83d9eabf2a$var$_scroll_to2(offset) {
|
|
|
2914
2910
|
let harsh = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2915
2911
|
const left = $5e1f45affc1d7def$export$b3bbfd758f11cfa9($be288a83d9eabf2a$var$_classPrivateMethodGet(this, $be288a83d9eabf2a$var$_distance_to, $be288a83d9eabf2a$var$_distance_to2)).call(this, offset, is_absolute);
|
|
2916
2912
|
const distance_after_fallback_applied = Math.round(left !== null && left !== void 0 ? left : fallback_scroll_distance);
|
|
2917
|
-
if (getComputedStyle(
|
|
2913
|
+
if (getComputedStyle(this.elements_.sliding_el_).scrollSnapType !== "none" && Math.abs(distance_after_fallback_applied) < 10) {
|
|
2918
2914
|
$241f2f02cc612a49$export$de56f1198d121036("Not scrolling because snapping is enabled and distance not over threshold", distance_after_fallback_applied);
|
|
2919
2915
|
return;
|
|
2920
2916
|
}
|
|
2921
2917
|
$241f2f02cc612a49$export$de56f1198d121036("Trying to scroll by", left, "px", "before fallback,", distance_after_fallback_applied, "after");
|
|
2922
|
-
|
|
2918
|
+
this.elements_.sliding_el_.scrollBy({
|
|
2923
2919
|
left: distance_after_fallback_applied,
|
|
2924
2920
|
top: 0,
|
|
2925
2921
|
behavior: harsh ? "auto" : "smooth"
|