@nesso-how/types 0.1.0-alpha.25 → 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/README.md CHANGED
@@ -11,8 +11,8 @@ npm install @nesso-how/types
11
11
  ## Usage
12
12
 
13
13
  ```ts
14
- import type { ConceptNodeData, NessoSettings } from "@nesso-how/types";
15
- import { defaultConceptReviewFields, nodeToCard } from "@nesso-how/types";
14
+ import type { ConceptNodeData, NessoSettings } from '@nesso-how/types'
15
+ import { defaultConceptReviewFields, nodeToCard } from '@nesso-how/types'
16
16
  ```
17
17
 
18
18
  ## License
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.25",
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.25"
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,134 +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'
32
- | 'difficulty'
33
- | 'reps'
34
- | 'lapses'
35
- | 'fsrsState'
36
- | 'due'
37
- | 'lastReview'
38
- | 'lastRating'
39
- > {
40
- return {
41
- stability: 0,
42
- difficulty: 0,
43
- reps: 0,
44
- lapses: 0,
45
- fsrsState: 0,
46
- due: 0,
47
- lastReview: 0,
48
- lastRating: 0,
49
- }
50
- }
51
-
52
- export function nodeToCard(data: ConceptNodeData): Card {
53
- return {
54
- due: new Date(data.due || Date.now()),
55
- stability: data.stability,
56
- difficulty: data.difficulty,
57
- elapsed_days: 0,
58
- scheduled_days: 0,
59
- learning_steps: 0,
60
- reps: data.reps,
61
- lapses: data.lapses,
62
- state: data.fsrsState as State,
63
- last_review: data.lastReview ? new Date(data.lastReview) : undefined,
64
- }
65
- }
66
-
67
- export type EdgeEncoding = 'full' | 'category' | 'minimal'
68
- export type CurveStyle = 'arc' | 'straight'
69
-
70
- export interface NessoEdgeData extends Record<string, unknown> {
71
- type: EdgeTypeName
72
- siblingIdx?: number
73
- curveFlip?: boolean
74
- curveFlipPinned?: boolean
75
- }
76
-
77
- export type CategoryPalette = 'default' | 'vivid' | 'muted' | 'monoCat'
78
-
79
- export type Language = 'en' | 'it'
80
-
81
- export interface GraphDisplaySettings {
82
- edgeEncoding: EdgeEncoding
83
- showHeatmap: boolean
84
- curveStyle: CurveStyle
85
- autoCurveFlip: boolean
86
- }
87
-
88
- export function defaultGraphDisplay(
89
- settings?: Pick<NessoSettings, 'edgeEncoding' | 'showHeatmap' | 'curveStyle' | 'autoCurveFlip'>,
90
- ): GraphDisplaySettings {
91
- return {
92
- edgeEncoding: settings?.edgeEncoding ?? 'full',
93
- showHeatmap: settings?.showHeatmap ?? true,
94
- curveStyle: settings?.curveStyle ?? 'arc',
95
- autoCurveFlip: settings?.autoCurveFlip !== false,
96
- }
97
- }
98
-
99
- export function mergeGraphDisplay(
100
- stored: Partial<GraphDisplaySettings> | undefined,
101
- settings: NessoSettings,
102
- ): GraphDisplaySettings {
103
- const base = defaultGraphDisplay(settings)
104
- if (!stored) return base
105
- return {
106
- edgeEncoding: stored.edgeEncoding ?? base.edgeEncoding,
107
- showHeatmap: stored.showHeatmap ?? base.showHeatmap,
108
- curveStyle: stored.curveStyle ?? base.curveStyle,
109
- autoCurveFlip: stored.autoCurveFlip !== undefined ? stored.autoCurveFlip : base.autoCurveFlip,
110
- }
111
- }
112
-
113
- export interface NessoSettings {
114
- dark: boolean
115
- accent: string
116
- language: Language
117
- edgeEncoding: EdgeEncoding
118
- showLabels: boolean
119
- showConfidence: boolean
120
- showHeatmap: boolean
121
- curveStyle: CurveStyle
122
- autoCurveFlip: boolean
123
- categoryPalette: CategoryPalette
124
- aiMode: 'remote' | 'local'
125
- aiBaseUrl: string
126
- aiModel: string
127
- aiApiKey: string
128
- fsrsRetention: number
129
- maximumInterval: number
130
- inspectorExamplesOpen: boolean
131
- inspectorRelationsOpen: boolean
132
- /** Desktop: custom folder for graph .json files; null = default app data graphs folder. */
133
- graphWorkspacePath: string | null
134
- }
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
- }