revojs 0.0.64 → 0.0.66
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/index.js +17 -3
- package/dist/router/index.d.ts +4 -0
- package/dist/signals/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -358,6 +358,14 @@ function fromValue(value) {
|
|
|
358
358
|
if (value instanceof Function) return fromValue(value());
|
|
359
359
|
return value;
|
|
360
360
|
}
|
|
361
|
+
function untrack(invoke) {
|
|
362
|
+
let previous = activeCompute;
|
|
363
|
+
activeCompute = void 0;
|
|
364
|
+
const result = invoke();
|
|
365
|
+
if (result instanceof Promise) return result.finally(() => activeCompute = previous);
|
|
366
|
+
activeCompute = previous;
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
361
369
|
function defineContext(key) {
|
|
362
370
|
return key;
|
|
363
371
|
}
|
|
@@ -704,7 +712,7 @@ const toCustomElement = (Component) => {
|
|
|
704
712
|
detail: value
|
|
705
713
|
}));
|
|
706
714
|
});
|
|
707
|
-
hydrate(this.component.scope, rootNode, this.component.setup
|
|
715
|
+
hydrate(this.component.scope, rootNode, untrack(this.component.setup), 0);
|
|
708
716
|
requestAnimationFrame(() => this.dispatchEvent(new MountedEvent()));
|
|
709
717
|
}
|
|
710
718
|
attributeChangedCallback(name, oldValue, value) {
|
|
@@ -780,6 +788,11 @@ var NavigateEvent = class extends Event {
|
|
|
780
788
|
super("navigate");
|
|
781
789
|
}
|
|
782
790
|
};
|
|
791
|
+
var AfterNavigateEvent = class extends Event {
|
|
792
|
+
constructor() {
|
|
793
|
+
super("afterNavigate");
|
|
794
|
+
}
|
|
795
|
+
};
|
|
783
796
|
const provideRouterContext = (scope, options) => {
|
|
784
797
|
const url = createState();
|
|
785
798
|
const route = createState();
|
|
@@ -799,6 +812,7 @@ const provideRouterContext = (scope, options) => {
|
|
|
799
812
|
const match = radix.match(url.value.pathname);
|
|
800
813
|
inputs.value = match.inputs;
|
|
801
814
|
route.value = match.value;
|
|
815
|
+
navigator.dispatchEvent(new AfterNavigateEvent());
|
|
802
816
|
};
|
|
803
817
|
if (isClient()) useEvent(scope, window, "popstate", () => navigator.dispatchEvent(new NavigateEvent()));
|
|
804
818
|
scope.setContext(ROUTE_CONTEXT, { inputs: createState() });
|
|
@@ -860,7 +874,7 @@ const provideLocaleContext = (scope, options) => {
|
|
|
860
874
|
}
|
|
861
875
|
};
|
|
862
876
|
fetch$1();
|
|
863
|
-
useEvent(scope, navigator, "
|
|
877
|
+
useEvent(scope, navigator, "afterNavigate", fetch$1);
|
|
864
878
|
scope.setContext(LOCALE_CONTEXT, {
|
|
865
879
|
locale,
|
|
866
880
|
messages,
|
|
@@ -887,4 +901,4 @@ const useLocale = (scope, context) => {
|
|
|
887
901
|
const LOCALE_CONTEXT = defineContext("LOCALE_CONTEXT");
|
|
888
902
|
|
|
889
903
|
//#endregion
|
|
890
|
-
export { $fetch, CLIENT, Compute, HOST_CONTEXT, Handler, LOCALE_CONTEXT, MountedEvent, NavigateEvent, Page, ROUTER_CONTEXT, ROUTE_CONTEXT, RUNTIME_CONTEXT, Radix, SERVER, Scope, StopEvent, activeCompute, components, createApp, createCompute, createElement, createMemo, createRuntime, createState, defineComponent, defineContext, defineMiddleware, defineRoute, fileName, fromValue, hydrate, isClient, isComponent, isCustomElement, isRoute, isServer, isTemplate, mimeType, onMounted, preventDefault, provideLocaleContext, provideRouterContext, registerComponent, renderToString, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, startViewTransition, stopImmediatePropagation, stopPropagation, targets, toArray, toCustomElement, toFragment, toPath, toRange, toString, useAsync, useCookies, useEvent, useHost, useLocale, useRequestUrl, useRoute, useRouter, useRuntime, useSetCookies };
|
|
904
|
+
export { $fetch, AfterNavigateEvent, CLIENT, Compute, HOST_CONTEXT, Handler, LOCALE_CONTEXT, MountedEvent, NavigateEvent, Page, ROUTER_CONTEXT, ROUTE_CONTEXT, RUNTIME_CONTEXT, Radix, SERVER, Scope, StopEvent, activeCompute, components, createApp, createCompute, createElement, createMemo, createRuntime, createState, defineComponent, defineContext, defineMiddleware, defineRoute, fileName, fromValue, hydrate, isClient, isComponent, isCustomElement, isRoute, isServer, isTemplate, mimeType, onMounted, preventDefault, provideLocaleContext, provideRouterContext, registerComponent, renderToString, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, startViewTransition, stopImmediatePropagation, stopPropagation, targets, toArray, toCustomElement, toFragment, toPath, toRange, toString, untrack, useAsync, useCookies, useEvent, useHost, useLocale, useRequestUrl, useRoute, useRouter, useRuntime, useSetCookies };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export type RouterContext = {
|
|
|
14
14
|
export declare class NavigateEvent extends Event {
|
|
15
15
|
constructor();
|
|
16
16
|
}
|
|
17
|
+
export declare class AfterNavigateEvent extends Event {
|
|
18
|
+
constructor();
|
|
19
|
+
}
|
|
17
20
|
export declare const provideRouterContext: (scope: Scope, options: RouterOptions) => {
|
|
18
21
|
url: State<URL | undefined>;
|
|
19
22
|
route: State<unknown>;
|
|
@@ -33,5 +36,6 @@ export declare const ROUTER_CONTEXT: Descriptor<RouterContext>;
|
|
|
33
36
|
declare global {
|
|
34
37
|
interface ElementEventMap {
|
|
35
38
|
navigate: NavigateEvent;
|
|
39
|
+
afterNavigate: AfterNavigateEvent;
|
|
36
40
|
}
|
|
37
41
|
}
|
package/dist/signals/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare function createState<T>(value: T): State<T>;
|
|
|
32
32
|
export declare function createCompute<T>(scope: Scope, invoke: (scope: Scope) => T): T;
|
|
33
33
|
export declare function createMemo<T>(scope: Scope, invoke: (scope: Scope) => T): State<T>;
|
|
34
34
|
export declare function fromValue<T>(value: Value<T>): T;
|
|
35
|
+
export declare function untrack<T>(invoke: () => T): T;
|
|
35
36
|
export declare function defineContext<T>(key: string): Descriptor<T>;
|
|
36
37
|
export declare let activeCompute: Compute | undefined;
|
|
37
38
|
export declare const targets: WeakMap<object, Map<string | symbol, Set<Compute<void>>>>;
|