@zeus-js/zeus 0.1.0-beta.0 → 0.1.0-beta.2
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/advanced.cjs.js +26 -0
- package/dist/advanced.cjs.prod.js +26 -0
- package/dist/advanced.d.ts +1 -0
- package/dist/advanced.js +7 -0
- package/dist/advanced.prod.js +7 -0
- package/dist/capabilities.cjs.js +59 -0
- package/dist/capabilities.cjs.prod.js +59 -0
- package/dist/capabilities.d.ts +51 -0
- package/dist/capabilities.js +50 -0
- package/dist/capabilities.prod.js +50 -0
- package/dist/zeus.cjs.js +6 -1
- package/dist/zeus.cjs.prod.js +6 -1
- package/dist/zeus.esm-browser.js +119 -26
- package/dist/zeus.esm-browser.prod.js +1 -1
- package/dist/zeus.esm-bundler.js +7 -2
- package/dist/zeus.global.js +119 -26
- package/dist/zeus.global.prod.js +1 -1
- package/package.json +34 -6
- package/src/jsx.d.ts +87 -85
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _zeus_js_signal = require("@zeus-js/signal");
|
|
11
|
+
exports.ReactiveFlags = _zeus_js_signal.ReactiveFlags;
|
|
12
|
+
exports.TrackOpTypes = _zeus_js_signal.TrackOpTypes;
|
|
13
|
+
exports.TriggerOpTypes = _zeus_js_signal.TriggerOpTypes;
|
|
14
|
+
exports.effectScope = _zeus_js_signal.effectScope;
|
|
15
|
+
exports.enableTracking = _zeus_js_signal.enableTracking;
|
|
16
|
+
exports.flushJobs = _zeus_js_signal.flushJobs;
|
|
17
|
+
exports.getCurrentEffect = _zeus_js_signal.getCurrentEffect;
|
|
18
|
+
exports.getCurrentScope = _zeus_js_signal.getCurrentScope;
|
|
19
|
+
exports.getCurrentWatcher = _zeus_js_signal.getCurrentWatcher;
|
|
20
|
+
exports.onEffectCleanup = _zeus_js_signal.onEffectCleanup;
|
|
21
|
+
exports.onScopeDispose = _zeus_js_signal.onScopeDispose;
|
|
22
|
+
exports.onWatcherCleanup = _zeus_js_signal.onWatcherCleanup;
|
|
23
|
+
exports.pauseTracking = _zeus_js_signal.pauseTracking;
|
|
24
|
+
exports.queueJob = _zeus_js_signal.queueJob;
|
|
25
|
+
exports.resetTracking = _zeus_js_signal.resetTracking;
|
|
26
|
+
exports.stop = _zeus_js_signal.stop;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
let _zeus_js_signal = require("@zeus-js/signal");
|
|
11
|
+
exports.ReactiveFlags = _zeus_js_signal.ReactiveFlags;
|
|
12
|
+
exports.TrackOpTypes = _zeus_js_signal.TrackOpTypes;
|
|
13
|
+
exports.TriggerOpTypes = _zeus_js_signal.TriggerOpTypes;
|
|
14
|
+
exports.effectScope = _zeus_js_signal.effectScope;
|
|
15
|
+
exports.enableTracking = _zeus_js_signal.enableTracking;
|
|
16
|
+
exports.flushJobs = _zeus_js_signal.flushJobs;
|
|
17
|
+
exports.getCurrentEffect = _zeus_js_signal.getCurrentEffect;
|
|
18
|
+
exports.getCurrentScope = _zeus_js_signal.getCurrentScope;
|
|
19
|
+
exports.getCurrentWatcher = _zeus_js_signal.getCurrentWatcher;
|
|
20
|
+
exports.onEffectCleanup = _zeus_js_signal.onEffectCleanup;
|
|
21
|
+
exports.onScopeDispose = _zeus_js_signal.onScopeDispose;
|
|
22
|
+
exports.onWatcherCleanup = _zeus_js_signal.onWatcherCleanup;
|
|
23
|
+
exports.pauseTracking = _zeus_js_signal.pauseTracking;
|
|
24
|
+
exports.queueJob = _zeus_js_signal.queueJob;
|
|
25
|
+
exports.resetTracking = _zeus_js_signal.resetTracking;
|
|
26
|
+
exports.stop = _zeus_js_signal.stop;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ReactiveEffectOptions, ReactiveEffectRunner, ReactiveFlags, Scope, TrackOpTypes, TriggerOpTypes, effectScope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, resetTracking, stop } from '@zeus-js/signal';
|
package/dist/advanced.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
import { ReactiveFlags, TrackOpTypes, TriggerOpTypes, effectScope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, resetTracking, stop } from "@zeus-js/signal";
|
|
7
|
+
export { ReactiveFlags, TrackOpTypes, TriggerOpTypes, effectScope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, resetTracking, stop };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
import { ReactiveFlags, TrackOpTypes, TriggerOpTypes, effectScope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, resetTracking, stop } from "@zeus-js/signal";
|
|
7
|
+
export { ReactiveFlags, TrackOpTypes, TriggerOpTypes, effectScope, enableTracking, flushJobs, getCurrentEffect, getCurrentScope, getCurrentWatcher, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, queueJob, resetTracking, stop };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
const ZEUS_CAPABILITIES = {
|
|
11
|
+
packageName: "@zeus-js/zeus",
|
|
12
|
+
version: "0.1.0-beta.2",
|
|
13
|
+
publicApi: {
|
|
14
|
+
state: true,
|
|
15
|
+
computed: true,
|
|
16
|
+
effect: true,
|
|
17
|
+
watch: true,
|
|
18
|
+
scope: true,
|
|
19
|
+
batch: true,
|
|
20
|
+
untrack: true,
|
|
21
|
+
nextTick: true,
|
|
22
|
+
onCleanup: true,
|
|
23
|
+
render: true,
|
|
24
|
+
Show: true,
|
|
25
|
+
For: true,
|
|
26
|
+
createContext: true,
|
|
27
|
+
provide: true,
|
|
28
|
+
inject: true,
|
|
29
|
+
useContext: true
|
|
30
|
+
},
|
|
31
|
+
jsx: {
|
|
32
|
+
jsxRuntime: true,
|
|
33
|
+
jsxDevRuntime: true,
|
|
34
|
+
fragment: true,
|
|
35
|
+
compiledJsx: true
|
|
36
|
+
},
|
|
37
|
+
webComponents: {
|
|
38
|
+
defineElement: true,
|
|
39
|
+
Host: true,
|
|
40
|
+
Slot: true,
|
|
41
|
+
shadowDom: true,
|
|
42
|
+
lightDom: true,
|
|
43
|
+
namedSlots: true,
|
|
44
|
+
defaultSlot: true,
|
|
45
|
+
props: true,
|
|
46
|
+
attrs: true,
|
|
47
|
+
reflect: true,
|
|
48
|
+
events: true,
|
|
49
|
+
styles: true,
|
|
50
|
+
context: true
|
|
51
|
+
},
|
|
52
|
+
stability: {
|
|
53
|
+
main: "stable",
|
|
54
|
+
advanced: "advanced",
|
|
55
|
+
internal: "private"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.ZEUS_CAPABILITIES = ZEUS_CAPABILITIES;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
|
+
* (c) 2026 baicie
|
|
4
|
+
* Released under the MIT License.
|
|
5
|
+
**/
|
|
6
|
+
Object.defineProperties(exports, {
|
|
7
|
+
__esModule: { value: true },
|
|
8
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
9
|
+
});
|
|
10
|
+
const ZEUS_CAPABILITIES = {
|
|
11
|
+
packageName: "@zeus-js/zeus",
|
|
12
|
+
version: "0.1.0-beta.2",
|
|
13
|
+
publicApi: {
|
|
14
|
+
state: true,
|
|
15
|
+
computed: true,
|
|
16
|
+
effect: true,
|
|
17
|
+
watch: true,
|
|
18
|
+
scope: true,
|
|
19
|
+
batch: true,
|
|
20
|
+
untrack: true,
|
|
21
|
+
nextTick: true,
|
|
22
|
+
onCleanup: true,
|
|
23
|
+
render: true,
|
|
24
|
+
Show: true,
|
|
25
|
+
For: true,
|
|
26
|
+
createContext: true,
|
|
27
|
+
provide: true,
|
|
28
|
+
inject: true,
|
|
29
|
+
useContext: true
|
|
30
|
+
},
|
|
31
|
+
jsx: {
|
|
32
|
+
jsxRuntime: true,
|
|
33
|
+
jsxDevRuntime: true,
|
|
34
|
+
fragment: true,
|
|
35
|
+
compiledJsx: true
|
|
36
|
+
},
|
|
37
|
+
webComponents: {
|
|
38
|
+
defineElement: true,
|
|
39
|
+
Host: true,
|
|
40
|
+
Slot: true,
|
|
41
|
+
shadowDom: true,
|
|
42
|
+
lightDom: true,
|
|
43
|
+
namedSlots: true,
|
|
44
|
+
defaultSlot: true,
|
|
45
|
+
props: true,
|
|
46
|
+
attrs: true,
|
|
47
|
+
reflect: true,
|
|
48
|
+
events: true,
|
|
49
|
+
styles: true,
|
|
50
|
+
context: true
|
|
51
|
+
},
|
|
52
|
+
stability: {
|
|
53
|
+
main: "stable",
|
|
54
|
+
advanced: "advanced",
|
|
55
|
+
internal: "private"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.ZEUS_CAPABILITIES = ZEUS_CAPABILITIES;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const ZEUS_CAPABILITIES: {
|
|
2
|
+
readonly packageName: "@zeus-js/zeus";
|
|
3
|
+
readonly version: string;
|
|
4
|
+
readonly publicApi: {
|
|
5
|
+
readonly state: true;
|
|
6
|
+
readonly computed: true;
|
|
7
|
+
readonly effect: true;
|
|
8
|
+
readonly watch: true;
|
|
9
|
+
readonly scope: true;
|
|
10
|
+
readonly batch: true;
|
|
11
|
+
readonly untrack: true;
|
|
12
|
+
readonly nextTick: true;
|
|
13
|
+
readonly onCleanup: true;
|
|
14
|
+
readonly render: true;
|
|
15
|
+
readonly Show: true;
|
|
16
|
+
readonly For: true;
|
|
17
|
+
readonly createContext: true;
|
|
18
|
+
readonly provide: true;
|
|
19
|
+
readonly inject: true;
|
|
20
|
+
readonly useContext: true;
|
|
21
|
+
};
|
|
22
|
+
readonly jsx: {
|
|
23
|
+
readonly jsxRuntime: true;
|
|
24
|
+
readonly jsxDevRuntime: true;
|
|
25
|
+
readonly fragment: true;
|
|
26
|
+
readonly compiledJsx: true;
|
|
27
|
+
};
|
|
28
|
+
readonly webComponents: {
|
|
29
|
+
readonly defineElement: true;
|
|
30
|
+
readonly Host: true;
|
|
31
|
+
readonly Slot: true;
|
|
32
|
+
readonly shadowDom: true;
|
|
33
|
+
readonly lightDom: true;
|
|
34
|
+
readonly namedSlots: true;
|
|
35
|
+
readonly defaultSlot: true;
|
|
36
|
+
readonly props: true;
|
|
37
|
+
readonly attrs: true;
|
|
38
|
+
readonly reflect: true;
|
|
39
|
+
readonly events: true;
|
|
40
|
+
readonly styles: true;
|
|
41
|
+
readonly context: true;
|
|
42
|
+
};
|
|
43
|
+
readonly stability: {
|
|
44
|
+
readonly main: "stable";
|
|
45
|
+
readonly advanced: "advanced";
|
|
46
|
+
readonly internal: "private";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export type ZeusCapabilities = typeof ZEUS_CAPABILITIES;
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const ZEUS_CAPABILITIES = {
|
|
2
|
+
packageName: "@zeus-js/zeus",
|
|
3
|
+
version: "0.1.0-beta.2",
|
|
4
|
+
publicApi: {
|
|
5
|
+
state: true,
|
|
6
|
+
computed: true,
|
|
7
|
+
effect: true,
|
|
8
|
+
watch: true,
|
|
9
|
+
scope: true,
|
|
10
|
+
batch: true,
|
|
11
|
+
untrack: true,
|
|
12
|
+
nextTick: true,
|
|
13
|
+
onCleanup: true,
|
|
14
|
+
render: true,
|
|
15
|
+
Show: true,
|
|
16
|
+
For: true,
|
|
17
|
+
createContext: true,
|
|
18
|
+
provide: true,
|
|
19
|
+
inject: true,
|
|
20
|
+
useContext: true
|
|
21
|
+
},
|
|
22
|
+
jsx: {
|
|
23
|
+
jsxRuntime: true,
|
|
24
|
+
jsxDevRuntime: true,
|
|
25
|
+
fragment: true,
|
|
26
|
+
compiledJsx: true
|
|
27
|
+
},
|
|
28
|
+
webComponents: {
|
|
29
|
+
defineElement: true,
|
|
30
|
+
Host: true,
|
|
31
|
+
Slot: true,
|
|
32
|
+
shadowDom: true,
|
|
33
|
+
lightDom: true,
|
|
34
|
+
namedSlots: true,
|
|
35
|
+
defaultSlot: true,
|
|
36
|
+
props: true,
|
|
37
|
+
attrs: true,
|
|
38
|
+
reflect: true,
|
|
39
|
+
events: true,
|
|
40
|
+
styles: true,
|
|
41
|
+
context: true
|
|
42
|
+
},
|
|
43
|
+
stability: {
|
|
44
|
+
main: "stable",
|
|
45
|
+
advanced: "advanced",
|
|
46
|
+
internal: "private"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ZEUS_CAPABILITIES };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const ZEUS_CAPABILITIES = {
|
|
2
|
+
packageName: "@zeus-js/zeus",
|
|
3
|
+
version: "0.1.0-beta.2",
|
|
4
|
+
publicApi: {
|
|
5
|
+
state: true,
|
|
6
|
+
computed: true,
|
|
7
|
+
effect: true,
|
|
8
|
+
watch: true,
|
|
9
|
+
scope: true,
|
|
10
|
+
batch: true,
|
|
11
|
+
untrack: true,
|
|
12
|
+
nextTick: true,
|
|
13
|
+
onCleanup: true,
|
|
14
|
+
render: true,
|
|
15
|
+
Show: true,
|
|
16
|
+
For: true,
|
|
17
|
+
createContext: true,
|
|
18
|
+
provide: true,
|
|
19
|
+
inject: true,
|
|
20
|
+
useContext: true
|
|
21
|
+
},
|
|
22
|
+
jsx: {
|
|
23
|
+
jsxRuntime: true,
|
|
24
|
+
jsxDevRuntime: true,
|
|
25
|
+
fragment: true,
|
|
26
|
+
compiledJsx: true
|
|
27
|
+
},
|
|
28
|
+
webComponents: {
|
|
29
|
+
defineElement: true,
|
|
30
|
+
Host: true,
|
|
31
|
+
Slot: true,
|
|
32
|
+
shadowDom: true,
|
|
33
|
+
lightDom: true,
|
|
34
|
+
namedSlots: true,
|
|
35
|
+
defaultSlot: true,
|
|
36
|
+
props: true,
|
|
37
|
+
attrs: true,
|
|
38
|
+
reflect: true,
|
|
39
|
+
events: true,
|
|
40
|
+
styles: true,
|
|
41
|
+
context: true
|
|
42
|
+
},
|
|
43
|
+
stability: {
|
|
44
|
+
main: "stable",
|
|
45
|
+
advanced: "advanced",
|
|
46
|
+
internal: "private"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ZEUS_CAPABILITIES };
|
package/dist/zeus.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zeus v0.1.0-beta.
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -32,6 +32,11 @@ function createJSXNode(type, props) {
|
|
|
32
32
|
const value = props[key];
|
|
33
33
|
if (key.startsWith("on") && typeof value === "function") el.addEventListener(key.slice(2).toLowerCase(), value);
|
|
34
34
|
else if (key === "ref") setFallbackRef(value, el);
|
|
35
|
+
else if (key.startsWith("prop:")) {
|
|
36
|
+
const propName = key.slice(5);
|
|
37
|
+
if (typeof value === "function") (0, _zeus_js_runtime_dom.bindProp)(el, propName, value);
|
|
38
|
+
else el[propName] = value;
|
|
39
|
+
} else if (typeof value === "function") (0, _zeus_js_runtime_dom.bindAttr)(el, key, value);
|
|
35
40
|
else if (value != null && value !== false) el.setAttribute(key === "className" ? "class" : key, String(value));
|
|
36
41
|
}
|
|
37
42
|
if (children !== void 0) (0, _zeus_js_runtime_dom.insert)(el, children);
|
package/dist/zeus.cjs.prod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zeus v0.1.0-beta.
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -32,6 +32,11 @@ function createJSXNode(type, props) {
|
|
|
32
32
|
const value = props[key];
|
|
33
33
|
if (key.startsWith("on") && typeof value === "function") el.addEventListener(key.slice(2).toLowerCase(), value);
|
|
34
34
|
else if (key === "ref") setFallbackRef(value, el);
|
|
35
|
+
else if (key.startsWith("prop:")) {
|
|
36
|
+
const propName = key.slice(5);
|
|
37
|
+
if (typeof value === "function") (0, _zeus_js_runtime_dom.bindProp)(el, propName, value);
|
|
38
|
+
else el[propName] = value;
|
|
39
|
+
} else if (typeof value === "function") (0, _zeus_js_runtime_dom.bindAttr)(el, key, value);
|
|
35
40
|
else if (value != null && value !== false) el.setAttribute(key === "className" ? "class" : key, String(value));
|
|
36
41
|
}
|
|
37
42
|
if (children !== void 0) (0, _zeus_js_runtime_dom.insert)(el, children);
|
package/dist/zeus.esm-browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zeus v0.1.0-beta.
|
|
2
|
+
* zeus v0.1.0-beta.2
|
|
3
3
|
* (c) 2026 baicie
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
**/
|
|
@@ -1841,17 +1841,43 @@ function resolveValue$2(value) {
|
|
|
1841
1841
|
//#endregion
|
|
1842
1842
|
//#region packages/core/runtime-dom/src/bindings.ts
|
|
1843
1843
|
function setAttr(el, name, value) {
|
|
1844
|
+
const attrName = normalizeAttrName(name);
|
|
1845
|
+
const propName = getBooleanDomPropertyName(name);
|
|
1846
|
+
if (propName && el instanceof HTMLElement) {
|
|
1847
|
+
el[propName] = Boolean(value);
|
|
1848
|
+
if (value == null || value === false) el.removeAttribute(attrName);
|
|
1849
|
+
else if (value === true) el.setAttribute(attrName, "");
|
|
1850
|
+
else el.setAttribute(attrName, String(value));
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1844
1853
|
if (value == null || value === false) {
|
|
1845
|
-
el.removeAttribute(
|
|
1854
|
+
el.removeAttribute(attrName);
|
|
1846
1855
|
return;
|
|
1847
1856
|
}
|
|
1848
|
-
const attrName = normalizeAttrName(name);
|
|
1849
1857
|
if (value === true) {
|
|
1850
1858
|
el.setAttribute(attrName, "");
|
|
1851
1859
|
return;
|
|
1852
1860
|
}
|
|
1853
1861
|
el.setAttribute(attrName, String(value));
|
|
1854
1862
|
}
|
|
1863
|
+
function getBooleanDomPropertyName(name) {
|
|
1864
|
+
return BOOLEAN_DOM_PROPERTY_NAME[name];
|
|
1865
|
+
}
|
|
1866
|
+
const BOOLEAN_DOM_PROPERTY_NAME = {
|
|
1867
|
+
hidden: "hidden",
|
|
1868
|
+
disabled: "disabled",
|
|
1869
|
+
readonly: "readOnly",
|
|
1870
|
+
readOnly: "readOnly",
|
|
1871
|
+
multiple: "multiple",
|
|
1872
|
+
selected: "selected",
|
|
1873
|
+
checked: "checked",
|
|
1874
|
+
open: "open",
|
|
1875
|
+
autofocus: "autofocus",
|
|
1876
|
+
autoFocus: "autofocus",
|
|
1877
|
+
indeterminate: "indeterminate",
|
|
1878
|
+
noValidate: "noValidate",
|
|
1879
|
+
novalidate: "noValidate"
|
|
1880
|
+
};
|
|
1855
1881
|
function normalizeAttrName(name) {
|
|
1856
1882
|
return name === "className" ? "class" : name;
|
|
1857
1883
|
}
|
|
@@ -1860,6 +1886,11 @@ function bindAttr(el, name, value) {
|
|
|
1860
1886
|
setAttr(el, name, value());
|
|
1861
1887
|
});
|
|
1862
1888
|
}
|
|
1889
|
+
function bindProp(el, name, value) {
|
|
1890
|
+
effect(() => {
|
|
1891
|
+
el[name] = value();
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1863
1894
|
function bindClass(el, value) {
|
|
1864
1895
|
effect(() => {
|
|
1865
1896
|
const next = normalizeClass(value());
|
|
@@ -2029,6 +2060,42 @@ function _objectSpread2(e) {
|
|
|
2029
2060
|
}
|
|
2030
2061
|
//#endregion
|
|
2031
2062
|
//#region packages/core/runtime-dom/src/defineElement.ts
|
|
2063
|
+
function createPropStore(defs) {
|
|
2064
|
+
const slots = /* @__PURE__ */ new Map();
|
|
2065
|
+
const props = {};
|
|
2066
|
+
for (const def of defs) {
|
|
2067
|
+
const slot = state();
|
|
2068
|
+
slots.set(def.key, slot);
|
|
2069
|
+
Object.defineProperty(props, def.key, {
|
|
2070
|
+
configurable: false,
|
|
2071
|
+
enumerable: true,
|
|
2072
|
+
get() {
|
|
2073
|
+
return slot.value;
|
|
2074
|
+
},
|
|
2075
|
+
set(value) {
|
|
2076
|
+
slot.value = value;
|
|
2077
|
+
}
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
return {
|
|
2081
|
+
props,
|
|
2082
|
+
get(key) {
|
|
2083
|
+
var _slots$get;
|
|
2084
|
+
return (_slots$get = slots.get(key)) === null || _slots$get === void 0 ? void 0 : _slots$get.value;
|
|
2085
|
+
},
|
|
2086
|
+
set(key, value) {
|
|
2087
|
+
const slot = slots.get(key);
|
|
2088
|
+
if (!slot) {
|
|
2089
|
+
console.warn(`[Zeus custom-element] Unknown prop "${key}" was written.`);
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
slot.value = value;
|
|
2093
|
+
},
|
|
2094
|
+
has(key) {
|
|
2095
|
+
return slots.has(key);
|
|
2096
|
+
}
|
|
2097
|
+
};
|
|
2098
|
+
}
|
|
2032
2099
|
function defineElement(tagName, options, setup) {
|
|
2033
2100
|
var _options$props;
|
|
2034
2101
|
const propDefs = normalizePropDefinitions((_options$props = options.props) !== null && _options$props !== void 0 ? _options$props : {});
|
|
@@ -2039,12 +2106,13 @@ function defineElement(tagName, options, setup) {
|
|
|
2039
2106
|
}
|
|
2040
2107
|
constructor() {
|
|
2041
2108
|
super();
|
|
2042
|
-
this.props = state({});
|
|
2043
2109
|
this.lightChildren = [];
|
|
2044
2110
|
this.capturedLightChildren = false;
|
|
2045
2111
|
this.reflecting = false;
|
|
2046
|
-
|
|
2047
|
-
|
|
2112
|
+
this.propStore = createPropStore(propDefs);
|
|
2113
|
+
this.props = this.propStore.props;
|
|
2114
|
+
applyPropDefaults(this.propStore, propDefs);
|
|
2115
|
+
definePropAccessors(this, this.propStore, propDefs);
|
|
2048
2116
|
}
|
|
2049
2117
|
connectedCallback() {
|
|
2050
2118
|
var _options$shadow, _options$consumes;
|
|
@@ -2090,7 +2158,7 @@ function defineElement(tagName, options, setup) {
|
|
|
2090
2158
|
if (oldValue === newValue || this.reflecting) return;
|
|
2091
2159
|
const def = propDefs.find((item) => item.attr === name);
|
|
2092
2160
|
if (!def) return;
|
|
2093
|
-
this.
|
|
2161
|
+
this.propStore.set(def.key, castAttributeValue(newValue, def));
|
|
2094
2162
|
}
|
|
2095
2163
|
resolveRenderTarget(shadow) {
|
|
2096
2164
|
if (this.target) return this.target;
|
|
@@ -2105,12 +2173,12 @@ function defineElement(tagName, options, setup) {
|
|
|
2105
2173
|
for (const def of defs) {
|
|
2106
2174
|
if (def.attr === false) continue;
|
|
2107
2175
|
const value = this.getAttribute(def.attr);
|
|
2108
|
-
if (value !== null || def.type === Boolean) this.
|
|
2176
|
+
if (value !== null || def.type === Boolean) this.propStore.set(def.key, castAttributeValue(value, def));
|
|
2109
2177
|
}
|
|
2110
2178
|
}
|
|
2111
2179
|
_writePropFromProperty(key, value) {
|
|
2112
2180
|
const def = propDefs.find((item) => item.key === key);
|
|
2113
|
-
this.
|
|
2181
|
+
this.propStore.set(key, value);
|
|
2114
2182
|
if ((def === null || def === void 0 ? void 0 : def.reflect) && def.attr !== false) {
|
|
2115
2183
|
this.reflecting = true;
|
|
2116
2184
|
try {
|
|
@@ -2142,26 +2210,35 @@ function normalizePropDefinitions(props) {
|
|
|
2142
2210
|
};
|
|
2143
2211
|
});
|
|
2144
2212
|
}
|
|
2145
|
-
function applyPropDefaults(
|
|
2213
|
+
function applyPropDefaults(store, defs) {
|
|
2146
2214
|
for (const def of defs) {
|
|
2147
2215
|
if (!("default" in def)) continue;
|
|
2148
2216
|
const value = typeof def.default === "function" ? def.default() : def.default;
|
|
2149
|
-
|
|
2217
|
+
store.set(def.key, value);
|
|
2150
2218
|
}
|
|
2151
2219
|
}
|
|
2152
|
-
function definePropAccessors(element,
|
|
2220
|
+
function definePropAccessors(element, store, defs) {
|
|
2153
2221
|
for (const def of defs) {
|
|
2154
|
-
|
|
2155
|
-
Object.
|
|
2222
|
+
const key = def.key;
|
|
2223
|
+
const hadOwnValue = Object.prototype.hasOwnProperty.call(element, key);
|
|
2224
|
+
const ownValue = hadOwnValue ? element[key] : void 0;
|
|
2225
|
+
if (hadOwnValue) delete element[key];
|
|
2226
|
+
const existing = Object.getOwnPropertyDescriptor(element, key);
|
|
2227
|
+
if (existing && existing.configurable === false) {
|
|
2228
|
+
console.warn(`[Zeus custom-element] Cannot define prop "${key}" because an own non-configurable property already exists.`);
|
|
2229
|
+
continue;
|
|
2230
|
+
}
|
|
2231
|
+
Object.defineProperty(element, key, {
|
|
2156
2232
|
configurable: true,
|
|
2157
2233
|
enumerable: true,
|
|
2158
2234
|
get() {
|
|
2159
|
-
return
|
|
2235
|
+
return store.get(key);
|
|
2160
2236
|
},
|
|
2161
2237
|
set(value) {
|
|
2162
|
-
element._writePropFromProperty(
|
|
2238
|
+
element._writePropFromProperty(key, value);
|
|
2163
2239
|
}
|
|
2164
2240
|
});
|
|
2241
|
+
if (hadOwnValue) element._writePropFromProperty(key, ownValue);
|
|
2165
2242
|
}
|
|
2166
2243
|
}
|
|
2167
2244
|
function castAttributeValue(value, def) {
|
|
@@ -2244,7 +2321,8 @@ const HOST_RESERVED_KEYS = new Set([
|
|
|
2244
2321
|
"ref",
|
|
2245
2322
|
"class",
|
|
2246
2323
|
"className",
|
|
2247
|
-
"style"
|
|
2324
|
+
"style",
|
|
2325
|
+
"_elements"
|
|
2248
2326
|
]);
|
|
2249
2327
|
function Host(props) {
|
|
2250
2328
|
const context = getCurrentHostContext();
|
|
@@ -2259,6 +2337,7 @@ function bindHostProps(host, props) {
|
|
|
2259
2337
|
bindHostClass(host, props);
|
|
2260
2338
|
bindHostStyle(host, props);
|
|
2261
2339
|
bindHostAttributes(host, props);
|
|
2340
|
+
if ("_elements" in props) bindHostElementBindings(host, props);
|
|
2262
2341
|
}
|
|
2263
2342
|
function bindHostRef(host, props) {
|
|
2264
2343
|
if (!("ref" in props)) return;
|
|
@@ -2266,9 +2345,6 @@ function bindHostRef(host, props) {
|
|
|
2266
2345
|
}
|
|
2267
2346
|
function bindHostClass(host, props) {
|
|
2268
2347
|
if (!("class" in props) && !("className" in props)) return;
|
|
2269
|
-
/**
|
|
2270
|
-
* className has higher priority than class when both exist.
|
|
2271
|
-
*/
|
|
2272
2348
|
const value = props.className !== void 0 ? props.className : props.class;
|
|
2273
2349
|
bindClass(host, () => {
|
|
2274
2350
|
return resolveHostValue(value);
|
|
@@ -2290,13 +2366,25 @@ function bindHostAttributes(host, props) {
|
|
|
2290
2366
|
});
|
|
2291
2367
|
}
|
|
2292
2368
|
}
|
|
2369
|
+
function bindHostElementBindings(host, props) {
|
|
2370
|
+
const elements = props._elements;
|
|
2371
|
+
for (const _key of Object.keys(elements)) {
|
|
2372
|
+
const getEl = elements[_key];
|
|
2373
|
+
const el = getEl();
|
|
2374
|
+
if (!el) continue;
|
|
2375
|
+
for (const attrKey of Object.keys(props)) {
|
|
2376
|
+
if (HOST_RESERVED_KEYS.has(attrKey)) continue;
|
|
2377
|
+
if (isEventLikeProp(attrKey)) continue;
|
|
2378
|
+
const value = props[attrKey];
|
|
2379
|
+
bindAttr(el, normalizeHostAttrName(attrKey), () => {
|
|
2380
|
+
return resolveHostValue(value);
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2293
2385
|
function resolveHostValue(value) {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
* Function values are treated as getters except event-like props,
|
|
2297
|
-
* which are filtered before this function is called.
|
|
2298
|
-
*/
|
|
2299
|
-
return typeof value === "function" ? value() : value;
|
|
2386
|
+
if (typeof value === "function") return value();
|
|
2387
|
+
return value;
|
|
2300
2388
|
}
|
|
2301
2389
|
function resolveValue(value) {
|
|
2302
2390
|
return typeof value === "function" ? value() : value;
|
|
@@ -2341,6 +2429,11 @@ function createJSXNode(type, props) {
|
|
|
2341
2429
|
const value = props[key];
|
|
2342
2430
|
if (key.startsWith("on") && typeof value === "function") el.addEventListener(key.slice(2).toLowerCase(), value);
|
|
2343
2431
|
else if (key === "ref") setFallbackRef(value, el);
|
|
2432
|
+
else if (key.startsWith("prop:")) {
|
|
2433
|
+
const propName = key.slice(5);
|
|
2434
|
+
if (typeof value === "function") bindProp(el, propName, value);
|
|
2435
|
+
else el[propName] = value;
|
|
2436
|
+
} else if (typeof value === "function") bindAttr(el, key, value);
|
|
2344
2437
|
else if (value != null && value !== false) el.setAttribute(key === "className" ? "class" : key, String(value));
|
|
2345
2438
|
}
|
|
2346
2439
|
if (children !== void 0) insert(el, children);
|