camox 0.41.1 → 0.43.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.
Files changed (93) hide show
  1. package/dist/core/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
  2. package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
  3. package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
  4. package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
  5. package/dist/core/components/lexical/SidebarLexicalEditor.js +52 -49
  6. package/dist/core/components/lexical/TextLinkPopover.js +191 -208
  7. package/dist/core/components/lexical/editorConfig.js +2 -2
  8. package/dist/core/createApp.d.ts +19 -4
  9. package/dist/core/createApp.js +2 -1
  10. package/dist/core/createLayout.d.ts +16 -3
  11. package/dist/core/createLayout.js +15 -15
  12. package/dist/core/derivedRoutes.js +1 -1
  13. package/dist/core/dom.d.ts +17 -0
  14. package/dist/core/dom.js +22 -0
  15. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  16. package/dist/core/editing/createEditableBlock.js +636 -459
  17. package/dist/core/hooks/useOverlayState.js +11 -0
  18. package/dist/core/lib/fieldTypes.js +5 -5
  19. package/dist/core/lib/lexicalReact.js +4 -4
  20. package/dist/core/lib/lexicalState.js +20 -4
  21. package/dist/core/lib/modifierFormats.js +1 -1
  22. package/dist/core/lib/textLinks.js +5 -2
  23. package/dist/core/lib/textStyles.d.ts +2 -2
  24. package/dist/core/lib/textStyles.js +6 -11
  25. package/dist/core/pageDestinations.js +37 -0
  26. package/dist/features/og/imageResponse.node.js +11 -9
  27. package/dist/features/preview/CamoxPreview.js +108 -124
  28. package/dist/features/preview/commentsEnabled.js +8 -0
  29. package/dist/features/preview/components/AddBlockSidebar.js +80 -90
  30. package/dist/features/preview/components/AssetLightbox.js +4 -11
  31. package/dist/features/preview/components/AttachedComments.js +194 -0
  32. package/dist/features/preview/components/BlockActionsPopover.js +14 -65
  33. package/dist/features/preview/components/CommentHeader.js +122 -0
  34. package/dist/features/preview/components/CommentSidebar.js +29 -0
  35. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  36. package/dist/features/preview/components/CreatePageModal.js +4 -10
  37. package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
  38. package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
  39. package/dist/features/preview/components/FieldToolbar.js +7 -7
  40. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  41. package/dist/features/preview/components/LeftSidebar.js +18 -18
  42. package/dist/features/preview/components/LinkFieldEditor.js +212 -209
  43. package/dist/features/preview/components/OverlayTracker.js +14 -20
  44. package/dist/features/preview/components/Overlays.js +26 -35
  45. package/dist/features/preview/components/PageEditorSidebar.js +90 -91
  46. package/dist/features/preview/components/PageInfoSidebar.js +128 -159
  47. package/dist/features/preview/components/PagePicker.js +29 -24
  48. package/dist/features/preview/components/PageTree.js +159 -157
  49. package/dist/features/preview/components/PreviewComments.js +56 -0
  50. package/dist/features/preview/components/PreviewPanel.js +122 -78
  51. package/dist/features/preview/components/PreviewToolbar.js +280 -231
  52. package/dist/features/preview/components/PublicationRow.js +8 -11
  53. package/dist/features/preview/components/RightSidebar.js +14 -11
  54. package/dist/features/preview/components/SidebarSection.js +121 -0
  55. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  56. package/dist/features/preview/previewCommentsStore.js +115 -0
  57. package/dist/features/preview/previewSelection.js +75 -0
  58. package/dist/features/preview/previewStore.js +19 -39
  59. package/dist/features/preview/publication.js +10 -0
  60. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  61. package/dist/features/provider/CoreCamoxProvider.js +1 -1
  62. package/dist/features/provider/components/CommandPalette.js +142 -58
  63. package/dist/features/provider/useAdminShortcuts.js +19 -8
  64. package/dist/features/routes/pageRuntime.js +0 -6
  65. package/dist/features/runtime/RuntimeChrome.js +40 -37
  66. package/dist/features/runtime/runtime.js +20 -21
  67. package/dist/features/studio/CamoxStudio.js +30 -50
  68. package/dist/features/studio/components/EnvironmentMenu.js +3 -2
  69. package/dist/features/studio/components/Navbar.js +53 -80
  70. package/dist/features/vite/layoutGeneration.js +7 -3
  71. package/dist/features/vite/runtimeDev.js +4 -1
  72. package/dist/features/vite/vite.d.ts +3 -2
  73. package/dist/features/vite/vite.js +14 -6
  74. package/dist/hooks/use-file-upload.js +0 -2
  75. package/dist/hooks/use-page-destinations.js +53 -0
  76. package/dist/lib/auth.js +11 -14
  77. package/dist/lib/server-auth-cookie.js +21 -0
  78. package/dist/studio.css +1 -1
  79. package/package.json +9 -7
  80. package/skills/camox/SKILL.md +32 -9
  81. package/skills/camox/references/block-definitions.md +84 -290
  82. package/skills/camox/references/cli-common.md +2 -4
  83. package/skills/camox/references/cli-content.md +147 -0
  84. package/skills/camox/references/cli-environments.md +1 -1
  85. package/skills/camox/references/dom-integrations.md +93 -0
  86. package/skills/camox/references/field-styling.md +50 -0
  87. package/skills/camox/references/layout-definitions.md +33 -147
  88. package/skills/camox/references/routed-layouts.md +71 -0
  89. package/skills/camoxify/SKILL.md +52 -0
  90. package/dist/lib/telemetry-client.js +0 -66
  91. package/dist/lib/telemetry.js +0 -26
  92. package/skills/camox/references/cli-blocks.md +0 -78
  93. package/skills/camox/references/cli-pages.md +0 -53
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: camoxify
3
+ description: Turn an existing website, screenshot, or design into an editable Camox site. Use when recreating a reference in an existing Camox project, composing its design into blocks, layouts, fields, and repeaters.
4
+ ---
5
+
6
+ # Camoxify
7
+
8
+ Work in the existing Camox project; project creation and authentication are onboarding prerequisites. Match the reference while making the result reusable and easy to edit.
9
+
10
+ ## Inspect and decompose
11
+
12
+ Inspect the source URL with available browsing tools, or use the supplied screenshot/design. If the URL is inaccessible, ask for screenshots. Check multiple pages and viewport sizes when available; don't infer a whole site's structure from one crop.
13
+
14
+ For URL references, use a browser when available to explore interactive states: navigation dropdowns, hover menus, tooltips, modals, accordions, carousels, and mobile navigation. Reproduce observed behavior, not just the initial appearance. Avoid submitting forms or triggering destructive actions.
15
+
16
+ Before coding, map the reference to:
17
+
18
+ - **Layout:** the consistent shell across pages, such as navigation and footer. Editable shell content still lives in blocks, placed by the layout.
19
+ - **Page blocks:** independently useful sections such as a hero, feature grid, testimonials, or pricing. Reuse existing definitions where they fit. Avoid both a monolithic page block and separate blocks for every heading or card.
20
+ - **Fields and repeaters:** editable content within each section, grouped by meaning rather than visual position.
21
+
22
+ Read [Block Definitions](../camox/references/block-definitions.md) and, when creating or changing a shell, [Layout Definitions](../camox/references/layout-definitions.md).
23
+
24
+ ## Keep definitions generic
25
+
26
+ Block names, schemas, rendering, and **default content** must work on other pages. Use `feature-grid`, not `acme-homepage-features`. Defaults are neutral examples, not the reference's copy, links, assets, or item data.
27
+
28
+ Apply reference-specific content **only to instances through the CLI**, never by changing definition defaults or hardcoding it in JSX.
29
+
30
+ ## Model repetition, not a fixed screenshot
31
+
32
+ Use `Type.Repeater` for every repeated content structure: lists, rows, columns, tables, carousels, navigation items, and cards. Never use `field1`, `field2`, etc., or hardcoded content arrays. Nest repeaters for structures such as footer columns containing links or table rows containing cells.
33
+
34
+ Choose bounds from real constraints, not the number of items visible in the reference. Many sibling fields are a code smell: look for repeated groups or separate sections. Model enough flexibility to add, remove, reorder, and rewrite content without code changes; don't expose every CSS value as a field.
35
+
36
+ ## Keep formatted text in one field
37
+
38
+ Use inline formatting and `textStyle`, including highlights, instead of fields such as `headingStart`, `coloredWord`, and `headingEnd`. Editors should be able to move the emphasis by editing content alone. Read [Field styling](../camox/references/field-styling.md).
39
+
40
+ ```ts
41
+ // Avoid: headingStart + coloredWord + headingEnd
42
+ // Instance content:
43
+ {
44
+ title: "Build <highlight>something great</highlight>";
45
+ }
46
+ ```
47
+
48
+ ## Populate and verify
49
+
50
+ Follow the [Camox CLI workflow](../camox/SKILL.md#content-and-cli) to assign layouts, place blocks, and populate content, including shared navigation/footer content. Don't publish unless asked.
51
+
52
+ Compare the rendered site with the reference at desktop and mobile sizes. Verify that fields remain editable and that longer text and different repeater counts still work. Fix the reusable implementation, not just the one captured arrangement.
@@ -1,66 +0,0 @@
1
- import { POSTHOG_PUBLIC_KEY } from "@camox/api-contract";
2
- import posthog from "posthog-js";
3
-
4
- //#region src/lib/telemetry-client.ts
5
- let initialized = false;
6
- function ensureInitialized() {
7
- if (__CAMOX_TELEMETRY_DISABLED__) return false;
8
- if (typeof window === "undefined") return false;
9
- if (initialized) return true;
10
- posthog.init(POSTHOG_PUBLIC_KEY, {
11
- api_host: "https://t.camox.dev",
12
- ui_host: "https://us.posthog.com",
13
- defaults: "2026-01-30",
14
- autocapture: false,
15
- persistence: "localStorage+cookie"
16
- });
17
- posthog.register({
18
- host: window.location.hostname,
19
- isLocalhost: window.location.hostname === "localhost"
20
- });
21
- initialized = true;
22
- return true;
23
- }
24
- let lastIdentifiedUserId = null;
25
- /**
26
- * Identifies the authenticated user. distinctId matches the server-side
27
- * `ctx.user.id` so studio + CLI/agent events for the same person unify.
28
- * Idempotent per userId.
29
- */
30
- function identifyUser(options) {
31
- if (!ensureInitialized()) return;
32
- if (lastIdentifiedUserId === options.userId) return;
33
- lastIdentifiedUserId = options.userId;
34
- posthog.identify(options.userId, {
35
- email: options.email,
36
- name: options.name
37
- });
38
- }
39
- let lastIdentifiedProjectId = null;
40
- /**
41
- * Registers project context as PostHog super properties + group.
42
- * Idempotent per projectId — call freely from React effects.
43
- */
44
- function identifyProject(options) {
45
- if (!ensureInitialized()) return;
46
- if (lastIdentifiedProjectId === options.projectId) return;
47
- lastIdentifiedProjectId = options.projectId;
48
- posthog.register({
49
- projectId: options.projectId,
50
- projectSlug: options.projectSlug,
51
- environmentName: options.environmentName ?? null,
52
- surface: "studio"
53
- });
54
- posthog.group("project", String(options.projectId), {
55
- name: options.projectName,
56
- slug: options.projectSlug
57
- });
58
- }
59
- /** Client-side tracking for CMS actions. Events route through t.camox.dev reverse proxy. */
60
- function trackClientEvent(event, properties) {
61
- if (!ensureInitialized()) return;
62
- posthog.capture(event, properties);
63
- }
64
-
65
- //#endregion
66
- export { identifyProject, identifyUser, trackClientEvent };
@@ -1,26 +0,0 @@
1
- import { POSTHOG_PUBLIC_KEY } from "@camox/api-contract";
2
-
3
- //#region src/lib/telemetry.ts
4
- let client = null;
5
- async function getClient() {
6
- if (__CAMOX_TELEMETRY_DISABLED__) return null;
7
- if (!client) {
8
- const { PostHog } = await import("posthog-node");
9
- client = new PostHog(POSTHOG_PUBLIC_KEY, { host: "https://us.i.posthog.com" });
10
- }
11
- return client;
12
- }
13
- /** Server-side tracking for page views (used in pageRoute.tsx) */
14
- async function trackEvent(event, properties) {
15
- const posthog = await getClient();
16
- if (!posthog) return;
17
- const distinctId = properties.projectId ?? "unknown";
18
- posthog.capture({
19
- distinctId,
20
- event,
21
- properties
22
- });
23
- }
24
-
25
- //#endregion
26
- export { trackEvent };
@@ -1,78 +0,0 @@
1
- # Managing Blocks with the Camox CLI
2
-
3
- Read [cli-common.md](cli-common.md) first. Replace `{{CAMOX_CMD}}` as described there and verify commands with `--help`.
4
-
5
- Use these commands for Block instances and their Content. To change which fields or rendering a Block type provides, use the Block Definition reference instead.
6
-
7
- ## Inspect before changing
8
-
9
- Look up the Page before creating or moving Blocks so you have its `id`, current Blocks, and any sibling ids. Describe the Block type before constructing Content:
10
-
11
- ```sh
12
- {{CAMOX_CMD}} pages get --path /
13
- {{CAMOX_CMD}} blocks describe --type hero
14
- ```
15
-
16
- ## Create and position a Block
17
-
18
- ```sh
19
- {{CAMOX_CMD}} blocks create --page-id 25 --type hero --content '{...}'
20
- {{CAMOX_CMD}} blocks create --page-id 25 --type hero --content '{...}' --position first
21
- {{CAMOX_CMD}} blocks create --page-id 25 --type hero --content '{...}' --before-id 174
22
- {{CAMOX_CMD}} blocks create --page-id 25 --type hero --content '{...}' --after-id 174
23
- ```
24
-
25
- `blocks create` and `blocks move` accept the same positioning flags. Pass at most one:
26
-
27
- | Flag | Meaning |
28
- | ------------------------- | ----------------------------------------------- |
29
- | `--position first` | Put the Block first. |
30
- | `--position last` | Put the Block last; this is the create default. |
31
- | `--after-id <ID>` | Put it immediately after a sibling Block. |
32
- | `--before-id <ID>` | Put it immediately before a sibling Block. |
33
- | `--after-position <KEY>` | Insert after a known fractional-index key. |
34
- | `--before-position <KEY>` | Insert before a known fractional-index key. |
35
-
36
- Prefer `--position`, `--after-id`, and `--before-id`. A move requires one positioning flag.
37
-
38
- ## Edit Block Content
39
-
40
- Content patches merge ordinary fields, so send only fields that should change:
41
-
42
- ```sh
43
- {{CAMOX_CMD}} pages get --path /pricing
44
- {{CAMOX_CMD}} blocks edit --id 314 --content '{"headline": "New headline"}'
45
- ```
46
-
47
- ## Edit repeatable Content safely
48
-
49
- A repeatable field's array is replacement-shaped: omitting an existing item deletes it and cascades to its file references, settings, and nested items. Fetch the Block, preserve every existing item with `_itemId`, and add changes only to the intended entries:
50
-
51
- ```sh
52
- {{CAMOX_CMD}} blocks get --id 99
53
-
54
- {{CAMOX_CMD}} blocks edit --id 99 --content '{
55
- "items": [
56
- {"_itemId": 401},
57
- {"_itemId": 402, "answer": "Updated answer."},
58
- {"_itemId": 403}
59
- ]
60
- }'
61
- ```
62
-
63
- The response's `repeatableItems` contains each item's `id`, `fieldName`, `parentItemId`, and Content. Use the same `_itemId` pattern recursively for nested repeatables. Fetch multiple Blocks together when useful:
64
-
65
- ```sh
66
- {{CAMOX_CMD}} blocks get-many --id 99 --id 100 --id 101
67
- ```
68
-
69
- `blocks get-many` returns the same bundle shape as `blocks get`, in requested-id order.
70
-
71
- ## Draft and live reads
72
-
73
- ```sh
74
- {{CAMOX_CMD}} blocks get --id 314 # draft
75
- {{CAMOX_CMD}} blocks get --id 314 --live # published snapshot
76
- ```
77
-
78
- Publish or discard at the Page level; read [cli-pages.md](cli-pages.md) when the task includes review or publication.
@@ -1,53 +0,0 @@
1
- # Managing Pages with the Camox CLI
2
-
3
- Read [cli-common.md](cli-common.md) first. Replace `{{CAMOX_CMD}}` as described there and verify commands with `--help`.
4
-
5
- Use these commands for Page paths and metadata, Layout assignments, draft review, and publishing. Use [cli-blocks.md](cli-blocks.md) when changing the ordered Blocks or Content on a Page.
6
-
7
- ## Create a Page with an existing Layout
8
-
9
- ```sh
10
- {{CAMOX_CMD}} layouts list
11
- {{CAMOX_CMD}} pages create --path-segment about --layout-id 39
12
- ```
13
-
14
- Use `--parent-page-id <ID>` to nest the Page under another Page. Assigning an existing Layout is a CLI content operation; creating or changing a Layout Definition is a code operation covered by the Layout Definition reference.
15
-
16
- ## Review draft and live state
17
-
18
- ```sh
19
- {{CAMOX_CMD}} pages get --path /pricing # draft
20
- {{CAMOX_CMD}} pages get --path /pricing --live # published snapshot
21
- ```
22
-
23
- Live reads fail when the Page or Block has never been published. `--live` is not a write target and does not publish anything.
24
-
25
- ## Publish after approval
26
-
27
- ```sh
28
- {{CAMOX_CMD}} pages publish --path /pricing
29
- ```
30
-
31
- `pages publish` accepts exactly one of `--id` or `--path`. It publishes the Page's current draft and, by default, its Layout. Publishing the Layout is a no-op when it has no pending changes. Use `--no-layout` only when the user explicitly does not want pending Layout changes published with the Page:
32
-
33
- ```sh
34
- {{CAMOX_CMD}} pages publish --path /pricing --no-layout
35
- ```
36
-
37
- Do not publish merely because a draft edit succeeded. Summarize the draft and wait for the user to ask or approve publication.
38
-
39
- ## Unpublish or discard drafts
40
-
41
- Remove a Page from live without deleting its draft:
42
-
43
- ```sh
44
- {{CAMOX_CMD}} pages unpublish --path /pricing
45
- ```
46
-
47
- Reset a draft to its current live snapshot without changing live:
48
-
49
- ```sh
50
- {{CAMOX_CMD}} pages discard-changes --path /pricing
51
- ```
52
-
53
- Both commands accept exactly one of `--id` or `--path`. Discarding fails if the Page has never been published.