@askrjs/askr 0.0.6 → 0.0.8
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 → component-DHAn9JxU.d.ts} +1 -1
- package/dist/foundations/index.d.ts +348 -6
- package/dist/foundations/index.js +1011 -84
- package/dist/foundations/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +80 -81
- package/dist/index.js.map +1 -1
- package/dist/{jsx-AzPM8gMS.d.ts → jsx-CSWf4VFg.d.ts} +2 -2
- package/dist/jsx-dev-runtime.d.ts +3 -3
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/layout-BINPv-nz.d.ts +29 -0
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/resources/index.js.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.js +57 -8
- package/dist/router/index.js.map +1 -1
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +80 -71
- package/dist/ssr/index.js.map +1 -1
- package/dist/{types-uOPfcrdz.d.ts → types-DxdosFWx.d.ts} +1 -1
- package/package.json +5 -5
- package/dist/layout-D5MqtW_q.d.ts +0 -14
package/dist/router/index.js
CHANGED
|
@@ -324,6 +324,9 @@ function isSchedulerExecuting() {
|
|
|
324
324
|
return globalScheduler.isExecuting();
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
// src/common/jsx.ts
|
|
328
|
+
var Fragment = /* @__PURE__ */ Symbol.for("askr.fragment");
|
|
329
|
+
|
|
327
330
|
// src/runtime/context.ts
|
|
328
331
|
var CONTEXT_FRAME_SYMBOL = /* @__PURE__ */ Symbol("__tempoContextFrame__");
|
|
329
332
|
var currentContextFrame = null;
|
|
@@ -340,7 +343,7 @@ function getCurrentContextFrame() {
|
|
|
340
343
|
return currentContextFrame;
|
|
341
344
|
}
|
|
342
345
|
|
|
343
|
-
// src/renderer/diag
|
|
346
|
+
// src/renderer/diag.ts
|
|
344
347
|
function getDiagMap() {
|
|
345
348
|
try {
|
|
346
349
|
const root = globalThis;
|
|
@@ -432,7 +435,7 @@ function createWrappedHandler(handler, flushAfter = false) {
|
|
|
432
435
|
};
|
|
433
436
|
}
|
|
434
437
|
function isSkippedProp(key) {
|
|
435
|
-
return key === "children" || key === "key";
|
|
438
|
+
return key === "children" || key === "key" || key === "ref";
|
|
436
439
|
}
|
|
437
440
|
function isIgnoredForPropChanges(key) {
|
|
438
441
|
if (key === "children" || key === "key") return true;
|
|
@@ -642,9 +645,6 @@ function isKeyedReorderFastPathEligible(parent, newChildren, oldKeyMap) {
|
|
|
642
645
|
};
|
|
643
646
|
}
|
|
644
647
|
|
|
645
|
-
// src/common/jsx.ts
|
|
646
|
-
var Fragment = /* @__PURE__ */ Symbol.for("askr.fragment");
|
|
647
|
-
|
|
648
648
|
// src/runtime/dev-namespace.ts
|
|
649
649
|
function getDevNamespace() {
|
|
650
650
|
if (process.env.NODE_ENV === "production") return {};
|
|
@@ -1008,6 +1008,20 @@ function removeAllListeners(root) {
|
|
|
1008
1008
|
|
|
1009
1009
|
// src/renderer/dom.ts
|
|
1010
1010
|
var IS_DOM_AVAILABLE = typeof document !== "undefined";
|
|
1011
|
+
var fallbackComponentInstanceId = 0;
|
|
1012
|
+
function nextComponentInstanceId() {
|
|
1013
|
+
const key = "__COMPONENT_INSTANCE_ID";
|
|
1014
|
+
try {
|
|
1015
|
+
__ASKR_incCounter(key);
|
|
1016
|
+
const root = globalThis;
|
|
1017
|
+
const diag = root.__ASKR_DIAG;
|
|
1018
|
+
const n = diag ? diag[key] : void 0;
|
|
1019
|
+
if (typeof n === "number" && Number.isFinite(n)) return `comp-${n}`;
|
|
1020
|
+
} catch {
|
|
1021
|
+
}
|
|
1022
|
+
fallbackComponentInstanceId++;
|
|
1023
|
+
return `comp-${fallbackComponentInstanceId}`;
|
|
1024
|
+
}
|
|
1011
1025
|
function addTrackedListener(el, eventName, handler) {
|
|
1012
1026
|
const wrappedHandler = createWrappedHandler(handler, true);
|
|
1013
1027
|
const options = getPassiveOptions(eventName);
|
|
@@ -1030,6 +1044,10 @@ function applyPropsToElement(el, props, tagName) {
|
|
|
1030
1044
|
const value = props[key];
|
|
1031
1045
|
if (isSkippedProp(key)) continue;
|
|
1032
1046
|
if (value === void 0 || value === null || value === false) continue;
|
|
1047
|
+
if (key === "ref") {
|
|
1048
|
+
applyRef(el, value);
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1033
1051
|
const eventName = parseEventName(key);
|
|
1034
1052
|
if (eventName) {
|
|
1035
1053
|
addTrackedListener(el, eventName, value);
|
|
@@ -1044,6 +1062,18 @@ function applyPropsToElement(el, props, tagName) {
|
|
|
1044
1062
|
}
|
|
1045
1063
|
}
|
|
1046
1064
|
}
|
|
1065
|
+
function applyRef(el, ref) {
|
|
1066
|
+
const r = ref;
|
|
1067
|
+
if (!r) return;
|
|
1068
|
+
if (typeof r === "function") {
|
|
1069
|
+
r(el);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
try {
|
|
1073
|
+
r.current = el;
|
|
1074
|
+
} catch {
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1047
1077
|
function applyFormControlProp(el, key, value, tagName) {
|
|
1048
1078
|
if (key === "value") {
|
|
1049
1079
|
if (tagNamesEqualIgnoreCase(tagName, "input") || tagNamesEqualIgnoreCase(tagName, "textarea") || tagNamesEqualIgnoreCase(tagName, "select")) {
|
|
@@ -1169,7 +1199,7 @@ function createComponentElement(node, type, props) {
|
|
|
1169
1199
|
let childInstance = node.__instance;
|
|
1170
1200
|
if (!childInstance) {
|
|
1171
1201
|
childInstance = createComponentInstance(
|
|
1172
|
-
|
|
1202
|
+
nextComponentInstanceId(),
|
|
1173
1203
|
componentFn,
|
|
1174
1204
|
props || {},
|
|
1175
1205
|
null
|
|
@@ -2411,6 +2441,10 @@ function applyPropsToElement2(el, props) {
|
|
|
2411
2441
|
for (const [key, value] of Object.entries(props)) {
|
|
2412
2442
|
if (key === "children" || key === "key") continue;
|
|
2413
2443
|
if (value === void 0 || value === null || value === false) continue;
|
|
2444
|
+
if (key === "ref") {
|
|
2445
|
+
applyRef2(el, value);
|
|
2446
|
+
continue;
|
|
2447
|
+
}
|
|
2414
2448
|
const eventName = parseEventName(key);
|
|
2415
2449
|
if (eventName) {
|
|
2416
2450
|
const wrappedHandler = createWrappedHandler(
|
|
@@ -2438,6 +2472,18 @@ function applyPropsToElement2(el, props) {
|
|
|
2438
2472
|
}
|
|
2439
2473
|
}
|
|
2440
2474
|
}
|
|
2475
|
+
function applyRef2(el, ref) {
|
|
2476
|
+
const r = ref;
|
|
2477
|
+
if (!r) return;
|
|
2478
|
+
if (typeof r === "function") {
|
|
2479
|
+
r(el);
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
try {
|
|
2483
|
+
r.current = el;
|
|
2484
|
+
} catch {
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2441
2487
|
function tryFirstRenderKeyedChildren(target, vnode) {
|
|
2442
2488
|
const children = vnode.children;
|
|
2443
2489
|
if (!Array.isArray(children) || !hasKeyedChildren(children)) {
|
|
@@ -3135,9 +3181,12 @@ function Link({ href, children }) {
|
|
|
3135
3181
|
};
|
|
3136
3182
|
}
|
|
3137
3183
|
|
|
3138
|
-
// src/foundations/layout.tsx
|
|
3184
|
+
// src/foundations/structures/layout.tsx
|
|
3139
3185
|
function layout(Layout) {
|
|
3140
|
-
return (children, props) =>
|
|
3186
|
+
return (children, props) => {
|
|
3187
|
+
const mergedProps = { ...props, children };
|
|
3188
|
+
return Layout(mergedProps);
|
|
3189
|
+
};
|
|
3141
3190
|
}
|
|
3142
3191
|
|
|
3143
3192
|
export { Link, clearRoutes, getRoutes, layout, navigate, route };
|