@lingjingai/script-editor 0.4.0 → 0.4.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/index.d.ts +7 -1
- package/dist/index.js +148 -133
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -318,6 +318,12 @@ interface AssetSortItem {
|
|
|
318
318
|
/** appearance count (scenes referencing this asset). */
|
|
319
319
|
count: number;
|
|
320
320
|
}
|
|
321
|
+
/** The built-in asset ordering, ALSO used by the bundled StudioToc: background
|
|
322
|
+
* last, then appearance count desc, ties by name. This is the single source of
|
|
323
|
+
* truth so the built-in TOC and the preview agree by default. Hosts override
|
|
324
|
+
* BOTH by passing their own comparator as `assetSort` (and feeding the same one
|
|
325
|
+
* to their own TOC). */
|
|
326
|
+
declare function defaultAssetSort(a: AssetSortItem, b: AssetSortItem): number;
|
|
321
327
|
|
|
322
328
|
/**
|
|
323
329
|
* Reference focus — the INVERSE of "quote to chat". The host pushes a
|
|
@@ -932,4 +938,4 @@ declare function DeleteConfirmButton({ onConfirm, disabled, targetScope, title,
|
|
|
932
938
|
description?: string;
|
|
933
939
|
}): react.JSX.Element;
|
|
934
940
|
|
|
935
|
-
export { type AssetAdapter, type AssetDeleteRequest, type AssetSortItem, type AssetState, type ChangeSet, type ChatReference, DeleteConfirmButton, type DiffActionMark, type DiffAdapter, type DiffSceneMark, EMPTY_SELECTION, EditableText, type EpisodeWorkspaceView, type FieldChange, type Importance, type ParsedTimestamp, Popover, type SaveStatus, type Scene, type SceneActionDiff, type SceneChangeKind, type SceneContext, type SceneEnvironment, type ScriptActor, ScriptContentType, type ScriptData, ScriptEditor, type ScriptEditorAdapters, type ScriptEditorProps, type ScriptEpisode, type ScriptFormat, type ScriptHighlight, type ScriptItem, type ScriptLocation, type ScriptNav, type ScriptNavEntity, type ScriptNavEpisode, type ScriptNavScene, type ScriptProject, type ScriptProp, type ScriptReferenceFocusRequest, type ScriptReferenceLocator, type ScriptSpeaker, type ScriptTargetKind, SelectField, type StateChange, type StudioSelection, type StudioSelectionFrom, type StudioSelectionOrigin, type TransitionPrompt, type V3Speaker, acceptActionIntoBaseline, acceptSceneIntoBaseline, applyActionAccept, applyActionReject, buildActionDiff, buildDiffFromBaseline, buildScriptNav, buildSelectionFrom, changeSetToDiffScenes, computeChangeSet, computeSceneActionDiff, countAssetAppearances, findBaselineScene, formatTimestamp, fromToSelection, getActorCueVar, getActorMap, getEpisodeTitle, getLocationMap, getPropMap, getSceneContext, getSelectionEpisodeIdx, getSpeakerMap, isClipSelected, isEpisodeOpen, isSameSelectionTarget, isSceneSelected, index as mutations, rejectActionToBaseline, rejectSceneToBaseline, sceneChangeKey, selectionFromScriptReference, selectionTargetKey, withOrigin };
|
|
941
|
+
export { type AssetAdapter, type AssetDeleteRequest, type AssetSortItem, type AssetState, type ChangeSet, type ChatReference, DeleteConfirmButton, type DiffActionMark, type DiffAdapter, type DiffSceneMark, EMPTY_SELECTION, EditableText, type EpisodeWorkspaceView, type FieldChange, type Importance, type ParsedTimestamp, Popover, type SaveStatus, type Scene, type SceneActionDiff, type SceneChangeKind, type SceneContext, type SceneEnvironment, type ScriptActor, ScriptContentType, type ScriptData, ScriptEditor, type ScriptEditorAdapters, type ScriptEditorProps, type ScriptEpisode, type ScriptFormat, type ScriptHighlight, type ScriptItem, type ScriptLocation, type ScriptNav, type ScriptNavEntity, type ScriptNavEpisode, type ScriptNavScene, type ScriptProject, type ScriptProp, type ScriptReferenceFocusRequest, type ScriptReferenceLocator, type ScriptSpeaker, type ScriptTargetKind, SelectField, type StateChange, type StudioSelection, type StudioSelectionFrom, type StudioSelectionOrigin, type TransitionPrompt, type V3Speaker, acceptActionIntoBaseline, acceptSceneIntoBaseline, applyActionAccept, applyActionReject, buildActionDiff, buildDiffFromBaseline, buildScriptNav, buildSelectionFrom, changeSetToDiffScenes, computeChangeSet, computeSceneActionDiff, countAssetAppearances, defaultAssetSort, findBaselineScene, formatTimestamp, fromToSelection, getActorCueVar, getActorMap, getEpisodeTitle, getLocationMap, getPropMap, getSceneContext, getSelectionEpisodeIdx, getSpeakerMap, isClipSelected, isEpisodeOpen, isSameSelectionTarget, isSceneSelected, index as mutations, rejectActionToBaseline, rejectSceneToBaseline, sceneChangeKey, selectionFromScriptReference, selectionTargetKey, withOrigin };
|
package/dist/index.js
CHANGED
|
@@ -471,6 +471,137 @@ function getDialogueDeliveryLabel(delivery) {
|
|
|
471
471
|
return "";
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
+
// src/stream/flat-items.ts
|
|
475
|
+
var SCENE_KEY = (e, s) => `ep:${e}:sc:${s}`;
|
|
476
|
+
var SCENE_ID_KEY = (e, id) => `ep:${e}:id:${id}`;
|
|
477
|
+
var ASSET_KEY = (g, id) => `${g}:${id}`;
|
|
478
|
+
function safeId(raw, fallback) {
|
|
479
|
+
const t = (raw ?? "").toString().trim();
|
|
480
|
+
return t.length > 0 ? t : fallback;
|
|
481
|
+
}
|
|
482
|
+
var GROUP_LABEL = { actors: "\u89D2\u8272", locations: "\u573A\u666F", props: "\u9053\u5177" };
|
|
483
|
+
var assetGroupLabel = (g) => GROUP_LABEL[g];
|
|
484
|
+
function defaultAssetSort(a, b) {
|
|
485
|
+
const bgA = a.importance === "background" ? 1 : 0;
|
|
486
|
+
const bgB = b.importance === "background" ? 1 : 0;
|
|
487
|
+
return bgA - bgB || b.count - a.count || a.name.localeCompare(b.name, "zh");
|
|
488
|
+
}
|
|
489
|
+
function buildFlatStream(data, opts = {}) {
|
|
490
|
+
const includeAssets = opts.includeAssets ?? true;
|
|
491
|
+
const items = [];
|
|
492
|
+
const indexByKey = /* @__PURE__ */ new Map();
|
|
493
|
+
const sceneIndexLookup = /* @__PURE__ */ new Map();
|
|
494
|
+
const sceneIdLookup = /* @__PURE__ */ new Map();
|
|
495
|
+
const assetIndexLookup = /* @__PURE__ */ new Map();
|
|
496
|
+
const push = (item) => {
|
|
497
|
+
indexByKey.set(item.key, items.length);
|
|
498
|
+
if (item.kind === "scene") {
|
|
499
|
+
sceneIndexLookup.set(SCENE_KEY(item.episodeIdx, item.sceneIdx), items.length);
|
|
500
|
+
sceneIdLookup.set(SCENE_ID_KEY(item.episodeIdx, item.sceneId), items.length);
|
|
501
|
+
}
|
|
502
|
+
if (item.kind === "asset-card") assetIndexLookup.set(ASSET_KEY(item.group, item.assetId), items.length);
|
|
503
|
+
items.push(item);
|
|
504
|
+
};
|
|
505
|
+
if (!data) {
|
|
506
|
+
return { items, indexByKey, sceneIndexLookup, sceneIdLookup, assetIndexLookup, paperStartKey: null, paperEndKey: null };
|
|
507
|
+
}
|
|
508
|
+
let paperStartKey = null;
|
|
509
|
+
let paperEndKey = null;
|
|
510
|
+
(data.episodes ?? []).forEach((episode, ei) => {
|
|
511
|
+
const headerKey = `ep:${ei}:header`;
|
|
512
|
+
push({ key: headerKey, kind: "episode-header", episodeIdx: ei });
|
|
513
|
+
if (paperStartKey === null) paperStartKey = headerKey;
|
|
514
|
+
paperEndKey = headerKey;
|
|
515
|
+
const scenes = episode.scenes ?? [];
|
|
516
|
+
if (scenes.length === 0) {
|
|
517
|
+
const emptyKey = `ep:${ei}:empty`;
|
|
518
|
+
push({ key: emptyKey, kind: "episode-empty", episodeIdx: ei });
|
|
519
|
+
paperEndKey = emptyKey;
|
|
520
|
+
} else {
|
|
521
|
+
scenes.forEach((scene, si) => {
|
|
522
|
+
const sceneId = safeId(scene.scene_id, `__idx:${si}`);
|
|
523
|
+
const key = `sc:ep${ei}:sc${si}:${sceneId}`;
|
|
524
|
+
push({
|
|
525
|
+
key,
|
|
526
|
+
kind: "scene",
|
|
527
|
+
episodeIdx: ei,
|
|
528
|
+
sceneIdx: si,
|
|
529
|
+
sceneId,
|
|
530
|
+
isStart: si === 0,
|
|
531
|
+
isEnd: si === scenes.length - 1
|
|
532
|
+
});
|
|
533
|
+
paperEndKey = key;
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
push({ key: "add-episode", kind: "add-episode" });
|
|
538
|
+
if (includeAssets) {
|
|
539
|
+
const specs = [
|
|
540
|
+
{ group: "actors", ids: (data.actors ?? []).map((a, i) => safeId(a.actor_id, `__idx:${i}`)) },
|
|
541
|
+
{ group: "locations", ids: (data.locations ?? []).map((l, i) => safeId(l.location_id, `__idx:${i}`)) },
|
|
542
|
+
{ group: "props", ids: (data.props ?? []).map((p, i) => safeId(p.prop_id, `__idx:${i}`)) }
|
|
543
|
+
];
|
|
544
|
+
const sort = opts.assetSort ?? defaultAssetSort;
|
|
545
|
+
const counts = countAssetAppearances(data);
|
|
546
|
+
const actorMap = getActorMap(data.actors ?? []);
|
|
547
|
+
const locationMap = getLocationMap(data.locations ?? []);
|
|
548
|
+
const propMap = getPropMap(data.props ?? []);
|
|
549
|
+
const enrich = (group, id) => {
|
|
550
|
+
if (group === "actors") return { group, id, name: getActorDisplayName(actorMap.get(id)) || id, importance: actorMap.get(id)?.importance, count: counts.actors.get(id) ?? 0 };
|
|
551
|
+
if (group === "locations") return { group, id, name: getLocationDisplayName(locationMap.get(id)) || id, importance: locationMap.get(id)?.importance, count: counts.locations.get(id) ?? 0 };
|
|
552
|
+
return { group, id, name: getPropDisplayName(propMap.get(id)) || id, importance: propMap.get(id)?.importance, count: counts.props.get(id) ?? 0 };
|
|
553
|
+
};
|
|
554
|
+
for (const spec of specs) {
|
|
555
|
+
spec.ids = spec.ids.map((id) => enrich(spec.group, id)).sort(sort).map((it) => it.id);
|
|
556
|
+
}
|
|
557
|
+
for (const { group, ids } of specs) {
|
|
558
|
+
push({ key: `asset-group:${group}`, kind: "asset-group-header", group });
|
|
559
|
+
ids.forEach((assetId) => push({ key: `asset:${group}:${assetId}`, kind: "asset-card", group, assetId }));
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return { items, indexByKey, sceneIndexLookup, sceneIdLookup, assetIndexLookup, paperStartKey, paperEndKey };
|
|
563
|
+
}
|
|
564
|
+
function selectionToFlatIndex(stream, sel) {
|
|
565
|
+
switch (sel.kind) {
|
|
566
|
+
case "episode":
|
|
567
|
+
return stream.indexByKey.get(`ep:${sel.episodeIdx}:header`) ?? null;
|
|
568
|
+
case "scene":
|
|
569
|
+
return stream.sceneIndexLookup.get(SCENE_KEY(sel.episodeIdx, sel.sceneIdx)) ?? null;
|
|
570
|
+
case "clip": {
|
|
571
|
+
if (sel.sceneIdx !== void 0) {
|
|
572
|
+
const byIdx = stream.sceneIndexLookup.get(SCENE_KEY(sel.episodeIdx, sel.sceneIdx));
|
|
573
|
+
if (byIdx !== void 0) return byIdx;
|
|
574
|
+
}
|
|
575
|
+
const id = (sel.sceneId ?? "").trim();
|
|
576
|
+
return id ? stream.sceneIdLookup.get(SCENE_ID_KEY(sel.episodeIdx, id)) ?? null : null;
|
|
577
|
+
}
|
|
578
|
+
case "actor":
|
|
579
|
+
return stream.assetIndexLookup.get(ASSET_KEY("actors", sel.actorId)) ?? null;
|
|
580
|
+
case "location":
|
|
581
|
+
return stream.assetIndexLookup.get(ASSET_KEY("locations", sel.locationId)) ?? null;
|
|
582
|
+
case "prop":
|
|
583
|
+
return stream.assetIndexLookup.get(ASSET_KEY("props", sel.propId)) ?? null;
|
|
584
|
+
default:
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
function flatIndexToSelection(stream, idx) {
|
|
589
|
+
const item = stream.items[idx];
|
|
590
|
+
if (!item) return null;
|
|
591
|
+
switch (item.kind) {
|
|
592
|
+
case "episode-header":
|
|
593
|
+
return { kind: "episode", episodeIdx: item.episodeIdx };
|
|
594
|
+
case "scene":
|
|
595
|
+
return { kind: "scene", episodeIdx: item.episodeIdx, sceneIdx: item.sceneIdx };
|
|
596
|
+
case "asset-card":
|
|
597
|
+
if (item.group === "actors") return { kind: "actor", actorId: item.assetId };
|
|
598
|
+
if (item.group === "locations") return { kind: "location", locationId: item.assetId };
|
|
599
|
+
return { kind: "prop", propId: item.assetId };
|
|
600
|
+
default:
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
474
605
|
// src/cn.ts
|
|
475
606
|
function cn(...parts) {
|
|
476
607
|
return parts.filter(Boolean).join(" ");
|
|
@@ -501,7 +632,8 @@ function StudioToc({
|
|
|
501
632
|
data,
|
|
502
633
|
selection,
|
|
503
634
|
onSelect,
|
|
504
|
-
onAddEpisode
|
|
635
|
+
onAddEpisode,
|
|
636
|
+
assetSort
|
|
505
637
|
}) {
|
|
506
638
|
const episodes = data.episodes ?? [];
|
|
507
639
|
const [episodesOpen, setEpisodesOpen] = useState(true);
|
|
@@ -576,7 +708,9 @@ function StudioToc({
|
|
|
576
708
|
{
|
|
577
709
|
icon: Users,
|
|
578
710
|
label: "\u89D2\u8272",
|
|
711
|
+
group: "actors",
|
|
579
712
|
emptyText: "\u5C1A\u65E0\u89D2\u8272",
|
|
713
|
+
sort: assetSort,
|
|
580
714
|
items: (data.actors ?? []).map((a) => {
|
|
581
715
|
const id = (a.actor_id ?? "").trim();
|
|
582
716
|
return { id, name: getActorDisplayName(a), importance: a.importance, count: counts.actors.get(id) ?? 0 };
|
|
@@ -591,7 +725,9 @@ function StudioToc({
|
|
|
591
725
|
{
|
|
592
726
|
icon: MapPin,
|
|
593
727
|
label: "\u573A\u666F",
|
|
728
|
+
group: "locations",
|
|
594
729
|
emptyText: "\u5C1A\u65E0\u573A\u666F",
|
|
730
|
+
sort: assetSort,
|
|
595
731
|
items: (data.locations ?? []).map((l) => {
|
|
596
732
|
const id = (l.location_id ?? "").trim();
|
|
597
733
|
return { id, name: getLocationDisplayName(l), importance: l.importance, count: counts.locations.get(id) ?? 0 };
|
|
@@ -606,7 +742,9 @@ function StudioToc({
|
|
|
606
742
|
{
|
|
607
743
|
icon: Package,
|
|
608
744
|
label: "\u9053\u5177",
|
|
745
|
+
group: "props",
|
|
609
746
|
emptyText: "\u5C1A\u65E0\u9053\u5177",
|
|
747
|
+
sort: assetSort,
|
|
610
748
|
items: (data.props ?? []).map((p) => {
|
|
611
749
|
const id = (p.prop_id ?? "").trim();
|
|
612
750
|
return { id, name: getPropDisplayName(p), importance: p.importance, count: counts.props.get(id) ?? 0 };
|
|
@@ -644,18 +782,21 @@ function TocLabel({ text, className }) {
|
|
|
644
782
|
function EntityGroup({
|
|
645
783
|
icon: Icon,
|
|
646
784
|
label,
|
|
785
|
+
group,
|
|
647
786
|
emptyText,
|
|
648
787
|
items,
|
|
788
|
+
sort,
|
|
649
789
|
highlighted,
|
|
650
790
|
isActive,
|
|
651
791
|
onPick
|
|
652
792
|
}) {
|
|
653
793
|
const [open, setOpen] = useState(true);
|
|
654
794
|
const [bgOpen, setBgOpen] = useState(false);
|
|
655
|
-
const
|
|
795
|
+
const cmp = sort ?? defaultAssetSort;
|
|
796
|
+
const byCmp = (a, b) => cmp({ group, ...a }, { group, ...b });
|
|
656
797
|
const valid = items.filter((i) => i.id);
|
|
657
|
-
const featured = valid.filter((i) => i.importance !== "background").sort(
|
|
658
|
-
const background = valid.filter((i) => i.importance === "background").sort(
|
|
798
|
+
const featured = valid.filter((i) => i.importance !== "background").sort(byCmp);
|
|
799
|
+
const background = valid.filter((i) => i.importance === "background").sort(byCmp);
|
|
659
800
|
const row = (i, bg = false) => /* @__PURE__ */ jsxs(
|
|
660
801
|
"button",
|
|
661
802
|
{
|
|
@@ -2870,133 +3011,6 @@ function SceneEditorImpl({
|
|
|
2870
3011
|
}
|
|
2871
3012
|
var SceneEditor = memo(SceneEditorImpl);
|
|
2872
3013
|
|
|
2873
|
-
// src/stream/flat-items.ts
|
|
2874
|
-
var SCENE_KEY = (e, s) => `ep:${e}:sc:${s}`;
|
|
2875
|
-
var SCENE_ID_KEY = (e, id) => `ep:${e}:id:${id}`;
|
|
2876
|
-
var ASSET_KEY = (g, id) => `${g}:${id}`;
|
|
2877
|
-
function safeId(raw, fallback) {
|
|
2878
|
-
const t = (raw ?? "").toString().trim();
|
|
2879
|
-
return t.length > 0 ? t : fallback;
|
|
2880
|
-
}
|
|
2881
|
-
var GROUP_LABEL = { actors: "\u89D2\u8272", locations: "\u573A\u666F", props: "\u9053\u5177" };
|
|
2882
|
-
var assetGroupLabel = (g) => GROUP_LABEL[g];
|
|
2883
|
-
function buildFlatStream(data, opts = {}) {
|
|
2884
|
-
const includeAssets = opts.includeAssets ?? true;
|
|
2885
|
-
const items = [];
|
|
2886
|
-
const indexByKey = /* @__PURE__ */ new Map();
|
|
2887
|
-
const sceneIndexLookup = /* @__PURE__ */ new Map();
|
|
2888
|
-
const sceneIdLookup = /* @__PURE__ */ new Map();
|
|
2889
|
-
const assetIndexLookup = /* @__PURE__ */ new Map();
|
|
2890
|
-
const push = (item) => {
|
|
2891
|
-
indexByKey.set(item.key, items.length);
|
|
2892
|
-
if (item.kind === "scene") {
|
|
2893
|
-
sceneIndexLookup.set(SCENE_KEY(item.episodeIdx, item.sceneIdx), items.length);
|
|
2894
|
-
sceneIdLookup.set(SCENE_ID_KEY(item.episodeIdx, item.sceneId), items.length);
|
|
2895
|
-
}
|
|
2896
|
-
if (item.kind === "asset-card") assetIndexLookup.set(ASSET_KEY(item.group, item.assetId), items.length);
|
|
2897
|
-
items.push(item);
|
|
2898
|
-
};
|
|
2899
|
-
if (!data) {
|
|
2900
|
-
return { items, indexByKey, sceneIndexLookup, sceneIdLookup, assetIndexLookup, paperStartKey: null, paperEndKey: null };
|
|
2901
|
-
}
|
|
2902
|
-
let paperStartKey = null;
|
|
2903
|
-
let paperEndKey = null;
|
|
2904
|
-
(data.episodes ?? []).forEach((episode, ei) => {
|
|
2905
|
-
const headerKey = `ep:${ei}:header`;
|
|
2906
|
-
push({ key: headerKey, kind: "episode-header", episodeIdx: ei });
|
|
2907
|
-
if (paperStartKey === null) paperStartKey = headerKey;
|
|
2908
|
-
paperEndKey = headerKey;
|
|
2909
|
-
const scenes = episode.scenes ?? [];
|
|
2910
|
-
if (scenes.length === 0) {
|
|
2911
|
-
const emptyKey = `ep:${ei}:empty`;
|
|
2912
|
-
push({ key: emptyKey, kind: "episode-empty", episodeIdx: ei });
|
|
2913
|
-
paperEndKey = emptyKey;
|
|
2914
|
-
} else {
|
|
2915
|
-
scenes.forEach((scene, si) => {
|
|
2916
|
-
const sceneId = safeId(scene.scene_id, `__idx:${si}`);
|
|
2917
|
-
const key = `sc:ep${ei}:sc${si}:${sceneId}`;
|
|
2918
|
-
push({
|
|
2919
|
-
key,
|
|
2920
|
-
kind: "scene",
|
|
2921
|
-
episodeIdx: ei,
|
|
2922
|
-
sceneIdx: si,
|
|
2923
|
-
sceneId,
|
|
2924
|
-
isStart: si === 0,
|
|
2925
|
-
isEnd: si === scenes.length - 1
|
|
2926
|
-
});
|
|
2927
|
-
paperEndKey = key;
|
|
2928
|
-
});
|
|
2929
|
-
}
|
|
2930
|
-
});
|
|
2931
|
-
push({ key: "add-episode", kind: "add-episode" });
|
|
2932
|
-
if (includeAssets) {
|
|
2933
|
-
const specs = [
|
|
2934
|
-
{ group: "actors", ids: (data.actors ?? []).map((a, i) => safeId(a.actor_id, `__idx:${i}`)) },
|
|
2935
|
-
{ group: "locations", ids: (data.locations ?? []).map((l, i) => safeId(l.location_id, `__idx:${i}`)) },
|
|
2936
|
-
{ group: "props", ids: (data.props ?? []).map((p, i) => safeId(p.prop_id, `__idx:${i}`)) }
|
|
2937
|
-
];
|
|
2938
|
-
if (opts.assetSort) {
|
|
2939
|
-
const counts = countAssetAppearances(data);
|
|
2940
|
-
const actorMap = getActorMap(data.actors ?? []);
|
|
2941
|
-
const locationMap = getLocationMap(data.locations ?? []);
|
|
2942
|
-
const propMap = getPropMap(data.props ?? []);
|
|
2943
|
-
const enrich = (group, id) => {
|
|
2944
|
-
if (group === "actors") return { group, id, name: getActorDisplayName(actorMap.get(id)) || id, importance: actorMap.get(id)?.importance, count: counts.actors.get(id) ?? 0 };
|
|
2945
|
-
if (group === "locations") return { group, id, name: getLocationDisplayName(locationMap.get(id)) || id, importance: locationMap.get(id)?.importance, count: counts.locations.get(id) ?? 0 };
|
|
2946
|
-
return { group, id, name: getPropDisplayName(propMap.get(id)) || id, importance: propMap.get(id)?.importance, count: counts.props.get(id) ?? 0 };
|
|
2947
|
-
};
|
|
2948
|
-
for (const spec of specs) {
|
|
2949
|
-
spec.ids = spec.ids.map((id) => enrich(spec.group, id)).sort(opts.assetSort).map((it) => it.id);
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
|
-
for (const { group, ids } of specs) {
|
|
2953
|
-
push({ key: `asset-group:${group}`, kind: "asset-group-header", group });
|
|
2954
|
-
ids.forEach((assetId) => push({ key: `asset:${group}:${assetId}`, kind: "asset-card", group, assetId }));
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
return { items, indexByKey, sceneIndexLookup, sceneIdLookup, assetIndexLookup, paperStartKey, paperEndKey };
|
|
2958
|
-
}
|
|
2959
|
-
function selectionToFlatIndex(stream, sel) {
|
|
2960
|
-
switch (sel.kind) {
|
|
2961
|
-
case "episode":
|
|
2962
|
-
return stream.indexByKey.get(`ep:${sel.episodeIdx}:header`) ?? null;
|
|
2963
|
-
case "scene":
|
|
2964
|
-
return stream.sceneIndexLookup.get(SCENE_KEY(sel.episodeIdx, sel.sceneIdx)) ?? null;
|
|
2965
|
-
case "clip": {
|
|
2966
|
-
if (sel.sceneIdx !== void 0) {
|
|
2967
|
-
const byIdx = stream.sceneIndexLookup.get(SCENE_KEY(sel.episodeIdx, sel.sceneIdx));
|
|
2968
|
-
if (byIdx !== void 0) return byIdx;
|
|
2969
|
-
}
|
|
2970
|
-
const id = (sel.sceneId ?? "").trim();
|
|
2971
|
-
return id ? stream.sceneIdLookup.get(SCENE_ID_KEY(sel.episodeIdx, id)) ?? null : null;
|
|
2972
|
-
}
|
|
2973
|
-
case "actor":
|
|
2974
|
-
return stream.assetIndexLookup.get(ASSET_KEY("actors", sel.actorId)) ?? null;
|
|
2975
|
-
case "location":
|
|
2976
|
-
return stream.assetIndexLookup.get(ASSET_KEY("locations", sel.locationId)) ?? null;
|
|
2977
|
-
case "prop":
|
|
2978
|
-
return stream.assetIndexLookup.get(ASSET_KEY("props", sel.propId)) ?? null;
|
|
2979
|
-
default:
|
|
2980
|
-
return null;
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
function flatIndexToSelection(stream, idx) {
|
|
2984
|
-
const item = stream.items[idx];
|
|
2985
|
-
if (!item) return null;
|
|
2986
|
-
switch (item.kind) {
|
|
2987
|
-
case "episode-header":
|
|
2988
|
-
return { kind: "episode", episodeIdx: item.episodeIdx };
|
|
2989
|
-
case "scene":
|
|
2990
|
-
return { kind: "scene", episodeIdx: item.episodeIdx, sceneIdx: item.sceneIdx };
|
|
2991
|
-
case "asset-card":
|
|
2992
|
-
if (item.group === "actors") return { kind: "actor", actorId: item.assetId };
|
|
2993
|
-
if (item.group === "locations") return { kind: "location", locationId: item.assetId };
|
|
2994
|
-
return { kind: "prop", propId: item.assetId };
|
|
2995
|
-
default:
|
|
2996
|
-
return null;
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3000
3014
|
// src/mutations/entity-mutations.ts
|
|
3001
3015
|
var ID_FIELD = {
|
|
3002
3016
|
actor: "actor_id",
|
|
@@ -4864,7 +4878,8 @@ function ScriptEditor({
|
|
|
4864
4878
|
data: value,
|
|
4865
4879
|
selection,
|
|
4866
4880
|
onSelect: setSelection,
|
|
4867
|
-
onAddEpisode: disabled ? void 0 : () => onEdit((p) => addEpisode(p))
|
|
4881
|
+
onAddEpisode: disabled ? void 0 : () => onEdit((p) => addEpisode(p)),
|
|
4882
|
+
assetSort
|
|
4868
4883
|
}
|
|
4869
4884
|
) : null,
|
|
4870
4885
|
/* @__PURE__ */ jsxs("div", { className: "lj-se-main", children: [
|
|
@@ -5117,6 +5132,6 @@ function DeleteConfirmButton({
|
|
|
5117
5132
|
);
|
|
5118
5133
|
}
|
|
5119
5134
|
|
|
5120
|
-
export { DeleteConfirmButton, EMPTY_SELECTION, EditableText, Popover, ScriptContentType, ScriptEditor, SelectField, acceptActionIntoBaseline, acceptSceneIntoBaseline, applyActionAccept, applyActionReject, buildActionDiff, buildDiffFromBaseline, buildScriptNav, buildSelectionFrom, changeSetToDiffScenes, computeChangeSet, computeSceneActionDiff, countAssetAppearances, findBaselineScene, formatTimestamp, fromToSelection, getActorCueVar, getActorMap, getEpisodeTitle, getLocationMap, getPropMap, getSceneContext, getSelectionEpisodeIdx, getSpeakerMap, isClipSelected, isEpisodeOpen, isSameSelectionTarget, isSceneSelected, mutations_exports as mutations, rejectActionToBaseline, rejectSceneToBaseline, sceneChangeKey, selectionFromScriptReference, selectionTargetKey, withOrigin };
|
|
5135
|
+
export { DeleteConfirmButton, EMPTY_SELECTION, EditableText, Popover, ScriptContentType, ScriptEditor, SelectField, acceptActionIntoBaseline, acceptSceneIntoBaseline, applyActionAccept, applyActionReject, buildActionDiff, buildDiffFromBaseline, buildScriptNav, buildSelectionFrom, changeSetToDiffScenes, computeChangeSet, computeSceneActionDiff, countAssetAppearances, defaultAssetSort, findBaselineScene, formatTimestamp, fromToSelection, getActorCueVar, getActorMap, getEpisodeTitle, getLocationMap, getPropMap, getSceneContext, getSelectionEpisodeIdx, getSpeakerMap, isClipSelected, isEpisodeOpen, isSameSelectionTarget, isSceneSelected, mutations_exports as mutations, rejectActionToBaseline, rejectSceneToBaseline, sceneChangeKey, selectionFromScriptReference, selectionTargetKey, withOrigin };
|
|
5121
5136
|
//# sourceMappingURL=index.js.map
|
|
5122
5137
|
//# sourceMappingURL=index.js.map
|