@duckpic/content-spec 0.2.6 → 0.2.7

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.
@@ -7,5 +7,6 @@ export declare const LayoutPropsSchema: z.ZodObject<{
7
7
  padding: z.ZodOptional<z.ZodString>;
8
8
  borderRadius: z.ZodOptional<z.ZodString>;
9
9
  }, z.core.$strip>>;
10
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
10
11
  }, z.core.$strip>;
11
12
  export declare const LayoutComponentSpec: ComponentSpec;
@@ -1,11 +1,13 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const LayoutPropsSchema = z.object({
3
4
  backgroundColor: z.string().optional(),
4
5
  style: z.object({
5
6
  backgroundColor: z.string().optional(),
6
7
  padding: z.string().optional(),
7
8
  borderRadius: z.string().optional()
8
- }).optional()
9
+ }).optional(),
10
+ visibleForLevels: VisibleForLevelsSchema,
9
11
  });
10
12
  export const LayoutComponentSpec = {
11
13
  type: "Layout",
@@ -3,5 +3,6 @@ import type { ComponentSpec } from "./ComponentSpec";
3
3
  export declare const MultipagePropsSchema: z.ZodObject<{
4
4
  title: z.ZodOptional<z.ZodString>;
5
5
  description: z.ZodOptional<z.ZodString>;
6
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
6
7
  }, z.core.$strip>;
7
8
  export declare const MultipageComponentSpec: ComponentSpec;
@@ -1,7 +1,9 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const MultipagePropsSchema = z.object({
3
4
  title: z.string().optional(),
4
5
  description: z.string().optional(),
6
+ visibleForLevels: VisibleForLevelsSchema,
5
7
  });
6
8
  export const MultipageComponentSpec = {
7
9
  type: "Multipage",
@@ -3,5 +3,6 @@ import type { ComponentSpec } from "./ComponentSpec";
3
3
  export declare const PagePropsSchema: z.ZodObject<{
4
4
  title: z.ZodOptional<z.ZodString>;
5
5
  backgroundColor: z.ZodOptional<z.ZodString>;
6
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
6
7
  }, z.core.$strip>;
7
8
  export declare const PageComponentSpec: ComponentSpec;
@@ -1,7 +1,9 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const PagePropsSchema = z.object({
3
4
  title: z.string().optional(),
4
- backgroundColor: z.string().optional()
5
+ backgroundColor: z.string().optional(),
6
+ visibleForLevels: VisibleForLevelsSchema,
5
7
  });
6
8
  export const PageComponentSpec = {
7
9
  type: "Page",
@@ -11,6 +11,7 @@ export declare const QuizPropsSchema: z.ZodObject<{
11
11
  a: z.ZodString;
12
12
  }, z.core.$strip>>;
13
13
  backgroundColor: z.ZodOptional<z.ZodString>;
14
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
14
15
  }, z.core.$strip>;
15
16
  export type QuizProps = z.infer<typeof QuizPropsSchema>;
16
17
  export declare const QuizComponentSpec: ComponentSpec;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const QuizQuestionSchema = z.object({
3
4
  q: z.string(),
4
5
  a: z.string()
@@ -6,7 +7,8 @@ export const QuizQuestionSchema = z.object({
6
7
  export const QuizPropsSchema = z.object({
7
8
  title: z.string().optional(),
8
9
  questions: z.array(QuizQuestionSchema).min(1),
9
- backgroundColor: z.string().optional()
10
+ backgroundColor: z.string().optional(),
11
+ visibleForLevels: VisibleForLevelsSchema,
10
12
  });
11
13
  export const QuizComponentSpec = {
12
14
  type: "Quiz",
@@ -9,5 +9,6 @@ export declare const TextPropsSchema: z.ZodObject<{
9
9
  }>;
10
10
  text: z.ZodString;
11
11
  backgroundColor: z.ZodOptional<z.ZodString>;
12
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
12
13
  }, z.core.$strip>;
13
14
  export declare const TextComponentSpec: ComponentSpec;
@@ -1,8 +1,10 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const TextPropsSchema = z.object({
3
4
  variant: z.enum(["h1", "h2", "h3", "body"]),
4
5
  text: z.string(),
5
- backgroundColor: z.string().optional()
6
+ backgroundColor: z.string().optional(),
7
+ visibleForLevels: VisibleForLevelsSchema,
6
8
  });
7
9
  export const TextComponentSpec = {
8
10
  type: "Text",
@@ -3,5 +3,6 @@ import type { ComponentSpec } from "./ComponentSpec";
3
3
  export declare const VideoPropsSchema: z.ZodObject<{
4
4
  title: z.ZodOptional<z.ZodString>;
5
5
  link: z.ZodOptional<z.ZodString>;
6
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
6
7
  }, z.core.$strip>;
7
8
  export declare const VideoComponentSpec: ComponentSpec;
@@ -1,7 +1,9 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const VideoPropsSchema = z.object({
3
4
  title: z.string().optional(),
4
5
  link: z.string().optional(),
6
+ visibleForLevels: VisibleForLevelsSchema,
5
7
  });
6
8
  export const VideoComponentSpec = {
7
9
  type: "Video",
@@ -7,5 +7,6 @@ export declare const VocabularyListPropsSchema: z.ZodObject<{
7
7
  select: "select";
8
8
  "add-to-my-vocabulary": "add-to-my-vocabulary";
9
9
  }>>>;
10
+ visibleForLevels: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof import("../schema/Level").LevelEnum>>>;
10
11
  }, z.core.$strip>;
11
12
  export declare const VocabularyListComponentSpec: ComponentSpec;
@@ -1,8 +1,10 @@
1
1
  import { z } from "zod";
2
+ import { VisibleForLevelsSchema } from "../schema/Level";
2
3
  export const VocabularyListPropsSchema = z.object({
3
4
  title: z.string().optional(),
4
5
  staticVocabIds: z.array(z.number()).default([]),
5
- userActions: z.array(z.enum(["select", "add-to-my-vocabulary"])).default([])
6
+ userActions: z.array(z.enum(["select", "add-to-my-vocabulary"])).default([]),
7
+ visibleForLevels: VisibleForLevelsSchema,
6
8
  });
7
9
  export const VocabularyListComponentSpec = {
8
10
  type: "VocabularyList",
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./components/Multipage";
6
6
  export * from "./components/Video";
7
7
  export * from "./components/VocabularyList";
8
8
  export * from "./schema/PageTree";
9
+ export * from "./schema/Level";
9
10
  import type { ComponentSpec } from "./components/ComponentSpec.ts";
10
11
  export declare const ComponentRegistry: {
11
12
  Text: ComponentSpec;
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from "./components/Multipage";
6
6
  export * from "./components/Video";
7
7
  export * from "./components/VocabularyList";
8
8
  export * from "./schema/PageTree";
9
+ export * from "./schema/Level";
9
10
  import { TextComponentSpec } from "./components/Text";
10
11
  import { QuizComponentSpec } from "./components/Quiz";
11
12
  import { LayoutComponentSpec } from "./components/Layout";
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ export declare enum LevelEnum {
3
+ beginner = "beginner",
4
+ elementary = "elementary",
5
+ preIntermediate = "pre-intermediate",
6
+ intermediate = "intermediate",
7
+ upperIntermediate = "upper-intermediate",
8
+ advanced = "advanced"
9
+ }
10
+ export declare const LevelSchema: z.ZodEnum<typeof LevelEnum>;
11
+ export declare const AllLevels: readonly [LevelEnum.beginner, LevelEnum.elementary, LevelEnum.preIntermediate, LevelEnum.intermediate, LevelEnum.upperIntermediate, LevelEnum.advanced];
12
+ export declare const VisibleForLevelsSchema: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof LevelEnum>>>;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export var LevelEnum;
3
+ (function (LevelEnum) {
4
+ LevelEnum["beginner"] = "beginner";
5
+ LevelEnum["elementary"] = "elementary";
6
+ LevelEnum["preIntermediate"] = "pre-intermediate";
7
+ LevelEnum["intermediate"] = "intermediate";
8
+ LevelEnum["upperIntermediate"] = "upper-intermediate";
9
+ LevelEnum["advanced"] = "advanced";
10
+ })(LevelEnum || (LevelEnum = {}));
11
+ export const LevelSchema = z.nativeEnum(LevelEnum);
12
+ export const AllLevels = [
13
+ LevelEnum.beginner,
14
+ LevelEnum.elementary,
15
+ LevelEnum.preIntermediate,
16
+ LevelEnum.intermediate,
17
+ LevelEnum.upperIntermediate,
18
+ LevelEnum.advanced,
19
+ ];
20
+ export const VisibleForLevelsSchema = z.array(LevelSchema).default([...AllLevels]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckpic/content-spec",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const LayoutPropsSchema = z.object({
5
6
  backgroundColor: z.string().optional(),
@@ -7,7 +8,8 @@ export const LayoutPropsSchema = z.object({
7
8
  backgroundColor: z.string().optional(),
8
9
  padding: z.string().optional(),
9
10
  borderRadius: z.string().optional()
10
- }).optional()
11
+ }).optional(),
12
+ visibleForLevels: VisibleForLevelsSchema,
11
13
  });
12
14
 
13
15
  export const LayoutComponentSpec: ComponentSpec = {
@@ -1,9 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const MultipagePropsSchema = z.object({
5
6
  title: z.string().optional(),
6
7
  description: z.string().optional(),
8
+ visibleForLevels: VisibleForLevelsSchema,
7
9
  });
8
10
 
9
11
  export const MultipageComponentSpec: ComponentSpec = {
@@ -1,9 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const PagePropsSchema = z.object({
5
6
  title: z.string().optional(),
6
- backgroundColor: z.string().optional()
7
+ backgroundColor: z.string().optional(),
8
+ visibleForLevels: VisibleForLevelsSchema,
7
9
  });
8
10
 
9
11
  export const PageComponentSpec: ComponentSpec = {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const QuizQuestionSchema = z.object({
5
6
  q: z.string(),
@@ -9,7 +10,8 @@ export const QuizQuestionSchema = z.object({
9
10
  export const QuizPropsSchema = z.object({
10
11
  title: z.string().optional(),
11
12
  questions: z.array(QuizQuestionSchema).min(1),
12
- backgroundColor: z.string().optional()
13
+ backgroundColor: z.string().optional(),
14
+ visibleForLevels: VisibleForLevelsSchema,
13
15
  });
14
16
 
15
17
  export type QuizProps = z.infer<typeof QuizPropsSchema>;
@@ -1,10 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const TextPropsSchema = z.object({
5
6
  variant: z.enum(["h1", "h2", "h3", "body"]),
6
7
  text: z.string(),
7
- backgroundColor: z.string().optional()
8
+ backgroundColor: z.string().optional(),
9
+ visibleForLevels: VisibleForLevelsSchema,
8
10
  });
9
11
 
10
12
  export const TextComponentSpec: ComponentSpec = {
@@ -1,9 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const VideoPropsSchema = z.object({
5
6
  title: z.string().optional(),
6
7
  link: z.string().optional(),
8
+ visibleForLevels: VisibleForLevelsSchema,
7
9
  });
8
10
 
9
11
  export const VideoComponentSpec: ComponentSpec = {
@@ -1,10 +1,12 @@
1
1
  import { z } from "zod";
2
2
  import type { ComponentSpec } from "./ComponentSpec";
3
+ import { VisibleForLevelsSchema } from "../schema/Level";
3
4
 
4
5
  export const VocabularyListPropsSchema = z.object({
5
6
  title: z.string().optional(),
6
7
  staticVocabIds: z.array(z.number()).default([]),
7
- userActions: z.array(z.enum(["select", "add-to-my-vocabulary"])).default([])
8
+ userActions: z.array(z.enum(["select", "add-to-my-vocabulary"])).default([]),
9
+ visibleForLevels: VisibleForLevelsSchema,
8
10
  });
9
11
 
10
12
  export const VocabularyListComponentSpec: ComponentSpec = {
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export * from "./components/Multipage";
6
6
  export * from "./components/Video";
7
7
  export * from "./components/VocabularyList";
8
8
  export * from "./schema/PageTree";
9
+ export * from "./schema/Level";
9
10
 
10
11
 
11
12
  import { TextComponentSpec } from "./components/Text";
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+
3
+ export enum LevelEnum {
4
+ beginner = "beginner",
5
+ elementary = "elementary",
6
+ preIntermediate = "pre-intermediate",
7
+ intermediate = "intermediate",
8
+ upperIntermediate = "upper-intermediate",
9
+ advanced = "advanced",
10
+ }
11
+
12
+ export const LevelSchema = z.nativeEnum(LevelEnum);
13
+
14
+ export const AllLevels = [
15
+ LevelEnum.beginner,
16
+ LevelEnum.elementary,
17
+ LevelEnum.preIntermediate,
18
+ LevelEnum.intermediate,
19
+ LevelEnum.upperIntermediate,
20
+ LevelEnum.advanced,
21
+ ] as const;
22
+
23
+ export const VisibleForLevelsSchema = z.array(LevelSchema).default([...AllLevels]);