astro-tractstack 2.1.2 → 2.2.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/README.md +54 -266
- package/bin/create-tractstack.js +9 -6
- package/dist/index.js +109 -71
- package/package.json +4 -2
- package/templates/css/custom.css +5 -0
- package/templates/custom/minimal/CodeHook.astro +1 -0
- package/templates/custom/with-examples/CodeHook.astro +1 -0
- package/templates/icons/code.svg +18 -0
- package/templates/icons/li.svg +4 -0
- package/templates/icons/link.svg +22 -0
- package/templates/icons/p.svg +3 -0
- package/templates/src/client/app.js +80 -1
- package/templates/src/components/Footer.astro +1 -1
- package/templates/src/components/codehooks/BunnyVideoSetup.tsx +6 -6
- package/templates/src/components/codehooks/EpinetDurationSelector.tsx +3 -3
- package/templates/src/components/codehooks/FeaturedArticleSetup.tsx +1 -1
- package/templates/src/components/codehooks/ListContentSetup.tsx +2 -2
- package/templates/src/components/codehooks/ProductCardSetup.tsx +1 -1
- package/templates/src/components/codehooks/ProductGridSetup.tsx +2 -2
- package/templates/src/components/codehooks/SandboxRegisterForm.tsx +3 -3
- package/templates/src/components/compositor/Compositor.tsx +25 -9
- package/templates/src/components/compositor/Node.tsx +168 -496
- package/templates/src/components/compositor/PanelVisibilityWrapper.tsx +1 -0
- package/templates/src/components/compositor/elements/SignUp.tsx +1 -1
- package/templates/src/components/compositor/elements/YouTubeWrapper.tsx +2 -0
- package/templates/src/components/compositor/nodes/CreativePane.tsx +262 -0
- package/templates/src/components/compositor/nodes/GhostInsertBlock.tsx +4 -6
- package/templates/src/components/compositor/nodes/GridLayout.tsx +4 -2
- package/templates/src/components/compositor/nodes/Markdown.tsx +18 -3
- package/templates/src/components/compositor/nodes/Pane.tsx +11 -5
- package/templates/src/components/compositor/nodes/RenderChildren.tsx +1 -1
- package/templates/src/components/compositor/nodes/tagElements/NodeAnchorComponent.tsx +5 -5
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag.tsx +90 -42
- package/templates/src/components/compositor/nodes/tagElements/NodeImg.tsx +2 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeText.tsx +27 -1
- package/templates/src/components/compositor/preview/PaneSnapshotGenerator.tsx +10 -8
- package/templates/src/components/compositor/tools/NodeOverlay.tsx +224 -0
- package/templates/src/components/compositor/tools/PaneOverlay.tsx +122 -0
- package/templates/src/components/edit/Header.tsx +68 -9
- package/templates/src/components/edit/PanelSwitch.tsx +42 -4
- package/templates/src/components/edit/SettingsPanel.tsx +2 -3
- package/templates/src/components/edit/ToolMode.tsx +1 -31
- package/templates/src/components/edit/pane/AddPanePanel_break.tsx +2 -2
- package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +1 -1
- package/templates/src/components/edit/pane/AddPanePanel_new.tsx +193 -659
- package/templates/src/components/edit/pane/AddPanePanel_reuse.tsx +15 -82
- package/templates/src/components/edit/pane/AiRestylePaneModal.tsx +95 -45
- package/templates/src/components/edit/pane/ConfigPanePanel.tsx +137 -49
- package/templates/src/components/edit/pane/RestylePaneModal.tsx +1 -1
- package/templates/src/components/edit/pane/steps/AiCreativeDesignStep.tsx +375 -0
- package/templates/src/components/edit/pane/steps/AiDesignStep.tsx +1 -23
- package/templates/src/components/edit/pane/steps/AiLibraryCopyStep.tsx +327 -0
- package/templates/src/components/edit/pane/steps/AiRefineDesignStep.tsx +267 -0
- package/templates/src/components/edit/pane/steps/AiStandardDesignStep.tsx +371 -0
- package/templates/src/components/edit/pane/steps/CopyInputStep.tsx +201 -76
- package/templates/src/components/edit/pane/steps/CreativeInjectStep.tsx +141 -0
- package/templates/src/components/edit/panels/CreativeImagePanel.tsx +435 -0
- package/templates/src/components/edit/panels/CreativeLinkPanel.tsx +110 -0
- package/templates/src/components/edit/panels/StyleCodeHookPanel.tsx +1 -1
- package/templates/src/components/edit/panels/StyleParentPanel.tsx +118 -126
- package/templates/src/components/edit/panels/StyleParentPanel_add.tsx +3 -2
- package/templates/src/components/edit/panels/StyleParentPanel_deleteLayer.tsx +1 -0
- package/templates/src/components/edit/panels/StyleParentPanel_remove.tsx +3 -1
- package/templates/src/components/edit/panels/StyleParentPanel_update.tsx +3 -1
- package/templates/src/components/edit/panels/StyleWidgetPanel.tsx +1 -1
- package/templates/src/components/edit/state/SaveModal.tsx +19 -787
- package/templates/src/components/edit/state/SaveToLibraryModal.tsx +2 -2
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_menu.tsx +1 -1
- package/templates/src/components/edit/widgets/BunnyWidget.tsx +5 -5
- package/templates/src/components/edit/widgets/InteractiveDisclosureWidget.tsx +1 -1
- package/templates/src/components/edit/widgets/SignupWidget.tsx +1 -1
- package/templates/src/components/fields/ActionBuilderTimeSelector.tsx +1 -1
- package/templates/src/components/fields/ArtpackImage.tsx +11 -3
- package/templates/src/components/fields/BackgroundImage.tsx +8 -0
- package/templates/src/components/fields/BackgroundImageWrapper.tsx +15 -9
- package/templates/src/components/fields/ImageUpload.tsx +6 -0
- package/templates/src/components/form/ActionBuilderField.tsx +15 -5
- package/templates/src/components/form/ActionBuilderSlugSelector.tsx +1 -1
- package/templates/src/components/form/ColorPicker.tsx +1 -1
- package/templates/src/components/form/EnumSelect.tsx +1 -1
- package/templates/src/components/form/NumberInput.tsx +1 -1
- package/templates/src/components/form/StringArrayInput.tsx +1 -1
- package/templates/src/components/form/StringInput.tsx +1 -1
- package/templates/src/components/form/UnsavedChangesBar.tsx +1 -1
- package/templates/src/components/form/advanced/APIConfigSection.tsx +2 -2
- package/templates/src/components/form/advanced/AuthConfigSection.tsx +2 -2
- package/templates/src/components/profile/ProfileCreate.tsx +1 -1
- package/templates/src/components/profile/ProfileEdit.tsx +1 -1
- package/templates/src/components/storykeep/Dashboard_Advanced.tsx +2 -2
- package/templates/src/components/storykeep/controls/content/BeliefForm.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/ContentSummary.tsx +2 -2
- package/templates/src/components/storykeep/controls/content/KnownResourceTable.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/ManageContent.tsx +6 -6
- package/templates/src/components/storykeep/controls/content/MenuForm.tsx +1 -1
- package/templates/src/components/storykeep/controls/content/PaneTable.tsx +358 -0
- package/templates/src/components/storykeep/controls/content/ResourceTable.tsx +1 -1
- package/templates/src/constants/prompts.json +18 -10
- package/templates/src/constants.ts +3 -0
- package/templates/src/hooks/usePaneFragments.ts +60 -0
- package/templates/src/lib/session.ts +71 -16
- package/templates/src/pages/[...slug].astro +5 -46
- package/templates/src/pages/api/css.ts +149 -0
- package/templates/src/pages/context/[...contextSlug].astro +1 -0
- package/templates/src/pages/maint.astro +1 -1
- package/templates/src/pages/storykeep/login.astro +2 -2
- package/templates/src/stores/nodes.ts +162 -49
- package/templates/src/stores/orphanAnalysis.ts +6 -30
- package/templates/src/stores/previews.ts +7 -0
- package/templates/src/stores/storykeep.ts +0 -8
- package/templates/src/types/compositorTypes.ts +53 -10
- package/templates/src/utils/compositor/aiGeneration.ts +93 -0
- package/templates/src/utils/compositor/allowInsert.ts +2 -0
- package/templates/src/utils/compositor/htmlAst.ts +704 -0
- package/templates/src/utils/compositor/nodesHelper.ts +281 -102
- package/templates/src/utils/compositor/savePipeline.ts +893 -0
- package/templates/src/utils/etl/index.ts +3 -0
- package/templates/src/utils/etl/transformer.ts +10 -0
- package/templates/src/utils/helpers.ts +101 -0
- package/utils/inject-files.ts +100 -62
- package/templates/icons/text.svg +0 -6
- package/templates/src/components/compositor/NodeWithGuid.tsx +0 -69
- package/templates/src/components/compositor/nodes/GridLayout_eraser.tsx +0 -33
- package/templates/src/components/compositor/nodes/Markdown_eraser.tsx +0 -56
- package/templates/src/components/compositor/nodes/Pane_DesignLibrary.tsx +0 -269
- package/templates/src/components/compositor/nodes/Pane_eraser.tsx +0 -186
- package/templates/src/components/compositor/nodes/Pane_layout.tsx +0 -79
- package/templates/src/components/compositor/nodes/tagElements/NodeA_eraser.tsx +0 -26
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_eraser.tsx +0 -61
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_insert.tsx +0 -120
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_settings.tsx +0 -62
- package/templates/src/components/compositor/nodes/tagElements/NodeButton_eraser.tsx +0 -26
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { getCtx } from '@/stores/nodes';
|
|
2
|
-
import { viewportKeyStore } from '@/stores/storykeep';
|
|
3
|
-
import { RenderChildren } from '../RenderChildren';
|
|
4
|
-
import type { NodeProps } from '@/types/nodeProps';
|
|
5
|
-
import { tagTitles } from '@/types/compositorTypes';
|
|
6
|
-
import { getTemplateNode } from '@/utils/compositor/nodesHelper';
|
|
7
|
-
import { type JSX, type MouseEvent } from 'react';
|
|
8
|
-
|
|
9
|
-
type NodeTagProps = NodeProps & { tagName: keyof JSX.IntrinsicElements };
|
|
10
|
-
|
|
11
|
-
export const NodeBasicTagInsert = (props: NodeTagProps) => {
|
|
12
|
-
const { value: toolAddMode } = getCtx(props).toolAddModeStore.get();
|
|
13
|
-
const nodeId = props.nodeId;
|
|
14
|
-
const { allowInsertBefore, allowInsertAfter } =
|
|
15
|
-
props.tagName !== 'li'
|
|
16
|
-
? getCtx(props).allowInsert(nodeId, toolAddMode)
|
|
17
|
-
: getCtx(props).allowInsertLi(nodeId, toolAddMode);
|
|
18
|
-
const children = getCtx(props).getChildNodeIDs(props.nodeId);
|
|
19
|
-
|
|
20
|
-
const Tag = props.tagName;
|
|
21
|
-
const newTagTitle = tagTitles[toolAddMode];
|
|
22
|
-
|
|
23
|
-
const handleInsertAbove = (e: MouseEvent) => {
|
|
24
|
-
e.stopPropagation();
|
|
25
|
-
const templateNode = getTemplateNode(
|
|
26
|
-
getCtx(props).toolAddModeStore.get().value
|
|
27
|
-
);
|
|
28
|
-
const newNodeId = getCtx(props).addTemplateNode(
|
|
29
|
-
props.nodeId,
|
|
30
|
-
templateNode,
|
|
31
|
-
props.nodeId,
|
|
32
|
-
'before'
|
|
33
|
-
);
|
|
34
|
-
if (newNodeId && templateNode.tagName)
|
|
35
|
-
handleInsertSignal(templateNode.tagName, newNodeId);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const handleInsertBelow = (e: MouseEvent) => {
|
|
39
|
-
e.stopPropagation();
|
|
40
|
-
const templateNode = getTemplateNode(
|
|
41
|
-
getCtx(props).toolAddModeStore.get().value
|
|
42
|
-
);
|
|
43
|
-
const newNodeId = getCtx(props).addTemplateNode(
|
|
44
|
-
props.nodeId,
|
|
45
|
-
templateNode,
|
|
46
|
-
props.nodeId,
|
|
47
|
-
'after'
|
|
48
|
-
);
|
|
49
|
-
if (newNodeId && templateNode.tagName)
|
|
50
|
-
handleInsertSignal(templateNode.tagName, newNodeId);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleInsertSignal = (tagName: string, nodeId: string) => {
|
|
54
|
-
getCtx(props).handleInsertSignal(tagName, nodeId);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const handleClickIntercept = (e: MouseEvent) => {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
e.stopPropagation();
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const InsertButtons = () => (
|
|
63
|
-
<div
|
|
64
|
-
className={`absolute left-2 top-2 z-10 flex items-center gap-2 transition-opacity`}
|
|
65
|
-
>
|
|
66
|
-
{(allowInsertBefore || allowInsertAfter) && (
|
|
67
|
-
<div className="rounded-full bg-gray-200 px-2 py-1 text-sm text-gray-800">
|
|
68
|
-
Insert {newTagTitle}
|
|
69
|
-
</div>
|
|
70
|
-
)}
|
|
71
|
-
{allowInsertBefore && (
|
|
72
|
-
<button
|
|
73
|
-
onClick={handleInsertAbove}
|
|
74
|
-
className="z-10 rounded bg-white px-2 py-1 text-sm text-cyan-700 shadow-sm transition-colors hover:bg-cyan-700 hover:text-white focus:bg-cyan-700 focus:text-white"
|
|
75
|
-
>
|
|
76
|
-
+ Above
|
|
77
|
-
</button>
|
|
78
|
-
)}
|
|
79
|
-
{allowInsertAfter && (
|
|
80
|
-
<button
|
|
81
|
-
onClick={handleInsertBelow}
|
|
82
|
-
className="z-10 rounded bg-white px-2 py-1 text-sm text-cyan-700 shadow-sm transition-colors hover:bg-cyan-700 hover:text-white focus:bg-cyan-700 focus:text-white"
|
|
83
|
-
>
|
|
84
|
-
+ Below
|
|
85
|
-
</button>
|
|
86
|
-
)}
|
|
87
|
-
{!allowInsertBefore && !allowInsertAfter && (
|
|
88
|
-
<button
|
|
89
|
-
className="rounded bg-white px-2 py-1 text-sm text-cyan-700 opacity-50 shadow-sm transition-colors"
|
|
90
|
-
disabled={true}
|
|
91
|
-
>
|
|
92
|
-
+ Can't Insert {newTagTitle} Here
|
|
93
|
-
</button>
|
|
94
|
-
)}
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div className="group relative">
|
|
100
|
-
<div className="relative">
|
|
101
|
-
{/* Click interceptor layer */}
|
|
102
|
-
<div
|
|
103
|
-
className="absolute inset-0 z-10"
|
|
104
|
-
onClick={handleClickIntercept}
|
|
105
|
-
onMouseDown={handleClickIntercept}
|
|
106
|
-
onMouseUp={handleClickIntercept}
|
|
107
|
-
/>
|
|
108
|
-
<div className="absolute inset-0">
|
|
109
|
-
<div className="h-full w-full opacity-50 mix-blend-difference outline-dashed outline-4 outline-cyan-600 group-focus-within:opacity-100 group-hover:opacity-100" />
|
|
110
|
-
</div>
|
|
111
|
-
<InsertButtons />
|
|
112
|
-
<Tag
|
|
113
|
-
className={`${getCtx(props).getNodeClasses(nodeId, viewportKeyStore.get().value)} pt-12`}
|
|
114
|
-
>
|
|
115
|
-
<RenderChildren children={children} nodeProps={props} />
|
|
116
|
-
</Tag>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { type JSX } from 'react';
|
|
2
|
-
import ArrowDownIcon from '@heroicons/react/24/outline/ArrowDownIcon';
|
|
3
|
-
import ArrowUpIcon from '@heroicons/react/24/outline/ArrowUpIcon';
|
|
4
|
-
import { getCtx } from '@/stores/nodes';
|
|
5
|
-
import { viewportKeyStore } from '@/stores/storykeep';
|
|
6
|
-
import { RenderChildren } from '../RenderChildren';
|
|
7
|
-
import type { FlatNode } from '@/types/compositorTypes';
|
|
8
|
-
import type { NodeProps } from '@/types/nodeProps';
|
|
9
|
-
|
|
10
|
-
type NodeTagProps = NodeProps & { tagName: keyof JSX.IntrinsicElements };
|
|
11
|
-
|
|
12
|
-
export const NodeBasicTagSettings = (props: NodeTagProps) => {
|
|
13
|
-
const nodeId = props.nodeId;
|
|
14
|
-
const node = getCtx(props).allNodes.get().get(nodeId) as FlatNode;
|
|
15
|
-
const children = getCtx(props).getChildNodeIDs(props.nodeId);
|
|
16
|
-
const Tag = props.tagName;
|
|
17
|
-
|
|
18
|
-
const canMove = (/*direction: "before" | "after"*/): boolean => {
|
|
19
|
-
// only block level can move
|
|
20
|
-
if (node.tagName === 'li') {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const SettingsButtons = () => (
|
|
27
|
-
<div
|
|
28
|
-
className={`absolute left-2 top-2 z-10 flex items-center gap-2 transition-opacity`}
|
|
29
|
-
>
|
|
30
|
-
{canMove(/*"after"*/) && (
|
|
31
|
-
<button onClick={() => getCtx().moveNode(nodeId, 'after')}>
|
|
32
|
-
<div className="inline-flex items-center rounded-b-md bg-gray-200 px-2 py-1 text-sm text-gray-800">
|
|
33
|
-
<ArrowDownIcon className="mr-1 h-6 w-6" />
|
|
34
|
-
</div>
|
|
35
|
-
</button>
|
|
36
|
-
)}
|
|
37
|
-
{canMove(/*"before"*/) && (
|
|
38
|
-
<button onClick={() => getCtx().moveNode(nodeId, 'before')}>
|
|
39
|
-
<div className="inline-flex items-center rounded-b-md bg-gray-200 px-2 py-1 text-sm text-gray-800">
|
|
40
|
-
<ArrowUpIcon className="mr-1 h-6 w-6" />
|
|
41
|
-
</div>
|
|
42
|
-
</button>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<div className="group relative">
|
|
49
|
-
<div className="relative">
|
|
50
|
-
<div className="absolute inset-0">
|
|
51
|
-
<div className="h-full w-full opacity-50 outline-dashed outline-4 outline-cyan-600 group-focus-within:opacity-100 group-hover:opacity-100" />
|
|
52
|
-
</div>
|
|
53
|
-
<SettingsButtons />
|
|
54
|
-
<Tag
|
|
55
|
-
className={`${getCtx(props).getNodeClasses(nodeId, viewportKeyStore.get().value)} pt-12`}
|
|
56
|
-
>
|
|
57
|
-
<RenderChildren children={children} nodeProps={props} />
|
|
58
|
-
</Tag>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import TrashIcon from '@heroicons/react/24/outline/TrashIcon';
|
|
2
|
-
import { getCtx } from '@/stores/nodes';
|
|
3
|
-
import { viewportKeyStore } from '@/stores/storykeep';
|
|
4
|
-
import { RenderChildren } from '../RenderChildren';
|
|
5
|
-
import type { NodeProps } from '@/types/nodeProps';
|
|
6
|
-
|
|
7
|
-
export const NodeButtonEraser = (props: NodeProps) => {
|
|
8
|
-
return (
|
|
9
|
-
<button
|
|
10
|
-
className={` ${getCtx(props).getNodeClasses(props.nodeId, viewportKeyStore.get().value)} eraser-child group relative transition-all before:pointer-events-none before:absolute before:inset-0 before:opacity-50 before:outline-dashed before:outline-4 before:outline-red-700 hover:before:bg-red-600/50 hover:before:opacity-100 focus:before:bg-red-600/50 focus:before:opacity-100`}
|
|
11
|
-
title="Delete Link"
|
|
12
|
-
onClick={(e) => {
|
|
13
|
-
getCtx(props).setClickedNodeId(props.nodeId);
|
|
14
|
-
e.stopPropagation();
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
<div className="absolute right-2 top-2 rounded-full bg-red-700 p-0.5">
|
|
18
|
-
<TrashIcon className="h-5 w-5 text-white" />
|
|
19
|
-
</div>
|
|
20
|
-
<RenderChildren
|
|
21
|
-
children={getCtx(props).getChildNodeIDs(props.nodeId)}
|
|
22
|
-
nodeProps={props}
|
|
23
|
-
/>
|
|
24
|
-
</button>
|
|
25
|
-
);
|
|
26
|
-
};
|