@octanejs/tiptap 0.0.37 → 0.0.39

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/internal.ts +5 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/tiptap",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -56,7 +56,7 @@
56
56
  "@tiptap/extension-floating-menu": "3.28.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "octane": "0.1.43"
59
+ "octane": "0.1.45"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@testing-library/jest-dom": "^6.9.1",
@@ -73,8 +73,8 @@
73
73
  "use-sync-external-store": "^1.4.0",
74
74
  "@types/react": "19.2.17",
75
75
  "@types/react-dom": "19.2.3",
76
- "@octanejs/testing-library": "0.1.40",
77
- "octane": "0.1.43"
76
+ "@octanejs/testing-library": "0.1.42",
77
+ "octane": "0.1.45"
78
78
  },
79
79
  "scripts": {
80
80
  "test": "vitest run",
package/src/internal.ts CHANGED
@@ -3,32 +3,12 @@
3
3
  // custom-hook call. Binding hooks split that argument from their public
4
4
  // options and derive one stable sub-slot for each base hook they compose.
5
5
 
6
- const subSlotCache = new Map<symbol, Map<string, symbol>>();
7
- const bareSlotCache = new Map<string, symbol>();
6
+ import { createSubSlot } from 'octane';
8
7
 
9
- export function subSlot(slot: symbol | undefined, tag: string): symbol {
10
- if (slot === undefined) {
11
- let bare = bareSlotCache.get(tag);
12
- if (bare === undefined) {
13
- bare = Symbol.for(`@octanejs/tiptap:${tag}`);
14
- bareSlotCache.set(tag, bare);
15
- }
16
- return bare;
17
- }
18
-
19
- let byTag = subSlotCache.get(slot);
20
- if (byTag === undefined) {
21
- byTag = new Map();
22
- subSlotCache.set(slot, byTag);
23
- }
24
-
25
- let result = byTag.get(tag);
26
- if (result === undefined) {
27
- result = Symbol.for(`${slot.description ?? ''}:@octanejs/tiptap:${tag}`);
28
- byTag.set(tag, result);
29
- }
30
- return result;
31
- }
8
+ export const subSlot = createSubSlot({
9
+ tagPrefix: ':@octanejs/tiptap:',
10
+ slotlessPrefix: '@octanejs/tiptap:',
11
+ });
32
12
 
33
13
  /** Split a compiler-owned trailing slot from a custom hook's user arguments. */
34
14
  export function splitSlot(args: readonly unknown[]): [readonly unknown[], symbol | undefined] {