@karagoz/hayali 0.0.0-stage → 0.6.1
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/karagoz-hayali.css +3 -0
- package/dist/karagoz-hayali.js +3869 -0
- package/dist/karagoz-hayali.umd.cjs +15 -0
- package/dist/karagoz-logo.svg +3 -0
- package/dist/parse.cjs +3 -0
- package/dist/parse.js +521 -0
- package/dist/src/App.vue.d.ts +3 -0
- package/dist/src/callouts.d.ts +28 -0
- package/dist/src/components/KrgzHayali.vue.d.ts +49 -0
- package/dist/src/components/LessonToolbar.vue.d.ts +17 -0
- package/dist/src/components/StepBody.vue.d.ts +7 -0
- package/dist/src/components/StepList.vue.d.ts +15 -0
- package/dist/src/components/StepLockAlert.vue.d.ts +8 -0
- package/dist/src/components/TocDropdown.vue.d.ts +14 -0
- package/dist/src/composables/useCounter.d.ts +4 -0
- package/dist/src/composables/useIsolationWarning.d.ts +5 -0
- package/dist/src/composables/useLessonPosition.d.ts +30 -0
- package/dist/src/composables/useLessonReset.d.ts +34 -0
- package/dist/src/composables/useStepEntry.d.ts +59 -0
- package/dist/src/composables/useStepLocks.d.ts +24 -0
- package/dist/src/examples/DefaultExample.vue.d.ts +3 -0
- package/dist/src/examples/ParserExample.vue.d.ts +3 -0
- package/dist/src/i18n.d.ts +1739 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/layout/breakpoints.d.ts +16 -0
- package/dist/src/layout/layoutCss.d.ts +5 -0
- package/dist/src/lesson.d.ts +9 -0
- package/dist/src/locales/ar.d.ts +25 -0
- package/dist/src/locales/de.d.ts +25 -0
- package/dist/src/locales/en.d.ts +25 -0
- package/dist/src/locales/index.d.ts +1743 -0
- package/dist/src/main.d.ts +3 -0
- package/dist/src/parse/blocks.d.ts +31 -0
- package/dist/src/parse/body.d.ts +7 -0
- package/dist/src/parse/fenceInfo.d.ts +8 -0
- package/dist/src/parse/fileSource.d.ts +18 -0
- package/dist/src/parse/index.d.ts +2 -0
- package/dist/src/parse/parseLesson.d.ts +3 -0
- package/dist/src/parse/resolve.d.ts +37 -0
- package/dist/src/parse/tree.d.ts +11 -0
- package/dist/src/parse/types.d.ts +32 -0
- package/dist/src/typedoc-entry.d.ts +7 -0
- package/dist/src/types.d.ts +69 -0
- package/dist/src/validateLesson.d.ts +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +1943 -0
- package/package.json +87 -3
- package/src/layout.css +218 -0
- package/src/lib.css +50 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { Chapter, Lesson, Position, Step } from '../types';
|
|
4
|
+
export interface StepGroupEntry {
|
|
5
|
+
position: Position;
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StepGroup {
|
|
9
|
+
chapterId: string;
|
|
10
|
+
/** Undefined when the lesson has a single chapter (flattened). */
|
|
11
|
+
title?: string;
|
|
12
|
+
steps: StepGroupEntry[];
|
|
13
|
+
}
|
|
14
|
+
/** First step of the first non-empty chapter; blank IDs for a lesson with no steps. */
|
|
15
|
+
export declare const firstPosition: (lesson: Lesson) => Position;
|
|
16
|
+
/** Whether `target` names an existing step (step IDs are only unique within a chapter). */
|
|
17
|
+
export declare const hasPosition: (lesson: Lesson, target: Position) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Lesson traversal over a `{ chapterId, stepId }` position.
|
|
20
|
+
* @param lesson
|
|
21
|
+
* @param position the `v-model` ref; written through by `goTo`
|
|
22
|
+
*/
|
|
23
|
+
export declare const useLessonPosition: (lesson: MaybeRefOrGetter<Lesson>, position: Ref<Position>) => {
|
|
24
|
+
chapter: import("vue").ComputedRef<Chapter | undefined>;
|
|
25
|
+
step: import("vue").ComputedRef<Step | undefined>;
|
|
26
|
+
prev: import("vue").ComputedRef<Position | undefined>;
|
|
27
|
+
next: import("vue").ComputedRef<Position | undefined>;
|
|
28
|
+
groups: import("vue").ComputedRef<StepGroup[]>;
|
|
29
|
+
goTo: (target: Position) => void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { AdjustmentsTree, Lesson, Position } from '../types';
|
|
3
|
+
/** The slice of WebContainer's `fs` this composable needs; injectable for tests. */
|
|
4
|
+
export interface LessonFs {
|
|
5
|
+
watch(path: string, options: {
|
|
6
|
+
recursive: boolean;
|
|
7
|
+
}, listener: (event: string, filename: string | Uint8Array | null) => void): {
|
|
8
|
+
close(): void;
|
|
9
|
+
};
|
|
10
|
+
mount(tree: AdjustmentsTree): Promise<unknown>;
|
|
11
|
+
rm(path: string, options?: {
|
|
12
|
+
recursive?: boolean;
|
|
13
|
+
force?: boolean;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
}
|
|
16
|
+
export type Tier = 'A' | 'B';
|
|
17
|
+
/**
|
|
18
|
+
* Tier A (immutable) / tier B (resettable) tracking, dirty flag, confirm gate and reset-on-navigate.
|
|
19
|
+
* @param options.fs WebContainer-shaped `fs`
|
|
20
|
+
* @param options.lesson
|
|
21
|
+
*/
|
|
22
|
+
export declare const useLessonReset: (options: {
|
|
23
|
+
fs: LessonFs;
|
|
24
|
+
lesson: MaybeRefOrGetter<Lesson>;
|
|
25
|
+
}) => {
|
|
26
|
+
tierOf: (path: string) => Tier;
|
|
27
|
+
dirty: import("vue").Ref<boolean, boolean>;
|
|
28
|
+
requiresConfirm: import("vue").ComputedRef<boolean>;
|
|
29
|
+
current: import("vue").Ref<Position | undefined, Position | undefined>;
|
|
30
|
+
boot: (position: Position) => Promise<void>;
|
|
31
|
+
reset: (from: Position, to: Position) => Promise<void>;
|
|
32
|
+
navigate: (to: Position, confirm: () => boolean | Promise<boolean>) => Promise<boolean>;
|
|
33
|
+
dispose: () => void;
|
|
34
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { Lesson, Position } from '../types';
|
|
3
|
+
/** The slice of `useSandbox()` this composable calls; injectable for tests. */
|
|
4
|
+
export interface StepEntrySandbox {
|
|
5
|
+
editorTabs: {
|
|
6
|
+
tabs: Readonly<Ref<readonly {
|
|
7
|
+
id: string;
|
|
8
|
+
}[]>>;
|
|
9
|
+
open(id: string): void;
|
|
10
|
+
close(id: string): void;
|
|
11
|
+
closeAll(): void;
|
|
12
|
+
};
|
|
13
|
+
editorViews: {
|
|
14
|
+
/** One line or one inclusive `[from, to]` range per call (the sandbox does not take lists). */
|
|
15
|
+
highlightLines(lines: number | [from: number, to: number], path: string, options: {
|
|
16
|
+
open: false;
|
|
17
|
+
}): Promise<void> | void;
|
|
18
|
+
goToLine(line: number, path: string, options: {
|
|
19
|
+
focus: false;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
clearAllHighlightedLines(): void;
|
|
22
|
+
};
|
|
23
|
+
preview: {
|
|
24
|
+
navigate(path: string): void;
|
|
25
|
+
/** Reload the current page, e.g. after the files under it changed. */
|
|
26
|
+
reload(): Promise<void> | void;
|
|
27
|
+
/** Current preview path. */
|
|
28
|
+
path: Readonly<Ref<string>>;
|
|
29
|
+
/** Empty until the dev server is ready. */
|
|
30
|
+
url: Readonly<Ref<string>>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The slice of `useLessonReset()` this composable calls. */
|
|
34
|
+
export interface StepEntryReset {
|
|
35
|
+
dirty: Readonly<Ref<boolean>>;
|
|
36
|
+
navigate(to: Position, confirm: () => boolean | Promise<boolean>): Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Owns navigation (single-flight: confirm, reset, position) and the step-entry sequence that follows it: clear
|
|
40
|
+
* highlights, close/open tabs, highlight, go to a line, then the preview. Everything is derived from the entered step
|
|
41
|
+
* alone; nothing is inherited from the previous one. Bad directives are skipped with a dev warning, never thrown.
|
|
42
|
+
*/
|
|
43
|
+
export declare const useStepEntry: (options: {
|
|
44
|
+
lesson: () => Lesson;
|
|
45
|
+
position: Readonly<Ref<Position>>;
|
|
46
|
+
/** Writes the new position (after a successful reset). */
|
|
47
|
+
goTo: (to: Position) => void;
|
|
48
|
+
reset: StepEntryReset;
|
|
49
|
+
confirm: () => boolean | Promise<boolean>;
|
|
50
|
+
sandbox: StepEntrySandbox;
|
|
51
|
+
/** Whether the Sandbox pane is visible (always true on the side-by-side layout). */
|
|
52
|
+
sandboxVisible: Readonly<Ref<boolean>>;
|
|
53
|
+
/** How long to wait for an editor view before skipping a go-to. */
|
|
54
|
+
viewTimeoutMs?: number;
|
|
55
|
+
}) => {
|
|
56
|
+
navigating: Ref<boolean, boolean>;
|
|
57
|
+
navigate: (target: Position) => Promise<void>;
|
|
58
|
+
enterInitial: () => Promise<void>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SandboxOptions } from '@karagoz/sandbox';
|
|
2
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import type { Lesson, PathPattern, Position } from '../types';
|
|
4
|
+
type ExplorerOptions = SandboxOptions['explorer'];
|
|
5
|
+
/** The slice of `useSandbox().setOption` this composable needs; injectable for tests. */
|
|
6
|
+
export type SetExplorerOption = (key: 'explorer', setter: (old: ExplorerOptions) => ExplorerOptions) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Lesson patterns are gitignore-style and relative to the project root, while the sandbox explorer matches
|
|
9
|
+
* `./`-prefixed paths. Anchor patterns containing a slash to `./` and let slash-less ones match at any depth.
|
|
10
|
+
*/
|
|
11
|
+
export declare const toSandboxPattern: (pattern: PathPattern) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Keeps the sandbox explorer's readonly patterns in sync with the current step's locks (plus the lesson's
|
|
14
|
+
* immutable tier). Readonly is UI-only: it never blocks `container.fs` writes, so locked files still count as dirty.
|
|
15
|
+
* @param options.lesson
|
|
16
|
+
* @param options.position current step
|
|
17
|
+
* @param options.setOption `useSandbox().setOption`
|
|
18
|
+
*/
|
|
19
|
+
export declare const useStepLocks: (options: {
|
|
20
|
+
lesson: MaybeRefOrGetter<Lesson>;
|
|
21
|
+
position: MaybeRefOrGetter<Position>;
|
|
22
|
+
setOption: SetExplorerOption;
|
|
23
|
+
}) => import("vue").ComputedRef<string[]>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|