canopycms 0.0.16 → 0.0.18

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 (219) hide show
  1. package/README.md +120 -34
  2. package/dist/ai/generate.js +3 -3
  3. package/dist/ai/handler.js +5 -5
  4. package/dist/ai/index.js +3 -3
  5. package/dist/ai/json-to-markdown.js +1 -1
  6. package/dist/ai/json-to-markdown.js.map +1 -1
  7. package/dist/ai/resolve-branch.js +2 -2
  8. package/dist/api/__test__/mock-client.js +1 -1
  9. package/dist/api/assets.js +1 -1
  10. package/dist/api/branch-merge.js +3 -3
  11. package/dist/api/branch-review.js +4 -4
  12. package/dist/api/branch-status.js +8 -8
  13. package/dist/api/branch-withdraw.js +5 -5
  14. package/dist/api/branch.js +9 -9
  15. package/dist/api/comments.js +4 -4
  16. package/dist/api/content.d.ts.map +1 -1
  17. package/dist/api/content.js +17 -16
  18. package/dist/api/content.js.map +1 -1
  19. package/dist/api/entries.js +8 -8
  20. package/dist/api/github-sync.js +3 -3
  21. package/dist/api/groups.js +4 -4
  22. package/dist/api/guards.js +1 -1
  23. package/dist/api/index.js +3 -3
  24. package/dist/api/permissions.js +4 -4
  25. package/dist/api/reference-options.js +5 -5
  26. package/dist/api/resolve-references.js +4 -4
  27. package/dist/api/route-builder.js +1 -1
  28. package/dist/api/schema.js +5 -5
  29. package/dist/api/settings-helpers.js +1 -1
  30. package/dist/api/user.js +1 -1
  31. package/dist/api/validators.js +3 -3
  32. package/dist/asset-store.js +1 -1
  33. package/dist/auth/cache.js +2 -2
  34. package/dist/auth/caching-auth-plugin.js +1 -1
  35. package/dist/auth/file-based-auth-cache.js +1 -1
  36. package/dist/auth/index.js +1 -1
  37. package/dist/authorization/branch.js +1 -1
  38. package/dist/authorization/content.js +3 -3
  39. package/dist/authorization/groups/index.js +2 -2
  40. package/dist/authorization/groups/loader.js +4 -4
  41. package/dist/authorization/index.js +8 -8
  42. package/dist/authorization/path.js +1 -1
  43. package/dist/authorization/permissions/index.js +2 -2
  44. package/dist/authorization/permissions/loader.js +3 -3
  45. package/dist/authorization/permissions/schema.js +1 -1
  46. package/dist/authorization/test-utils.js +1 -1
  47. package/dist/authorization/validation.js +1 -1
  48. package/dist/branch-metadata.js +3 -3
  49. package/dist/branch-registry.js +2 -2
  50. package/dist/branch-schema-cache.js +2 -2
  51. package/dist/branch-workspace.js +6 -6
  52. package/dist/build/generate-ai-content.js +4 -4
  53. package/dist/build/index.js +1 -1
  54. package/dist/cli/cli.js +5 -5
  55. package/dist/cli/generate-ai-content.js +40 -29
  56. package/dist/cli/init.d.ts +5 -0
  57. package/dist/cli/init.d.ts.map +1 -1
  58. package/dist/cli/init.js +68 -25
  59. package/dist/cli/init.js.map +1 -1
  60. package/dist/cli/sync.js +1 -1
  61. package/dist/cli/template-files/canopy.ts.template +10 -6
  62. package/dist/cli/template-files/edit-page-dev.tsx.template +16 -0
  63. package/dist/cli/template-files/edit-page.tsx.template +14 -21
  64. package/dist/cli/template-files/middleware-clerk.ts.template +13 -0
  65. package/dist/cli/template-files/middleware.ts.template +30 -0
  66. package/dist/cli/template-files/next.config-static.ts.template +13 -0
  67. package/dist/cli/template-files/next.config.ts.template +5 -0
  68. package/dist/cli/template-files/schemas.ts.template +4 -2
  69. package/dist/cli/templates.d.ts +8 -0
  70. package/dist/cli/templates.d.ts.map +1 -1
  71. package/dist/cli/templates.js +22 -2
  72. package/dist/cli/templates.js.map +1 -1
  73. package/dist/client.js +9 -9
  74. package/dist/config/flatten.js +2 -2
  75. package/dist/config/helpers.js +3 -3
  76. package/dist/config/index.js +9 -9
  77. package/dist/config/schemas/collection.js +1 -1
  78. package/dist/config/schemas/config.js +2 -2
  79. package/dist/config/schemas/field.d.ts +21 -0
  80. package/dist/config/schemas/field.d.ts.map +1 -1
  81. package/dist/config/schemas/field.js +2 -1
  82. package/dist/config/schemas/field.js.map +1 -1
  83. package/dist/config/types.d.ts +7 -0
  84. package/dist/config/types.d.ts.map +1 -1
  85. package/dist/config/validation.js +2 -2
  86. package/dist/config-test.js +2 -2
  87. package/dist/config.js +2 -2
  88. package/dist/content-id-index.js +2 -2
  89. package/dist/content-listing.d.ts +3 -2
  90. package/dist/content-listing.d.ts.map +1 -1
  91. package/dist/content-listing.js +15 -12
  92. package/dist/content-listing.js.map +1 -1
  93. package/dist/content-reader.d.ts.map +1 -1
  94. package/dist/content-reader.js +18 -14
  95. package/dist/content-reader.js.map +1 -1
  96. package/dist/content-store.d.ts +5 -0
  97. package/dist/content-store.d.ts.map +1 -1
  98. package/dist/content-store.js +34 -24
  99. package/dist/content-store.js.map +1 -1
  100. package/dist/content-tree.d.ts.map +1 -1
  101. package/dist/content-tree.js +8 -3
  102. package/dist/content-tree.js.map +1 -1
  103. package/dist/context.d.ts +38 -7
  104. package/dist/context.d.ts.map +1 -1
  105. package/dist/context.js +38 -6
  106. package/dist/context.js.map +1 -1
  107. package/dist/editor/BranchManager.js +4 -4
  108. package/dist/editor/CanopyEditor.js +3 -3
  109. package/dist/editor/CanopyEditorPage.js +1 -1
  110. package/dist/editor/CommentsPanel.js +1 -1
  111. package/dist/editor/Editor.js +18 -18
  112. package/dist/editor/EntryNavigator.js +1 -1
  113. package/dist/editor/FormRenderer.js +12 -12
  114. package/dist/editor/GroupManager.js +1 -1
  115. package/dist/editor/PermissionManager.js +1 -1
  116. package/dist/editor/client-reference-resolver.js +1 -1
  117. package/dist/editor/comments/BranchComments.js +1 -1
  118. package/dist/editor/comments/EntryComments.js +1 -1
  119. package/dist/editor/comments/FieldWrapper.js +1 -1
  120. package/dist/editor/comments/InlineCommentThread.js +1 -1
  121. package/dist/editor/comments/ThreadCarousel.js +1 -1
  122. package/dist/editor/components/EditorHeader.js +1 -1
  123. package/dist/editor/components/UserBadge.js +1 -1
  124. package/dist/editor/components/index.js +3 -3
  125. package/dist/editor/context/ApiClientContext.js +1 -1
  126. package/dist/editor/context/index.js +2 -2
  127. package/dist/editor/editor-config.js +2 -2
  128. package/dist/editor/editor-config.js.map +1 -1
  129. package/dist/editor/editor-utils.js +1 -1
  130. package/dist/editor/fields/BlockField.js +1 -1
  131. package/dist/editor/fields/ObjectField.js +1 -1
  132. package/dist/editor/fields/ReferenceField.js +1 -1
  133. package/dist/editor/group-manager/GroupCard.js +1 -1
  134. package/dist/editor/group-manager/InternalGroupsTab.js +1 -1
  135. package/dist/editor/group-manager/MemberList.js +1 -1
  136. package/dist/editor/group-manager/index.js +9 -9
  137. package/dist/editor/hooks/__test__/test-utils.js +3 -3
  138. package/dist/editor/hooks/index.js +11 -11
  139. package/dist/editor/hooks/useBranchActions.js +1 -1
  140. package/dist/editor/hooks/useBranchManager.js +1 -1
  141. package/dist/editor/hooks/useCommentSystem.js +2 -2
  142. package/dist/editor/hooks/useDraftManager.js +1 -1
  143. package/dist/editor/hooks/useEntryManager.js +3 -3
  144. package/dist/editor/hooks/useGroupManager.js +1 -1
  145. package/dist/editor/hooks/usePermissionManager.js +1 -1
  146. package/dist/editor/hooks/useReferenceResolution.js +1 -1
  147. package/dist/editor/hooks/useSchemaManager.js +1 -1
  148. package/dist/editor/hooks/useUserContext.js +1 -1
  149. package/dist/editor/permission-manager/PermissionEditor.js +4 -4
  150. package/dist/editor/permission-manager/PermissionLevelBadge.js +1 -1
  151. package/dist/editor/permission-manager/PermissionTree.js +3 -3
  152. package/dist/editor/permission-manager/UserSelector.js +1 -1
  153. package/dist/editor/permission-manager/hooks/usePermissionTree.js +2 -2
  154. package/dist/editor/permission-manager/index.js +6 -6
  155. package/dist/editor/preview-bridge.js +1 -1
  156. package/dist/editor/schema-editor/CollectionEditor.js +2 -2
  157. package/dist/editor/schema-editor/index.js +2 -2
  158. package/dist/entry-schema-registry.d.ts.map +1 -1
  159. package/dist/entry-schema-registry.js +12 -3
  160. package/dist/entry-schema-registry.js.map +1 -1
  161. package/dist/entry-schema.d.ts +1 -0
  162. package/dist/entry-schema.d.ts.map +1 -1
  163. package/dist/entry-schema.js.map +1 -1
  164. package/dist/git-manager.js +4 -4
  165. package/dist/github-service.d.ts.map +1 -1
  166. package/dist/github-service.js +12 -8
  167. package/dist/github-service.js.map +1 -1
  168. package/dist/http/handler.js +7 -7
  169. package/dist/http/index.js +3 -3
  170. package/dist/http/router.js +12 -12
  171. package/dist/id.js +1 -1
  172. package/dist/index.d.ts +1 -0
  173. package/dist/index.d.ts.map +1 -1
  174. package/dist/index.js +7 -6
  175. package/dist/index.js.map +1 -1
  176. package/dist/operating-mode/client-unsafe-strategy.js +2 -2
  177. package/dist/operating-mode/client.js +1 -1
  178. package/dist/operating-mode/index.js +2 -2
  179. package/dist/paths/branch.js +1 -1
  180. package/dist/paths/index.d.ts +1 -1
  181. package/dist/paths/index.d.ts.map +1 -1
  182. package/dist/paths/index.js +6 -6
  183. package/dist/paths/index.js.map +1 -1
  184. package/dist/paths/normalize.d.ts +8 -0
  185. package/dist/paths/normalize.d.ts.map +1 -1
  186. package/dist/paths/normalize.js +17 -0
  187. package/dist/paths/normalize.js.map +1 -1
  188. package/dist/paths/test-utils.js +1 -1
  189. package/dist/paths/validation.js +1 -1
  190. package/dist/reference-resolver.js +1 -1
  191. package/dist/schema/index.js +2 -2
  192. package/dist/schema/meta-loader.js +1 -1
  193. package/dist/schema/resolver.js +1 -1
  194. package/dist/schema/schema-store.js +4 -4
  195. package/dist/server.js +13 -13
  196. package/dist/services.js +12 -12
  197. package/dist/settings-branch-utils.js +1 -1
  198. package/dist/settings-workspace.js +3 -3
  199. package/dist/task-queue/index.js +1 -1
  200. package/dist/task-queue/task-queue.js +1 -1
  201. package/dist/url-path-resolver.d.ts +16 -0
  202. package/dist/url-path-resolver.d.ts.map +1 -0
  203. package/dist/url-path-resolver.js +31 -0
  204. package/dist/url-path-resolver.js.map +1 -0
  205. package/dist/user.js +1 -1
  206. package/dist/utils/body-field.d.ts +18 -0
  207. package/dist/utils/body-field.d.ts.map +1 -0
  208. package/dist/utils/body-field.js +39 -0
  209. package/dist/utils/body-field.js.map +1 -0
  210. package/dist/utils/fs.js +1 -1
  211. package/dist/utils/sanitize-href.d.ts +19 -0
  212. package/dist/utils/sanitize-href.d.ts.map +1 -0
  213. package/dist/utils/sanitize-href.js +30 -0
  214. package/dist/utils/sanitize-href.js.map +1 -0
  215. package/dist/validation/reference-validator.js +2 -2
  216. package/dist/worker/cms-worker.js +5 -5
  217. package/dist/worker/task-queue-config.js +1 -1
  218. package/dist/worker/task-queue.js +2 -2
  219. package/package.json +1 -1
package/dist/context.d.ts CHANGED
@@ -12,7 +12,20 @@ export interface CanopyContextOptions {
12
12
  */
13
13
  extractUser: () => Promise<CanopyUser>;
14
14
  }
15
- export interface CanopyContext {
15
+ /**
16
+ * Build-time context with only listing/tree operations.
17
+ * Does NOT include read/readByUrlPath since those require request-scoped auth.
18
+ * Use getCanopyForBuild() to obtain this; use getCanopy() for request-scoped access.
19
+ */
20
+ export interface CanopyBuildContext {
21
+ /** Build a content tree from the schema and filesystem entries. */
22
+ buildContentTree: <T = unknown>(options?: BuildContentTreeOptions<T>) => Promise<ContentTreeNode<T>[]>;
23
+ /** List all content entries as a flat array. */
24
+ listEntries: <T = Record<string, unknown>>(options?: ListEntriesOptions<T>) => Promise<ListEntriesItem<T>[]>;
25
+ /** Underlying services */
26
+ services: CanopyServices;
27
+ }
28
+ export interface CanopyContext extends CanopyBuildContext {
16
29
  /** Content reader with automatic auth context */
17
30
  read: <T = unknown>(input: {
18
31
  entryPath: string;
@@ -23,12 +36,30 @@ export interface CanopyContext {
23
36
  data: T;
24
37
  path: string;
25
38
  }>;
26
- /** Build a content tree from the schema and filesystem entries. */
27
- buildContentTree: <T = unknown>(options?: BuildContentTreeOptions<T>) => Promise<ContentTreeNode<T>[]>;
28
- /** List all content entries as a flat array. */
29
- listEntries: <T = Record<string, unknown>>(options?: ListEntriesOptions<T>) => Promise<ListEntriesItem<T>[]>;
30
- /** Underlying services */
31
- services: CanopyServices;
39
+ /**
40
+ * Read content by URL path, resolving the collection/entry split automatically.
41
+ *
42
+ * Tries direct entry match first (last segment = slug, rest = collection path),
43
+ * then falls back to index entry (full path = collection, slug = 'index').
44
+ * Returns null if no content matches the path.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // URL /docs/guides/getting-started → reads content/docs/guides + slug "getting-started"
49
+ * // URL /docs/guides → reads content/docs/guides + slug "index"
50
+ * const result = await canopy.readByUrlPath<DocContent>('/docs/guides/getting-started')
51
+ * if (result) {
52
+ * const { data, path } = result
53
+ * }
54
+ * ```
55
+ */
56
+ readByUrlPath: <T = unknown>(urlPath: string, options?: {
57
+ branch?: string;
58
+ resolveReferences?: boolean;
59
+ }) => Promise<{
60
+ data: T;
61
+ path: string;
62
+ } | null>;
32
63
  /** Current authenticated user */
33
64
  user: CanopyUser;
34
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAMhD,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;CACvC;AAED,MAAM,WAAW,aAAa;IAC5B,iDAAiD;IACjD,IAAI,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE;QACzB,SAAS,EAAE,MAAM,CAAA;QACjB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC5B,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,MA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ContentReader } from './content-reader';
3
- import { createLogicalPath, parseSlug, resolveBranchPaths } from './paths';
4
- import { loadOrCreateBranchContext } from './branch-workspace';
5
- import { buildContentTree as buildContentTreeImpl, } from './content-tree';
6
- import { listEntries as listEntriesImpl, } from './content-listing';
1
+ import { isDeployedStatic, isBuildMode, STATIC_DEPLOY_USER } from './build-mode.js';
2
+ import { createContentReader } from './content-reader.js';
3
+ import { ContentStoreError } from './content-store.js';
4
+ import { createLogicalPath, parseSlug, resolveBranchPaths } from './paths/index.js';
5
+ import { resolveUrlPathCandidates } from './url-path-resolver.js';
6
+ import { loadOrCreateBranchContext } from './branch-workspace.js';
7
+ import { buildContentTree as buildContentTreeImpl, } from './content-tree.js';
8
+ import { listEntries as listEntriesImpl, } from './content-listing.js';
9
+ /** True when a ContentStoreError indicates a path/entry wasn't found (expected during candidate probing). */
10
+ function isLookupFailure(err) {
11
+ return err.code === 'NOT_FOUND' || err.code === 'NO_SCHEMA_ITEM';
12
+ }
7
13
  /**
8
14
  * Create a Canopy context that manages auth + content reading.
9
15
  * Framework-agnostic - the adapter provides the extractUser function.
@@ -58,6 +64,31 @@ export function createCanopyContext(options) {
58
64
  };
59
65
  return baseReader.read(readInput);
60
66
  };
67
+ const readByUrlPath = async (urlPath, options) => {
68
+ const contentRoot = services.config.contentRoot || 'content';
69
+ const candidates = resolveUrlPathCandidates(urlPath, contentRoot);
70
+ if (candidates.length === 0)
71
+ return null;
72
+ const { branch, resolveReferences } = options ?? {};
73
+ for (const candidate of candidates) {
74
+ try {
75
+ return await read({
76
+ entryPath: candidate.entryPath,
77
+ slug: candidate.slug,
78
+ branch,
79
+ resolveReferences,
80
+ });
81
+ }
82
+ catch (err) {
83
+ // Only swallow "not found" errors from trying candidate paths.
84
+ // Re-throw real errors (path traversal, permission, corruption).
85
+ if (err instanceof ContentStoreError && isLookupFailure(err))
86
+ continue;
87
+ throw err;
88
+ }
89
+ }
90
+ return null;
91
+ };
61
92
  /** Resolve branch workspace and schema — shared by buildContentTree and listEntries. Memoized per getContext call. */
62
93
  let schemaContextPromise = null;
63
94
  const resolveSchemaContextImpl = async () => {
@@ -91,6 +122,7 @@ export function createCanopyContext(options) {
91
122
  };
92
123
  return {
93
124
  read,
125
+ readByUrlPath,
94
126
  buildContentTree,
95
127
  listEntries,
96
128
  services,
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,kBAAkB,EAAa,MAAM,SAAS,CAAA;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EACL,gBAAgB,IAAI,oBAAoB,GAGzC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,WAAW,IAAI,eAAe,GAG/B,MAAM,mBAAmB,CAAA;AAuC1B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IAEjC;;;OAGG;IACH,MAAM,OAAO,GAAG,KAAK,IAAyB,EAAE;QAC9C,iFAAiF;QACjF,IAAI,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,WAAW,EAAE,EAAE,CAAC;YACvD,OAAO,kBAAkB,CAAA;QAC3B,CAAC;QAED,uDAAuD;QACvD,wEAAwE;QACxE,OAAO,MAAM,OAAO,CAAC,WAAW,EAAE,CAAA;IACpC,CAAC,CAAA;IAED;;;OAGG;IACH,MAAM,UAAU,GAAG,KAAK,IAA4B,EAAE;QACpD,MAAM,IAAI,GAAG,MAAM,OAAO,EAAE,CAAA;QAE5B,6BAA6B;QAC7B,MAAM,UAAU,GAAG,mBAAmB,CAAC,EAAE,QAAQ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YACnD,CAAC;YACD,OAAO,oBAAoB,CAAA;QAC7B,CAAC,CAAA;QAED,MAAM,gBAAgB,GAAsC,KAAK,EAC/D,OAAoC,EACpC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,oBAAoB,EAAE,CAAA;YAChF,OAAO,oBAAoB,CAAI,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;QAClF,CAAC,CAAA;QAED,MAAM,WAAW,GAAiC,KAAK,EACrD,OAA+B,EAC/B,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,oBAAoB,EAAE,CAAA;YAChF,OAAO,eAAe,CAAI,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,CAAC,CAAA;QAC7E,CAAC,CAAA;QAED,OAAO;YACL,IAAI;YACJ,aAAa;YACb,gBAAgB;YAChB,WAAW;YACX,QAAQ;YACR,IAAI;SACL,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,UAAU;QACV,QAAQ;KACT,CAAA;AACH,CAAC"}
@@ -2,11 +2,11 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
4
  import { Badge, Button, Group, Paper, ScrollArea, Stack, Text, TextInput, Textarea, Collapse, Tooltip, } from '@mantine/core';
5
- import { BranchComments } from './comments/BranchComments';
6
- import { UserBadge } from './components/UserBadge';
5
+ import { BranchComments } from './comments/BranchComments.js';
6
+ import { UserBadge } from './components/UserBadge.js';
7
7
  // Import directly from helpers to avoid server-only code in authorization barrel
8
- import { isAdmin, isReviewer } from '../authorization/helpers';
9
- import { clientOperatingStrategy } from '../operating-mode/client';
8
+ import { isAdmin, isReviewer } from '../authorization/helpers.js';
9
+ import { clientOperatingStrategy } from '../operating-mode/client.js';
10
10
  /**
11
11
  * Compute what actions the current user can perform on a branch.
12
12
  * Uses the same hybrid permission model as the backend:
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useMemo } from 'react';
4
- import { Editor } from './Editor';
5
- import { ApiClientProvider } from './context';
6
- import { buildEditorCollections, buildPreviewBaseByCollection } from './editor-config';
4
+ import { Editor } from './Editor.js';
5
+ import { ApiClientProvider } from './context/index.js';
6
+ import { buildEditorCollections, buildPreviewBaseByCollection } from './editor-config.js';
7
7
  export const CanopyEditor = ({ config, entries = [], initialSelectedId, initialValues, renderPreview, onCreateEntry, branchName, }) => {
8
8
  const collections = useMemo(() => buildEditorCollections(config.flatSchema), [config.flatSchema]);
9
9
  const previewBase = useMemo(() => ({
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CanopyEditor } from './CanopyEditor';
2
+ import { CanopyEditor } from './CanopyEditor.js';
3
3
  export const CanopyEditorPage = (config) => {
4
4
  const CanopyEditorPageInner = ({ searchParams, }) => {
5
5
  const branchName = searchParams?.branch ?? config.defaultBaseBranch ?? 'main';
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
4
  import { Badge, Button, Drawer, Group, Paper, ScrollArea, Stack, Text, Textarea, Title, Switch, } from '@mantine/core';
5
- import { UserBadge } from './components/UserBadge';
5
+ import { UserBadge } from './components/UserBadge.js';
6
6
  export const CommentsPanel = ({ branchName, comments, canResolve, onAddComment, onResolveThread, onClose, onJumpToField, onJumpToEntry, onJumpToBranch, onGetUserMetadata, }) => {
7
7
  const [newCommentText, setNewCommentText] = useState('');
8
8
  const [replyTo, setReplyTo] = useState(null);
@@ -4,24 +4,24 @@ import { useEffect, useMemo, useState, useRef } from 'react';
4
4
  import { ActionIcon, Box, Drawer, Group, Menu, Paper, Text, Title } from '@mantine/core';
5
5
  import { IconChevronDown, IconChevronUp, IconDots, IconFolderPlus, IconPlus, } from '@tabler/icons-react';
6
6
  import { notifications } from '@mantine/notifications';
7
- import { EntryNavigator } from './EntryNavigator';
8
- import { FormRenderer } from './FormRenderer';
9
- import { PreviewFrame } from './preview-bridge';
10
- import { EditorPanes } from './EditorPanes';
11
- import { CanopyCMSProvider } from './theme';
12
- import { BranchManager } from './BranchManager';
13
- import { CommentsPanel } from './CommentsPanel';
14
- import { GroupManager } from './GroupManager';
15
- import { PermissionManager } from './PermissionManager';
16
- import { buildPreviewSrc, buildCollectionLabels, buildBreadcrumbSegments } from './editor-utils';
17
- import { useEditorLayout, useDraftManager, useEntryManager, useGroupManager, usePermissionManager, useCommentSystem, useBranchManager, useUserContext, useSchemaManager, } from './hooks';
18
- import { useBranchActions } from './hooks/useBranchActions';
19
- import { EditorFooter, EditorHeader, EditorSidebar } from './components';
20
- import { RenameEntryModal } from './components/RenameEntryModal';
21
- import { EntryCreateModal } from './components/EntryCreateModal';
22
- import { ConfirmDeleteModal } from './components/ConfirmDeleteModal';
23
- import { CollectionEditor } from './schema-editor';
24
- import { useApiClient } from './context';
7
+ import { EntryNavigator } from './EntryNavigator.js';
8
+ import { FormRenderer } from './FormRenderer.js';
9
+ import { PreviewFrame } from './preview-bridge.js';
10
+ import { EditorPanes } from './EditorPanes.js';
11
+ import { CanopyCMSProvider } from './theme.js';
12
+ import { BranchManager } from './BranchManager.js';
13
+ import { CommentsPanel } from './CommentsPanel.js';
14
+ import { GroupManager } from './GroupManager.js';
15
+ import { PermissionManager } from './PermissionManager.js';
16
+ import { buildPreviewSrc, buildCollectionLabels, buildBreadcrumbSegments } from './editor-utils.js';
17
+ import { useEditorLayout, useDraftManager, useEntryManager, useGroupManager, usePermissionManager, useCommentSystem, useBranchManager, useUserContext, useSchemaManager, } from './hooks/index.js';
18
+ import { useBranchActions } from './hooks/useBranchActions.js';
19
+ import { EditorFooter, EditorHeader, EditorSidebar } from './components/index.js';
20
+ import { RenameEntryModal } from './components/RenameEntryModal.js';
21
+ import { EntryCreateModal } from './components/EntryCreateModal.js';
22
+ import { ConfirmDeleteModal } from './components/ConfirmDeleteModal.js';
23
+ import { CollectionEditor } from './schema-editor/index.js';
24
+ import { useApiClient } from './context/index.js';
25
25
  /**
26
26
  * High-level editor wrapper that wires entry navigation, form rendering,
27
27
  * saving/loading, and preview rendering using entry definitions.
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useMemo, useRef, useEffect } from 'react';
4
4
  import { ActionIcon, Badge, Box, Group, Menu, ScrollArea, Stack, Text, Tooltip, Tree, useTree, rem, } from '@mantine/core';
5
5
  import { IconArrowDown, IconArrowUp, IconDots, IconEdit, IconFolderPlus, IconPlus, IconTrash, } from '@tabler/icons-react';
6
- import { calculatePathToEntry } from './editor-utils';
6
+ import { calculatePathToEntry } from './editor-utils.js';
7
7
  export const EntryNavigator = ({ items, collections, selectedPath, onSelect, onTreeControllerReady, expandedStateRef, onExpandedStateChange, onDeleteEntry, onRenameEntry, onReorderEntry, hiddenRootPath, }) => {
8
8
  const selectedNodeRef = useRef(null);
9
9
  const hasScrolledRef = useRef(false);
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Alert, Button, Group, Paper, Stack, Text } from '@mantine/core';
3
3
  import { IconInfoCircle } from '@tabler/icons-react';
4
- import { MarkdownField } from './fields/MarkdownField';
5
- import { TextField } from './fields/TextField';
6
- import { ToggleField } from './fields/ToggleField';
7
- import { BlockField } from './fields/BlockField';
8
- import { SelectField } from './fields/SelectField';
9
- import { ReferenceField } from './fields/ReferenceField';
10
- import { CodeField } from './fields/CodeField';
11
- import { ObjectField } from './fields/ObjectField';
12
- import { formatCanopyPath, normalizeCanopyPath } from './canopy-path';
13
- import { FieldWrapper } from './comments/FieldWrapper';
14
- import { EntryComments } from './comments/EntryComments';
15
- import { useReferenceResolution } from './hooks/useReferenceResolution';
4
+ import { MarkdownField } from './fields/MarkdownField.js';
5
+ import { TextField } from './fields/TextField.js';
6
+ import { ToggleField } from './fields/ToggleField.js';
7
+ import { BlockField } from './fields/BlockField.js';
8
+ import { SelectField } from './fields/SelectField.js';
9
+ import { ReferenceField } from './fields/ReferenceField.js';
10
+ import { CodeField } from './fields/CodeField.js';
11
+ import { ObjectField } from './fields/ObjectField.js';
12
+ import { formatCanopyPath, normalizeCanopyPath } from './canopy-path.js';
13
+ import { FieldWrapper } from './comments/FieldWrapper.js';
14
+ import { EntryComments } from './comments/EntryComments.js';
15
+ import { useReferenceResolution } from './hooks/useReferenceResolution.js';
16
16
  const normalizeOptions = (options) => {
17
17
  if (!options)
18
18
  return [];
@@ -3,5 +3,5 @@
3
3
  * GroupManager - Re-exports from the group-manager module.
4
4
  * This file maintains backward compatibility with existing imports.
5
5
  */
6
- export { GroupManager, useGroupState, useUserSearch, useExternalGroupSearch } from './group-manager';
6
+ export { GroupManager, useGroupState, useUserSearch, useExternalGroupSearch } from './group-manager/index.js';
7
7
  //# sourceMappingURL=GroupManager.js.map
@@ -5,5 +5,5 @@
5
5
  * This file maintains backward compatibility for imports.
6
6
  * The actual implementation is in ./permission-manager/
7
7
  */
8
- export { PermissionManager, usePermissionTree, useGroupsAndUsers } from './permission-manager';
8
+ export { PermissionManager, usePermissionTree, useGroupsAndUsers } from './permission-manager/index.js';
9
9
  //# sourceMappingURL=PermissionManager.js.map
@@ -1,4 +1,4 @@
1
- import { createApiClient } from '../api/client';
1
+ import { createApiClient } from '../api/client.js';
2
2
  /**
3
3
  * Client-side utility for incrementally resolving reference fields in form data.
4
4
  * Used by FormRenderer to transform draft data before sending to preview.
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from 'react';
4
4
  import { Box, Button } from '@mantine/core';
5
- import { ThreadCarousel } from './ThreadCarousel';
5
+ import { ThreadCarousel } from './ThreadCarousel.js';
6
6
  /**
7
7
  * Branch-level comments section displayed at the top of BranchManager.
8
8
  * Uses ThreadCarousel for navigation.
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from 'react';
4
4
  import { Box, Button } from '@mantine/core';
5
- import { ThreadCarousel } from './ThreadCarousel';
5
+ import { ThreadCarousel } from './ThreadCarousel.js';
6
6
  /**
7
7
  * Entry-level comments section displayed at the top of the form.
8
8
  * Uses ThreadCarousel for navigation.
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef, useState } from 'react';
4
4
  import { Box, Button } from '@mantine/core';
5
- import { ThreadCarousel } from './ThreadCarousel';
5
+ import { ThreadCarousel } from './ThreadCarousel.js';
6
6
  /**
7
7
  * Wraps a form field with inline comment functionality.
8
8
  * Shows ThreadCarousel when comments exist or when user clicks "New comment".
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
4
  import { Alert, Badge, Button, Group, Paper, Stack, Text, Textarea } from '@mantine/core';
5
5
  import { IconAlertCircle } from '@tabler/icons-react';
6
- import { UserBadge } from '../components/UserBadge';
6
+ import { UserBadge } from '../components/UserBadge.js';
7
7
  /**
8
8
  * Individual comment thread display within the carousel.
9
9
  * Always shows full thread view with per-thread scrolling.
@@ -3,7 +3,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
3
3
  import { useState, useMemo, useEffect, useRef } from 'react';
4
4
  import { ActionIcon, Alert, Button, Group, Paper, Stack, Text, Textarea } from '@mantine/core';
5
5
  import { IconChevronLeft, IconChevronRight, IconAlertCircle } from '@tabler/icons-react';
6
- import { InlineCommentThread } from './InlineCommentThread';
6
+ import { InlineCommentThread } from './InlineCommentThread.js';
7
7
  export const ThreadCarousel = ({ threads, label = 'Comments', contextType: _, currentUserId, canResolve, onAddComment, onResolveThread, autoFocus, autoOpenNewThread, highlightThreadId, onGetUserMetadata, }) => {
8
8
  const [currentIndex, setCurrentIndex] = useState(0);
9
9
  const [showNewThreadBox, setShowNewThreadBox] = useState(false);
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
3
3
  import { Badge, Box, Button, Group, Menu, Paper, Stack, Text, Title, Tooltip } from '@mantine/core';
4
4
  import { MdFolderOpen, MdKeyboardArrowDown } from 'react-icons/md';
5
5
  import { GoGitBranch } from 'react-icons/go';
6
- import { clientOperatingStrategy } from '../../operating-mode/client';
6
+ import { clientOperatingStrategy } from '../../operating-mode/client.js';
7
7
  /**
8
8
  * Status color map matching BranchManager.tsx pattern.
9
9
  * Returns the Mantine color string for a given branch status.
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Avatar, Badge, Tooltip, Group, Text, Skeleton, ActionIcon } from '@mantine/core';
3
3
  import { IconUserOff, IconX } from '@tabler/icons-react';
4
- import { useUserMetadata } from '../hooks/useUserMetadata';
4
+ import { useUserMetadata } from '../hooks/useUserMetadata.js';
5
5
  export const UserBadge = ({ userId, getUserMetadata, variant = 'avatar-name', showEmailTooltip = true, onRemove, color, size = 'sm', badgeVariant = 'filled', showBadge = false, loading: loadingOverride, cachedUser, }) => {
6
6
  const { userMetadata, isLoading, error } = useUserMetadata(userId, getUserMetadata, cachedUser);
7
7
  const loading = loadingOverride ?? isLoading;
@@ -1,6 +1,6 @@
1
1
  // Barrel export for all Editor UI components
2
2
  // Export components as they are created
3
- export * from './EditorFooter';
4
- export * from './EditorHeader';
5
- export * from './EditorSidebar';
3
+ export * from './EditorFooter.js';
4
+ export * from './EditorHeader.js';
5
+ export * from './EditorSidebar.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -10,7 +10,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  * - No global mutable state
11
11
  */
12
12
  import { createContext, useContext, useMemo } from 'react';
13
- import { createApiClient } from '../../api';
13
+ import { createApiClient } from '../../api/index.js';
14
14
  const ApiClientContext = createContext(null);
15
15
  /**
16
16
  * Provider that creates and provides the API client.
@@ -15,6 +15,6 @@
15
15
  * </ApiClientProvider>
16
16
  * ```
17
17
  */
18
- export { ApiClientProvider, useApiClient, useOptionalApiClient, } from './ApiClientContext';
19
- export { EditorStateProvider, useEditorState, useEditorLoading, useEditorModals, useEditorPreview, } from './EditorStateContext';
18
+ export { ApiClientProvider, useApiClient, useOptionalApiClient, } from './ApiClientContext.js';
19
+ export { EditorStateProvider, useEditorState, useEditorLoading, useEditorModals, useEditorPreview, } from './EditorStateContext.js';
20
20
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
+ import { trimSlashes } from '../paths/normalize.js';
1
2
  const normalizeContentRoot = (value) => {
2
- const trimmed = (value ?? 'content').replace(/^\/+|\/+$/g, '');
3
- return trimmed;
3
+ return trimSlashes(value ?? 'content');
4
4
  };
5
5
  const stripContentRoot = (logicalPath, contentRoot) => {
6
6
  const prefix = contentRoot ? `${contentRoot}/` : '';
@@ -1 +1 @@
1
- {"version":3,"file":"editor-config.js","sourceRoot":"","sources":["../../src/editor/editor-config.ts"],"names":[],"mappings":"AAGA,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAAU,EAAE;IACtD,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAA;IAC9D,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,WAAmB,EAAE,WAAmB,EAAU,EAAE;IAC5E,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;IACnD,IAAI,MAAM,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7C,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED;;;;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BACrE,CAAC,CAAA;YACJ,CAAC;YACD,8EAA8E;QAChF,CAAC;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,4DAA4D;IAC5D,uDAAuD;IACvD,OAAO,SAAS,CAAC,SAAS,CAAC,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,MAAyC,EACzC,UAA4B,EACJ,EAAE;IAC1B,MAAM,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,IAAI,GAAG,UAAU,CAAA;IACvB,MAAM,GAAG,GAA2B,EAAE,CAAA;IAEtC,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,iEAAiE;QACjE,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;QAC5D,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;QAC9C,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,cAAc,CAAA;IACxC,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
@@ -1,5 +1,5 @@
1
1
  // Import directly from normalize to avoid pulling in server-only branch.ts
2
- import { normalizeCollectionPath } from '../paths/normalize';
2
+ import { normalizeCollectionPath } from '../paths/normalize.js';
3
3
  export { normalizeCollectionPath };
4
4
  export const encodeSlug = (value) => (value ?? '')
5
5
  .split('/')
@@ -5,7 +5,7 @@ import { ActionIcon, Button, Group, Paper, Select, Stack, Text } from '@mantine/
5
5
  import { DndContext, KeyboardSensor, PointerSensor, useSensor, useSensors, } from '@dnd-kit/core';
6
6
  import { SortableContext, arrayMove, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy, } from '@dnd-kit/sortable';
7
7
  import { CSS } from '@dnd-kit/utilities';
8
- import { formatCanopyPath } from '../canopy-path';
8
+ import { formatCanopyPath } from '../canopy-path.js';
9
9
  const findTemplate = (templates, name) => templates.find((t) => t.name === name);
10
10
  const SortableBlock = ({ id, children }) => {
11
11
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Paper, Stack, Text } from '@mantine/core';
3
- import { formatCanopyPath } from '../canopy-path';
3
+ import { formatCanopyPath } from '../canopy-path.js';
4
4
  export const ObjectField = ({ label, fields, value, onChange, renderField, path, dataCanopyField, }) => {
5
5
  const current = value ?? {};
6
6
  return (_jsx(Paper, { withBorder: true, radius: "md", p: "md", bg: "gray.0", "data-canopy-field": dataCanopyField ?? formatCanopyPath(path), shadow: "xs", children: _jsxs(Stack, { gap: "sm", children: [label && (_jsx(Text, { size: "xs", fw: 700, c: "neutral.8", children: label })), _jsx(Stack, { gap: "sm", children: fields.map((field) => {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useId, useState } from 'react';
3
3
  import { MultiSelect, Select, Stack, Text, Loader } from '@mantine/core';
4
- import { createApiClient } from '../../api/client';
4
+ import { createApiClient } from '../../api/client.js';
5
5
  export const ReferenceField = ({ id, label, options: staticOptions, collections, displayField = 'title', branch = 'main', value, onChange, multiple, dataCanopyField, }) => {
6
6
  const needsFetch = !staticOptions && !!collections && collections.length > 0;
7
7
  const [options, setOptions] = useState(staticOptions || []);
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ActionIcon, Badge, Group, Paper, Text, Tooltip } from '@mantine/core';
4
4
  import { IconEdit, IconTrash } from '@tabler/icons-react';
5
- import { MemberList } from './MemberList';
5
+ import { MemberList } from './MemberList.js';
6
6
  export const GroupCard = ({ group, onEdit, onDelete, onAddMember, onRemoveMember, onGetUserMetadata, showUserSearch, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
7
7
  return (_jsxs(Paper, { withBorder: true, p: "sm", mb: "xs", children: [_jsxs(Group, { justify: "space-between", mb: "sm", children: [_jsxs("div", { style: { flex: 1 }, children: [_jsxs(Group, { gap: "xs", children: [_jsx(Text, { size: "sm", fw: 500, children: group.name }), _jsxs(Badge, { size: "sm", variant: "light", children: [group.members?.length || 0, " members"] })] }), _jsxs(Text, { size: "xs", c: "dimmed", mt: 4, children: ["ID: ", group.id] }), group.description && (_jsx(Text, { size: "xs", c: "dimmed", mt: 4, children: group.description }))] }), _jsxs(Group, { gap: "xs", children: [_jsx(Tooltip, { label: "Edit group", children: _jsx(ActionIcon, { size: "sm", variant: "subtle", onClick: () => onEdit(group), children: _jsx(IconEdit, { size: 16 }) }) }), _jsx(Tooltip, { label: "Delete group", children: _jsx(ActionIcon, { size: "sm", variant: "subtle", color: "red", onClick: () => onDelete(group.id), children: _jsx(IconTrash, { size: 16 }) }) })] })] }), _jsx(MemberList, { groupId: group.id, members: group.members || [], onRemoveMember: onRemoveMember, onAddMember: onAddMember, onGetUserMetadata: onGetUserMetadata, showUserSearch: showUserSearch, searchQuery: searchQuery, searchResults: searchResults, isSearching: isSearching, searchError: searchError, onSearchQueryChange: onSearchQueryChange, onShowSearch: onShowSearch, onHideSearch: onHideSearch, canSearch: canSearch })] }));
8
8
  };
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Button, Group, Paper, ScrollArea, Stack, Text } from '@mantine/core';
4
4
  import { IconPlus, IconUsers } from '@tabler/icons-react';
5
- import { GroupCard } from './GroupCard';
5
+ import { GroupCard } from './GroupCard.js';
6
6
  export const InternalGroupsTab = ({ groups, canEdit, onCreateGroup, onEditGroup, onDeleteGroup, onAddMember, onRemoveMember, onGetUserMetadata, activeSearchGroupId, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
7
7
  // Read-only view
8
8
  if (!canEdit) {
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ActionIcon, Badge, Button, Group, Loader, Paper, Stack, Text, TextInput, } from '@mantine/core';
4
4
  import { IconSearch, IconX } from '@tabler/icons-react';
5
- import { UserBadge } from '../components/UserBadge';
5
+ import { UserBadge } from '../components/UserBadge.js';
6
6
  export const MemberList = ({ groupId, members, onRemoveMember, onAddMember, onGetUserMetadata, showUserSearch, searchQuery, searchResults, isSearching, searchError, onSearchQueryChange, onShowSearch, onHideSearch, canSearch, }) => {
7
7
  const handleAddMember = (userId) => {
8
8
  onAddMember(groupId, userId);
@@ -9,12 +9,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  import { useState, useCallback } from 'react';
10
10
  import { Alert, Button, Group, Loader, Stack, Tabs, Text } from '@mantine/core';
11
11
  import { IconAlertCircle } from '@tabler/icons-react';
12
- import { useGroupState } from './hooks/useGroupState';
13
- import { useUserSearch } from './hooks/useUserSearch';
14
- import { useExternalGroupSearch } from './hooks/useExternalGroupSearch';
15
- import { InternalGroupsTab } from './InternalGroupsTab';
16
- import { ExternalGroupsTab } from './ExternalGroupsTab';
17
- import { GroupForm } from './GroupForm';
12
+ import { useGroupState } from './hooks/useGroupState.js';
13
+ import { useUserSearch } from './hooks/useUserSearch.js';
14
+ import { useExternalGroupSearch } from './hooks/useExternalGroupSearch.js';
15
+ import { InternalGroupsTab } from './InternalGroupsTab.js';
16
+ import { ExternalGroupsTab } from './ExternalGroupsTab.js';
17
+ import { GroupForm } from './GroupForm.js';
18
18
  export const GroupManager = ({ internalGroups: initialInternalGroups, loading = false, canEdit, onSave, onSearchUsers, onGetUserMetadata, onSearchExternalGroups, onClose: _, }) => {
19
19
  // Group state management
20
20
  const { groups, isDirty, isSaving, error, setError, createGroup, updateGroup, deleteGroup, addMember, removeMember, save, discard, } = useGroupState({
@@ -65,7 +65,7 @@ export const GroupManager = ({ internalGroups: initialInternalGroups, loading =
65
65
  }, [addMember, userSearch]);
66
66
  return (_jsxs(Stack, { h: "100%", style: { display: 'flex', flexDirection: 'column' }, gap: 0, children: [!canEdit && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "yellow", mb: "sm", title: "Read-only", children: "You need admin access to manage groups." })), error && (_jsx(Alert, { icon: _jsx(IconAlertCircle, { size: 16 }), color: "red", mb: "sm", title: "Error", withCloseButton: true, onClose: () => setError(null), children: error })), loading ? (_jsxs(Group, { justify: "center", py: "xl", children: [_jsx(Loader, { size: "md" }), _jsx(Text, { size: "sm", c: "dimmed", children: "Loading groups..." })] })) : (_jsxs(Tabs, { defaultValue: "internal", style: { flex: 1, display: 'flex', flexDirection: 'column' }, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Tab, { value: "internal", children: "Internal Groups" }), _jsx(Tabs.Tab, { value: "external", children: "External Groups" })] }), _jsx(Tabs.Panel, { value: "internal", style: { flex: 1, overflow: 'auto' }, children: _jsx(InternalGroupsTab, { groups: groups, canEdit: canEdit, onCreateGroup: handleCreateGroup, onEditGroup: handleEditGroup, onDeleteGroup: deleteGroup, onAddMember: handleAddMember, onRemoveMember: removeMember, onGetUserMetadata: onGetUserMetadata, activeSearchGroupId: userSearch.activeGroupId, searchQuery: userSearch.searchQuery, searchResults: userSearch.searchResults, isSearching: userSearch.isSearching, searchError: userSearch.searchError, onSearchQueryChange: userSearch.setSearchQuery, onShowSearch: userSearch.showSearch, onHideSearch: userSearch.hideSearch, canSearch: !!onSearchUsers }) }), _jsx(Tabs.Panel, { value: "external", style: { flex: 1, overflow: 'auto' }, children: _jsx(ExternalGroupsTab, { canEdit: canEdit, searchQuery: externalGroupSearch.searchQuery, searchResults: externalGroupSearch.searchResults, isSearching: externalGroupSearch.isSearching, searchError: externalGroupSearch.searchError, onSearchQueryChange: externalGroupSearch.setSearchQuery, canSearch: !!onSearchExternalGroups }) })] })), canEdit && isDirty && (_jsxs(Group, { justify: "flex-end", py: "sm", gap: "sm", style: { borderTop: '1px solid var(--mantine-color-gray-3)' }, children: [_jsx(Button, { variant: "subtle", color: "neutral", onClick: discard, disabled: isSaving, children: "Discard Changes" }), _jsx(Button, { onClick: save, loading: isSaving, disabled: isSaving, children: "Save Groups" })] })), _jsx(GroupForm, { isOpen: isModalOpen, editingGroup: editingGroup, formData: formData, onFormChange: handleFormChange, onSave: handleSaveModal, onClose: () => setIsModalOpen(false) })] }));
67
67
  };
68
- export { useGroupState } from './hooks/useGroupState';
69
- export { useUserSearch } from './hooks/useUserSearch';
70
- export { useExternalGroupSearch } from './hooks/useExternalGroupSearch';
68
+ export { useGroupState } from './hooks/useGroupState.js';
69
+ export { useUserSearch } from './hooks/useUserSearch.js';
70
+ export { useExternalGroupSearch } from './hooks/useExternalGroupSearch.js';
71
71
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { vi } from 'vitest';
3
- import { createMockApiClient } from '../../../api/__test__/mock-client';
4
- import { ApiClientProvider } from '../../context';
3
+ import { createMockApiClient } from '../../../api/__test__/mock-client.js';
4
+ import { ApiClientProvider } from '../../context/index.js';
5
5
  /**
6
6
  * Setup mock API client for hook tests.
7
7
  *
@@ -21,7 +21,7 @@ import { ApiClientProvider } from '../../context';
21
21
  * ```
22
22
  */
23
23
  export async function setupMockApiClient() {
24
- const { createApiClient } = await import('../../../api');
24
+ const { createApiClient } = await import('../../../api/index.js');
25
25
  const mockClient = createMockApiClient();
26
26
  vi.mocked(createApiClient).mockReturnValue(mockClient);
27
27
  return mockClient;
@@ -1,15 +1,15 @@
1
1
  // Barrel export for all custom hooks
2
2
  // Export hooks as they are created
3
3
  // Note: resetApiClient functions are not exported - they're test-only utilities
4
- export * from './useEditorLayout';
5
- export { useBranchManager } from './useBranchManager';
6
- export { useEntryManager } from './useEntryManager';
7
- export * from './useDraftManager';
8
- export { useCommentSystem } from './useCommentSystem';
9
- export { useGroupManager } from './useGroupManager';
10
- export { usePermissionManager } from './usePermissionManager';
11
- export { useBranchActions } from './useBranchActions';
12
- export { useUserContext } from './useUserContext';
13
- export { useReferenceResolution, } from './useReferenceResolution';
14
- export { useSchemaManager, } from './useSchemaManager';
4
+ export * from './useEditorLayout.js';
5
+ export { useBranchManager } from './useBranchManager.js';
6
+ export { useEntryManager } from './useEntryManager.js';
7
+ export * from './useDraftManager.js';
8
+ export { useCommentSystem } from './useCommentSystem.js';
9
+ export { useGroupManager } from './useGroupManager.js';
10
+ export { usePermissionManager } from './usePermissionManager.js';
11
+ export { useBranchActions } from './useBranchActions.js';
12
+ export { useUserContext } from './useUserContext.js';
13
+ export { useReferenceResolution, } from './useReferenceResolution.js';
14
+ export { useSchemaManager, } from './useSchemaManager.js';
15
15
  //# sourceMappingURL=index.js.map