@fluixi/dom 1.0.0-alpha.83 → 1.0.0-alpha.85
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/dom-client.cjs +1427 -1
- package/dist/cdn/dom-client.d.ts +2 -2
- package/dist/cdn/dom-client.global.js +2 -1
- package/dist/cdn/dom-client.js +3 -3
- package/dist/cdn/dom-client.mjs +1430 -1
- package/dist/cdn/dom.cjs +3127 -1
- package/dist/cdn/dom.d.ts +2 -2
- package/dist/cdn/dom.global.js +2 -1
- package/dist/cdn/dom.js +4 -4
- package/dist/cdn/dom.mjs +3133 -1
- package/dist/index.cjs +3155 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +3149 -1
- package/dist/lib/component/index.cjs +128 -1
- package/dist/lib/component/index.mjs +105 -1
- package/dist/lib/component/modifiers.cjs +126 -1
- package/dist/lib/component/modifiers.d.ts +12 -0
- package/dist/lib/component/modifiers.d.ts.map +1 -1
- package/dist/lib/component/modifiers.js +12 -84
- package/dist/lib/component/modifiers.mjs +105 -1
- package/dist/lib/dom/delegate.cjs +60 -1
- package/dist/lib/dom/delegate.js +1 -1
- package/dist/lib/dom/delegate.mjs +39 -1
- package/dist/lib/dom/dynamic-element.cjs +949 -1
- package/dist/lib/dom/dynamic-element.d.ts +3 -3
- package/dist/lib/dom/dynamic-element.js +2 -2
- package/dist/lib/dom/dynamic-element.mjs +928 -1
- package/dist/lib/dom/hydration-state.cjs +93 -1
- package/dist/lib/dom/hydration-state.d.ts +1 -1
- package/dist/lib/dom/hydration-state.js +1 -1
- package/dist/lib/dom/hydration-state.mjs +72 -1
- package/dist/lib/dom/hydration.cjs +685 -1
- package/dist/lib/dom/hydration.js +8 -8
- package/dist/lib/dom/hydration.mjs +664 -1
- package/dist/lib/dom/index.cjs +2040 -1
- package/dist/lib/dom/index.js +1 -1
- package/dist/lib/dom/index.mjs +2020 -1
- package/dist/lib/dom/integration.cjs +71 -1
- package/dist/lib/dom/integration.js +3 -3
- package/dist/lib/dom/integration.mjs +51 -1
- package/dist/lib/dom/island.cjs +790 -1
- package/dist/lib/dom/island.d.ts +1 -1
- package/dist/lib/dom/island.js +11 -11
- package/dist/lib/dom/island.mjs +769 -1
- package/dist/lib/dom/runtime.cjs +1432 -1
- package/dist/lib/dom/runtime.d.ts +60 -17
- package/dist/lib/dom/runtime.d.ts.map +1 -1
- package/dist/lib/dom/runtime.js +122 -79
- package/dist/lib/dom/runtime.mjs +1414 -1
- package/dist/lib/dom/server/fx-data.cjs +53 -1
- package/dist/lib/dom/server/fx-data.d.ts +5 -5
- package/dist/lib/dom/server/fx-data.js +6 -6
- package/dist/lib/dom/server/fx-data.mjs +32 -1
- package/dist/lib/dom/server/host.cjs +66 -1
- package/dist/lib/dom/server/host.d.ts +6 -0
- package/dist/lib/dom/server/host.d.ts.map +1 -1
- package/dist/lib/dom/server/host.js +7 -1
- package/dist/lib/dom/server/host.mjs +45 -1
- package/dist/lib/dom/server/index.cjs +759 -1
- package/dist/lib/dom/server/index.d.ts +1 -1
- package/dist/lib/dom/server/index.js +1 -1
- package/dist/lib/dom/server/index.mjs +743 -1
- package/dist/lib/dom/server/nodes.cjs +302 -1
- package/dist/lib/dom/server/nodes.d.ts +2 -2
- package/dist/lib/dom/server/nodes.d.ts.map +1 -1
- package/dist/lib/dom/server/nodes.js +4 -4
- package/dist/lib/dom/server/nodes.mjs +279 -1
- package/dist/lib/dom/server/parse-template.cjs +395 -1
- package/dist/lib/dom/server/parse-template.d.ts +1 -1
- package/dist/lib/dom/server/parse-template.js +4 -4
- package/dist/lib/dom/server/parse-template.mjs +372 -1
- package/dist/lib/dom/server/render.cjs +691 -1
- package/dist/lib/dom/server/render.d.ts +9 -1
- package/dist/lib/dom/server/render.d.ts.map +1 -1
- package/dist/lib/dom/server/render.js +23 -15
- package/dist/lib/dom/server/render.mjs +677 -1
- package/dist/lib/dom/server/request-context.cjs +110 -1
- package/dist/lib/dom/server/request-context.d.ts +29 -9
- package/dist/lib/dom/server/request-context.d.ts.map +1 -1
- package/dist/lib/dom/server/request-context.js +28 -8
- package/dist/lib/dom/server/request-context.mjs +89 -1
- package/dist/lib/dom/server/serialize.cjs +187 -1
- package/dist/lib/dom/server/serialize.js +3 -3
- package/dist/lib/dom/server/serialize.mjs +164 -1
- package/dist/lib/dom/server-renderer.cjs +760 -1
- package/dist/lib/dom/server-renderer.js +1 -1
- package/dist/lib/dom/server-renderer.mjs +745 -1
- package/dist/lib/dom/types.cjs +18 -1
- package/dist/lib/dom/utils.cjs +381 -1
- package/dist/lib/dom/utils.d.ts +1 -88
- package/dist/lib/dom/utils.d.ts.map +1 -1
- package/dist/lib/dom/utils.js +2 -99
- package/dist/lib/dom/utils.mjs +361 -1
- package/dist/lib/dom/versions.cjs +60 -1
- package/dist/lib/dom/versions.d.ts +3 -3
- package/dist/lib/dom/versions.d.ts.map +1 -1
- package/dist/lib/dom/versions.js +17 -5
- package/dist/lib/dom/versions.mjs +37 -1
- package/dist/lib/element/attributes.cjs +19 -1
- package/dist/lib/element/attributes.d.ts +7 -7
- package/dist/lib/element/attributes.js +1 -1
- package/dist/lib/element/attributes.mjs +1 -0
- package/dist/lib/element/index.cjs +19 -1
- package/dist/lib/element/index.mjs +1 -0
- package/dist/lib/element/types.cjs +18 -1
- package/dist/lib/element/types.d.ts +4 -5
- package/dist/lib/element/types.d.ts.map +1 -1
- package/dist/lib/element/types.js +0 -1
- package/dist/lib/flow/class-map.cjs +38 -1
- package/dist/lib/flow/class-map.d.ts +3 -3
- package/dist/lib/flow/class-map.js +2 -2
- package/dist/lib/flow/class-map.mjs +17 -1
- package/dist/lib/flow/client-only.cjs +57 -1
- package/dist/lib/flow/client-only.d.ts +4 -4
- package/dist/lib/flow/client-only.js +3 -3
- package/dist/lib/flow/client-only.mjs +36 -1
- package/dist/lib/flow/dynamic.cjs +53 -1
- package/dist/lib/flow/dynamic.d.ts +2 -2
- package/dist/lib/flow/dynamic.js +3 -3
- package/dist/lib/flow/dynamic.mjs +32 -1
- package/dist/lib/flow/error-boundary.cjs +43 -1
- package/dist/lib/flow/error-boundary.d.ts +2 -2
- package/dist/lib/flow/error-boundary.js +3 -3
- package/dist/lib/flow/error-boundary.mjs +22 -1
- package/dist/lib/flow/for.cjs +66 -1
- package/dist/lib/flow/for.d.ts +9 -9
- package/dist/lib/flow/for.d.ts.map +1 -1
- package/dist/lib/flow/for.js +2 -2
- package/dist/lib/flow/for.mjs +45 -1
- package/dist/lib/flow/index-flow.cjs +67 -1
- package/dist/lib/flow/index-flow.d.ts +5 -5
- package/dist/lib/flow/index-flow.js +4 -4
- package/dist/lib/flow/index-flow.mjs +46 -1
- package/dist/lib/flow/index.cjs +805 -1
- package/dist/lib/flow/index.mjs +792 -1
- package/dist/lib/flow/portal.cjs +538 -1
- package/dist/lib/flow/portal.mjs +519 -1
- package/dist/lib/flow/show.cjs +81 -1
- package/dist/lib/flow/show.d.ts +1 -1
- package/dist/lib/flow/show.d.ts.map +1 -1
- package/dist/lib/flow/show.js +4 -115
- package/dist/lib/flow/show.mjs +67 -1
- package/dist/lib/flow/style-map.cjs +43 -1
- package/dist/lib/flow/style-map.d.ts +3 -3
- package/dist/lib/flow/style-map.js +3 -3
- package/dist/lib/flow/style-map.mjs +22 -1
- package/dist/lib/flow/switch.cjs +91 -1
- package/dist/lib/flow/switch.d.ts +3 -3
- package/dist/lib/flow/switch.d.ts.map +1 -1
- package/dist/lib/flow/switch.js +6 -6
- package/dist/lib/flow/switch.mjs +70 -1
- package/dist/lib/flow/utils.cjs +44 -1
- package/dist/lib/flow/utils.d.ts +1 -1
- package/dist/lib/flow/utils.js +1 -1
- package/dist/lib/flow/utils.mjs +23 -1
- package/dist/lib/html.cjs +32 -1
- package/dist/lib/html.d.ts +6 -6
- package/dist/lib/html.js +5 -5
- package/dist/lib/html.mjs +11 -1
- package/dist/lib/index.cjs +3104 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -3
- package/dist/lib/index.mjs +3097 -1
- package/dist/lib/shared/types.cjs +18 -1
- package/dist/lib/shared/types.d.ts +8 -8
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/version.generated.cjs +26 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +2 -2
- package/dist/version.generated.mjs +5 -1
- package/package.json +7 -6
- package/dist/lib/jsx/control-flow/flow.cjs +0 -1
- package/dist/lib/jsx/control-flow/flow.d.ts +0 -2
- package/dist/lib/jsx/control-flow/flow.d.ts.map +0 -1
- package/dist/lib/jsx/control-flow/flow.js +0 -627
- package/dist/lib/jsx/control-flow/flow.mjs +0 -0
- package/dist/lib/jsx/control-flow/for-flow.cjs +0 -1
- package/dist/lib/jsx/control-flow/for-flow.d.ts +0 -2
- package/dist/lib/jsx/control-flow/for-flow.d.ts.map +0 -1
- package/dist/lib/jsx/control-flow/for-flow.js +0 -1
- package/dist/lib/jsx/control-flow/for-flow.mjs +0 -0
|
@@ -1 +1,128 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/component/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
asComponent: () => asComponent,
|
|
24
|
+
asContext: () => asContext,
|
|
25
|
+
asOutlet: () => asOutlet,
|
|
26
|
+
asProvider: () => asProvider,
|
|
27
|
+
asRoute: () => asRoute,
|
|
28
|
+
asRouter: () => asRouter,
|
|
29
|
+
asRoutes: () => asRoutes,
|
|
30
|
+
asSuspense: () => asSuspense,
|
|
31
|
+
checkRenderType: () => checkRenderType,
|
|
32
|
+
isComponent: () => isComponent,
|
|
33
|
+
isContext: () => isContext,
|
|
34
|
+
isOutlet: () => isOutlet,
|
|
35
|
+
isProvider: () => isProvider,
|
|
36
|
+
isRoute: () => isRoute,
|
|
37
|
+
isRouter: () => isRouter,
|
|
38
|
+
isRoutes: () => isRoutes,
|
|
39
|
+
isSuspense: () => isSuspense
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(index_exports);
|
|
42
|
+
|
|
43
|
+
// src/lib/component/modifiers.ts
|
|
44
|
+
function asRouter(value) {
|
|
45
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-router"), { value: true, enumerable: true });
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
function asRoutes(value) {
|
|
49
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-routes"), { value: true, enumerable: true });
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function asRoute(value) {
|
|
53
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-route"), { value: true, enumerable: true });
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
function asOutlet(value) {
|
|
57
|
+
if (typeof value !== "function") return value;
|
|
58
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-outlet"), { value: true, enumerable: true });
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
function asProvider(value) {
|
|
62
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-provider"), { value: true, enumerable: true });
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
function asContext(value) {
|
|
66
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-context"), { value: true, enumerable: true });
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
function asComponent(value) {
|
|
70
|
+
if (typeof value !== "function") return value;
|
|
71
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-component"), { value: true, enumerable: true });
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
function asSuspense(value) {
|
|
75
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-suspense"), { value: true, enumerable: true });
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
function isRouter(value) {
|
|
79
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-router")] === true;
|
|
80
|
+
}
|
|
81
|
+
function isRoutes(value) {
|
|
82
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-routes")] === true;
|
|
83
|
+
}
|
|
84
|
+
function isRoute(value) {
|
|
85
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-route")] === true;
|
|
86
|
+
}
|
|
87
|
+
function isOutlet(value) {
|
|
88
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-outlet")] === true;
|
|
89
|
+
}
|
|
90
|
+
function isProvider(value) {
|
|
91
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-provider")] === true;
|
|
92
|
+
}
|
|
93
|
+
function isContext(value) {
|
|
94
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-context")] === true;
|
|
95
|
+
}
|
|
96
|
+
function isComponent(value) {
|
|
97
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-component")] === true;
|
|
98
|
+
}
|
|
99
|
+
function isSuspense(value) {
|
|
100
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-suspense")] === true;
|
|
101
|
+
}
|
|
102
|
+
function checkRenderType(value) {
|
|
103
|
+
if (isRouter(value)) {
|
|
104
|
+
return { type: "router", value };
|
|
105
|
+
}
|
|
106
|
+
if (isRoute(value)) {
|
|
107
|
+
return { type: "route", value };
|
|
108
|
+
}
|
|
109
|
+
if (isRoutes(value)) {
|
|
110
|
+
return { type: "routes", value };
|
|
111
|
+
}
|
|
112
|
+
if (isOutlet(value)) {
|
|
113
|
+
return { type: "outlet", value };
|
|
114
|
+
}
|
|
115
|
+
if (isComponent(value)) {
|
|
116
|
+
return { type: "component", value };
|
|
117
|
+
}
|
|
118
|
+
if (isSuspense(value)) {
|
|
119
|
+
return { type: "suspense", value };
|
|
120
|
+
}
|
|
121
|
+
if (isProvider(value)) {
|
|
122
|
+
return { type: "provider", value };
|
|
123
|
+
}
|
|
124
|
+
if (isContext(value)) {
|
|
125
|
+
return { type: "context", value };
|
|
126
|
+
}
|
|
127
|
+
return { type: "none", value };
|
|
128
|
+
}
|
|
@@ -1 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/component/modifiers.ts
|
|
2
|
+
function asRouter(value) {
|
|
3
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-router"), { value: true, enumerable: true });
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
function asRoutes(value) {
|
|
7
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-routes"), { value: true, enumerable: true });
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function asRoute(value) {
|
|
11
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-route"), { value: true, enumerable: true });
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function asOutlet(value) {
|
|
15
|
+
if (typeof value !== "function") return value;
|
|
16
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-outlet"), { value: true, enumerable: true });
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function asProvider(value) {
|
|
20
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-provider"), { value: true, enumerable: true });
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function asContext(value) {
|
|
24
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-context"), { value: true, enumerable: true });
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
function asComponent(value) {
|
|
28
|
+
if (typeof value !== "function") return value;
|
|
29
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-component"), { value: true, enumerable: true });
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function asSuspense(value) {
|
|
33
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-suspense"), { value: true, enumerable: true });
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function isRouter(value) {
|
|
37
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-router")] === true;
|
|
38
|
+
}
|
|
39
|
+
function isRoutes(value) {
|
|
40
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-routes")] === true;
|
|
41
|
+
}
|
|
42
|
+
function isRoute(value) {
|
|
43
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-route")] === true;
|
|
44
|
+
}
|
|
45
|
+
function isOutlet(value) {
|
|
46
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-outlet")] === true;
|
|
47
|
+
}
|
|
48
|
+
function isProvider(value) {
|
|
49
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-provider")] === true;
|
|
50
|
+
}
|
|
51
|
+
function isContext(value) {
|
|
52
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-context")] === true;
|
|
53
|
+
}
|
|
54
|
+
function isComponent(value) {
|
|
55
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-component")] === true;
|
|
56
|
+
}
|
|
57
|
+
function isSuspense(value) {
|
|
58
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-suspense")] === true;
|
|
59
|
+
}
|
|
60
|
+
function checkRenderType(value) {
|
|
61
|
+
if (isRouter(value)) {
|
|
62
|
+
return { type: "router", value };
|
|
63
|
+
}
|
|
64
|
+
if (isRoute(value)) {
|
|
65
|
+
return { type: "route", value };
|
|
66
|
+
}
|
|
67
|
+
if (isRoutes(value)) {
|
|
68
|
+
return { type: "routes", value };
|
|
69
|
+
}
|
|
70
|
+
if (isOutlet(value)) {
|
|
71
|
+
return { type: "outlet", value };
|
|
72
|
+
}
|
|
73
|
+
if (isComponent(value)) {
|
|
74
|
+
return { type: "component", value };
|
|
75
|
+
}
|
|
76
|
+
if (isSuspense(value)) {
|
|
77
|
+
return { type: "suspense", value };
|
|
78
|
+
}
|
|
79
|
+
if (isProvider(value)) {
|
|
80
|
+
return { type: "provider", value };
|
|
81
|
+
}
|
|
82
|
+
if (isContext(value)) {
|
|
83
|
+
return { type: "context", value };
|
|
84
|
+
}
|
|
85
|
+
return { type: "none", value };
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
asComponent,
|
|
89
|
+
asContext,
|
|
90
|
+
asOutlet,
|
|
91
|
+
asProvider,
|
|
92
|
+
asRoute,
|
|
93
|
+
asRouter,
|
|
94
|
+
asRoutes,
|
|
95
|
+
asSuspense,
|
|
96
|
+
checkRenderType,
|
|
97
|
+
isComponent,
|
|
98
|
+
isContext,
|
|
99
|
+
isOutlet,
|
|
100
|
+
isProvider,
|
|
101
|
+
isRoute,
|
|
102
|
+
isRouter,
|
|
103
|
+
isRoutes,
|
|
104
|
+
isSuspense
|
|
105
|
+
};
|
|
@@ -1 +1,126 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/component/modifiers.ts
|
|
21
|
+
var modifiers_exports = {};
|
|
22
|
+
__export(modifiers_exports, {
|
|
23
|
+
asComponent: () => asComponent,
|
|
24
|
+
asContext: () => asContext,
|
|
25
|
+
asOutlet: () => asOutlet,
|
|
26
|
+
asProvider: () => asProvider,
|
|
27
|
+
asRoute: () => asRoute,
|
|
28
|
+
asRouter: () => asRouter,
|
|
29
|
+
asRoutes: () => asRoutes,
|
|
30
|
+
asSuspense: () => asSuspense,
|
|
31
|
+
checkRenderType: () => checkRenderType,
|
|
32
|
+
isComponent: () => isComponent,
|
|
33
|
+
isContext: () => isContext,
|
|
34
|
+
isOutlet: () => isOutlet,
|
|
35
|
+
isProvider: () => isProvider,
|
|
36
|
+
isRoute: () => isRoute,
|
|
37
|
+
isRouter: () => isRouter,
|
|
38
|
+
isRoutes: () => isRoutes,
|
|
39
|
+
isSuspense: () => isSuspense
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(modifiers_exports);
|
|
42
|
+
function asRouter(value) {
|
|
43
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-router"), { value: true, enumerable: true });
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
function asRoutes(value) {
|
|
47
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-routes"), { value: true, enumerable: true });
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
function asRoute(value) {
|
|
51
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-route"), { value: true, enumerable: true });
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function asOutlet(value) {
|
|
55
|
+
if (typeof value !== "function") return value;
|
|
56
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-outlet"), { value: true, enumerable: true });
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
function asProvider(value) {
|
|
60
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-provider"), { value: true, enumerable: true });
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
function asContext(value) {
|
|
64
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-context"), { value: true, enumerable: true });
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
function asComponent(value) {
|
|
68
|
+
if (typeof value !== "function") return value;
|
|
69
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-component"), { value: true, enumerable: true });
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
function asSuspense(value) {
|
|
73
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-suspense"), { value: true, enumerable: true });
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
function isRouter(value) {
|
|
77
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-router")] === true;
|
|
78
|
+
}
|
|
79
|
+
function isRoutes(value) {
|
|
80
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-routes")] === true;
|
|
81
|
+
}
|
|
82
|
+
function isRoute(value) {
|
|
83
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-route")] === true;
|
|
84
|
+
}
|
|
85
|
+
function isOutlet(value) {
|
|
86
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-outlet")] === true;
|
|
87
|
+
}
|
|
88
|
+
function isProvider(value) {
|
|
89
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-provider")] === true;
|
|
90
|
+
}
|
|
91
|
+
function isContext(value) {
|
|
92
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-context")] === true;
|
|
93
|
+
}
|
|
94
|
+
function isComponent(value) {
|
|
95
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-component")] === true;
|
|
96
|
+
}
|
|
97
|
+
function isSuspense(value) {
|
|
98
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-suspense")] === true;
|
|
99
|
+
}
|
|
100
|
+
function checkRenderType(value) {
|
|
101
|
+
if (isRouter(value)) {
|
|
102
|
+
return { type: "router", value };
|
|
103
|
+
}
|
|
104
|
+
if (isRoute(value)) {
|
|
105
|
+
return { type: "route", value };
|
|
106
|
+
}
|
|
107
|
+
if (isRoutes(value)) {
|
|
108
|
+
return { type: "routes", value };
|
|
109
|
+
}
|
|
110
|
+
if (isOutlet(value)) {
|
|
111
|
+
return { type: "outlet", value };
|
|
112
|
+
}
|
|
113
|
+
if (isComponent(value)) {
|
|
114
|
+
return { type: "component", value };
|
|
115
|
+
}
|
|
116
|
+
if (isSuspense(value)) {
|
|
117
|
+
return { type: "suspense", value };
|
|
118
|
+
}
|
|
119
|
+
if (isProvider(value)) {
|
|
120
|
+
return { type: "provider", value };
|
|
121
|
+
}
|
|
122
|
+
if (isContext(value)) {
|
|
123
|
+
return { type: "context", value };
|
|
124
|
+
}
|
|
125
|
+
return { type: "none", value };
|
|
126
|
+
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brands on a function, and the guards that read them back.
|
|
3
|
+
*
|
|
4
|
+
* The runtime has to know what a value is before it calls it. A router has to be entered
|
|
5
|
+
* differently from a provider, and a provider's children have to be read under its own
|
|
6
|
+
* owner, so `insert` and `createComponent` ask before dispatching. None of that is
|
|
7
|
+
* inferable from a function, which is why each `as*` stamps a registry symbol and the
|
|
8
|
+
* matching `is*` tests for it.
|
|
9
|
+
*
|
|
10
|
+
* `Symbol.for` rather than a local symbol, so two bundled copies of this module agree.
|
|
11
|
+
* That is the same reason the reactive graph brands its nodes that way.
|
|
12
|
+
*/
|
|
1
13
|
export declare function asRouter(value: any): any;
|
|
2
14
|
export declare function asRoutes(value: any): any;
|
|
3
15
|
export declare function asRoute(value: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../../src/lib/component/modifiers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modifiers.d.ts","sourceRoot":"","sources":["../../../src/lib/component/modifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,OAGlC;AACD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,OAGlC;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,OAGjC;AACD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,OAIlC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,OAGpC;AACD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,OAGnC;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,OAIrC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,OAGpC;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,WAElC;AACD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,WAElC;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,WAEjC;AACD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,GAAG,WAElC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,WAEpC;AACD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,WAEnC;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,WAErC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,WAEpC;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG;IAC3C,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;IAC5G,KAAK,EAAE,GAAG,CAAA;CACX,CA0BA"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Brands on a function, and the guards that read them back.
|
|
3
|
+
*
|
|
4
|
+
* The runtime has to know what a value is before it calls it. A router has to be entered
|
|
5
|
+
* differently from a provider, and a provider's children have to be read under its own
|
|
6
|
+
* owner, so `insert` and `createComponent` ask before dispatching. None of that is
|
|
7
|
+
* inferable from a function, which is why each `as*` stamps a registry symbol and the
|
|
8
|
+
* matching `is*` tests for it.
|
|
9
|
+
*
|
|
10
|
+
* `Symbol.for` rather than a local symbol, so two bundled copies of this module agree.
|
|
11
|
+
* That is the same reason the reactive graph brands its nodes that way.
|
|
12
|
+
*/
|
|
4
13
|
export function asRouter(value) {
|
|
5
14
|
Object.defineProperty(value, Symbol.for('fluixi-router'), { value: true, enumerable: true });
|
|
6
15
|
return value;
|
|
@@ -88,84 +97,3 @@ export function checkRenderType(value) {
|
|
|
88
97
|
}
|
|
89
98
|
return { type: 'none', value };
|
|
90
99
|
}
|
|
91
|
-
// export const DEV =
|
|
92
|
-
// typeof process !== 'undefined' && process.env?.NODE_ENV === 'development';
|
|
93
|
-
// /**
|
|
94
|
-
// * Component props type
|
|
95
|
-
// */
|
|
96
|
-
// export interface ComponentProps {
|
|
97
|
-
// children?: any;
|
|
98
|
-
// [key: string]: any;
|
|
99
|
-
// }
|
|
100
|
-
// /**
|
|
101
|
-
// * Component function type
|
|
102
|
-
// */
|
|
103
|
-
// export type Component<P = ComponentProps> = (props: P) => any;
|
|
104
|
-
// /**
|
|
105
|
-
// * Create and execute a component
|
|
106
|
-
// *
|
|
107
|
-
// * Section 2 — createComponent responsibilities:
|
|
108
|
-
// * - Create Owner ✓
|
|
109
|
-
// * - Untrack execution ✓
|
|
110
|
-
// * - Capture output ✓
|
|
111
|
-
// * - Lazy children ✓
|
|
112
|
-
// * - Context propagation ✓ (via reactive system)
|
|
113
|
-
// * - Cleanup attachment ✓
|
|
114
|
-
// *
|
|
115
|
-
// * Section 1: Components execute once, never re-execute
|
|
116
|
-
// *
|
|
117
|
-
// * @template P - Props type
|
|
118
|
-
// * @param {Component<P>} Comp - Component function
|
|
119
|
-
// * @param {P} props - Component props
|
|
120
|
-
// * @returns {any} Component output
|
|
121
|
-
// *
|
|
122
|
-
// * @example
|
|
123
|
-
// * ```typescript
|
|
124
|
-
// * const MyComponent = (props: { name: string }) => {
|
|
125
|
-
// * return html`<div>Hello ${props.name}</div>`;
|
|
126
|
-
// * };
|
|
127
|
-
// *
|
|
128
|
-
// * const result = createComponent(MyComponent, { name: 'World' });
|
|
129
|
-
// * ```
|
|
130
|
-
// */
|
|
131
|
-
// export function createComponent<P extends ComponentProps>(
|
|
132
|
-
// Comp: Component<P>,
|
|
133
|
-
// props: P
|
|
134
|
-
// ): any {
|
|
135
|
-
// // Section 1: Component is a plain function
|
|
136
|
-
// if (typeof Comp !== 'function') {
|
|
137
|
-
// return Comp;
|
|
138
|
-
// }
|
|
139
|
-
// // Section 3: Make children lazy
|
|
140
|
-
// if (props && 'children' in props) {
|
|
141
|
-
// const children = props.children;
|
|
142
|
-
// // Already lazy, keep as is
|
|
143
|
-
// if (typeof children === 'function') {
|
|
144
|
-
// // Children are already a function
|
|
145
|
-
// } else {
|
|
146
|
-
// // Make children lazy by wrapping in getter
|
|
147
|
-
// Object.defineProperty(props, 'children', {
|
|
148
|
-
// get() {
|
|
149
|
-
// return typeof children === 'function' ? children : () => children;
|
|
150
|
-
// },
|
|
151
|
-
// enumerable: true,
|
|
152
|
-
// configurable: true,
|
|
153
|
-
// });
|
|
154
|
-
// }
|
|
155
|
-
// }
|
|
156
|
-
// // DEV mode: Mark component for debugging
|
|
157
|
-
// if (DEV && Comp.name) {
|
|
158
|
-
// try {
|
|
159
|
-
// (props as any).__componentName = Comp.name;
|
|
160
|
-
// } catch (e) {
|
|
161
|
-
// // Silently fail if props is frozen
|
|
162
|
-
// }
|
|
163
|
-
// }
|
|
164
|
-
// // Section 2: Untrack execution - component doesn't track parent dependencies
|
|
165
|
-
// // Section 1: Execute once, never re-execute
|
|
166
|
-
// return untrack(() => {
|
|
167
|
-
// // Section 2: Execute component in untracked context
|
|
168
|
-
// // The component function runs once and constructs the reactive graph
|
|
169
|
-
// return Comp(props);
|
|
170
|
-
// });
|
|
171
|
-
// }
|
|
@@ -1 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
// src/lib/component/modifiers.ts
|
|
2
|
+
function asRouter(value) {
|
|
3
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-router"), { value: true, enumerable: true });
|
|
4
|
+
return value;
|
|
5
|
+
}
|
|
6
|
+
function asRoutes(value) {
|
|
7
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-routes"), { value: true, enumerable: true });
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function asRoute(value) {
|
|
11
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-route"), { value: true, enumerable: true });
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function asOutlet(value) {
|
|
15
|
+
if (typeof value !== "function") return value;
|
|
16
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-outlet"), { value: true, enumerable: true });
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function asProvider(value) {
|
|
20
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-provider"), { value: true, enumerable: true });
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function asContext(value) {
|
|
24
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-context"), { value: true, enumerable: true });
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
function asComponent(value) {
|
|
28
|
+
if (typeof value !== "function") return value;
|
|
29
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-component"), { value: true, enumerable: true });
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function asSuspense(value) {
|
|
33
|
+
Object.defineProperty(value, /* @__PURE__ */ Symbol.for("fluixi-suspense"), { value: true, enumerable: true });
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function isRouter(value) {
|
|
37
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-router")] === true;
|
|
38
|
+
}
|
|
39
|
+
function isRoutes(value) {
|
|
40
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-routes")] === true;
|
|
41
|
+
}
|
|
42
|
+
function isRoute(value) {
|
|
43
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-route")] === true;
|
|
44
|
+
}
|
|
45
|
+
function isOutlet(value) {
|
|
46
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-outlet")] === true;
|
|
47
|
+
}
|
|
48
|
+
function isProvider(value) {
|
|
49
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-provider")] === true;
|
|
50
|
+
}
|
|
51
|
+
function isContext(value) {
|
|
52
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-context")] === true;
|
|
53
|
+
}
|
|
54
|
+
function isComponent(value) {
|
|
55
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-component")] === true;
|
|
56
|
+
}
|
|
57
|
+
function isSuspense(value) {
|
|
58
|
+
return typeof value === "function" && value[/* @__PURE__ */ Symbol.for("fluixi-suspense")] === true;
|
|
59
|
+
}
|
|
60
|
+
function checkRenderType(value) {
|
|
61
|
+
if (isRouter(value)) {
|
|
62
|
+
return { type: "router", value };
|
|
63
|
+
}
|
|
64
|
+
if (isRoute(value)) {
|
|
65
|
+
return { type: "route", value };
|
|
66
|
+
}
|
|
67
|
+
if (isRoutes(value)) {
|
|
68
|
+
return { type: "routes", value };
|
|
69
|
+
}
|
|
70
|
+
if (isOutlet(value)) {
|
|
71
|
+
return { type: "outlet", value };
|
|
72
|
+
}
|
|
73
|
+
if (isComponent(value)) {
|
|
74
|
+
return { type: "component", value };
|
|
75
|
+
}
|
|
76
|
+
if (isSuspense(value)) {
|
|
77
|
+
return { type: "suspense", value };
|
|
78
|
+
}
|
|
79
|
+
if (isProvider(value)) {
|
|
80
|
+
return { type: "provider", value };
|
|
81
|
+
}
|
|
82
|
+
if (isContext(value)) {
|
|
83
|
+
return { type: "context", value };
|
|
84
|
+
}
|
|
85
|
+
return { type: "none", value };
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
asComponent,
|
|
89
|
+
asContext,
|
|
90
|
+
asOutlet,
|
|
91
|
+
asProvider,
|
|
92
|
+
asRoute,
|
|
93
|
+
asRouter,
|
|
94
|
+
asRoutes,
|
|
95
|
+
asSuspense,
|
|
96
|
+
checkRenderType,
|
|
97
|
+
isComponent,
|
|
98
|
+
isContext,
|
|
99
|
+
isOutlet,
|
|
100
|
+
isProvider,
|
|
101
|
+
isRoute,
|
|
102
|
+
isRouter,
|
|
103
|
+
isRoutes,
|
|
104
|
+
isSuspense
|
|
105
|
+
};
|
|
@@ -1 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/dom/delegate.ts
|
|
21
|
+
var delegate_exports = {};
|
|
22
|
+
__export(delegate_exports, {
|
|
23
|
+
addDelegatedEventListener: () => addDelegatedEventListener,
|
|
24
|
+
delegateEvents: () => delegateEvents,
|
|
25
|
+
isDelegatedEvent: () => isDelegatedEvent,
|
|
26
|
+
removeDelegatedEventListener: () => removeDelegatedEventListener
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(delegate_exports);
|
|
29
|
+
var delegatedEvents = /* @__PURE__ */ new Set();
|
|
30
|
+
var NON_DELEGATED = /* @__PURE__ */ new Set([
|
|
31
|
+
"scroll",
|
|
32
|
+
"focus",
|
|
33
|
+
"blur"
|
|
34
|
+
]);
|
|
35
|
+
function delegateEvents(eventNames) {
|
|
36
|
+
for (const name of eventNames) {
|
|
37
|
+
if (delegatedEvents.has(name) || NON_DELEGATED.has(name)) continue;
|
|
38
|
+
delegatedEvents.add(name);
|
|
39
|
+
document.addEventListener(name, (event) => {
|
|
40
|
+
let node = event.target;
|
|
41
|
+
while (node && node !== document.documentElement) {
|
|
42
|
+
const handler = node["$$" + name];
|
|
43
|
+
if (handler) {
|
|
44
|
+
handler.call(node, event);
|
|
45
|
+
}
|
|
46
|
+
node = node.parentNode;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function addDelegatedEventListener(element, name, handler) {
|
|
52
|
+
element["$$" + name] = handler;
|
|
53
|
+
delegateEvents([name]);
|
|
54
|
+
}
|
|
55
|
+
function removeDelegatedEventListener(element, name) {
|
|
56
|
+
delete element["$$" + name];
|
|
57
|
+
}
|
|
58
|
+
function isDelegatedEvent(name) {
|
|
59
|
+
return !NON_DELEGATED.has(name);
|
|
60
|
+
}
|