@arbidocs/blocks 0.4.97 → 0.4.98

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 (31) hide show
  1. package/dist/{chunk-RSUOOMPT.js → chunk-6B2AWE3I.js} +3 -3
  2. package/dist/{chunk-RSUOOMPT.js.map → chunk-6B2AWE3I.js.map} +1 -1
  3. package/dist/{chunk-QIEEFBZ5.js → chunk-FIEAWH4K.js} +354 -69
  4. package/dist/chunk-FIEAWH4K.js.map +1 -0
  5. package/dist/{chunk-YH6SSJDW.js → chunk-LZ5AFAWC.js} +3 -3
  6. package/dist/{chunk-YH6SSJDW.js.map → chunk-LZ5AFAWC.js.map} +1 -1
  7. package/dist/{chunk-HGJGALLN.cjs → chunk-MIMVRMKC.cjs} +359 -67
  8. package/dist/chunk-MIMVRMKC.cjs.map +1 -0
  9. package/dist/{chunk-GVOTXXZG.cjs → chunk-MUYZP5FB.cjs} +5 -5
  10. package/dist/{chunk-GVOTXXZG.cjs.map → chunk-MUYZP5FB.cjs.map} +1 -1
  11. package/dist/{chunk-EHB7J6SR.cjs → chunk-VJO66VVF.cjs} +5 -5
  12. package/dist/{chunk-EHB7J6SR.cjs.map → chunk-VJO66VVF.cjs.map} +1 -1
  13. package/dist/connect/docx.cjs +6 -6
  14. package/dist/connect/docx.js +4 -4
  15. package/dist/connect/index.cjs +3 -3
  16. package/dist/connect/index.js +2 -2
  17. package/dist/docx/NativeDocxEditor.d.ts +7 -0
  18. package/dist/docx/RibbonMenu.d.ts +3 -1
  19. package/dist/docx/index.cjs +52 -24
  20. package/dist/docx/index.d.ts +2 -0
  21. package/dist/docx/index.js +3 -3
  22. package/dist/docx/template/HouseTemplate.d.ts +64 -0
  23. package/dist/docx/template/HouseTemplatePanel.d.ts +6 -0
  24. package/dist/docx/template/QuickParts.d.ts +7 -0
  25. package/dist/docx/wordStyles.d.ts +3 -0
  26. package/dist/index.cjs +41 -41
  27. package/dist/index.js +2 -2
  28. package/package.json +4 -4
  29. package/src/docx/styles.css +102 -0
  30. package/dist/chunk-HGJGALLN.cjs.map +0 -1
  31. package/dist/chunk-QIEEFBZ5.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkHGJGALLN_cjs = require('./chunk-HGJGALLN.cjs');
4
+ var chunkMIMVRMKC_cjs = require('./chunk-MIMVRMKC.cjs');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
7
  function StreamedWordArtifact({
@@ -15,7 +15,7 @@ function StreamedWordArtifact({
15
15
  }) {
16
16
  if (!busy && documentId) {
17
17
  return /* @__PURE__ */ jsxRuntime.jsx(
18
- chunkHGJGALLN_cjs.NativeDocxEditor,
18
+ chunkMIMVRMKC_cjs.NativeDocxEditor,
19
19
  {
20
20
  adapter,
21
21
  documentId,
@@ -26,7 +26,7 @@ function StreamedWordArtifact({
26
26
  );
27
27
  }
28
28
  return /* @__PURE__ */ jsxRuntime.jsx(
29
- chunkHGJGALLN_cjs.NativeDocxEditor,
29
+ chunkMIMVRMKC_cjs.NativeDocxEditor,
30
30
  {
31
31
  adapter,
32
32
  documentId: "stream-preview",
@@ -39,5 +39,5 @@ function StreamedWordArtifact({
39
39
  }
40
40
 
41
41
  exports.StreamedWordArtifact = StreamedWordArtifact;
42
- //# sourceMappingURL=chunk-GVOTXXZG.cjs.map
43
- //# sourceMappingURL=chunk-GVOTXXZG.cjs.map
42
+ //# sourceMappingURL=chunk-MUYZP5FB.cjs.map
43
+ //# sourceMappingURL=chunk-MUYZP5FB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":["jsx","NativeDocxEditor"],"mappings":";;;;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACEA,cAAA;AAAA,MAACC,kCAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACED,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-GVOTXXZG.cjs","sourcesContent":["import { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface StreamedWordArtifactProps {\n adapter: NativeDocxAdapter\n /** Streamed Markdown, shown as a read-only preview while the draft is generated. */\n content: string\n title: string\n busy: boolean\n error?: string | null\n /** The DOCX draft the server stored for this generation (`doc-…`), once known. */\n documentId?: string\n onSaved?: (documentId: string) => void\n}\n\n/**\n * One drafting surface for an AI document draft. The server stores every draft as DOCX, so\n * this component never creates a document: it previews the streamed Markdown until generation\n * ends and the stored DOCX is known, then opens that DOCX in the live collaborative editor.\n */\nexport function StreamedWordArtifact({\n adapter,\n content,\n title,\n busy,\n error,\n documentId,\n onSaved,\n}: StreamedWordArtifactProps) {\n if (!busy && documentId) {\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={title}\n onSaved={onSaved}\n />\n )\n }\n return (\n <NativeDocxEditor\n key=\"stream-preview\"\n adapter={adapter}\n documentId=\"stream-preview\"\n title={title}\n draftContent=\"\"\n stream={{ content, busy, error }}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/docx/StreamedWordArtifact.tsx"],"names":["jsx","NativeDocxEditor"],"mappings":";;;;;AAmBO,SAAS,oBAAA,CAAqB;AAAA,EACnC,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,IAAI,CAAC,QAAQ,UAAA,EAAY;AACvB,IAAA,uBACEA,cAAA;AAAA,MAACC,kCAAA;AAAA,MAAA;AAAA,QAEC,OAAA;AAAA,QACA,UAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA,OAAA;AAAA,MAJK;AAAA,KAKP;AAAA,EAEJ;AACA,EAAA,uBACED,cAAA;AAAA,IAACC,kCAAA;AAAA,IAAA;AAAA,MAEC,OAAA;AAAA,MACA,UAAA,EAAW,gBAAA;AAAA,MACX,KAAA;AAAA,MACA,YAAA,EAAa,EAAA;AAAA,MACb,MAAA,EAAQ,EAAE,OAAA,EAAS,IAAA,EAAM,KAAA;AAAM,KAAA;AAAA,IAL3B;AAAA,GAMN;AAEJ","file":"chunk-MUYZP5FB.cjs","sourcesContent":["import { NativeDocxEditor, type NativeDocxAdapter } from './NativeDocxEditor'\n\nexport interface StreamedWordArtifactProps {\n adapter: NativeDocxAdapter\n /** Streamed Markdown, shown as a read-only preview while the draft is generated. */\n content: string\n title: string\n busy: boolean\n error?: string | null\n /** The DOCX draft the server stored for this generation (`doc-…`), once known. */\n documentId?: string\n onSaved?: (documentId: string) => void\n}\n\n/**\n * One drafting surface for an AI document draft. The server stores every draft as DOCX, so\n * this component never creates a document: it previews the streamed Markdown until generation\n * ends and the stored DOCX is known, then opens that DOCX in the live collaborative editor.\n */\nexport function StreamedWordArtifact({\n adapter,\n content,\n title,\n busy,\n error,\n documentId,\n onSaved,\n}: StreamedWordArtifactProps) {\n if (!busy && documentId) {\n return (\n <NativeDocxEditor\n key={documentId}\n adapter={adapter}\n documentId={documentId}\n title={title}\n onSaved={onSaved}\n />\n )\n }\n return (\n <NativeDocxEditor\n key=\"stream-preview\"\n adapter={adapter}\n documentId=\"stream-preview\"\n title={title}\n draftContent=\"\"\n stream={{ content, busy, error }}\n />\n )\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkMUMH3Z6K_cjs = require('./chunk-MUMH3Z6K.cjs');
5
- var chunkHGJGALLN_cjs = require('./chunk-HGJGALLN.cjs');
5
+ var chunkMIMVRMKC_cjs = require('./chunk-MIMVRMKC.cjs');
6
6
  var react$1 = require('react');
7
7
  var reactQuery = require('@tanstack/react-query');
8
8
  var react = require('@arbidocs/react');
@@ -13,7 +13,7 @@ function ConnectedNativeDocxEditor({
13
13
  ...props
14
14
  }) {
15
15
  const adapter = useConnectedNativeDocxAdapter(fontBaseUrl);
16
- return /* @__PURE__ */ jsxRuntime.jsx(chunkHGJGALLN_cjs.NativeDocxEditor, { ...props, adapter });
16
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkMIMVRMKC_cjs.NativeDocxEditor, { ...props, adapter });
17
17
  }
18
18
  function useConnectedNativeDocxAdapter(fontBaseUrl = "/native-docx/fonts") {
19
19
  const arbi = react.useArbi();
@@ -42,7 +42,7 @@ function useConnectedNativeDocxAdapter(fontBaseUrl = "/native-docx/fonts") {
42
42
  headers: { "Content-Type": "application/json" },
43
43
  body: JSON.stringify({ state })
44
44
  })).json(),
45
- loadFonts: () => chunkHGJGALLN_cjs.loadDocxFonts(fontBaseUrl),
45
+ loadFonts: () => chunkMIMVRMKC_cjs.loadDocxFonts(fontBaseUrl),
46
46
  baseUrl: apiUrl,
47
47
  author: user?.name || "You",
48
48
  onVersionSaved: async (id) => {
@@ -91,5 +91,5 @@ function useConnectedNativeDocxAdapter(fontBaseUrl = "/native-docx/fonts") {
91
91
 
92
92
  exports.ConnectedNativeDocxEditor = ConnectedNativeDocxEditor;
93
93
  exports.useConnectedNativeDocxAdapter = useConnectedNativeDocxAdapter;
94
- //# sourceMappingURL=chunk-EHB7J6SR.cjs.map
95
- //# sourceMappingURL=chunk-EHB7J6SR.cjs.map
94
+ //# sourceMappingURL=chunk-VJO66VVF.cjs.map
95
+ //# sourceMappingURL=chunk-VJO66VVF.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/ConnectedNativeDocxEditor.tsx"],"names":["jsx","NativeDocxEditor","useArbi","useConnection","useQueryClient","useQuery","useMemo","loadDocxFonts","arbiQueryKeys","notify"],"mappings":";;;;;;;;;AAYO,SAAS,yBAAA,CAA0B;AAAA,EACxC,WAAA,GAAc,oBAAA;AAAA,EACd,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOA,cAAA,CAACC,kCAAA,EAAA,EAAkB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AACxD;AAEO,SAAS,6BAAA,CAA8B,cAAc,oBAAA,EAAsB;AAChF,EAAA,MAAM,OAAOC,aAAA,EAAQ;AACrB,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,IAAA,EAAM,mBAAA,KAAwBC,+BAAA,EAAc;AACzE,EAAA,MAAM,UAAUC,yBAAA,EAAe;AAC/B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAQ,GAAIC,mBAAA,CAAS;AAAA,IACjC,UAAU,CAAC,qBAAA,EAAuB,MAAA,EAAQ,IAAA,EAAM,YAAY,WAAW,CAAA;AAAA,IACvE,OAAA,EAAS,IAAA,CAAK,UAAA,IAAc,CAAC,CAAC,WAAA;AAAA,IAC9B,SAAS,YAAY;AACnB,MAAA,MAAM,mBAAA,EAAoB;AAC1B,MAAA,OAAO,IAAA,CAAK,WAAW,SAAA,EAAU;AAAA,IACnC;AAAA,GACD,CAAA;AACD,EAAA,MAAM,OAAA,GAAUC,eAAA;AAAA,IACd,OAAO;AAAA,MACL,OAAA,EAAS,OAAO,IAAA,EAAM,OAAA,KAAY;AAChC,QAAA,MAAM,mBAAA,EAAoB;AAC1B,QAAA,OAAO,IAAA,CAAK,MAAA,CA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CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,QAAAA,YAAA,CAAO,QAAQ,oBAAoB,CAAA;AACnC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG;AAAA,KACvF,CAAA;AAAA,IACA,CAAC,MAAM,MAAA,EAAQ,IAAA,EAAM,MAAM,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,OAAA,EAAS,WAAW;AAAA,GAC5F;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-EHB7J6SR.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, notify, arbiQueryKeys } from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../docx/fonts'\n\n/** Native Word widget bound to the standard blocks connection and SDK session. */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: Omit<NativeDocxEditorProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxEditor {...props} adapter={adapter} />\n}\n\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, apiUrl, user, ensureWorkspaceOpen } = useConnection()\n const queries = useQueryClient()\n const { data: members } = useQuery({\n queryKey: ['native-docx-members', apiUrl, user?.externalId, workspaceId],\n enabled: arbi.isLoggedIn && !!workspaceId,\n queryFn: async () => {\n await ensureWorkspaceOpen()\n return arbi.workspaces.listUsers()\n },\n })\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: apiUrl,\n author: user?.name || 'You',\n onVersionSaved: async (id) => {\n if (!workspaceId) return\n const key = arbiQueryKeys.documents(workspaceId)\n try {\n const documents = await arbi.documents.get([id])\n if (!documents.length) throw new Error('The saved version is not available yet.')\n queries.setQueryData<Awaited<ReturnType<typeof arbi.documents.list>>>(key, (previous) => [\n ...documents,\n ...(previous || []).filter(\n (doc) => !documents.some((saved) => saved.external_id === doc.external_id)\n ),\n ])\n } catch {\n await queries.invalidateQueries({ queryKey: key })\n }\n },\n notify: (message, kind) => notify[kind](message),\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify.success('Mention delivered.')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n }),\n [arbi, apiUrl, user?.name, members, ensureWorkspaceOpen, fontBaseUrl, queries, workspaceId]\n )\n return adapter\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/ConnectedNativeDocxEditor.tsx"],"names":["jsx","NativeDocxEditor","useArbi","useConnection","useQueryClient","useQuery","useMemo","loadDocxFonts","arbiQueryKeys","notify"],"mappings":";;;;;;;;;AAYO,SAAS,yBAAA,CAA0B;AAAA,EACxC,WAAA,GAAc,oBAAA;AAAA,EACd,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOA,cAAA,CAACC,kCAAA,EAAA,EAAkB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AACxD;AAEO,SAAS,6BAAA,CAA8B,cAAc,oBAAA,EAAsB;AAChF,EAAA,MAAM,OAAOC,aAAA,EAAQ;AACrB,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,IAAA,EAAM,mBAAA,KAAwBC,+BAAA,EAAc;AACzE,EAAA,MAAM,UAAUC,yBAAA,EAAe;AAC/B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAQ,GAAIC,mBAAA,CAAS;AAAA,IACjC,UAAU,CAAC,qBAAA,EAAuB,MAAA,EAAQ,IAAA,EAAM,YAAY,WAAW,CAAA;AAAA,IACvE,OAAA,EAAS,IAAA,CAAK,UAAA,IAAc,CAAC,CAAC,WAAA;AAAA,IAC9B,SAAS,YAAY;AACnB,MAAA,MAAM,mBAAA,EAAoB;AAC1B,MAAA,OAAO,IAAA,CAAK,WAAW,SAAA,EAAU;AAAA,IACnC;AAAA,GACD,CAAA;AACD,EAAA,MAAM,OAAA,GAAUC,eAAA;AAAA,IACd,OAAO;AAAA,MACL,OAAA,EAAS,OAAO,IAAA,EAAM,OAAA,KAAY;AAChC,QAAA,MAAM,mBAAA,EAAoB;AAC1B,QAAA,OAAO,IAAA,CAAK,MAAA,CAAO,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA;AAAA,MAC1C,CAAA;AAAA,MACA,IAAA,EAAM,OAAO,EAAA,KA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tC,QAAAA,YAAA,CAAO,QAAQ,oBAAoB,CAAA;AACnC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG;AAAA,KACvF,CAAA;AAAA,IACA,CAAC,MAAM,MAAA,EAAQ,IAAA,EAAM,MAAM,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,OAAA,EAAS,WAAW;AAAA,GAC5F;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-VJO66VVF.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, notify, arbiQueryKeys } from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../docx/fonts'\n\n/** Native Word widget bound to the standard blocks connection and SDK session. */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: Omit<NativeDocxEditorProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxEditor {...props} adapter={adapter} />\n}\n\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, apiUrl, user, ensureWorkspaceOpen } = useConnection()\n const queries = useQueryClient()\n const { data: members } = useQuery({\n queryKey: ['native-docx-members', apiUrl, user?.externalId, workspaceId],\n enabled: arbi.isLoggedIn && !!workspaceId,\n queryFn: async () => {\n await ensureWorkspaceOpen()\n return arbi.workspaces.listUsers()\n },\n })\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: apiUrl,\n author: user?.name || 'You',\n onVersionSaved: async (id) => {\n if (!workspaceId) return\n const key = arbiQueryKeys.documents(workspaceId)\n try {\n const documents = await arbi.documents.get([id])\n if (!documents.length) throw new Error('The saved version is not available yet.')\n queries.setQueryData<Awaited<ReturnType<typeof arbi.documents.list>>>(key, (previous) => [\n ...documents,\n ...(previous || []).filter(\n (doc) => !documents.some((saved) => saved.external_id === doc.external_id)\n ),\n ])\n } catch {\n await queries.invalidateQueries({ queryKey: key })\n }\n },\n notify: (message, kind) => notify[kind](message),\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify.success('Mention delivered.')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n }),\n [arbi, apiUrl, user?.name, members, ensureWorkspaceOpen, fontBaseUrl, queries, workspaceId]\n )\n return adapter\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkEHB7J6SR_cjs = require('../chunk-EHB7J6SR.cjs');
4
+ var chunkVJO66VVF_cjs = require('../chunk-VJO66VVF.cjs');
5
5
  require('../chunk-MUMH3Z6K.cjs');
6
- var chunkGVOTXXZG_cjs = require('../chunk-GVOTXXZG.cjs');
7
- require('../chunk-HGJGALLN.cjs');
6
+ var chunkMUYZP5FB_cjs = require('../chunk-MUYZP5FB.cjs');
7
+ require('../chunk-MIMVRMKC.cjs');
8
8
  require('../chunk-AOFATOT3.cjs');
9
9
  require('../chunk-RC25WMVB.cjs');
10
10
  require('../chunk-7UTB4PHM.cjs');
@@ -16,13 +16,13 @@ function ConnectedStreamedWordArtifact({
16
16
  fontBaseUrl,
17
17
  ...props
18
18
  }) {
19
- const adapter = chunkEHB7J6SR_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
20
- return /* @__PURE__ */ jsxRuntime.jsx(chunkGVOTXXZG_cjs.StreamedWordArtifact, { ...props, adapter });
19
+ const adapter = chunkVJO66VVF_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
20
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkMUYZP5FB_cjs.StreamedWordArtifact, { ...props, adapter });
21
21
  }
22
22
 
23
23
  Object.defineProperty(exports, "ConnectedNativeDocxEditor", {
24
24
  enumerable: true,
25
- get: function () { return chunkEHB7J6SR_cjs.ConnectedNativeDocxEditor; }
25
+ get: function () { return chunkVJO66VVF_cjs.ConnectedNativeDocxEditor; }
26
26
  });
27
27
  exports.ConnectedStreamedWordArtifact = ConnectedStreamedWordArtifact;
28
28
  //# sourceMappingURL=docx.cjs.map
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { useConnectedNativeDocxAdapter } from '../chunk-YH6SSJDW.js';
3
- export { ConnectedNativeDocxEditor } from '../chunk-YH6SSJDW.js';
2
+ import { useConnectedNativeDocxAdapter } from '../chunk-LZ5AFAWC.js';
3
+ export { ConnectedNativeDocxEditor } from '../chunk-LZ5AFAWC.js';
4
4
  import '../chunk-OYMWV45N.js';
5
- import { StreamedWordArtifact } from '../chunk-RSUOOMPT.js';
6
- import '../chunk-QIEEFBZ5.js';
5
+ import { StreamedWordArtifact } from '../chunk-6B2AWE3I.js';
6
+ import '../chunk-FIEAWH4K.js';
7
7
  import '../chunk-D3QPYKZG.js';
8
8
  import '../chunk-AF6RDAJF.js';
9
9
  import '../chunk-AA3PT6KR.js';
@@ -3,10 +3,10 @@
3
3
 
4
4
  var chunk5YXG342J_cjs = require('../chunk-5YXG342J.cjs');
5
5
  var chunkXMBYDLZQ_cjs = require('../chunk-XMBYDLZQ.cjs');
6
- var chunkEHB7J6SR_cjs = require('../chunk-EHB7J6SR.cjs');
6
+ var chunkVJO66VVF_cjs = require('../chunk-VJO66VVF.cjs');
7
7
  var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
8
8
  var chunkJH6JTI76_cjs = require('../chunk-JH6JTI76.cjs');
9
- require('../chunk-HGJGALLN.cjs');
9
+ require('../chunk-MIMVRMKC.cjs');
10
10
  var chunkO4YPVYPO_cjs = require('../chunk-O4YPVYPO.cjs');
11
11
  var chunkLENXDIMY_cjs = require('../chunk-LENXDIMY.cjs');
12
12
  var chunkAOFATOT3_cjs = require('../chunk-AOFATOT3.cjs');
@@ -663,7 +663,7 @@ function WorkflowWordDialog({
663
663
  title: title ?? labels.wordTitle,
664
664
  size: "xl",
665
665
  testId: "workflow-word-dialog",
666
- children: /* @__PURE__ */ jsxRuntime.jsx(chunkULWRNGGE_cjs.ModalScaffold.Body, { className: "h-[70dvh] p-0", children: /* @__PURE__ */ jsxRuntime.jsx(chunkEHB7J6SR_cjs.ConnectedNativeDocxEditor, { documentId: id, title: title ?? labels.wordTitle }) })
666
+ children: /* @__PURE__ */ jsxRuntime.jsx(chunkULWRNGGE_cjs.ModalScaffold.Body, { className: "h-[70dvh] p-0", children: /* @__PURE__ */ jsxRuntime.jsx(chunkVJO66VVF_cjs.ConnectedNativeDocxEditor, { documentId: id, title: title ?? labels.wordTitle }) })
667
667
  }
668
668
  );
669
669
  }
@@ -2,11 +2,11 @@
2
2
  import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-W7NZRZ54.js';
3
3
  import { useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
4
4
  export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
5
- import { ConnectedNativeDocxEditor } from '../chunk-YH6SSJDW.js';
5
+ import { ConnectedNativeDocxEditor } from '../chunk-LZ5AFAWC.js';
6
6
  import { ConnectionProvider, useConnection } from '../chunk-OYMWV45N.js';
7
7
  export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-OYMWV45N.js';
8
8
  import { SignDocumentDialog } from '../chunk-2YOVK524.js';
9
- import '../chunk-QIEEFBZ5.js';
9
+ import '../chunk-FIEAWH4K.js';
10
10
  import { FilesFilterBar, FolderFilterButton, FolderPickerRow } from '../chunk-7RJTEWYM.js';
11
11
  import { WorkspaceActivityList, WorkspaceNotificationMenu, ThreadFollowMenuItem, ThreadFollowButton, TagTable, tagTableDocx } from '../chunk-Z3G65XHZ.js';
12
12
  import { DOCX_MIME_TYPE } from '../chunk-D3QPYKZG.js';
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { type FontConfiguration } from '@docx-editor.dev/react';
4
4
  import type { DocxCollaborationSession } from '@arbidocs/coedit';
5
5
  import type { DefinitionSource } from '../tags/definitions';
6
+ import { type HouseTemplateHost } from './template/HouseTemplate';
6
7
  /**
7
8
  * The editor path of a document's DOCX bytes. A version reference (`doc-…@v2`, a read-only
8
9
  * snapshot of an older version) reads that version; a plain id the current one.
@@ -44,6 +45,12 @@ export interface NativeDocxAdapter {
44
45
  * Defined term and Update definitions, and typing `@@` in the body opens the term type-ahead.
45
46
  */
46
47
  definitions?: () => Promise<DefinitionSource[]>;
48
+ /**
49
+ * The workspace's house template. Present: a blank note starts from it (its styles, numbering,
50
+ * page setup, headers and footers), Insert offers its Quick Parts, and the Design tab and the
51
+ * style box show where the document's styles differ from it.
52
+ */
53
+ houseTemplate?: HouseTemplateHost;
47
54
  }
48
55
  export interface NativeDocxEditorProps {
49
56
  adapter: NativeDocxAdapter;
@@ -5,8 +5,10 @@ import React from 'react';
5
5
  * press outside it. `children` may be a function that receives `close`, for panels that close
6
6
  * themselves once the user has picked something.
7
7
  */
8
- export declare function RibbonMenu({ label, icon, children, className, testId, }: {
8
+ export declare function RibbonMenu({ label, icon, children, className, testId, title, }: {
9
9
  label: string;
10
+ /** Tooltip; defaults to `label`. */
11
+ title?: string;
10
12
  /** Trigger content: an icon, or a short text label with a `className` that widens it. */
11
13
  icon: React.ReactNode;
12
14
  children: React.ReactNode | ((close: () => void) => React.ReactNode);
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkGVOTXXZG_cjs = require('../chunk-GVOTXXZG.cjs');
5
- var chunkHGJGALLN_cjs = require('../chunk-HGJGALLN.cjs');
4
+ var chunkMUYZP5FB_cjs = require('../chunk-MUYZP5FB.cjs');
5
+ var chunkMIMVRMKC_cjs = require('../chunk-MIMVRMKC.cjs');
6
6
  require('../chunk-AOFATOT3.cjs');
7
7
  require('../chunk-RC25WMVB.cjs');
8
8
  require('../chunk-7UTB4PHM.cjs');
@@ -60,7 +60,7 @@ function NativeDocxComparison({
60
60
  if (!documentId)
61
61
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "native-docx-error", role: "status", children: "Comparing Word documents\u2026" });
62
62
  return /* @__PURE__ */ jsxRuntime.jsx(
63
- chunkHGJGALLN_cjs.NativeDocxEditor,
63
+ chunkMIMVRMKC_cjs.NativeDocxEditor,
64
64
  {
65
65
  adapter,
66
66
  documentId,
@@ -72,87 +72,115 @@ function NativeDocxComparison({
72
72
 
73
73
  Object.defineProperty(exports, "StreamedWordArtifact", {
74
74
  enumerable: true,
75
- get: function () { return chunkGVOTXXZG_cjs.StreamedWordArtifact; }
75
+ get: function () { return chunkMUYZP5FB_cjs.StreamedWordArtifact; }
76
+ });
77
+ Object.defineProperty(exports, "BUILTIN_TEMPLATE_NAME", {
78
+ enumerable: true,
79
+ get: function () { return chunkMIMVRMKC_cjs.BUILTIN_TEMPLATE_NAME; }
76
80
  });
77
81
  Object.defineProperty(exports, "DEFAULT_DEFINED_TERMS_LABELS", {
78
82
  enumerable: true,
79
- get: function () { return chunkHGJGALLN_cjs.DEFAULT_DEFINED_TERMS_LABELS; }
83
+ get: function () { return chunkMIMVRMKC_cjs.DEFAULT_DEFINED_TERMS_LABELS; }
80
84
  });
81
85
  Object.defineProperty(exports, "DEFINED_TERM_TRIGGER", {
82
86
  enumerable: true,
83
- get: function () { return chunkHGJGALLN_cjs.DEFINED_TERM_TRIGGER; }
87
+ get: function () { return chunkMIMVRMKC_cjs.DEFINED_TERM_TRIGGER; }
84
88
  });
85
89
  Object.defineProperty(exports, "DefinedTermsProvider", {
86
90
  enumerable: true,
87
- get: function () { return chunkHGJGALLN_cjs.DefinedTermsProvider; }
91
+ get: function () { return chunkMIMVRMKC_cjs.DefinedTermsProvider; }
88
92
  });
89
93
  Object.defineProperty(exports, "DocxCommentActivity", {
90
94
  enumerable: true,
91
- get: function () { return chunkHGJGALLN_cjs.DocxCommentActivity; }
95
+ get: function () { return chunkMIMVRMKC_cjs.DocxCommentActivity; }
92
96
  });
93
97
  Object.defineProperty(exports, "DocxEditorReview", {
94
98
  enumerable: true,
95
- get: function () { return chunkHGJGALLN_cjs.DocxEditorReview; }
99
+ get: function () { return chunkMIMVRMKC_cjs.DocxEditorReview; }
96
100
  });
97
101
  Object.defineProperty(exports, "DocxMentions", {
98
102
  enumerable: true,
99
- get: function () { return chunkHGJGALLN_cjs.DocxMentions; }
103
+ get: function () { return chunkMIMVRMKC_cjs.DocxMentions; }
100
104
  });
101
105
  Object.defineProperty(exports, "DocxParticipants", {
102
106
  enumerable: true,
103
- get: function () { return chunkHGJGALLN_cjs.DocxParticipants; }
107
+ get: function () { return chunkMIMVRMKC_cjs.DocxParticipants; }
104
108
  });
105
109
  Object.defineProperty(exports, "DocxRibbon", {
106
110
  enumerable: true,
107
- get: function () { return chunkHGJGALLN_cjs.DocxRibbon; }
111
+ get: function () { return chunkMIMVRMKC_cjs.DocxRibbon; }
112
+ });
113
+ Object.defineProperty(exports, "HouseTemplateProvider", {
114
+ enumerable: true,
115
+ get: function () { return chunkMIMVRMKC_cjs.HouseTemplateProvider; }
108
116
  });
109
117
  Object.defineProperty(exports, "NativeDocxEditor", {
110
118
  enumerable: true,
111
- get: function () { return chunkHGJGALLN_cjs.NativeDocxEditor; }
119
+ get: function () { return chunkMIMVRMKC_cjs.NativeDocxEditor; }
120
+ });
121
+ Object.defineProperty(exports, "builtinHouseTemplate", {
122
+ enumerable: true,
123
+ get: function () { return chunkMIMVRMKC_cjs.builtinHouseTemplate; }
124
+ });
125
+ Object.defineProperty(exports, "contentPath", {
126
+ enumerable: true,
127
+ get: function () { return chunkMIMVRMKC_cjs.contentPath; }
112
128
  });
113
129
  Object.defineProperty(exports, "editorPort", {
114
130
  enumerable: true,
115
- get: function () { return chunkHGJGALLN_cjs.editorPort; }
131
+ get: function () { return chunkMIMVRMKC_cjs.editorPort; }
116
132
  });
117
133
  Object.defineProperty(exports, "findDefinitionsSection", {
118
134
  enumerable: true,
119
- get: function () { return chunkHGJGALLN_cjs.findDefinitionsSection; }
135
+ get: function () { return chunkMIMVRMKC_cjs.findDefinitionsSection; }
120
136
  });
121
137
  Object.defineProperty(exports, "insertDefinedTerm", {
122
138
  enumerable: true,
123
- get: function () { return chunkHGJGALLN_cjs.insertDefinedTerm; }
139
+ get: function () { return chunkMIMVRMKC_cjs.insertDefinedTerm; }
124
140
  });
125
141
  Object.defineProperty(exports, "loadDocxFonts", {
126
142
  enumerable: true,
127
- get: function () { return chunkHGJGALLN_cjs.loadDocxFonts; }
143
+ get: function () { return chunkMIMVRMKC_cjs.loadDocxFonts; }
128
144
  });
129
145
  Object.defineProperty(exports, "normalizeDocxExport", {
130
146
  enumerable: true,
131
- get: function () { return chunkHGJGALLN_cjs.normalizeDocxExport; }
147
+ get: function () { return chunkMIMVRMKC_cjs.normalizeDocxExport; }
148
+ });
149
+ Object.defineProperty(exports, "resolveHouseTemplate", {
150
+ enumerable: true,
151
+ get: function () { return chunkMIMVRMKC_cjs.resolveHouseTemplate; }
132
152
  });
133
153
  Object.defineProperty(exports, "reviewModule", {
134
154
  enumerable: true,
135
- get: function () { return chunkHGJGALLN_cjs.reviewModule; }
155
+ get: function () { return chunkMIMVRMKC_cjs.reviewModule; }
156
+ });
157
+ Object.defineProperty(exports, "templateFileName", {
158
+ enumerable: true,
159
+ get: function () { return chunkMIMVRMKC_cjs.templateFileName; }
136
160
  });
137
161
  Object.defineProperty(exports, "updateDefinitions", {
138
162
  enumerable: true,
139
- get: function () { return chunkHGJGALLN_cjs.updateDefinitions; }
163
+ get: function () { return chunkMIMVRMKC_cjs.updateDefinitions; }
140
164
  });
141
165
  Object.defineProperty(exports, "useDefinedTerms", {
142
166
  enumerable: true,
143
- get: function () { return chunkHGJGALLN_cjs.useDefinedTerms; }
167
+ get: function () { return chunkMIMVRMKC_cjs.useDefinedTerms; }
168
+ });
169
+ Object.defineProperty(exports, "useHouseTemplate", {
170
+ enumerable: true,
171
+ get: function () { return chunkMIMVRMKC_cjs.useHouseTemplate; }
144
172
  });
145
173
  Object.defineProperty(exports, "useReview", {
146
174
  enumerable: true,
147
- get: function () { return chunkHGJGALLN_cjs.useReview; }
175
+ get: function () { return chunkMIMVRMKC_cjs.useReview; }
148
176
  });
149
177
  Object.defineProperty(exports, "useReviewItem", {
150
178
  enumerable: true,
151
- get: function () { return chunkHGJGALLN_cjs.useReviewItem; }
179
+ get: function () { return chunkMIMVRMKC_cjs.useReviewItem; }
152
180
  });
153
181
  Object.defineProperty(exports, "withDirectEditing", {
154
182
  enumerable: true,
155
- get: function () { return chunkHGJGALLN_cjs.withDirectEditing; }
183
+ get: function () { return chunkMIMVRMKC_cjs.withDirectEditing; }
156
184
  });
157
185
  Object.defineProperty(exports, "DocxEditor", {
158
186
  enumerable: true,
@@ -12,3 +12,5 @@ export { NativeDocxComparison, type NativeDocxComparisonProps } from './NativeDo
12
12
  export { DefinedTermsProvider, useDefinedTerms, DEFINED_TERM_TRIGGER, DEFAULT_DEFINED_TERMS_LABELS, type DefinedTermsProviderProps, type DefinedTermsLabels, } from './definitions/DefinedTerms';
13
13
  export { insertDefinedTerm, updateDefinitions, findDefinitionsSection, type UpdateDefinitionsResult, } from './definitions/commands';
14
14
  export { editorPort, withDirectEditing, type DefinitionsPort } from './definitions/port';
15
+ export { contentPath } from './NativeDocxEditor';
16
+ export { HouseTemplateProvider, useHouseTemplate, builtinHouseTemplate, resolveHouseTemplate, templateFileName, BUILTIN_TEMPLATE_NAME, type HouseTemplate, type HouseTemplateHost, type HouseTemplateSource, } from './template/HouseTemplate';
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- export { StreamedWordArtifact } from '../chunk-RSUOOMPT.js';
3
- import { NativeDocxEditor } from '../chunk-QIEEFBZ5.js';
4
- export { DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, NativeDocxEditor, editorPort, findDefinitionsSection, insertDefinedTerm, loadDocxFonts, normalizeDocxExport, reviewModule, updateDefinitions, useDefinedTerms, useReview, useReviewItem, withDirectEditing } from '../chunk-QIEEFBZ5.js';
2
+ export { StreamedWordArtifact } from '../chunk-6B2AWE3I.js';
3
+ import { NativeDocxEditor } from '../chunk-FIEAWH4K.js';
4
+ export { BUILTIN_TEMPLATE_NAME, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, HouseTemplateProvider, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, findDefinitionsSection, insertDefinedTerm, loadDocxFonts, normalizeDocxExport, resolveHouseTemplate, reviewModule, templateFileName, updateDefinitions, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, withDirectEditing } from '../chunk-FIEAWH4K.js';
5
5
  import '../chunk-D3QPYKZG.js';
6
6
  import '../chunk-AF6RDAJF.js';
7
7
  import '../chunk-AA3PT6KR.js';
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The house template inside the Word editor: which template applies (the workspace's, else the
3
+ * deployment's, else ARBI's built-in legal template), its Quick Parts, and where this document's
4
+ * styles have drifted from it. Mount `HouseTemplateProvider` inside `DocxEditor.Root`; the ribbon's
5
+ * Quick Parts, Design tab and the style box read it from context.
6
+ */
7
+ import React from 'react';
8
+ import { type LinkedLevel, type BuildingBlockInfo, type StyleDivergence } from '@arbidocs/coedit/template';
9
+ export type HouseTemplateSource = 'workspace' | 'deployment' | 'builtin';
10
+ export interface HouseTemplate {
11
+ /** The .dotx/.docx bytes. */
12
+ bytes: Uint8Array;
13
+ /** What to call it: its filename, or "ARBI legal template". */
14
+ name: string;
15
+ source: HouseTemplateSource;
16
+ /** The workspace document it is, when it is one. */
17
+ documentId?: string;
18
+ }
19
+ /** How the host stores and resolves house templates. */
20
+ export interface HouseTemplateHost {
21
+ /** The template that applies in this workspace. Falls back to the built-in one when it fails. */
22
+ load: () => Promise<HouseTemplate>;
23
+ /**
24
+ * Make a workspace document the workspace's house template. Present only when the user may
25
+ * (a workspace owner) and the server stores house templates.
26
+ */
27
+ setFromDocument?: (documentId: string) => Promise<void>;
28
+ }
29
+ export declare const BUILTIN_TEMPLATE_NAME = "ARBI legal template";
30
+ /** The file name a document records as its attached template (`w:attachedTemplate`). */
31
+ export declare const templateFileName: (t: Pick<HouseTemplate, "name">) => string;
32
+ /** ARBI's built-in UK legal template, with its Quick Parts. */
33
+ export declare function builtinHouseTemplate(): HouseTemplate;
34
+ /** The template a host resolves, or the built-in one when there is no host or it fails. */
35
+ export declare function resolveHouseTemplate(host?: HouseTemplateHost): Promise<HouseTemplate>;
36
+ interface HouseTemplateContextValue {
37
+ template: HouseTemplate;
38
+ blocks: readonly BuildingBlockInfo[];
39
+ /** Null until measured (or for a document that cannot be read). */
40
+ divergence: StyleDivergence | null;
41
+ /** The document was started from this template (it records it as attached). */
42
+ basedOnTemplate: boolean;
43
+ /** Outline levels linked to styles in this document (Level 1 → Level 2 …), by style id. */
44
+ levels: Readonly<Record<string, LinkedLevel>>;
45
+ /** Insert a Quick Part at the caret, with the styles, numbering and pictures it uses. */
46
+ insertBlock: (name: string) => boolean;
47
+ /** Measure the divergence again (after something brought styles in). */
48
+ refresh: () => void;
49
+ /** Present when this document may become the workspace's house template. */
50
+ setAsHouseTemplate?: () => Promise<void>;
51
+ editable: boolean;
52
+ }
53
+ export declare const useHouseTemplate: () => HouseTemplateContextValue | null;
54
+ export declare function HouseTemplateProvider({ host, documentId, editable, notify, enabled, children, }: {
55
+ /** False for a generating draft: no template chrome, no measuring. */
56
+ enabled?: boolean;
57
+ host?: HouseTemplateHost;
58
+ /** The stored document this editor shows; absent for an unsaved note. */
59
+ documentId?: string;
60
+ editable: boolean;
61
+ notify?: (message: string, kind: 'success' | 'error') => void;
62
+ children: React.ReactNode;
63
+ }): React.JSX.Element;
64
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Design › House template: which template new documents start from, whether this document's
3
+ * styles still match it, and — for a workspace owner — making this document the house template.
4
+ */
5
+ import React from 'react';
6
+ export declare function HouseTemplatePanel(): React.JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Insert › Quick Parts: the house template's building blocks (execution blocks, document markings,
3
+ * document skeletons) by category, each with a preview of its text; picking one inserts it at the
4
+ * caret with the styles, numbering and pictures it uses.
5
+ */
6
+ import React from 'react';
7
+ export declare function QuickParts(): React.JSX.Element | null;
@@ -4,6 +4,7 @@
4
4
  * styles and notes.
5
5
  */
6
6
  import type { ParagraphStyleOption } from '@docx-editor.dev/react';
7
+ import type { StyleDivergence } from '@arbidocs/coedit/template';
7
8
  /** Word's quick picks, by the built-in style names `styles.xml` gives them. */
8
9
  export declare const QUICK_STYLES: readonly ["Normal", "Title", "heading 1", "heading 2", "heading 3"];
9
10
  /**
@@ -19,3 +20,5 @@ export declare function styleLabel(name: string): string;
19
20
  * Ctrl+Shift+N; read from `code` so a keyboard layout cannot move them.
20
21
  */
21
22
  export declare function wordShortcut(event: Pick<KeyboardEvent, 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'code'>): 'footnote' | 'endnote' | 'heading 1' | 'heading 2' | 'heading 3' | 'Normal' | null;
23
+ /** A summary of how the document differs, for a tooltip; null when it matches. */
24
+ export declare function divergenceSummary(divergence: StyleDivergence | null): string | null;
package/dist/index.cjs CHANGED
@@ -10,8 +10,8 @@ var chunkMJCCBMM5_cjs = require('./chunk-MJCCBMM5.cjs');
10
10
  var chunkELR74ME6_cjs = require('./chunk-ELR74ME6.cjs');
11
11
  var chunkXAJIKT6Y_cjs = require('./chunk-XAJIKT6Y.cjs');
12
12
  var chunkLENXDIMY_cjs = require('./chunk-LENXDIMY.cjs');
13
- var chunkAOFATOT3_cjs = require('./chunk-AOFATOT3.cjs');
14
13
  var chunkD54JXTPG_cjs = require('./chunk-D54JXTPG.cjs');
14
+ var chunkAOFATOT3_cjs = require('./chunk-AOFATOT3.cjs');
15
15
  var chunkOUW6G4O2_cjs = require('./chunk-OUW6G4O2.cjs');
16
16
  var chunkVPPX5XUF_cjs = require('./chunk-VPPX5XUF.cjs');
17
17
  require('./chunk-RC25WMVB.cjs');
@@ -1514,6 +1514,46 @@ Object.defineProperty(exports, "workspaceActivityTarget", {
1514
1514
  enumerable: true,
1515
1515
  get: function () { return chunkLENXDIMY_cjs.workspaceActivityTarget; }
1516
1516
  });
1517
+ Object.defineProperty(exports, "DEFAULT_DETAIL_PANEL_LABELS", {
1518
+ enumerable: true,
1519
+ get: function () { return chunkD54JXTPG_cjs.DEFAULT_DETAIL_PANEL_LABELS; }
1520
+ });
1521
+ Object.defineProperty(exports, "DetailBody", {
1522
+ enumerable: true,
1523
+ get: function () { return chunkD54JXTPG_cjs.DetailBody; }
1524
+ });
1525
+ Object.defineProperty(exports, "DetailEmpty", {
1526
+ enumerable: true,
1527
+ get: function () { return chunkD54JXTPG_cjs.DetailEmpty; }
1528
+ });
1529
+ Object.defineProperty(exports, "DetailField", {
1530
+ enumerable: true,
1531
+ get: function () { return chunkD54JXTPG_cjs.DetailField; }
1532
+ });
1533
+ Object.defineProperty(exports, "DetailFields", {
1534
+ enumerable: true,
1535
+ get: function () { return chunkD54JXTPG_cjs.DetailFields; }
1536
+ });
1537
+ Object.defineProperty(exports, "DetailLinkItem", {
1538
+ enumerable: true,
1539
+ get: function () { return chunkD54JXTPG_cjs.DetailLinkItem; }
1540
+ });
1541
+ Object.defineProperty(exports, "DetailLinkList", {
1542
+ enumerable: true,
1543
+ get: function () { return chunkD54JXTPG_cjs.DetailLinkList; }
1544
+ });
1545
+ Object.defineProperty(exports, "DetailLoading", {
1546
+ enumerable: true,
1547
+ get: function () { return chunkD54JXTPG_cjs.DetailLoading; }
1548
+ });
1549
+ Object.defineProperty(exports, "DetailPanel", {
1550
+ enumerable: true,
1551
+ get: function () { return chunkD54JXTPG_cjs.DetailPanel; }
1552
+ });
1553
+ Object.defineProperty(exports, "DetailSection", {
1554
+ enumerable: true,
1555
+ get: function () { return chunkD54JXTPG_cjs.DetailSection; }
1556
+ });
1517
1557
  Object.defineProperty(exports, "DEFINITIONS_LABEL", {
1518
1558
  enumerable: true,
1519
1559
  get: function () { return chunkAOFATOT3_cjs.DEFINITIONS_LABEL; }
@@ -1562,46 +1602,6 @@ Object.defineProperty(exports, "toDefinition", {
1562
1602
  enumerable: true,
1563
1603
  get: function () { return chunkAOFATOT3_cjs.toDefinition; }
1564
1604
  });
1565
- Object.defineProperty(exports, "DEFAULT_DETAIL_PANEL_LABELS", {
1566
- enumerable: true,
1567
- get: function () { return chunkD54JXTPG_cjs.DEFAULT_DETAIL_PANEL_LABELS; }
1568
- });
1569
- Object.defineProperty(exports, "DetailBody", {
1570
- enumerable: true,
1571
- get: function () { return chunkD54JXTPG_cjs.DetailBody; }
1572
- });
1573
- Object.defineProperty(exports, "DetailEmpty", {
1574
- enumerable: true,
1575
- get: function () { return chunkD54JXTPG_cjs.DetailEmpty; }
1576
- });
1577
- Object.defineProperty(exports, "DetailField", {
1578
- enumerable: true,
1579
- get: function () { return chunkD54JXTPG_cjs.DetailField; }
1580
- });
1581
- Object.defineProperty(exports, "DetailFields", {
1582
- enumerable: true,
1583
- get: function () { return chunkD54JXTPG_cjs.DetailFields; }
1584
- });
1585
- Object.defineProperty(exports, "DetailLinkItem", {
1586
- enumerable: true,
1587
- get: function () { return chunkD54JXTPG_cjs.DetailLinkItem; }
1588
- });
1589
- Object.defineProperty(exports, "DetailLinkList", {
1590
- enumerable: true,
1591
- get: function () { return chunkD54JXTPG_cjs.DetailLinkList; }
1592
- });
1593
- Object.defineProperty(exports, "DetailLoading", {
1594
- enumerable: true,
1595
- get: function () { return chunkD54JXTPG_cjs.DetailLoading; }
1596
- });
1597
- Object.defineProperty(exports, "DetailPanel", {
1598
- enumerable: true,
1599
- get: function () { return chunkD54JXTPG_cjs.DetailPanel; }
1600
- });
1601
- Object.defineProperty(exports, "DetailSection", {
1602
- enumerable: true,
1603
- get: function () { return chunkD54JXTPG_cjs.DetailSection; }
1604
- });
1605
1605
  Object.defineProperty(exports, "DEFAULT_SEARCH_HIT_LABELS", {
1606
1606
  enumerable: true,
1607
1607
  get: function () { return chunkOUW6G4O2_cjs.DEFAULT_SEARCH_HIT_LABELS; }
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ export { Timeline } from './chunk-OVEQERPO.js';
9
9
  export { MemberAvatarStack } from './chunk-XNOASBGW.js';
10
10
  import { DEFAULT_TAG_TABLE_LABELS, rowLinks, TagTableCell } from './chunk-Z3G65XHZ.js';
11
11
  export { DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DEFAULT_THREAD_FOLLOW_LABELS, DEFAULT_WORKSPACE_ACTIVITY_LABELS, DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagTable, TagTableCell, ThreadFollowButton, ThreadFollowMenuItem, WorkspaceActivityList, WorkspaceNotificationMenu, cellText, cellValue, fieldWrites, isGap, parseCell, rowLinks, tagTableDocumentXml, tagTableDocx, tagTableMarkdown, workspaceActivityHeadline, workspaceActivityTarget } from './chunk-Z3G65XHZ.js';
12
- import { groupDefinitions, compareDefinitions, minuteUtc, page, cell, documentXml, paragraph, docxPackage, TABLE_DOCUMENT_STYLES } from './chunk-D3QPYKZG.js';
13
- export { DEFINITIONS_LABEL, DEFINITION_BOOKMARK_PREFIX, compareDefinitions, compareTerms, definitionBookmark, definitionIdOfBookmark, definitionLabels, filterTermGroups, groupDefinitions, parseDefinition, termKey, toDefinition } from './chunk-D3QPYKZG.js';
14
12
  import { DetailLoading, DetailBody, DetailSection, DetailFields, DetailField, DetailLinkList, DetailLinkItem, DetailEmpty } from './chunk-ZCOVDK2E.js';
15
13
  export { DEFAULT_DETAIL_PANEL_LABELS, DetailBody, DetailEmpty, DetailField, DetailFields, DetailLinkItem, DetailLinkList, DetailLoading, DetailPanel, DetailSection } from './chunk-ZCOVDK2E.js';
14
+ import { groupDefinitions, compareDefinitions, minuteUtc, page, cell, documentXml, paragraph, docxPackage, TABLE_DOCUMENT_STYLES } from './chunk-D3QPYKZG.js';
15
+ export { DEFINITIONS_LABEL, DEFINITION_BOOKMARK_PREFIX, compareDefinitions, compareTerms, definitionBookmark, definitionIdOfBookmark, definitionLabels, filterTermGroups, groupDefinitions, parseDefinition, termKey, toDefinition } from './chunk-D3QPYKZG.js';
16
16
  export { DEFAULT_SEARCH_HIT_LABELS, SearchHit } from './chunk-A2YAC22G.js';
17
17
  export { TIMELINE_ZOOM, TimelineCalendar, TimelineGantt, TimelineZoomControl, dayKey, formatSpan, monthLabel, parseIso, utcDay } from './chunk-4EZVCGRL.js';
18
18
  import './chunk-AF6RDAJF.js';