@nesso-how/types 0.1.0-alpha.26 → 0.1.0-alpha.27

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export type { EdgeCategory, EdgeTypeDef, EdgeTypeName, GlyphKind } from '@nesso-how/relation-types';
1
+ export type { EdgeCategory, EdgeTypeDef, EdgeTypeName, GlyphKind, CategoryPalette, } from '@nesso-how/relation-types';
2
2
  import type { Card } from 'ts-fsrs';
3
- import type { EdgeTypeName } from '@nesso-how/relation-types';
3
+ import type { CategoryPalette, EdgeTypeName } from '@nesso-how/relation-types';
4
4
  export interface ConceptElaboration {
5
5
  definition: string;
6
6
  examples: string;
@@ -32,7 +32,6 @@ export interface NessoEdgeData extends Record<string, unknown> {
32
32
  curveFlip?: boolean;
33
33
  curveFlipPinned?: boolean;
34
34
  }
35
- export type CategoryPalette = 'default' | 'vivid' | 'muted' | 'monoCat';
36
35
  export type Language = 'en' | 'it';
37
36
  export interface GraphDisplaySettings {
38
37
  edgeEncoding: EdgeEncoding;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nesso-how/types",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.27",
4
4
  "description": "Nesso shared TypeScript types — graph, node, edge, settings, FSRS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,6 +12,9 @@
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
+ "files": [
16
+ "dist"
17
+ ],
15
18
  "exports": {
16
19
  ".": {
17
20
  "types": "./dist/index.d.ts",
@@ -19,14 +22,17 @@
19
22
  }
20
23
  },
21
24
  "dependencies": {
22
- "ts-fsrs": "^5.3.2",
23
- "@nesso-how/relation-types": "0.1.0-alpha.26"
25
+ "@nesso-how/relation-types": "0.1.0-alpha.27"
26
+ },
27
+ "peerDependencies": {
28
+ "ts-fsrs": "^5.3.2"
24
29
  },
25
30
  "devDependencies": {
31
+ "ts-fsrs": "^5.3.2",
26
32
  "typescript": "~5.8.3"
27
33
  },
28
34
  "scripts": {
29
- "build": "tsc",
35
+ "build": "rm -rf dist && tsc",
30
36
  "dev": "tsc --watch"
31
37
  }
32
38
  }
package/src/index.ts DELETED
@@ -1,127 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- export type { EdgeCategory, EdgeTypeDef, EdgeTypeName, GlyphKind } from '@nesso-how/relation-types'
3
- import type { Card, State } from 'ts-fsrs'
4
- import type { EdgeTypeName } from '@nesso-how/relation-types'
5
-
6
- export interface ConceptElaboration {
7
- definition: string
8
- examples: string
9
- notes: string
10
- imageUrl?: string
11
- imageTitle?: string
12
- imageDescriptionUrl?: string
13
- }
14
-
15
- export interface ConceptNodeData extends Record<string, unknown> {
16
- text: string
17
- stability: number
18
- difficulty: number
19
- reps: number
20
- lapses: number
21
- fsrsState: number // State: 0=New 1=Learning 2=Review 3=Relearning
22
- due: number // ms timestamp; 0 = due immediately (new card)
23
- lastReview: number // ms timestamp; 0 = never reviewed
24
- lastRating: number // 0=unrated, 1=Again 2=Hard 3=Good 4=Easy
25
- elaboration?: ConceptElaboration
26
- }
27
-
28
- /** Fresh FSRS fields for a new or shared-import concept (no personal review history). */
29
- export function defaultConceptReviewFields(): Pick<
30
- ConceptNodeData,
31
- 'stability' | 'difficulty' | 'reps' | 'lapses' | 'fsrsState' | 'due' | 'lastReview' | 'lastRating'
32
- > {
33
- return {
34
- stability: 0,
35
- difficulty: 0,
36
- reps: 0,
37
- lapses: 0,
38
- fsrsState: 0,
39
- due: 0,
40
- lastReview: 0,
41
- lastRating: 0,
42
- }
43
- }
44
-
45
- export function nodeToCard(data: ConceptNodeData): Card {
46
- return {
47
- due: new Date(data.due || Date.now()),
48
- stability: data.stability,
49
- difficulty: data.difficulty,
50
- elapsed_days: 0,
51
- scheduled_days: 0,
52
- learning_steps: 0,
53
- reps: data.reps,
54
- lapses: data.lapses,
55
- state: data.fsrsState as State,
56
- last_review: data.lastReview ? new Date(data.lastReview) : undefined,
57
- }
58
- }
59
-
60
- export type EdgeEncoding = 'full' | 'category' | 'minimal'
61
- export type CurveStyle = 'arc' | 'straight'
62
-
63
- export interface NessoEdgeData extends Record<string, unknown> {
64
- type: EdgeTypeName
65
- siblingIdx?: number
66
- curveFlip?: boolean
67
- curveFlipPinned?: boolean
68
- }
69
-
70
- export type CategoryPalette = 'default' | 'vivid' | 'muted' | 'monoCat'
71
-
72
- export type Language = 'en' | 'it'
73
-
74
- export interface GraphDisplaySettings {
75
- edgeEncoding: EdgeEncoding
76
- showHeatmap: boolean
77
- curveStyle: CurveStyle
78
- autoCurveFlip: boolean
79
- }
80
-
81
- export function defaultGraphDisplay(
82
- settings?: Pick<NessoSettings, 'edgeEncoding' | 'showHeatmap' | 'curveStyle' | 'autoCurveFlip'>,
83
- ): GraphDisplaySettings {
84
- return {
85
- edgeEncoding: settings?.edgeEncoding ?? 'full',
86
- showHeatmap: settings?.showHeatmap ?? true,
87
- curveStyle: settings?.curveStyle ?? 'arc',
88
- autoCurveFlip: settings?.autoCurveFlip !== false,
89
- }
90
- }
91
-
92
- export function mergeGraphDisplay(
93
- stored: Partial<GraphDisplaySettings> | undefined,
94
- settings: NessoSettings,
95
- ): GraphDisplaySettings {
96
- const base = defaultGraphDisplay(settings)
97
- if (!stored) return base
98
- return {
99
- edgeEncoding: stored.edgeEncoding ?? base.edgeEncoding,
100
- showHeatmap: stored.showHeatmap ?? base.showHeatmap,
101
- curveStyle: stored.curveStyle ?? base.curveStyle,
102
- autoCurveFlip: stored.autoCurveFlip !== undefined ? stored.autoCurveFlip : base.autoCurveFlip,
103
- }
104
- }
105
-
106
- export interface NessoSettings {
107
- dark: boolean
108
- accent: string
109
- language: Language
110
- edgeEncoding: EdgeEncoding
111
- showLabels: boolean
112
- showConfidence: boolean
113
- showHeatmap: boolean
114
- curveStyle: CurveStyle
115
- autoCurveFlip: boolean
116
- categoryPalette: CategoryPalette
117
- aiMode: 'remote' | 'local'
118
- aiBaseUrl: string
119
- aiModel: string
120
- aiApiKey: string
121
- fsrsRetention: number
122
- maximumInterval: number
123
- inspectorExamplesOpen: boolean
124
- inspectorRelationsOpen: boolean
125
- /** Desktop: custom folder for graph .json files; null = default app data graphs folder. */
126
- graphWorkspacePath: string | null
127
- }
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "strict": true,
9
- "declaration": true,
10
- "skipLibCheck": true
11
- },
12
- "include": ["src"]
13
- }