@jjlmoya/utils-language 1.7.0 → 1.9.0

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 (38) hide show
  1. package/package.json +1 -1
  2. package/src/category/index.ts +2 -1
  3. package/src/entries.ts +2 -1
  4. package/src/index.ts +5 -0
  5. package/src/tests/locale_completeness.test.ts +1 -1
  6. package/src/tests/seo_translation_completeness.test.ts +18 -12
  7. package/src/tests/tool_validation.test.ts +1 -1
  8. package/src/tool/cefr-language-skill-profile-planner/bibliography.astro +6 -0
  9. package/src/tool/cefr-language-skill-profile-planner/bibliography.ts +6 -0
  10. package/src/tool/cefr-language-skill-profile-planner/cefr-language-skill-profile-planner.css +565 -0
  11. package/src/tool/cefr-language-skill-profile-planner/component.astro +100 -0
  12. package/src/tool/cefr-language-skill-profile-planner/controller.ts +158 -0
  13. package/src/tool/cefr-language-skill-profile-planner/dom-views.ts +154 -0
  14. package/src/tool/cefr-language-skill-profile-planner/entry.ts +34 -0
  15. package/src/tool/cefr-language-skill-profile-planner/evaluator.ts +12 -0
  16. package/src/tool/cefr-language-skill-profile-planner/i18n/de.ts +26 -0
  17. package/src/tool/cefr-language-skill-profile-planner/i18n/en.ts +59 -0
  18. package/src/tool/cefr-language-skill-profile-planner/i18n/es.ts +15 -0
  19. package/src/tool/cefr-language-skill-profile-planner/i18n/fr.ts +11 -0
  20. package/src/tool/cefr-language-skill-profile-planner/i18n/id.ts +11 -0
  21. package/src/tool/cefr-language-skill-profile-planner/i18n/it.ts +11 -0
  22. package/src/tool/cefr-language-skill-profile-planner/i18n/ja.ts +11 -0
  23. package/src/tool/cefr-language-skill-profile-planner/i18n/ko.ts +11 -0
  24. package/src/tool/cefr-language-skill-profile-planner/i18n/nl.ts +11 -0
  25. package/src/tool/cefr-language-skill-profile-planner/i18n/pl.ts +11 -0
  26. package/src/tool/cefr-language-skill-profile-planner/i18n/pt.ts +11 -0
  27. package/src/tool/cefr-language-skill-profile-planner/i18n/ru.ts +11 -0
  28. package/src/tool/cefr-language-skill-profile-planner/i18n/sv.ts +11 -0
  29. package/src/tool/cefr-language-skill-profile-planner/i18n/tr.ts +11 -0
  30. package/src/tool/cefr-language-skill-profile-planner/i18n/zh.ts +11 -0
  31. package/src/tool/cefr-language-skill-profile-planner/index.ts +14 -0
  32. package/src/tool/cefr-language-skill-profile-planner/logic.test.ts +38 -0
  33. package/src/tool/cefr-language-skill-profile-planner/logic.ts +131 -0
  34. package/src/tool/cefr-language-skill-profile-planner/seo.astro +9 -0
  35. package/src/tool/cefr-language-skill-profile-planner/storage.ts +24 -0
  36. package/src/tool/cefr-language-skill-profile-planner/types.ts +45 -0
  37. package/src/tool/cefr-language-skill-profile-planner/ui.ts +43 -0
  38. package/src/tools.ts +2 -1
@@ -0,0 +1,24 @@
1
+ import type { CefrPlannerInputs } from './types';
2
+
3
+ const STORAGE_KEY = 'cefr-language-skill-profile-planner';
4
+
5
+ export function readSavedInputs(): Partial<CefrPlannerInputs> | null {
6
+ try {
7
+ const value = localStorage.getItem(STORAGE_KEY);
8
+ return value ? JSON.parse(value) as Partial<CefrPlannerInputs> : null;
9
+ } catch {
10
+ return null;
11
+ }
12
+ }
13
+
14
+ export function saveInputs(inputs: CefrPlannerInputs): void {
15
+ try {
16
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(inputs));
17
+ } catch {}
18
+ }
19
+
20
+ export function clearSavedInputs(): void {
21
+ try {
22
+ localStorage.removeItem(STORAGE_KEY);
23
+ } catch {}
24
+ }
@@ -0,0 +1,45 @@
1
+ export type CefrLevel = 'A1' | 'A2' | 'B1' | 'B2' | 'C1' | 'C2';
2
+ export type SkillKey = 'listening' | 'reading' | 'spokenInteraction' | 'spokenProduction' | 'writing';
3
+ export type ProfileStatus = 'on-track' | 'tight' | 'insufficient';
4
+
5
+ export interface SkillInput {
6
+ current: CefrLevel;
7
+ target: CefrLevel;
8
+ }
9
+
10
+ export interface CefrPlannerInputs {
11
+ targetDate: string;
12
+ weeklyHours: number;
13
+ skills: Record<SkillKey, SkillInput>;
14
+ }
15
+
16
+ export interface SkillPlan {
17
+ key: SkillKey;
18
+ current: CefrLevel;
19
+ target: CefrLevel;
20
+ gapLevels: number;
21
+ hoursLow: number;
22
+ hoursHigh: number;
23
+ weeklyHours: number;
24
+ allocation: number;
25
+ }
26
+
27
+ export interface SkillMilestone {
28
+ key: SkillKey;
29
+ level: CefrLevel;
30
+ week: number;
31
+ date: string;
32
+ }
33
+
34
+ export interface CefrProfilePlan {
35
+ inputs: CefrPlannerInputs;
36
+ weeksAvailable: number;
37
+ totalHoursLow: number;
38
+ totalHoursHigh: number;
39
+ availableHours: number;
40
+ status: ProfileStatus;
41
+ skills: SkillPlan[];
42
+ milestones: SkillMilestone[];
43
+ }
44
+
45
+ export type CefrPlannerResult = { ok: true; plan: CefrProfilePlan } | { ok: false; error: string };
@@ -0,0 +1,43 @@
1
+ export interface CefrSkillProfileUI extends Record<string, string> {
2
+ targetDate: string;
3
+ weeklyHours: string;
4
+ listening: string;
5
+ reading: string;
6
+ spokenInteraction: string;
7
+ spokenProduction: string;
8
+ writing: string;
9
+ currentLevel: string;
10
+ targetLevel: string;
11
+ planButton: string;
12
+ resetButton: string;
13
+ presetLabel: string;
14
+ gentlePreset: string;
15
+ steadyPreset: string;
16
+ focusedPreset: string;
17
+ resultTitle: string;
18
+ emptyResult: string;
19
+ statusOnTrack: string;
20
+ statusTight: string;
21
+ statusInsufficient: string;
22
+ totalHours: string;
23
+ availableHours: string;
24
+ weeksAvailable: string;
25
+ skillProfile: string;
26
+ milestoneMap: string;
27
+ hours: string;
28
+ week: string;
29
+ noGap: string;
30
+ checkInputs: string;
31
+ futureDateError: string;
32
+ dateFormatError: string;
33
+ hoursError: string;
34
+ targetBelowCurrentError: string;
35
+ noProgressError: string;
36
+ plannerNote: string;
37
+ hoursEstimateNote: string;
38
+ skillListening: string;
39
+ skillReading: string;
40
+ skillSpokenInteraction: string;
41
+ skillSpokenProduction: string;
42
+ skillWriting: string;
43
+ }
package/src/tools.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ToolDefinition } from './types';
2
+ import { CEFR_LANGUAGE_SKILL_PROFILE_PLANNER_TOOL } from './tool/cefr-language-skill-profile-planner';
2
3
  import { LANGUAGE_LEARNING_STUDY_PLAN_PLANNER_TOOL } from './tool/language-learning-study-plan-planner';
3
4
 
4
- export const ALL_TOOLS: ToolDefinition[] = [LANGUAGE_LEARNING_STUDY_PLAN_PLANNER_TOOL];
5
+ export const ALL_TOOLS: ToolDefinition[] = [LANGUAGE_LEARNING_STUDY_PLAN_PLANNER_TOOL, CEFR_LANGUAGE_SKILL_PROFILE_PLANNER_TOOL];
5
6
 
6
7
  export { ALL_ENTRIES } from './entries';