@refrakt-md/storytelling 0.8.5 → 0.9.1
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/dist/config.d.ts.map +1 -1
- package/dist/config.js +54 -12
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline.d.ts +18 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +242 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/tags/bond.d.ts.map +1 -1
- package/dist/tags/bond.js +1 -2
- package/dist/tags/bond.js.map +1 -1
- package/dist/tags/character.d.ts.map +1 -1
- package/dist/tags/character.js +40 -71
- package/dist/tags/character.js.map +1 -1
- package/dist/tags/common.d.ts +29 -0
- package/dist/tags/common.d.ts.map +1 -0
- package/dist/tags/common.js +59 -0
- package/dist/tags/common.js.map +1 -0
- package/dist/tags/faction.d.ts.map +1 -1
- package/dist/tags/faction.js +30 -93
- package/dist/tags/faction.js.map +1 -1
- package/dist/tags/lore.d.ts.map +1 -1
- package/dist/tags/lore.js +1 -2
- package/dist/tags/lore.js.map +1 -1
- package/dist/tags/plot.d.ts.map +1 -1
- package/dist/tags/plot.js +28 -58
- package/dist/tags/plot.js.map +1 -1
- package/dist/tags/realm.d.ts.map +1 -1
- package/dist/tags/realm.js +32 -97
- package/dist/tags/realm.js.map +1 -1
- package/dist/tags/storyboard.d.ts.map +1 -1
- package/dist/tags/storyboard.js +14 -10
- package/dist/tags/storyboard.js.map +1 -1
- package/package.json +4 -4
- package/dist/schema/bond.d.ts +0 -8
- package/dist/schema/bond.d.ts.map +0 -1
- package/dist/schema/bond.js +0 -10
- package/dist/schema/bond.js.map +0 -1
- package/dist/schema/character.d.ts +0 -10
- package/dist/schema/character.d.ts.map +0 -1
- package/dist/schema/character.js +0 -11
- package/dist/schema/character.js.map +0 -1
- package/dist/schema/faction.d.ts +0 -10
- package/dist/schema/faction.d.ts.map +0 -1
- package/dist/schema/faction.js +0 -11
- package/dist/schema/faction.js.map +0 -1
- package/dist/schema/lore.d.ts +0 -7
- package/dist/schema/lore.d.ts.map +0 -1
- package/dist/schema/lore.js +0 -9
- package/dist/schema/lore.js.map +0 -1
- package/dist/schema/plot.d.ts +0 -15
- package/dist/schema/plot.d.ts.map +0 -1
- package/dist/schema/plot.js +0 -19
- package/dist/schema/plot.js.map +0 -1
- package/dist/schema/realm.d.ts +0 -10
- package/dist/schema/realm.d.ts.map +0 -1
- package/dist/schema/realm.js +0 -11
- package/dist/schema/realm.js.map +0 -1
- package/dist/schema/story-section.d.ts +0 -4
- package/dist/schema/story-section.d.ts.map +0 -1
- package/dist/schema/story-section.js +0 -6
- package/dist/schema/story-section.js.map +0 -1
- package/dist/schema/storyboard.d.ts +0 -8
- package/dist/schema/storyboard.d.ts.map +0 -1
- package/dist/schema/storyboard.js +0 -10
- package/dist/schema/storyboard.js.map +0 -1
- package/dist/types.d.ts +0 -23
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -24
- package/dist/types.js.map +0 -1
package/dist/tags/character.js
CHANGED
|
@@ -1,38 +1,28 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
1
|
import Markdoc from '@markdoc/markdoc';
|
|
11
2
|
const { Tag } = Markdoc;
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, asNodes, RenderableNodeCursor } from '@refrakt-md/runes';
|
|
4
|
+
export const characterSection = createContentModelSchema({
|
|
5
|
+
attributes: {
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
},
|
|
8
|
+
contentModel: {
|
|
9
|
+
type: 'sequence',
|
|
10
|
+
fields: [
|
|
11
|
+
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
transform(resolved, attrs, config) {
|
|
15
|
+
const nameTag = new Tag('span', {}, [attrs.name ?? '']);
|
|
16
|
+
const body = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config)).wrap('div');
|
|
17
|
+
return createComponentRenderable({ rune: 'character-section',
|
|
23
18
|
tag: 'div',
|
|
24
19
|
refs: { name: nameTag, body: body.tag('div') },
|
|
25
20
|
children: [nameTag, body.next()],
|
|
26
21
|
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
__decorate([
|
|
30
|
-
attribute({ type: String, required: true }),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], StorySectionModel.prototype, "name", void 0);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
33
24
|
const roleType = ['protagonist', 'antagonist', 'supporting', 'minor'];
|
|
34
25
|
const statusType = ['alive', 'dead', 'unknown', 'missing'];
|
|
35
|
-
export const characterSection = createSchema(StorySectionModel);
|
|
36
26
|
export const character = createContentModelSchema({
|
|
37
27
|
attributes: {
|
|
38
28
|
name: { type: String, required: true, description: 'Display name shown in the character header.' },
|
|
@@ -72,56 +62,35 @@ export const character = createContentModelSchema({
|
|
|
72
62
|
const portraitDiv = hasPortrait ? portrait.wrap('div') : undefined;
|
|
73
63
|
const sections = sectionNodes.tag('div').typeof('CharacterSection');
|
|
74
64
|
const hasSections = sections.count() > 0;
|
|
75
|
-
|
|
65
|
+
// Portrait before name so the image appears between header and title in stacked layout.
|
|
66
|
+
const children = [];
|
|
76
67
|
if (portraitDiv)
|
|
77
68
|
children.push(portraitDiv.next());
|
|
69
|
+
children.push(nameTag, roleMeta, statusMeta, aliasesMeta, tagsMeta);
|
|
78
70
|
const schemaMap = {
|
|
79
71
|
name: nameTag,
|
|
80
72
|
jobTitle: roleMeta,
|
|
81
73
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const body = sectionNodes.wrap('div');
|
|
106
|
-
children.push(body.next());
|
|
107
|
-
return createComponentRenderable(schema.Character, {
|
|
108
|
-
tag: 'article',
|
|
109
|
-
property: 'contentSection',
|
|
110
|
-
properties: {
|
|
111
|
-
role: roleMeta,
|
|
112
|
-
status: statusMeta,
|
|
113
|
-
aliases: aliasesMeta,
|
|
114
|
-
tags: tagsMeta,
|
|
115
|
-
},
|
|
116
|
-
refs: {
|
|
117
|
-
name: nameTag,
|
|
118
|
-
...(portraitDiv ? { portrait: portraitDiv } : {}),
|
|
119
|
-
body,
|
|
120
|
-
},
|
|
121
|
-
schema: schemaMap,
|
|
122
|
-
children,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
74
|
+
const sectionsContainer = hasSections ? sections.wrap('div') : undefined;
|
|
75
|
+
const body = !hasSections ? sectionNodes.wrap('div') : undefined;
|
|
76
|
+
children.push(hasSections ? sectionsContainer.next() : body.next());
|
|
77
|
+
return createComponentRenderable({ rune: 'character', schemaOrgType: 'Person',
|
|
78
|
+
tag: 'article',
|
|
79
|
+
property: 'contentSection',
|
|
80
|
+
properties: {
|
|
81
|
+
role: roleMeta,
|
|
82
|
+
status: statusMeta,
|
|
83
|
+
aliases: aliasesMeta,
|
|
84
|
+
tags: tagsMeta,
|
|
85
|
+
...(hasSections ? { section: sections } : {}),
|
|
86
|
+
},
|
|
87
|
+
refs: {
|
|
88
|
+
name: nameTag,
|
|
89
|
+
...(portraitDiv ? { portrait: portraitDiv } : {}),
|
|
90
|
+
...(hasSections ? { sections: sectionsContainer } : { body: body }),
|
|
91
|
+
},
|
|
92
|
+
schema: schemaMap,
|
|
93
|
+
children, });
|
|
125
94
|
},
|
|
126
95
|
});
|
|
127
96
|
//# sourceMappingURL=character.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character.js","sourceRoot":"","sources":["../../src/tags/character.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"character.js","sourceRoot":"","sources":["../../src/tags/character.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEvH,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;IACxD,UAAU,EAAE;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KACtC;IACD,YAAY,EAAE;QACb,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACP,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;SAC5D;KACD;IACD,SAAS,CAAC,QAAQ,E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,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAK,EAAE,CAAC;aACrE;YACD,MAAM,EAAE,SAAS;YACjB,QAAQ,GACR,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
import type { RenderableTreeNode } from '@markdoc/markdoc';
|
|
3
|
+
import { RenderableNodeCursor } from '@refrakt-md/runes';
|
|
4
|
+
/**
|
|
5
|
+
* Shared scene-image extraction for storytelling runes (realm, faction).
|
|
6
|
+
*
|
|
7
|
+
* Takes the resolved `scene` field, transforms it, and returns either:
|
|
8
|
+
* - A media div wrapping the extracted `<img>` tag (if the scene was an image)
|
|
9
|
+
* - Extra description nodes (if the scene was text, not an image)
|
|
10
|
+
*
|
|
11
|
+
* Also returns the raw `<img>` tag for SEO schema use.
|
|
12
|
+
*/
|
|
13
|
+
export declare function extractScene(sceneResolved: unknown, config: Record<string, any>): {
|
|
14
|
+
sceneDiv: RenderableNodeCursor<Markdoc.Tag> | undefined;
|
|
15
|
+
sceneImgTag: Markdoc.Tag | undefined;
|
|
16
|
+
extraDescription: RenderableTreeNode[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Shared content assembly for storytelling runes with sections (realm, faction).
|
|
20
|
+
*
|
|
21
|
+
* Takes the extra description nodes, resolved description field, section cursor,
|
|
22
|
+
* and section type name, and returns a wrapped content div.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildStoryContent(extraDescription: RenderableTreeNode[], descriptionResolved: unknown, sectionNodes: RenderableNodeCursor, sectionTypeName: string, config: Record<string, any>): {
|
|
25
|
+
mainContent: RenderableNodeCursor<Markdoc.Tag>;
|
|
26
|
+
sections: RenderableNodeCursor<Markdoc.Tag>;
|
|
27
|
+
hasSections: boolean;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/tags/common.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAW,oBAAoB,EAAqB,MAAM,mBAAmB,CAAC;AAErF;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB;IACF,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IACxD,WAAW,EAAE,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IACrC,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CACvC,CAmBA;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAChC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,mBAAmB,EAAE,OAAO,EAC5B,YAAY,EAAE,oBAAoB,EAClC,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB;IACF,WAAW,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/C,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5C,WAAW,EAAE,OAAO,CAAC;CACrB,CA8BA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Markdoc from '@markdoc/markdoc';
|
|
2
|
+
const { Tag } = Markdoc;
|
|
3
|
+
import { asNodes, RenderableNodeCursor, extractMediaImage } from '@refrakt-md/runes';
|
|
4
|
+
/**
|
|
5
|
+
* Shared scene-image extraction for storytelling runes (realm, faction).
|
|
6
|
+
*
|
|
7
|
+
* Takes the resolved `scene` field, transforms it, and returns either:
|
|
8
|
+
* - A media div wrapping the extracted `<img>` tag (if the scene was an image)
|
|
9
|
+
* - Extra description nodes (if the scene was text, not an image)
|
|
10
|
+
*
|
|
11
|
+
* Also returns the raw `<img>` tag for SEO schema use.
|
|
12
|
+
*/
|
|
13
|
+
export function extractScene(sceneResolved, config) {
|
|
14
|
+
const sceneAstNodes = asNodes(sceneResolved);
|
|
15
|
+
const sceneRendered = new RenderableNodeCursor(Markdoc.transform(sceneAstNodes, config));
|
|
16
|
+
const sceneImgTag = extractMediaImage(sceneRendered);
|
|
17
|
+
let sceneDiv;
|
|
18
|
+
let extraDescription = [];
|
|
19
|
+
if (sceneImgTag) {
|
|
20
|
+
sceneDiv = new RenderableNodeCursor([sceneImgTag]).wrap('div');
|
|
21
|
+
}
|
|
22
|
+
else if (sceneRendered.count() > 0) {
|
|
23
|
+
// First paragraph was text, not an image — include as description
|
|
24
|
+
extraDescription = sceneRendered.toArray();
|
|
25
|
+
}
|
|
26
|
+
return { sceneDiv, sceneImgTag, extraDescription };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Shared content assembly for storytelling runes with sections (realm, faction).
|
|
30
|
+
*
|
|
31
|
+
* Takes the extra description nodes, resolved description field, section cursor,
|
|
32
|
+
* and section type name, and returns a wrapped content div.
|
|
33
|
+
*/
|
|
34
|
+
export function buildStoryContent(extraDescription, descriptionResolved, sectionNodes, sectionTypeName, config) {
|
|
35
|
+
// Transform description paragraphs
|
|
36
|
+
const descAstNodes = asNodes(descriptionResolved);
|
|
37
|
+
const descRendered = new RenderableNodeCursor(Markdoc.transform(descAstNodes, config));
|
|
38
|
+
const sections = sectionNodes.tag('div').typeof(sectionTypeName);
|
|
39
|
+
const hasSections = sections.count() > 0;
|
|
40
|
+
// Build content children (everything except scene)
|
|
41
|
+
const contentChildren = [];
|
|
42
|
+
const allDescNodes = [...extraDescription, ...descRendered.toArray()];
|
|
43
|
+
if (allDescNodes.length > 0) {
|
|
44
|
+
contentChildren.push(...allDescNodes);
|
|
45
|
+
}
|
|
46
|
+
if (hasSections) {
|
|
47
|
+
const sectionsContainer = sections.wrap('div');
|
|
48
|
+
contentChildren.push(sectionsContainer.next());
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
const body = sectionNodes.wrap('div');
|
|
52
|
+
if (sectionNodes.count() > 0) {
|
|
53
|
+
contentChildren.push(body.next());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const mainContent = new RenderableNodeCursor(contentChildren).wrap('div');
|
|
57
|
+
return { mainContent, sections, hasSections };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/tags/common.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC3B,aAAsB,EACtB,MAA2B;IAM3B,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,aAAa,GAAG,IAAI,oBAAoB,CAC7C,OAAO,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAyB,CAChE,CAAC;IAEF,MAAM,WAAW,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;IAErD,IAAI,QAAuD,CAAC;IAC5D,IAAI,gBAAgB,GAAyB,EAAE,CAAC;IAEhD,IAAI,WAAW,EAAE,CAAC;QACjB,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAsC,CAAC;IACrG,CAAC;SAAM,IAAI,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;QACtC,kEAAkE;QAClE,gBAAgB,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC;IAC5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AAG,IAAI,oBAAoB,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faction.d.ts","sourceRoot":"","sources":["../../src/tags/faction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"faction.d.ts","sourceRoot":"","sources":["../../src/tags/faction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAMvC,eAAO,MAAM,cAAc,gBAsBzB,CAAC;AAEH,eAAO,MAAM,OAAO,gBA+FlB,CAAC"}
|
package/dist/tags/faction.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
1
|
import Markdoc from '@markdoc/markdoc';
|
|
11
2
|
const { Tag } = Markdoc;
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, asNodes, RenderableNodeCursor, SplitLayoutModel, buildLayoutMetas } from '@refrakt-md/runes';
|
|
4
|
+
import { extractScene, buildStoryContent } from './common.js';
|
|
5
|
+
export const factionSection = createContentModelSchema({
|
|
6
|
+
attributes: {
|
|
7
|
+
name: { type: String, required: true },
|
|
8
|
+
},
|
|
9
|
+
contentModel: {
|
|
10
|
+
type: 'sequence',
|
|
11
|
+
fields: [
|
|
12
|
+
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
transform(resolved, attrs, config) {
|
|
16
|
+
const nameTag = new Tag('span', {}, [attrs.name ?? '']);
|
|
17
|
+
const body = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config)).wrap('div');
|
|
18
|
+
return createComponentRenderable({ rune: 'faction-section',
|
|
23
19
|
tag: 'div',
|
|
24
20
|
refs: { name: nameTag, body: body.tag('div') },
|
|
25
21
|
children: [nameTag, body.next()],
|
|
26
22
|
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
__decorate([
|
|
30
|
-
attribute({ type: String, required: true }),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], FactionSectionModel.prototype, "name", void 0);
|
|
33
|
-
export const factionSection = createSchema(FactionSectionModel);
|
|
23
|
+
},
|
|
24
|
+
});
|
|
34
25
|
export const faction = createContentModelSchema({
|
|
35
26
|
base: SplitLayoutModel,
|
|
36
27
|
attributes: {
|
|
@@ -59,80 +50,26 @@ export const faction = createContentModelSchema({
|
|
|
59
50
|
// Combine explicit child tags (preamble items) with emitted section tags
|
|
60
51
|
const allItems = [...asNodes(resolved.items), ...asNodes(resolved.sections)];
|
|
61
52
|
const sectionNodes = new RenderableNodeCursor(Markdoc.transform(allItems, config));
|
|
53
|
+
// Domain meta tags
|
|
62
54
|
const nameTag = new Tag('span', {}, [attrs.name ?? '']);
|
|
63
55
|
const factionTypeMeta = new Tag('meta', { content: attrs.type ?? '' });
|
|
64
56
|
const alignmentMeta = new Tag('meta', { content: attrs.alignment ?? '' });
|
|
65
57
|
const sizeMeta = new Tag('meta', { content: attrs.size ?? '' });
|
|
66
58
|
const tagsMeta = new Tag('meta', { content: attrs.tags ?? '' });
|
|
67
59
|
// Layout meta tags
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const ratioMeta = layout !== 'stacked' ? new Tag('meta', { content: ratio }) : undefined;
|
|
75
|
-
const valignMeta = layout !== 'stacked' ? new Tag('meta', { content: valign }) : undefined;
|
|
76
|
-
const gapMeta = gap !== 'default' ? new Tag('meta', { content: gap }) : undefined;
|
|
77
|
-
const collapseMeta = collapse ? new Tag('meta', { content: collapse }) : undefined;
|
|
78
|
-
// Extract scene image from the first preamble paragraph
|
|
79
|
-
const sceneAstNodes = asNodes(resolved.scene);
|
|
80
|
-
const sceneRendered = new RenderableNodeCursor(Markdoc.transform(sceneAstNodes, config));
|
|
81
|
-
let sceneImgTag;
|
|
82
|
-
for (const node of sceneRendered.toArray()) {
|
|
83
|
-
if (Markdoc.Tag.isTag(node) && node.name === 'img') {
|
|
84
|
-
sceneImgTag = node;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
if (Markdoc.Tag.isTag(node) && node.name === 'p') {
|
|
88
|
-
const img = node.children.find((c) => Markdoc.Tag.isTag(c) && c.name === 'img');
|
|
89
|
-
if (img) {
|
|
90
|
-
sceneImgTag = img;
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
let sceneDiv;
|
|
96
|
-
let extraDescription = [];
|
|
97
|
-
if (sceneImgTag) {
|
|
98
|
-
sceneDiv = new RenderableNodeCursor([sceneImgTag]).wrap('div');
|
|
99
|
-
}
|
|
100
|
-
else if (sceneRendered.count() > 0) {
|
|
101
|
-
extraDescription = sceneRendered.toArray();
|
|
102
|
-
}
|
|
103
|
-
// Transform description paragraphs
|
|
104
|
-
const descAstNodes = asNodes(resolved.description);
|
|
105
|
-
const descRendered = new RenderableNodeCursor(Markdoc.transform(descAstNodes, config));
|
|
106
|
-
const sections = sectionNodes.tag('div').typeof('FactionSection');
|
|
107
|
-
const hasSections = sections.count() > 0;
|
|
108
|
-
// Build content children (everything except scene)
|
|
109
|
-
const contentChildren = [];
|
|
110
|
-
const allDescNodes = [...extraDescription, ...descRendered.toArray()];
|
|
111
|
-
if (allDescNodes.length > 0) {
|
|
112
|
-
contentChildren.push(...allDescNodes);
|
|
113
|
-
}
|
|
114
|
-
if (hasSections) {
|
|
115
|
-
const sectionsContainer = sections.wrap('div');
|
|
116
|
-
contentChildren.push(sectionsContainer.next());
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const body = sectionNodes.wrap('div');
|
|
120
|
-
if (sectionNodes.count() > 0) {
|
|
121
|
-
contentChildren.push(body.next());
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const mainContent = new RenderableNodeCursor(contentChildren).wrap('div');
|
|
60
|
+
const { metas: layoutMetas, children: layoutChildren } = buildLayoutMetas(attrs);
|
|
61
|
+
const { layout: layoutMeta, ratio: ratioMeta, valign: valignMeta, gap: gapMeta, collapse: collapseMeta } = layoutMetas;
|
|
62
|
+
// Extract scene image (shared helper)
|
|
63
|
+
const { sceneDiv, sceneImgTag, extraDescription } = extractScene(resolved.scene, config);
|
|
64
|
+
// Build content div with sections (shared helper)
|
|
65
|
+
const { mainContent, sections, hasSections } = buildStoryContent(extraDescription, resolved.description, sectionNodes, 'FactionSection', config);
|
|
125
66
|
// Build children array
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
...(ratioMeta ? [ratioMeta] : []),
|
|
130
|
-
...(valignMeta ? [valignMeta] : []),
|
|
131
|
-
...(gapMeta ? [gapMeta] : []),
|
|
132
|
-
...(collapseMeta ? [collapseMeta] : []),
|
|
133
|
-
];
|
|
67
|
+
// Scene before name so the image appears between header and title in stacked layout.
|
|
68
|
+
// In split layouts, CSS grid explicit placement controls the visual order.
|
|
69
|
+
const children = [];
|
|
134
70
|
if (sceneDiv)
|
|
135
71
|
children.push(sceneDiv.next());
|
|
72
|
+
children.push(nameTag, factionTypeMeta, alignmentMeta, sizeMeta, tagsMeta, ...layoutChildren);
|
|
136
73
|
children.push(mainContent.next());
|
|
137
74
|
// SEO schema
|
|
138
75
|
const schemaMap = {
|
|
@@ -141,7 +78,7 @@ export const faction = createContentModelSchema({
|
|
|
141
78
|
if (sceneImgTag) {
|
|
142
79
|
schemaMap.image = sceneImgTag;
|
|
143
80
|
}
|
|
144
|
-
return createComponentRenderable(
|
|
81
|
+
return createComponentRenderable({ rune: 'faction', schemaOrgType: 'Organization',
|
|
145
82
|
tag: 'article',
|
|
146
83
|
property: 'contentSection',
|
|
147
84
|
properties: {
|
package/dist/tags/faction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faction.js","sourceRoot":"","sources":["../../src/tags/faction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"faction.js","sourceRoot":"","sources":["../../src/tags/faction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3J,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC;IACtD,UAAU,EAAE;QACX,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;KACtC;IACD,YAAY,EAAE;QACb,IAAI,EAAE,UAAU;QAChB,MAAM,EAA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Q;SACR,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
package/dist/tags/lore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lore.d.ts","sourceRoot":"","sources":["../../src/tags/lore.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"lore.d.ts","sourceRoot":"","sources":["../../src/tags/lore.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAKvC,eAAO,MAAM,IAAI,gBAyCf,CAAC"}
|
package/dist/tags/lore.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Markdoc from '@markdoc/markdoc';
|
|
2
2
|
const { Tag } = Markdoc;
|
|
3
3
|
import { createContentModelSchema, createComponentRenderable, asNodes, RenderableNodeCursor } from '@refrakt-md/runes';
|
|
4
|
-
import { schema } from '../types.js';
|
|
5
4
|
export const lore = createContentModelSchema({
|
|
6
5
|
attributes: {
|
|
7
6
|
title: { type: String, required: true, description: 'Heading displayed for this lore entry.' },
|
|
@@ -21,7 +20,7 @@ export const lore = createContentModelSchema({
|
|
|
21
20
|
const spoilerMeta = new Tag('meta', { content: String(attrs.spoiler ?? false) });
|
|
22
21
|
const tagsMeta = new Tag('meta', { content: attrs.tags ?? '' });
|
|
23
22
|
const body = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config)).wrap('div');
|
|
24
|
-
return createComponentRenderable(
|
|
23
|
+
return createComponentRenderable({ rune: 'lore', schemaOrgType: 'Article',
|
|
25
24
|
tag: 'article',
|
|
26
25
|
property: 'contentSection',
|
|
27
26
|
properties: {
|
package/dist/tags/lore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lore.js","sourceRoot":"","sources":["../../src/tags/lore.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAEvC,MAAM,EAAE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,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plot.d.ts","sourceRoot":"","sources":["../../src/tags/plot.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAcvC,eAAO,MAAM,IAAI,gBAkDf,CAAC;AAKH,eAAO,MAAM,IAAI,gBAgEf,CAAC"}
|
package/dist/tags/plot.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
1
|
import Markdoc from '@markdoc/markdoc';
|
|
11
2
|
const { Tag } = Markdoc;
|
|
12
|
-
import {
|
|
3
|
+
import { createComponentRenderable, createContentModelSchema, asNodes } from '@refrakt-md/runes';
|
|
13
4
|
import { RenderableNodeCursor } from '@refrakt-md/runes';
|
|
14
|
-
import { schema } from '../types.js';
|
|
15
5
|
// Map marker characters to status strings
|
|
16
6
|
const MARKER_TO_STATUS = {
|
|
17
7
|
'x': 'complete',
|
|
@@ -19,27 +9,32 @@ const MARKER_TO_STATUS = {
|
|
|
19
9
|
' ': 'planned',
|
|
20
10
|
'-': 'abandoned',
|
|
21
11
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
12
|
+
export const beat = createContentModelSchema({
|
|
13
|
+
attributes: {
|
|
14
|
+
label: { type: String, required: true },
|
|
15
|
+
status: { type: String, required: false },
|
|
16
|
+
description: { type: String, required: false },
|
|
17
|
+
id: { type: String, required: false },
|
|
18
|
+
track: { type: String, required: false },
|
|
19
|
+
follows: { type: String, required: false },
|
|
20
|
+
},
|
|
21
|
+
contentModel: {
|
|
22
|
+
type: 'sequence',
|
|
23
|
+
fields: [
|
|
24
|
+
{ name: 'body', match: 'any', optional: true, greedy: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
transform(resolved, attrs, config) {
|
|
28
|
+
const labelTag = new Tag('span', {}, [attrs.label ?? '']);
|
|
34
29
|
// Map raw marker char to status string if needed
|
|
35
|
-
const resolvedStatus = MARKER_TO_STATUS[
|
|
30
|
+
const resolvedStatus = MARKER_TO_STATUS[attrs.status] ?? (attrs.status || 'planned');
|
|
36
31
|
const statusMeta = new Tag('meta', { content: resolvedStatus });
|
|
37
|
-
const idMeta = new Tag('meta', { content:
|
|
38
|
-
const trackMeta = new Tag('meta', { content:
|
|
39
|
-
const followsMeta = new Tag('meta', { content:
|
|
32
|
+
const idMeta = new Tag('meta', { content: attrs.id ?? '' });
|
|
33
|
+
const trackMeta = new Tag('meta', { content: attrs.track ?? '' });
|
|
34
|
+
const followsMeta = new Tag('meta', { content: attrs.follows ?? '' });
|
|
40
35
|
// Build body from description attribute + any block-level children
|
|
41
|
-
const childContent =
|
|
42
|
-
const descText =
|
|
36
|
+
const childContent = new RenderableNodeCursor(Markdoc.transform(asNodes(resolved.body), config));
|
|
37
|
+
const descText = (attrs.description ?? '').replace(/^[\s—–-]+/, '').trim();
|
|
43
38
|
const bodyChildren = [];
|
|
44
39
|
if (descText) {
|
|
45
40
|
bodyChildren.push(new Tag('p', {}, [descText]));
|
|
@@ -48,7 +43,7 @@ class BeatModel extends Model {
|
|
|
48
43
|
bodyChildren.push(...childContent.toArray());
|
|
49
44
|
}
|
|
50
45
|
const body = new RenderableNodeCursor(bodyChildren).wrap('div');
|
|
51
|
-
return createComponentRenderable(
|
|
46
|
+
return createComponentRenderable({ rune: 'beat',
|
|
52
47
|
tag: 'li',
|
|
53
48
|
properties: {
|
|
54
49
|
status: statusMeta,
|
|
@@ -59,35 +54,10 @@ class BeatModel extends Model {
|
|
|
59
54
|
refs: { label: labelTag, body: body.tag('div') },
|
|
60
55
|
children: [labelTag, statusMeta, idMeta, trackMeta, followsMeta, body.next()],
|
|
61
56
|
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
__decorate([
|
|
65
|
-
attribute({ type: String, required: true }),
|
|
66
|
-
__metadata("design:type", String)
|
|
67
|
-
], BeatModel.prototype, "label", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
attribute({ type: String, required: false }),
|
|
70
|
-
__metadata("design:type", String)
|
|
71
|
-
], BeatModel.prototype, "status", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
attribute({ type: String, required: false }),
|
|
74
|
-
__metadata("design:type", String)
|
|
75
|
-
], BeatModel.prototype, "description", void 0);
|
|
76
|
-
__decorate([
|
|
77
|
-
attribute({ type: String, required: false }),
|
|
78
|
-
__metadata("design:type", String)
|
|
79
|
-
], BeatModel.prototype, "id", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
attribute({ type: String, required: false }),
|
|
82
|
-
__metadata("design:type", String)
|
|
83
|
-
], BeatModel.prototype, "track", void 0);
|
|
84
|
-
__decorate([
|
|
85
|
-
attribute({ type: String, required: false }),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], BeatModel.prototype, "follows", void 0);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
88
59
|
const plotType = ['arc', 'quest', 'subplot', 'campaign', 'episode', 'act', 'chapter'];
|
|
89
60
|
const structureType = ['linear', 'parallel', 'branching', 'web'];
|
|
90
|
-
export const beat = createSchema(BeatModel);
|
|
91
61
|
export const plot = createContentModelSchema({
|
|
92
62
|
attributes: {
|
|
93
63
|
title: { type: String, required: true, description: 'Heading displayed for this plot line.' },
|
|
@@ -127,7 +97,7 @@ export const plot = createContentModelSchema({
|
|
|
127
97
|
children.push(...descRendered.toArray());
|
|
128
98
|
}
|
|
129
99
|
children.push(beatsList);
|
|
130
|
-
return createComponentRenderable(
|
|
100
|
+
return createComponentRenderable({ rune: 'plot', schemaOrgType: 'CreativeWork',
|
|
131
101
|
tag: 'section',
|
|
132
102
|
property: 'contentSection',
|
|
133
103
|
properties: {
|