@askrjs/askr 0.0.5 → 0.0.7
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/component-BBGWJdqJ.d.ts +177 -0
- package/dist/foundations/index.d.ts +373 -0
- package/dist/foundations/index.js +1051 -0
- package/dist/foundations/index.js.map +1 -0
- package/dist/{fx.js → fx/index.js} +2 -2
- package/dist/fx/index.js.map +1 -0
- package/dist/index.d.ts +4 -134
- package/dist/index.js +53 -68
- package/dist/index.js.map +1 -1
- package/dist/layout-BINPv-nz.d.ts +29 -0
- package/dist/{resources.d.ts → resources/index.d.ts} +3 -0
- package/dist/{resources.js → resources/index.js} +10 -3
- package/dist/resources/index.js.map +1 -0
- package/dist/{router.d.ts → router/index.d.ts} +4 -16
- package/dist/{router.js → router/index.js} +36 -4
- package/dist/router/index.js.map +1 -0
- package/dist/{ssr.d.ts → ssr/index.d.ts} +2 -2
- package/dist/{ssr.js → ssr/index.js} +62 -67
- package/dist/ssr/index.js.map +1 -0
- package/package.json +7 -5
- package/dist/fx.js.map +0 -1
- package/dist/resources.js.map +0 -1
- package/dist/router.js.map +0 -1
- package/dist/ssr.js.map +0 -1
- /package/dist/{fx.d.ts → fx/index.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -433,7 +433,7 @@ function createWrappedHandler(handler, flushAfter = false) {
|
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
435
|
function isSkippedProp(key) {
|
|
436
|
-
return key === "children" || key === "key";
|
|
436
|
+
return key === "children" || key === "key" || key === "ref";
|
|
437
437
|
}
|
|
438
438
|
function isIgnoredForPropChanges(key) {
|
|
439
439
|
if (key === "children" || key === "key") return true;
|
|
@@ -1095,6 +1095,10 @@ function applyPropsToElement(el, props, tagName) {
|
|
|
1095
1095
|
const value = props[key];
|
|
1096
1096
|
if (isSkippedProp(key)) continue;
|
|
1097
1097
|
if (value === void 0 || value === null || value === false) continue;
|
|
1098
|
+
if (key === "ref") {
|
|
1099
|
+
applyRef(el, value);
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1098
1102
|
const eventName = parseEventName(key);
|
|
1099
1103
|
if (eventName) {
|
|
1100
1104
|
addTrackedListener(el, eventName, value);
|
|
@@ -1109,6 +1113,18 @@ function applyPropsToElement(el, props, tagName) {
|
|
|
1109
1113
|
}
|
|
1110
1114
|
}
|
|
1111
1115
|
}
|
|
1116
|
+
function applyRef(el, ref) {
|
|
1117
|
+
const r = ref;
|
|
1118
|
+
if (!r) return;
|
|
1119
|
+
if (typeof r === "function") {
|
|
1120
|
+
r(el);
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
try {
|
|
1124
|
+
r.current = el;
|
|
1125
|
+
} catch {
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1112
1128
|
function applyFormControlProp(el, key, value, tagName) {
|
|
1113
1129
|
if (key === "value") {
|
|
1114
1130
|
if (tagNamesEqualIgnoreCase(tagName, "input") || tagNamesEqualIgnoreCase(tagName, "textarea") || tagNamesEqualIgnoreCase(tagName, "select")) {
|
|
@@ -2511,6 +2527,10 @@ function applyPropsToElement2(el, props) {
|
|
|
2511
2527
|
for (const [key, value] of Object.entries(props)) {
|
|
2512
2528
|
if (key === "children" || key === "key") continue;
|
|
2513
2529
|
if (value === void 0 || value === null || value === false) continue;
|
|
2530
|
+
if (key === "ref") {
|
|
2531
|
+
applyRef2(el, value);
|
|
2532
|
+
continue;
|
|
2533
|
+
}
|
|
2514
2534
|
const eventName = parseEventName(key);
|
|
2515
2535
|
if (eventName) {
|
|
2516
2536
|
const wrappedHandler = createWrappedHandler(
|
|
@@ -2538,6 +2558,18 @@ function applyPropsToElement2(el, props) {
|
|
|
2538
2558
|
}
|
|
2539
2559
|
}
|
|
2540
2560
|
}
|
|
2561
|
+
function applyRef2(el, ref) {
|
|
2562
|
+
const r = ref;
|
|
2563
|
+
if (!r) return;
|
|
2564
|
+
if (typeof r === "function") {
|
|
2565
|
+
r(el);
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
try {
|
|
2569
|
+
r.current = el;
|
|
2570
|
+
} catch {
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2541
2573
|
function tryFirstRenderKeyedChildren(target, vnode) {
|
|
2542
2574
|
const children = vnode.children;
|
|
2543
2575
|
if (!Array.isArray(children) || !hasKeyedChildren(children)) {
|
|
@@ -3477,86 +3509,39 @@ var init_jsx2 = __esm({
|
|
|
3477
3509
|
}
|
|
3478
3510
|
});
|
|
3479
3511
|
|
|
3480
|
-
// src/foundations/portal.tsx
|
|
3512
|
+
// src/foundations/structures/portal.tsx
|
|
3481
3513
|
function definePortal() {
|
|
3482
|
-
if (typeof createPortalSlot
|
|
3483
|
-
let
|
|
3484
|
-
|
|
3485
|
-
owner = null;
|
|
3486
|
-
pending = void 0;
|
|
3487
|
-
}
|
|
3488
|
-
const inst = getCurrentComponentInstance();
|
|
3489
|
-
if (!owner && inst) owner = inst;
|
|
3490
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3491
|
-
const ns = globalThis.__ASKR__ || (globalThis.__ASKR__ = {});
|
|
3492
|
-
ns.__PORTAL_READS = (ns.__PORTAL_READS || 0) + 1;
|
|
3493
|
-
}
|
|
3494
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3495
|
-
if (inst && owner && inst !== owner && inst.mounted === true) {
|
|
3496
|
-
logger.warn(
|
|
3497
|
-
"[Portal] multiple mounted hosts detected; first mounted host is owner"
|
|
3498
|
-
);
|
|
3499
|
-
}
|
|
3500
|
-
}
|
|
3501
|
-
return inst && owner && inst === owner ? pending : void 0;
|
|
3514
|
+
if (typeof createPortalSlot === "function") {
|
|
3515
|
+
let PortalHost2 = function() {
|
|
3516
|
+
return slot.read();
|
|
3502
3517
|
};
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
if (!owner || owner.mounted !== true) return null;
|
|
3507
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3508
|
-
const ns = globalThis.__ASKR__ || (globalThis.__ASKR__ = {});
|
|
3509
|
-
ns.__PORTAL_WRITES = (ns.__PORTAL_WRITES || 0) + 1;
|
|
3510
|
-
}
|
|
3511
|
-
pending = props.children;
|
|
3512
|
-
if (owner.notifyUpdate) owner.notifyUpdate();
|
|
3518
|
+
const slot = createPortalSlot();
|
|
3519
|
+
PortalHost2.render = function PortalRender(props) {
|
|
3520
|
+
slot.write(props.children);
|
|
3513
3521
|
return null;
|
|
3514
3522
|
};
|
|
3515
|
-
return
|
|
3523
|
+
return PortalHost2;
|
|
3516
3524
|
}
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3525
|
+
let mounted = false;
|
|
3526
|
+
let value;
|
|
3527
|
+
function PortalHostFallback() {
|
|
3528
|
+
mounted = true;
|
|
3529
|
+
return value;
|
|
3520
3530
|
}
|
|
3521
|
-
|
|
3522
|
-
if (
|
|
3523
|
-
|
|
3524
|
-
ns.__PORTAL_WRITES = (ns.__PORTAL_WRITES || 0) + 1;
|
|
3525
|
-
}
|
|
3526
|
-
slot.write(props.children);
|
|
3531
|
+
PortalHostFallback.render = function PortalRenderFallback(props) {
|
|
3532
|
+
if (!mounted) return null;
|
|
3533
|
+
value = props.children;
|
|
3527
3534
|
return null;
|
|
3528
3535
|
};
|
|
3529
|
-
return
|
|
3536
|
+
return PortalHostFallback;
|
|
3530
3537
|
}
|
|
3531
3538
|
function ensureDefaultPortal() {
|
|
3532
|
-
if (!_defaultPortal)
|
|
3533
|
-
if (typeof createPortalSlot === "function") {
|
|
3534
|
-
_defaultPortal = definePortal();
|
|
3535
|
-
_defaultPortalIsFallback = false;
|
|
3536
|
-
} else {
|
|
3537
|
-
_defaultPortal = definePortal();
|
|
3538
|
-
_defaultPortalIsFallback = true;
|
|
3539
|
-
}
|
|
3540
|
-
return _defaultPortal;
|
|
3541
|
-
}
|
|
3542
|
-
if (_defaultPortalIsFallback && typeof createPortalSlot === "function") {
|
|
3543
|
-
const real = definePortal();
|
|
3544
|
-
_defaultPortal = real;
|
|
3545
|
-
_defaultPortalIsFallback = false;
|
|
3546
|
-
}
|
|
3547
|
-
if (!_defaultPortalIsFallback && typeof createPortalSlot !== "function") {
|
|
3548
|
-
const fallback = definePortal();
|
|
3549
|
-
_defaultPortal = fallback;
|
|
3550
|
-
_defaultPortalIsFallback = true;
|
|
3551
|
-
}
|
|
3539
|
+
if (!_defaultPortal) _defaultPortal = definePortal();
|
|
3552
3540
|
return _defaultPortal;
|
|
3553
3541
|
}
|
|
3554
|
-
var _defaultPortal,
|
|
3542
|
+
var _defaultPortal, DefaultPortal;
|
|
3555
3543
|
var init_portal = __esm({
|
|
3556
|
-
"src/foundations/portal.tsx"() {
|
|
3557
|
-
init_component();
|
|
3558
|
-
init_logger();
|
|
3559
|
-
_defaultPortalIsFallback = false;
|
|
3544
|
+
"src/foundations/structures/portal.tsx"() {
|
|
3560
3545
|
DefaultPortal = (() => {
|
|
3561
3546
|
function Host() {
|
|
3562
3547
|
const v = ensureDefaultPortal()();
|