@slidejs/context 0.0.1 → 0.1.2

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 ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 slidejs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,130 @@
1
- /**
2
- * @slidejs/context
3
- *
4
- * Slide DSL Context 接口定义
5
- */
6
- export type { SlideContext, SlideMetadata, ContentItem, ContentGroup, ContextAdapter, } from './types';
7
- //# sourceMappingURL=index.d.ts.map
1
+ /**
2
+ * 内容分组/章节
3
+ */
4
+ export declare interface ContentGroup {
5
+ /** 分组 ID */
6
+ id: string;
7
+ /** 分组标题 */
8
+ title: string;
9
+ /** 分组描述 */
10
+ description?: string;
11
+ /** 分组内的内容项 */
12
+ items: ContentItem[];
13
+ /** 元数据 */
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+
17
+ /**
18
+ * 内容项接口(通用抽象)
19
+ * 表示演示文稿中的一个内容单元
20
+ */
21
+ export declare interface ContentItem {
22
+ /**
23
+ * 唯一标识
24
+ */
25
+ id: string;
26
+ /**
27
+ * 内容类型(由数据源定义)
28
+ * @example 'question', 'survey-item', 'form-field', 'content-block'
29
+ */
30
+ type: string;
31
+ /**
32
+ * 显示文本(主要内容)
33
+ */
34
+ text: string;
35
+ /**
36
+ * 标题(可选)
37
+ */
38
+ title?: string;
39
+ /**
40
+ * 元数据
41
+ */
42
+ metadata?: {
43
+ /** 标签 */
44
+ tags?: string[];
45
+ /** 难度(如果适用) */
46
+ difficulty?: string;
47
+ /** 其他元数据 */
48
+ [key: string]: unknown;
49
+ };
50
+ /**
51
+ * 数据源特定的数据
52
+ * 用于传递类型特定的信息(如选项、正确答案等)
53
+ */
54
+ data?: Record<string, unknown>;
55
+ }
56
+
57
+ /**
58
+ * Context 适配器接口
59
+ * 数据源需要实现此接口,将自己的 DSL 转换为 SlideContext
60
+ */
61
+ export declare interface ContextAdapter<TSource = unknown> {
62
+ /**
63
+ * 数据源类型标识符
64
+ */
65
+ readonly sourceType: string;
66
+ /**
67
+ * 转换函数:将数据源 DSL 转换为 SlideContext
68
+ */
69
+ transform(source: TSource): SlideContext;
70
+ }
71
+
72
+ /**
73
+ * @slidejs/context - Slide DSL Context 接口定义
74
+ *
75
+ * 定义所有数据源(quiz、survey、form 等)必须实现的通用接口
76
+ */
77
+ /**
78
+ * Slide DSL 通用 Context 接口
79
+ * 所有数据源(quiz、survey、form 等)都必须提供此接口的实现
80
+ */
81
+ export declare interface SlideContext {
82
+ /**
83
+ * 数据源类型标识符
84
+ * @example 'quiz', 'survey', 'form', 'assessment'
85
+ */
86
+ sourceType: string;
87
+ /**
88
+ * 数据源唯一标识
89
+ */
90
+ sourceId: string;
91
+ /**
92
+ * 元数据(标题、描述等)
93
+ */
94
+ metadata: SlideMetadata;
95
+ /**
96
+ * 内容项集合
97
+ * 核心抽象 - 所有数据源都提供"内容项"的概念
98
+ */
99
+ items: ContentItem[];
100
+ /**
101
+ * 分组/章节(可选)
102
+ * 用于组织 items 的层级结构
103
+ */
104
+ groups?: ContentGroup[];
105
+ /**
106
+ * 自定义属性
107
+ * 数据源特定的扩展属性,供 Slide DSL 规则使用
108
+ */
109
+ custom?: Record<string, unknown>;
110
+ }
111
+
112
+ /**
113
+ * Slide 元数据
114
+ */
115
+ export declare interface SlideMetadata {
116
+ /** 标题 */
117
+ title: string;
118
+ /** 描述 */
119
+ description?: string;
120
+ /** 作者 */
121
+ author?: string;
122
+ /** 创建时间 */
123
+ createdAt?: string;
124
+ /** 标签 */
125
+ tags?: string[];
126
+ /** 其他元数据 */
127
+ [key: string]: unknown;
128
+ }
129
+
130
+ export { }
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,25 +1,21 @@
1
1
  {
2
2
  "name": "@slidejs/context",
3
- "version": "0.0.1",
3
+ "version": "0.1.2",
4
4
  "description": "Slide DSL Context 接口定义",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.cjs"
13
14
  }
14
15
  },
15
16
  "files": [
16
17
  "dist"
17
18
  ],
18
- "scripts": {
19
- "build": "vite build",
20
- "typecheck": "tsc --noEmit",
21
- "clean": "rm -rf dist"
22
- },
23
19
  "keywords": [
24
20
  "slide",
25
21
  "dsl",
@@ -28,9 +24,17 @@
28
24
  ],
29
25
  "author": "",
30
26
  "license": "MIT",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
31
30
  "devDependencies": {
32
31
  "typescript": "^5.3.3",
33
32
  "vite": "^5.0.0",
34
33
  "vite-plugin-dts": "^3.0.0"
34
+ },
35
+ "scripts": {
36
+ "build": "vite build",
37
+ "typecheck": "tsc --noEmit",
38
+ "clean": "rm -rf dist"
35
39
  }
36
- }
40
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC"}
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/dist/types.d.ts DELETED
@@ -1,125 +0,0 @@
1
- /**
2
- * @slidejs/context - Slide DSL Context 接口定义
3
- *
4
- * 定义所有数据源(quiz、survey、form 等)必须实现的通用接口
5
- */
6
- /**
7
- * Slide DSL 通用 Context 接口
8
- * 所有数据源(quiz、survey、form 等)都必须提供此接口的实现
9
- */
10
- export interface SlideContext {
11
- /**
12
- * 数据源类型标识符
13
- * @example 'quiz', 'survey', 'form', 'assessment'
14
- */
15
- sourceType: string;
16
- /**
17
- * 数据源唯一标识
18
- */
19
- sourceId: string;
20
- /**
21
- * 元数据(标题、描述等)
22
- */
23
- metadata: SlideMetadata;
24
- /**
25
- * 内容项集合
26
- * 核心抽象 - 所有数据源都提供"内容项"的概念
27
- */
28
- items: ContentItem[];
29
- /**
30
- * 分组/章节(可选)
31
- * 用于组织 items 的层级结构
32
- */
33
- groups?: ContentGroup[];
34
- /**
35
- * 自定义属性
36
- * 数据源特定的扩展属性,供 Slide DSL 规则使用
37
- */
38
- custom?: Record<string, unknown>;
39
- }
40
- /**
41
- * Slide 元数据
42
- */
43
- export interface SlideMetadata {
44
- /** 标题 */
45
- title: string;
46
- /** 描述 */
47
- description?: string;
48
- /** 作者 */
49
- author?: string;
50
- /** 创建时间 */
51
- createdAt?: string;
52
- /** 标签 */
53
- tags?: string[];
54
- /** 其他元数据 */
55
- [key: string]: unknown;
56
- }
57
- /**
58
- * 内容项接口(通用抽象)
59
- * 表示演示文稿中的一个内容单元
60
- */
61
- export interface ContentItem {
62
- /**
63
- * 唯一标识
64
- */
65
- id: string;
66
- /**
67
- * 内容类型(由数据源定义)
68
- * @example 'question', 'survey-item', 'form-field', 'content-block'
69
- */
70
- type: string;
71
- /**
72
- * 显示文本(主要内容)
73
- */
74
- text: string;
75
- /**
76
- * 标题(可选)
77
- */
78
- title?: string;
79
- /**
80
- * 元数据
81
- */
82
- metadata?: {
83
- /** 标签 */
84
- tags?: string[];
85
- /** 难度(如果适用) */
86
- difficulty?: string;
87
- /** 其他元数据 */
88
- [key: string]: unknown;
89
- };
90
- /**
91
- * 数据源特定的数据
92
- * 用于传递类型特定的信息(如选项、正确答案等)
93
- */
94
- data?: Record<string, unknown>;
95
- }
96
- /**
97
- * 内容分组/章节
98
- */
99
- export interface ContentGroup {
100
- /** 分组 ID */
101
- id: string;
102
- /** 分组标题 */
103
- title: string;
104
- /** 分组描述 */
105
- description?: string;
106
- /** 分组内的内容项 */
107
- items: ContentItem[];
108
- /** 元数据 */
109
- metadata?: Record<string, unknown>;
110
- }
111
- /**
112
- * Context 适配器接口
113
- * 数据源需要实现此接口,将自己的 DSL 转换为 SlideContext
114
- */
115
- export interface ContextAdapter<TSource = unknown> {
116
- /**
117
- * 数据源类型标识符
118
- */
119
- readonly sourceType: string;
120
- /**
121
- * 转换函数:将数据源 DSL 转换为 SlideContext
122
- */
123
- transform(source: TSource): SlideContext;
124
- }
125
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,KAAK,EAAE,WAAW,EAAE,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS;IACT,KAAK,EAAE,MAAM,CAAC;IACd,SAAS;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS;IACT,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS;IACT,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,SAAS;QACT,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,eAAe;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY;QACZ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IAEF;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,YAAY;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc;IACd,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,UAAU;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO,GAAG,OAAO;IAC/C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAAC;CAC1C"}