@studiometa/js-toolkit 2.3.0 → 2.4.0
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/Base/index.cjs +41 -40
- package/Base/index.js +64 -57
- package/Base/managers/AbstractManager.cjs +10 -5
- package/Base/managers/AbstractManager.js +11 -5
- package/Base/managers/ChildrenManager.cjs +11 -2
- package/Base/managers/ChildrenManager.js +12 -2
- package/Base/managers/EventsManager.cjs +46 -41
- package/Base/managers/EventsManager.js +47 -41
- package/Base/managers/OptionsManager.cjs +14 -7
- package/Base/managers/OptionsManager.js +15 -7
- package/Base/managers/RefsManager.cjs +2 -1
- package/Base/managers/RefsManager.js +2 -1
- package/Base/managers/ServicesManager.cjs +9 -1
- package/Base/managers/ServicesManager.js +10 -1
- package/README.md +3 -3
- package/decorators/withBreakpointObserver.cjs +16 -11
- package/decorators/withBreakpointObserver.js +17 -11
- package/decorators/withDrag.cjs +11 -6
- package/decorators/withDrag.js +12 -6
- package/decorators/withExtraConfig.cjs +8 -3
- package/decorators/withExtraConfig.js +9 -3
- package/decorators/withFreezedOptions.cjs +9 -1
- package/decorators/withFreezedOptions.js +10 -1
- package/decorators/withIntersectionObserver.cjs +16 -11
- package/decorators/withIntersectionObserver.js +17 -11
- package/decorators/withMountWhenInView.cjs +17 -12
- package/decorators/withMountWhenInView.js +18 -12
- package/decorators/withScrolledInView.cjs +35 -30
- package/decorators/withScrolledInView.js +36 -30
- package/decorators/withVue2.cjs +15 -10
- package/decorators/withVue2.js +16 -10
- package/helpers/getDirectChildren.cjs +46 -0
- package/helpers/getDirectChildren.d.ts +24 -0
- package/helpers/getDirectChildren.js +24 -0
- package/helpers/getInstanceFromElement.cjs +2 -1
- package/helpers/getInstanceFromElement.js +2 -1
- package/helpers/importOnInteraction.cjs +1 -1
- package/helpers/importOnInteraction.js +1 -1
- package/helpers/importWhenIdle.cjs +3 -2
- package/helpers/importWhenIdle.js +3 -2
- package/helpers/importWhenVisible.cjs +1 -1
- package/helpers/importWhenVisible.js +1 -1
- package/helpers/index.cjs +2 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/package.json +1 -1
- package/services/key.cjs +1 -1
- package/services/key.js +1 -1
- package/services/pointer.cjs +3 -2
- package/services/pointer.js +3 -2
- package/utils/css/animate.cjs +12 -8
- package/utils/css/animate.js +12 -8
- package/utils/css/matrix.cjs +2 -1
- package/utils/css/matrix.js +2 -1
- package/utils/css/transform.cjs +2 -1
- package/utils/css/transform.js +2 -1
- package/utils/css/transition.cjs +7 -2
- package/utils/css/transition.js +8 -2
- package/utils/tween.cjs +2 -1
- package/utils/tween.js +2 -1
package/Base/index.cjs
CHANGED
|
@@ -73,11 +73,43 @@ function createAndTestManagers(instance) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
var Base = class extends EventTarget {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
constructor(element) {
|
|
77
|
+
super();
|
|
78
|
+
__publicField(this, "$parent", null);
|
|
79
|
+
__publicField(this, "$id");
|
|
80
|
+
__publicField(this, "$el");
|
|
81
|
+
__publicField(this, "$isMounted", false);
|
|
82
|
+
__publicField(this, "__eventHandlers", /* @__PURE__ */ new Map());
|
|
83
|
+
__publicField(this, "__services");
|
|
84
|
+
__publicField(this, "__refs");
|
|
85
|
+
__publicField(this, "__options");
|
|
86
|
+
__publicField(this, "__children");
|
|
87
|
+
__publicField(this, "__events");
|
|
88
|
+
if (!element) {
|
|
89
|
+
if (import_utils2.isDev) {
|
|
90
|
+
throw new Error("The root element must be defined.");
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const { __config } = this;
|
|
95
|
+
if (__config.name === "Base") {
|
|
96
|
+
if (import_utils2.isDev) {
|
|
97
|
+
throw new Error("The `config.name` property is required.");
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.$id = `${__config.name}-${id}`;
|
|
102
|
+
id += 1;
|
|
103
|
+
this.$el = element;
|
|
104
|
+
if (!this.$el.__base__) {
|
|
105
|
+
this.$el.__base__ = /* @__PURE__ */ new WeakMap();
|
|
106
|
+
}
|
|
107
|
+
this.$el.__base__.set(this.__ctor, this);
|
|
108
|
+
createAndTestManagers(this);
|
|
109
|
+
if (import_utils2.isDev) {
|
|
110
|
+
this.__debug("constructor", this);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
81
113
|
get $root() {
|
|
82
114
|
if (!this.$parent) {
|
|
83
115
|
return this;
|
|
@@ -93,6 +125,7 @@ var Base = class extends EventTarget {
|
|
|
93
125
|
return root;
|
|
94
126
|
}
|
|
95
127
|
get __config() {
|
|
128
|
+
var _a, _b, _c;
|
|
96
129
|
let proto = Object.getPrototypeOf(this);
|
|
97
130
|
let { config } = proto.constructor;
|
|
98
131
|
while (proto.constructor.config && proto.constructor.$isBase) {
|
|
@@ -105,28 +138,23 @@ var Base = class extends EventTarget {
|
|
|
105
138
|
}
|
|
106
139
|
proto = Object.getPrototypeOf(proto);
|
|
107
140
|
}
|
|
108
|
-
config.options = config.options
|
|
109
|
-
config.refs = config.refs
|
|
110
|
-
config.components = config.components
|
|
141
|
+
config.options = (_a = config.options) != null ? _a : {};
|
|
142
|
+
config.refs = (_b = config.refs) != null ? _b : [];
|
|
143
|
+
config.components = (_c = config.components) != null ? _c : {};
|
|
111
144
|
return config;
|
|
112
145
|
}
|
|
113
|
-
__services;
|
|
114
146
|
get $services() {
|
|
115
147
|
return this.__services;
|
|
116
148
|
}
|
|
117
|
-
__refs;
|
|
118
149
|
get $refs() {
|
|
119
150
|
return this.__refs;
|
|
120
151
|
}
|
|
121
|
-
__options;
|
|
122
152
|
get $options() {
|
|
123
153
|
return this.__options;
|
|
124
154
|
}
|
|
125
|
-
__children;
|
|
126
155
|
get $children() {
|
|
127
156
|
return this.__children;
|
|
128
157
|
}
|
|
129
|
-
__events;
|
|
130
158
|
get $log() {
|
|
131
159
|
return this.__options.log ? window.console.log.bind(window, `[${this.__config.name}]`) : import_utils2.noop;
|
|
132
160
|
}
|
|
@@ -159,33 +187,6 @@ var Base = class extends EventTarget {
|
|
|
159
187
|
const eventHandlers = this.__eventHandlers.get(event);
|
|
160
188
|
return eventHandlers && eventHandlers.size > 0;
|
|
161
189
|
}
|
|
162
|
-
constructor(element) {
|
|
163
|
-
super();
|
|
164
|
-
if (!element) {
|
|
165
|
-
if (import_utils2.isDev) {
|
|
166
|
-
throw new Error("The root element must be defined.");
|
|
167
|
-
}
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const { __config } = this;
|
|
171
|
-
if (__config.name === "Base") {
|
|
172
|
-
if (import_utils2.isDev) {
|
|
173
|
-
throw new Error("The `config.name` property is required.");
|
|
174
|
-
}
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
this.$id = `${__config.name}-${id}`;
|
|
178
|
-
id += 1;
|
|
179
|
-
this.$el = element;
|
|
180
|
-
if (!this.$el.__base__) {
|
|
181
|
-
this.$el.__base__ = /* @__PURE__ */ new WeakMap();
|
|
182
|
-
}
|
|
183
|
-
this.$el.__base__.set(this.__ctor, this);
|
|
184
|
-
createAndTestManagers(this);
|
|
185
|
-
if (import_utils2.isDev) {
|
|
186
|
-
this.__debug("constructor", this);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
190
|
$mount() {
|
|
190
191
|
if (this.$isMounted) {
|
|
191
192
|
return this;
|
package/Base/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import { getComponentElements, getEventTarget } from "./utils.js";
|
|
2
8
|
import ChildrenManager from "./managers/ChildrenManager.js";
|
|
3
9
|
import RefsManager from "./managers/RefsManager.js";
|
|
@@ -41,12 +47,43 @@ function createAndTestManagers(instance) {
|
|
|
41
47
|
});
|
|
42
48
|
}
|
|
43
49
|
class Base extends EventTarget {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
constructor(element) {
|
|
51
|
+
super();
|
|
52
|
+
__publicField(this, "$parent", null);
|
|
53
|
+
__publicField(this, "$id");
|
|
54
|
+
__publicField(this, "$el");
|
|
55
|
+
__publicField(this, "$isMounted", false);
|
|
56
|
+
__publicField(this, "__eventHandlers", /* @__PURE__ */ new Map());
|
|
57
|
+
__publicField(this, "__services");
|
|
58
|
+
__publicField(this, "__refs");
|
|
59
|
+
__publicField(this, "__options");
|
|
60
|
+
__publicField(this, "__children");
|
|
61
|
+
__publicField(this, "__events");
|
|
62
|
+
if (!element) {
|
|
63
|
+
if (isDev) {
|
|
64
|
+
throw new Error("The root element must be defined.");
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const { __config } = this;
|
|
69
|
+
if (__config.name === "Base") {
|
|
70
|
+
if (isDev) {
|
|
71
|
+
throw new Error("The `config.name` property is required.");
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.$id = `${__config.name}-${id}`;
|
|
76
|
+
id += 1;
|
|
77
|
+
this.$el = element;
|
|
78
|
+
if (!this.$el.__base__) {
|
|
79
|
+
this.$el.__base__ = /* @__PURE__ */ new WeakMap();
|
|
80
|
+
}
|
|
81
|
+
this.$el.__base__.set(this.__ctor, this);
|
|
82
|
+
createAndTestManagers(this);
|
|
83
|
+
if (isDev) {
|
|
84
|
+
this.__debug("constructor", this);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
50
87
|
get $root() {
|
|
51
88
|
if (!this.$parent) {
|
|
52
89
|
return this;
|
|
@@ -62,6 +99,7 @@ class Base extends EventTarget {
|
|
|
62
99
|
return root;
|
|
63
100
|
}
|
|
64
101
|
get __config() {
|
|
102
|
+
var _a, _b, _c;
|
|
65
103
|
let proto = Object.getPrototypeOf(this);
|
|
66
104
|
let { config } = proto.constructor;
|
|
67
105
|
while (proto.constructor.config && proto.constructor.$isBase) {
|
|
@@ -74,44 +112,23 @@ class Base extends EventTarget {
|
|
|
74
112
|
}
|
|
75
113
|
proto = Object.getPrototypeOf(proto);
|
|
76
114
|
}
|
|
77
|
-
config.options = config.options
|
|
78
|
-
config.refs = config.refs
|
|
79
|
-
config.components = config.components
|
|
115
|
+
config.options = (_a = config.options) != null ? _a : {};
|
|
116
|
+
config.refs = (_b = config.refs) != null ? _b : [];
|
|
117
|
+
config.components = (_c = config.components) != null ? _c : {};
|
|
80
118
|
return config;
|
|
81
119
|
}
|
|
82
|
-
static config = {
|
|
83
|
-
name: "Base",
|
|
84
|
-
emits: [
|
|
85
|
-
"before-mounted",
|
|
86
|
-
"mounted",
|
|
87
|
-
"updated",
|
|
88
|
-
"destroyed",
|
|
89
|
-
"terminated",
|
|
90
|
-
"ticked",
|
|
91
|
-
"scrolled",
|
|
92
|
-
"resized",
|
|
93
|
-
"moved",
|
|
94
|
-
"loaded",
|
|
95
|
-
"keyed"
|
|
96
|
-
]
|
|
97
|
-
};
|
|
98
|
-
__services;
|
|
99
120
|
get $services() {
|
|
100
121
|
return this.__services;
|
|
101
122
|
}
|
|
102
|
-
__refs;
|
|
103
123
|
get $refs() {
|
|
104
124
|
return this.__refs;
|
|
105
125
|
}
|
|
106
|
-
__options;
|
|
107
126
|
get $options() {
|
|
108
127
|
return this.__options;
|
|
109
128
|
}
|
|
110
|
-
__children;
|
|
111
129
|
get $children() {
|
|
112
130
|
return this.__children;
|
|
113
131
|
}
|
|
114
|
-
__events;
|
|
115
132
|
get $log() {
|
|
116
133
|
return this.__options.log ? window.console.log.bind(window, `[${this.__config.name}]`) : noop;
|
|
117
134
|
}
|
|
@@ -144,33 +161,6 @@ class Base extends EventTarget {
|
|
|
144
161
|
const eventHandlers = this.__eventHandlers.get(event);
|
|
145
162
|
return eventHandlers && eventHandlers.size > 0;
|
|
146
163
|
}
|
|
147
|
-
constructor(element) {
|
|
148
|
-
super();
|
|
149
|
-
if (!element) {
|
|
150
|
-
if (isDev) {
|
|
151
|
-
throw new Error("The root element must be defined.");
|
|
152
|
-
}
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const { __config } = this;
|
|
156
|
-
if (__config.name === "Base") {
|
|
157
|
-
if (isDev) {
|
|
158
|
-
throw new Error("The `config.name` property is required.");
|
|
159
|
-
}
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.$id = `${__config.name}-${id}`;
|
|
163
|
-
id += 1;
|
|
164
|
-
this.$el = element;
|
|
165
|
-
if (!this.$el.__base__) {
|
|
166
|
-
this.$el.__base__ = /* @__PURE__ */ new WeakMap();
|
|
167
|
-
}
|
|
168
|
-
this.$el.__base__.set(this.__ctor, this);
|
|
169
|
-
createAndTestManagers(this);
|
|
170
|
-
if (isDev) {
|
|
171
|
-
this.__debug("constructor", this);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
164
|
$mount() {
|
|
175
165
|
if (this.$isMounted) {
|
|
176
166
|
return this;
|
|
@@ -277,6 +267,23 @@ class Base extends EventTarget {
|
|
|
277
267
|
return getComponentElements(nameOrSelector).map((el) => new this(el).$mount());
|
|
278
268
|
}
|
|
279
269
|
}
|
|
270
|
+
__publicField(Base, "$isBase", true);
|
|
271
|
+
__publicField(Base, "config", {
|
|
272
|
+
name: "Base",
|
|
273
|
+
emits: [
|
|
274
|
+
"before-mounted",
|
|
275
|
+
"mounted",
|
|
276
|
+
"updated",
|
|
277
|
+
"destroyed",
|
|
278
|
+
"terminated",
|
|
279
|
+
"ticked",
|
|
280
|
+
"scrolled",
|
|
281
|
+
"resized",
|
|
282
|
+
"moved",
|
|
283
|
+
"loaded",
|
|
284
|
+
"keyed"
|
|
285
|
+
]
|
|
286
|
+
});
|
|
280
287
|
export {
|
|
281
288
|
Base as default
|
|
282
289
|
};
|
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,6 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
16
|
return to;
|
|
16
17
|
};
|
|
17
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __publicField = (obj, key, value) => {
|
|
20
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
18
23
|
|
|
19
24
|
// packages/js-toolkit/Base/managers/AbstractManager.js
|
|
20
25
|
var AbstractManager_exports = {};
|
|
@@ -23,7 +28,11 @@ __export(AbstractManager_exports, {
|
|
|
23
28
|
});
|
|
24
29
|
module.exports = __toCommonJS(AbstractManager_exports);
|
|
25
30
|
var AbstractManager = class {
|
|
26
|
-
|
|
31
|
+
constructor(base) {
|
|
32
|
+
__publicField(this, "__base");
|
|
33
|
+
this.__base = base;
|
|
34
|
+
this.__hideProperties(["__base"]);
|
|
35
|
+
}
|
|
27
36
|
get __element() {
|
|
28
37
|
return this.__base.$el;
|
|
29
38
|
}
|
|
@@ -33,10 +42,6 @@ var AbstractManager = class {
|
|
|
33
42
|
get __eventsManager() {
|
|
34
43
|
return this.__base.__events;
|
|
35
44
|
}
|
|
36
|
-
constructor(base) {
|
|
37
|
-
this.__base = base;
|
|
38
|
-
this.__hideProperties(["__base"]);
|
|
39
|
-
}
|
|
40
45
|
__hideProperties(properties) {
|
|
41
46
|
Object.defineProperties(this, Object.fromEntries(properties.map((property) => [
|
|
42
47
|
property,
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
class AbstractManager {
|
|
2
|
-
|
|
8
|
+
constructor(base) {
|
|
9
|
+
__publicField(this, "__base");
|
|
10
|
+
this.__base = base;
|
|
11
|
+
this.__hideProperties(["__base"]);
|
|
12
|
+
}
|
|
3
13
|
get __element() {
|
|
4
14
|
return this.__base.$el;
|
|
5
15
|
}
|
|
@@ -9,10 +19,6 @@ class AbstractManager {
|
|
|
9
19
|
get __eventsManager() {
|
|
10
20
|
return this.__base.__events;
|
|
11
21
|
}
|
|
12
|
-
constructor(base) {
|
|
13
|
-
this.__base = base;
|
|
14
|
-
this.__hideProperties(["__base"]);
|
|
15
|
-
}
|
|
16
22
|
__hideProperties(properties) {
|
|
17
23
|
Object.defineProperties(this, Object.fromEntries(properties.map((property) => [
|
|
18
24
|
property,
|
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/Base/managers/ChildrenManager.js
|
|
23
28
|
var ChildrenManager_exports = {};
|
|
@@ -50,7 +55,8 @@ function __getChild(that, el, ComponentClass, name) {
|
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
57
|
return promise.then((module2) => {
|
|
53
|
-
|
|
58
|
+
var _a;
|
|
59
|
+
const ctor = (_a = module2.default) != null ? _a : module2;
|
|
54
60
|
that.__asyncComponentPromises.set(ComponentClass, {
|
|
55
61
|
promise,
|
|
56
62
|
status: "resolved",
|
|
@@ -96,7 +102,10 @@ function __triggerHookForAll(that, hook) {
|
|
|
96
102
|
});
|
|
97
103
|
}
|
|
98
104
|
var ChildrenManager = class extends import_AbstractManager.default {
|
|
99
|
-
|
|
105
|
+
constructor() {
|
|
106
|
+
super(...arguments);
|
|
107
|
+
__publicField(this, "__asyncComponentPromises", /* @__PURE__ */ new WeakMap());
|
|
108
|
+
}
|
|
100
109
|
get registeredNames() {
|
|
101
110
|
return Object.keys(this).filter((key) => !key.startsWith("__"));
|
|
102
111
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import AbstractManager from "./AbstractManager.js";
|
|
2
8
|
import { getComponentElements } from "../utils.js";
|
|
3
9
|
function __getChild(that, el, ComponentClass, name) {
|
|
@@ -23,7 +29,8 @@ function __getChild(that, el, ComponentClass, name) {
|
|
|
23
29
|
});
|
|
24
30
|
}
|
|
25
31
|
return promise.then((module) => {
|
|
26
|
-
|
|
32
|
+
var _a;
|
|
33
|
+
const ctor = (_a = module.default) != null ? _a : module;
|
|
27
34
|
that.__asyncComponentPromises.set(ComponentClass, {
|
|
28
35
|
promise,
|
|
29
36
|
status: "resolved",
|
|
@@ -69,7 +76,10 @@ function __triggerHookForAll(that, hook) {
|
|
|
69
76
|
});
|
|
70
77
|
}
|
|
71
78
|
class ChildrenManager extends AbstractManager {
|
|
72
|
-
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
__publicField(this, "__asyncComponentPromises", /* @__PURE__ */ new WeakMap());
|
|
82
|
+
}
|
|
73
83
|
get registeredNames() {
|
|
74
84
|
return Object.keys(this).filter((key) => !key.startsWith("__"));
|
|
75
85
|
}
|
|
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
9
|
for (var name in all)
|
|
9
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,6 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
19
|
};
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
// packages/js-toolkit/Base/managers/EventsManager.js
|
|
23
28
|
var EventsManager_exports = {};
|
|
@@ -94,49 +99,49 @@ function manageRootElement(that, mode = "add") {
|
|
|
94
99
|
});
|
|
95
100
|
}
|
|
96
101
|
var EventsManager = class extends import_AbstractManager.default {
|
|
97
|
-
__methodsCache = /* @__PURE__ */ new Map();
|
|
98
|
-
__rootElementHandler = {
|
|
99
|
-
handleEvent: (event) => {
|
|
100
|
-
const normalizedEventName = normalizeName(event.type);
|
|
101
|
-
const method = `on${normalizedEventName}`;
|
|
102
|
-
if (event instanceof CustomEvent && (0, import_utils.isArray)(event.detail) && event.detail.length) {
|
|
103
|
-
this.__base[method](...event.detail, event);
|
|
104
|
-
} else {
|
|
105
|
-
this.__base[method](event);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
__refsHandler = {
|
|
110
|
-
handleEvent: (event) => {
|
|
111
|
-
const ref = event.currentTarget;
|
|
112
|
-
const refName = (0, import_RefsManager.normalizeRefName)(ref.dataset.ref);
|
|
113
|
-
const normalizedRefName = normalizeName(refName);
|
|
114
|
-
const normalizedEventName = normalizeName(event.type);
|
|
115
|
-
const method = `on${normalizedRefName}${normalizedEventName}`;
|
|
116
|
-
let index = 0;
|
|
117
|
-
if ((0, import_utils.isArray)(this.__base.$refs[refName])) {
|
|
118
|
-
index = this.__base.$refs[refName].indexOf(ref);
|
|
119
|
-
}
|
|
120
|
-
this.__base[method](event, index);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
__childrenHandler = {
|
|
124
|
-
handleEvent: (event) => {
|
|
125
|
-
const childrenManager = this.__base.$children;
|
|
126
|
-
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
127
|
-
name: childName,
|
|
128
|
-
child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
|
|
129
|
-
})).find(({ child }) => child);
|
|
130
|
-
const normalizedChildName = normalizeName(name);
|
|
131
|
-
const normalizedEventName = normalizeName(event.type);
|
|
132
|
-
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
133
|
-
const index = childrenManager[name].indexOf(resolvedChild);
|
|
134
|
-
const args = (0, import_utils.isArray)(event.detail) ? event.detail : [];
|
|
135
|
-
this.__base[method](...args, index, event);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
102
|
constructor(base) {
|
|
139
103
|
super(base);
|
|
104
|
+
__publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
|
|
105
|
+
__publicField(this, "__rootElementHandler", {
|
|
106
|
+
handleEvent: (event) => {
|
|
107
|
+
const normalizedEventName = normalizeName(event.type);
|
|
108
|
+
const method = `on${normalizedEventName}`;
|
|
109
|
+
if (event instanceof CustomEvent && (0, import_utils.isArray)(event.detail) && event.detail.length) {
|
|
110
|
+
this.__base[method](...event.detail, event);
|
|
111
|
+
} else {
|
|
112
|
+
this.__base[method](event);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
__publicField(this, "__refsHandler", {
|
|
117
|
+
handleEvent: (event) => {
|
|
118
|
+
const ref = event.currentTarget;
|
|
119
|
+
const refName = (0, import_RefsManager.normalizeRefName)(ref.dataset.ref);
|
|
120
|
+
const normalizedRefName = normalizeName(refName);
|
|
121
|
+
const normalizedEventName = normalizeName(event.type);
|
|
122
|
+
const method = `on${normalizedRefName}${normalizedEventName}`;
|
|
123
|
+
let index = 0;
|
|
124
|
+
if ((0, import_utils.isArray)(this.__base.$refs[refName])) {
|
|
125
|
+
index = this.__base.$refs[refName].indexOf(ref);
|
|
126
|
+
}
|
|
127
|
+
this.__base[method](event, index);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
__publicField(this, "__childrenHandler", {
|
|
131
|
+
handleEvent: (event) => {
|
|
132
|
+
const childrenManager = this.__base.$children;
|
|
133
|
+
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
134
|
+
name: childName,
|
|
135
|
+
child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
|
|
136
|
+
})).find(({ child }) => child);
|
|
137
|
+
const normalizedChildName = normalizeName(name);
|
|
138
|
+
const normalizedEventName = normalizeName(event.type);
|
|
139
|
+
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
140
|
+
const index = childrenManager[name].indexOf(resolvedChild);
|
|
141
|
+
const args = (0, import_utils.isArray)(event.detail) ? event.detail : [];
|
|
142
|
+
this.__base[method](...args, index, event);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
140
145
|
this.__hideProperties([
|
|
141
146
|
"__methodsCache",
|
|
142
147
|
"__rootElementHandler",
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
1
7
|
import getAllProperties from "../../utils/object/getAllProperties.js";
|
|
2
8
|
import { isArray } from "../../utils/index.js";
|
|
3
9
|
import { getEventTarget, eventIsNative, eventIsDefinedInConfig } from "../utils.js";
|
|
@@ -65,49 +71,49 @@ function manageRootElement(that, mode = "add") {
|
|
|
65
71
|
});
|
|
66
72
|
}
|
|
67
73
|
class EventsManager extends AbstractManager {
|
|
68
|
-
__methodsCache = /* @__PURE__ */ new Map();
|
|
69
|
-
__rootElementHandler = {
|
|
70
|
-
handleEvent: (event) => {
|
|
71
|
-
const normalizedEventName = normalizeName(event.type);
|
|
72
|
-
const method = `on${normalizedEventName}`;
|
|
73
|
-
if (event instanceof CustomEvent && isArray(event.detail) && event.detail.length) {
|
|
74
|
-
this.__base[method](...event.detail, event);
|
|
75
|
-
} else {
|
|
76
|
-
this.__base[method](event);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
__refsHandler = {
|
|
81
|
-
handleEvent: (event) => {
|
|
82
|
-
const ref = event.currentTarget;
|
|
83
|
-
const refName = normalizeRefName(ref.dataset.ref);
|
|
84
|
-
const normalizedRefName = normalizeName(refName);
|
|
85
|
-
const normalizedEventName = normalizeName(event.type);
|
|
86
|
-
const method = `on${normalizedRefName}${normalizedEventName}`;
|
|
87
|
-
let index = 0;
|
|
88
|
-
if (isArray(this.__base.$refs[refName])) {
|
|
89
|
-
index = this.__base.$refs[refName].indexOf(ref);
|
|
90
|
-
}
|
|
91
|
-
this.__base[method](event, index);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
__childrenHandler = {
|
|
95
|
-
handleEvent: (event) => {
|
|
96
|
-
const childrenManager = this.__base.$children;
|
|
97
|
-
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
98
|
-
name: childName,
|
|
99
|
-
child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
|
|
100
|
-
})).find(({ child }) => child);
|
|
101
|
-
const normalizedChildName = normalizeName(name);
|
|
102
|
-
const normalizedEventName = normalizeName(event.type);
|
|
103
|
-
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
104
|
-
const index = childrenManager[name].indexOf(resolvedChild);
|
|
105
|
-
const args = isArray(event.detail) ? event.detail : [];
|
|
106
|
-
this.__base[method](...args, index, event);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
74
|
constructor(base) {
|
|
110
75
|
super(base);
|
|
76
|
+
__publicField(this, "__methodsCache", /* @__PURE__ */ new Map());
|
|
77
|
+
__publicField(this, "__rootElementHandler", {
|
|
78
|
+
handleEvent: (event) => {
|
|
79
|
+
const normalizedEventName = normalizeName(event.type);
|
|
80
|
+
const method = `on${normalizedEventName}`;
|
|
81
|
+
if (event instanceof CustomEvent && isArray(event.detail) && event.detail.length) {
|
|
82
|
+
this.__base[method](...event.detail, event);
|
|
83
|
+
} else {
|
|
84
|
+
this.__base[method](event);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
__publicField(this, "__refsHandler", {
|
|
89
|
+
handleEvent: (event) => {
|
|
90
|
+
const ref = event.currentTarget;
|
|
91
|
+
const refName = normalizeRefName(ref.dataset.ref);
|
|
92
|
+
const normalizedRefName = normalizeName(refName);
|
|
93
|
+
const normalizedEventName = normalizeName(event.type);
|
|
94
|
+
const method = `on${normalizedRefName}${normalizedEventName}`;
|
|
95
|
+
let index = 0;
|
|
96
|
+
if (isArray(this.__base.$refs[refName])) {
|
|
97
|
+
index = this.__base.$refs[refName].indexOf(ref);
|
|
98
|
+
}
|
|
99
|
+
this.__base[method](event, index);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
__publicField(this, "__childrenHandler", {
|
|
103
|
+
handleEvent: (event) => {
|
|
104
|
+
const childrenManager = this.__base.$children;
|
|
105
|
+
const { name, child: resolvedChild } = childrenManager.registeredNames.map((childName) => ({
|
|
106
|
+
name: childName,
|
|
107
|
+
child: childrenManager[childName].find((instance) => instance === event.currentTarget || instance.$el === event.currentTarget)
|
|
108
|
+
})).find(({ child }) => child);
|
|
109
|
+
const normalizedChildName = normalizeName(name);
|
|
110
|
+
const normalizedEventName = normalizeName(event.type);
|
|
111
|
+
const method = `on${normalizedChildName}${normalizedEventName}`;
|
|
112
|
+
const index = childrenManager[name].indexOf(resolvedChild);
|
|
113
|
+
const args = isArray(event.detail) ? event.detail : [];
|
|
114
|
+
this.__base[method](...args, index, event);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
111
117
|
this.__hideProperties([
|
|
112
118
|
"__methodsCache",
|
|
113
119
|
"__rootElementHandler",
|