npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@exam-paper/structure

v0.0.0

Published

the structured data of exam-paper

Readme

@exam-paper/structure

This package defines the core data structures for the entire exam paper application. It uses TypeScript to create robust and type-safe models for papers, questions, answers, and more.

此包为整个试卷应用定义了核心数据结构。它使用 TypeScript 创建了健壮且类型安全的模型,用于描述试卷、问题、答案等。


Data Models

The data models are organized into the following directories:

数据模型按以下目录组织:

| Directory | English Description | 中文描述 | | :--- | :--- | :--- | | answer | Defines the data structure for answers to questions. | 定义了问题答案的数据结构。 | | consts | Contains constant values and enums used throughout the data models. | 包含整个数据模型中使用的常量和枚举。 | | content | Describes the structure of content blocks, such as text, images, or formulas, that can be used in questions and descriptions. | 描述了内容块的结构,例如可以在问题和描述中使用的文本、图片或公式。 | | exams | Defines the top-level structure for an entire exam, which may contain multiple papers. | 定义了整个考试的顶层结构,其中可能包含多份试卷。 | | papers | Contains the data models for the exam paper itself, including its header, footer, and sections. | 包含试卷本身的数据模型,包括其页眉、页脚和各个部分。 | | questions | Defines the structure for different types of questions (e.g., multiple choice, fill-in-the-blank). | 定义了不同类型问题(如选择题、填空题)的结构。 | | shared | Includes common TypeScript types and interfaces that are shared across different data models. | 包含在不同数据模型之间共享的通用 TypeScript 类型和接口。 | | styles | Defines the data structures for styling information, allowing for customizable rendering of the exam paper. | 定义了用于样式信息的数据结构,允许对试卷进行可定制的渲染。 |


API Reference

ExamPaperWrapper

ExamPaperWrapper 是试卷结构的核心类型,它包装了整个试卷的所有内容。

interface ExamPaperWrapper<Paper extends string = BuiltInPaperNameUnionTypes> {
  /**
   * 结构类型
   */
  type: StructuralType.PAPER;
  /**
   * 选项配置
   */
  option: PaperOption<Paper>;
  /**
   * 全局样式
   */
  style?: StyleWrapper;
  /**
   * 全局页眉
   */
  header?: HeaderWrapper["value"];
  /**
   * 全局页脚
   */
  footer?: FooterWrapper["value"];
  /**
   * 页面
   */
  pages: PageWrapper<ExamWidget[]>[];
}

试卷结构示例

示例:

{
  /**
   * 结构类型
   */
  "type": "paper",
  /**
   * 选项配置
   */
  "option": {
    /**
     * 纸张大小
     */
    "paper": "A4",
    /**
     * 纸张方向
     */
    "direction": "portrait",
    /**
     * 分页设置
     */
    "pagination": {
      /**
       * 分页类型
       */
      "type": "inner",
      /**
      * 分页样式
      */
      "style": {
        "color": "grap",
        "fontSize": "12px"
      },
      /**
       * 分页格式
       */
      "formatter": "'第' %current '页 / 共' %total '页'",
      /**
       * 分页位置
       */
      "position": "bottom-center"
    }
  },
  /**
   * 全局样式
   */
  "style": {
    "type": "css",
    "value": {
      ".className": {
        "color": "black"
      },
      "#idName": {
        "backgroundColor": "white"
      },
      "tagName": {
        "border": "1px solid red"
      },
    }
  }, 
  /**
   * 全局页眉
   */
  "header": {
    "style": {
      "type": "inline",
      "value": {
        "color": "#000000",
        "fontSize": "12px",
      }
    },
    "value": "<rich-text>"
  },
  /**
   * 全局页脚
   */
  "footer": {
    "style": {
      "type": "inline",
      "value": {
        "color": "#000000",
        "fontSize": "12px",
      }
    },
    "value": "<rich-text>"
  },
  /**
   * 页面
   */
  "pages": [
    {
      "type": "page",
      "style": {
        "type": "css",
        "value": {
          ".className": {
            "color": "black"
          },
          "#idName": {
            "backgroundColor": "white"
          },
          "tagName": {
            "border": "1px solid red"
          },
        }
      },
      "layout": [
        {
          "type": "title",
          "value": {
            "style": {
              "type": "inline",
              "value": {
                "color": "#000000",
                "fontSize": "12px",
              }
            },
            "value": "<rich-text>"
          }
        }
        // header 页眉
        // title  标题
        // description 描述
        // answer 答案
        // question 问题
        // blank 空白
        // ...
        // footer 页脚
      ]
    }
  ]

}

渲染示例