camox 0.44.0 → 0.45.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/dist/components/AuthGate.js +0 -6
- package/dist/components/DeviceSelector.js +96 -0
- package/dist/components/PlatformLabel.js +20 -24
- package/dist/core/components/lexical/HighlightNode.js +1 -1
- package/dist/core/components/lexical/InlineContentEditable.js +15 -19
- package/dist/core/components/lexical/InlineLexicalEditor.js +54 -74
- package/dist/core/components/lexical/InlineStylesPlugin.js +53 -53
- package/dist/core/components/lexical/MaxLengthPlugin.js +59 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +53 -54
- package/dist/core/components/lexical/SidebarLexicalEditor.js +322 -229
- package/dist/core/components/lexical/SummaryToggleGuard.js +42 -0
- package/dist/core/components/lexical/TextLinkPopover.js +169 -180
- package/dist/core/createApp.d.ts +241 -312
- package/dist/core/createApp.js +123 -29
- package/dist/core/createBlock.d.ts +5 -5
- package/dist/core/createBlock.js +385 -152
- package/dist/core/createCollection.d.ts +55 -0
- package/dist/core/createCollection.js +93 -0
- package/dist/core/createLayout.d.ts +197 -61
- package/dist/core/createLayout.js +114 -56
- package/dist/core/defineDocument.d.ts +3 -5
- package/dist/core/derivedRoutes.js +49 -1
- package/dist/core/dom.d.ts +13 -4
- package/dist/core/dom.js +44 -1
- package/dist/core/editing/BlockEditingRuntime.d.ts +16 -0
- package/dist/core/editing/BlockEditingRuntime.js +6 -15
- package/dist/core/editing/CompleteBlockEditingRuntime.js +28 -23
- package/dist/core/editing/createEditableBlock.d.ts +754 -633
- package/dist/core/editing/createEditableBlock.js +2113 -1066
- package/dist/core/editing/referenceWrites.js +51 -0
- package/dist/core/editing/useLatestRecord.js +90 -0
- package/dist/core/hooks/useArtifactHost.js +139 -0
- package/dist/core/hooks/useFieldSelection.js +43 -18
- package/dist/core/hooks/useIsEditable.js +12 -10
- package/dist/core/hooks/useOverlayMessage.js +15 -19
- package/dist/core/lib/artifact.d.ts +21 -0
- package/dist/core/lib/artifact.js +154 -0
- package/dist/core/lib/artifactColors.js +123 -0
- package/dist/core/lib/artifactData.d.ts +1 -0
- package/dist/core/lib/artifactData.js +131 -0
- package/dist/core/lib/artifactHost.js +205 -0
- package/dist/core/lib/artifactRuntime.js +36 -0
- package/dist/core/lib/artifactTheme.js +57 -0
- package/dist/core/lib/contentType.d.ts +302 -106
- package/dist/core/lib/contentType.js +201 -173
- package/dist/core/lib/fieldTypes.js +3 -0
- package/dist/core/lib/iconTypes.d.ts +3 -3
- package/dist/core/lib/icons.d.ts +4 -4
- package/dist/core/lib/icons.js +40 -44
- package/dist/core/lib/imagePlaceholder.js +177 -0
- package/dist/core/lib/imageTransform.js +1 -1
- package/dist/core/lib/lexicalReact.d.ts +3 -1
- package/dist/core/lib/lexicalState.js +1 -1
- package/dist/core/lib/previewPaused.js +9 -0
- package/dist/core/lib/recordScope.js +316 -0
- package/dist/core/lib/reference.d.ts +81 -0
- package/dist/core/lib/reference.js +29 -0
- package/dist/core/lib/textLinks.js +7 -5
- package/dist/core/lib/textStyles.d.ts +5 -7
- package/dist/core/lib/textStyles.js +2 -2
- package/dist/core/notFound.d.ts +7 -0
- package/dist/core/notFound.js +11 -0
- package/dist/core/pageDestinations.js +6 -3
- package/dist/core/recordItem.js +34 -0
- package/dist/core/requestContext.d.ts +26 -0
- package/dist/core/requestContext.js +20 -0
- package/dist/features/canvas/CamoxCanvas.js +1734 -0
- package/dist/features/canvas/CanvasBlockFrame.js +353 -0
- package/dist/features/canvas/CanvasBlockHeader.js +55 -0
- package/dist/features/canvas/CanvasLoadingScreen.js +35 -0
- package/dist/features/canvas/CanvasOverlays.js +254 -0
- package/dist/features/canvas/CanvasPageEdge.js +87 -0
- package/dist/features/canvas/CanvasPageFrame.js +335 -0
- package/dist/features/canvas/CanvasPageHeader.js +125 -0
- package/dist/features/canvas/CanvasPreviewPageSlot.js +103 -0
- package/dist/features/canvas/CanvasShelfMarker.js +255 -0
- package/dist/features/canvas/DerivedPagePathInput.js +238 -0
- package/dist/features/canvas/canvasCamera.js +229 -0
- package/dist/features/canvas/canvasFlight.js +104 -0
- package/dist/features/canvas/canvasFrameCapture.js +364 -0
- package/dist/features/canvas/canvasFrameDocument.js +317 -0
- package/dist/features/canvas/canvasFrameMode.js +53 -0
- package/dist/features/canvas/canvasInsertionSeams.js +44 -0
- package/dist/features/canvas/canvasItems.js +120 -0
- package/dist/features/canvas/canvasOverlayGeometry.js +240 -0
- package/dist/features/canvas/canvasPages.js +79 -0
- package/dist/features/canvas/canvasScreenSpace.js +26 -0
- package/dist/features/canvas/canvasSelection.js +18 -0
- package/dist/features/canvas/canvasStore.js +149 -0
- package/dist/features/canvas/canvasThumbnails.js +304 -0
- package/dist/features/canvas/canvasZoom.js +10 -0
- package/dist/features/canvas/sidebar/CanvasInspector.js +202 -0
- package/dist/features/canvas/sidebar/CanvasNavigator.js +226 -0
- package/dist/features/canvas/sidebar/CanvasSidebar.js +60 -0
- package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +48 -0
- package/dist/features/canvas/sidebar/CanvasSidebarSkeleton.js +39 -0
- package/dist/features/canvas/sidebar/CatalogBlockInspector.js +189 -0
- package/dist/features/canvas/sidebar/CuratedPageInspector.js +69 -0
- package/dist/features/canvas/sidebar/DerivedPageInspector.js +37 -0
- package/dist/features/canvas/sidebar/LayoutPageBlocks.js +78 -0
- package/dist/features/canvas/sidebar/LayoutPageOverview.js +71 -0
- package/dist/features/canvas/sidebar/PageInspector.js +157 -0
- package/dist/features/canvas/sidebar/PageInspectorSkeleton.js +90 -0
- package/dist/features/canvas/sidebar/PageOverview.js +27 -0
- package/dist/features/canvas/sidebar/SingletonPageInspector.js +31 -0
- package/dist/features/canvas/useCanvasCamera.js +803 -0
- package/dist/features/canvas/useCanvasFrame.js +149 -0
- package/dist/features/canvas/useCanvasFrameInput.js +97 -0
- package/dist/features/canvas/useCanvasNearness.js +57 -0
- package/dist/features/canvas/useDiscoveredPreviewPaths.js +62 -0
- package/dist/features/content/CamoxContent.d.ts +2 -5
- package/dist/features/content/CamoxContent.js +174 -271
- package/dist/features/content/CollectionItemSheetContext.js +106 -0
- package/dist/features/content/ContentAssets.js +315 -0
- package/dist/features/content/ContentCollection.js +663 -0
- package/dist/features/content/collection-form.js +58 -0
- package/dist/features/content/components/AssetCard.js +80 -84
- package/dist/features/content/components/AssetCardSkeleton.js +4 -8
- package/dist/features/content/components/ContentSidebar.js +129 -18
- package/dist/features/content/components/ContentSidebarGroup.js +37 -0
- package/dist/features/content/components/DeleteCollectionItemButton.js +202 -0
- package/dist/features/content/components/MissingFromLocale.js +282 -0
- package/dist/features/content/components/UploadDropZone.js +27 -31
- package/dist/features/content/components/UploadProgressDrawer.js +90 -98
- package/dist/features/navigation/navigation.d.ts +66 -20
- package/dist/features/navigation/navigation.js +257 -90
- package/dist/features/og/defaultFonts.js +8 -8
- package/dist/features/og/geist-variable-ttf-base64.js +1 -1
- package/dist/features/og/imageResponse.d.ts +8 -0
- package/dist/features/og/imageResponse.js +26 -0
- package/dist/features/page/CuratedPageContent.js +167 -0
- package/dist/features/page/DerivedPageContent.js +26 -30
- package/dist/features/page/SharedLayoutContent.js +25 -27
- package/dist/features/preview/CamoxPreview.d.ts +23 -61
- package/dist/features/preview/CamoxPreview.js +816 -537
- package/dist/features/preview/EditablePageContent.js +1 -1
- package/dist/features/preview/EditablePageExperience.js +16 -22
- package/dist/features/preview/components/AddBlockDialog.js +270 -0
- package/dist/features/preview/components/AssetFieldEditor.js +173 -154
- package/dist/features/preview/components/AssetLightbox.js +181 -134
- package/dist/features/preview/components/AssetPickerModal.js +153 -170
- package/dist/features/preview/components/BlockActionsPopover.js +150 -149
- package/dist/features/preview/components/BlockErrorBoundary.js +8 -12
- package/dist/features/preview/components/BlockThumbnail.js +176 -100
- package/dist/features/preview/components/CanvasPreview.js +243 -0
- package/dist/features/preview/components/CreatePageModal.js +128 -137
- package/dist/features/preview/components/DebouncedFieldEditor.js +29 -33
- package/dist/features/preview/components/DerivedLayoutDialog.js +21 -19
- package/dist/features/preview/components/DrillRow.js +150 -0
- package/dist/features/preview/components/FieldOverlayStyles.js +11 -8
- package/dist/features/preview/components/FieldToolbar.js +160 -110
- package/dist/features/preview/components/Frame.js +108 -20
- package/dist/features/preview/components/IconFieldEditor.js +62 -66
- package/dist/features/preview/components/ItemFieldsEditor.js +231 -205
- package/dist/features/preview/components/LinkFieldEditor.js +135 -139
- package/dist/features/preview/components/Metadata.js +22 -30
- package/dist/features/preview/components/MobilePreviewDrawer.js +89 -108
- package/dist/features/preview/components/MultipleAssetFieldEditor.js +334 -246
- package/dist/features/preview/components/OverlayTracker.js +9 -41
- package/dist/features/preview/components/Overlays.js +81 -69
- package/dist/features/preview/components/PageInfo.js +1748 -0
- package/dist/features/preview/components/PageInfoSkeleton.js +51 -0
- package/dist/features/preview/components/PageLocationFieldset.js +112 -116
- package/dist/features/preview/components/PageNavigatorHeader.js +24 -0
- package/dist/features/preview/components/PageNicknameField.js +22 -26
- package/dist/features/preview/components/PagePicker.js +128 -130
- package/dist/features/preview/components/PageTree.js +525 -532
- package/dist/features/preview/components/PreviewActivation.js +28 -32
- package/dist/features/preview/components/PreviewPanel.js +620 -319
- package/dist/features/preview/components/PreviewToolbar.js +105 -333
- package/dist/features/preview/components/RecordCard.js +80 -0
- package/dist/features/preview/components/RecordCombobox.js +178 -0
- package/dist/features/preview/components/ReferenceFieldEditor.js +149 -0
- package/dist/features/preview/components/ReferenceListFieldEditor.js +432 -0
- package/dist/features/preview/components/RemovedBlockPlaceholder.js +95 -0
- package/dist/features/preview/components/RepeatableItemsList.js +125 -138
- package/dist/features/preview/components/SelectionEditor.js +993 -0
- package/dist/features/preview/components/ShikiMarkdown.js +14 -18
- package/dist/features/preview/components/SidebarSection.js +52 -64
- package/dist/features/preview/components/StudioEditingFallback.js +56 -0
- package/dist/features/preview/components/UnlinkAssetButton.js +104 -107
- package/dist/features/preview/components/blockGridNavigation.js +15 -0
- package/dist/features/preview/components/contentFieldSchema.js +8 -0
- package/dist/features/preview/components/useFieldWriter.js +200 -0
- package/dist/features/preview/components/useRecordView.js +383 -0
- package/dist/features/preview/components/useRepeatableItemActions.js +35 -37
- package/dist/features/preview/components/useUpdateBlockPosition.js +37 -37
- package/dist/features/preview/editingFrame.js +197 -0
- package/dist/features/preview/overlayHighlights.js +17 -44
- package/dist/features/preview/overlayMessages.js +72 -1
- package/dist/features/preview/pageRecord.js +189 -0
- package/dist/features/preview/previewConstants.js +6 -2
- package/dist/features/preview/previewPageFrame.js +95 -0
- package/dist/features/preview/previewPreparation.js +7 -0
- package/dist/features/preview/previewSelection.js +32 -63
- package/dist/features/preview/previewStore.js +225 -123
- package/dist/features/preview/referencePickerFocus.js +29 -0
- package/dist/features/preview/repeatableItemTargets.js +56 -0
- package/dist/features/preview/selectionReveal.js +21 -0
- package/dist/features/preview/usePreviewViewportActions.js +114 -0
- package/dist/features/preview/viewportContinuity.js +109 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +69 -44
- package/dist/features/provider/CamoxProvider.d.ts +3 -6
- package/dist/features/provider/CamoxProvider.js +38 -50
- package/dist/features/provider/CoreCamoxProvider.js +66 -50
- package/dist/features/provider/LocalhostPreviewProvider.js +78 -114
- package/dist/features/provider/PreviewSignInPage.js +54 -0
- package/dist/features/provider/components/CamoxAppContext.js +11 -11
- package/dist/features/provider/components/CommandPalette.js +75 -82
- package/dist/features/provider/useAdminShortcuts.js +7 -11
- package/dist/features/routes/pageRuntime.d.ts +44 -4
- package/dist/features/routes/pageRuntime.js +244 -137
- package/dist/features/runtime/RuntimeChrome.js +117 -115
- package/dist/features/runtime/alternates.js +64 -0
- package/dist/features/runtime/analytics.d.ts +7 -0
- package/dist/features/runtime/analytics.js +66 -0
- package/dist/features/runtime/artifactSources.js +87 -0
- package/dist/features/runtime/editingFallback.js +20 -0
- package/dist/features/runtime/linkPrefetch.js +97 -0
- package/dist/features/runtime/livePages.js +62 -0
- package/dist/features/runtime/llmsTxt.js +40 -0
- package/dist/features/runtime/loopbackFetch.js +18 -0
- package/dist/features/runtime/navigationAccessibility.js +51 -0
- package/dist/features/runtime/navigationTarget.js +23 -2
- package/dist/features/runtime/pageApp.js +229 -158
- package/dist/features/runtime/pageBlockTypes.js +20 -0
- package/dist/features/runtime/pageClient.d.ts +2 -4
- package/dist/features/runtime/pageClient.js +18 -3
- package/dist/features/runtime/pageNavigation.js +254 -32
- package/dist/features/runtime/pageServer.d.ts +2 -4
- package/dist/features/runtime/pageServer.js +6 -2
- package/dist/features/runtime/pageViewport.js +7 -0
- package/dist/features/runtime/runtime.d.ts +59 -24
- package/dist/features/runtime/runtime.js +779 -191
- package/dist/features/runtime/runtimeChromeLoader.js +58 -0
- package/dist/features/runtime/runtimeRoutes.d.ts +19 -0
- package/dist/features/runtime/runtimeRoutes.js +25 -0
- package/dist/features/runtime/scrollRestoration.js +133 -0
- package/dist/features/runtime/studioApp.d.ts +4 -3
- package/dist/features/runtime/studioApp.js +5 -9
- package/dist/features/runtime/studioClient.d.ts +2 -4
- package/dist/features/runtime/studioClient.js +12 -3
- package/dist/features/runtime/studioServer.d.ts +2 -4
- package/dist/features/runtime/studioServer.js +6 -1
- package/dist/features/runtime/worker.d.ts +6 -0
- package/dist/features/runtime/worker.js +23 -0
- package/dist/features/runtime/workerRequest.js +44 -0
- package/dist/features/studio/CamoxStudio.d.ts +2 -6
- package/dist/features/studio/CamoxStudio.js +34 -49
- package/dist/features/studio/FollowAgentProvider.js +338 -0
- package/dist/features/studio/components/ChatSidebar.js +356 -0
- package/dist/features/studio/components/DraftsControl.js +676 -0
- package/dist/features/studio/components/FaviconDialog.js +318 -0
- package/dist/features/studio/components/LocalePicker.js +785 -0
- package/dist/features/studio/components/Navbar.js +123 -103
- package/dist/features/studio/components/ProjectMenu.js +239 -260
- package/dist/features/studio/components/RenameDraftDialog.js +206 -0
- package/dist/features/studio/components/ReviewDraftSheet.js +1472 -0
- package/dist/features/studio/components/ThreadComposer.js +157 -0
- package/dist/features/studio/components/ThreadMarkdown.js +113 -0
- package/dist/features/studio/components/ThreadMessages.js +270 -0
- package/dist/features/studio/components/UserButton.js +34 -23
- package/dist/features/studio/draftLabel.js +33 -0
- package/dist/features/studio/draftNotice.js +13 -0
- package/dist/features/studio/followAgent.js +250 -0
- package/dist/features/studio/followAgentContext.js +7 -0
- package/dist/features/studio/localeOptions.js +118 -0
- package/dist/features/studio/localeSwitch.js +19 -0
- package/dist/features/studio/routes.js +48 -1
- package/dist/features/studio/studioStore.js +64 -1
- package/dist/features/studio/useTheme.js +24 -27
- package/dist/features/vite/artifactRuntimeMinification.js +36 -0
- package/dist/features/vite/blockBoilerplate.js +6 -5
- package/dist/features/vite/blockChunks.js +31 -0
- package/dist/features/vite/bundlerLogs.js +17 -0
- package/dist/features/vite/definitionsSync.js +158 -226
- package/dist/features/vite/devAuthentication.js +4 -16
- package/dist/features/vite/devSignIn.js +87 -0
- package/dist/features/vite/iconGeneration.js +1 -1
- package/dist/features/vite/layoutGeneration.js +11 -1
- package/dist/features/vite/publishSeededContent.js +30 -0
- package/dist/features/vite/routeGeneration.js +6 -7
- package/dist/features/vite/runtimeDev.js +80 -99
- package/dist/features/vite/vite.d.ts +51 -31
- package/dist/features/vite/vite.js +224 -127
- package/dist/features/vite/workerBuild.js +39 -0
- package/dist/hooks/use-debounced-field.js +116 -47
- package/dist/hooks/use-file-upload.js +114 -67
- package/dist/hooks/use-marquee-selection.js +32 -36
- package/dist/hooks/use-page-destinations.js +69 -37
- package/dist/lib/api-client-server.d.ts +5 -0
- package/dist/lib/api-client-server.js +10 -4
- package/dist/lib/api-client.d.ts +6 -0
- package/dist/lib/api-client.js +51 -16
- package/dist/lib/api-socket.js +17 -0
- package/dist/lib/auth-page-styles.js +39 -0
- package/dist/lib/auth.js +117 -61
- package/dist/lib/collection-cache.js +23 -0
- package/dist/lib/draft-scope.d.ts +4 -0
- package/dist/lib/draft-scope.js +222 -0
- package/dist/lib/html.js +12 -0
- package/dist/lib/link-pages.js +154 -0
- package/dist/lib/locale-path.d.ts +22 -0
- package/dist/lib/locale-path.js +57 -0
- package/dist/lib/normalized-data.js +252 -152
- package/dist/lib/preview-handoff.js +2 -2
- package/dist/lib/queries.d.ts +11 -0
- package/dist/lib/queries.js +70 -141
- package/dist/lib/studio-reads.d.ts +14 -0
- package/dist/lib/studio-reads.js +574 -0
- package/dist/lib/use-project-room.js +50 -50
- package/dist/lib/use-thread.js +310 -0
- package/dist/lib/utils.js +25 -29
- package/dist/lib/view-locale-context.js +22 -0
- package/dist/lib/view-locale.js +46 -0
- package/dist/package.js +5 -0
- package/dist/studio-overlays.css +41 -151
- package/dist/studio.css +2 -2
- package/package.json +70 -73
- package/skills/camox/SKILL.md +16 -11
- package/skills/camox/references/artifacts.md +179 -0
- package/skills/camox/references/block-definitions.md +75 -59
- package/skills/camox/references/cli-common.md +9 -11
- package/skills/camox/references/cli-content.md +92 -69
- package/skills/camox/references/cli-publishing.md +26 -0
- package/skills/camox/references/dom-integrations.md +27 -0
- package/skills/camox/references/field-styling.md +4 -4
- package/skills/camox/references/layout-definitions.md +16 -14
- package/skills/camox/references/localization.md +56 -0
- package/skills/camox/references/routed-layouts.md +133 -15
- package/skills/camox-expand/SKILL.md +69 -0
- package/skills/camox-expand/references/jobs.md +39 -0
- package/skills/camoxify/SKILL.md +29 -7
- package/dist/core/components/AddBlockControlBar.js +0 -78
- package/dist/core/hooks/useRequireDraftSource.js +0 -23
- package/dist/features/metadata/sitemap.d.ts +0 -8
- package/dist/features/metadata/sitemap.js +0 -17
- package/dist/features/og/imageResponse.node.d.ts +0 -12
- package/dist/features/og/imageResponse.node.js +0 -49
- package/dist/features/og/imageResponse.workerd.d.ts +0 -12
- package/dist/features/og/imageResponse.workerd.js +0 -40
- package/dist/features/page/PublishedPageContent.js +0 -205
- package/dist/features/page/PublishedPageExperience.js +0 -23
- package/dist/features/preview/DerivedPreview.js +0 -134
- package/dist/features/preview/commentsEnabled.js +0 -8
- package/dist/features/preview/components/AddBlockSidebar.js +0 -381
- package/dist/features/preview/components/AttachedComments.js +0 -331
- package/dist/features/preview/components/CommentHeader.js +0 -122
- package/dist/features/preview/components/CommentSidebar.js +0 -29
- package/dist/features/preview/components/CommentTargetQuote.js +0 -167
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +0 -5
- package/dist/features/preview/components/DerivedLayoutSidebar.js +0 -179
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +0 -69
- package/dist/features/preview/components/LeftSidebar.js +0 -68
- package/dist/features/preview/components/PageEditorSidebar.js +0 -563
- package/dist/features/preview/components/PageInfoSidebar.js +0 -1551
- package/dist/features/preview/components/PageNavigatorSidebar.js +0 -78
- package/dist/features/preview/components/PageStatusBadge.js +0 -97
- package/dist/features/preview/components/PeekedBlock.js +0 -217
- package/dist/features/preview/components/PreviewComments.js +0 -56
- package/dist/features/preview/components/PreviewToolbarSpacer.js +0 -43
- package/dist/features/preview/components/PublicationRow.js +0 -422
- package/dist/features/preview/components/PublishDialog.js +0 -194
- package/dist/features/preview/components/RightSidebar.js +0 -59
- package/dist/features/preview/components/SendFeedbackDialog.js +0 -83
- package/dist/features/preview/previewCommentsStore.js +0 -135
- package/dist/features/preview/publication.js +0 -81
- package/dist/features/preview/usePageComments.js +0 -39
- package/dist/features/runtime/SharedChromeContext.js +0 -7
- package/dist/features/studio/components/EnvironmentMenu.js +0 -425
- package/dist/features/vite/appGeneration.js +0 -89
- package/dist/lib/view-queries.js +0 -28
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/Matches.d.ts +0 -114
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/RouterProvider.d.ts +0 -25
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/config.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/defer.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/fileRoute.d.ts +0 -20
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/global.d.ts +0 -8
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/hash-scroll.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/index.d.ts +0 -18
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/link.d.ts +0 -161
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/load-matches.d.ts +0 -6
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/location.d.ts +0 -54
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/lru-cache.d.ts +0 -8
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/manifest.d.ts +0 -32
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/new-process-route-tree.d.ts +0 -115
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/not-found.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/redirect.d.ts +0 -49
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/rewrite.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/root.d.ts +0 -6
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/route.d.ts +0 -343
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/routeInfo.d.ts +0 -48
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/router.d.ts +0 -695
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/scroll-restoration.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchMiddleware.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/searchParams.d.ts +0 -5
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/RawStream.d.ts +0 -38
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/seroval-plugins.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/ssr/serializer/transformer.d.ts +0 -65
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/stores.d.ts +0 -69
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/structuralSharing.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/typePrimitives.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderData.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useLoaderDeps.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useNavigate.d.ts +0 -10
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useParams.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useRouteContext.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/useSearch.d.ts +0 -1
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/utils.d.ts +0 -28
- package/dist/node_modules/.pnpm/@tanstack_router-core@1.168.14/node_modules/@tanstack/router-core/dist/esm/validators.d.ts +0 -49
- package/skills/camox/references/cli-environments.md +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "camox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"camox": "./bin/camox.mjs"
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
14
|
"exports": {
|
|
15
|
+
"./createCollection": {
|
|
16
|
+
"types": "./dist/core/createCollection.d.ts",
|
|
17
|
+
"import": "./dist/core/createCollection.js"
|
|
18
|
+
},
|
|
15
19
|
"./dom": {
|
|
16
20
|
"types": "./dist/core/dom.d.ts",
|
|
17
21
|
"import": "./dist/core/dom.js"
|
|
@@ -56,10 +60,6 @@
|
|
|
56
60
|
"types": "./dist/features/vite/vite.d.ts",
|
|
57
61
|
"import": "./dist/features/vite/vite.js"
|
|
58
62
|
},
|
|
59
|
-
"./metadata": {
|
|
60
|
-
"types": "./dist/features/metadata/sitemap.d.ts",
|
|
61
|
-
"import": "./dist/features/metadata/sitemap.js"
|
|
62
|
-
},
|
|
63
63
|
"./_internal/pageServer": {
|
|
64
64
|
"types": "./dist/features/runtime/pageServer.d.ts",
|
|
65
65
|
"import": "./dist/features/runtime/pageServer.js"
|
|
@@ -81,87 +81,76 @@
|
|
|
81
81
|
"import": "./dist/features/runtime/runtime.js"
|
|
82
82
|
},
|
|
83
83
|
"./_internal/imageResponse": {
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
"import": "./dist/features/og/imageResponse.workerd.js"
|
|
91
|
-
},
|
|
92
|
-
"deno": {
|
|
93
|
-
"types": "./dist/features/og/imageResponse.workerd.d.ts",
|
|
94
|
-
"import": "./dist/features/og/imageResponse.workerd.js"
|
|
95
|
-
},
|
|
96
|
-
"default": {
|
|
97
|
-
"types": "./dist/features/og/imageResponse.node.d.ts",
|
|
98
|
-
"import": "./dist/features/og/imageResponse.node.js"
|
|
99
|
-
}
|
|
84
|
+
"types": "./dist/features/og/imageResponse.d.ts",
|
|
85
|
+
"import": "./dist/features/og/imageResponse.js"
|
|
86
|
+
},
|
|
87
|
+
"./worker": {
|
|
88
|
+
"types": "./dist/features/runtime/worker.d.ts",
|
|
89
|
+
"import": "./dist/features/runtime/worker.js"
|
|
100
90
|
},
|
|
101
91
|
"./studio.css": "./dist/studio.css"
|
|
102
92
|
},
|
|
103
93
|
"dependencies": {
|
|
104
|
-
"@base-ui/react": "^1.
|
|
94
|
+
"@base-ui/react": "^1.9.0",
|
|
105
95
|
"@dnd-kit/core": "^6.3.1",
|
|
106
96
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
107
97
|
"@dnd-kit/sortable": "^10.0.0",
|
|
108
98
|
"@dnd-kit/utilities": "^3.2.2",
|
|
109
|
-
"@lexical/link": "^0.
|
|
110
|
-
"@lexical/markdown": "^0.
|
|
111
|
-
"@lexical/react": "^0.
|
|
112
|
-
"@lexical/rich-text": "^0.
|
|
113
|
-
"@
|
|
114
|
-
"@orpc/
|
|
115
|
-
"@
|
|
116
|
-
"@shikijs/
|
|
117
|
-
"@shikijs/
|
|
118
|
-
"@shikijs/
|
|
119
|
-
"@
|
|
120
|
-
"@
|
|
121
|
-
"@takumi-rs/
|
|
122
|
-
"@tanstack/react-form": "^1.
|
|
123
|
-
"@tanstack/react-query-devtools": "^5.
|
|
124
|
-
"@tanstack/react-virtual": "^3.14.
|
|
125
|
-
"@unhead/react": "^3.
|
|
126
|
-
"@xstate/store": "3.
|
|
127
|
-
"@xstate/store-react": "^1.0
|
|
128
|
-
"better-auth": "^1.
|
|
129
|
-
"fractional-indexing": "^
|
|
130
|
-
"hono": "^4.
|
|
131
|
-
"lexical": "^0.
|
|
132
|
-
"lucide-react": "^
|
|
133
|
-
"marked": "^18.
|
|
134
|
-
"partysocket": "^1.
|
|
135
|
-
"react": "^19.
|
|
99
|
+
"@lexical/link": "^0.52.0",
|
|
100
|
+
"@lexical/markdown": "^0.52.0",
|
|
101
|
+
"@lexical/react": "^0.52.0",
|
|
102
|
+
"@lexical/rich-text": "^0.52.0",
|
|
103
|
+
"@lexical/utils": "^0.52.0",
|
|
104
|
+
"@orpc/client": "^1.15.7",
|
|
105
|
+
"@orpc/tanstack-query": "^1.15.7",
|
|
106
|
+
"@shikijs/core": "^4.5.0",
|
|
107
|
+
"@shikijs/engine-javascript": "^4.5.0",
|
|
108
|
+
"@shikijs/langs": "^4.5.0",
|
|
109
|
+
"@shikijs/themes": "^4.5.0",
|
|
110
|
+
"@sinclair/typebox": "^0.34.52",
|
|
111
|
+
"@takumi-rs/image-response": "^2.16.3",
|
|
112
|
+
"@tanstack/react-form": "^1.33.5",
|
|
113
|
+
"@tanstack/react-query-devtools": "^5.104.3",
|
|
114
|
+
"@tanstack/react-virtual": "^3.14.20",
|
|
115
|
+
"@unhead/react": "^3.4.3",
|
|
116
|
+
"@xstate/store": "4.3.0",
|
|
117
|
+
"@xstate/store-react": "^2.1.0",
|
|
118
|
+
"better-auth": "^1.7.10",
|
|
119
|
+
"fractional-indexing": "^4.0.0",
|
|
120
|
+
"hono": "^4.13.13",
|
|
121
|
+
"lexical": "^0.52.0",
|
|
122
|
+
"lucide-react": "^1.57.0",
|
|
123
|
+
"marked": "^18.1.1",
|
|
124
|
+
"partysocket": "^1.3.0",
|
|
125
|
+
"react": "^19.3.1",
|
|
136
126
|
"react-compiler-runtime": "^1.0.0",
|
|
137
|
-
"react-dom": "^19.
|
|
127
|
+
"react-dom": "^19.3.1",
|
|
138
128
|
"react-og-preview": "^0.2.0",
|
|
139
|
-
"shiki": "^4.
|
|
140
|
-
"unhead": "^3.
|
|
141
|
-
"zod": "^4.
|
|
142
|
-
"@camox/api-contract": "0.
|
|
143
|
-
"@camox/
|
|
144
|
-
"@camox/
|
|
129
|
+
"shiki": "^4.5.0",
|
|
130
|
+
"unhead": "^3.4.3",
|
|
131
|
+
"zod": "^4.6.7",
|
|
132
|
+
"@camox/api-contract": "0.45.0",
|
|
133
|
+
"@camox/ui": "0.45.0",
|
|
134
|
+
"@camox/cli": "0.45.0"
|
|
145
135
|
},
|
|
146
136
|
"devDependencies": {
|
|
147
|
-
"@
|
|
148
|
-
"@
|
|
149
|
-
"@
|
|
150
|
-
"@tailwindcss/cli": "^4.3.
|
|
151
|
-
"@types/babel__core": "^7.20.5",
|
|
137
|
+
"@earendil-works/pi-ai": "1.3.0",
|
|
138
|
+
"@earendil-works/pi-durable": "1.3.0",
|
|
139
|
+
"@orpc/server": "^1.15.7",
|
|
140
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
152
141
|
"@types/node": "^24.12.4",
|
|
153
|
-
"@types/react": "^19.0
|
|
154
|
-
"@types/react-dom": "^19.
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"tsx": "^4.22.2",
|
|
142
|
+
"@types/react": "^19.3.0",
|
|
143
|
+
"@types/react-dom": "^19.3.0",
|
|
144
|
+
"happy-dom": "^21.0.1",
|
|
145
|
+
"oxc-transform-react": "^0.152.0",
|
|
146
|
+
"tailwindcss": "^4.3.3",
|
|
147
|
+
"tsx": "^4.23.15",
|
|
160
148
|
"tw-animate-css": "^1.4.0",
|
|
161
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@
|
|
162
|
-
"vite-plus": "
|
|
149
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
150
|
+
"vite-plus": "1.3.0"
|
|
163
151
|
},
|
|
164
152
|
"peerDependencies": {
|
|
153
|
+
"@cloudflare/vite-plugin": "^1.64.0",
|
|
165
154
|
"@tanstack/react-query": "^5.95.0",
|
|
166
155
|
"@tanstack/react-router": "^1.166.2",
|
|
167
156
|
"@tanstack/react-router-ssr-query": "^1.166.2",
|
|
@@ -170,14 +159,22 @@
|
|
|
170
159
|
"nx": {
|
|
171
160
|
"tags": [
|
|
172
161
|
"type:pkg"
|
|
173
|
-
]
|
|
162
|
+
],
|
|
163
|
+
"targets": {
|
|
164
|
+
"test": {
|
|
165
|
+
"dependsOn": [
|
|
166
|
+
"^build"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
174
170
|
},
|
|
175
171
|
"scripts": {
|
|
176
172
|
"dev": "mkdir -p .dev && cp ./src/features/preview/studio-overlays.css ./.dev/studio-overlays.css && tailwindcss -i ./src/studio.css -o ./.dev/studio.css --watch",
|
|
177
173
|
"build": "vp pack && tailwindcss -i ./src/studio.css -o ./dist/studio.css --minify && cp ./src/features/preview/studio-overlays.css ./dist/studio-overlays.css",
|
|
178
174
|
"build:watch": "vp pack --watch",
|
|
179
|
-
"
|
|
175
|
+
"test": "tsx --test \"src/**/*.test.ts\" \"src/**/*.test.tsx\"",
|
|
180
176
|
"test:inline": "tsx --test src/core/lib/inlineText.test.tsx src/core/components/lexical/inlineEditing.test.tsx",
|
|
181
|
-
"
|
|
177
|
+
"test:images": "tsx --test src/core/lib/imagePlaceholder.test.tsx src/core/createBlock.test.tsx",
|
|
178
|
+
"test:content": "tsx --test src/features/content/content.test.tsx src/features/content/delete-collection-item.test.tsx"
|
|
182
179
|
}
|
|
183
180
|
}
|
package/skills/camox/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: camox
|
|
3
|
-
description: Use when working in a Camox codebase with Block Definitions, Layout Definitions, Pages, Block content, the Camox CLI,
|
|
3
|
+
description: Use when working in a Camox codebase with Block Definitions, Layout Definitions, Pages, Block content, the Camox CLI, or publishing. Applies to code-defined site structure and agent-driven content changes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Camox
|
|
@@ -11,13 +11,22 @@ Read only the references needed for the current task. Do not preload every refer
|
|
|
11
11
|
|
|
12
12
|
- Create a block or change its schema or field rendering API in `src/blocks/`:
|
|
13
13
|
[Block Definitions](references/block-definitions.md).
|
|
14
|
-
- Create or change a curated layout (a reusable shell for editor-created pages), including
|
|
14
|
+
- Create or change a curated layout (a reusable shell for editor-created pages), including navbar/footer layout slots:
|
|
15
15
|
[Layout Definitions](references/layout-definitions.md).
|
|
16
16
|
- Create or change a singleton page (a code-owned fixed URL) or derived route (a code-owned data-driven route) in `src/layouts/`:
|
|
17
17
|
[Routed layouts](references/routed-layouts.md).
|
|
18
18
|
- Share content across layouts with `synced: true`, independently of `layoutOnly`:
|
|
19
19
|
[Synced blocks](references/block-definitions.md#synced-blocks-synced-optional).
|
|
20
20
|
|
|
21
|
+
## Localized code
|
|
22
|
+
|
|
23
|
+
Every block, layout and component renders in every locale the project publishes:
|
|
24
|
+
|
|
25
|
+
- Put every visible text in blocks, layout blocks included. Camox translates block content, never JSX.
|
|
26
|
+
- Pass internal links through `useLocalizedHref` from `camox/navigation`, and write paths without a locale prefix.
|
|
27
|
+
|
|
28
|
+
For a locale switcher, a loader fetching localized data, or the details of either rule: [Localization](references/localization.md).
|
|
29
|
+
|
|
21
30
|
## Specialized block work
|
|
22
31
|
|
|
23
32
|
- DOM listeners, scrolling, browser scripts, or third-party widgets:
|
|
@@ -25,6 +34,8 @@ Read only the references needed for the current task. Do not preload every refer
|
|
|
25
34
|
Preview DOM lives in an iframe; component globals target the editor.
|
|
26
35
|
- Customize inline text/link formatting or highlights:
|
|
27
36
|
[Field styling](references/field-styling.md).
|
|
37
|
+
- Bespoke visuals or widgets as code (animations, 3D scenes, interactive widgets), declaring `field.artifact` or writing an artifact source:
|
|
38
|
+
[Artifacts](references/artifacts.md).
|
|
28
39
|
|
|
29
40
|
For specialized changes to an existing block, read the specialist reference directly. Also read Block Definitions only if creating a block or changing its schema or other field rendering APIs.
|
|
30
41
|
|
|
@@ -32,16 +43,10 @@ For specialized changes to an existing block, read the specialist reference dire
|
|
|
32
43
|
|
|
33
44
|
For any CLI operation, first read [CLI common guidance](references/cli-common.md), then only the relevant command reference:
|
|
34
45
|
|
|
35
|
-
- Pages, metadata, layout assignments,
|
|
46
|
+
- Pages, metadata, layout assignments, Blocks, content, or ordering:
|
|
36
47
|
[CLI Content](references/cli-content.md).
|
|
37
|
-
-
|
|
38
|
-
[CLI
|
|
39
|
-
- Production targeting or environment replication:
|
|
40
|
-
[CLI Environments](references/cli-environments.md).
|
|
41
|
-
|
|
42
|
-
## Addressing feedback
|
|
43
|
-
|
|
44
|
-
When asked to address feedback on a Page, read [CLI common guidance](references/cli-common.md) and [CLI Content — Comments](references/cli-content.md#comments), plus the relevant references for each change. Run `{{CAMOX_CMD}} comments list --page-id <PAGE_ID>` to load the Page's comments. For each unresolved comment, inspect its message and target, then find the relevant Page, Block, item, or field with the CLI (and its code definition if applicable). Make the required changes using the CLI for content and code for definitions. Only after addressing a comment, run `{{CAMOX_CMD}} comments resolve --page-id <PAGE_ID> --id <COMMENT_UUID>`. Leave comments you could not address unresolved and explain why. Re-list the Page's comments to verify their status. Do not publish draft changes unless requested.
|
|
48
|
+
- Where the CLI writes, publishing or discarding the development draft, or its status:
|
|
49
|
+
[CLI Publishing](references/cli-publishing.md).
|
|
45
50
|
|
|
46
51
|
Code definitions do not place blocks on existing Pages or assign their layouts; `blocks.initial` only seeds the initial homepage. When the request includes placement or assignment on existing Pages, follow with the relevant CLI workflow. Singleton pages and derived routes are declared in code, not created through the pages CLI.
|
|
47
52
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Artifacts
|
|
2
|
+
|
|
3
|
+
An **artifact** is a field whose content is a self-contained web page (its **artifact source**), usually written by an agent and rendered in a sandboxed `<iframe>`. Artifacts hold bespoke visuals and interactions that blocks can't express: animated SVGs, 3D scenes, small interactive widgets.
|
|
4
|
+
|
|
5
|
+
## Artifact or block?
|
|
6
|
+
|
|
7
|
+
Pick an artifact when the element is really code: a one-off visual whose value is in how it moves or responds, which editors would never restructure. Pick a block for anything editors write, reorder, or reuse: headings, copy, links, images, lists, cards. Keep that content in the block's fields, around the artifact, so editors and agents can still read and change it.
|
|
8
|
+
|
|
9
|
+
A definition that would fit one place on one site, or settings bolted on only to make a visual look reusable, is the signal for an artifact. Text that matters for SEO or Markdown belongs in fields, never inside the source: Camox treats the source as opaque and only reads its `<title>`.
|
|
10
|
+
|
|
11
|
+
## Declare and render
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
content: (field) => ({
|
|
15
|
+
heading: field.string({ default: "How it works" }),
|
|
16
|
+
visual: field.artifact({ size: "fill", title: "Diagram" }),
|
|
17
|
+
}),
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- `size` (required): `"fill"` fills a container whose size the block controls, for example with an aspect ratio; `"content"` is for frames whose height follows their page, such as calculators. See [Size to the content](#size-to-the-content).
|
|
21
|
+
- `data` (optional): sibling content fields and settings shared with the artifact as **Artifact Data**, so editors can change what it shows without touching its source. Inside a repeater item, the siblings are the item's own fields and settings. The names are type-checked; artifacts, repeaters and references can't be listed. See [`camox.data`](#camoxdata).
|
|
22
|
+
- `default` (optional): a starting source. Leave it out; agents write sources as content. An empty artifact renders nothing on the website and a placeholder in the studio preview.
|
|
23
|
+
- Artifacts work in block content and repeater items, so also in layout and synced blocks. Collection records can't hold them.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
content: (field) => ({
|
|
27
|
+
label: field.string({ default: "Uptime" }),
|
|
28
|
+
gauge: field.artifact({ size: "fill", data: ["label", "tone"] }),
|
|
29
|
+
}),
|
|
30
|
+
settings: (setting) => ({
|
|
31
|
+
tone: setting.enum({ default: "calm", options: { calm: "Calm", bold: "Bold" } }),
|
|
32
|
+
}),
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<div className="aspect-video">
|
|
37
|
+
<block.Artifact name="visual">
|
|
38
|
+
{(props) => <iframe {...props} className="size-full" />}
|
|
39
|
+
</block.Artifact>
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Spread the props onto your own `<iframe>`: they carry `srcDoc`, `sandbox="allow-scripts"`, `allow="fullscreen; clipboard-write"`, `title`, `loading="lazy"`, a `ref` that connects the frame to the `camox` runtime, and for `size: "content"` a `style` with the frame's height. Don't replace the `ref`, and don't set a height on a `"content"` frame. Repeater items use `item.Artifact`. `block.Field` rejects artifact fields.
|
|
44
|
+
|
|
45
|
+
## Write a source
|
|
46
|
+
|
|
47
|
+
Write the source to a local file and push it with `blocks edit --id <ID> --field-file <NAME>=<PATH>` (or `blocks create`), then check it with `camox preview`; see [Set string fields from files](cli-content.md#set-string-fields-from-files). `blocks describe` lists artifact fields with `fieldType: "Artifact"` and their `size`. Artifacts that share Artifact Data also list the sibling names in `data`, and the exact shape of `camox.data` as JSON Schema in `dataSchema`: write the source against it.
|
|
48
|
+
|
|
49
|
+
- **Under 256 KB.** Larger writes are rejected. Load libraries from a CDN instead of inlining them.
|
|
50
|
+
- **Import from esm.sh with exact pinned versions**, so the artifact never changes under the website:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<script type="module">
|
|
54
|
+
import { animate } from "https://esm.sh/motion@12.23.12";
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- **A meaningful `<title>`.** It names the frame for screen readers and is the artifact's Markdown Representation. Without one, the artifact is called "Untitled artifact", and `blocks create` and `blocks edit` return a warning.
|
|
59
|
+
- **Respect `prefers-reduced-motion`** with the native media query, in CSS (`@media (prefers-reduced-motion: reduce)`) and in scripts (`matchMedia`), by stopping or simplifying motion.
|
|
60
|
+
- **Fonts on the website's own domain need CORS headers.** The sandbox gives the page an opaque origin, so self-hosted fonts load only when the server sends `Access-Control-Allow-Origin: *` for them.
|
|
61
|
+
|
|
62
|
+
## The `camox` runtime
|
|
63
|
+
|
|
64
|
+
Camox injects a small runtime at the top of every source, before anything in it runs. It's how an artifact receives what its sandbox hides from it. `window.camox` always exists, so use it directly, without feature detection.
|
|
65
|
+
|
|
66
|
+
Never implement your own `postMessage` protocol with the page. The website and the studio talk to artifacts only through `camox`, and nothing on the page listens for other messages.
|
|
67
|
+
|
|
68
|
+
### `camox.data`
|
|
69
|
+
|
|
70
|
+
The artifact's Artifact Data: an object with one entry per name in the field's `data`, matching the `dataSchema` that `blocks describe` shows. It's `{}` for artifacts that share no data. It's available from the first render, so the first paint can already show the right labels and values.
|
|
71
|
+
|
|
72
|
+
Values are normalized:
|
|
73
|
+
|
|
74
|
+
- Text fields are strings, as stored (inline Markdown, such as `**bold**`, is kept).
|
|
75
|
+
- Links are `{ text, href, newTab }`, with page links already resolved to their path.
|
|
76
|
+
- Images are `{ url, alt }`, files `{ url, filename }`, and image and file lists are arrays of those.
|
|
77
|
+
- Embeds and icons are strings, enum settings their option key, and boolean settings booleans.
|
|
78
|
+
|
|
79
|
+
### `camox.onData(callback)`
|
|
80
|
+
|
|
81
|
+
Calls `callback` with the new `camox.data` each time it changes, for example when an editor edits a listed field in the studio, without reloading the frame. It isn't called on subscribe, and it returns a function that unsubscribes. Render from `camox.data` first, then re-render in the callback:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
const render = (data) => {
|
|
85
|
+
document.querySelector("h2").textContent = data.label;
|
|
86
|
+
document.body.dataset.tone = data.tone;
|
|
87
|
+
};
|
|
88
|
+
render(window.camox.data);
|
|
89
|
+
window.camox.onData(render);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `camox.studio`
|
|
93
|
+
|
|
94
|
+
`null` on the website. Inside the studio, an object describing where the artifact is shown:
|
|
95
|
+
|
|
96
|
+
- `editing`: `true` while editors can edit the artifact's block, on the Canvas.
|
|
97
|
+
- `canvas`: `true` on the Canvas, where pages and blocks are laid out side by side.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
const editing = window.camox.studio?.editing === true;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Read it when you act rather than once at startup: it's `null` until the frame connects, and it changes when the editor shows or hides the Canvas. Use it to stay calm while someone is editing, for example by not autoplaying sound.
|
|
104
|
+
|
|
105
|
+
### Theme: `camox.theme` and `camox.onTheme`
|
|
106
|
+
|
|
107
|
+
Artifacts match the website automatically. The website's theme tokens (its CSS custom properties, named by each website; for instance `--canvas` or `--brand`) are applied to the artifact's `:root`, with the values of the color scheme where the artifact sits on the page: inside a block with the `dark` class, an artifact gets the dark color scheme's values. When the color scheme around the artifact changes, for example when a visitor switches the website to its dark color scheme, the tokens are applied again. Read the website's stylesheet for the tokens it defines and what each is for. Style with the tokens and CSS needs nothing else:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
body {
|
|
111
|
+
background: var(--canvas);
|
|
112
|
+
color: var(--ink);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`camox.theme` holds the same tokens for scripts:
|
|
117
|
+
|
|
118
|
+
- `tokens`: each token's raw value, such as `{ "--brand": "oklch(0.55 0.2 260)", "--radius": "0.5rem" }`.
|
|
119
|
+
- `colors`: each color token as sRGB channels from 0 to 255, such as `{ "--brand": { r: 37, g: 99, b: 235 } }`, including tokens written in `oklch()`. Use these for canvas, three.js or WebGL, which can't read CSS variables.
|
|
120
|
+
|
|
121
|
+
`camox.onTheme(callback)` calls `callback(theme)` whenever the tokens change, and returns a function that unsubscribes. It isn't called for the theme the artifact already has, so draw once with `camox.theme`, then on each change:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
const draw = ({ colors }) => {
|
|
125
|
+
const { r, g, b } = colors["--brand"];
|
|
126
|
+
material.color.setRGB(r / 255, g / 255, b / 255, THREE.SRGBColorSpace);
|
|
127
|
+
};
|
|
128
|
+
draw(window.camox.theme);
|
|
129
|
+
window.camox.onTheme(draw);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- **The body starts hidden.** It stays invisible until the first theme arrives, so the artifact never shows in the wrong colors. If no theme comes, it shows after a short timeout. Don't fight this by forcing `visibility` on `body`.
|
|
133
|
+
- **Never use `prefers-color-scheme`** to pick light or dark. Inside the frame it follows the visitor's OS, not the website, which may be dark on a light OS or the reverse. Rely on the tokens.
|
|
134
|
+
- **Fonts.** The website's font stylesheets and preconnect links from its document definition are loaded before your source, so its fonts work from the first render. Use the website's font family names, or the tokens that hold them.
|
|
135
|
+
|
|
136
|
+
### `camox.onViewport(callback)`
|
|
137
|
+
|
|
138
|
+
Scroll-driven animations follow where the frame sits in the page's viewport. The first call subscribes; it returns a function that unsubscribes. The callback receives:
|
|
139
|
+
|
|
140
|
+
- `progress`: `0` when the frame's top enters at the bottom of the viewport, `1` when its bottom leaves at the top, `0.5` when the frame is centered.
|
|
141
|
+
- `visibleRatio`: the share of the frame inside the viewport, from `0` to `1`.
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
const stop = window.camox.onViewport(({ progress, visibleRatio }) => {
|
|
145
|
+
scene.rotation.y = progress * Math.PI * 2;
|
|
146
|
+
if (visibleRatio === 0) pauseRendering();
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
While subscribed, the runtime also sets `--camox-progress` on `:root`, so CSS alone can scrub with scroll. Subscribe once, even with an empty callback, to get it:
|
|
151
|
+
|
|
152
|
+
```html
|
|
153
|
+
<style>
|
|
154
|
+
.orbit {
|
|
155
|
+
transform: rotate(calc(var(--camox-progress, 0) * 1turn));
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
158
|
+
<script>
|
|
159
|
+
window.camox.onViewport(() => {});
|
|
160
|
+
</script>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Updates arrive at most once per animation frame, only while the frame is near the viewport, and only when the values change. After the frame leaves the viewport, the last update is `visibleRatio: 0`, with `progress` at `0` or `1`. Artifacts that never subscribe get nothing and cost nothing. Don't read the frame's own scroll position or listen to `scroll` inside it: the artifact can't see the page scroll.
|
|
164
|
+
|
|
165
|
+
### Size to the content
|
|
166
|
+
|
|
167
|
+
With `size: "content"`, the runtime measures the height of the artifact's `<html>` element and the frame follows it as the content changes, so the page never shows a scrollbar inside the frame. Let the document grow with its content: never give `html` or `body` a height in viewport or percentage units (`100vh`, `100%`), which would tie the content's height to the frame's. With `size: "fill"`, the block sizes the frame and the artifact never resizes it.
|
|
168
|
+
|
|
169
|
+
### `camox.navigate(href)`
|
|
170
|
+
|
|
171
|
+
Navigates the website, for example from a widget's call to action. Internal paths such as `/pricing` go through the website's client router; external URLs open in a new tab. Only `http` and `https` URLs work.
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
button.addEventListener("click", () => window.camox.navigate("/pricing?plan=pro"));
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
It only works right after a real click or key press in the artifact. Calls from timers, scroll callbacks or page load do nothing, so an artifact can't redirect visitors on its own. The sandbox blocks popups and navigating the website: a plain `<a href>` would only load inside the frame, and `window.open` does nothing. Use `camox.navigate` instead.
|
|
178
|
+
|
|
179
|
+
The runtime API has no stability guarantee while Camox is pre-1.0.
|