astro-tractstack 2.0.0-rc.16 → 2.0.0-rc.17
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/custom/minimal/CodeHook.astro +2 -4
- package/templates/custom/minimal/CustomRoutes.astro +0 -6
- package/templates/custom/with-examples/CodeHook.astro +2 -4
- package/templates/custom/with-examples/CustomRoutes.astro +0 -4
- package/templates/src/components/compositor/nodes/Pane.tsx +1 -1
- package/templates/src/components/edit/PanelSwitch.tsx +1 -0
- package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +2 -1
- package/templates/src/components/edit/pane/ConfigPanePanel.tsx +1 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel.tsx +2 -0
- package/templates/src/layouts/Layout.astro +19 -8
- package/templates/src/lib/storyData.ts +1 -0
- package/templates/src/pages/[...slug].astro +2 -0
- package/templates/src/pages/context/[...contextSlug].astro +6 -1
package/package.json
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
// CodeHook Dispatcher - Minimal Version
|
|
3
|
-
// Framework components are always available, custom components are commented for guidance
|
|
4
|
-
|
|
5
2
|
import FeaturedContent from '@/components/codehooks/FeaturedContent.astro';
|
|
6
3
|
import ListContent from '@/components/codehooks/ListContent.astro';
|
|
7
4
|
import BunnyVideoWrapper from '@/components/codehooks/BunnyVideoWrapper.astro';
|
|
@@ -12,6 +9,7 @@ import type { FullContentMapItem } from '@/types/tractstack';
|
|
|
12
9
|
export interface Props {
|
|
13
10
|
target: string;
|
|
14
11
|
fullContentMap: FullContentMapItem[];
|
|
12
|
+
resourcesPayload?: Record<string, any[]>;
|
|
15
13
|
options?: {
|
|
16
14
|
params?: {
|
|
17
15
|
options?: string;
|
|
@@ -19,7 +17,7 @@ export interface Props {
|
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
const { target, options, fullContentMap } = Astro.props;
|
|
20
|
+
const { target, options, fullContentMap /* resourcesPayload */ } = Astro.props;
|
|
23
21
|
|
|
24
22
|
export const components = {
|
|
25
23
|
'featured-content': true,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
// V2 Custom Routes - Minimal Version
|
|
3
|
-
// This is a stub - implement your custom routes here
|
|
4
|
-
|
|
5
2
|
export interface Props {
|
|
6
3
|
route: string;
|
|
7
4
|
slug: string;
|
|
@@ -15,9 +12,6 @@ const { route, slug, resources } = Astro.props;
|
|
|
15
12
|
export const routes = {
|
|
16
13
|
// collections: true, // Uncomment to enable collections route
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
// Example implementation for collections:
|
|
20
|
-
// const payload = resources; // V2 resources are already filtered by backend
|
|
21
15
|
---
|
|
22
16
|
|
|
23
17
|
{
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
// V2 CodeHook Dispatcher - With Examples
|
|
3
|
-
// Framework components and custom examples are available
|
|
4
|
-
|
|
5
2
|
import CustomHero from './CustomHero.astro';
|
|
6
3
|
import FeaturedContent from '@/components/codehooks/FeaturedContent.astro';
|
|
7
4
|
import ListContent from '@/components/codehooks/ListContent.astro';
|
|
@@ -12,6 +9,7 @@ import type { FullContentMapItem } from '@/types/tractstack';
|
|
|
12
9
|
export interface Props {
|
|
13
10
|
target: string;
|
|
14
11
|
fullContentMap: FullContentMapItem[];
|
|
12
|
+
resourcesPayload?: Record<string, any[]>;
|
|
15
13
|
options?: {
|
|
16
14
|
params?: {
|
|
17
15
|
options?: string;
|
|
@@ -19,7 +17,7 @@ export interface Props {
|
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
const { target, options, fullContentMap } = Astro.props;
|
|
20
|
+
const { target, options, fullContentMap /* resourcesPayload */ } = Astro.props;
|
|
23
21
|
|
|
24
22
|
export const components = {
|
|
25
23
|
'custom-hero': true,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
// V2 Custom Routes - With Examples
|
|
3
|
-
// Full Collections implementation included
|
|
4
|
-
|
|
5
2
|
import Collections from './pages/Collections.astro';
|
|
6
3
|
|
|
7
4
|
export interface Props {
|
|
@@ -17,7 +14,6 @@ export const routes = {
|
|
|
17
14
|
collections: true,
|
|
18
15
|
};
|
|
19
16
|
|
|
20
|
-
// V2: Resources are already filtered by backend, no client-side extraction needed
|
|
21
17
|
const payload = resources;
|
|
22
18
|
---
|
|
23
19
|
|
|
@@ -29,7 +29,7 @@ const CodeHookContainer = ({
|
|
|
29
29
|
value && (
|
|
30
30
|
<div key={key} className="flex items-start">
|
|
31
31
|
<span className="min-w-24 font-bold text-gray-600">{key}:</span>
|
|
32
|
-
<span className="ml-2 text-gray-800">
|
|
32
|
+
<span className="ml-2 truncate text-gray-800">
|
|
33
33
|
{JSON.stringify(value)}
|
|
34
34
|
</span>
|
|
35
35
|
</div>
|
|
@@ -153,7 +153,8 @@ const AddPaneCodeHookPanel = ({
|
|
|
153
153
|
font-weight: bold;
|
|
154
154
|
}
|
|
155
155
|
.hook-item-available:hover {
|
|
156
|
-
background-color:
|
|
156
|
+
background-color: #0891b2;
|
|
157
|
+
color: #fff;
|
|
157
158
|
}
|
|
158
159
|
.hook-item-disabled {
|
|
159
160
|
background-color: #f9fafb; /* bg-gray-50 */
|
|
@@ -5,6 +5,7 @@ import { StylesMemory } from '@/components/edit/state/StylesMemory';
|
|
|
5
5
|
import SelectedTailwindClass from '@/components/fields/SelectedTailwindClass';
|
|
6
6
|
import { isMarkdownPaneFragmentNode } from '@/utils/compositor/typeGuards';
|
|
7
7
|
import { widgetMeta } from '@/constants';
|
|
8
|
+
import { getCtx } from '@/stores/nodes';
|
|
8
9
|
import type {
|
|
9
10
|
FlatNode,
|
|
10
11
|
MarkdownPaneFragmentNode,
|
|
@@ -271,6 +272,7 @@ const StyleWidgetPanel = ({
|
|
|
271
272
|
};
|
|
272
273
|
|
|
273
274
|
const handleWidgetConfig = () => {
|
|
275
|
+
getCtx().toolModeValStore.set({ value: 'styles' });
|
|
274
276
|
settingsPanelStore.set({
|
|
275
277
|
action: `style-code-config`,
|
|
276
278
|
nodeId: node.id,
|
|
@@ -50,19 +50,30 @@ const isDev = import.meta.env.DEV;
|
|
|
50
50
|
// Get site status from the store
|
|
51
51
|
const isInitialized = !freshInstallStore.get().needsSetup;
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
const cssBasePath = isInitialized ? '/media/css' : '/styles';
|
|
55
|
-
const fontBasePath = isInitialized ? '/media/fonts' : '/fonts';
|
|
56
|
-
const mainStylesUrl =
|
|
57
|
-
isStoryKeep || isDev
|
|
58
|
-
? `${cssBasePath}/storykeep.css`
|
|
59
|
-
: `${cssBasePath}/frontend.css`;
|
|
53
|
+
// ensure we have brand config!
|
|
60
54
|
const goBackend = import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:8080';
|
|
61
55
|
const tenantId =
|
|
62
56
|
Astro.locals.tenant?.id || import.meta.env.PUBLIC_TENANTID || 'default';
|
|
57
|
+
const brandConfig = propBrandConfig || (await getBrandConfig(tenantId));
|
|
58
|
+
|
|
59
|
+
// Conditionally set asset paths based on initialization status
|
|
60
|
+
const cssBasePath = isInitialized ? '/media/css' : '/styles';
|
|
61
|
+
const fontBasePath = isInitialized ? '/media/fonts' : '/fonts';
|
|
62
|
+
const mainStylesUrl = (() => {
|
|
63
|
+
const baseUrl =
|
|
64
|
+
isStoryKeep || isDev
|
|
65
|
+
? `${cssBasePath}/storykeep.css`
|
|
66
|
+
: `${cssBasePath}/frontend.css`;
|
|
67
|
+
|
|
68
|
+
// Only add version for frontend.css (the dynamic one)
|
|
69
|
+
if (!isStoryKeep && !isDev && brandConfig?.STYLES_VER) {
|
|
70
|
+
return `${baseUrl}?v=${brandConfig.STYLES_VER}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return baseUrl;
|
|
74
|
+
})();
|
|
63
75
|
|
|
64
76
|
// Social media and SEO setup
|
|
65
|
-
const brandConfig = propBrandConfig || (await getBrandConfig(tenantId));
|
|
66
77
|
const defaultFavIcon = brandConfig.FAVICON || `/brand/favicon.ico`;
|
|
67
78
|
const defaultSocialImageURL = ogImage || brandConfig.OG || `/brand/og.png`;
|
|
68
79
|
const defaultSocialLogoURL = brandConfig.OGLOGO || `/brand/oglogo.png`;
|
|
@@ -43,6 +43,7 @@ const storyfragmentId = storyData.id;
|
|
|
43
43
|
const storyfragmentTitle = storyData.title || 'Untitled Story';
|
|
44
44
|
const paneIds = storyData.paneIds || [];
|
|
45
45
|
const codeHookTargets = storyData.codeHookTargets || {};
|
|
46
|
+
const resourcesPayload = storyData.resourcesPayload || {};
|
|
46
47
|
|
|
47
48
|
if (paneIds.length === 0) {
|
|
48
49
|
console.log(`Empty Story Fragment. Redirecting to /storykeep`);
|
|
@@ -134,6 +135,7 @@ if (!brandConfig.SITE_INIT) {
|
|
|
134
135
|
target={codeHookTargets[paneId]}
|
|
135
136
|
paneId={paneId}
|
|
136
137
|
fullContentMap={fullContentMap}
|
|
138
|
+
resourcesPayload={resourcesPayload}
|
|
137
139
|
noPaneId={true}
|
|
138
140
|
/>
|
|
139
141
|
</div>
|
|
@@ -59,6 +59,7 @@ try {
|
|
|
59
59
|
const paneId = contextPaneData.id;
|
|
60
60
|
const paneTitle = contextPaneData.title || 'Context';
|
|
61
61
|
const codeHookTarget = contextPaneData.codeHookTarget || null;
|
|
62
|
+
const resourcesPayload = storyData.resourcesPayload || {};
|
|
62
63
|
|
|
63
64
|
// Get rendered fragment for the context pane
|
|
64
65
|
let fragmentData = '';
|
|
@@ -123,7 +124,11 @@ if (!brandConfig.SITE_INIT) {
|
|
|
123
124
|
>
|
|
124
125
|
{
|
|
125
126
|
codeHookTarget ? (
|
|
126
|
-
<CodeHook
|
|
127
|
+
<CodeHook
|
|
128
|
+
target={codeHookTarget}
|
|
129
|
+
resourcesPayload={resourcesPayload}
|
|
130
|
+
fullContentMap={fullContentMap}
|
|
131
|
+
/>
|
|
127
132
|
) : (
|
|
128
133
|
<Fragment set:html={fragmentData} />
|
|
129
134
|
)
|