camox 0.0.0 → 0.1.2-alpha.2
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/LICENSE.md +110 -0
- package/dist/components/AuthGate.d.ts +7 -0
- package/dist/components/AuthGate.d.ts.map +1 -0
- package/dist/core/components/AddBlockControlBar.d.ts +9 -0
- package/dist/core/components/AddBlockControlBar.d.ts.map +1 -0
- package/dist/core/components/AddBlockControlBar.js +65 -0
- package/dist/core/components/lexical/InlineContentEditable.d.ts +7 -0
- package/dist/core/components/lexical/InlineContentEditable.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineContentEditable.js +40 -0
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts +12 -0
- package/dist/core/components/lexical/InlineLexicalEditor.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +133 -0
- package/dist/core/components/lexical/InlineParagraphNode.d.ts +10 -0
- package/dist/core/components/lexical/InlineParagraphNode.d.ts.map +1 -0
- package/dist/core/components/lexical/InlineParagraphNode.js +34 -0
- package/dist/core/components/lexical/SelectionBroadcaster.d.ts +6 -0
- package/dist/core/components/lexical/SelectionBroadcaster.d.ts.map +1 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +62 -0
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts +9 -0
- package/dist/core/components/lexical/SidebarLexicalEditor.d.ts.map +1 -0
- package/dist/core/components/lexical/editorConfig.d.ts +4 -0
- package/dist/core/components/lexical/editorConfig.d.ts.map +1 -0
- package/dist/core/components/lexical/editorConfig.js +24 -0
- package/dist/core/createApp.d.ts +373 -0
- package/dist/core/createApp.d.ts.map +1 -0
- package/dist/core/createApp.js +40 -0
- package/dist/core/createBlock.d.ts +947 -0
- package/dist/core/createBlock.d.ts.map +1 -0
- package/dist/core/createBlock.js +873 -0
- package/dist/core/createLayout.d.ts +78 -0
- package/dist/core/createLayout.d.ts.map +1 -0
- package/dist/core/createLayout.js +73 -0
- package/dist/core/hooks/useFieldSelection.d.ts +11 -0
- package/dist/core/hooks/useFieldSelection.d.ts.map +1 -0
- package/dist/core/hooks/useFieldSelection.js +25 -0
- package/dist/core/hooks/useIsEditable.d.ts +2 -0
- package/dist/core/hooks/useIsEditable.d.ts.map +1 -0
- package/dist/core/hooks/useIsEditable.js +12 -0
- package/dist/core/hooks/useOverlayMessage.d.ts +10 -0
- package/dist/core/hooks/useOverlayMessage.d.ts.map +1 -0
- package/dist/core/hooks/useOverlayMessage.js +37 -0
- package/dist/core/lib/contentType.d.ts +165 -0
- package/dist/core/lib/contentType.d.ts.map +1 -0
- package/dist/core/lib/contentType.js +148 -0
- package/dist/core/lib/fieldTypes.d.ts +85 -0
- package/dist/core/lib/fieldTypes.d.ts.map +1 -0
- package/dist/core/lib/lexicalReact.d.ts +3 -0
- package/dist/core/lib/lexicalReact.d.ts.map +1 -0
- package/dist/core/lib/lexicalReact.js +24 -0
- package/dist/core/lib/lexicalState.d.ts +10 -0
- package/dist/core/lib/lexicalState.d.ts.map +1 -0
- package/dist/core/lib/lexicalState.js +38 -0
- package/dist/core/lib/modifierFormats.d.ts +9 -0
- package/dist/core/lib/modifierFormats.d.ts.map +1 -0
- package/dist/core/lib/modifierFormats.js +8 -0
- package/dist/core/lib/modifiers.d.ts +12 -0
- package/dist/core/lib/modifiers.d.ts.map +1 -0
- package/dist/core/lib/modifiers.js +27 -0
- package/dist/features/content/CamoxContent.d.ts +2 -0
- package/dist/features/content/CamoxContent.d.ts.map +1 -0
- package/dist/features/content/CamoxContent.js +100 -0
- package/dist/features/content/components/AssetCard.d.ts +10 -0
- package/dist/features/content/components/AssetCard.d.ts.map +1 -0
- package/dist/features/content/components/AssetCard.js +41 -0
- package/dist/features/content/components/AssetCardSkeleton.d.ts +2 -0
- package/dist/features/content/components/AssetCardSkeleton.d.ts.map +1 -0
- package/dist/features/content/components/AssetCardSkeleton.js +11 -0
- package/dist/features/content/components/ContentSidebar.d.ts +2 -0
- package/dist/features/content/components/ContentSidebar.d.ts.map +1 -0
- package/dist/features/content/components/ContentSidebar.js +15 -0
- package/dist/features/content/components/UploadDropZone.d.ts +9 -0
- package/dist/features/content/components/UploadDropZone.d.ts.map +1 -0
- package/dist/features/content/components/UploadDropZone.js +51 -0
- package/dist/features/content/components/UploadProgressDrawer.d.ts +11 -0
- package/dist/features/content/components/UploadProgressDrawer.d.ts.map +1 -0
- package/dist/features/content/components/UploadProgressDrawer.js +72 -0
- package/dist/features/preview/CamoxPreview.d.ts +124 -0
- package/dist/features/preview/CamoxPreview.d.ts.map +1 -0
- package/dist/features/preview/CamoxPreview.js +253 -0
- package/dist/features/preview/components/AddBlockSheet.d.ts +3 -0
- package/dist/features/preview/components/AddBlockSheet.d.ts.map +1 -0
- package/dist/features/preview/components/AddBlockSheet.js +121 -0
- package/dist/features/preview/components/AgentChatSheet.d.ts +3 -0
- package/dist/features/preview/components/AgentChatSheet.d.ts.map +1 -0
- package/dist/features/preview/components/AgentChatSheet.js +24 -0
- package/dist/features/preview/components/AssetFieldEditor.d.ts +18 -0
- package/dist/features/preview/components/AssetFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/AssetFieldEditor.js +139 -0
- package/dist/features/preview/components/AssetLightbox.d.ts +9 -0
- package/dist/features/preview/components/AssetLightbox.d.ts.map +1 -0
- package/dist/features/preview/components/AssetLightbox.js +421 -0
- package/dist/features/preview/components/AssetPickerGrid.d.ts +11 -0
- package/dist/features/preview/components/AssetPickerGrid.d.ts.map +1 -0
- package/dist/features/preview/components/AssetPickerGrid.js +92 -0
- package/dist/features/preview/components/BlockActionsPopover.d.ts +15 -0
- package/dist/features/preview/components/BlockActionsPopover.d.ts.map +1 -0
- package/dist/features/preview/components/BlockActionsPopover.js +506 -0
- package/dist/features/preview/components/CreatePageSheet.d.ts +3 -0
- package/dist/features/preview/components/CreatePageSheet.d.ts.map +1 -0
- package/dist/features/preview/components/CreatePageSheet.js +159 -0
- package/dist/features/preview/components/DebouncedFieldEditor.d.ts +10 -0
- package/dist/features/preview/components/DebouncedFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/DebouncedFieldEditor.js +51 -0
- package/dist/features/preview/components/EditPageSheet.d.ts +3 -0
- package/dist/features/preview/components/EditPageSheet.d.ts.map +1 -0
- package/dist/features/preview/components/EditPageSheet.js +352 -0
- package/dist/features/preview/components/ItemFieldsEditor.d.ts +29 -0
- package/dist/features/preview/components/ItemFieldsEditor.d.ts.map +1 -0
- package/dist/features/preview/components/ItemFieldsEditor.js +308 -0
- package/dist/features/preview/components/LinkFieldEditor.d.ts +8 -0
- package/dist/features/preview/components/LinkFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/LinkFieldEditor.js +190 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts +10 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.d.ts.map +1 -0
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +232 -0
- package/dist/features/preview/components/OverlayTracker.d.ts +6 -0
- package/dist/features/preview/components/OverlayTracker.d.ts.map +1 -0
- package/dist/features/preview/components/OverlayTracker.js +41 -0
- package/dist/features/preview/components/Overlays.d.ts +6 -0
- package/dist/features/preview/components/Overlays.d.ts.map +1 -0
- package/dist/features/preview/components/Overlays.js +58 -0
- package/dist/features/preview/components/PageContentSheet.d.ts +3 -0
- package/dist/features/preview/components/PageContentSheet.d.ts.map +1 -0
- package/dist/features/preview/components/PageContentSheet.js +492 -0
- package/dist/features/preview/components/PageLocationFieldset.d.ts +14 -0
- package/dist/features/preview/components/PageLocationFieldset.d.ts.map +1 -0
- package/dist/features/preview/components/PageLocationFieldset.js +77 -0
- package/dist/features/preview/components/PagePicker.d.ts +3 -0
- package/dist/features/preview/components/PagePicker.d.ts.map +1 -0
- package/dist/features/preview/components/PagePicker.js +185 -0
- package/dist/features/preview/components/PageTree.d.ts +3 -0
- package/dist/features/preview/components/PageTree.d.ts.map +1 -0
- package/dist/features/preview/components/PageTree.js +410 -0
- package/dist/features/preview/components/PeekedBlock.d.ts +6 -0
- package/dist/features/preview/components/PeekedBlock.d.ts.map +1 -0
- package/dist/features/preview/components/PeekedBlock.js +95 -0
- package/dist/features/preview/components/PreviewPanel.d.ts +12 -0
- package/dist/features/preview/components/PreviewPanel.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewPanel.js +192 -0
- package/dist/features/preview/components/PreviewSideSheet.d.ts +13 -0
- package/dist/features/preview/components/PreviewSideSheet.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewSideSheet.js +28 -0
- package/dist/features/preview/components/PreviewToolbar.d.ts +2 -0
- package/dist/features/preview/components/PreviewToolbar.d.ts.map +1 -0
- package/dist/features/preview/components/PreviewToolbar.js +79 -0
- package/dist/features/preview/components/RepeatableItemsList.d.ts +14 -0
- package/dist/features/preview/components/RepeatableItemsList.d.ts.map +1 -0
- package/dist/features/preview/components/RepeatableItemsList.js +366 -0
- package/dist/features/preview/components/ShikiMarkdown.d.ts +4 -0
- package/dist/features/preview/components/ShikiMarkdown.d.ts.map +1 -0
- package/dist/features/preview/components/ShikiMarkdown.js +37 -0
- package/dist/features/preview/components/TextFormatToolbar.d.ts +2 -0
- package/dist/features/preview/components/TextFormatToolbar.d.ts.map +1 -0
- package/dist/features/preview/components/TextFormatToolbar.js +73 -0
- package/dist/features/preview/components/UnlinkAssetButton.d.ts +9 -0
- package/dist/features/preview/components/UnlinkAssetButton.d.ts.map +1 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +55 -0
- package/dist/features/preview/overlayConstants.d.ts +19 -0
- package/dist/features/preview/overlayConstants.d.ts.map +1 -0
- package/dist/features/preview/overlayConstants.js +21 -0
- package/dist/features/preview/overlayMessages.d.ts +62 -0
- package/dist/features/preview/overlayMessages.d.ts.map +1 -0
- package/dist/features/preview/overlayMessages.js +9 -0
- package/dist/features/preview/previewConstants.d.ts +2 -0
- package/dist/features/preview/previewConstants.d.ts.map +1 -0
- package/dist/features/preview/previewStore.d.ts +116 -0
- package/dist/features/preview/previewStore.d.ts.map +1 -0
- package/dist/features/preview/previewStore.js +321 -0
- package/dist/features/provider/CamoxProvider.d.ts +11 -0
- package/dist/features/provider/CamoxProvider.d.ts.map +1 -0
- package/dist/features/provider/CamoxProvider.js +73 -0
- package/dist/features/provider/actionsStore.d.ts +39 -0
- package/dist/features/provider/actionsStore.d.ts.map +1 -0
- package/dist/features/provider/actionsStore.js +35 -0
- package/dist/features/provider/components/CamoxAppContext.d.ts +371 -0
- package/dist/features/provider/components/CamoxAppContext.d.ts.map +1 -0
- package/dist/features/provider/components/CamoxAppContext.js +17 -0
- package/dist/features/provider/components/CommandPalette.d.ts +3 -0
- package/dist/features/provider/components/CommandPalette.d.ts.map +1 -0
- package/dist/features/provider/components/CommandPalette.js +127 -0
- package/dist/features/provider/useAdminShortcuts.d.ts +5 -0
- package/dist/features/provider/useAdminShortcuts.d.ts.map +1 -0
- package/dist/features/provider/useAdminShortcuts.js +83 -0
- package/dist/features/routes/ogRoute.d.ts +7 -0
- package/dist/features/routes/ogRoute.d.ts.map +1 -0
- package/dist/features/routes/ogRoute.js +19 -0
- package/dist/features/routes/pageRoute.d.ts +135 -0
- package/dist/features/routes/pageRoute.d.ts.map +1 -0
- package/dist/features/routes/pageRoute.js +112 -0
- package/dist/features/studio/CamoxStudio.d.ts +7 -0
- package/dist/features/studio/CamoxStudio.d.ts.map +1 -0
- package/dist/features/studio/CamoxStudio.js +24 -0
- package/dist/features/studio/components/Navbar.d.ts +4 -0
- package/dist/features/studio/components/Navbar.d.ts.map +1 -0
- package/dist/features/studio/components/Navbar.js +95 -0
- package/dist/features/studio/components/ProjectMenu.d.ts +2 -0
- package/dist/features/studio/components/ProjectMenu.d.ts.map +1 -0
- package/dist/features/studio/components/ProjectMenu.js +132 -0
- package/dist/features/studio/components/UserButton.d.ts +2 -0
- package/dist/features/studio/components/UserButton.d.ts.map +1 -0
- package/dist/features/studio/components/UserButton.js +96 -0
- package/dist/features/studio/studioStore.d.ts +17 -0
- package/dist/features/studio/studioStore.d.ts.map +1 -0
- package/dist/features/studio/studioStore.js +44 -0
- package/dist/features/studio/useTheme.d.ts +9 -0
- package/dist/features/studio/useTheme.d.ts.map +1 -0
- package/dist/features/studio/useTheme.js +98 -0
- package/dist/features/vite/appGeneration.d.ts +4 -0
- package/dist/features/vite/appGeneration.d.ts.map +1 -0
- package/dist/features/vite/appGeneration.js +67 -0
- package/dist/features/vite/blockBoilerplate.d.ts +3 -0
- package/dist/features/vite/blockBoilerplate.d.ts.map +1 -0
- package/dist/features/vite/blockBoilerplate.js +59 -0
- package/dist/features/vite/convexSync.d.ts +6 -0
- package/dist/features/vite/convexSync.d.ts.map +1 -0
- package/dist/features/vite/convexSync.js +98 -0
- package/dist/features/vite/definitionsSync.d.ts +11 -0
- package/dist/features/vite/definitionsSync.d.ts.map +1 -0
- package/dist/features/vite/definitionsSync.js +157 -0
- package/dist/features/vite/routeGeneration.d.ts +4 -0
- package/dist/features/vite/routeGeneration.d.ts.map +1 -0
- package/dist/features/vite/routeGeneration.js +194 -0
- package/dist/features/vite/skillGeneration.d.ts +4 -0
- package/dist/features/vite/skillGeneration.d.ts.map +1 -0
- package/dist/features/vite/skillGeneration.js +69 -0
- package/dist/features/vite/utils.d.ts +2 -0
- package/dist/features/vite/utils.d.ts.map +1 -0
- package/dist/features/vite/utils.js +10 -0
- package/dist/features/vite/vite.d.ts +18 -0
- package/dist/features/vite/vite.d.ts.map +1 -0
- package/dist/features/vite/vite.js +77 -0
- package/dist/hooks/use-file-upload.d.ts +22 -0
- package/dist/hooks/use-file-upload.d.ts.map +1 -0
- package/dist/hooks/use-marquee-selection.d.ts +17 -0
- package/dist/hooks/use-marquee-selection.d.ts.map +1 -0
- package/dist/lib/analytics-client.d.ts +3 -0
- package/dist/lib/analytics-client.d.ts.map +1 -0
- package/dist/lib/analytics.d.ts +3 -0
- package/dist/lib/analytics.d.ts.map +1 -0
- package/dist/lib/analytics.js +24 -0
- package/dist/lib/auth.d.ts +3683 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/convex-site.d.ts +3 -0
- package/dist/lib/convex-site.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +40 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/studio.css +2 -0
- package/package.json +123 -10
- package/server/api.d.ts +1 -0
- package/server/api.js +1 -0
- package/server/dataModel.d.ts +1 -0
- package/server/dataModel.js +1 -0
- package/skills/camox-block/SKILL.md +357 -0
- package/skills/camox-layout/SKILL.md +181 -0
- package/index.js +0 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Rémi de Juvigny
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthGate.d.ts","sourceRoot":"","sources":["../../src/components/AuthGate.tsx"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAED,wBAAgB,QAAQ,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,aAAa,6BAKzE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface AddBlockControlBarProps {
|
|
2
|
+
position: "top" | "bottom";
|
|
3
|
+
hidden: boolean;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
onMouseLeave: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const AddBlockControlBar: ({ position, hidden, onClick, onMouseLeave, }: AddBlockControlBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=AddBlockControlBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddBlockControlBar.d.ts","sourceRoot":"","sources":["../../../src/core/components/AddBlockControlBar.tsx"],"names":[],"mappings":"AAIA,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,GAAI,8CAKhC,uBAAuB,4CAiEzB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { OVERLAY_COLORS } from "../../features/preview/overlayConstants.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/core/components/AddBlockControlBar.tsx
|
|
5
|
+
var AddBlockControlBar = ({ position, hidden, onClick, onMouseLeave }) => {
|
|
6
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
style: {
|
|
9
|
+
position: "absolute",
|
|
10
|
+
top: position === "top" ? 0 : void 0,
|
|
11
|
+
bottom: position === "bottom" ? 0 : void 0,
|
|
12
|
+
left: "50%",
|
|
13
|
+
right: 0,
|
|
14
|
+
height: "36px",
|
|
15
|
+
transform: position === "top" ? "translateX(-50%) translateY(-50%)" : "translateX(-50%) translateY(50%)",
|
|
16
|
+
width: "fit-content",
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
zIndex: 11,
|
|
21
|
+
opacity: hidden ? 0 : 1,
|
|
22
|
+
pointerEvents: hidden ? "none" : "auto",
|
|
23
|
+
transition: "opacity 150ms ease"
|
|
24
|
+
},
|
|
25
|
+
onMouseLeave,
|
|
26
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
27
|
+
style: {
|
|
28
|
+
width: "120px",
|
|
29
|
+
height: "36px",
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
justifyContent: "center"
|
|
33
|
+
},
|
|
34
|
+
onMouseEnter: () => setIsExpanded(true),
|
|
35
|
+
onMouseLeave: () => setIsExpanded(false),
|
|
36
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
37
|
+
style: {
|
|
38
|
+
display: "flex",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
gap: isExpanded ? "4px" : "0px",
|
|
41
|
+
padding: isExpanded ? "4px 8px" : "0px",
|
|
42
|
+
width: isExpanded ? "auto" : "20px",
|
|
43
|
+
height: isExpanded ? "auto" : "20px",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
backgroundColor: OVERLAY_COLORS.selected,
|
|
46
|
+
color: "white",
|
|
47
|
+
border: "none",
|
|
48
|
+
borderRadius: "9999px",
|
|
49
|
+
fontSize: "12px",
|
|
50
|
+
fontWeight: 500,
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
whiteSpace: "nowrap",
|
|
53
|
+
transition: "all 150ms ease"
|
|
54
|
+
},
|
|
55
|
+
onClick,
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
style: { lineHeight: 1 },
|
|
58
|
+
children: "+"
|
|
59
|
+
}), isExpanded && /* @__PURE__ */ jsx("span", { children: "Add block" })]
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { AddBlockControlBar };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A ContentEditable that renders a <span> instead of <div>,
|
|
4
|
+
* so it can be nested inside phrasing elements like <h1>, <p>, etc.
|
|
5
|
+
*/
|
|
6
|
+
export declare const InlineContentEditable: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
//# sourceMappingURL=InlineContentEditable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineContentEditable.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,qBAAqB,+GA6ChC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
//#region src/core/components/lexical/InlineContentEditable.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A ContentEditable that renders a <span> instead of <div>,
|
|
7
|
+
* so it can be nested inside phrasing elements like <h1>, <p>, etc.
|
|
8
|
+
*/
|
|
9
|
+
var InlineContentEditable = React.forwardRef(function InlineContentEditable(props, ref) {
|
|
10
|
+
const [editor] = useLexicalComposerContext();
|
|
11
|
+
const [isEditable, setEditable] = React.useState(false);
|
|
12
|
+
const handleRef = React.useCallback((el) => {
|
|
13
|
+
if (el?.ownerDocument?.defaultView) editor.setRootElement(el);
|
|
14
|
+
else editor.setRootElement(null);
|
|
15
|
+
}, [editor]);
|
|
16
|
+
const mergedRef = React.useMemo(() => {
|
|
17
|
+
return (el) => {
|
|
18
|
+
handleRef(el);
|
|
19
|
+
if (typeof ref === "function") ref(el);
|
|
20
|
+
else if (ref) ref.current = el;
|
|
21
|
+
};
|
|
22
|
+
}, [handleRef, ref]);
|
|
23
|
+
React.useLayoutEffect(() => {
|
|
24
|
+
editor.setEditable(false);
|
|
25
|
+
return editor.registerEditableListener(setEditable);
|
|
26
|
+
}, [editor]);
|
|
27
|
+
const handleBlur = React.useCallback(() => {
|
|
28
|
+
editor.setEditable(false);
|
|
29
|
+
}, [editor]);
|
|
30
|
+
return /* @__PURE__ */ jsx("span", {
|
|
31
|
+
...props,
|
|
32
|
+
contentEditable: isEditable,
|
|
33
|
+
ref: mergedRef,
|
|
34
|
+
role: "textbox",
|
|
35
|
+
spellCheck: true,
|
|
36
|
+
onBlur: handleBlur
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//#endregion
|
|
40
|
+
export { InlineContentEditable };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface InlineLexicalEditorProps {
|
|
3
|
+
initialState: string;
|
|
4
|
+
externalState: string;
|
|
5
|
+
onChange: (serialized: string) => void;
|
|
6
|
+
onFocus: () => void;
|
|
7
|
+
onBlur: () => void;
|
|
8
|
+
activateRef?: React.RefObject<(() => void) | null>;
|
|
9
|
+
}
|
|
10
|
+
export declare function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur, activateRef, }: InlineLexicalEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=InlineLexicalEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineLexicalEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,wBAAwB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;CACpD;AA0FD,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,EACN,WAAW,GACZ,EAAE,wBAAwB,2CAsD1B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
|
|
2
|
+
import { InlineContentEditable } from "./InlineContentEditable.js";
|
|
3
|
+
import { SelectionBroadcaster } from "./SelectionBroadcaster.js";
|
|
4
|
+
import { useFrame } from "@camox/ui/frame";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
8
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
|
+
import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
|
|
10
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
11
|
+
import { COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND } from "lexical";
|
|
12
|
+
//#region src/core/components/lexical/InlineLexicalEditor.tsx
|
|
13
|
+
function ExternalStateSync({ externalState }) {
|
|
14
|
+
const [editor] = useLexicalComposerContext();
|
|
15
|
+
const isFocusedRef = React.useRef(false);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
return editor.registerRootListener((root) => {
|
|
18
|
+
if (!root) return;
|
|
19
|
+
const handleFocus = () => {
|
|
20
|
+
isFocusedRef.current = true;
|
|
21
|
+
};
|
|
22
|
+
const handleBlur = () => {
|
|
23
|
+
isFocusedRef.current = false;
|
|
24
|
+
};
|
|
25
|
+
root.addEventListener("focus", handleFocus);
|
|
26
|
+
root.addEventListener("blur", handleBlur);
|
|
27
|
+
return () => {
|
|
28
|
+
root.removeEventListener("focus", handleFocus);
|
|
29
|
+
root.removeEventListener("blur", handleBlur);
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}, [editor]);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (isFocusedRef.current) return;
|
|
35
|
+
try {
|
|
36
|
+
const normalized = normalizeLexicalState(externalState);
|
|
37
|
+
const newState = editor.parseEditorState(normalized);
|
|
38
|
+
editor.setEditorState(newState);
|
|
39
|
+
} catch {}
|
|
40
|
+
}, [editor, externalState]);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function EscapeHandler() {
|
|
44
|
+
const [editor] = useLexicalComposerContext();
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
return editor.registerCommand(KEY_ESCAPE_COMMAND, () => {
|
|
47
|
+
editor.getRootElement()?.blur();
|
|
48
|
+
return true;
|
|
49
|
+
}, COMMAND_PRIORITY_LOW);
|
|
50
|
+
}, [editor]);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function ActivateHandler({ activateRef }) {
|
|
54
|
+
const [editor] = useLexicalComposerContext();
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
activateRef.current = () => {
|
|
57
|
+
editor.setEditable(true);
|
|
58
|
+
editor.focus();
|
|
59
|
+
};
|
|
60
|
+
return () => {
|
|
61
|
+
activateRef.current = null;
|
|
62
|
+
};
|
|
63
|
+
}, [editor, activateRef]);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function FocusBlurHandler({ onFocus, onBlur }) {
|
|
67
|
+
const [editor] = useLexicalComposerContext();
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
return editor.registerRootListener((root) => {
|
|
70
|
+
if (!root) return;
|
|
71
|
+
root.addEventListener("focus", onFocus);
|
|
72
|
+
root.addEventListener("blur", onBlur);
|
|
73
|
+
return () => {
|
|
74
|
+
root.removeEventListener("focus", onFocus);
|
|
75
|
+
root.removeEventListener("blur", onBlur);
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}, [
|
|
79
|
+
editor,
|
|
80
|
+
onFocus,
|
|
81
|
+
onBlur
|
|
82
|
+
]);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, onBlur, activateRef }) {
|
|
86
|
+
const { window: iframeWindow } = useFrame();
|
|
87
|
+
const timerRef = React.useRef(null);
|
|
88
|
+
const isDirtyRef = React.useRef(false);
|
|
89
|
+
const config = React.useMemo(() => createEditorConfig(initialState), []);
|
|
90
|
+
const handleChange = React.useCallback((editorState) => {
|
|
91
|
+
if (!isDirtyRef.current) return;
|
|
92
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
93
|
+
timerRef.current = window.setTimeout(() => {
|
|
94
|
+
onChange(JSON.stringify(editorState.toJSON()));
|
|
95
|
+
}, 300);
|
|
96
|
+
}, [onChange]);
|
|
97
|
+
const handleFocus = React.useCallback(() => {
|
|
98
|
+
isDirtyRef.current = true;
|
|
99
|
+
onFocus();
|
|
100
|
+
}, [onFocus]);
|
|
101
|
+
const handleBlur = React.useCallback(() => {
|
|
102
|
+
isDirtyRef.current = false;
|
|
103
|
+
onBlur();
|
|
104
|
+
}, [onBlur]);
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
return () => {
|
|
107
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
return /* @__PURE__ */ jsxs(LexicalComposer, {
|
|
111
|
+
initialConfig: config,
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsx(RichTextPlugin, {
|
|
114
|
+
contentEditable: /* @__PURE__ */ jsx(InlineContentEditable, { style: { outline: "none" } }),
|
|
115
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx(OnChangePlugin, { onChange: handleChange }),
|
|
118
|
+
/* @__PURE__ */ jsx(ExternalStateSync, { externalState }),
|
|
119
|
+
/* @__PURE__ */ jsx(EscapeHandler, {}),
|
|
120
|
+
activateRef && /* @__PURE__ */ jsx(ActivateHandler, { activateRef }),
|
|
121
|
+
/* @__PURE__ */ jsx(FocusBlurHandler, {
|
|
122
|
+
onFocus: handleFocus,
|
|
123
|
+
onBlur: handleBlur
|
|
124
|
+
}),
|
|
125
|
+
iframeWindow && /* @__PURE__ */ jsx(SelectionBroadcaster, { targetWindow: iframeWindow })
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function LexicalErrorBoundary({ children }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { InlineLexicalEditor };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ParagraphNode, EditorConfig, SerializedParagraphNode } from 'lexical';
|
|
2
|
+
export declare class InlineParagraphNode extends ParagraphNode {
|
|
3
|
+
static getType(): string;
|
|
4
|
+
static clone(node: InlineParagraphNode): InlineParagraphNode;
|
|
5
|
+
createDOM(_config: EditorConfig): HTMLElement;
|
|
6
|
+
updateDOM(): boolean;
|
|
7
|
+
static importJSON(serializedNode: SerializedParagraphNode): InlineParagraphNode;
|
|
8
|
+
exportJSON(): SerializedParagraphNode;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=InlineParagraphNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineParagraphNode.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/InlineParagraphNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEzF,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,mBAAmB,GAAG,mBAAmB;IAI5D,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAO7C,SAAS,IAAI,OAAO;IAIpB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,uBAAuB,GAAG,mBAAmB;IAQ/E,UAAU,IAAI,uBAAuB;CAMtC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ParagraphNode } from "lexical";
|
|
2
|
+
//#region src/core/components/lexical/InlineParagraphNode.ts
|
|
3
|
+
var InlineParagraphNode = class InlineParagraphNode extends ParagraphNode {
|
|
4
|
+
static getType() {
|
|
5
|
+
return "inline-paragraph";
|
|
6
|
+
}
|
|
7
|
+
static clone(node) {
|
|
8
|
+
return new InlineParagraphNode(node.__key);
|
|
9
|
+
}
|
|
10
|
+
createDOM(_config) {
|
|
11
|
+
const span = document.createElement("span");
|
|
12
|
+
const dir = this.getDirection();
|
|
13
|
+
if (dir) span.dir = dir;
|
|
14
|
+
return span;
|
|
15
|
+
}
|
|
16
|
+
updateDOM() {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
static importJSON(serializedNode) {
|
|
20
|
+
const node = new InlineParagraphNode();
|
|
21
|
+
node.setDirection(serializedNode.direction);
|
|
22
|
+
node.setFormat(serializedNode.format);
|
|
23
|
+
node.setIndent(serializedNode.indent);
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
exportJSON() {
|
|
27
|
+
return {
|
|
28
|
+
...super.exportJSON(),
|
|
29
|
+
type: "inline-paragraph"
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { InlineParagraphNode };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionBroadcaster.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/SelectionBroadcaster.tsx"],"names":[],"mappings":"AAQA,UAAU,yBAAyB;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,YAAY,EAAE,EAAE,yBAAyB,QAwE/E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isOverlayMessage, postOverlayMessage } from "../../../features/preview/overlayMessages.js";
|
|
2
|
+
import { TEXT_MODIFIERS } from "../../lib/modifiers.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
5
|
+
import { $getSelection, $isRangeSelection, FORMAT_TEXT_COMMAND } from "lexical";
|
|
6
|
+
//#region src/core/components/lexical/SelectionBroadcaster.tsx
|
|
7
|
+
function SelectionBroadcaster({ targetWindow }) {
|
|
8
|
+
const [editor] = useLexicalComposerContext();
|
|
9
|
+
const broadcastSelection = React.useCallback(() => {
|
|
10
|
+
const nativeSelection = targetWindow.getSelection();
|
|
11
|
+
if (!(nativeSelection != null && nativeSelection.rangeCount > 0 && !nativeSelection.isCollapsed)) {
|
|
12
|
+
postOverlayMessage({
|
|
13
|
+
type: "CAMOX_TEXT_SELECTION_STATE",
|
|
14
|
+
hasSelection: false,
|
|
15
|
+
activeFormats: 0
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let format = 0;
|
|
20
|
+
editor.getEditorState().read(() => {
|
|
21
|
+
const selection = $getSelection();
|
|
22
|
+
if (!$isRangeSelection(selection)) return;
|
|
23
|
+
for (const modifier of Object.values(TEXT_MODIFIERS)) {
|
|
24
|
+
const key = modifier === TEXT_MODIFIERS.bold ? "bold" : "italic";
|
|
25
|
+
if (selection.hasFormat(key)) format |= modifier.formatFlag;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
postOverlayMessage({
|
|
29
|
+
type: "CAMOX_TEXT_SELECTION_STATE",
|
|
30
|
+
hasSelection: true,
|
|
31
|
+
activeFormats: format
|
|
32
|
+
});
|
|
33
|
+
}, [editor, targetWindow]);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
const doc = targetWindow.document;
|
|
36
|
+
const handleSelectionChange = () => broadcastSelection();
|
|
37
|
+
doc.addEventListener("selectionchange", handleSelectionChange);
|
|
38
|
+
return () => doc.removeEventListener("selectionchange", handleSelectionChange);
|
|
39
|
+
}, [targetWindow, broadcastSelection]);
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
const handleMessage = (event) => {
|
|
42
|
+
const data = event.data;
|
|
43
|
+
if (!isOverlayMessage(data) || data.type !== "CAMOX_FORMAT_TEXT") return;
|
|
44
|
+
const root = editor.getRootElement();
|
|
45
|
+
const nativeSelection = targetWindow.getSelection();
|
|
46
|
+
if (!root || !nativeSelection || nativeSelection.rangeCount === 0) return;
|
|
47
|
+
if (!root.contains(nativeSelection.anchorNode)) return;
|
|
48
|
+
root.focus();
|
|
49
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, data.formatKey);
|
|
50
|
+
setTimeout(broadcastSelection, 10);
|
|
51
|
+
};
|
|
52
|
+
targetWindow.addEventListener("message", handleMessage);
|
|
53
|
+
return () => targetWindow.removeEventListener("message", handleMessage);
|
|
54
|
+
}, [
|
|
55
|
+
editor,
|
|
56
|
+
targetWindow,
|
|
57
|
+
broadcastSelection
|
|
58
|
+
]);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { SelectionBroadcaster };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface SidebarLexicalEditorProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (serialized: string) => void;
|
|
4
|
+
onFocus?: () => void;
|
|
5
|
+
onBlur?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function SidebarLexicalEditor({ value, onChange, onFocus, onBlur, }: SidebarLexicalEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SidebarLexicalEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarLexicalEditor.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/SidebarLexicalEditor.tsx"],"names":[],"mappings":"AAYA,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAsCD,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,GACP,EAAE,yBAAyB,2CA8C3B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InitialConfigType } from '@lexical/react/LexicalComposer';
|
|
2
|
+
export declare function normalizeLexicalState(value: string): string;
|
|
3
|
+
export declare function createEditorConfig(initialState: string | undefined): InitialConfigType;
|
|
4
|
+
//# sourceMappingURL=editorConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/components/lexical/editorConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAMxE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAgBtF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isLexicalState, plainTextToLexicalState } from "../../lib/lexicalState.js";
|
|
2
|
+
import { InlineParagraphNode } from "./InlineParagraphNode.js";
|
|
3
|
+
import { ParagraphNode } from "lexical";
|
|
4
|
+
//#region src/core/components/lexical/editorConfig.ts
|
|
5
|
+
function normalizeLexicalState(value) {
|
|
6
|
+
if (isLexicalState(value)) return value;
|
|
7
|
+
return plainTextToLexicalState(value);
|
|
8
|
+
}
|
|
9
|
+
function createEditorConfig(initialState) {
|
|
10
|
+
return {
|
|
11
|
+
namespace: "camox",
|
|
12
|
+
editorState: initialState ? normalizeLexicalState(initialState) : void 0,
|
|
13
|
+
onError: (error) => {
|
|
14
|
+
console.error("Lexical error:", error);
|
|
15
|
+
},
|
|
16
|
+
nodes: [InlineParagraphNode, {
|
|
17
|
+
replace: ParagraphNode,
|
|
18
|
+
with: () => new InlineParagraphNode(),
|
|
19
|
+
withKlass: InlineParagraphNode
|
|
20
|
+
}]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createEditorConfig, normalizeLexicalState };
|