astro-tractstack 2.0.29 → 2.0.31
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/package.json +1 -1
- package/templates/src/components/compositor/Compositor.tsx +8 -0
- package/templates/src/components/compositor/nodes/Pane_DesignLibrary.tsx +169 -48
- package/templates/src/components/compositor/nodes/Pane_eraser.tsx +153 -36
- package/templates/src/components/edit/pane/AddPanePanel_new.tsx +323 -77
- package/templates/src/components/edit/pane/steps/CopyInputStep.tsx +82 -9
- package/templates/src/components/edit/pane/steps/DirectInjectStep.tsx +41 -21
- package/templates/src/components/edit/state/SaveToLibraryModal.tsx +68 -34
- package/templates/src/constants/prompts.json +65 -36
- package/templates/src/constants.ts +3 -3
- package/templates/src/stores/nodes.ts +27 -4
- package/templates/src/types/compositorTypes.ts +3 -0
- package/templates/src/types/tractstack.ts +2 -0
- package/templates/src/utils/auth.ts +6 -3
- package/templates/src/utils/compositor/designLibraryHelper.ts +8 -3
- package/templates/src/utils/compositor/typeGuards.ts +0 -18
|
@@ -78,7 +78,8 @@ export function getUserRole(astro: any): 'admin' | 'editor' | null {
|
|
|
78
78
|
*/
|
|
79
79
|
export function requireAdmin(astro: any): Response | undefined {
|
|
80
80
|
if (!isAdmin(astro)) {
|
|
81
|
-
|
|
81
|
+
const target = encodeURIComponent(astro.url.pathname + astro.url.search);
|
|
82
|
+
return astro.redirect(`/storykeep/login?redirect=${target}`);
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -88,7 +89,8 @@ export function requireAdmin(astro: any): Response | undefined {
|
|
|
88
89
|
*/
|
|
89
90
|
export function requireEditor(astro: any): Response | undefined {
|
|
90
91
|
if (!isEditor(astro)) {
|
|
91
|
-
|
|
92
|
+
const target = encodeURIComponent(astro.url.pathname + astro.url.search);
|
|
93
|
+
return astro.redirect(`/storykeep/login?redirect=${target}`);
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -98,7 +100,8 @@ export function requireEditor(astro: any): Response | undefined {
|
|
|
98
100
|
*/
|
|
99
101
|
export function requireAdminOrEditor(astro: any): Response | undefined {
|
|
100
102
|
if (!isAuthenticated(astro)) {
|
|
101
|
-
|
|
103
|
+
const target = encodeURIComponent(astro.url.pathname + astro.url.search);
|
|
104
|
+
return astro.redirect(`/storykeep/login?redirect=${target}`);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -62,7 +62,7 @@ function convertLiveNodeToStorageNode(
|
|
|
62
62
|
fileId: copyMode === 'retain' ? node.fileId : undefined,
|
|
63
63
|
buttonPayload: copyMode === 'retain' ? node.buttonPayload : undefined,
|
|
64
64
|
codeHookParams: copyMode === 'retain' ? node.codeHookParams : undefined,
|
|
65
|
-
|
|
65
|
+
copy: copyMode === 'retain' ? node.copy : undefined,
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const childIds = ctx.getChildNodeIDs(node.id);
|
|
@@ -500,7 +500,8 @@ function convertLivePaneToStoragePane(
|
|
|
500
500
|
: [],
|
|
501
501
|
};
|
|
502
502
|
} else if (gridLayoutNode) {
|
|
503
|
-
const { id, parentId, isChanged, ...restOfGrid } =
|
|
503
|
+
const { id, parentId, isChanged, parentCss, gridCss, ...restOfGrid } =
|
|
504
|
+
gridLayoutNode;
|
|
504
505
|
storageGridLayout = {
|
|
505
506
|
...restOfGrid,
|
|
506
507
|
nodes: ctx
|
|
@@ -517,6 +518,7 @@ function convertLivePaneToStoragePane(
|
|
|
517
518
|
isChanged,
|
|
518
519
|
markdownId,
|
|
519
520
|
parentCss,
|
|
521
|
+
gridCss,
|
|
520
522
|
...restOfColumn
|
|
521
523
|
} = columnNode;
|
|
522
524
|
|
|
@@ -584,10 +586,11 @@ export async function savePaneToLibrary(
|
|
|
584
586
|
title: string;
|
|
585
587
|
category: string;
|
|
586
588
|
copyMode: CopyMode;
|
|
589
|
+
locked?: boolean;
|
|
587
590
|
}
|
|
588
591
|
): Promise<BrandConfigState | null> {
|
|
589
592
|
const ctx = getCtx();
|
|
590
|
-
const { title, category, copyMode } = formData;
|
|
593
|
+
const { title, category, copyMode, locked } = formData;
|
|
591
594
|
|
|
592
595
|
const newStoragePane = convertLivePaneToStoragePane(paneId, ctx, {
|
|
593
596
|
title,
|
|
@@ -613,6 +616,8 @@ export async function savePaneToLibrary(
|
|
|
613
616
|
title: title,
|
|
614
617
|
markdownCount: actualMarkdownCount,
|
|
615
618
|
template: newStoragePane,
|
|
619
|
+
retain: copyMode === 'retain',
|
|
620
|
+
locked: !!locked,
|
|
616
621
|
};
|
|
617
622
|
|
|
618
623
|
const currentState: BrandConfigState = convertToLocalState(config);
|
|
@@ -93,24 +93,6 @@ export const isMarkdownPaneFragmentNode = (
|
|
|
93
93
|
);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface WidgetNode extends FlatNode {
|
|
97
|
-
tagName: 'code';
|
|
98
|
-
codeHookParams: (string | string[])[];
|
|
99
|
-
copy: string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const isWidgetNode = (
|
|
103
|
-
node: BaseNode | FlatNode | null
|
|
104
|
-
): node is WidgetNode => {
|
|
105
|
-
return (
|
|
106
|
-
node !== null &&
|
|
107
|
-
'tagName' in node &&
|
|
108
|
-
node.tagName === 'code' &&
|
|
109
|
-
'codeHookParams' in node &&
|
|
110
|
-
Array.isArray(node.codeHookParams)
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
96
|
export function hasTagName(
|
|
115
97
|
node: BaseNode | null | undefined
|
|
116
98
|
): node is FlatNode {
|