@octolearn/training-ui 0.0.0-stage → 0.2.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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +413 -3
  3. package/THIRD-PARTY-NOTICES.md +211 -0
  4. package/dist/chunks/core-rJUDTpGS.js +592 -0
  5. package/dist/chunks/define-elements-CeSpZJXj.js +6111 -0
  6. package/dist/chunks/font-data-DlFp9eSH.js +8 -0
  7. package/dist/core.js +11 -0
  8. package/dist/define.js +52 -0
  9. package/dist/index.js +50 -0
  10. package/dist/octolearn-training-ui.bundle.js +6441 -0
  11. package/dist/types/base-element.d.ts +35 -0
  12. package/dist/types/content.d.ts +51 -0
  13. package/dist/types/core.d.ts +13 -0
  14. package/dist/types/d-icons.d.ts +10 -0
  15. package/dist/types/define-elements.d.ts +18 -0
  16. package/dist/types/define.d.ts +1 -0
  17. package/dist/types/diff.d.ts +34 -0
  18. package/dist/types/elements/arithmetic-question.d.ts +31 -0
  19. package/dist/types/elements/card.d.ts +43 -0
  20. package/dist/types/elements/choice-pair.d.ts +21 -0
  21. package/dist/types/elements/dictation-question.d.ts +51 -0
  22. package/dist/types/elements/feedback-toast.d.ts +29 -0
  23. package/dist/types/elements/feedback.d.ts +87 -0
  24. package/dist/types/elements/flashcard.d.ts +46 -0
  25. package/dist/types/elements/matching-round.d.ts +61 -0
  26. package/dist/types/elements/multiple-choice.d.ts +33 -0
  27. package/dist/types/elements/picture-question.d.ts +30 -0
  28. package/dist/types/elements/progress.d.ts +24 -0
  29. package/dist/types/elements/question-answer.d.ts +20 -0
  30. package/dist/types/elements/question-parts.d.ts +88 -0
  31. package/dist/types/elements/question.d.ts +37 -0
  32. package/dist/types/elements/text-answer.d.ts +57 -0
  33. package/dist/types/elements/tile-answer.d.ts +43 -0
  34. package/dist/types/elements/today-stats.d.ts +17 -0
  35. package/dist/types/elements/trainer-overlay.d.ts +45 -0
  36. package/dist/types/elements/trainer-panel.d.ts +46 -0
  37. package/dist/types/elements/trainer.d.ts +57 -0
  38. package/dist/types/elements/true-false.d.ts +37 -0
  39. package/dist/types/events.d.ts +53 -0
  40. package/dist/types/feedback-message.d.ts +34 -0
  41. package/dist/types/font-data.d.ts +2 -0
  42. package/dist/types/fonts.d.ts +9 -0
  43. package/dist/types/i18n/strings.d.ts +233 -0
  44. package/dist/types/icons.d.ts +21 -0
  45. package/dist/types/images.d.ts +2 -0
  46. package/dist/types/index.d.ts +32 -0
  47. package/dist/types/keys.d.ts +6 -0
  48. package/dist/types/session/third-party-transport.d.ts +22 -0
  49. package/dist/types/session/training-session.d.ts +167 -0
  50. package/dist/types/session/transport.d.ts +44 -0
  51. package/dist/types/speech.d.ts +71 -0
  52. package/dist/types/styles/base.d.ts +9 -0
  53. package/dist/types/styles/d-parts.d.ts +13 -0
  54. package/dist/types/styles/tokens.d.ts +95 -0
  55. package/dist/types/viewport.d.ts +35 -0
  56. package/package.json +67 -6
@@ -0,0 +1,95 @@
1
+ import { type CSSResult } from 'lit';
2
+ export declare const tokens: {
3
+ fontBody: CSSResult;
4
+ fontHeadline: CSSResult;
5
+ primary: CSSResult;
6
+ /** Hover of the filled button (octolearn: .btn-octolearn-success:hover). */
7
+ primaryHover: CSSResult;
8
+ /** Orange-brown that meets 4.5:1 on white and the surface; used for the focus ring. */
9
+ primaryContrast: CSSResult;
10
+ onPrimary: CSSResult;
11
+ text: CSSResult;
12
+ textMuted: CSSResult;
13
+ placeholder: CSSResult;
14
+ /** Card behind the whole training (octolearn: .card-light.training-shell; .card-light's !important grey wins). */
15
+ card: CSSResult;
16
+ /** Question and stats panels (octolearn: --training-surface). */
17
+ surface: CSSResult;
18
+ /** Inputs, stat tiles, picture frame. */
19
+ field: CSSResult;
20
+ /** Frame around the picture of a picture riddle. */
21
+ frame: CSSResult;
22
+ fieldBorder: CSSResult;
23
+ folderName: CSSResult;
24
+ prompt: CSSResult;
25
+ statsTitle: CSSResult;
26
+ statLabel: CSSResult;
27
+ statValue: CSSResult;
28
+ choiceText: CSSResult;
29
+ choiceTop: CSSResult;
30
+ choiceBottom: CSSResult;
31
+ feedbackCard: CSSResult;
32
+ feedbackEyebrow: CSSResult;
33
+ feedbackLabel: CSSResult;
34
+ feedbackValue: CSSResult;
35
+ feedbackValueBg: CSSResult;
36
+ successAccent: CSSResult;
37
+ successBg: CSSResult;
38
+ successBadge: CSSResult;
39
+ successBadgeBg: CSSResult;
40
+ errorAccent: CSSResult;
41
+ errorBg: CSSResult;
42
+ errorBadge: CSSResult;
43
+ errorBadgeBg: CSSResult;
44
+ hintBg: CSSResult;
45
+ hintBorder: CSSResult;
46
+ hintText: CSSResult;
47
+ badgeBorder: CSSResult;
48
+ badgeText: CSSResult;
49
+ badgeBg: CSSResult;
50
+ };
51
+ /**
52
+ * `theme="dark"` on an element: darker surfaces, same accent. Set on :host, so the elements inside its shadow root inherit
53
+ * them; a page that sets the properties itself still wins.
54
+ */
55
+ export declare const darkTheme: CSSResult;
56
+ /**
57
+ * Design D (canvas "Octolearn Startseite – Redesign", Entwurf D): the question card for children. Same rule as above:
58
+ * read-only custom properties with D's values as fallback.
59
+ */
60
+ export declare const d: {
61
+ ink: CSSResult;
62
+ inkSoft: CSSResult;
63
+ muted: CSSResult;
64
+ /** The uppercase format label ("DIKTAT"), 4.9:1 on white. */
65
+ label: CSSResult;
66
+ accent: CSSResult;
67
+ /** Text and icons on the accent ("Weiter", the speaker button); stays dark in the dark theme. */
68
+ onAccent: CSSResult;
69
+ cream: CSSResult;
70
+ /** Picture frame, Inkie's speech bubble in the side panel. */
71
+ creamLight: CSSResult;
72
+ /** Background of the side panel. */
73
+ panel: CSSResult;
74
+ paper: CSSResult;
75
+ paperLine: CSSResult;
76
+ line: CSSResult;
77
+ lineSoft: CSSResult;
78
+ openStar: CSSResult;
79
+ /** Choices that can no longer be picked, and the other tiles in the feedback. */
80
+ disabled: CSSResult;
81
+ /** Border of the picture frame. */
82
+ frameLine: CSSResult;
83
+ /** Dashed orange borders: the gap of a fragment, the reward box in the side panel. */
84
+ dash: CSSResult;
85
+ /** An empty slot of a tile answer. */
86
+ slot: CSSResult;
87
+ right: CSSResult;
88
+ rightBg: CSSResult;
89
+ rightText: CSSResult;
90
+ wrong: CSSResult;
91
+ wrongBg: CSSResult;
92
+ wrongText: CSSResult;
93
+ /** Behind the card in the overlay: the game, darkened. */
94
+ backdrop: CSSResult;
95
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Is the visible part of the page short, e.g. because a phone's on-screen keyboard covers half of it? CSS can't tell:
3
+ * iOS Safari and current Android Chrome shrink only the visual viewport when the keyboard opens, not the layout viewport
4
+ * that `vh` and media queries see. So the elements ask `window.visualViewport`; while it is short they switch to a
5
+ * compact layout (attribute `short`, see OctolearnElement).
6
+ */
7
+ /** Below this height (CSS px, at zoom 1) the visible area counts as short. A phone with its keyboard open has ~300–400. */
8
+ export declare const SHORT_VIEWPORT_PX = 520;
9
+ type Listener = (short: boolean) => void;
10
+ /** Watches `window.visualViewport` while anything listens. One per page: see getViewportWatcher(). */
11
+ export declare class ViewportWatcher {
12
+ private readonly listeners;
13
+ private viewport;
14
+ private current;
15
+ /** The visible area is short right now (false without a visual viewport, e.g. old browsers). */
16
+ get short(): boolean;
17
+ /** Calls `listener` whenever `short` flips; returns the function that ends it. */
18
+ subscribe(listener: Listener): () => void;
19
+ private attach;
20
+ private detach;
21
+ private readonly onResize;
22
+ private static visualViewport;
23
+ /** Height times scale: zooming in with two fingers makes the visual viewport smaller, but the page isn't short. */
24
+ private static measure;
25
+ }
26
+ /** The watcher the elements use. One per page: there is one viewport. */
27
+ export declare function getViewportWatcher(): ViewportWatcher;
28
+ /**
29
+ * Scrolls `element` to the top of what the learner sees. On iOS the visual viewport is panned down inside the layout
30
+ * viewport while the keyboard is open (`offsetTop`); without the correction the element would sit above the visible part.
31
+ */
32
+ export declare function revealAtTop(element: Element): void;
33
+ /** The focus is inside `element` (also inside its shadow root and the shadow roots below). */
34
+ export declare function hasFocusInside(element: Element): boolean;
35
+ export {};
package/package.json CHANGED
@@ -1,6 +1,67 @@
1
- {
2
- "name": "@octolearn/training-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@octolearn/training-ui",
3
+ "version": "0.2.0",
4
+ "description": "Octolearn's training components (questions, multiple choice, answer feedback, today's stats) as framework-independent web components.",
5
+ "keywords": [
6
+ "octolearn",
7
+ "learning",
8
+ "spaced-repetition",
9
+ "web-components",
10
+ "lit",
11
+ "custom-elements"
12
+ ],
13
+ "homepage": "https://octolearn.de/docs",
14
+ "license": "MIT",
15
+ "sideEffects": [
16
+ "./dist/define.js",
17
+ "./dist/octolearn-training-ui.bundle.js"
18
+ ],
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/types/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "./define": {
26
+ "types": "./dist/types/define.d.ts",
27
+ "default": "./dist/define.js"
28
+ },
29
+ "./core": {
30
+ "types": "./dist/types/core.d.ts",
31
+ "default": "./dist/core.js"
32
+ },
33
+ "./bundle": "./dist/octolearn-training-ui.bundle.js",
34
+ "./package.json": "./package.json"
35
+ },
36
+ "main": "./dist/index.js",
37
+ "module": "./dist/index.js",
38
+ "types": "./dist/types/index.d.ts",
39
+ "files": [
40
+ "dist",
41
+ "README.md",
42
+ "LICENSE",
43
+ "THIRD-PARTY-NOTICES.md"
44
+ ],
45
+ "scripts": {
46
+ "build": "vite build && vite build --mode bundle && tsc -p tsconfig.build.json",
47
+ "dev": "vite",
48
+ "prepublishOnly": "npm run build && npm run test",
49
+ "test": "tsc --noEmit -p tsconfig.json && vitest run",
50
+ "test:watch": "vitest"
51
+ },
52
+ "dependencies": {
53
+ "lit": "3.3.3"
54
+ },
55
+ "devDependencies": {
56
+ "@fontsource-variable/montserrat": "5.3.0",
57
+ "@fontsource/nothing-you-could-do": "5.3.0",
58
+ "@fortawesome/free-solid-svg-icons": "6.7.2",
59
+ "happy-dom": "20.14.5",
60
+ "typescript": "5.9.3",
61
+ "vite": "7.3.2",
62
+ "vitest": "5.0.3"
63
+ },
64
+ "engines": {
65
+ "node": ">=22.12.0"
66
+ }
67
+ }