@lowdefy/server-dev 0.0.0-experimental-20260710073520 → 0.0.0-experimental-20260713085736

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.
@@ -20,6 +20,7 @@ import Head from '@lowdefy/client/adapters/Head.js';
20
20
  import createLinkComponent from '@lowdefy/client/adapters/Link.js';
21
21
 
22
22
  import BuildingPage from '../lib/client/BuildingPage.jsx';
23
+ import FeedbackMount from './feedback/FeedbackMount.jsx';
23
24
  import Inspector from './Inspector.jsx';
24
25
  import Reload from './Reload.jsx';
25
26
  import Page from './Page.jsx';
@@ -70,6 +71,7 @@ function Routing({ auth, lowdefy, router }) {
70
71
  return (
71
72
  <>
72
73
  <Inspector basePath={router.basePath} lowdefy={lowdefy} pageId={pageId} />
74
+ <FeedbackMount basePath={router.basePath} lowdefy={lowdefy} pageId={pageId} />
73
75
  <Reload basePath={router.basePath} lowdefy={lowdefy}>
74
76
  {(resetContext) => (
75
77
  <Suspense key={`${pageId}_${getReloadVersion()}`} fallback={<BuildingPage />}>
@@ -0,0 +1,77 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ import React, { Suspense, useEffect, useState } from 'react';
18
+
19
+ import useFeedbackToggle from './useFeedbackToggle.js';
20
+
21
+ // Logged once per page load, not once per mount — React StrictMode / HMR can
22
+ // remount this component without a real reload.
23
+ let bannerLogged = false;
24
+
25
+ function logBannerOnce() {
26
+ if (bannerLogged) {
27
+ return;
28
+ }
29
+ bannerLogged = true;
30
+ try {
31
+ // eslint-disable-next-line no-console
32
+ console.info(
33
+ '%cLowdefy Annotate%c — press Cmd/Ctrl+/ to point, draw, and copy annotations for your coding agent.',
34
+ 'color: #4f9cf9; font-weight: bold;',
35
+ 'color: inherit;'
36
+ );
37
+ } catch {
38
+ // Never let a console-styling quirk break the app.
39
+ }
40
+ }
41
+
42
+ // Code-split: the overlay (state machine, drawing SVG, review tray) only
43
+ // loads once the developer actually opts in.
44
+ const LazyOverlay = React.lazy(() => import('./FeedbackOverlay.jsx'));
45
+
46
+ // Dev-only, always mounted alongside Inspector.jsx. Mirrors its resilience
47
+ // contract — nothing here may ever throw into the app it's riding along
48
+ // with. Stays inert until the developer presses Cmd/Ctrl+/, at which point
49
+ // the overlay mounts.
50
+ function FeedbackMount({ basePath, lowdefy, pageId }) {
51
+ const [active, setActive] = useState(false);
52
+
53
+ useFeedbackToggle({
54
+ onToggle: () => setActive((current) => !current),
55
+ });
56
+
57
+ useEffect(() => {
58
+ logBannerOnce();
59
+ }, []);
60
+
61
+ return (
62
+ <>
63
+ {active && (
64
+ <Suspense fallback={null}>
65
+ <LazyOverlay
66
+ basePath={basePath}
67
+ lowdefy={lowdefy}
68
+ pageId={pageId}
69
+ onClose={() => setActive(false)}
70
+ />
71
+ </Suspense>
72
+ )}
73
+ </>
74
+ );
75
+ }
76
+
77
+ export default FeedbackMount;