@wagger-components/cta-panel 0.0.0-stage → 1.0.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/component.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "段落 CTA 容器",
3
+ "category": "cta",
4
+ "description": "展示 role 为 cta 且仅含段落的完整内容分组;React 实现按 blocks 原顺序调用固定段落组件,保留文字与强调,不开放子节点替换。段落数量和文案职能由账号规则约束。",
5
+ "guidance": {
6
+ "appearance": "为 CTA 提供统一的外层留白,内部段落使用 regular 间距;外层 spacing 不覆盖段落参数。",
7
+ "suitable_for": [
8
+ "仅含段落的 CTA 分组,包括当前账号的关注、点赞、转发、评论四段内容。"
9
+ ],
10
+ "avoid_when": [
11
+ "输入含标题、列表或引用;应在规划时改为按块安排已有组件,不选用本容器。",
12
+ "不符合账号 CTA 文案规则的输入,不能靠排版补写或修复。",
13
+ "需要由容器自动添加 END;END 仍由账号排版配置安排。"
14
+ ]
15
+ },
16
+ "input_schema": {
17
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
18
+ "allOf": [
19
+ {
20
+ "$ref": "urn:article-generator:article-doc:draft-1#/$defs/canonicalSection"
21
+ },
22
+ {
23
+ "properties": {
24
+ "role": {
25
+ "const": "cta"
26
+ },
27
+ "blocks": {
28
+ "$ref": "urn:article-generator:article-doc:draft-1#/$defs/paragraphSequence"
29
+ }
30
+ },
31
+ "required": [
32
+ "role"
33
+ ]
34
+ }
35
+ ]
36
+ },
37
+ "props_schema": {
38
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
39
+ "type": "object",
40
+ "additionalProperties": false,
41
+ "properties": {
42
+ "spacing": {
43
+ "description": "CTA 容器周围的留白档位,不覆盖子组件参数。不填写时使用 regular;具体尺寸留给 Theme。",
44
+ "type": "string",
45
+ "oneOf": [
46
+ {
47
+ "const": "regular",
48
+ "description": "使用常规的容器外部留白。"
49
+ },
50
+ {
51
+ "const": "generous",
52
+ "description": "使用更宽松的容器外部留白。"
53
+ }
54
+ ],
55
+ "default": "regular",
56
+ "examples": [
57
+ "regular",
58
+ "generous"
59
+ ],
60
+ "x-param-role": "style"
61
+ }
62
+ }
63
+ },
64
+ "theme_schema": {
65
+ "$ref": "urn:article-generator:theme-visual-values:draft-1"
66
+ }
67
+ }
@@ -0,0 +1,60 @@
1
+ export type Input = Section & {
2
+ role: "cta";
3
+ blocks?: ParagraphSequence;
4
+ };
5
+ /**
6
+ * @minItems 1
7
+ */
8
+ export type BlockSequence = [Heading | Paragraph | List | Quote, ...(Heading | Paragraph | List | Quote)[]];
9
+ /**
10
+ * @minItems 1
11
+ */
12
+ export type ParagraphSequence = [Paragraph, ...Paragraph[]];
13
+ export interface Section {
14
+ id?: string;
15
+ role: "opening" | "body" | "closing" | "cta";
16
+ blocks: BlockSequence;
17
+ }
18
+ export interface Heading {
19
+ id?: string;
20
+ type: "heading";
21
+ level: 2 | 3;
22
+ text: string;
23
+ }
24
+ export interface Paragraph {
25
+ id?: string;
26
+ type: "paragraph";
27
+ /**
28
+ * @minItems 1
29
+ */
30
+ inlines: [InlineText, ...InlineText[]];
31
+ }
32
+ export interface InlineText {
33
+ text: string;
34
+ marks?: "strong"[];
35
+ }
36
+ export interface List {
37
+ id?: string;
38
+ type: "list";
39
+ ordered: boolean;
40
+ start?: number;
41
+ /**
42
+ * @minItems 1
43
+ */
44
+ items: [ListItem, ...ListItem[]];
45
+ }
46
+ export interface ListItem {
47
+ id?: string;
48
+ blocks: ParagraphSequence;
49
+ }
50
+ export interface Quote {
51
+ id?: string;
52
+ type: "quote";
53
+ blocks: ParagraphSequence;
54
+ }
55
+ export interface Props {
56
+ /**
57
+ * CTA 容器周围的留白档位,不覆盖子组件参数。不填写时使用 regular;具体尺寸留给 Theme。
58
+ */
59
+ spacing?: ("regular" | "generous") & string;
60
+ }
@@ -0,0 +1,2 @@
1
+ /* Generated from node 1 JSON Schema; do not edit. */
2
+ export {};
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { Input, Props } from './generated.js';
3
+ export default function CTA({ input, ...provided }: Props & {
4
+ input: Input;
5
+ }): React.JSX.Element;
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Paragraph from '@wagger-components/paragraph-base';
3
+ import { useTheme, applyDefaults } from '@wagger-components/runtime';
4
+ import definition from '../component.json' with { type: 'json' };
5
+ export default function CTA({ input, ...provided }) { const t = useTheme(); const props = applyDefaults(definition.props_schema, provided); return _jsx("section", { style: { marginTop: t.spacing[props.spacing === 'generous' ? 'relaxed_px' : 'regular_px'] }, children: input.blocks.map(block => { if (block.type !== "paragraph")
6
+ throw Error("CTA_PARAGRAPHS_ONLY"); return _jsx(Paragraph, { input: block, spacing: "regular" }, block.id); }) }); }
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "@wagger-components/cta-panel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "default": "./dist/index.js"
9
+ },
10
+ "./component.json": "./component.json",
11
+ "./package.json": "./package.json"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "component.json",
16
+ "package.json"
17
+ ],
18
+ "peerDependencies": {
19
+ "react": "19.3.1",
20
+ "@wagger-components/runtime": "1.0.0"
21
+ },
22
+ "dependencies": {
23
+ "@wagger-components/paragraph-base": "1.0.0"
24
+ },
25
+ "license": "UNLICENSED"
26
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.