miqro 6.2.13 → 7.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/README.md +9 -17
- package/build/editor.bundle.js +11601 -10129
- package/build/esm/src/bin/types.js +10 -5
- package/build/esm/src/cluster.js +1 -1
- package/build/esm/src/common/arguments.d.ts +2 -1
- package/build/esm/src/common/arguments.js +42 -18
- package/build/esm/src/common/assets.d.ts +1 -1
- package/build/esm/src/common/assets.js +34 -13
- package/build/esm/src/common/esbuild.d.ts +4 -1
- package/build/esm/src/common/esbuild.js +31 -26
- package/build/esm/src/common/exit.js +4 -4
- package/build/esm/src/common/help.d.ts +1 -1
- package/build/esm/src/common/help.js +2 -2
- package/build/esm/src/common/jsx.d.ts +2 -3
- package/build/esm/src/common/jsx.js +70 -75
- package/build/esm/src/common/paths.d.ts +0 -1
- package/build/esm/src/common/paths.js +3 -3
- package/build/esm/src/common/watch.d.ts +0 -1
- package/build/esm/src/common/watch.js +4 -1
- package/build/esm/src/inflate/inflate-sea.js +35 -24
- package/build/esm/src/inflate/inflate.js +4 -4
- package/build/esm/src/inflate/setup-auth.js +1 -1
- package/build/esm/src/inflate/setup-cors.js +1 -1
- package/build/esm/src/inflate/setup-db.js +2 -2
- package/build/esm/src/inflate/setup-error.js +1 -1
- package/build/esm/src/inflate/setup-http.js +16 -16
- package/build/esm/src/inflate/setup-log.js +1 -1
- package/build/esm/src/inflate/setup-middleware.js +1 -1
- package/build/esm/src/inflate/setup-server-config.js +1 -1
- package/build/esm/src/inflate/setup-ws.js +1 -1
- package/build/esm/src/inflate/setup.doc.d.ts +2 -2
- package/build/esm/src/inflate/setup.doc.js +23 -2
- package/build/esm/src/inflate/utils/sea-utils.js +2 -2
- package/build/esm/src/lib.d.ts +10 -1
- package/build/esm/src/lib.js +16 -1
- package/build/esm/src/main.js +2 -1
- package/build/esm/src/services/app.d.ts +1 -0
- package/build/esm/src/services/app.js +4 -5
- package/build/esm/src/services/migrations.js +2 -2
- package/build/esm/src/services/utils/jwt.d.ts +2 -0
- package/build/esm/src/services/utils/jwt.js +23 -0
- package/build/esm/src/services/utils/middleware.d.ts +9 -0
- package/build/esm/src/services/utils/middleware.js +9 -0
- package/build/esm/src/services/utils/server-interface.js +33 -4
- package/build/esm/src/types.d.ts +50 -83
- package/build/lib.cjs +15694 -15619
- package/package.json +6 -8
- package/sea/basic-compile.base64.sh +1 -1
- package/sea/basic-compile.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/.eslintrc +0 -15
- package/build/esm/editor/auth.d.ts +0 -6
- package/build/esm/editor/auth.js +0 -41
- package/build/esm/editor/common/admin-interface.d.ts +0 -36
- package/build/esm/editor/common/admin-interface.js +0 -44
- package/build/esm/editor/common/constants.d.ts +0 -4
- package/build/esm/editor/common/constants.js +0 -20
- package/build/esm/editor/common/constants.server.d.ts +0 -2
- package/build/esm/editor/common/constants.server.js +0 -4
- package/build/esm/editor/common/editor-index.d.ts +0 -2
- package/build/esm/editor/common/editor-index.js +0 -14
- package/build/esm/editor/common/html-encode.d.ts +0 -1
- package/build/esm/editor/common/html-encode.js +0 -14
- package/build/esm/editor/common/log-socket.d.ts +0 -15
- package/build/esm/editor/common/log-socket.js +0 -70
- package/build/esm/editor/common/templates.d.ts +0 -11
- package/build/esm/editor/common/templates.js +0 -477
- package/build/esm/editor/components/api-preview.d.ts +0 -11
- package/build/esm/editor/components/api-preview.js +0 -90
- package/build/esm/editor/components/editor.d.ts +0 -16
- package/build/esm/editor/components/editor.js +0 -365
- package/build/esm/editor/components/file-browser.d.ts +0 -37
- package/build/esm/editor/components/file-browser.js +0 -126
- package/build/esm/editor/components/file-editor-toolbar.d.ts +0 -22
- package/build/esm/editor/components/file-editor-toolbar.js +0 -93
- package/build/esm/editor/components/file-editor.d.ts +0 -32
- package/build/esm/editor/components/file-editor.js +0 -59
- package/build/esm/editor/components/filter-query.d.ts +0 -1
- package/build/esm/editor/components/filter-query.js +0 -22
- package/build/esm/editor/components/highlight-text-area.d.ts +0 -11
- package/build/esm/editor/components/highlight-text-area.js +0 -125
- package/build/esm/editor/components/log-viewer.d.ts +0 -6
- package/build/esm/editor/components/log-viewer.js +0 -69
- package/build/esm/editor/components/new-file.d.ts +0 -10
- package/build/esm/editor/components/new-file.js +0 -117
- package/build/esm/editor/components/scroll-query.d.ts +0 -7
- package/build/esm/editor/components/scroll-query.js +0 -21
- package/build/esm/editor/components/start-page.d.ts +0 -13
- package/build/esm/editor/components/start-page.js +0 -30
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +0 -3
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +0 -29
- package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +0 -5
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +0 -49
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +0 -4
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +0 -39
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +0 -26
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +0 -149
- package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +0 -3
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js +0 -38
- package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +0 -10
- package/build/esm/editor/http/admin/editor/api/server/reload.api.js +0 -46
- package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +0 -10
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js +0 -45
- package/build/esm/editor/http/admin/editor/editor.d.ts +0 -1
- package/build/esm/editor/http/admin/editor/editor.js +0 -7
- package/build/esm/editor/http/admin/editor/index.api.d.ts +0 -3
- package/build/esm/editor/http/admin/editor/index.api.js +0 -21
- package/build/esm/editor/server.d.ts +0 -3
- package/build/esm/editor/server.js +0 -49
- package/build/esm/editor/ws.d.ts +0 -3
- package/build/esm/editor/ws.js +0 -11
- package/build/esm/src/services/globals.d.ts +0 -3
- package/build/esm/src/services/globals.js +0 -182
- package/build/jsx.dom.js +0 -1587
- package/build/postject.base64.cjs +0 -1
- package/editor/auth.ts +0 -51
- package/editor/common/admin-interface.ts +0 -84
- package/editor/common/constants.server.ts +0 -5
- package/editor/common/constants.ts +0 -21
- package/editor/common/editor-index.tsx +0 -17
- package/editor/common/html-encode.ts +0 -14
- package/editor/common/log-socket.tsx +0 -85
- package/editor/common/templates.ts +0 -481
- package/editor/components/api-preview.tsx +0 -116
- package/editor/components/editor.tsx +0 -494
- package/editor/components/file-browser.tsx +0 -308
- package/editor/components/file-editor-toolbar.tsx +0 -191
- package/editor/components/file-editor.tsx +0 -122
- package/editor/components/filter-query.tsx +0 -22
- package/editor/components/highlight-text-area.tsx +0 -145
- package/editor/components/log-viewer.tsx +0 -110
- package/editor/components/new-file.tsx +0 -169
- package/editor/components/scroll-query.tsx +0 -22
- package/editor/components/start-page.tsx +0 -49
- package/editor/http/admin/editor/api/fs/delete.api.tsx +0 -32
- package/editor/http/admin/editor/api/fs/read.api.tsx +0 -55
- package/editor/http/admin/editor/api/fs/rename.api.tsx +0 -41
- package/editor/http/admin/editor/api/fs/scan.api.tsx +0 -181
- package/editor/http/admin/editor/api/fs/write.api.tsx +0 -41
- package/editor/http/admin/editor/api/server/reload.api.ts +0 -53
- package/editor/http/admin/editor/api/server/restart.api.tsx +0 -52
- package/editor/http/admin/editor/editor.tsx +0 -8
- package/editor/http/admin/editor/index.api.tsx +0 -39
- package/editor/server.ts +0 -57
- package/editor/ws.ts +0 -15
- package/sea/types.json +0 -1
- package/src/bin/compile.ts +0 -35
- package/src/bin/doc-md.ts +0 -210
- package/src/bin/generate-doc.ts +0 -64
- package/src/bin/test.ts +0 -92
- package/src/bin/types.ts +0 -29
- package/src/cluster.ts +0 -27
- package/src/common/arguments.ts +0 -733
- package/src/common/assets.ts +0 -128
- package/src/common/checksum.ts +0 -58
- package/src/common/constants.ts +0 -18
- package/src/common/content-type.ts +0 -84
- package/src/common/esbuild.ts +0 -94
- package/src/common/exit.ts +0 -91
- package/src/common/fs.ts +0 -82
- package/src/common/help.ts +0 -60
- package/src/common/jsx.ts +0 -547
- package/src/common/jwt.ts +0 -85
- package/src/common/paths.ts +0 -107
- package/src/common/watch.ts +0 -85
- package/src/inflate/inflate-sea.ts +0 -226
- package/src/inflate/inflate.ts +0 -101
- package/src/inflate/md.ts +0 -25
- package/src/inflate/setup-auth.ts +0 -41
- package/src/inflate/setup-cors.ts +0 -41
- package/src/inflate/setup-db.ts +0 -117
- package/src/inflate/setup-error.ts +0 -44
- package/src/inflate/setup-http.ts +0 -704
- package/src/inflate/setup-log.ts +0 -45
- package/src/inflate/setup-middleware.ts +0 -47
- package/src/inflate/setup-server-config.ts +0 -48
- package/src/inflate/setup-test.ts +0 -23
- package/src/inflate/setup-ws.ts +0 -50
- package/src/inflate/setup.doc.ts +0 -68
- package/src/inflate/utils/sea-utils.ts +0 -14
- package/src/lib.ts +0 -19
- package/src/main.ts +0 -100
- package/src/services/app.ts +0 -698
- package/src/services/editor.tsx +0 -101
- package/src/services/globals.ts +0 -186
- package/src/services/hot-reload.ts +0 -51
- package/src/services/migrations.ts +0 -68
- package/src/services/utils/admin-interface.ts +0 -37
- package/src/services/utils/cache.ts +0 -88
- package/src/services/utils/cluster-cache.ts +0 -230
- package/src/services/utils/cluster-ws.ts +0 -202
- package/src/services/utils/db-manager.ts +0 -92
- package/src/services/utils/get-route.ts +0 -70
- package/src/services/utils/log-transport.ts +0 -81
- package/src/services/utils/log.ts +0 -92
- package/src/services/utils/server-interface.ts +0 -92
- package/src/services/utils/websocketmanager.ts +0 -157
- package/src/types/@esbuild.d.ts +0 -1
- package/src/types/@miqro/core.d.ts +0 -2
- package/src/types/@miqro/jsx.d.ts +0 -2
- package/src/types/@miqro/parser.d.ts +0 -2
- package/src/types/@miqro/query.d.ts +0 -2
- package/src/types/@miqro/request.d.ts +0 -2
- package/src/types/@miqro/test.d.ts +0 -2
- package/src/types/@miqro.d.ts +0 -1
- package/src/types/@types.d.ts +0 -1
- package/src/types/browser.globals.d.ts +0 -1
- package/src/types/cookie.d.ts +0 -2
- package/src/types/globals.d.ts +0 -2
- package/src/types/jose.d.ts +0 -2
- package/src/types/jsx.globals.d.ts +0 -38
- package/src/types/miqro.d.ts +0 -228
- package/src/types/postject.d.ts +0 -1
- package/src/types/server.globals.d.ts +0 -47
- package/src/types.ts +0 -304
- package/tsconfig.json +0 -35
package/build/jsx.dom.js
DELETED
|
@@ -1,1587 +0,0 @@
|
|
|
1
|
-
// node_modules/@miqro/jsx/build/esm/vdom/log.js
|
|
2
|
-
var debugLogEnabled = false;
|
|
3
|
-
function debug(runtime2, message, ...args) {
|
|
4
|
-
if (debugLogEnabled) {
|
|
5
|
-
runtime2.consoleLog(message, ...args);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
function error(runtime2, message, ...args) {
|
|
9
|
-
runtime2.consoleError(message, ...args);
|
|
10
|
-
}
|
|
11
|
-
function enableDebugLog() {
|
|
12
|
-
debugLogEnabled = true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// node_modules/@miqro/jsx/build/esm/vdom/actions.js
|
|
16
|
-
function createAppendAction(node, runtime2) {
|
|
17
|
-
return {
|
|
18
|
-
isDestructive: true,
|
|
19
|
-
execute: () => {
|
|
20
|
-
const parent = node.parent;
|
|
21
|
-
const nodeRef = node.ref;
|
|
22
|
-
let changes = 0;
|
|
23
|
-
if (parent) {
|
|
24
|
-
debug(runtime2, "%s.children.add(%s)", parent.getName(), node.getName());
|
|
25
|
-
parent.children.add(node);
|
|
26
|
-
if (nodeRef) {
|
|
27
|
-
let currentParent = parent;
|
|
28
|
-
if (currentParent.ref) {
|
|
29
|
-
debug(runtime2, "%s.appendChild(%s)", currentParent.getName(), node.getName());
|
|
30
|
-
if (currentParent.state?.shadowRoot) {
|
|
31
|
-
currentParent.state.shadowRoot.appendChild(nodeRef);
|
|
32
|
-
} else {
|
|
33
|
-
currentParent.ref.appendChild(nodeRef);
|
|
34
|
-
}
|
|
35
|
-
changes++;
|
|
36
|
-
return changes;
|
|
37
|
-
} else {
|
|
38
|
-
while (currentParent !== null) {
|
|
39
|
-
currentParent = currentParent.parent;
|
|
40
|
-
if (currentParent && currentParent.ref) {
|
|
41
|
-
debug(runtime2, "%s.appendChild(%s)", currentParent.getName(), node.getName());
|
|
42
|
-
if (currentParent.state?.shadowRoot) {
|
|
43
|
-
currentParent.state.shadowRoot.appendChild(nodeRef);
|
|
44
|
-
} else {
|
|
45
|
-
currentParent.ref.appendChild(nodeRef);
|
|
46
|
-
}
|
|
47
|
-
changes++;
|
|
48
|
-
return changes;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
return changes;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
throw new Error("cannot find real parent(3)");
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function createRemoveAttributesAction(node, toRemove, runtime2) {
|
|
61
|
-
return {
|
|
62
|
-
execute: () => {
|
|
63
|
-
const ref = node.ref;
|
|
64
|
-
let changes = 0;
|
|
65
|
-
if (ref) {
|
|
66
|
-
const element = ref;
|
|
67
|
-
for (const name of toRemove) {
|
|
68
|
-
debug(runtime2, "%s.removeAttribute(%s)", node.getName(), name);
|
|
69
|
-
element.removeAttribute(name);
|
|
70
|
-
changes++;
|
|
71
|
-
if (name === "checked") {
|
|
72
|
-
debug(runtime2, "%s.%s=...", node.getName(), "checked");
|
|
73
|
-
element.checked = false;
|
|
74
|
-
changes++;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return changes;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function createSetAttributesAction(node, toSet, runtime2) {
|
|
83
|
-
return {
|
|
84
|
-
execute: () => {
|
|
85
|
-
const ref = node.ref;
|
|
86
|
-
let changes = 0;
|
|
87
|
-
if (ref) {
|
|
88
|
-
const element = ref;
|
|
89
|
-
for (const s of toSet) {
|
|
90
|
-
if (s.name === "className") {
|
|
91
|
-
s.name = "class";
|
|
92
|
-
}
|
|
93
|
-
debug(runtime2, "%s.setAttribute(%s, ...)", node.getName(), s.name);
|
|
94
|
-
element.setAttribute(s.name, s.value);
|
|
95
|
-
changes++;
|
|
96
|
-
if (s.name === "value") {
|
|
97
|
-
debug(runtime2, "%s.%s=...", node.getName(), s.name);
|
|
98
|
-
element.value = s.value;
|
|
99
|
-
changes++;
|
|
100
|
-
} else if (s.name === "checked") {
|
|
101
|
-
debug(runtime2, "%s.%s=...", node.getName(), s.name);
|
|
102
|
-
element.checked = true;
|
|
103
|
-
changes++;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return changes;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function createFlushEffects(node, options, runtime2) {
|
|
112
|
-
return {
|
|
113
|
-
postExecute: () => {
|
|
114
|
-
const meta = node.state;
|
|
115
|
-
const func = node.component;
|
|
116
|
-
const changes = 0;
|
|
117
|
-
if (func && meta) {
|
|
118
|
-
debug(runtime2, "flush effects callbacks for [%s]", node.getName());
|
|
119
|
-
flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime2);
|
|
120
|
-
debug(runtime2, "flush effects for [%s]", node.getName());
|
|
121
|
-
flushEffects(meta.effects, meta.effectQueueCallbacks, options.disableEffects, runtime2);
|
|
122
|
-
}
|
|
123
|
-
return changes;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function createFlushEffectsRemove(node, options, runtime2) {
|
|
128
|
-
return {
|
|
129
|
-
execute: () => {
|
|
130
|
-
const meta = node.state;
|
|
131
|
-
const changes = 0;
|
|
132
|
-
if (node.component && meta) {
|
|
133
|
-
debug(runtime2, "flush effects callbacks for [%s]", node.getName());
|
|
134
|
-
flushEffectCallbacks(meta.effectCallbacks, options.disableEffects, runtime2);
|
|
135
|
-
debug(runtime2, "flush effects for [%s]", node.getName());
|
|
136
|
-
flushEffectCallbacks(meta.effectQueueCallbacks, options.disableEffects, runtime2);
|
|
137
|
-
}
|
|
138
|
-
return changes;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
function flushEffectCallbacks(callbacks, disableEffects, runtime2) {
|
|
143
|
-
const keys = Object.keys(callbacks);
|
|
144
|
-
for (const key of keys) {
|
|
145
|
-
if (!disableEffects) {
|
|
146
|
-
try {
|
|
147
|
-
callbacks[key]();
|
|
148
|
-
} catch (e) {
|
|
149
|
-
error(runtime2, e);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
delete callbacks[key];
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function flushEffects(effects, callbacks, disableEffects, runtime2) {
|
|
156
|
-
const keys = Object.keys(effects);
|
|
157
|
-
for (const key of keys) {
|
|
158
|
-
if (!disableEffects) {
|
|
159
|
-
try {
|
|
160
|
-
const callback = effects[key]();
|
|
161
|
-
if (callback) {
|
|
162
|
-
callbacks[key] = callback;
|
|
163
|
-
}
|
|
164
|
-
} catch (e) {
|
|
165
|
-
error(runtime2, e);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
delete effects[key];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function createRemoveListeners(node, runtime2) {
|
|
172
|
-
return {
|
|
173
|
-
execute: () => {
|
|
174
|
-
const ref = node.ref;
|
|
175
|
-
let changes = 0;
|
|
176
|
-
if (!ref) {
|
|
177
|
-
throw new Error("cannot update listeners without a ref");
|
|
178
|
-
}
|
|
179
|
-
const element = ref;
|
|
180
|
-
for (const listener of node.currentEventListeners) {
|
|
181
|
-
debug(runtime2, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
|
|
182
|
-
element.removeEventListener(listener.eventName, listener.listener);
|
|
183
|
-
changes++;
|
|
184
|
-
}
|
|
185
|
-
node.currentEventListeners = [];
|
|
186
|
-
return changes;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function createUpdateListeners(node, listeners, runtime2) {
|
|
191
|
-
return {
|
|
192
|
-
execute: () => {
|
|
193
|
-
const ref = node.ref;
|
|
194
|
-
let changes = 0;
|
|
195
|
-
if (!ref) {
|
|
196
|
-
throw new Error("cannot update listeners without a ref");
|
|
197
|
-
}
|
|
198
|
-
const element = ref;
|
|
199
|
-
for (const listener of node.currentEventListeners) {
|
|
200
|
-
debug(runtime2, "%s.removeEventListener(%s, ...)", node.getName(), listener.eventName);
|
|
201
|
-
element.removeEventListener(listener.eventName, listener.listener);
|
|
202
|
-
changes++;
|
|
203
|
-
}
|
|
204
|
-
node.currentEventListeners = [];
|
|
205
|
-
for (const listener of listeners) {
|
|
206
|
-
debug(runtime2, "%s.addEventListener(%s, ...)", node.getName(), listener.eventName);
|
|
207
|
-
element.addEventListener(listener.eventName, listener.listener);
|
|
208
|
-
changes++;
|
|
209
|
-
}
|
|
210
|
-
node.currentEventListeners = listeners;
|
|
211
|
-
return changes;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
function createNotifyRef(node, refListener, runtime2) {
|
|
216
|
-
return {
|
|
217
|
-
postExecute: () => {
|
|
218
|
-
const ref = node.ref;
|
|
219
|
-
let changes = 0;
|
|
220
|
-
if (!ref) {
|
|
221
|
-
throw new Error("cannot notify ref without a ref");
|
|
222
|
-
}
|
|
223
|
-
debug(runtime2, "calling ref [%s]", node.getName());
|
|
224
|
-
refListener(ref);
|
|
225
|
-
return changes;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
function createRemoveNode(node, options, runtime2) {
|
|
230
|
-
return {
|
|
231
|
-
isDestructive: true,
|
|
232
|
-
execute: () => {
|
|
233
|
-
const meta = node.state;
|
|
234
|
-
let changes = 0;
|
|
235
|
-
if (node.component && meta) {
|
|
236
|
-
debug(runtime2, "[%s].remove()", node.getName());
|
|
237
|
-
}
|
|
238
|
-
const parent = node.parent;
|
|
239
|
-
if (!parent) {
|
|
240
|
-
throw new Error(`cannot remove from tree ${node.type} ${node.textContent}`);
|
|
241
|
-
}
|
|
242
|
-
parent.children.delete(node);
|
|
243
|
-
const nodeRef = node.ref;
|
|
244
|
-
if (nodeRef) {
|
|
245
|
-
changes++;
|
|
246
|
-
debug(runtime2, "%s.remove()", node.getName());
|
|
247
|
-
nodeRef.remove();
|
|
248
|
-
}
|
|
249
|
-
node.parent = null;
|
|
250
|
-
return changes;
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function createSetTextAction(node, textContent, runtime2) {
|
|
255
|
-
return {
|
|
256
|
-
execute: () => {
|
|
257
|
-
const ref = node.ref;
|
|
258
|
-
let changes = 0;
|
|
259
|
-
if (ref) {
|
|
260
|
-
debug(runtime2, "%s.textContent = ...", node.getName());
|
|
261
|
-
ref.textContent = textContent ? textContent : "";
|
|
262
|
-
node.textContent = textContent;
|
|
263
|
-
changes++;
|
|
264
|
-
}
|
|
265
|
-
return changes;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
function createUpdateLastRenderArgs(node, options, runtime2, props, children) {
|
|
270
|
-
return {
|
|
271
|
-
postExecute: () => {
|
|
272
|
-
node.lastRenderArgs = {
|
|
273
|
-
props,
|
|
274
|
-
children
|
|
275
|
-
};
|
|
276
|
-
return 0;
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function createSetInnerHTMLAction(node, innerHTML, runtime2) {
|
|
281
|
-
return {
|
|
282
|
-
execute: () => {
|
|
283
|
-
const ref = node.ref;
|
|
284
|
-
let changes = 0;
|
|
285
|
-
if (ref) {
|
|
286
|
-
debug(runtime2, "%s.innerHTML = ...", node.getName());
|
|
287
|
-
if (innerHTML !== null && innerHTML !== void 0) {
|
|
288
|
-
ref.innerHTML = String(innerHTML);
|
|
289
|
-
changes++;
|
|
290
|
-
}
|
|
291
|
-
node.innerHTML = innerHTML;
|
|
292
|
-
}
|
|
293
|
-
return changes;
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/base-node.js
|
|
299
|
-
function setDefaultOptions(options) {
|
|
300
|
-
if (defaultOptionsFuse) {
|
|
301
|
-
throw new Error("cannot override default options once and before an element has been created!");
|
|
302
|
-
}
|
|
303
|
-
defaultOptionsFuse = true;
|
|
304
|
-
DEFAULT_OPTIONS = options;
|
|
305
|
-
Object.freeze(DEFAULT_OPTIONS);
|
|
306
|
-
}
|
|
307
|
-
var BaseNode = class {
|
|
308
|
-
type;
|
|
309
|
-
parent;
|
|
310
|
-
children = /* @__PURE__ */ new Set();
|
|
311
|
-
currentEventListeners = [];
|
|
312
|
-
contextKey;
|
|
313
|
-
contextValue;
|
|
314
|
-
state;
|
|
315
|
-
tagName;
|
|
316
|
-
lastRenderArgs = {};
|
|
317
|
-
component;
|
|
318
|
-
textContent;
|
|
319
|
-
innerHTML;
|
|
320
|
-
ref;
|
|
321
|
-
isRoot;
|
|
322
|
-
constructor(type, parent) {
|
|
323
|
-
this.type = type;
|
|
324
|
-
this.parent = parent;
|
|
325
|
-
}
|
|
326
|
-
create(runtime2, options, change, parent, list) {
|
|
327
|
-
this.parent = parent;
|
|
328
|
-
this.update(runtime2, options, change, list, true);
|
|
329
|
-
list.push(createAppendAction(this, runtime2));
|
|
330
|
-
this.lastRenderArgs = {
|
|
331
|
-
props: change.props,
|
|
332
|
-
children: change.children
|
|
333
|
-
};
|
|
334
|
-
return this;
|
|
335
|
-
}
|
|
336
|
-
update(runtime2, options, change, list, initial) {
|
|
337
|
-
return this;
|
|
338
|
-
}
|
|
339
|
-
compare(change) {
|
|
340
|
-
return this.type === change.type && this.component === change.func && this.tagName === change.tagName && this.contextKey === change.contextKey;
|
|
341
|
-
}
|
|
342
|
-
remove(runtime2, options, list) {
|
|
343
|
-
if (this.children) {
|
|
344
|
-
for (const child of this.children) {
|
|
345
|
-
child.remove(runtime2, options, list);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
if (this.state && this.component) {
|
|
349
|
-
list.push(createFlushEffectsRemove(this, options, runtime2));
|
|
350
|
-
}
|
|
351
|
-
list.push(createRemoveNode(this, options, runtime2));
|
|
352
|
-
return this;
|
|
353
|
-
}
|
|
354
|
-
calculateChildren(runtime2, options, change, list) {
|
|
355
|
-
return change.children ? change.children : [];
|
|
356
|
-
}
|
|
357
|
-
getName() {
|
|
358
|
-
return this.component ? this.component.name : this.tagName ? this.tagName : this.type;
|
|
359
|
-
}
|
|
360
|
-
initComponentState(runtime2, options) {
|
|
361
|
-
if (this.state) {
|
|
362
|
-
throw new Error("already initialized");
|
|
363
|
-
}
|
|
364
|
-
const ref = this.ref;
|
|
365
|
-
const o = options ? {
|
|
366
|
-
...getDefaultOptions(),
|
|
367
|
-
...options ? options : {}
|
|
368
|
-
} : {
|
|
369
|
-
...getDefaultOptions()
|
|
370
|
-
};
|
|
371
|
-
const shadowInit = o.shadowInit;
|
|
372
|
-
const renderAsFragment = o.asFragment;
|
|
373
|
-
if (!ref && !renderAsFragment) {
|
|
374
|
-
throw new Error("createMeta without ref");
|
|
375
|
-
}
|
|
376
|
-
this.state = {
|
|
377
|
-
effectConditions: {},
|
|
378
|
-
effectCallbacks: {},
|
|
379
|
-
effectQueueCallbacks: {},
|
|
380
|
-
effects: {},
|
|
381
|
-
shadowRoot: renderAsFragment || !runtime2.isIntanceOfHTMLElement(ref) || shadowInit === false ? void 0 : runtime2.attachShadow(ref, shadowInit === void 0 || shadowInit === true ? {
|
|
382
|
-
mode: "closed"
|
|
383
|
-
} : shadowInit)
|
|
384
|
-
};
|
|
385
|
-
return this;
|
|
386
|
-
}
|
|
387
|
-
abortApply(runtime2) {
|
|
388
|
-
if (!this.state) {
|
|
389
|
-
throw new Error("no meta");
|
|
390
|
-
}
|
|
391
|
-
runtime2.clearTimeout(this.state.refreshTimeout);
|
|
392
|
-
if (this.state.abort) {
|
|
393
|
-
this.state.abort.abort("abortApply!");
|
|
394
|
-
}
|
|
395
|
-
this.state.abort = runtime2.createAbortController();
|
|
396
|
-
return this.state.abort;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
var DEFAULT_OPTIONS = {
|
|
400
|
-
/*shadowInit: {
|
|
401
|
-
mode: "closed"
|
|
402
|
-
},
|
|
403
|
-
asFragment: false*/
|
|
404
|
-
/*shadowInit: false*/
|
|
405
|
-
shadowInit: false,
|
|
406
|
-
asFragment: true
|
|
407
|
-
};
|
|
408
|
-
var defaultOptionsFuse = false;
|
|
409
|
-
function getDefaultOptions() {
|
|
410
|
-
defaultOptionsFuse = true;
|
|
411
|
-
return DEFAULT_OPTIONS;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// node_modules/@miqro/jsx/build/esm/jsx.js
|
|
415
|
-
var Fragment = Symbol("Fragment");
|
|
416
|
-
function createElement(tag, attributes, ...children) {
|
|
417
|
-
if (!tag) {
|
|
418
|
-
throw new Error(`cannot call createElement with [${String(tag)}] `);
|
|
419
|
-
}
|
|
420
|
-
const isFragment = tag === Fragment;
|
|
421
|
-
const fAsFragment = typeof tag === "string" || isFragment ? getDefaultOptions().asFragment : tag.asFragment !== void 0 ? tag.asFragment : getDefaultOptions().asFragment;
|
|
422
|
-
const tagName = typeof tag === "string" ? tag : isFragment ? "Fragment" : `${!tag.name ? "no-name" : tag.name}-component`.toLowerCase();
|
|
423
|
-
return isFragment ? {
|
|
424
|
-
type: "Fragment",
|
|
425
|
-
children
|
|
426
|
-
} : typeof tag === "function" ? {
|
|
427
|
-
type: fAsFragment ? "FragmentComponent" : "Component",
|
|
428
|
-
tagName: !fAsFragment ? tagName : void 0,
|
|
429
|
-
props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
|
|
430
|
-
func: tag,
|
|
431
|
-
children
|
|
432
|
-
} : {
|
|
433
|
-
type: "Element",
|
|
434
|
-
tagName,
|
|
435
|
-
props: attributes ? attributes : /* @__PURE__ */ Object.create(null),
|
|
436
|
-
children
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
var JSX = /* @__PURE__ */ Object.create(null);
|
|
440
|
-
var objectDefineProperty = Object.defineProperty;
|
|
441
|
-
objectDefineProperty(JSX, "createElement", {
|
|
442
|
-
configurable: false,
|
|
443
|
-
enumerable: true,
|
|
444
|
-
writable: false,
|
|
445
|
-
value: createElement
|
|
446
|
-
});
|
|
447
|
-
objectDefineProperty(JSX, "jsxFactory", {
|
|
448
|
-
configurable: false,
|
|
449
|
-
enumerable: true,
|
|
450
|
-
writable: false,
|
|
451
|
-
value: createElement
|
|
452
|
-
});
|
|
453
|
-
objectDefineProperty(JSX, "Fragment", {
|
|
454
|
-
configurable: false,
|
|
455
|
-
enumerable: true,
|
|
456
|
-
writable: false,
|
|
457
|
-
value: Fragment
|
|
458
|
-
});
|
|
459
|
-
objectDefineProperty(JSX, "jsxFragmentFactory", {
|
|
460
|
-
configurable: false,
|
|
461
|
-
enumerable: true,
|
|
462
|
-
writable: false,
|
|
463
|
-
value: Fragment
|
|
464
|
-
});
|
|
465
|
-
Object.freeze(JSX);
|
|
466
|
-
|
|
467
|
-
// node_modules/@miqro/jsx/build/esm/vdom/types.js
|
|
468
|
-
var CHANGE_TYPES_SET = /* @__PURE__ */ new Set(["FragmentComponent", "Component", "Element", "Ref", "Fragment", "ContextProvider"]);
|
|
469
|
-
|
|
470
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/context-provider.js
|
|
471
|
-
var ContextProvider = class extends BaseNode {
|
|
472
|
-
constructor(parent) {
|
|
473
|
-
super("ContextProvider", parent);
|
|
474
|
-
}
|
|
475
|
-
create(runtime2, options, change, parent, list) {
|
|
476
|
-
if (!change.contextKey) {
|
|
477
|
-
throw new Error("cannot create ContextProvider without contextKey");
|
|
478
|
-
}
|
|
479
|
-
this.contextKey = change.contextKey;
|
|
480
|
-
this.contextValue = change.contextValue;
|
|
481
|
-
this.parent = parent;
|
|
482
|
-
const children = this.calculateChildren(runtime2, options, change, list);
|
|
483
|
-
for (const child of children) {
|
|
484
|
-
createNewNodeFromChange(runtime2, options, normalizeChild(runtime2, child), this, list);
|
|
485
|
-
}
|
|
486
|
-
return super.create(runtime2, options, change, parent, list);
|
|
487
|
-
}
|
|
488
|
-
update(runtime2, options, change, list, initial) {
|
|
489
|
-
this.contextValue = change.contextValue;
|
|
490
|
-
return this;
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/fragment.js
|
|
495
|
-
var Fragment2 = class extends BaseNode {
|
|
496
|
-
constructor(parent) {
|
|
497
|
-
super("Fragment", parent);
|
|
498
|
-
}
|
|
499
|
-
create(runtime2, options, change, parent, list) {
|
|
500
|
-
this.parent = parent;
|
|
501
|
-
const children = this.calculateChildren(runtime2, options, change, list);
|
|
502
|
-
for (const child of children) {
|
|
503
|
-
createNewNodeFromChange(runtime2, options, normalizeChild(runtime2, child), this, list);
|
|
504
|
-
}
|
|
505
|
-
super.create(runtime2, options, change, parent, list);
|
|
506
|
-
return this;
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
// node_modules/@miqro/jsx/build/esm/component/render.js
|
|
511
|
-
var currentContext = null;
|
|
512
|
-
function useConditional(name) {
|
|
513
|
-
return pushContextCall(currentContext, name);
|
|
514
|
-
}
|
|
515
|
-
function useRenderContext() {
|
|
516
|
-
if (!currentContext) {
|
|
517
|
-
throw new Error("useContext not in render");
|
|
518
|
-
}
|
|
519
|
-
return currentContext;
|
|
520
|
-
}
|
|
521
|
-
function renderComponent(runtime2, component, options, list, props, children) {
|
|
522
|
-
try {
|
|
523
|
-
const meta = component.state;
|
|
524
|
-
const func = component.component;
|
|
525
|
-
if (!meta || !func) {
|
|
526
|
-
throw new Error("meta not found!");
|
|
527
|
-
}
|
|
528
|
-
if (meta.conditionalUseDetected) {
|
|
529
|
-
throw new Error("conditional this.use calls detected(4)!");
|
|
530
|
-
}
|
|
531
|
-
const context = {
|
|
532
|
-
calls: [],
|
|
533
|
-
node: component,
|
|
534
|
-
options,
|
|
535
|
-
runtime: runtime2
|
|
536
|
-
};
|
|
537
|
-
list.push(createUpdateLastRenderArgs(component, options, runtime2, props, children));
|
|
538
|
-
currentContext = null;
|
|
539
|
-
currentContext = context;
|
|
540
|
-
const output = func(props, children);
|
|
541
|
-
currentContext = null;
|
|
542
|
-
if (meta.lastContextCalls && meta.lastContextCalls.length !== context.calls.length) {
|
|
543
|
-
meta.conditionalUseDetected = true;
|
|
544
|
-
throw new Error("conditional this.use calls detected(3)!");
|
|
545
|
-
}
|
|
546
|
-
meta.lastContextCalls = context.calls;
|
|
547
|
-
return [output];
|
|
548
|
-
} catch (e) {
|
|
549
|
-
currentContext = null;
|
|
550
|
-
throw e;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
function pushContextCall(context, name) {
|
|
554
|
-
if (!context) {
|
|
555
|
-
throw new Error("not in render(7)");
|
|
556
|
-
}
|
|
557
|
-
const meta = context.node.state;
|
|
558
|
-
if (!meta) {
|
|
559
|
-
throw new Error("not in render(-1)");
|
|
560
|
-
}
|
|
561
|
-
const callIndex = context.calls.length;
|
|
562
|
-
const key = `${callIndex}-${name}`;
|
|
563
|
-
context.calls.push({
|
|
564
|
-
key
|
|
565
|
-
});
|
|
566
|
-
if (!meta.lastContextCalls) {
|
|
567
|
-
return key;
|
|
568
|
-
}
|
|
569
|
-
if (context.calls > meta.lastContextCalls) {
|
|
570
|
-
meta.conditionalUseDetected = true;
|
|
571
|
-
throw new Error("conditional this.use calls detected(1)!");
|
|
572
|
-
}
|
|
573
|
-
const lastCall = meta.lastContextCalls[callIndex];
|
|
574
|
-
if (lastCall === void 0 || lastCall.key !== key) {
|
|
575
|
-
meta.conditionalUseDetected = true;
|
|
576
|
-
throw new Error("conditional this.use calls detected(2)!");
|
|
577
|
-
}
|
|
578
|
-
return key;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/component-fragment.js
|
|
582
|
-
var FragmentComponent = class extends Fragment2 {
|
|
583
|
-
constructor(parent) {
|
|
584
|
-
super(parent);
|
|
585
|
-
this.type = "FragmentComponent";
|
|
586
|
-
}
|
|
587
|
-
create(runtime2, options, change, parent, list) {
|
|
588
|
-
if (change.func === void 0) {
|
|
589
|
-
throw new Error("cannot create FragmentFunction without func");
|
|
590
|
-
}
|
|
591
|
-
this.component = change.func;
|
|
592
|
-
const o = {
|
|
593
|
-
asFragment: true
|
|
594
|
-
};
|
|
595
|
-
if (this.component.shadowInit !== void 0) {
|
|
596
|
-
o.shadowInit = this.component.shadowInit;
|
|
597
|
-
}
|
|
598
|
-
this.initComponentState(runtime2, o);
|
|
599
|
-
this.parent = parent;
|
|
600
|
-
this.lastRenderArgs = {
|
|
601
|
-
props: change.props,
|
|
602
|
-
children: change.children
|
|
603
|
-
};
|
|
604
|
-
return super.create(runtime2, options, change, parent, list);
|
|
605
|
-
}
|
|
606
|
-
calculateChildren(runtime2, options, change, list) {
|
|
607
|
-
if (this.component && this.state) {
|
|
608
|
-
list.push(createFlushEffects(this, options, runtime2));
|
|
609
|
-
const out = renderComponent(runtime2, this, options, list, change.props, change.children);
|
|
610
|
-
return out ? out : [];
|
|
611
|
-
} else {
|
|
612
|
-
return change.children ? change.children : [];
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
};
|
|
616
|
-
|
|
617
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/element.js
|
|
618
|
-
var ATTRIBUTES_WITHOUT_VALUE = /* @__PURE__ */ new Set([
|
|
619
|
-
"disabled",
|
|
620
|
-
"checked",
|
|
621
|
-
"selected",
|
|
622
|
-
"hidden"
|
|
623
|
-
]);
|
|
624
|
-
var Element = class extends BaseNode {
|
|
625
|
-
constructor(parent) {
|
|
626
|
-
super("Element", parent);
|
|
627
|
-
}
|
|
628
|
-
create(runtime2, options, change, parent, list) {
|
|
629
|
-
if (change.tagName === void 0) {
|
|
630
|
-
throw new Error("cannot create element without a tagName");
|
|
631
|
-
}
|
|
632
|
-
this.tagName = change.tagName;
|
|
633
|
-
this.ref = runtime2.createElement(change.tagName);
|
|
634
|
-
this.parent = parent;
|
|
635
|
-
const children = this.calculateChildren(runtime2, options, change, list);
|
|
636
|
-
for (const child of children) {
|
|
637
|
-
createNewNodeFromChange(runtime2, options, normalizeChild(runtime2, child), this, list);
|
|
638
|
-
}
|
|
639
|
-
return super.create(runtime2, options, change, parent, list);
|
|
640
|
-
}
|
|
641
|
-
update(runtime2, options, change, list, initial) {
|
|
642
|
-
const attributesSet = [];
|
|
643
|
-
let setInnerHTMLFlag = true;
|
|
644
|
-
let setInnerHTML = void 0;
|
|
645
|
-
const attributesRemove = [];
|
|
646
|
-
const listenerChanges = [];
|
|
647
|
-
let refListener = null;
|
|
648
|
-
const changeProps = change.props ? change.props : {};
|
|
649
|
-
const changePropNames = new Set(Object.keys(changeProps));
|
|
650
|
-
const element = this.ref;
|
|
651
|
-
const currentAttributeNames = new Set(element.getAttributeNames());
|
|
652
|
-
for (const changePropName of changePropNames) {
|
|
653
|
-
const changePropValue = changeProps[changePropName];
|
|
654
|
-
if (typeof changePropValue === "function") {
|
|
655
|
-
if (changePropName === "ref") {
|
|
656
|
-
if (!initial) {
|
|
657
|
-
continue;
|
|
658
|
-
} else {
|
|
659
|
-
refListener = changePropValue;
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
662
|
-
} else if (changePropName.indexOf("on") === 0) {
|
|
663
|
-
const eventName = changePropName.substring("on".length);
|
|
664
|
-
listenerChanges.push({
|
|
665
|
-
eventName,
|
|
666
|
-
listener: changePropValue
|
|
667
|
-
});
|
|
668
|
-
continue;
|
|
669
|
-
} else if (changePropName.indexOf("data-on") === 0) {
|
|
670
|
-
const eventName = changePropName.substring("data-on".length);
|
|
671
|
-
listenerChanges.push({
|
|
672
|
-
eventName,
|
|
673
|
-
listener: changePropValue
|
|
674
|
-
});
|
|
675
|
-
continue;
|
|
676
|
-
}
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
if (!this.component) {
|
|
680
|
-
if (changePropName === "innerHTML") {
|
|
681
|
-
if (changePropValue !== this.innerHTML) {
|
|
682
|
-
setInnerHTMLFlag = true;
|
|
683
|
-
setInnerHTML = changePropValue;
|
|
684
|
-
}
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
const attributeName = changePropName === "className" ? "class" : changePropName;
|
|
688
|
-
currentAttributeNames.delete(attributeName);
|
|
689
|
-
const currentAttributeValue = attributeName === "value" ? element.value : attributeName === "checked" ? element.checked : element.getAttribute(attributeName);
|
|
690
|
-
if (typeof changePropValue === "boolean" && ATTRIBUTES_WITHOUT_VALUE.has(attributeName)) {
|
|
691
|
-
if (attributeName === "checked") {
|
|
692
|
-
if (changePropValue) {
|
|
693
|
-
attributesSet.push({
|
|
694
|
-
name: attributeName,
|
|
695
|
-
value: ""
|
|
696
|
-
});
|
|
697
|
-
} else {
|
|
698
|
-
attributesRemove.push(attributeName);
|
|
699
|
-
}
|
|
700
|
-
} else if (!changePropValue && currentAttributeValue !== null) {
|
|
701
|
-
attributesRemove.push(attributeName);
|
|
702
|
-
} else if (changePropValue && currentAttributeValue === null) {
|
|
703
|
-
attributesSet.push({
|
|
704
|
-
name: attributeName,
|
|
705
|
-
value: ""
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
} else {
|
|
709
|
-
const sValue = String(changePropValue);
|
|
710
|
-
if (sValue !== currentAttributeValue) {
|
|
711
|
-
attributesSet.push({
|
|
712
|
-
name: attributeName,
|
|
713
|
-
value: String(changePropValue)
|
|
714
|
-
});
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
if (!this.component) {
|
|
720
|
-
if (currentAttributeNames.size > 0) {
|
|
721
|
-
for (const name of currentAttributeNames) {
|
|
722
|
-
attributesRemove.push(name);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (this.currentEventListeners.length > 0) {
|
|
727
|
-
list.push(createRemoveListeners(this, runtime2));
|
|
728
|
-
}
|
|
729
|
-
if (attributesRemove.length > 0) {
|
|
730
|
-
list.push(createRemoveAttributesAction(this, attributesRemove, runtime2));
|
|
731
|
-
}
|
|
732
|
-
if (attributesSet.length > 0) {
|
|
733
|
-
list.push(createSetAttributesAction(this, attributesSet, runtime2));
|
|
734
|
-
}
|
|
735
|
-
if (listenerChanges.length > 0) {
|
|
736
|
-
list.push(createUpdateListeners(this, listenerChanges, runtime2));
|
|
737
|
-
}
|
|
738
|
-
if (refListener !== null) {
|
|
739
|
-
list.push(createNotifyRef(this, refListener, runtime2));
|
|
740
|
-
}
|
|
741
|
-
if (setInnerHTMLFlag) {
|
|
742
|
-
list.push(createSetInnerHTMLAction(this, setInnerHTML, runtime2));
|
|
743
|
-
}
|
|
744
|
-
return super.update(runtime2, options, change, list);
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/component.js
|
|
749
|
-
var Component = class extends Element {
|
|
750
|
-
constructor(parent) {
|
|
751
|
-
super(parent);
|
|
752
|
-
this.type = "Component";
|
|
753
|
-
}
|
|
754
|
-
create(runtime2, options, change, parent, list) {
|
|
755
|
-
if (change.func === void 0) {
|
|
756
|
-
throw new Error("cannot create Function without func");
|
|
757
|
-
}
|
|
758
|
-
if (change.tagName === void 0) {
|
|
759
|
-
throw new Error("cannot create element without a tagName");
|
|
760
|
-
}
|
|
761
|
-
this.component = change.func;
|
|
762
|
-
this.tagName = change.tagName;
|
|
763
|
-
this.ref = runtime2.createElement(change.tagName);
|
|
764
|
-
if (this.component) {
|
|
765
|
-
const o = {};
|
|
766
|
-
if (this.component.asFragment !== void 0) {
|
|
767
|
-
o.asFragment = this.component.asFragment;
|
|
768
|
-
}
|
|
769
|
-
if (this.component.shadowInit !== void 0) {
|
|
770
|
-
o.shadowInit = this.component.shadowInit;
|
|
771
|
-
}
|
|
772
|
-
this.initComponentState(runtime2, o);
|
|
773
|
-
}
|
|
774
|
-
this.parent = parent;
|
|
775
|
-
const children = this.calculateChildren(runtime2, options, change, list);
|
|
776
|
-
for (const child of children) {
|
|
777
|
-
createNewNodeFromChange(runtime2, options, normalizeChild(runtime2, child), this, list);
|
|
778
|
-
}
|
|
779
|
-
this.parent = parent;
|
|
780
|
-
this.update(runtime2, options, change, list, true);
|
|
781
|
-
list.push(createAppendAction(this, runtime2));
|
|
782
|
-
this.lastRenderArgs = {
|
|
783
|
-
props: change.props,
|
|
784
|
-
children: change.children
|
|
785
|
-
};
|
|
786
|
-
return this;
|
|
787
|
-
}
|
|
788
|
-
calculateChildren(runtime2, options, change, list) {
|
|
789
|
-
if (this.component && this.state) {
|
|
790
|
-
list.push(createFlushEffects(this, options, runtime2));
|
|
791
|
-
const out = renderComponent(runtime2, this, options, list, change.props, change.children);
|
|
792
|
-
return out ? out : [];
|
|
793
|
-
} else {
|
|
794
|
-
return super.calculateChildren(runtime2, options, change, list);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/ref.js
|
|
800
|
-
var Ref = class extends BaseNode {
|
|
801
|
-
constructor(parent) {
|
|
802
|
-
super("Ref", parent);
|
|
803
|
-
}
|
|
804
|
-
create(runtime2, options, change, parent, list) {
|
|
805
|
-
if (!change.ref) {
|
|
806
|
-
throw new Error("cannot create ref without ref");
|
|
807
|
-
}
|
|
808
|
-
this.ref = change.ref;
|
|
809
|
-
this.parent = parent;
|
|
810
|
-
list.push(createAppendAction(this, runtime2));
|
|
811
|
-
return this;
|
|
812
|
-
}
|
|
813
|
-
compare(change) {
|
|
814
|
-
return this.type === change.type && this.ref === change.ref && this.component === change.func && this.tagName === change.tagName && this.ref === change.ref;
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
|
|
818
|
-
// node_modules/@miqro/jsx/build/esm/vdom/nodes/text.js
|
|
819
|
-
var Text = class extends BaseNode {
|
|
820
|
-
constructor(parent) {
|
|
821
|
-
super("Text", parent);
|
|
822
|
-
}
|
|
823
|
-
create(runtime2, options, change, parent, list) {
|
|
824
|
-
if (change.textContent === void 0) {
|
|
825
|
-
throw new Error("cannot create text without a textContent");
|
|
826
|
-
}
|
|
827
|
-
this.ref = runtime2.createTextNode(change.textContent);
|
|
828
|
-
this.textContent = change.textContent;
|
|
829
|
-
this.parent = parent;
|
|
830
|
-
list.push(createAppendAction(this, runtime2));
|
|
831
|
-
return this;
|
|
832
|
-
}
|
|
833
|
-
update(runtime2, options, change, list, initial) {
|
|
834
|
-
if (this.textContent !== change.textContent) {
|
|
835
|
-
list.push(createSetTextAction(this, change.textContent, runtime2));
|
|
836
|
-
}
|
|
837
|
-
return this;
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
// node_modules/@miqro/jsx/build/esm/vdom/tree.js
|
|
842
|
-
var Tree = class extends BaseNode {
|
|
843
|
-
name;
|
|
844
|
-
constructor(name, ref, runtime2, shadowInit) {
|
|
845
|
-
super("Fragment", null);
|
|
846
|
-
this.isRoot = true;
|
|
847
|
-
this.parent = null;
|
|
848
|
-
this.ref = ref;
|
|
849
|
-
this.initComponentState(runtime2, {
|
|
850
|
-
asFragment: false,
|
|
851
|
-
shadowInit
|
|
852
|
-
});
|
|
853
|
-
this.name = name;
|
|
854
|
-
}
|
|
855
|
-
getName() {
|
|
856
|
-
return this.name;
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
function createNewNodeFromChange(runtime2, options, change, parent, list) {
|
|
860
|
-
switch (change.type) {
|
|
861
|
-
case "ContextProvider":
|
|
862
|
-
return new ContextProvider(parent).create(runtime2, options, change, parent, list);
|
|
863
|
-
case "Element":
|
|
864
|
-
return new Element(parent).create(runtime2, options, change, parent, list);
|
|
865
|
-
case "Component":
|
|
866
|
-
return new Component(parent).create(runtime2, options, change, parent, list);
|
|
867
|
-
case "Ref":
|
|
868
|
-
return new Ref(parent).create(runtime2, options, change, parent, list);
|
|
869
|
-
case "Text":
|
|
870
|
-
return new Text(parent).create(runtime2, options, change, parent, list);
|
|
871
|
-
case "Fragment":
|
|
872
|
-
return new Fragment2(parent).create(runtime2, options, change, parent, list);
|
|
873
|
-
case "FragmentComponent":
|
|
874
|
-
return new FragmentComponent(parent).create(runtime2, options, change, parent, list);
|
|
875
|
-
default:
|
|
876
|
-
throw new Error(`unsopported change.type = %${change.type}`);
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
function normalizeChild(runtime2, c) {
|
|
880
|
-
if (typeof c === "object") {
|
|
881
|
-
if (c instanceof Array) {
|
|
882
|
-
return {
|
|
883
|
-
type: "Fragment",
|
|
884
|
-
children: c
|
|
885
|
-
};
|
|
886
|
-
} else if (runtime2.isInstanceofNode(c)) {
|
|
887
|
-
return {
|
|
888
|
-
type: "Ref",
|
|
889
|
-
ref: c
|
|
890
|
-
};
|
|
891
|
-
} else if (c && CHANGE_TYPES_SET.has(c.type)) {
|
|
892
|
-
return c;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
return {
|
|
896
|
-
type: "Text",
|
|
897
|
-
textContent: String(c)
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
// node_modules/@miqro/jsx/build/esm/vdom/diff.js
|
|
902
|
-
function diff(abortSignal, tree, changes, actions, options, runtime2, lo = false) {
|
|
903
|
-
if (changes === void 0 || changes === null || abortSignal.aborted) {
|
|
904
|
-
return actions;
|
|
905
|
-
}
|
|
906
|
-
const currentChildren = tree.children.values();
|
|
907
|
-
let currentChildrenRet = currentChildren.next();
|
|
908
|
-
for (const change of changes) {
|
|
909
|
-
const normalizedChange = normalizeChild(runtime2, change);
|
|
910
|
-
const actualChild = currentChildrenRet.value;
|
|
911
|
-
if (actualChild === void 0) {
|
|
912
|
-
createNewNodeFromChange(runtime2, options, normalizedChange, tree, actions);
|
|
913
|
-
} else if (!actualChild.compare(normalizedChange)) {
|
|
914
|
-
currentChildrenRet = removeFrom(runtime2, currentChildren, currentChildrenRet, actions, options);
|
|
915
|
-
createNewNodeFromChange(runtime2, options, normalizedChange, tree, actions);
|
|
916
|
-
} else {
|
|
917
|
-
actualChild.update(runtime2, options, normalizedChange, actions);
|
|
918
|
-
if (actualChild.type === "Fragment" || actualChild.type === "FragmentComponent" || actualChild.type === "ContextProvider") {
|
|
919
|
-
const fragmentActions = [];
|
|
920
|
-
diff(abortSignal, actualChild, actualChild.calculateChildren(runtime2, options, normalizedChange, fragmentActions), fragmentActions, options, runtime2, true);
|
|
921
|
-
if (areActionDestructive(fragmentActions)) {
|
|
922
|
-
currentChildrenRet = currentChildren.next();
|
|
923
|
-
currentChildrenRet = removeFrom(runtime2, currentChildren, currentChildrenRet, actions, options);
|
|
924
|
-
}
|
|
925
|
-
actions.push(...fragmentActions);
|
|
926
|
-
} else {
|
|
927
|
-
diff(abortSignal, actualChild, actualChild.calculateChildren(runtime2, options, normalizedChange, actions), actions, options, runtime2);
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
currentChildrenRet = currentChildren.next();
|
|
931
|
-
}
|
|
932
|
-
currentChildrenRet = removeFrom(runtime2, currentChildren, currentChildrenRet, actions, options);
|
|
933
|
-
return actions;
|
|
934
|
-
}
|
|
935
|
-
function removeFrom(runtime2, nodeIterator, nodeIteratorRet, currentActions, options) {
|
|
936
|
-
while (nodeIteratorRet.value !== void 0) {
|
|
937
|
-
nodeIteratorRet.value.remove(runtime2, options, currentActions);
|
|
938
|
-
nodeIteratorRet = nodeIterator.next();
|
|
939
|
-
}
|
|
940
|
-
return nodeIteratorRet;
|
|
941
|
-
}
|
|
942
|
-
function areActionDestructive(actions) {
|
|
943
|
-
for (const fragmentAction of actions) {
|
|
944
|
-
if (fragmentAction.isDestructive) {
|
|
945
|
-
return true;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
// node_modules/@miqro/jsx/build/esm/vdom/execute.js
|
|
952
|
-
function execute(abortSignal, runtime2, actions) {
|
|
953
|
-
if (abortSignal.aborted) {
|
|
954
|
-
return 0;
|
|
955
|
-
}
|
|
956
|
-
let changes = 0;
|
|
957
|
-
const postExecute = [];
|
|
958
|
-
for (const action of actions) {
|
|
959
|
-
try {
|
|
960
|
-
if (action.execute) {
|
|
961
|
-
const actionChanges = action.execute();
|
|
962
|
-
changes += actionChanges;
|
|
963
|
-
}
|
|
964
|
-
if (action.postExecute) {
|
|
965
|
-
postExecute.push(action);
|
|
966
|
-
}
|
|
967
|
-
} catch (e) {
|
|
968
|
-
error(runtime2, e);
|
|
969
|
-
throw e;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
for (const action of postExecute) {
|
|
973
|
-
try {
|
|
974
|
-
const actionChanges = action.postExecute();
|
|
975
|
-
changes += actionChanges;
|
|
976
|
-
} catch (e) {
|
|
977
|
-
error(runtime2, e);
|
|
978
|
-
throw e;
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
return changes;
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
// node_modules/@miqro/jsx/build/esm/vdom/render.js
|
|
985
|
-
function render(runtime2, tree, treeOptions, change, preActions = [], props, children) {
|
|
986
|
-
const meta = tree.state;
|
|
987
|
-
if (!meta) {
|
|
988
|
-
throw new Error("cannot find meta");
|
|
989
|
-
}
|
|
990
|
-
const abortSignal = tree.abortApply(runtime2).signal;
|
|
991
|
-
debug(runtime2, "render for [%s]", tree.getName());
|
|
992
|
-
if (tree.isRoot || tree.parent !== null) {
|
|
993
|
-
const applyStart = Date.now();
|
|
994
|
-
const out = change instanceof Array ? change : change === true ? renderComponent(runtime2, tree, treeOptions, preActions, props, children) : void 0;
|
|
995
|
-
const changes = execute(abortSignal, runtime2, diff(abortSignal, tree, out, preActions, treeOptions, runtime2));
|
|
996
|
-
const took = Date.now() - applyStart;
|
|
997
|
-
if (took > 5e3) {
|
|
998
|
-
error(runtime2, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
|
|
999
|
-
} else {
|
|
1000
|
-
debug(runtime2, "render for [%s] with [%s] changes took [%s]ms", tree.getName(), changes, took);
|
|
1001
|
-
}
|
|
1002
|
-
return changes;
|
|
1003
|
-
} else {
|
|
1004
|
-
debug(runtime2, "render skipped for [%s]", tree.getName());
|
|
1005
|
-
return 0;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
// node_modules/@miqro/jsx/build/esm/component/container.js
|
|
1010
|
-
var objectDefineProperty2 = Object.defineProperty;
|
|
1011
|
-
function createContainer(element, runtime2, args) {
|
|
1012
|
-
const name = `DOMContainer [${String(element)}]`;
|
|
1013
|
-
const tree = new Tree(name, element, runtime2, args?.shadowInit);
|
|
1014
|
-
const treeOptions = args && args.runtimeOptions ? {
|
|
1015
|
-
disableEffects: false,
|
|
1016
|
-
disableRefListener: false,
|
|
1017
|
-
disableRefresh: false,
|
|
1018
|
-
disableEvents: false,
|
|
1019
|
-
...args.runtimeOptions
|
|
1020
|
-
} : {
|
|
1021
|
-
disableEffects: false,
|
|
1022
|
-
disableRefListener: false,
|
|
1023
|
-
disableRefresh: false,
|
|
1024
|
-
disableEvents: false
|
|
1025
|
-
};
|
|
1026
|
-
const container = /* @__PURE__ */ Object.create(null);
|
|
1027
|
-
objectDefineProperty2(container, "name", {
|
|
1028
|
-
configurable: false,
|
|
1029
|
-
enumerable: true,
|
|
1030
|
-
writable: false,
|
|
1031
|
-
value: name
|
|
1032
|
-
});
|
|
1033
|
-
objectDefineProperty2(container, "render", {
|
|
1034
|
-
configurable: false,
|
|
1035
|
-
enumerable: true,
|
|
1036
|
-
writable: false,
|
|
1037
|
-
value: function render2(out) {
|
|
1038
|
-
return render(runtime2, tree, treeOptions, [out]);
|
|
1039
|
-
}
|
|
1040
|
-
});
|
|
1041
|
-
objectDefineProperty2(container, "disconnect", {
|
|
1042
|
-
configurable: false,
|
|
1043
|
-
enumerable: true,
|
|
1044
|
-
writable: false,
|
|
1045
|
-
value: function disconnect() {
|
|
1046
|
-
return render(runtime2, tree, treeOptions, []);
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
Object.freeze(container);
|
|
1050
|
-
return container;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// node_modules/@miqro/jsx/build/esm/hooks/runtime.js
|
|
1054
|
-
function useRuntime() {
|
|
1055
|
-
useConditional("useRuntime");
|
|
1056
|
-
const currentContext2 = useRenderContext();
|
|
1057
|
-
if (!currentContext2) {
|
|
1058
|
-
throw new Error("useRuntime not in render");
|
|
1059
|
-
}
|
|
1060
|
-
return currentContext2.runtime;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
// node_modules/@miqro/jsx/build/esm/hooks/refresh.js
|
|
1064
|
-
var REFRESH_TIMEOUT_MS = 0;
|
|
1065
|
-
function useRefresh() {
|
|
1066
|
-
useConditional("useRefresh");
|
|
1067
|
-
const currentContext2 = useRenderContext();
|
|
1068
|
-
if (!currentContext2) {
|
|
1069
|
-
throw new Error("useRefresh not in render");
|
|
1070
|
-
}
|
|
1071
|
-
const meta = currentContext2.node.state;
|
|
1072
|
-
if (!meta) {
|
|
1073
|
-
throw new Error("useRefresh without meta");
|
|
1074
|
-
}
|
|
1075
|
-
const runtime2 = useRuntime();
|
|
1076
|
-
const options = currentContext2.options;
|
|
1077
|
-
const node = currentContext2.node;
|
|
1078
|
-
const component = node.component;
|
|
1079
|
-
if (!component) {
|
|
1080
|
-
throw new Error("useRefresh without func");
|
|
1081
|
-
}
|
|
1082
|
-
return (cb) => {
|
|
1083
|
-
runtime2.clearTimeout(meta.refreshTimeout);
|
|
1084
|
-
if (options.disableRefresh) {
|
|
1085
|
-
debug(runtime2, "useRefresh.refresh() disabled for [%s]", component.name);
|
|
1086
|
-
} else {
|
|
1087
|
-
meta.refreshTimeout = runtime2.setTimeout(() => {
|
|
1088
|
-
debug(runtime2, "useRefresh.refresh() for [%s]", component.name);
|
|
1089
|
-
const props = node.lastRenderArgs.props;
|
|
1090
|
-
const children = node.lastRenderArgs.children;
|
|
1091
|
-
const changes = render(runtime2, node, options, true, [createFlushEffects(node, options, runtime2)], props, children);
|
|
1092
|
-
if (cb) {
|
|
1093
|
-
runtime2.setTimeout(() => cb(changes), 0);
|
|
1094
|
-
}
|
|
1095
|
-
}, REFRESH_TIMEOUT_MS);
|
|
1096
|
-
}
|
|
1097
|
-
};
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
// node_modules/@miqro/jsx/build/esm/hooks/state.js
|
|
1101
|
-
function useState(defaultValue) {
|
|
1102
|
-
const key = useConditional("useState");
|
|
1103
|
-
const currentContext2 = useRenderContext();
|
|
1104
|
-
if (!currentContext2) {
|
|
1105
|
-
throw new Error("useState not in render");
|
|
1106
|
-
}
|
|
1107
|
-
const refresh = useRefresh();
|
|
1108
|
-
const meta = currentContext2.node.state;
|
|
1109
|
-
const runtime2 = useRuntime();
|
|
1110
|
-
if (!meta) {
|
|
1111
|
-
throw new Error("useState without meta");
|
|
1112
|
-
}
|
|
1113
|
-
if (!meta.state) {
|
|
1114
|
-
meta.state = /* @__PURE__ */ Object.create(null);
|
|
1115
|
-
}
|
|
1116
|
-
if (!meta.state) {
|
|
1117
|
-
throw new Error("useState without meta.state");
|
|
1118
|
-
}
|
|
1119
|
-
const name = currentContext2.node.component?.name;
|
|
1120
|
-
const currentStateItem = meta.state[key];
|
|
1121
|
-
if (currentStateItem === void 0) {
|
|
1122
|
-
const stateItem = {
|
|
1123
|
-
value: defaultValue,
|
|
1124
|
-
set: (newValue, refreshOnSet = true) => {
|
|
1125
|
-
debug(runtime2, "setState() for [%s]", name);
|
|
1126
|
-
if (stateItem.value !== newValue) {
|
|
1127
|
-
stateItem.value = newValue;
|
|
1128
|
-
if (refreshOnSet) {
|
|
1129
|
-
refresh(typeof refreshOnSet === "function" ? refreshOnSet : void 0);
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
},
|
|
1133
|
-
get: () => {
|
|
1134
|
-
return stateItem.value;
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
meta.state[key] = stateItem;
|
|
1138
|
-
return [
|
|
1139
|
-
stateItem.value,
|
|
1140
|
-
stateItem.set,
|
|
1141
|
-
stateItem.get
|
|
1142
|
-
];
|
|
1143
|
-
} else {
|
|
1144
|
-
return [
|
|
1145
|
-
currentStateItem.value,
|
|
1146
|
-
currentStateItem.set,
|
|
1147
|
-
currentStateItem.get
|
|
1148
|
-
];
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
// node_modules/@miqro/jsx/build/esm/hooks/effect.js
|
|
1153
|
-
function useEffect(effect, condition) {
|
|
1154
|
-
const currentContext2 = useRenderContext();
|
|
1155
|
-
if (!currentContext2) {
|
|
1156
|
-
throw new Error("useEffect not in render");
|
|
1157
|
-
}
|
|
1158
|
-
const key = useConditional("useEffect");
|
|
1159
|
-
const meta = currentContext2.node.state;
|
|
1160
|
-
if (!meta) {
|
|
1161
|
-
throw new Error("useEffect without meta");
|
|
1162
|
-
}
|
|
1163
|
-
const c = condition ? condition : false;
|
|
1164
|
-
if (meta.effectConditions[key] === void 0 || condition === void 0 && meta.effectConditions[key] === false || !equalArray(meta.effectConditions[key], c)) {
|
|
1165
|
-
meta.effectConditions[key] = c;
|
|
1166
|
-
const oldCallback = meta.effectQueueCallbacks[key];
|
|
1167
|
-
delete meta.effectQueueCallbacks[key];
|
|
1168
|
-
if (meta.effectCallbacks[key]) {
|
|
1169
|
-
meta.conditionalUseDetected = true;
|
|
1170
|
-
throw new Error("invalid state. component lock.");
|
|
1171
|
-
}
|
|
1172
|
-
if (oldCallback) {
|
|
1173
|
-
meta.effectCallbacks[key] = oldCallback;
|
|
1174
|
-
}
|
|
1175
|
-
meta.effects[key] = effect;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
function equalArray(a, c) {
|
|
1179
|
-
if (typeof a !== typeof c) {
|
|
1180
|
-
return false;
|
|
1181
|
-
}
|
|
1182
|
-
if (typeof a === "undefined" || typeof a === "boolean") {
|
|
1183
|
-
return a === c;
|
|
1184
|
-
}
|
|
1185
|
-
const l1 = a;
|
|
1186
|
-
const l2 = c;
|
|
1187
|
-
if (l1.length !== l2.length) {
|
|
1188
|
-
return false;
|
|
1189
|
-
}
|
|
1190
|
-
for (let i = 0; i < l1.length; i++) {
|
|
1191
|
-
if (l1[i] !== l2[i]) {
|
|
1192
|
-
return false;
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
return true;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
// node_modules/@miqro/jsx/build/esm/hooks/pathname.js
|
|
1199
|
-
function usePathname() {
|
|
1200
|
-
const runtime2 = useRuntime();
|
|
1201
|
-
const pathname = runtime2.getLocation().pathname;
|
|
1202
|
-
const [currentLocation, setCurrentLocation, getL] = useState(pathname);
|
|
1203
|
-
debug(runtime2, "usePathname [%s]", currentLocation);
|
|
1204
|
-
useEffect(function usePathnameEffect() {
|
|
1205
|
-
const listener = () => {
|
|
1206
|
-
const newLocation = runtime2.getLocation().pathname;
|
|
1207
|
-
setCurrentLocation(newLocation);
|
|
1208
|
-
};
|
|
1209
|
-
runtime2.addPathListener(listener);
|
|
1210
|
-
return function usePathnameEffectUnLoad() {
|
|
1211
|
-
runtime2.removePathListener(listener);
|
|
1212
|
-
};
|
|
1213
|
-
}, []);
|
|
1214
|
-
return String(currentLocation);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
// node_modules/@miqro/jsx/build/esm/component/router.js
|
|
1218
|
-
function useIsLocationPathNameActive(path) {
|
|
1219
|
-
useConditional("useIsLocationPathNameMatch");
|
|
1220
|
-
const runtime2 = useRuntime();
|
|
1221
|
-
const basePath = runtime2.getBasePath();
|
|
1222
|
-
return isPathLocation(basePath, path, usePathname());
|
|
1223
|
-
}
|
|
1224
|
-
function Router(props) {
|
|
1225
|
-
const defaultElement = props.defaultElement;
|
|
1226
|
-
const locationPathName = usePathname();
|
|
1227
|
-
const runtime2 = useRuntime();
|
|
1228
|
-
const active = getActiveRoute(locationPathName, props.routes, runtime2);
|
|
1229
|
-
return active ? active.element : defaultElement;
|
|
1230
|
-
}
|
|
1231
|
-
Router.asFragment = true;
|
|
1232
|
-
Router.shadowInit = false;
|
|
1233
|
-
function Link(props, children) {
|
|
1234
|
-
const path = props.path;
|
|
1235
|
-
const runtime2 = useRuntime();
|
|
1236
|
-
const basePath = runtime2.getBasePath();
|
|
1237
|
-
const className = props.className ? props.className : "";
|
|
1238
|
-
const activeClass = props.classNameActive ? props.classNameActive : "active";
|
|
1239
|
-
const inactiveClass = props.classNameInactive ? props.classNameInactive : "inactive";
|
|
1240
|
-
const isActive = useIsLocationPathNameActive(path);
|
|
1241
|
-
const newClassName = `${className ? `${className} ` : ""}${isActive ? activeClass : inactiveClass}`;
|
|
1242
|
-
const fullPath = getFullPath(basePath, path);
|
|
1243
|
-
const element = {
|
|
1244
|
-
type: "Element",
|
|
1245
|
-
tagName: "a",
|
|
1246
|
-
props: {
|
|
1247
|
-
class: newClassName,
|
|
1248
|
-
href: fullPath
|
|
1249
|
-
},
|
|
1250
|
-
children
|
|
1251
|
-
};
|
|
1252
|
-
return props.disableHandler ? element : {
|
|
1253
|
-
...element,
|
|
1254
|
-
props: {
|
|
1255
|
-
...element.props,
|
|
1256
|
-
onclick: (ev) => {
|
|
1257
|
-
ev.preventDefault();
|
|
1258
|
-
runtime2.pushPath(fullPath);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
}
|
|
1263
|
-
Link.asFragment = true;
|
|
1264
|
-
Link.shadowInit = false;
|
|
1265
|
-
function getFullPath(basePath, p) {
|
|
1266
|
-
return normalizePath(`${basePath ? basePath : ""}${p}`);
|
|
1267
|
-
}
|
|
1268
|
-
function isPathLocation(basePath, p, currentLocation) {
|
|
1269
|
-
const path = getFullPath(basePath, p);
|
|
1270
|
-
const pathname = normalizePath(currentLocation);
|
|
1271
|
-
return pathname.toLocaleLowerCase() === path.toLowerCase();
|
|
1272
|
-
}
|
|
1273
|
-
function getActiveRoute(locationPathName, routes, runtime2) {
|
|
1274
|
-
let activeRoute;
|
|
1275
|
-
const basePath = runtime2.getBasePath() ? runtime2.getBasePath() : "";
|
|
1276
|
-
for (const route of routes) {
|
|
1277
|
-
if (isPathLocation(basePath, route.path, locationPathName)) {
|
|
1278
|
-
activeRoute = route;
|
|
1279
|
-
break;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
return activeRoute;
|
|
1283
|
-
}
|
|
1284
|
-
function normalizePath(path) {
|
|
1285
|
-
if (path.length > 1 && path.charAt(path.length - 1) === "/") {
|
|
1286
|
-
path = path.substring(0, path.length - 1);
|
|
1287
|
-
}
|
|
1288
|
-
return path;
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
// node_modules/@miqro/jsx/build/esm/hooks/ref.js
|
|
1292
|
-
function useRef() {
|
|
1293
|
-
const [ref, setRef] = useState(null);
|
|
1294
|
-
function useRefFunction(newRef) {
|
|
1295
|
-
setRef(newRef);
|
|
1296
|
-
}
|
|
1297
|
-
;
|
|
1298
|
-
useRefFunction.current = ref;
|
|
1299
|
-
return useRefFunction;
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
// node_modules/@miqro/jsx/build/esm/hooks/query.js
|
|
1303
|
-
function useAllQuery(watch = true) {
|
|
1304
|
-
const key = useConditional(`useAllQuery`);
|
|
1305
|
-
const runtime2 = useRuntime();
|
|
1306
|
-
const [last, setLast, getLast] = useState(getQueryValue(runtime2));
|
|
1307
|
-
useEffect(function useQueryEffect() {
|
|
1308
|
-
if (watch) {
|
|
1309
|
-
let useQueryEffectPathListener = function() {
|
|
1310
|
-
const current = getQueryValue(runtime2);
|
|
1311
|
-
if (getLast() !== current) {
|
|
1312
|
-
debug(runtime2, "useQuery listener for %s", key);
|
|
1313
|
-
setLast(current);
|
|
1314
|
-
}
|
|
1315
|
-
};
|
|
1316
|
-
runtime2.addPathListener(useQueryEffectPathListener);
|
|
1317
|
-
return function useQueryEffectUnLoad() {
|
|
1318
|
-
runtime2.removePathListener(useQueryEffectPathListener);
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
}, []);
|
|
1322
|
-
return last;
|
|
1323
|
-
}
|
|
1324
|
-
function useQuery(name, defaultValue, watch = true) {
|
|
1325
|
-
const key = useConditional(`useQuery-${name}-${defaultValue}`);
|
|
1326
|
-
const runtime2 = useRuntime();
|
|
1327
|
-
const [last, setLast, getLast] = useState(getQueryValue(runtime2, name, defaultValue));
|
|
1328
|
-
useEffect(function useQueryEffect() {
|
|
1329
|
-
if (watch) {
|
|
1330
|
-
let useQueryEffectPathListener = function() {
|
|
1331
|
-
const current = getQueryValue(runtime2, name, defaultValue);
|
|
1332
|
-
if (getLast() !== current) {
|
|
1333
|
-
debug(runtime2, "useQuery listener for %s", key);
|
|
1334
|
-
setLast(current);
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
runtime2.addPathListener(useQueryEffectPathListener);
|
|
1338
|
-
return function useQueryEffectUnLoad() {
|
|
1339
|
-
runtime2.removePathListener(useQueryEffectPathListener);
|
|
1340
|
-
};
|
|
1341
|
-
}
|
|
1342
|
-
}, []);
|
|
1343
|
-
return [
|
|
1344
|
-
last,
|
|
1345
|
-
function setQuery(newValue) {
|
|
1346
|
-
setQueryValue(runtime2, name, newValue, watch);
|
|
1347
|
-
setLast(newValue);
|
|
1348
|
-
},
|
|
1349
|
-
function getQuery() {
|
|
1350
|
-
return getQueryValue(runtime2, name, defaultValue);
|
|
1351
|
-
}
|
|
1352
|
-
];
|
|
1353
|
-
}
|
|
1354
|
-
function getQueryValue(runtime2, name, defaultValue) {
|
|
1355
|
-
if (!name) {
|
|
1356
|
-
return runtime2.getLocation().searchParams.toString();
|
|
1357
|
-
} else {
|
|
1358
|
-
const ret = runtime2.getLocation().searchParams.getAll(name);
|
|
1359
|
-
if (ret.length === 0) {
|
|
1360
|
-
return defaultValue !== void 0 ? defaultValue : null;
|
|
1361
|
-
}
|
|
1362
|
-
return ret && ret.length === 1 && !(defaultValue instanceof Array) ? ret[0] : ret;
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
function setQueryValue(runtime2, name, value, watch = true) {
|
|
1366
|
-
const url = runtime2.getLocation();
|
|
1367
|
-
if (value instanceof Array) {
|
|
1368
|
-
url.searchParams.delete(name);
|
|
1369
|
-
for (const v of value) {
|
|
1370
|
-
url.searchParams.append(name, v);
|
|
1371
|
-
}
|
|
1372
|
-
} else if (value !== null) {
|
|
1373
|
-
url.searchParams.set(name, value);
|
|
1374
|
-
} else {
|
|
1375
|
-
url.searchParams.delete(name);
|
|
1376
|
-
}
|
|
1377
|
-
if (watch) {
|
|
1378
|
-
runtime2.pushPath(String(url));
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
// node_modules/@miqro/jsx/build/esm/hooks/useelement.js
|
|
1383
|
-
function useElement() {
|
|
1384
|
-
useConditional("useElement");
|
|
1385
|
-
const currentContext2 = useRenderContext();
|
|
1386
|
-
if (!currentContext2) {
|
|
1387
|
-
throw new Error("useElement not in render");
|
|
1388
|
-
}
|
|
1389
|
-
return currentContext2.node.ref ? currentContext2.node.ref : null;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
// node_modules/@miqro/jsx/build/esm/hooks/context.js
|
|
1393
|
-
function createContext(defaultValue) {
|
|
1394
|
-
const symbol = Symbol();
|
|
1395
|
-
return {
|
|
1396
|
-
provider: createContextProvider(symbol, defaultValue),
|
|
1397
|
-
symbol
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
function useContext(context) {
|
|
1401
|
-
useConditional("useContext");
|
|
1402
|
-
const currentContext2 = useRenderContext();
|
|
1403
|
-
if (!currentContext2) {
|
|
1404
|
-
throw new Error("useContext not in render");
|
|
1405
|
-
}
|
|
1406
|
-
let currentNode = currentContext2.node;
|
|
1407
|
-
while (currentNode) {
|
|
1408
|
-
if (currentNode.type === "ContextProvider" && currentNode.contextKey === context.symbol) {
|
|
1409
|
-
return currentNode.contextValue;
|
|
1410
|
-
}
|
|
1411
|
-
currentNode = currentNode.parent;
|
|
1412
|
-
}
|
|
1413
|
-
throw new Error("cannot find provider!");
|
|
1414
|
-
}
|
|
1415
|
-
function createContextProvider(symbol, defaultValue) {
|
|
1416
|
-
function ContextProvider2({ value }, ...children) {
|
|
1417
|
-
useConditional("ContextProvider");
|
|
1418
|
-
const currentContext2 = useRenderContext();
|
|
1419
|
-
if (!currentContext2) {
|
|
1420
|
-
throw new Error("ContextProvider not in render");
|
|
1421
|
-
}
|
|
1422
|
-
return {
|
|
1423
|
-
type: "ContextProvider",
|
|
1424
|
-
contextKey: symbol,
|
|
1425
|
-
contextValue: value === void 0 ? defaultValue : value,
|
|
1426
|
-
children
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
ContextProvider2.asFragment = true;
|
|
1430
|
-
ContextProvider2.shadowInit = false;
|
|
1431
|
-
return ContextProvider2;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
// src/define.ts
|
|
1435
|
-
var customElementDefine = customElements.define.bind(customElements);
|
|
1436
|
-
function domElementDefine(tagName, component, options) {
|
|
1437
|
-
let container = null;
|
|
1438
|
-
let originalChildNodes = [];
|
|
1439
|
-
customElementDefine(tagName, class CustomElement extends HTMLElement {
|
|
1440
|
-
static {
|
|
1441
|
-
this.observedAttributes = options?.observedAttributes;
|
|
1442
|
-
}
|
|
1443
|
-
constructor() {
|
|
1444
|
-
super();
|
|
1445
|
-
container = runtime.createContainer(this, { shadowInit: options?.shadowInit, runtimeOptions: options?.runtimeOptions });
|
|
1446
|
-
}
|
|
1447
|
-
connectedCallback() {
|
|
1448
|
-
if (!container) {
|
|
1449
|
-
throw new Error("cannot find container!");
|
|
1450
|
-
}
|
|
1451
|
-
this.reCalculateOriginalChildren();
|
|
1452
|
-
const props = {};
|
|
1453
|
-
const self = this;
|
|
1454
|
-
for (const name of self.getAttributeNames()) {
|
|
1455
|
-
props[name] = self.getAttribute(name);
|
|
1456
|
-
}
|
|
1457
|
-
props["$element$"] = self;
|
|
1458
|
-
container.render(
|
|
1459
|
-
createElement(component, props, originalChildNodes)
|
|
1460
|
-
);
|
|
1461
|
-
}
|
|
1462
|
-
disconnectedCallback() {
|
|
1463
|
-
if (!container) {
|
|
1464
|
-
throw new Error("cannot find container!");
|
|
1465
|
-
}
|
|
1466
|
-
container.disconnect();
|
|
1467
|
-
}
|
|
1468
|
-
attributeChangedCallback() {
|
|
1469
|
-
if (!container) {
|
|
1470
|
-
throw new Error("cannot find container!");
|
|
1471
|
-
}
|
|
1472
|
-
const props = {};
|
|
1473
|
-
const self = this;
|
|
1474
|
-
for (const name of self.getAttributeNames()) {
|
|
1475
|
-
props[name] = self.getAttribute(name);
|
|
1476
|
-
}
|
|
1477
|
-
props["$element$"] = self;
|
|
1478
|
-
container.render(createElement(component, props, originalChildNodes));
|
|
1479
|
-
}
|
|
1480
|
-
reCalculateOriginalChildren() {
|
|
1481
|
-
originalChildNodes = [];
|
|
1482
|
-
const self = this;
|
|
1483
|
-
for (let i = 0; i < self.childNodes.length; i++) {
|
|
1484
|
-
const node = self.childNodes[i];
|
|
1485
|
-
originalChildNodes.push(node);
|
|
1486
|
-
}
|
|
1487
|
-
for (const o of originalChildNodes) {
|
|
1488
|
-
o.remove();
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
getProps() {
|
|
1492
|
-
const props = {};
|
|
1493
|
-
const self = this;
|
|
1494
|
-
for (const name of self.getAttributeNames()) {
|
|
1495
|
-
props[name] = self.getAttribute(name);
|
|
1496
|
-
}
|
|
1497
|
-
return props;
|
|
1498
|
-
}
|
|
1499
|
-
}, options && options.extends ? {
|
|
1500
|
-
extends: options.extends
|
|
1501
|
-
} : void 0);
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
// src/runtime.ts
|
|
1505
|
-
var elementAttachShadowPrototype = HTMLElement.prototype.attachShadow;
|
|
1506
|
-
var documentGetElementById = document.getElementById.bind(document);
|
|
1507
|
-
var documentCreateElementPrototype = document.createElement.bind(document);
|
|
1508
|
-
var documentCreateTextNodePrototype = document.createTextNode.bind(document);
|
|
1509
|
-
var consoleLog = console.log.bind(console);
|
|
1510
|
-
var consoleError = console.error.bind(console);
|
|
1511
|
-
var documentDocumentElementGetAttributePrototype = document.documentElement.getAttribute.bind(document.documentElement);
|
|
1512
|
-
var runtime = {
|
|
1513
|
-
name: "dom",
|
|
1514
|
-
newEvent: (type, detail) => {
|
|
1515
|
-
return new CustomEvent(type, {
|
|
1516
|
-
detail
|
|
1517
|
-
});
|
|
1518
|
-
},
|
|
1519
|
-
getActiveElement: () => {
|
|
1520
|
-
return document.activeElement;
|
|
1521
|
-
},
|
|
1522
|
-
createContainer: (element, options) => {
|
|
1523
|
-
return createContainer(element, runtime, options);
|
|
1524
|
-
},
|
|
1525
|
-
getElementById: (id) => {
|
|
1526
|
-
return documentGetElementById(id);
|
|
1527
|
-
},
|
|
1528
|
-
define: (tagName, component, options) => {
|
|
1529
|
-
return domElementDefine(tagName, component, options);
|
|
1530
|
-
},
|
|
1531
|
-
createElement: (tagName) => documentCreateElementPrototype(tagName),
|
|
1532
|
-
createTextNode: (textContent) => documentCreateTextNodePrototype(textContent),
|
|
1533
|
-
attachShadow: (element, options) => elementAttachShadowPrototype.call(element, options),
|
|
1534
|
-
isInstanceofNode: (obj) => obj instanceof Node,
|
|
1535
|
-
isIntanceOfHTMLElement: (obj) => obj instanceof HTMLElement,
|
|
1536
|
-
createAbortController: () => new AbortController(),
|
|
1537
|
-
consoleLog: (...args) => consoleLog(...args),
|
|
1538
|
-
consoleError: (...args) => consoleError(...args),
|
|
1539
|
-
clearTimeout: (timeout) => clearTimeout(timeout),
|
|
1540
|
-
setTimeout: (cb, ms) => setTimeout(cb, ms),
|
|
1541
|
-
getLocation: () => {
|
|
1542
|
-
return new URL(window.location.href);
|
|
1543
|
-
},
|
|
1544
|
-
getBasePath: () => {
|
|
1545
|
-
return documentDocumentElementGetAttributePrototype("data-base-path");
|
|
1546
|
-
},
|
|
1547
|
-
addPathListener: (listener) => {
|
|
1548
|
-
window.addEventListener("popstate", listener);
|
|
1549
|
-
},
|
|
1550
|
-
removePathListener: (listener) => {
|
|
1551
|
-
window.removeEventListener("popstate", listener);
|
|
1552
|
-
},
|
|
1553
|
-
pushPath: (pathname) => {
|
|
1554
|
-
history.pushState(null, "", pathname);
|
|
1555
|
-
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
1556
|
-
}
|
|
1557
|
-
};
|
|
1558
|
-
function createDOMContainer(element, options) {
|
|
1559
|
-
return runtime.createContainer(element, options);
|
|
1560
|
-
}
|
|
1561
|
-
export {
|
|
1562
|
-
Fragment,
|
|
1563
|
-
JSX,
|
|
1564
|
-
Link,
|
|
1565
|
-
Router,
|
|
1566
|
-
createContainer,
|
|
1567
|
-
createContext,
|
|
1568
|
-
createDOMContainer,
|
|
1569
|
-
createElement,
|
|
1570
|
-
domElementDefine as define,
|
|
1571
|
-
enableDebugLog,
|
|
1572
|
-
isPathLocation,
|
|
1573
|
-
runtime,
|
|
1574
|
-
setDefaultOptions,
|
|
1575
|
-
useAllQuery,
|
|
1576
|
-
useConditional,
|
|
1577
|
-
useContext,
|
|
1578
|
-
useEffect,
|
|
1579
|
-
useElement,
|
|
1580
|
-
useIsLocationPathNameActive,
|
|
1581
|
-
usePathname,
|
|
1582
|
-
useQuery,
|
|
1583
|
-
useRef,
|
|
1584
|
-
useRefresh,
|
|
1585
|
-
useRuntime,
|
|
1586
|
-
useState
|
|
1587
|
-
};
|