@miadi/ncp-story-studio 0.1.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/LICENSE +21 -0
- package/PHASES.md +160 -0
- package/README.md +140 -0
- package/assets/PROVENANCE.json +5 -0
- package/assets/examples/PROVENANCE.json +26 -0
- package/assets/examples/anora.json +228 -0
- package/assets/examples/example-story.json +112 -0
- package/assets/examples/the-shawshank-redemption.json +2068 -0
- package/assets/examples/weaver_of_words__the_catalyst_of_change_251101.json +1132 -0
- package/assets/ncp-schema.json +794 -0
- package/assets/terminology.json +2919 -0
- package/dist/agents/adapter.d.ts +60 -0
- package/dist/agents/adapter.d.ts.map +1 -0
- package/dist/agents/adapter.js +69 -0
- package/dist/agents/adapter.js.map +1 -0
- package/dist/agents/context.d.ts +19 -0
- package/dist/agents/context.d.ts.map +1 -0
- package/dist/agents/context.js +49 -0
- package/dist/agents/context.js.map +1 -0
- package/dist/agents/index.d.ts +5 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +7 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/links.d.ts +41 -0
- package/dist/agents/links.d.ts.map +1 -0
- package/dist/agents/links.js +76 -0
- package/dist/agents/links.js.map +1 -0
- package/dist/agents/personas.d.ts +16 -0
- package/dist/agents/personas.d.ts.map +1 -0
- package/dist/agents/personas.js +34 -0
- package/dist/agents/personas.js.map +1 -0
- package/dist/fixtures/index.d.ts +27 -0
- package/dist/fixtures/index.d.ts.map +1 -0
- package/dist/fixtures/index.js +69 -0
- package/dist/fixtures/index.js.map +1 -0
- package/dist/graph/index.d.ts +60 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +97 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/react/index.d.ts +2 -0
- package/dist/graph/react/index.d.ts.map +1 -0
- package/dist/graph/react/index.js +5 -0
- package/dist/graph/react/index.js.map +1 -0
- package/dist/graph/react/story-graph.d.ts +17 -0
- package/dist/graph/react/story-graph.d.ts.map +1 -0
- package/dist/graph/react/story-graph.js +26 -0
- package/dist/graph/react/story-graph.js.map +1 -0
- package/dist/graph/tones.d.ts +36 -0
- package/dist/graph/tones.d.ts.map +1 -0
- package/dist/graph/tones.js +38 -0
- package/dist/graph/tones.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/constants.d.ts +3 -0
- package/dist/schema/constants.d.ts.map +1 -0
- package/dist/schema/constants.js +3 -0
- package/dist/schema/constants.js.map +1 -0
- package/dist/schema/extensions.d.ts +14 -0
- package/dist/schema/extensions.d.ts.map +1 -0
- package/dist/schema/extensions.js +61 -0
- package/dist/schema/extensions.js.map +1 -0
- package/dist/schema/generated-terms.d.ts +7 -0
- package/dist/schema/generated-terms.d.ts.map +1 -0
- package/dist/schema/generated-terms.js +518 -0
- package/dist/schema/generated-terms.js.map +1 -0
- package/dist/schema/generated.d.ts +64 -0
- package/dist/schema/generated.d.ts.map +1 -0
- package/dist/schema/generated.js +497 -0
- package/dist/schema/generated.js.map +1 -0
- package/dist/schema/index.d.ts +48 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +92 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/normalize.d.ts +20 -0
- package/dist/schema/normalize.d.ts.map +1 -0
- package/dist/schema/normalize.js +88 -0
- package/dist/schema/normalize.js.map +1 -0
- package/dist/schema/read.d.ts +31 -0
- package/dist/schema/read.d.ts.map +1 -0
- package/dist/schema/read.js +640 -0
- package/dist/schema/read.js.map +1 -0
- package/dist/schema/terms.d.ts +11 -0
- package/dist/schema/terms.d.ts.map +1 -0
- package/dist/schema/terms.js +80 -0
- package/dist/schema/terms.js.map +1 -0
- package/dist/schema/types.d.ts +140 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +2 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/validate.d.ts +54 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +490 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/store/index.d.ts +76 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +96 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json.d.ts +35 -0
- package/dist/store/json.d.ts.map +1 -0
- package/dist/store/json.js +192 -0
- package/dist/store/json.js.map +1 -0
- package/dist/store/mutations.d.ts +45 -0
- package/dist/store/mutations.d.ts.map +1 -0
- package/dist/store/mutations.js +181 -0
- package/dist/store/mutations.js.map +1 -0
- package/dist/store/neon.d.ts +42 -0
- package/dist/store/neon.d.ts.map +1 -0
- package/dist/store/neon.js +167 -0
- package/dist/store/neon.js.map +1 -0
- package/dist/terminology/generated.d.ts +3 -0
- package/dist/terminology/generated.d.ts.map +1 -0
- package/dist/terminology/generated.js +2923 -0
- package/dist/terminology/generated.js.map +1 -0
- package/dist/terminology/index.d.ts +20 -0
- package/dist/terminology/index.d.ts.map +1 -0
- package/dist/terminology/index.js +71 -0
- package/dist/terminology/index.js.map +1 -0
- package/dist/terminology/types.d.ts +25 -0
- package/dist/terminology/types.d.ts.map +1 -0
- package/dist/terminology/types.js +2 -0
- package/dist/terminology/types.js.map +1 -0
- package/package.json +117 -0
- package/rispecs/README.rise.md +5 -0
- package/rispecs/RISPEC.md +9 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// `@miadi/ncp-story-studio/graph` — the story lattice as geometry. No React,
|
|
2
|
+
// no DOM: a route handler, a test, or an SVG writer can call this.
|
|
3
|
+
import { orderedBeats } from '../schema/index.js';
|
|
4
|
+
import { toneRingColors } from './tones.js';
|
|
5
|
+
export * from './tones.js';
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
beatSpacing: 320,
|
|
8
|
+
centerY: 300,
|
|
9
|
+
nodeRadius: 26,
|
|
10
|
+
ringGap: 9,
|
|
11
|
+
paddingX: 140,
|
|
12
|
+
height: 620,
|
|
13
|
+
curvature: 0.45,
|
|
14
|
+
stagger: 0,
|
|
15
|
+
};
|
|
16
|
+
function beatTitle(beat) {
|
|
17
|
+
const fromFunction = beat.custom_narrative_function ?? beat.narrative_function;
|
|
18
|
+
if (typeof fromFunction === 'string' && fromFunction.length > 0) {
|
|
19
|
+
return fromFunction.replace(/_/g, ' ');
|
|
20
|
+
}
|
|
21
|
+
return `beat ${beat.sequence}`;
|
|
22
|
+
}
|
|
23
|
+
/** Lay a narrative's beats out as a left-to-right lattice. */
|
|
24
|
+
export function layoutNarrative(narrative, options) {
|
|
25
|
+
const resolved = { ...DEFAULTS, ...options };
|
|
26
|
+
const beats = orderedBeats(narrative);
|
|
27
|
+
const nodes = beats.map((beat, index) => {
|
|
28
|
+
const x = resolved.paddingX + index * resolved.beatSpacing;
|
|
29
|
+
const staggerDirection = index % 2 === 0 ? -1 : 1;
|
|
30
|
+
const y = resolved.centerY + staggerDirection * resolved.stagger;
|
|
31
|
+
const r1 = resolved.nodeRadius;
|
|
32
|
+
const r2 = r1 + resolved.ringGap;
|
|
33
|
+
const r3 = r2 + resolved.ringGap;
|
|
34
|
+
return {
|
|
35
|
+
id: beat.id,
|
|
36
|
+
sequence: beat.sequence,
|
|
37
|
+
appreciation: beat.appreciation,
|
|
38
|
+
narrativeFunction: beat.custom_narrative_function ?? beat.narrative_function,
|
|
39
|
+
title: beatTitle(beat),
|
|
40
|
+
summary: beat.summary,
|
|
41
|
+
x,
|
|
42
|
+
y,
|
|
43
|
+
radius: r1,
|
|
44
|
+
ringRadii: [r1, r2, r3],
|
|
45
|
+
ringColors: toneRingColors(beat.tones),
|
|
46
|
+
hasTones: beat.tones !== undefined,
|
|
47
|
+
perspectiveIds: (beat.perspectives ?? []).map((ref) => ref.perspective_id),
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const links = [];
|
|
51
|
+
for (let index = 0; index < nodes.length - 1; index += 1) {
|
|
52
|
+
const from = nodes[index];
|
|
53
|
+
const to = nodes[index + 1];
|
|
54
|
+
const dx = (to.x - from.x) * resolved.curvature;
|
|
55
|
+
links.push({
|
|
56
|
+
id: `${from.id}->${to.id}`,
|
|
57
|
+
fromId: from.id,
|
|
58
|
+
toId: to.id,
|
|
59
|
+
path: `M ${from.x + from.ringRadii[2]} ${from.y} C ${from.x + dx} ${from.y}, ${to.x - dx} ${to.y}, ${to.x - to.ringRadii[2]} ${to.y}`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const lastNode = nodes[nodes.length - 1];
|
|
63
|
+
const width = lastNode ? lastNode.x + resolved.paddingX : resolved.paddingX * 2;
|
|
64
|
+
return { nodes, links, width, height: resolved.height, centerY: resolved.centerY, resolved };
|
|
65
|
+
}
|
|
66
|
+
/** Render a layout as a standalone SVG string, for exports and server rendering. */
|
|
67
|
+
export function layoutToSvg(layout, options) {
|
|
68
|
+
const background = options?.background ?? '#020617';
|
|
69
|
+
const showLabels = options?.label ?? true;
|
|
70
|
+
const parts = [
|
|
71
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${layout.width} ${layout.height}" width="${layout.width}" height="${layout.height}">`,
|
|
72
|
+
`<rect width="${layout.width}" height="${layout.height}" fill="${background}"/>`,
|
|
73
|
+
];
|
|
74
|
+
for (const link of layout.links) {
|
|
75
|
+
parts.push(`<path d="${link.path}" fill="none" stroke="#6366f1" stroke-opacity="0.45" stroke-width="2"/>`);
|
|
76
|
+
}
|
|
77
|
+
for (const node of layout.nodes) {
|
|
78
|
+
const [r1, r2, r3] = node.ringRadii;
|
|
79
|
+
parts.push(`<circle cx="${node.x}" cy="${node.y}" r="${r3}" fill="none" stroke="${node.ringColors.temporal}" stroke-opacity="0.7" stroke-width="2"/>`);
|
|
80
|
+
parts.push(`<circle cx="${node.x}" cy="${node.y}" r="${r2}" fill="none" stroke="${node.ringColors.spatial}" stroke-opacity="0.8" stroke-width="2"/>`);
|
|
81
|
+
parts.push(`<circle cx="${node.x}" cy="${node.y}" r="${r1}" fill="${node.ringColors.abstraction}" fill-opacity="0.18" stroke="${node.ringColors.abstraction}" stroke-width="2"/>`);
|
|
82
|
+
parts.push(`<text x="${node.x}" y="${node.y + 5}" text-anchor="middle" font-family="monospace" font-size="14" fill="#e2e8f0">${node.sequence}</text>`);
|
|
83
|
+
if (showLabels) {
|
|
84
|
+
parts.push(`<text x="${node.x}" y="${node.y + r3 + 22}" text-anchor="middle" font-family="sans-serif" font-size="13" fill="#94a3b8">${escapeXml(node.title)}</text>`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
parts.push('</svg>');
|
|
88
|
+
return parts.join('\n');
|
|
89
|
+
}
|
|
90
|
+
function escapeXml(value) {
|
|
91
|
+
return value
|
|
92
|
+
.replace(/&/g, '&')
|
|
93
|
+
.replace(/</g, '<')
|
|
94
|
+
.replace(/>/g, '>')
|
|
95
|
+
.replace(/"/g, '"');
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,mEAAmE;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAuB,MAAM,YAAY,CAAA;AAEhE,cAAc,YAAY,CAAA;AAuD1B,MAAM,QAAQ,GAAiC;IAC7C,WAAW,EAAE,GAAG;IAChB,OAAO,EAAE,GAAG;IACZ,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,CAAC;IACV,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,GAAG;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,CAAC;CACX,CAAA;AAED,SAAS,SAAS,CAAC,IAAe;IAChC,MAAM,YAAY,GAAG,IAAI,CAAC,yBAAyB,IAAI,IAAI,CAAC,kBAAkB,CAAA;IAC9E,IAAI,OAAO,YAAY,KAAK,QAAQ,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AAe,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/graph/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,6EAA6E;AAC7E,iEAAiE;AACjE,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type GraphLayoutOptions } from '../index.js';
|
|
3
|
+
import type { Narrative } from '../../schema/types.js';
|
|
4
|
+
export interface StoryGraphProps {
|
|
5
|
+
narrative: Narrative;
|
|
6
|
+
/** Highlighted beat. */
|
|
7
|
+
focusedBeatId?: string | null;
|
|
8
|
+
onBeatClick?: (beatId: string) => void;
|
|
9
|
+
options?: GraphLayoutOptions;
|
|
10
|
+
/** Show the beat label under each node (default true). */
|
|
11
|
+
labels?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Rendered when the narrative has no beats. */
|
|
14
|
+
emptyMessage?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function StoryGraph({ narrative, focusedBeatId, onBeatClick, options, labels, className, emptyMessage, }: StoryGraphProps): React.ReactElement;
|
|
17
|
+
//# sourceMappingURL=story-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"story-graph.d.ts","sourceRoot":"","sources":["../../../src/graph/react/story-graph.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAqC,KAAK,kBAAkB,EAAkB,MAAM,aAAa,CAAA;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,SAAS,CAAA;IACpB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC/B;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAa,EACb,SAAS,EACT,YAAsD,GACvD,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CA8CtC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The story lattice as a React component. It owns no data source and no URL:
|
|
4
|
+
// a narrative comes in, a beat id goes out.
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { layoutNarrative } from '../index.js';
|
|
7
|
+
export function StoryGraph({ narrative, focusedBeatId, onBeatClick, options, labels = true, className, emptyMessage = 'This narrative has no storybeats yet.', }) {
|
|
8
|
+
const layout = React.useMemo(() => layoutNarrative(narrative, options), [narrative, options]);
|
|
9
|
+
if (layout.nodes.length === 0) {
|
|
10
|
+
return (_jsx("div", { className: className, "data-ncp-graph": "empty", style: { padding: '2rem', color: '#94a3b8' }, children: emptyMessage }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx("div", { className: className, "data-ncp-graph": "canvas", style: { overflowX: 'auto', overflowY: 'hidden' }, children: _jsxs("svg", { viewBox: `0 0 ${layout.width} ${layout.height}`, width: layout.width, height: layout.height, role: "img", "aria-label": `Story lattice for ${narrative.title}: ${layout.nodes.length} beats`, children: [_jsx("g", { "data-ncp-graph-layer": "links", children: layout.links.map((link) => (_jsx("path", { d: link.path, fill: "none", stroke: "currentColor", strokeOpacity: 0.35, strokeWidth: 2 }, link.id))) }), _jsx("g", { "data-ncp-graph-layer": "nodes", children: layout.nodes.map((node) => (_jsx(BeatNode, { node: node, focused: focusedBeatId === node.id, labels: labels, onClick: onBeatClick }, node.id))) })] }) }));
|
|
13
|
+
}
|
|
14
|
+
function BeatNode({ node, focused, labels, onClick }) {
|
|
15
|
+
const interactive = typeof onClick === 'function';
|
|
16
|
+
const [r1, r2, r3] = node.ringRadii;
|
|
17
|
+
return (_jsxs("g", { "data-ncp-beat": node.id, "data-ncp-beat-focused": focused ? 'true' : undefined, transform: `translate(${node.x} ${node.y})`, style: interactive ? { cursor: 'pointer' } : undefined, role: interactive ? 'button' : undefined, tabIndex: interactive ? 0 : undefined, "aria-label": `Beat ${node.sequence}: ${node.title}`, onClick: interactive ? () => onClick?.(node.id) : undefined, onKeyDown: interactive
|
|
18
|
+
? (event) => {
|
|
19
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
onClick?.(node.id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
: undefined, children: [focused ? _jsx("circle", { r: r3 + 10, fill: "none", stroke: "#ffd700", strokeWidth: 2, strokeDasharray: "4 4" }) : null, _jsx("circle", { r: r3, fill: "none", stroke: node.ringColors.temporal, strokeOpacity: 0.7, strokeWidth: 2 }), _jsx("circle", { r: r2, fill: "none", stroke: node.ringColors.spatial, strokeOpacity: 0.85, strokeWidth: 2 }), _jsx("circle", { r: r1, fill: node.ringColors.abstraction, fillOpacity: node.hasTones ? 0.2 : 0.06, stroke: node.ringColors.abstraction, strokeWidth: 2 }), _jsx("text", { textAnchor: "middle", y: 5, fontFamily: "ui-monospace, monospace", fontSize: 14, fill: "currentColor", children: node.sequence }), labels ? (_jsx("text", { textAnchor: "middle", y: r3 + 22, fontSize: 13, fill: "currentColor", fillOpacity: 0.65, children: node.title })) : null] }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=story-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AAI,EAAC,cAAc,YACnG,IAAI,CAAC,QAAQ,GACT,EACN,MAAM,CAAC,CAAC,CAAC,CACR,eAAM,UAAU,EAAC,QAAQ,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAC,cAAc,EAAC,WAAW,EAAE,IAAI,YACtF,IAAI,CAAC,KAAK,GACN,CACR,CAAC,CAAC,CAAC,IAAI,IACN,CACL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ToneAbstraction, ToneSpatial, ToneTemporal } from '../schema/generated.js';
|
|
2
|
+
export declare const TONE_COLORS: {
|
|
3
|
+
readonly abstraction: {
|
|
4
|
+
readonly situation: "#93c5fd";
|
|
5
|
+
readonly action: "#fca5a5";
|
|
6
|
+
readonly justification: "#fcd34d";
|
|
7
|
+
readonly opinion: "#d8b4fe";
|
|
8
|
+
};
|
|
9
|
+
readonly spatial: {
|
|
10
|
+
readonly potential: "#38bdf8";
|
|
11
|
+
readonly resistance: "#f87171";
|
|
12
|
+
readonly current: "#34d399";
|
|
13
|
+
readonly power: "#a78bfa";
|
|
14
|
+
};
|
|
15
|
+
readonly temporal: {
|
|
16
|
+
readonly expression: "#fbbf24";
|
|
17
|
+
readonly experimentation: "#fb923c";
|
|
18
|
+
readonly integration: "#2dd4bf";
|
|
19
|
+
readonly transcendence: "#e879f9";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const TONE_FALLBACK = "#94a3b8";
|
|
23
|
+
export declare function abstractionColor(value: ToneAbstraction | string | undefined): string;
|
|
24
|
+
export declare function spatialColor(value: ToneSpatial | string | undefined): string;
|
|
25
|
+
export declare function temporalColor(value: ToneTemporal | string | undefined): string;
|
|
26
|
+
export interface ToneRingColors {
|
|
27
|
+
abstraction: string;
|
|
28
|
+
spatial: string;
|
|
29
|
+
temporal: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function toneRingColors(tones: {
|
|
32
|
+
abstraction?: string;
|
|
33
|
+
spatial?: string;
|
|
34
|
+
temporal?: string;
|
|
35
|
+
} | undefined): ToneRingColors;
|
|
36
|
+
//# sourceMappingURL=tones.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tones.d.ts","sourceRoot":"","sources":["../../src/graph/tones.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAExF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;CAmBd,CAAA;AAEV,eAAO,MAAM,aAAa,YAAY,CAAA;AAEtC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAEpF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE5E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE9E;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,SAAS,GAAG,cAAc,CAM7B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const TONE_COLORS = {
|
|
2
|
+
abstraction: {
|
|
3
|
+
situation: '#93c5fd',
|
|
4
|
+
action: '#fca5a5',
|
|
5
|
+
justification: '#fcd34d',
|
|
6
|
+
opinion: '#d8b4fe',
|
|
7
|
+
},
|
|
8
|
+
spatial: {
|
|
9
|
+
potential: '#38bdf8',
|
|
10
|
+
resistance: '#f87171',
|
|
11
|
+
current: '#34d399',
|
|
12
|
+
power: '#a78bfa',
|
|
13
|
+
},
|
|
14
|
+
temporal: {
|
|
15
|
+
expression: '#fbbf24',
|
|
16
|
+
experimentation: '#fb923c',
|
|
17
|
+
integration: '#2dd4bf',
|
|
18
|
+
transcendence: '#e879f9',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const TONE_FALLBACK = '#94a3b8';
|
|
22
|
+
export function abstractionColor(value) {
|
|
23
|
+
return TONE_COLORS.abstraction[value] ?? TONE_FALLBACK;
|
|
24
|
+
}
|
|
25
|
+
export function spatialColor(value) {
|
|
26
|
+
return TONE_COLORS.spatial[value] ?? TONE_FALLBACK;
|
|
27
|
+
}
|
|
28
|
+
export function temporalColor(value) {
|
|
29
|
+
return TONE_COLORS.temporal[value] ?? TONE_FALLBACK;
|
|
30
|
+
}
|
|
31
|
+
export function toneRingColors(tones) {
|
|
32
|
+
return {
|
|
33
|
+
abstraction: abstractionColor(tones?.abstraction),
|
|
34
|
+
spatial: spatialColor(tones?.spatial),
|
|
35
|
+
temporal: temporalColor(tones?.temporal),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=tones.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tones.js","sourceRoot":"","sources":["../../src/graph/tones.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,SAAS;QACxB,OAAO,EAAE,SAAS;KACnB;IACD,OAAO,EAAE;QACP,SAAS,EAAE,SAAS;QACpB,UAAU,EAAE,SAAS;QACrB,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,SAAS;KACjB;IACD,QAAQ,EAAE;QACR,UAAU,EAAE,SAAS;QACrB,eAAe,EAAE,SAAS;QAC1B,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,SAAS;KACzB;CACO,CAAA;AAEV,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAA;AAEtC,MAAM,UAAU,gBAAgB,CAAC,KAA2C;IAC1E,OAAO,WAAW,CAAC,WAAW,CAAC,KAAwB,CAAC,IAAI,aAAa,CAAA;AAC3E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAuC;IAClE,OAAO,WAAW,CAAC,OAAO,CAAC,KAAoB,CAAC,IAAI,aAAa,CAAA;AACnE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAwC;IACpE,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAqB,CAAC,IAAI,aAAa,CAAA;AACrE,CAAC;AAQD,MAAM,UAAU,cAAc,CAAC,KAIlB;IACX,OAAO;QACL,WAAW,EAAE,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC;QACjD,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC;QACrC,QAAQ,EAAE,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC;KACzC,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './schema/index.js';
|
|
2
|
+
export declare const PACKAGE_NAME = "@miadi/ncp-story-studio";
|
|
3
|
+
/** The module surfaces this package publishes, for a consumer that lists them. */
|
|
4
|
+
export declare const MODULES: readonly [{
|
|
5
|
+
readonly subpath: "schema";
|
|
6
|
+
readonly needs: readonly [];
|
|
7
|
+
readonly purpose: "NCP types, validator, normalizer, completeness";
|
|
8
|
+
}, {
|
|
9
|
+
readonly subpath: "graph";
|
|
10
|
+
readonly needs: readonly [];
|
|
11
|
+
readonly purpose: "Story lattice geometry and SVG output";
|
|
12
|
+
}, {
|
|
13
|
+
readonly subpath: "graph/react";
|
|
14
|
+
readonly needs: readonly ["react"];
|
|
15
|
+
readonly purpose: "The lattice as a React component";
|
|
16
|
+
}, {
|
|
17
|
+
readonly subpath: "store";
|
|
18
|
+
readonly needs: readonly [];
|
|
19
|
+
readonly purpose: "Story projects, pure edits, JSON and Neon providers";
|
|
20
|
+
}, {
|
|
21
|
+
readonly subpath: "agents";
|
|
22
|
+
readonly needs: readonly [];
|
|
23
|
+
readonly purpose: "Personas, lattice context, the agent link protocol";
|
|
24
|
+
}, {
|
|
25
|
+
readonly subpath: "terminology";
|
|
26
|
+
readonly needs: readonly [];
|
|
27
|
+
readonly purpose: "Canonical NCP vocabulary as data";
|
|
28
|
+
}, {
|
|
29
|
+
readonly subpath: "fixtures";
|
|
30
|
+
readonly needs: readonly ["node"];
|
|
31
|
+
readonly purpose: "Bundled example documents";
|
|
32
|
+
}];
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,mBAAmB,CAAA;AAEjC,eAAO,MAAM,YAAY,4BAA4B,CAAA;AAErD,kFAAkF;AAClF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQV,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// `@miadi/ncp-story-studio` — the studio as modules. This entry carries the
|
|
2
|
+
// package identity and re-exports the schema, which every other module and
|
|
3
|
+
// every consumer needs. The heavier surfaces are subpath imports:
|
|
4
|
+
//
|
|
5
|
+
// @miadi/ncp-story-studio/schema types, validator, normalizer
|
|
6
|
+
// @miadi/ncp-story-studio/graph headless lattice layout + SVG
|
|
7
|
+
// @miadi/ncp-story-studio/graph/react the React renderer
|
|
8
|
+
// @miadi/ncp-story-studio/store project contract + JSON/Neon providers
|
|
9
|
+
// @miadi/ncp-story-studio/agents personas, lattice context, link protocol
|
|
10
|
+
// @miadi/ncp-story-studio/terminology the canonical vocabulary as data
|
|
11
|
+
// @miadi/ncp-story-studio/fixtures bundled example documents (Node only)
|
|
12
|
+
export * from './schema/index.js';
|
|
13
|
+
export const PACKAGE_NAME = '@miadi/ncp-story-studio';
|
|
14
|
+
/** The module surfaces this package publishes, for a consumer that lists them. */
|
|
15
|
+
export const MODULES = [
|
|
16
|
+
{ subpath: 'schema', needs: [], purpose: 'NCP types, validator, normalizer, completeness' },
|
|
17
|
+
{ subpath: 'graph', needs: [], purpose: 'Story lattice geometry and SVG output' },
|
|
18
|
+
{ subpath: 'graph/react', needs: ['react'], purpose: 'The lattice as a React component' },
|
|
19
|
+
{ subpath: 'store', needs: [], purpose: 'Story projects, pure edits, JSON and Neon providers' },
|
|
20
|
+
{ subpath: 'agents', needs: [], purpose: 'Personas, lattice context, the agent link protocol' },
|
|
21
|
+
{ subpath: 'terminology', needs: [], purpose: 'Canonical NCP vocabulary as data' },
|
|
22
|
+
{ subpath: 'fixtures', needs: ['node'], purpose: 'Bundled example documents' },
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,kEAAkE;AAClE,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,6DAA6D;AAC7D,iFAAiF;AACjF,mFAAmF;AACnF,2EAA2E;AAC3E,gFAAgF;AAChF,cAAc,mBAAmB,CAAA;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAA;AAErD,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE;IAC3F,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,uCAAuC,EAAE;IACjF,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE;IACzF,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,qDAAqD,EAAE;IAC/F,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,oDAAoD,EAAE;IAC/F,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,kCAAkC,EAAE;IAClF,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE;CACtE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/schema/constants.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/schema/constants.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface DeclaredExtension {
|
|
2
|
+
/** Stable identifier, `<element>.<field>`. */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Where the field is attached. */
|
|
5
|
+
element: 'perspective' | 'player' | 'dynamic' | 'storypoint' | 'storybeat';
|
|
6
|
+
field: string;
|
|
7
|
+
/** Why it exists, in one sentence. */
|
|
8
|
+
rationale: string;
|
|
9
|
+
/** Where the field came from. */
|
|
10
|
+
origin: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DECLARED_EXTENSIONS: readonly DeclaredExtension[];
|
|
13
|
+
export declare function isDeclaredExtension(element: DeclaredExtension['element'], field: string): boolean;
|
|
14
|
+
//# sourceMappingURL=extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../src/schema/extensions.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAA;IACV,mCAAmC;IACnC,OAAO,EAAE,aAAa,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAA;IAC1E,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,iBAAiB,EAkDlD,CAAA;AASV,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const DECLARED_EXTENSIONS = [
|
|
2
|
+
{
|
|
3
|
+
id: 'perspective.throughline',
|
|
4
|
+
element: 'perspective',
|
|
5
|
+
field: 'throughline',
|
|
6
|
+
rationale: 'Carries the Dramatica throughline label so a view can name a perspective without deriving it.',
|
|
7
|
+
origin: 'ncp-story-studio prototype types.ts',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: 'player.motivations',
|
|
11
|
+
element: 'player',
|
|
12
|
+
field: 'motivations',
|
|
13
|
+
rationale: 'Holds per-player narrative-function motivations, which the canonical player object has no place for.',
|
|
14
|
+
origin: 'ncp-story-studio prototype types.ts',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'dynamic.custom_dynamic',
|
|
18
|
+
element: 'dynamic',
|
|
19
|
+
field: 'custom_dynamic',
|
|
20
|
+
rationale: 'Names a dynamic outside the canonical set, which design-vocabulary sources routinely do.',
|
|
21
|
+
origin: 'ncp-story-studio, symmetric with storypoint.custom_appreciation',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'dynamic.custom_vector',
|
|
25
|
+
element: 'dynamic',
|
|
26
|
+
field: 'custom_vector',
|
|
27
|
+
rationale: 'Names a vector outside the canonical set.',
|
|
28
|
+
origin: 'ncp-story-studio, symmetric with storypoint.custom_appreciation',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'storypoint.custom_appreciation',
|
|
32
|
+
element: 'storypoint',
|
|
33
|
+
field: 'custom_appreciation',
|
|
34
|
+
rationale: 'Names an appreciation outside the canonical closed set instead of silently violating it.',
|
|
35
|
+
origin: 'ncp-story-studio prototype types.ts',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'storypoint.custom_narrative_function',
|
|
39
|
+
element: 'storypoint',
|
|
40
|
+
field: 'custom_narrative_function',
|
|
41
|
+
rationale: 'Names a narrative function outside the canonical closed set instead of silently violating it.',
|
|
42
|
+
origin: 'ncp-story-studio prototype types.ts',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'storybeat.custom_narrative_function',
|
|
46
|
+
element: 'storybeat',
|
|
47
|
+
field: 'custom_narrative_function',
|
|
48
|
+
rationale: 'The storypoint escape hatch, applied to beats for symmetry.',
|
|
49
|
+
origin: 'ncp-story-studio, symmetric with storypoint.custom_narrative_function',
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
const BY_ELEMENT = new Map();
|
|
53
|
+
for (const extension of DECLARED_EXTENSIONS) {
|
|
54
|
+
const fields = BY_ELEMENT.get(extension.element) ?? new Set();
|
|
55
|
+
fields.add(extension.field);
|
|
56
|
+
BY_ELEMENT.set(extension.element, fields);
|
|
57
|
+
}
|
|
58
|
+
export function isDeclaredExtension(element, field) {
|
|
59
|
+
return BY_ELEMENT.get(element)?.has(field) === true;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/schema/extensions.ts"],"names":[],"mappings":"AAeA,MAAM,C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rE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC3B,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAqC,EAAE,KAAa;IACtF,OAAO,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,CAAA;AACrD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const TERM_MAP: {
|
|
2
|
+
readonly appreciation_by_label: readonly [readonly ["objective story solution", "solution"], readonly ["objective story benchmark", "concern"], readonly ["objective story catalyst", "issue"], readonly ["objective story problem", "problem"], readonly ["objective story response", "response"], readonly ["objective story issue", "issue"], readonly ["objective story concern", "concern"], readonly ["objective story flow", "response"], readonly ["objective story symptom", "symptom"], readonly ["objective story domain", "domain"], readonly ["objective story inhibitor", "issue"], readonly ["objective story problem", "problem"], readonly ["objective story resistance", "symptom"], readonly ["objective story solution", "solution"], readonly ["story consequence", "concern"], readonly ["story costs", "concern"], readonly ["story dividends", "concern"], readonly ["story forewarnings", "concern"], readonly ["story dividends", "concern"], readonly ["story forewarnings", "concern"], readonly ["story goal", "concern"], readonly ["story consequence", "concern"], readonly ["story preconditions", "concern"], readonly ["story prerequisites", "concern"], readonly ["story costs", "concern"], readonly ["story requirements", "concern"], readonly ["main character solution", "solution"], readonly ["main character baseline", "problem"], readonly ["main character benchmark", "concern"], readonly ["main character problem", "problem"], readonly ["main character critical flaw", "issue"], readonly ["main character response", "response"], readonly ["main character evolution", "response"], readonly ["main character issue", "issue"], readonly ["main character concern", "concern"], readonly ["main character flow", "response"], readonly ["main character symptom", "symptom"], readonly ["main character domain", "domain"], readonly ["main character introduction", "problem"], readonly ["main character pivotal element", "problem"], readonly ["main character problem", "problem"], readonly ["main character resistance", "symptom"], readonly ["main character resolution", "solution"], readonly ["main character solution", "solution"], readonly ["main character unique ability", "issue"], readonly ["influence character solution", "solution"], readonly ["influence character baseline", "problem"], readonly ["influence character benchmark", "concern"], readonly ["influence character problem", "problem"], readonly ["influence character critical flaw", "issue"], readonly ["influence character response", "response"], readonly ["influence character evolution", "response"], readonly ["influence character issue", "issue"], readonly ["influence character concern", "concern"], readonly ["influence character flow", "response"], readonly ["influence character symptom", "symptom"], readonly ["influence character domain", "domain"], readonly ["influence character introduction", "problem"], readonly ["influence character pivotal element", "problem"], readonly ["influence character problem", "problem"], readonly ["influence character resistance", "symptom"], readonly ["influence character resolution", "solution"], readonly ["influence character solution", "solution"], readonly ["influence character unique ability", "issue"], readonly ["relationship story solution", "solution"], readonly ["relationship story benchmark", "concern"], readonly ["relationship story catalyst", "issue"], readonly ["relationship story problem", "problem"], readonly ["relationship story response", "response"], readonly ["relationship story issue", "issue"], readonly ["relationship story concern", "concern"], readonly ["relationship story flow", "response"], readonly ["relationship story symptom", "symptom"], readonly ["relationship story domain", "domain"], readonly ["relationship story inhibitor", "issue"], readonly ["relationship story problem", "problem"], readonly ["relationship story resistance", "symptom"], readonly ["relationship story solution", "solution"]];
|
|
3
|
+
readonly dynamic_by_label: readonly [readonly ["main character resolve", "main_character_resolve"], readonly ["influence character resolve", "influence_character_resolve"], readonly ["main character growth", "main_character_growth"], readonly ["main character approach", "main_character_approach"], readonly ["problem-solving style", "problem_solving_style"], readonly ["story limit", "story_limit"], readonly ["story driver", "story_driver"], readonly ["story outcome", "story_outcome"], readonly ["story judgment", "story_judgment"]];
|
|
4
|
+
readonly pov_by_context: readonly [readonly ["objective story", "they"], readonly ["objective story throughline", "they"], readonly ["main character", "i"], readonly ["main character throughline", "i"], readonly ["influence character", "you"], readonly ["influence character throughline", "you"], readonly ["relationship story", "we"], readonly ["relationship story throughline", "we"]];
|
|
5
|
+
readonly legacy_to_dramatica: readonly [readonly ["relinquished / released", "Change"], readonly ["maintained / sustained", "Steadfast"], readonly ["dopamine", "Linear"], readonly ["serotonin", "Holistic"], readonly ["narrative alignment", "Problem-Solving Style"], readonly ["narrative fabric", "Story Limit"], readonly ["spacetime", "Options"], readonly ["timespace", "Time"], readonly ["form", "Domain"], readonly ["field", "Concern"], readonly ["facet", "Issue"], readonly ["force", "Problem / Solution / Symptom / Response"], readonly ["condition", "Problem"], readonly ["adjustment", "Solution"], readonly ["focus", "Symptom"], readonly ["direction", "Response"], readonly ["free", "Uncontrolled"], readonly ["transit", "Signpost"], readonly ["external framing", "Universe"], readonly ["external processing", "Physics"], readonly ["internal processing", "Psychology"], readonly ["internal framing", "Mind"], readonly ["story intention", "Story Goal"], readonly ["story overwhelm", "Story Consequence"], readonly ["story excitement", "Story Dividends"], readonly ["story pressure", "Story Costs"], readonly ["story ennui", "Story Forewarnings"], readonly ["story habituations", "Story Requirements"], readonly ["story internalizations", "Story Prerequisites"], readonly ["story socializations", "Story Preconditions"]];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=generated-terms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-terms.d.ts","sourceRoot":"","sources":["../../src/schema/generated-terms.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ;;;;;CA6fX,CAAA"}
|