vrembem 4.0.0-next.29 → 4.0.0-next.30
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/dev/index.js +43 -19
- package/dev/index.js.map +1 -1
- package/dev/index.umd.cjs +43 -19
- package/dev/index.umd.cjs.map +1 -1
- package/dist/index.js +295 -270
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +22 -22
package/dev/index.umd.cjs
CHANGED
|
@@ -62,7 +62,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
62
62
|
function getCustomProps(entry) {
|
|
63
63
|
const styles = getComputedStyle(entry.el);
|
|
64
64
|
const result = {};
|
|
65
|
-
const keys =
|
|
65
|
+
const keys = entry.getSetting("customProps");
|
|
66
66
|
for (let i = 0; i < keys.length; i++) {
|
|
67
67
|
const prefix = getPrefix();
|
|
68
68
|
const module2 = entry.context.module.toLowerCase();
|
|
@@ -83,6 +83,27 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
83
83
|
return null;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
function maybeReturnSetting(prop, key, type = "camel") {
|
|
87
|
+
key = type === "camel" ? toCamel(key) : toKebab(key);
|
|
88
|
+
return prop.split(".").concat(key).reduce((obj, key2) => obj == null ? void 0 : obj[key2], this);
|
|
89
|
+
}
|
|
90
|
+
function getSetting(key, options = {}) {
|
|
91
|
+
const {
|
|
92
|
+
fallback,
|
|
93
|
+
props = ["dataConfig", "customProps", "settings", "context.settings"]
|
|
94
|
+
} = options;
|
|
95
|
+
for (const prop of props) {
|
|
96
|
+
const type = prop !== "customProps" ? "camel" : "kebab";
|
|
97
|
+
const result = maybeReturnSetting.call(this, prop, key, type);
|
|
98
|
+
if (result !== void 0) {
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (fallback !== void 0) {
|
|
103
|
+
return fallback;
|
|
104
|
+
}
|
|
105
|
+
throw new Error(`${this.context.module} setting does not exist: ${key}`);
|
|
106
|
+
}
|
|
86
107
|
async function lifecycleHook(name, ...args) {
|
|
87
108
|
if (name in this && typeof this[name] === "function") {
|
|
88
109
|
await this[name](...args);
|
|
@@ -171,6 +192,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
171
192
|
this.collection = [];
|
|
172
193
|
this.settings = Object.assign({
|
|
173
194
|
dataConfig: "config",
|
|
195
|
+
customProps: [],
|
|
174
196
|
teleport: null,
|
|
175
197
|
teleportMethod: "append"
|
|
176
198
|
}, options);
|
|
@@ -251,22 +273,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
251
273
|
getCustomProps() {
|
|
252
274
|
return Object.assign(this.customProps, getCustomProps(this));
|
|
253
275
|
}
|
|
254
|
-
getSetting(key) {
|
|
255
|
-
|
|
256
|
-
const kebab = toKebab(key);
|
|
257
|
-
if ("dataConfig" in this && camel in this.dataConfig) {
|
|
258
|
-
return this.dataConfig[camel];
|
|
259
|
-
}
|
|
260
|
-
if ("customProps" in this && kebab in this.customProps) {
|
|
261
|
-
return this.customProps[kebab];
|
|
262
|
-
}
|
|
263
|
-
if ("settings" in this && camel in this.settings) {
|
|
264
|
-
return this.settings[camel];
|
|
265
|
-
}
|
|
266
|
-
if ("settings" in this.context && camel in this.context.settings) {
|
|
267
|
-
return this.context.settings[camel];
|
|
268
|
-
}
|
|
269
|
-
throw new Error(`${this.context.module} setting does not exist: ${key}`);
|
|
276
|
+
getSetting(key, options = {}) {
|
|
277
|
+
return getSetting.call(this, key, options);
|
|
270
278
|
}
|
|
271
279
|
async mount(options = {}) {
|
|
272
280
|
if (this.el === null) {
|
|
@@ -523,6 +531,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
523
531
|
getCustomProps,
|
|
524
532
|
getElement,
|
|
525
533
|
getPrefix,
|
|
534
|
+
getSetting,
|
|
526
535
|
lifecycleHook,
|
|
527
536
|
localStore,
|
|
528
537
|
setGlobalState,
|
|
@@ -554,6 +563,9 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
554
563
|
// Classes
|
|
555
564
|
classModal: "drawer_modal",
|
|
556
565
|
// Feature toggles
|
|
566
|
+
customProps: [
|
|
567
|
+
"transition-duration"
|
|
568
|
+
],
|
|
557
569
|
breakpoints: null,
|
|
558
570
|
customEventPrefix: "drawer:",
|
|
559
571
|
store: true,
|
|
@@ -562,7 +574,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
562
574
|
teleport: null,
|
|
563
575
|
teleportMethod: "prepend",
|
|
564
576
|
transition: true,
|
|
565
|
-
transitionDuration:
|
|
577
|
+
transitionDuration: 300
|
|
566
578
|
};
|
|
567
579
|
function applyInitialState(entry) {
|
|
568
580
|
if (entry.store === "opened") {
|
|
@@ -934,12 +946,15 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
934
946
|
stateClosing: "is-closing",
|
|
935
947
|
stateClosed: "is-closed",
|
|
936
948
|
// Feature settings
|
|
949
|
+
customProps: [
|
|
950
|
+
"transition-duration"
|
|
951
|
+
],
|
|
937
952
|
customEventPrefix: "modal:",
|
|
938
953
|
setTabindex: true,
|
|
939
954
|
teleport: null,
|
|
940
955
|
teleportMethod: "append",
|
|
941
956
|
transition: true,
|
|
942
|
-
transitionDuration:
|
|
957
|
+
transitionDuration: 300
|
|
943
958
|
};
|
|
944
959
|
class ModalEntry extends CollectionEntry {
|
|
945
960
|
constructor(context, query, options = {}) {
|
|
@@ -1237,6 +1252,15 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1237
1252
|
// State classes
|
|
1238
1253
|
stateActive: "is-active",
|
|
1239
1254
|
// Custom properties and their defaults
|
|
1255
|
+
customProps: [
|
|
1256
|
+
"placement",
|
|
1257
|
+
"event",
|
|
1258
|
+
"offset",
|
|
1259
|
+
"flip-padding",
|
|
1260
|
+
"shift-padding",
|
|
1261
|
+
"arrow-padding",
|
|
1262
|
+
"toggle-delay"
|
|
1263
|
+
],
|
|
1240
1264
|
placement: "bottom",
|
|
1241
1265
|
event: "click",
|
|
1242
1266
|
offset: 0,
|