@flexilla/alpine-popover 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn.js +18 -9
- package/dist/module.cjs.js +18 -9
- package/dist/module.esm.js +18 -9
- package/package.json +2 -2
package/dist/cdn.js
CHANGED
|
@@ -111,9 +111,12 @@
|
|
|
111
111
|
*/
|
|
112
112
|
constructor(e, t, s = {}) {
|
|
113
113
|
h(this, "reference"), h(this, "popper"), h(this, "offsetDistance"), h(this, "placement"), h(this, "disableOnResize"), h(this, "disableOnScroll"), h(this, "onUpdate"), h(this, "isWindowEventsRegistered"), h(this, "validateElements", () => {
|
|
114
|
-
if (!(this.reference instanceof HTMLElement))
|
|
115
|
-
|
|
116
|
-
if (
|
|
114
|
+
if (!(this.reference instanceof HTMLElement))
|
|
115
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
116
|
+
if (!(this.popper instanceof HTMLElement))
|
|
117
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
118
|
+
if (typeof this.offsetDistance != "number")
|
|
119
|
+
throw new Error("OffsetDistance must be a number");
|
|
117
120
|
}), h(this, "setPopperStyleProperty", (m, v) => {
|
|
118
121
|
this.popper.style.setProperty("--fx-popper-placement-x", `${m}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${v}px`);
|
|
119
122
|
}), h(this, "setInitialStyles", () => {
|
|
@@ -153,9 +156,12 @@
|
|
|
153
156
|
eventEffect: r = {},
|
|
154
157
|
onUpdate: l
|
|
155
158
|
} = s;
|
|
156
|
-
if (!(e instanceof HTMLElement))
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
+
if (!(e instanceof HTMLElement))
|
|
160
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
161
|
+
if (!(t instanceof HTMLElement))
|
|
162
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
163
|
+
if (s.offsetDistance && typeof s.offsetDistance != "number")
|
|
164
|
+
throw new Error("OffsetDistance must be a number");
|
|
159
165
|
const { disableOnResize: d, disableOnScroll: c } = r;
|
|
160
166
|
this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = n, this.disableOnResize = d || false, this.disableOnScroll = c || false, this.onUpdate = l;
|
|
161
167
|
}
|
|
@@ -248,8 +254,10 @@
|
|
|
248
254
|
this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
|
|
249
255
|
});
|
|
250
256
|
var o;
|
|
251
|
-
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
252
|
-
|
|
257
|
+
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
258
|
+
throw new Error("Trigger element must be a valid HTML element");
|
|
259
|
+
if (!(this.contentElement instanceof HTMLElement))
|
|
260
|
+
throw new Error("Content element must be a valid HTML element");
|
|
253
261
|
this.options = s, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new oe(
|
|
254
262
|
this.triggerElement,
|
|
255
263
|
this.contentElement,
|
|
@@ -421,7 +429,8 @@
|
|
|
421
429
|
*/
|
|
422
430
|
static autoInit(e = "[data-fx-popover]") {
|
|
423
431
|
const t = j(e);
|
|
424
|
-
for (const s of t)
|
|
432
|
+
for (const s of t)
|
|
433
|
+
new _P(s);
|
|
425
434
|
}
|
|
426
435
|
};
|
|
427
436
|
|
package/dist/module.cjs.js
CHANGED
|
@@ -135,9 +135,12 @@ var oe = class {
|
|
|
135
135
|
*/
|
|
136
136
|
constructor(e, t, s = {}) {
|
|
137
137
|
h(this, "reference"), h(this, "popper"), h(this, "offsetDistance"), h(this, "placement"), h(this, "disableOnResize"), h(this, "disableOnScroll"), h(this, "onUpdate"), h(this, "isWindowEventsRegistered"), h(this, "validateElements", () => {
|
|
138
|
-
if (!(this.reference instanceof HTMLElement))
|
|
139
|
-
|
|
140
|
-
if (
|
|
138
|
+
if (!(this.reference instanceof HTMLElement))
|
|
139
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
140
|
+
if (!(this.popper instanceof HTMLElement))
|
|
141
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
142
|
+
if (typeof this.offsetDistance != "number")
|
|
143
|
+
throw new Error("OffsetDistance must be a number");
|
|
141
144
|
}), h(this, "setPopperStyleProperty", (m, v) => {
|
|
142
145
|
this.popper.style.setProperty("--fx-popper-placement-x", `${m}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${v}px`);
|
|
143
146
|
}), h(this, "setInitialStyles", () => {
|
|
@@ -177,9 +180,12 @@ var oe = class {
|
|
|
177
180
|
eventEffect: r = {},
|
|
178
181
|
onUpdate: l
|
|
179
182
|
} = s;
|
|
180
|
-
if (!(e instanceof HTMLElement))
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
+
if (!(e instanceof HTMLElement))
|
|
184
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
185
|
+
if (!(t instanceof HTMLElement))
|
|
186
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
187
|
+
if (s.offsetDistance && typeof s.offsetDistance != "number")
|
|
188
|
+
throw new Error("OffsetDistance must be a number");
|
|
183
189
|
const { disableOnResize: d, disableOnScroll: c } = r;
|
|
184
190
|
this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = n, this.disableOnResize = d || false, this.disableOnScroll = c || false, this.onUpdate = l;
|
|
185
191
|
}
|
|
@@ -272,8 +278,10 @@ var he = class {
|
|
|
272
278
|
this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
|
|
273
279
|
});
|
|
274
280
|
var o;
|
|
275
|
-
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
276
|
-
|
|
281
|
+
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
282
|
+
throw new Error("Trigger element must be a valid HTML element");
|
|
283
|
+
if (!(this.contentElement instanceof HTMLElement))
|
|
284
|
+
throw new Error("Content element must be a valid HTML element");
|
|
277
285
|
this.options = s, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new oe(
|
|
278
286
|
this.triggerElement,
|
|
279
287
|
this.contentElement,
|
|
@@ -445,7 +453,8 @@ var P = class _P {
|
|
|
445
453
|
*/
|
|
446
454
|
static autoInit(e = "[data-fx-popover]") {
|
|
447
455
|
const t = j(e);
|
|
448
|
-
for (const s of t)
|
|
456
|
+
for (const s of t)
|
|
457
|
+
new _P(s);
|
|
449
458
|
}
|
|
450
459
|
};
|
|
451
460
|
|
package/dist/module.esm.js
CHANGED
|
@@ -110,9 +110,12 @@ var oe = class {
|
|
|
110
110
|
*/
|
|
111
111
|
constructor(e, t, s = {}) {
|
|
112
112
|
h(this, "reference"), h(this, "popper"), h(this, "offsetDistance"), h(this, "placement"), h(this, "disableOnResize"), h(this, "disableOnScroll"), h(this, "onUpdate"), h(this, "isWindowEventsRegistered"), h(this, "validateElements", () => {
|
|
113
|
-
if (!(this.reference instanceof HTMLElement))
|
|
114
|
-
|
|
115
|
-
if (
|
|
113
|
+
if (!(this.reference instanceof HTMLElement))
|
|
114
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
115
|
+
if (!(this.popper instanceof HTMLElement))
|
|
116
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
117
|
+
if (typeof this.offsetDistance != "number")
|
|
118
|
+
throw new Error("OffsetDistance must be a number");
|
|
116
119
|
}), h(this, "setPopperStyleProperty", (m, v) => {
|
|
117
120
|
this.popper.style.setProperty("--fx-popper-placement-x", `${m}px`), this.popper.style.setProperty("--fx-popper-placement-y", `${v}px`);
|
|
118
121
|
}), h(this, "setInitialStyles", () => {
|
|
@@ -152,9 +155,12 @@ var oe = class {
|
|
|
152
155
|
eventEffect: r = {},
|
|
153
156
|
onUpdate: l
|
|
154
157
|
} = s;
|
|
155
|
-
if (!(e instanceof HTMLElement))
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
+
if (!(e instanceof HTMLElement))
|
|
159
|
+
throw new Error("Invalid HTMLElement for Reference Element");
|
|
160
|
+
if (!(t instanceof HTMLElement))
|
|
161
|
+
throw new Error("Invalid HTMLElement for Popper");
|
|
162
|
+
if (s.offsetDistance && typeof s.offsetDistance != "number")
|
|
163
|
+
throw new Error("OffsetDistance must be a number");
|
|
158
164
|
const { disableOnResize: d, disableOnScroll: c } = r;
|
|
159
165
|
this.isWindowEventsRegistered = false, this.reference = e, this.popper = t, this.offsetDistance = o, this.placement = n, this.disableOnResize = d || false, this.disableOnScroll = c || false, this.onUpdate = l;
|
|
160
166
|
}
|
|
@@ -247,8 +253,10 @@ var he = class {
|
|
|
247
253
|
this.triggerElement.removeEventListener("click", this.toggleStateOnClick), this.triggerStrategy === "hover" && this.triggerElement.removeEventListener("mouseenter", this.showOnMouseEnter);
|
|
248
254
|
});
|
|
249
255
|
var o;
|
|
250
|
-
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
251
|
-
|
|
256
|
+
if (this.contentElement = this.getElement(t), this.triggerElement = this.getElement(e), !(this.triggerElement instanceof HTMLElement))
|
|
257
|
+
throw new Error("Trigger element must be a valid HTML element");
|
|
258
|
+
if (!(this.contentElement instanceof HTMLElement))
|
|
259
|
+
throw new Error("Content element must be a valid HTML element");
|
|
252
260
|
this.options = s, this.triggerStrategy = this.options.triggerStrategy || "click", this.placement = this.options.placement || "bottom", this.offsetDistance = this.options.offsetDistance || 6, this.preventFromCloseOutside = this.options.preventFromCloseOutside || false, this.preventFromCloseInside = this.options.preventCloseFromInside || false, this.defaultState = this.options.defaultState || "close", this.eventEffect = (o = this.options.popper) == null ? void 0 : o.eventEffect, this.popper = new oe(
|
|
253
261
|
this.triggerElement,
|
|
254
262
|
this.contentElement,
|
|
@@ -420,7 +428,8 @@ var P = class _P {
|
|
|
420
428
|
*/
|
|
421
429
|
static autoInit(e = "[data-fx-popover]") {
|
|
422
430
|
const t = j(e);
|
|
423
|
-
for (const s of t)
|
|
431
|
+
for (const s of t)
|
|
432
|
+
new _P(s);
|
|
424
433
|
}
|
|
425
434
|
};
|
|
426
435
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexilla/alpine-popover",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "AlpineJS plugin for adding Popover functionality to your AlpineJS components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@flexilla/popover": "^0.2.1"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "2de9f4208852d8b159dfd7a84c4e8d03f9d53a86"
|
|
64
64
|
}
|