@octanejs/window 0.0.9 → 0.0.11
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/package.json +4 -4
- package/src/internal.ts +3 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/window",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/react": "^19.2.17"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"octane": "0.1.
|
|
46
|
+
"octane": "0.1.45"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"react-dom": "^19.2.7",
|
|
55
55
|
"react-window": "2.3.0",
|
|
56
56
|
"vitest": "^4.1.10",
|
|
57
|
-
"@octanejs/testing-library": "0.1.
|
|
58
|
-
"octane": "0.1.
|
|
57
|
+
"@octanejs/testing-library": "0.1.42",
|
|
58
|
+
"octane": "0.1.45"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"adapted:generate": "node ../../scripts/react-port/materialize.mjs run --package-dir .",
|
package/src/internal.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Octane appends a compiler-owned hook slot to public hook calls. Binding
|
|
2
2
|
// internals derive stable child slots so composed hooks and sibling
|
|
3
3
|
// virtualizers never share state.
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { createSubSlot } from 'octane';
|
|
5
|
+
|
|
6
|
+
export const subSlot = createSubSlot({ slotlessPrefix: '@octanejs/window:' });
|
|
6
7
|
|
|
7
8
|
export function getSlot(args: unknown[]): symbol | undefined {
|
|
8
9
|
const slot = args.at(-1);
|
|
@@ -13,25 +14,3 @@ export function getPublicArgument(args: unknown[], index: number): unknown {
|
|
|
13
14
|
const publicLength = getSlot(args) === undefined ? args.length : args.length - 1;
|
|
14
15
|
return index < publicLength ? args[index] : undefined;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
export function subSlot(slot: symbol | undefined, tag: string): symbol {
|
|
18
|
-
if (slot === undefined) {
|
|
19
|
-
let bare = bareTagCache.get(tag);
|
|
20
|
-
if (bare === undefined) {
|
|
21
|
-
bare = Symbol.for(`@octanejs/window:${tag}`);
|
|
22
|
-
bareTagCache.set(tag, bare);
|
|
23
|
-
}
|
|
24
|
-
return bare;
|
|
25
|
-
}
|
|
26
|
-
let byTag = subSlotCache.get(slot);
|
|
27
|
-
if (byTag === undefined) {
|
|
28
|
-
byTag = new Map();
|
|
29
|
-
subSlotCache.set(slot, byTag);
|
|
30
|
-
}
|
|
31
|
-
let child = byTag.get(tag);
|
|
32
|
-
if (child === undefined) {
|
|
33
|
-
child = Symbol.for(`${slot.description ?? ''}:${tag}`);
|
|
34
|
-
byTag.set(tag, child);
|
|
35
|
-
}
|
|
36
|
-
return child;
|
|
37
|
-
}
|