@realnation/content-config 0.6.2 → 0.7.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.
- package/README.md +1 -0
- package/package.json +50 -50
- package/src/canvas.d.ts +2 -0
- package/src/canvas.mjs +3 -1
package/README.md
CHANGED
|
@@ -106,6 +106,7 @@ import { canvasConfig } from '@realnation/content-config/canvas';
|
|
|
106
106
|
- 面板项的类型、默认值、选项、范围不写,以后台登记的 collocation 为准;`properties` 只写模块真读的属性的英文说明(宿主统一套在外框上的位置、大小、颜色、字体不列),`ignores` 列面板上有、模块不读的。
|
|
107
107
|
- `layout`、`layoutVariants`、`key` 都从模块代码 import 同一份常量(如 placeholders.ts),不抄数字。按配置里的列表一条推一个的元件(如 Video Player 每个叠加位一个),`key` 写模板 `vp-slot-{n}`(`{n}` 是模块编的序号数字,多数从 1 起,有的从 0 起,在 appearsWhen 写明),核对时查 `{n}` 前面那一截。`layout` 0.6.0 起可选:位置写在模块代码里的(模块自己会挪元件)才写;只登记在平台(collocation 的 values)的不写,默认位置以登记为准,不抄一份进来。推送元件的 key、componentName 与 `module` 要在构建用到的源码里原样找得到(另加 `src/page-events.ts`),对不上构建失败。
|
|
108
108
|
- `constraints` 只写模块自己的摆放规矩:`aspect`、`minWidth`、`minHeight`、`anchorsTo`(压在谁的正中)、`overlapAllowed`、`face`(盒子里真正画东西的是贴着远离某条边的正方形,如转盘的圆,`anchorsTo` 对准它的中心,`aspect` 在那条边为左右时宽高对调)。不出屏、不压角标这类平台规矩不写在这里。
|
|
109
|
+
- `control`(0.7.0 起,可选):访客要按、要点、要靠它操作的元件写 `control: true`(左右箭头、Spin、开始、提交、点哪都算的游戏区)。建活动引擎据此不许 AI 未经用户点名拿掉、隐藏、盖住它(引擎规矩 24)。不写时引擎按出厂版面带不带键码 `key-code` 认;带键码但不算操作的写 `false`。
|
|
109
110
|
- 说明文字一律英文。完整样例:体验仓 qiksense-lottery-spin-and-win-experience 的 `src/canvas-config.ts`。
|
|
110
111
|
|
|
111
112
|
## 其他用法
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@realnation/content-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "qiksense 模块内容配置的机器可读说明:构建时导出 content-config.json,并用字段说明校验默认请求体;0.5.0 起另导出画布说明 canvas-config.json(体验端)",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"types": "./src/index.d.ts",
|
|
9
|
-
"import": "./src/index.mjs"
|
|
10
|
-
},
|
|
11
|
-
"./validate": {
|
|
12
|
-
"types": "./src/validate.d.ts",
|
|
13
|
-
"import": "./src/validate.mjs"
|
|
14
|
-
},
|
|
15
|
-
"./exits": {
|
|
16
|
-
"types": "./src/exits.d.ts",
|
|
17
|
-
"import": "./src/exits.mjs"
|
|
18
|
-
},
|
|
19
|
-
"./canvas": {
|
|
20
|
-
"types": "./src/canvas.d.ts",
|
|
21
|
-
"import": "./src/canvas.mjs"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"files": [
|
|
25
|
-
"src",
|
|
26
|
-
"README.md"
|
|
27
|
-
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"test": "node --test \"test/*.test.mjs\""
|
|
30
|
-
},
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"esbuild": ">=0.19",
|
|
33
|
-
"vite": ">=5"
|
|
34
|
-
},
|
|
35
|
-
"peerDependenciesMeta": {
|
|
36
|
-
"esbuild": {
|
|
37
|
-
"optional": true
|
|
38
|
-
},
|
|
39
|
-
"vite": {
|
|
40
|
-
"optional": true
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=18"
|
|
45
|
-
},
|
|
46
|
-
"publishConfig": {
|
|
47
|
-
"access": "public"
|
|
48
|
-
},
|
|
49
|
-
"license": "UNLICENSED"
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@realnation/content-config",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "qiksense 模块内容配置的机器可读说明:构建时导出 content-config.json,并用字段说明校验默认请求体;0.5.0 起另导出画布说明 canvas-config.json(体验端)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
9
|
+
"import": "./src/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"./validate": {
|
|
12
|
+
"types": "./src/validate.d.ts",
|
|
13
|
+
"import": "./src/validate.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./exits": {
|
|
16
|
+
"types": "./src/exits.d.ts",
|
|
17
|
+
"import": "./src/exits.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./canvas": {
|
|
20
|
+
"types": "./src/canvas.d.ts",
|
|
21
|
+
"import": "./src/canvas.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "node --test \"test/*.test.mjs\""
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"esbuild": ">=0.19",
|
|
33
|
+
"vite": ">=5"
|
|
34
|
+
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"esbuild": {
|
|
37
|
+
"optional": true
|
|
38
|
+
},
|
|
39
|
+
"vite": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"license": "UNLICENSED"
|
|
50
|
+
}
|
package/src/canvas.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface CanvasElement {
|
|
|
20
20
|
tab: string;
|
|
21
21
|
/** pushed 必填:page-data 里的 type,平台元件类型(共用 SDK 的 EditorType:按钮 image-text、热区 button、平台拼写 compnent),另加图片变体 image-ratio、image-clip、image-ratio-clip */
|
|
22
22
|
type?: string;
|
|
23
|
+
/** 0.7.0 起:访客要按、要点、要靠它操作的元件(左右箭头、Spin、开始、提交、点哪都算的游戏区)写 true;建活动引擎不许 AI 未经用户点名拿掉、隐藏或盖住它(规矩 24)。不写就按出厂版面带不带键码 key-code 认,写 false 表示带键码但不算 */
|
|
24
|
+
control?: boolean;
|
|
23
25
|
/** 英文,给 AI:访客看到什么、模块拿它做什么、运营通常怎么改 */
|
|
24
26
|
description: string;
|
|
25
27
|
/** pushed 必填,英文:什么配置下才推 */
|
package/src/canvas.mjs
CHANGED
|
@@ -25,7 +25,7 @@ const PUSHED_TYPES = new Set([
|
|
|
25
25
|
'progress', 'sound-toggle', 'motion-preview', 'cursor-area', 'evoucher-pin', 'evoucher-submit',
|
|
26
26
|
'image-ratio', 'image-clip', 'image-ratio-clip',
|
|
27
27
|
])
|
|
28
|
-
const ELEMENT_KEYS = new Set(['kind', 'key', 'tab', 'type', 'description', 'appearsWhen', 'when', 'layout', 'layoutVariants', 'styleFrom', 'properties', 'ignores', 'assets', 'constraints'])
|
|
28
|
+
const ELEMENT_KEYS = new Set(['kind', 'key', 'tab', 'type', 'description', 'appearsWhen', 'when', 'layout', 'layoutVariants', 'styleFrom', 'properties', 'ignores', 'assets', 'constraints', 'control'])
|
|
29
29
|
const BOX_KEYS = ['x-position', 'y-position', 'width', 'height']
|
|
30
30
|
const ASSET_SOURCES = new Set(['from config', 'operator', 'none'])
|
|
31
31
|
const ANCHOR_AT = new Set(['center', 'top', 'bottom', 'left', 'right'])
|
|
@@ -95,6 +95,8 @@ export function validateCanvasConfig(spec) {
|
|
|
95
95
|
if (el.appearsWhen !== undefined || el.when !== undefined) errors.push(`${w}:系统元件新建节点就有,不写 appearsWhen、when`)
|
|
96
96
|
}
|
|
97
97
|
if (el.when !== undefined) checkWhen(errors, `${w}.when`, el.when)
|
|
98
|
+
// 0.7.0 起:访客要按、要点、要靠它操作的元件(箭头、开始、提交、点哪都算的游戏区)写 control: true,建活动引擎不许 AI 未经用户点名拿掉、隐藏、盖住(规矩 24)
|
|
99
|
+
if (el.control !== undefined && typeof el.control !== 'boolean') errors.push(`${w}.control:写 true(操作元件)或 false,不写就按出厂版面带不带键码认`)
|
|
98
100
|
// 0.6.0 起可选:位置写在模块代码里的(模块自己挪元件,如 Spin and Win)照写;只登记在平台的不写,以登记为准
|
|
99
101
|
if (el.layout !== undefined) {
|
|
100
102
|
if (!isObj(el.layout)) errors.push(`${w}.layout:写两档默认版面 { v: {…}, h: {…} },位置只登记在平台的就不写`)
|