astro-tractstack 2.0.0-rc.60 → 2.0.0-rc.61
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/nodes/Pane.tsx +1 -1
- package/templates/src/components/edit/ToolMode.tsx +5 -52
- package/templates/src/components/widgets/ImpressionWrapper.tsx +0 -1
- package/templates/src/pages/[...slug]/edit.astro +3 -10
- package/templates/src/pages/context/[...contextSlug]/edit.astro +1 -2
- package/templates/src/utils/layout.ts +0 -29
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ const CodeHookContainer = ({
|
|
|
32
32
|
<Fragment key={key}>
|
|
33
33
|
<span className="min-w-24 font-bold text-gray-600">{key}:</span>
|
|
34
34
|
<div className="ml-2 flex flex-wrap gap-1">
|
|
35
|
-
{value.split(
|
|
35
|
+
{value.split(/,|\|/).map((item, index) => (
|
|
36
36
|
<span
|
|
37
37
|
key={index}
|
|
38
38
|
className="inline-block rounded bg-gray-200 px-2 py-0.5 text-xs text-gray-800"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRef, useEffect } from 'react';
|
|
2
2
|
import { useStore } from '@nanostores/react';
|
|
3
3
|
import PencilSquareIcon from '@heroicons/react/24/outline/PencilSquareIcon';
|
|
4
4
|
import PaintBrushIcon from '@heroicons/react/24/outline/PaintBrushIcon';
|
|
@@ -8,11 +8,8 @@ import PlusIcon from '@heroicons/react/24/outline/PlusIcon';
|
|
|
8
8
|
import BugAntIcon from '@heroicons/react/24/outline/BugAntIcon';
|
|
9
9
|
import { settingsPanelStore } from '@/stores/storykeep';
|
|
10
10
|
import { getCtx } from '@/stores/nodes';
|
|
11
|
-
import { debounce } from '@/utils/helpers';
|
|
12
11
|
import type { ToolModeVal } from '@/types/compositorTypes';
|
|
13
12
|
|
|
14
|
-
const SHORT_THRESHOLD = 650;
|
|
15
|
-
|
|
16
13
|
const storykeepToolModes = [
|
|
17
14
|
{
|
|
18
15
|
key: 'styles' as const,
|
|
@@ -84,34 +81,16 @@ const StoryKeepToolMode = ({ isContext }: StoryKeepToolModeProps) => {
|
|
|
84
81
|
const handleEscapeKey = (event: KeyboardEvent) => {
|
|
85
82
|
if (event.key === 'Escape') {
|
|
86
83
|
ctx.toolModeValStore.set({ value: 'text' });
|
|
84
|
+
ctx.notifyNode('root');
|
|
87
85
|
}
|
|
88
86
|
};
|
|
89
87
|
|
|
90
|
-
const toolModeNav = navRef.current;
|
|
91
|
-
|
|
92
|
-
// If the <nav> element hasn't been rendered yet, do nothing.
|
|
93
|
-
// The hook will re-run when hasTitle/hasPanes changes and it does render.
|
|
94
|
-
if (!toolModeNav) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const updateToolbarLayout = debounce(() => {
|
|
99
|
-
const isWideAndShort =
|
|
100
|
-
window.innerWidth >= 801 && window.innerHeight <= SHORT_THRESHOLD;
|
|
101
|
-
toolModeNav.classList.toggle('is-compact-widget', isWideAndShort);
|
|
102
|
-
}, 50);
|
|
103
|
-
|
|
104
88
|
document.addEventListener('keydown', handleEscapeKey);
|
|
105
|
-
window.addEventListener('resize', updateToolbarLayout);
|
|
106
|
-
|
|
107
|
-
updateToolbarLayout(); // Initial check
|
|
108
89
|
|
|
109
90
|
return () => {
|
|
110
91
|
document.removeEventListener('keydown', handleEscapeKey);
|
|
111
|
-
window.removeEventListener('resize', updateToolbarLayout);
|
|
112
92
|
};
|
|
113
|
-
|
|
114
|
-
}, [ctx, hasTitle, hasPanes, isContext]);
|
|
93
|
+
}, [ctx]);
|
|
115
94
|
|
|
116
95
|
if (!hasTitle || (!hasPanes && !isContext)) {
|
|
117
96
|
return null;
|
|
@@ -119,38 +98,12 @@ const StoryKeepToolMode = ({ isContext }: StoryKeepToolModeProps) => {
|
|
|
119
98
|
|
|
120
99
|
return (
|
|
121
100
|
<>
|
|
122
|
-
<style>{`
|
|
123
|
-
#mainNav.is-compact-widget {
|
|
124
|
-
position: fixed;
|
|
125
|
-
bottom: 0.25rem;
|
|
126
|
-
left: 0rem;
|
|
127
|
-
top: auto;
|
|
128
|
-
right: auto;
|
|
129
|
-
height: auto;
|
|
130
|
-
width: auto;
|
|
131
|
-
padding: 0.5rem;
|
|
132
|
-
border-radius: 0 0.75rem 0.75rem 0;
|
|
133
|
-
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
134
|
-
background-color: rgba(252, 252, 252, 0.7);
|
|
135
|
-
backdrop-filter: blur(4px);
|
|
136
|
-
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
137
|
-
}
|
|
138
|
-
#mainNav.is-compact-widget > div {
|
|
139
|
-
flex-direction: row;
|
|
140
|
-
flex-wrap: nowrap;
|
|
141
|
-
align-items: center;
|
|
142
|
-
gap: 1rem;
|
|
143
|
-
margin: 0;
|
|
144
|
-
padding: 0;
|
|
145
|
-
height: auto;
|
|
146
|
-
}
|
|
147
|
-
`}</style>
|
|
148
101
|
<nav
|
|
149
102
|
id="mainNav"
|
|
150
103
|
ref={navRef}
|
|
151
|
-
className="z-102 bg-mywhite fixed bottom-0 left-0 right-0
|
|
104
|
+
className="z-102 bg-mywhite md:bg-mywhite/70 fixed bottom-0 left-0 right-0 p-1.5 md:bottom-2 md:right-auto md:h-auto md:w-auto md:rounded-r-xl md:border md:border-black/5 md:p-2 md:shadow-lg md:backdrop-blur-sm"
|
|
152
105
|
>
|
|
153
|
-
<div className="flex flex-wrap justify-around gap-4 py-0.5 md:
|
|
106
|
+
<div className="flex flex-wrap justify-around gap-4 py-0.5 md:flex-nowrap md:justify-start md:gap-4 md:p-0">
|
|
154
107
|
<div className="text-mydarkgrey text-center text-sm font-bold">
|
|
155
108
|
mode:
|
|
156
109
|
<div className="font-action text-myblue pt-1.5 text-center text-xs">
|
|
@@ -168,16 +168,10 @@ for (const [key, value] of Astro.url.searchParams) {
|
|
|
168
168
|
<StoryKeepToolMode isContext={false} client:only="react" />
|
|
169
169
|
|
|
170
170
|
<!-- Main Content Area -->
|
|
171
|
-
<main
|
|
172
|
-
id="mainContent"
|
|
173
|
-
class="relative flex-1 overflow-x-auto"
|
|
174
|
-
style={{
|
|
175
|
-
paddingBottom: 'var(--bottom-right-controls-bottom-offset, 16px)',
|
|
176
|
-
}}
|
|
177
|
-
>
|
|
171
|
+
<main id="mainContent" class="relative flex-1 overflow-x-auto">
|
|
178
172
|
<div class="bg-myblue/20 bg-mylightgrey h-full p-1.5">
|
|
179
173
|
<div
|
|
180
|
-
class="h-fit min-h-screen"
|
|
174
|
+
class="h-fit min-h-screen pb-24"
|
|
181
175
|
style={{
|
|
182
176
|
backgroundImage:
|
|
183
177
|
'repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(0,0,0,0.05) 10px, rgba(0,0,0,0.05) 20px)',
|
|
@@ -224,7 +218,6 @@ for (const [key, value] of Astro.url.searchParams) {
|
|
|
224
218
|
</Layout>
|
|
225
219
|
|
|
226
220
|
<script>
|
|
227
|
-
import { setupLayoutObservers
|
|
228
|
-
setupLayoutStyles();
|
|
221
|
+
import { setupLayoutObservers } from '@/utils/layout';
|
|
229
222
|
setupLayoutObservers();
|
|
230
223
|
</script>
|
|
@@ -215,7 +215,6 @@ for (const [key, value] of Astro.url.searchParams) {
|
|
|
215
215
|
</Layout>
|
|
216
216
|
|
|
217
217
|
<script>
|
|
218
|
-
import { setupLayoutObservers
|
|
219
|
-
setupLayoutStyles();
|
|
218
|
+
import { setupLayoutObservers } from '@/utils/layout';
|
|
220
219
|
setupLayoutObservers();
|
|
221
220
|
</script>
|
|
@@ -9,20 +9,6 @@ import { debounce } from '@/utils/helpers';
|
|
|
9
9
|
|
|
10
10
|
let hasScrolledForSettingsPanel = false;
|
|
11
11
|
|
|
12
|
-
export function setupLayoutStyles(): void {
|
|
13
|
-
const updateBottomOffset = () => {
|
|
14
|
-
const mobileNavHeight = window.innerWidth < 801 ? 80 : 0;
|
|
15
|
-
const padding = 4;
|
|
16
|
-
const offset = `${mobileNavHeight + padding}px`;
|
|
17
|
-
document.documentElement.style.setProperty(
|
|
18
|
-
'--bottom-right-controls-bottom-offset',
|
|
19
|
-
offset
|
|
20
|
-
);
|
|
21
|
-
};
|
|
22
|
-
updateBottomOffset();
|
|
23
|
-
window.addEventListener('resize', updateBottomOffset);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
// Replace your existing setupPaneObserver with this one.
|
|
27
13
|
function setupPaneObserver() {
|
|
28
14
|
let currentObserver: IntersectionObserver | null = null;
|
|
@@ -64,7 +50,6 @@ function setupPaneObserver() {
|
|
|
64
50
|
|
|
65
51
|
export function setupLayoutObservers(): void {
|
|
66
52
|
const storykeepHeader = document.getElementById('storykeepHeader');
|
|
67
|
-
const toolModeNav = document.getElementById('mainNav');
|
|
68
53
|
const settingsControls = document.getElementById('settingsControls');
|
|
69
54
|
const standardHeader = document.querySelector('header');
|
|
70
55
|
|
|
@@ -99,20 +84,6 @@ export function setupLayoutObservers(): void {
|
|
|
99
84
|
storykeepHeader.style.top = '';
|
|
100
85
|
}
|
|
101
86
|
}
|
|
102
|
-
|
|
103
|
-
if (toolModeNav && window.innerWidth >= 801) {
|
|
104
|
-
if (shouldBeSticky) {
|
|
105
|
-
toolModeNav.classList.remove('md:static');
|
|
106
|
-
toolModeNav.classList.add('md:fixed');
|
|
107
|
-
toolModeNav.style.top = '60px';
|
|
108
|
-
toolModeNav.style.left = '0';
|
|
109
|
-
} else {
|
|
110
|
-
toolModeNav.classList.remove('md:fixed');
|
|
111
|
-
toolModeNav.classList.add('md:static');
|
|
112
|
-
toolModeNav.style.top = '';
|
|
113
|
-
toolModeNav.style.left = '';
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
87
|
};
|
|
117
88
|
|
|
118
89
|
const debouncedUpdate = debounce(() => {
|