essor 0.0.16-beta.1 → 0.0.16-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/{chunk-6WF7W6MG.esm.js → chunk-FIBC7TTZ.esm.js} +117 -135
- package/dist/chunk-FIBC7TTZ.esm.js.map +1 -0
- package/dist/chunk-LKZM76RW.dev.esm.js +19 -0
- package/dist/chunk-LKZM76RW.dev.esm.js.map +1 -0
- package/dist/essor.cjs.js +115 -136
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs.js +9 -9
- package/dist/essor.dev.cjs.js.map +1 -1
- package/dist/essor.dev.esm.js +3 -3
- package/dist/essor.esm.js +4 -4
- package/dist/server.cjs.js +3 -3
- package/dist/server.cjs.js.map +1 -1
- package/dist/server.dev.cjs.js +4 -4
- package/dist/server.dev.cjs.js.map +1 -1
- package/dist/server.dev.esm.js +3 -3
- package/dist/server.esm.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-6WF7W6MG.esm.js.map +0 -1
- package/dist/chunk-X5T6LJES.dev.esm.js +0 -19
- package/dist/chunk-X5T6LJES.dev.esm.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.16-beta.
|
|
3
|
-
* build time 2026-
|
|
2
|
+
* essor v0.0.16-beta.2
|
|
3
|
+
* build time 2026-05-08T05:50:51.766Z
|
|
4
4
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
**/
|
|
7
7
|
|
|
8
8
|
// src/version.ts
|
|
9
|
-
var __version = "0.0.16-beta.
|
|
9
|
+
var __version = "0.0.16-beta.2";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/shared.esm.js
|
|
12
12
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -20,9 +20,6 @@ function isString(val) {
|
|
|
20
20
|
function isNumber(val) {
|
|
21
21
|
return typeof val === "number";
|
|
22
22
|
}
|
|
23
|
-
function isNull(val) {
|
|
24
|
-
return val === null;
|
|
25
|
-
}
|
|
26
23
|
function isSymbol(val) {
|
|
27
24
|
return typeof val === "symbol";
|
|
28
25
|
}
|
|
@@ -42,13 +39,6 @@ function isNil(val) {
|
|
|
42
39
|
return val === null || val === void 0;
|
|
43
40
|
}
|
|
44
41
|
var isFunction = (val) => typeof val === "function";
|
|
45
|
-
function isFalsy(val) {
|
|
46
|
-
return val === false || val === null || val === void 0;
|
|
47
|
-
}
|
|
48
|
-
var isPrimitive = (val) => val == null || typeof val === "string" || typeof val === "number" || typeof val === "boolean" || typeof val === "symbol" || typeof val === "undefined";
|
|
49
|
-
function isHTMLElement(val) {
|
|
50
|
-
return val instanceof HTMLElement;
|
|
51
|
-
}
|
|
52
42
|
var isPlainObject = (val) => _toString.call(val) === "[object Object]";
|
|
53
43
|
function isStringNumber(val) {
|
|
54
44
|
if (!isString(val) || val === "") {
|
|
@@ -56,12 +46,6 @@ function isStringNumber(val) {
|
|
|
56
46
|
}
|
|
57
47
|
return !Number.isNaN(Number(val));
|
|
58
48
|
}
|
|
59
|
-
function isUndefined(val) {
|
|
60
|
-
return typeof val === "undefined";
|
|
61
|
-
}
|
|
62
|
-
function isBoolean(val) {
|
|
63
|
-
return typeof val === "boolean";
|
|
64
|
-
}
|
|
65
49
|
var _toString = Object.prototype.toString;
|
|
66
50
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
67
51
|
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
@@ -2280,7 +2264,7 @@ var __objRest = (source, exclude) => {
|
|
|
2280
2264
|
return target;
|
|
2281
2265
|
};
|
|
2282
2266
|
var __async = (__this, __arguments, generator) => {
|
|
2283
|
-
return new Promise((
|
|
2267
|
+
return new Promise((resolve2, reject) => {
|
|
2284
2268
|
var fulfilled = (value) => {
|
|
2285
2269
|
try {
|
|
2286
2270
|
step(generator.next(value));
|
|
@@ -2295,7 +2279,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2295
2279
|
reject(e);
|
|
2296
2280
|
}
|
|
2297
2281
|
};
|
|
2298
|
-
var step = (x) => x.done ?
|
|
2282
|
+
var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2299
2283
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
2300
2284
|
});
|
|
2301
2285
|
};
|
|
@@ -2468,7 +2452,7 @@ function patchAttr(el, key, prev, next2) {
|
|
|
2468
2452
|
const elementIsSVG = (el == null ? void 0 : el.namespaceURI) === SVG_NAMESPACE;
|
|
2469
2453
|
const isXlink = elementIsSVG && key.startsWith("xlink:");
|
|
2470
2454
|
const isXmlns = elementIsSVG && key.startsWith("xmlns:");
|
|
2471
|
-
const
|
|
2455
|
+
const isBoolean = isSpecialBooleanAttr(key) || isBooleanAttr(key);
|
|
2472
2456
|
if (prev === next2) {
|
|
2473
2457
|
return;
|
|
2474
2458
|
}
|
|
@@ -2493,7 +2477,7 @@ function patchAttr(el, key, prev, next2) {
|
|
|
2493
2477
|
}
|
|
2494
2478
|
return;
|
|
2495
2479
|
}
|
|
2496
|
-
if (
|
|
2480
|
+
if (isBoolean) {
|
|
2497
2481
|
if (includeBooleanAttr(next2)) {
|
|
2498
2482
|
el.setAttribute(key, "");
|
|
2499
2483
|
} else {
|
|
@@ -2931,13 +2915,19 @@ function insertNode(parent, child2, before) {
|
|
|
2931
2915
|
}
|
|
2932
2916
|
}
|
|
2933
2917
|
function normalizeNode(node) {
|
|
2934
|
-
if (
|
|
2935
|
-
|
|
2918
|
+
if (node instanceof Node) return node;
|
|
2919
|
+
if (isComponent(node)) return node;
|
|
2920
|
+
const t = typeof node;
|
|
2921
|
+
if (node == null || t === "string" || t === "number" || t === "boolean" || t === "symbol") {
|
|
2922
|
+
return document.createTextNode(node === false || node == null ? "" : String(node));
|
|
2936
2923
|
}
|
|
2937
|
-
if (
|
|
2938
|
-
|
|
2924
|
+
if (isObject(node)) {
|
|
2925
|
+
warn(
|
|
2926
|
+
"Rendering a plain object as a node is not recommended. The object will be converted to its string representation.",
|
|
2927
|
+
node
|
|
2928
|
+
);
|
|
2939
2929
|
}
|
|
2940
|
-
return node;
|
|
2930
|
+
return document.createTextNode(String(node));
|
|
2941
2931
|
}
|
|
2942
2932
|
function insert(parent, nodeFactory, before) {
|
|
2943
2933
|
if (!parent) return;
|
|
@@ -2946,7 +2936,9 @@ function insert(parent, nodeFactory, before) {
|
|
|
2946
2936
|
let isFirstRun = true;
|
|
2947
2937
|
const resolveNodes = (raw) => {
|
|
2948
2938
|
if (raw instanceof Node) return [raw];
|
|
2949
|
-
if (
|
|
2939
|
+
if (isComponent(raw)) return [raw];
|
|
2940
|
+
const t = typeof raw;
|
|
2941
|
+
if (raw == null || t === "string" || t === "number" || t === "boolean") {
|
|
2950
2942
|
return [normalizeNode(raw)];
|
|
2951
2943
|
}
|
|
2952
2944
|
return coerceArray(raw).map((item) => isFunction(item) ? item() : item).flatMap((i) => i).map(normalizeNode);
|
|
@@ -3480,154 +3472,144 @@ function addEventListener(element, event, handler, options) {
|
|
|
3480
3472
|
onCleanup(cleanup);
|
|
3481
3473
|
}
|
|
3482
3474
|
}
|
|
3483
|
-
|
|
3475
|
+
function writeValue(el, v) {
|
|
3476
|
+
const target = el;
|
|
3477
|
+
const next2 = v == null ? "" : String(v);
|
|
3478
|
+
if (target.value !== next2) target.value = next2;
|
|
3479
|
+
}
|
|
3480
|
+
var CHECKBOX = {
|
|
3484
3481
|
event: "change",
|
|
3485
|
-
|
|
3486
|
-
read: (
|
|
3487
|
-
write
|
|
3488
|
-
const
|
|
3482
|
+
forceChange: true,
|
|
3483
|
+
read: (el) => el.checked,
|
|
3484
|
+
write(el, v) {
|
|
3485
|
+
const e = el;
|
|
3489
3486
|
const next2 = Boolean(v);
|
|
3490
|
-
if (
|
|
3487
|
+
if (e.checked !== next2) e.checked = next2;
|
|
3491
3488
|
}
|
|
3492
3489
|
};
|
|
3493
|
-
var
|
|
3490
|
+
var RADIO = {
|
|
3494
3491
|
event: "change",
|
|
3495
|
-
|
|
3496
|
-
read
|
|
3497
|
-
const
|
|
3498
|
-
return
|
|
3492
|
+
forceChange: true,
|
|
3493
|
+
read(el) {
|
|
3494
|
+
const e = el;
|
|
3495
|
+
return e.checked ? e.value : "";
|
|
3499
3496
|
},
|
|
3500
|
-
write
|
|
3501
|
-
const
|
|
3502
|
-
const next2 = String(v) ===
|
|
3503
|
-
if (
|
|
3497
|
+
write(el, v) {
|
|
3498
|
+
const e = el;
|
|
3499
|
+
const next2 = String(v) === e.value;
|
|
3500
|
+
if (e.checked !== next2) e.checked = next2;
|
|
3504
3501
|
}
|
|
3505
3502
|
};
|
|
3506
|
-
var
|
|
3503
|
+
var FILE = {
|
|
3507
3504
|
event: "change",
|
|
3508
|
-
|
|
3509
|
-
read: (
|
|
3510
|
-
|
|
3511
|
-
write: () => {
|
|
3505
|
+
forceChange: true,
|
|
3506
|
+
read: (el) => el.files,
|
|
3507
|
+
write() {
|
|
3512
3508
|
}
|
|
3509
|
+
// browsers forbid programmatic writes to file inputs
|
|
3513
3510
|
};
|
|
3514
|
-
var
|
|
3511
|
+
var TEXT = {
|
|
3515
3512
|
event: "input",
|
|
3516
|
-
|
|
3517
|
-
read: (
|
|
3518
|
-
write:
|
|
3519
|
-
const el = n;
|
|
3520
|
-
const next2 = v == null ? "" : String(v);
|
|
3521
|
-
if (el.value !== next2) el.value = next2;
|
|
3522
|
-
}
|
|
3513
|
+
ime: true,
|
|
3514
|
+
read: (el) => el.value,
|
|
3515
|
+
write: writeValue
|
|
3523
3516
|
};
|
|
3524
|
-
var
|
|
3517
|
+
var TEXTAREA = {
|
|
3518
|
+
event: "input",
|
|
3519
|
+
ime: true,
|
|
3520
|
+
read: (el) => el.value,
|
|
3521
|
+
write: writeValue
|
|
3522
|
+
};
|
|
3523
|
+
var SELECT = {
|
|
3525
3524
|
event: "change",
|
|
3526
|
-
|
|
3527
|
-
read
|
|
3528
|
-
const s =
|
|
3525
|
+
forceChange: true,
|
|
3526
|
+
read(el) {
|
|
3527
|
+
const s = el;
|
|
3529
3528
|
return s.multiple ? Array.from(s.selectedOptions, (o) => o.value) : s.value;
|
|
3530
3529
|
},
|
|
3531
|
-
write
|
|
3532
|
-
const s =
|
|
3530
|
+
write(el, v) {
|
|
3531
|
+
const s = el;
|
|
3533
3532
|
if (s.multiple) {
|
|
3534
|
-
const
|
|
3535
|
-
for (const opt of Array.from(s.options)) opt.selected =
|
|
3533
|
+
const selected = new Set((Array.isArray(v) ? v : []).map(String));
|
|
3534
|
+
for (const opt of Array.from(s.options)) opt.selected = selected.has(opt.value);
|
|
3536
3535
|
} else {
|
|
3537
|
-
|
|
3538
|
-
if (s.value !== next2) s.value = next2;
|
|
3536
|
+
writeValue(el, v);
|
|
3539
3537
|
}
|
|
3540
3538
|
}
|
|
3541
3539
|
};
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3540
|
+
function resolve(node, prop) {
|
|
3541
|
+
switch (node.nodeName) {
|
|
3542
|
+
case "INPUT":
|
|
3543
|
+
if (prop === "checked") return node.type === "radio" ? RADIO : CHECKBOX;
|
|
3544
|
+
if (prop === "files") return FILE;
|
|
3545
|
+
return TEXT;
|
|
3546
|
+
case "SELECT":
|
|
3547
|
+
return SELECT;
|
|
3548
|
+
case "TEXTAREA":
|
|
3549
|
+
return TEXTAREA;
|
|
3550
|
+
default:
|
|
3551
|
+
return {
|
|
3552
|
+
event: "input",
|
|
3553
|
+
read: (el) => el[prop],
|
|
3554
|
+
write(el, v) {
|
|
3555
|
+
el[prop] = v;
|
|
3556
|
+
}
|
|
3557
|
+
};
|
|
3550
3558
|
}
|
|
3551
|
-
};
|
|
3552
|
-
function resolveStrategy(node, prop) {
|
|
3553
|
-
const tag = node.nodeName;
|
|
3554
|
-
if (tag === "INPUT") {
|
|
3555
|
-
const type = node.type;
|
|
3556
|
-
if (prop === "checked") {
|
|
3557
|
-
return type === "radio" ? INPUT_RADIO_CHECKED : INPUT_CHECKBOX_CHECKED;
|
|
3558
|
-
}
|
|
3559
|
-
if (prop === "files") return INPUT_FILE_FILES;
|
|
3560
|
-
return INPUT_VALUE;
|
|
3561
|
-
}
|
|
3562
|
-
if (tag === "SELECT") return SELECT_VALUE;
|
|
3563
|
-
if (tag === "TEXTAREA") return TEXTAREA_VALUE;
|
|
3564
|
-
return {
|
|
3565
|
-
event: "input",
|
|
3566
|
-
read: (n) => n[prop],
|
|
3567
|
-
write: (n, v) => {
|
|
3568
|
-
n[prop] = v;
|
|
3569
|
-
}
|
|
3570
|
-
};
|
|
3571
3559
|
}
|
|
3572
|
-
function
|
|
3573
|
-
if (!isString(
|
|
3574
|
-
|
|
3575
|
-
if (
|
|
3576
|
-
|
|
3577
|
-
|
|
3560
|
+
function applyModifiers(v, trim, toNum) {
|
|
3561
|
+
if (!isString(v)) return v;
|
|
3562
|
+
let s = v;
|
|
3563
|
+
if (trim) s = s.trim();
|
|
3564
|
+
if (toNum && s !== "") {
|
|
3565
|
+
const n = Number(s);
|
|
3566
|
+
if (!Number.isNaN(n)) return n;
|
|
3578
3567
|
}
|
|
3579
|
-
return
|
|
3568
|
+
return s;
|
|
3580
3569
|
}
|
|
3581
|
-
function isFocused(
|
|
3582
|
-
const root =
|
|
3583
|
-
return (root instanceof Document || root instanceof ShadowRoot) && root.activeElement ===
|
|
3570
|
+
function isFocused(el) {
|
|
3571
|
+
const root = el.getRootNode();
|
|
3572
|
+
return (root instanceof Document || root instanceof ShadowRoot) && root.activeElement === el;
|
|
3584
3573
|
}
|
|
3585
3574
|
function bindElement(node, prop, getter, setter, modifiers = {}) {
|
|
3586
3575
|
if (!node) return;
|
|
3587
|
-
const
|
|
3588
|
-
const
|
|
3589
|
-
const
|
|
3590
|
-
const
|
|
3591
|
-
const
|
|
3592
|
-
const
|
|
3576
|
+
const { event, read, write, forceChange, ime } = resolve(node, prop);
|
|
3577
|
+
const trim = modifiers.trim === true;
|
|
3578
|
+
const toNum = modifiers.number === true;
|
|
3579
|
+
const lazy = modifiers.lazy === true;
|
|
3580
|
+
const shouldCast = (trim || toNum) && prop !== "files";
|
|
3581
|
+
const getModel = isFunction(getter) ? getter : () => getter;
|
|
3582
|
+
const cast = shouldCast ? (v) => applyModifiers(v, trim, toNum) : (v) => v;
|
|
3593
3583
|
let composing = false;
|
|
3594
|
-
const
|
|
3584
|
+
const eventName = lazy || forceChange ? "change" : event;
|
|
3585
|
+
const syncToModel = () => {
|
|
3595
3586
|
if (composing) return;
|
|
3596
|
-
const raw =
|
|
3587
|
+
const raw = read(node);
|
|
3597
3588
|
if (raw === void 0) return;
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
return;
|
|
3601
|
-
}
|
|
3602
|
-
const next2 = transform(raw);
|
|
3603
|
-
if (!Object.is(readModel(), next2)) {
|
|
3604
|
-
setter(next2);
|
|
3605
|
-
}
|
|
3589
|
+
const next2 = cast(raw);
|
|
3590
|
+
if (!Object.is(getModel(), next2)) setter(next2);
|
|
3606
3591
|
};
|
|
3607
|
-
addEventListener(node, eventName,
|
|
3608
|
-
if (!lazy &&
|
|
3609
|
-
addEventListener(node, "change", () =>
|
|
3610
|
-
strategy.write(node, transform(strategy.read(node)));
|
|
3611
|
-
});
|
|
3592
|
+
addEventListener(node, eventName, syncToModel);
|
|
3593
|
+
if (!lazy && shouldCast && eventName !== "change") {
|
|
3594
|
+
addEventListener(node, "change", () => write(node, cast(read(node))));
|
|
3612
3595
|
}
|
|
3613
|
-
if (
|
|
3596
|
+
if (ime && !lazy) {
|
|
3614
3597
|
addEventListener(node, "compositionstart", () => {
|
|
3615
3598
|
composing = true;
|
|
3616
3599
|
});
|
|
3617
3600
|
addEventListener(node, "compositionend", () => {
|
|
3618
3601
|
if (!composing) return;
|
|
3619
3602
|
composing = false;
|
|
3620
|
-
|
|
3603
|
+
syncToModel();
|
|
3621
3604
|
});
|
|
3622
3605
|
}
|
|
3623
3606
|
const runner = effect(() => {
|
|
3624
|
-
const value =
|
|
3625
|
-
if (
|
|
3607
|
+
const value = getModel();
|
|
3608
|
+
if (ime && !lazy && isFocused(node)) {
|
|
3626
3609
|
if (composing) return;
|
|
3627
|
-
|
|
3628
|
-
if (Object.is(current, value)) return;
|
|
3610
|
+
if (Object.is(cast(read(node)), value)) return;
|
|
3629
3611
|
}
|
|
3630
|
-
|
|
3612
|
+
write(node, value);
|
|
3631
3613
|
});
|
|
3632
3614
|
if (getActiveScope()) {
|
|
3633
3615
|
onCleanup(() => runner.stop());
|
|
@@ -4375,5 +4357,5 @@ function For(props) {
|
|
|
4375
4357
|
For[FOR_COMPONENT] = true;
|
|
4376
4358
|
|
|
4377
4359
|
export { Component, For, Fragment, Portal, Suspense, TriggerOpTypes, __version, addEvent, addEventListener, batch, beginHydration, bindElement, child, clearDelegatedEvents, computed, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, createStore, defineAsyncComponent, delegateEvents, effect, endBatch, endHydration, error, escapeHTML, getBatchDepth, getHydrationKey, getRenderedElement, hydrate, inject, insert, isArray, isBatching, isComponent, isComputed, isEffect, isFragment, isFunction, isHydrating, isNil, isObject, isPortal, isPromise, isReactive, isRef, isShallow, isSignal, isString, isSuspense, memoEffect, next, nextTick, normalizeClass, normalizeClassName, normalizeStyle, nthChild, omitProps, onDestroy, onMount, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, provide, queueJob, queuePreFlushCb, reactive, ref, resetHydrationKey, setStyle, shallowReactive, shallowSignal, signal, startBatch, stop, styleToString, template, toRaw, toReactive, trigger, untrack, watch };
|
|
4378
|
-
//# sourceMappingURL=chunk-
|
|
4379
|
-
//# sourceMappingURL=chunk-
|
|
4360
|
+
//# sourceMappingURL=chunk-FIBC7TTZ.esm.js.map
|
|
4361
|
+
//# sourceMappingURL=chunk-FIBC7TTZ.esm.js.map
|