@sigil-dev/runtime 0.7.0 → 0.7.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/index.ts +17 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { Boundary } from "./boundary";
|
|
2
|
+
|
|
1
3
|
export const SIGIL_SAFE = Symbol.for("sigil.safe");
|
|
2
4
|
export class SafeHtml {
|
|
3
5
|
[SIGIL_SAFE] = true;
|
|
@@ -7,6 +9,7 @@ export class SafeHtml {
|
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
|
|
12
|
+
|
|
10
13
|
let currentEffect: (() => void) | null = null;
|
|
11
14
|
let currentDeps: Set<Set<() => void>> | null = null;
|
|
12
15
|
|
|
@@ -449,3 +452,17 @@ export function setContext<T>(key: ContextKey<T>, value: T): void {
|
|
|
449
452
|
export function getContext<T>(key: ContextKey<T>): T {
|
|
450
453
|
return getStore().get(key as unknown as symbol) as T;
|
|
451
454
|
}
|
|
455
|
+
|
|
456
|
+
const _hydrationStack: ChildNode[][] = [];
|
|
457
|
+
|
|
458
|
+
export function pushHydrationNodes(nodes: ChildNode[]): void {
|
|
459
|
+
_hydrationStack.push(nodes);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export function popHydrationNodes(): void {
|
|
463
|
+
_hydrationStack.pop();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export function getHydrationNodes(): ChildNode[] {
|
|
467
|
+
return _hydrationStack[_hydrationStack.length - 1] ?? [];
|
|
468
|
+
}
|