@depict-ai/utilishared 2.4.5 → 2.4.6
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 +1 -1
- 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/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.6";
|
|
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($bBfCy$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($bBfCy$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($bBfCy$babelruntimehelpersdefineProperty)(this, "container", $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$));
|
|
2870
|
-
$
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
left_: $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$3),
|
|
2875
|
-
right_: $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$4)
|
|
2876
|
-
}
|
|
2869
|
+
$parcel$interopDefault($bBfCy$babelruntimehelpersdefineProperty)(this, "elements_", {
|
|
2870
|
+
sliding_el_: $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$2),
|
|
2871
|
+
left_: $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$3),
|
|
2872
|
+
right_: $bBfCy$solidjsweb.getNextElement($08a94efe56c2b35f$var$_tmpl$4)
|
|
2877
2873
|
});
|
|
2878
|
-
$parcel$interopDefault($bBfCy$babelruntimehelpersdefineProperty)(this, "insert_here",
|
|
2874
|
+
$parcel$interopDefault($bBfCy$babelruntimehelpersdefineProperty)(this, "insert_here", this.elements_.sliding_el_);
|
|
2879
2875
|
$parcel$interopDefault($bBfCy$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($bBfCy$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($bBfCy$babelruntimehelpersdefineProperty)(this, "observe", this.observer.observe.bind(this.observer));
|
|
@@ -2912,14 +2908,14 @@ class $08a94efe56c2b35f$export$692b27c28639e5b9 {
|
|
|
2912
2908
|
_mutation_plugins2 && $parcel$interopDefault($bBfCy$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/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.6";
|
|
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/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.6";
|
|
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 = $76EG6$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 = $76EG6$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
|
$76EG6$babelruntimehelpersdefineProperty(this, "container", $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$));
|
|
2671
|
-
$
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
left_: $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$3),
|
|
2676
|
-
right_: $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$4)
|
|
2677
|
-
}
|
|
2670
|
+
$76EG6$babelruntimehelpersdefineProperty(this, "elements_", {
|
|
2671
|
+
sliding_el_: $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$2),
|
|
2672
|
+
left_: $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$3),
|
|
2673
|
+
right_: $76EG6$getNextElement($be288a83d9eabf2a$var$_tmpl$4)
|
|
2678
2674
|
});
|
|
2679
|
-
$76EG6$babelruntimehelpersdefineProperty(this, "insert_here",
|
|
2675
|
+
$76EG6$babelruntimehelpersdefineProperty(this, "insert_here", this.elements_.sliding_el_);
|
|
2680
2676
|
$76EG6$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
|
$76EG6$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
|
$76EG6$babelruntimehelpersdefineProperty(this, "observe", this.observer.observe.bind(this.observer));
|
|
@@ -2713,14 +2709,14 @@ class $be288a83d9eabf2a$export$692b27c28639e5b9 {
|
|
|
2713
2709
|
_mutation_plugins2 && $76EG6$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"
|
package/latest/index.cjs
CHANGED
|
@@ -204,7 +204,7 @@ $parcel$export(module.exports, "version", () => $815f67c61b4c0a42$export$83d89fb
|
|
|
204
204
|
$parcel$export(module.exports, "add_to_version_info", () => $e4a18bf12ad092d9$export$2cefb7e61fcbae00);
|
|
205
205
|
$parcel$export(module.exports, "sync_el_content_with_accessor", () => $35303d72263038db$export$c3f56a35e076f139);
|
|
206
206
|
$parcel$export(module.exports, "use_href_accessor", () => $da35c7e27be2a442$export$e35115e6d0715f77);
|
|
207
|
-
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "2.4.
|
|
207
|
+
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "2.4.6";
|
|
208
208
|
const $7b5e577a60b81e60$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"))();
|
|
209
209
|
const $e6c6e7929ea385ae$var$browser_prefix_styling = "color: #fff;";
|
|
210
210
|
let $e6c6e7929ea385ae$var$browser_prefix = "[Depict]";
|
|
@@ -2350,12 +2350,12 @@ var $1683d0164abd7c1d$var$_tmpl$ = /*#__PURE__*/$z0IcO$solidjsweb.template(`<div
|
|
|
2350
2350
|
class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
2351
2351
|
// this is just here because it's often needed together with the slider
|
|
2352
2352
|
container = $z0IcO$solidjsweb.getNextElement($1683d0164abd7c1d$var$_tmpl$);
|
|
2353
|
-
|
|
2353
|
+
elements_ = {
|
|
2354
2354
|
sliding_el_: $z0IcO$solidjsweb.getNextElement($1683d0164abd7c1d$var$_tmpl$2),
|
|
2355
2355
|
left_: $z0IcO$solidjsweb.getNextElement($1683d0164abd7c1d$var$_tmpl$3),
|
|
2356
2356
|
right_: $z0IcO$solidjsweb.getNextElement($1683d0164abd7c1d$var$_tmpl$4)
|
|
2357
2357
|
};
|
|
2358
|
-
insert_here = this
|
|
2358
|
+
insert_here = this.elements_.sliding_el_;
|
|
2359
2359
|
intersecting_items_object = {};
|
|
2360
2360
|
#mutation_plugins = [];
|
|
2361
2361
|
stepstoslide = 2;
|
|
@@ -2376,7 +2376,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2376
2376
|
} = this;
|
|
2377
2377
|
const {
|
|
2378
2378
|
sliding_el_: sliding_el_
|
|
2379
|
-
} = this
|
|
2379
|
+
} = this.elements_;
|
|
2380
2380
|
for (const record of records) {
|
|
2381
2381
|
for (const node of record.addedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.observe(node);
|
|
2382
2382
|
for (const node of record.removedNodes) if (node instanceof Element && node.parentElement === sliding_el_) observer.unobserve(node);
|
|
@@ -2399,7 +2399,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2399
2399
|
for (let i = 0; i < mutation_plugins.length; i++) $268cbd9e4ade92db$export$b3bbfd758f11cfa9(mutation_plugins[i]).call(this, entries, intersecting_items);
|
|
2400
2400
|
}
|
|
2401
2401
|
observer = new IntersectionObserver(this.#observer_callback.bind(this), {
|
|
2402
|
-
root: this
|
|
2402
|
+
root: this.elements_.sliding_el_,
|
|
2403
2403
|
threshold: $0da0cad4f39e8f32$export$f8ea2e7b15b5d129(100)
|
|
2404
2404
|
});
|
|
2405
2405
|
observe = this.observer.observe.bind(this.observer);
|
|
@@ -2419,7 +2419,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2419
2419
|
}
|
|
2420
2420
|
#hide_buttons_if_needed() {
|
|
2421
2421
|
// 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
|
|
2422
|
-
const cont = this
|
|
2422
|
+
const cont = this.elements_.sliding_el_,
|
|
2423
2423
|
lastel = this.index_of_last_element,
|
|
2424
2424
|
cont_rect = cont.getBoundingClientRect(),
|
|
2425
2425
|
is = this.intersecting_items_object;
|
|
@@ -2433,12 +2433,12 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2433
2433
|
// slider is empty
|
|
2434
2434
|
dist_to_left = 0;
|
|
2435
2435
|
}
|
|
2436
|
-
if (dist_to_left >= -this.dist_to_hide_left) this.#visibility(this
|
|
2437
|
-
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this
|
|
2436
|
+
if (dist_to_left >= -this.dist_to_hide_left) this.#visibility(this.elements_.left_, 0);else this.#visibility(this.elements_.left_, 1);
|
|
2437
|
+
const rightmost_edge_of_last_card = Math.floor((this.element_by_index(lastel) || this.elements_.sliding_el_).getBoundingClientRect().right);
|
|
2438
2438
|
const rightmost_edge_of_container = cont_rect.right,
|
|
2439
2439
|
dist_to_right = rightmost_edge_of_last_card - rightmost_edge_of_container;
|
|
2440
2440
|
// dlog("dist to right", dist_to_right, "dist to left", dist_to_left);
|
|
2441
|
-
if (dist_to_right <= this.dist_to_hide_right) this.#visibility(this
|
|
2441
|
+
if (dist_to_right <= this.dist_to_hide_right) this.#visibility(this.elements_.right_, 0);else this.#visibility(this.elements_.right_, 1);
|
|
2442
2442
|
}
|
|
2443
2443
|
first_intersecting_index(min_ratio = 0.5) {
|
|
2444
2444
|
return parseInt(Object.keys(this.intersecting_items_object).find(i => this.intersecting_items_object[i].intersectionRatio > min_ratio) || "");
|
|
@@ -2449,7 +2449,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2449
2449
|
get index_of_last_element() {
|
|
2450
2450
|
return this.#index_cache.last_el_ ??= (this.first_intersecting?.target?.parentElement?.children?.length ??
|
|
2451
2451
|
// this is for plantagen which has a double whammy slider
|
|
2452
|
-
this
|
|
2452
|
+
this.elements_?.sliding_el_?.children?.length) - 1;
|
|
2453
2453
|
}
|
|
2454
2454
|
get currently_selected() {
|
|
2455
2455
|
// this tries to be what distance_to assumes is the current card when converting a relative offset into an absolute one, available for plugins
|
|
@@ -2459,7 +2459,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2459
2459
|
visible_sizes: visible_sizes
|
|
2460
2460
|
} = this;
|
|
2461
2461
|
let left_offset = 0;
|
|
2462
|
-
const rectangle_of_container = this
|
|
2462
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2463
2463
|
const middle_of_container = rectangle_of_container.width / 2;
|
|
2464
2464
|
for (const [element, info] of visible_sizes) {
|
|
2465
2465
|
left_offset += info.total_visible;
|
|
@@ -2521,13 +2521,13 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
2523
|
} else {
|
|
2524
|
-
$e6c6e7929ea385ae$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this
|
|
2524
|
+
$e6c6e7929ea385ae$export$de56f1198d121036("target is bs, can't find", target, "by either data-index attribute or as child of", this.elements_.sliding_el_);
|
|
2525
2525
|
return 0;
|
|
2526
2526
|
}
|
|
2527
2527
|
}
|
|
2528
2528
|
const rectangle_of_target = target_element.getBoundingClientRect();
|
|
2529
2529
|
const distance_of_li = rectangle_of_target.left + target % 1 * rectangle_of_target.width;
|
|
2530
|
-
const rectangle_of_container = this
|
|
2530
|
+
const rectangle_of_container = this.elements_.sliding_el_.getBoundingClientRect();
|
|
2531
2531
|
const distance_of_container = rectangle_of_container.left;
|
|
2532
2532
|
dist = distance_of_li - distance_of_container;
|
|
2533
2533
|
if (this.center_target) try {
|
|
@@ -2556,7 +2556,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2556
2556
|
const visible_sizes = new Map();
|
|
2557
2557
|
const visible_cards = Object.keys(this.intersecting_items_object).map(key => +key);
|
|
2558
2558
|
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);
|
|
2559
|
-
const root_el = this
|
|
2559
|
+
const root_el = this.elements_.sliding_el_;
|
|
2560
2560
|
const root = root_el.getBoundingClientRect();
|
|
2561
2561
|
const root_computed_style = getComputedStyle(root_el);
|
|
2562
2562
|
const root_left = root.left - parseInt(root_computed_style.marginLeft);
|
|
@@ -2624,7 +2624,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2624
2624
|
if (from_cache) return from_cache;
|
|
2625
2625
|
const {
|
|
2626
2626
|
sliding_el_: sliding_el_
|
|
2627
|
-
} = this
|
|
2627
|
+
} = this.elements_;
|
|
2628
2628
|
let maybe_el = [...(sliding_el_?.children || [])]?.[index];
|
|
2629
2629
|
if (!maybe_el)
|
|
2630
2630
|
// this is for plantagen which has a double whammy slider
|
|
@@ -2642,7 +2642,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2642
2642
|
const {
|
|
2643
2643
|
right_: right_,
|
|
2644
2644
|
left_: left_
|
|
2645
|
-
} = this
|
|
2645
|
+
} = this.elements_;
|
|
2646
2646
|
left_.addEventListener("click", goleft);
|
|
2647
2647
|
right_.addEventListener("click", goright);
|
|
2648
2648
|
[left_, right_].forEach(button => {
|
|
@@ -2650,7 +2650,7 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2650
2650
|
});
|
|
2651
2651
|
}
|
|
2652
2652
|
#create_element_structure(autoinvalidate = true) {
|
|
2653
|
-
const es = this
|
|
2653
|
+
const es = this.elements_;
|
|
2654
2654
|
this.#setup_buttons();
|
|
2655
2655
|
this.container.append(es.left_, es.right_);
|
|
2656
2656
|
this.container.append(es.sliding_el_);
|
|
@@ -2684,12 +2684,12 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2684
2684
|
#scroll_to(offset, is_absolute = false, fallback_scroll_distance = 500, harsh = false) {
|
|
2685
2685
|
const left = $268cbd9e4ade92db$export$b3bbfd758f11cfa9(this.#distance_to).call(this, offset, is_absolute);
|
|
2686
2686
|
const distance_after_fallback_applied = Math.round(left ?? fallback_scroll_distance);
|
|
2687
|
-
if (getComputedStyle(this
|
|
2687
|
+
if (getComputedStyle(this.elements_.sliding_el_).scrollSnapType !== "none" && Math.abs(distance_after_fallback_applied) < 10) {
|
|
2688
2688
|
$e6c6e7929ea385ae$export$de56f1198d121036("Not scrolling because snapping is enabled and distance not over threshold", distance_after_fallback_applied);
|
|
2689
2689
|
return;
|
|
2690
2690
|
}
|
|
2691
2691
|
$e6c6e7929ea385ae$export$de56f1198d121036("Trying to scroll by", left, "px", "before fallback,", distance_after_fallback_applied, "after");
|
|
2692
|
-
this
|
|
2692
|
+
this.elements_.sliding_el_.scrollBy({
|
|
2693
2693
|
left: distance_after_fallback_applied,
|
|
2694
2694
|
top: 0,
|
|
2695
2695
|
behavior: harsh ? "auto" : "smooth"
|
|
@@ -2720,14 +2720,14 @@ class $1683d0164abd7c1d$export$692b27c28639e5b9 {
|
|
|
2720
2720
|
mutation_plugins && (this.#mutation_plugins = mutation_plugins);
|
|
2721
2721
|
correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
|
|
2722
2722
|
if (button_elems) {
|
|
2723
|
-
this
|
|
2724
|
-
this
|
|
2723
|
+
this.elements_.right_ = button_elems.right;
|
|
2724
|
+
this.elements_.left_ = button_elems.left;
|
|
2725
2725
|
}
|
|
2726
|
-
if (button_contents?.right) this
|
|
2727
|
-
if (button_contents?.left) this
|
|
2726
|
+
if (button_contents?.right) this.elements_.right_.append(...button_contents.right);
|
|
2727
|
+
if (button_contents?.left) this.elements_.left_.append(...button_contents.left);
|
|
2728
2728
|
$268cbd9e4ade92db$export$b3bbfd758f11cfa9(this.#create_element_structure).call(this, autoinvalidate_cache);
|
|
2729
2729
|
// @ts-ignore
|
|
2730
|
-
this
|
|
2730
|
+
this.elements_.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
|
|
2731
2731
|
// plugin functionality i.e. for dots
|
|
2732
2732
|
const constructor_args = arguments;
|
|
2733
2733
|
constructor_plugins?.forEach?.(mplugin => {
|
package/latest/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.6";
|
|
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;
|