@sanity/agent-directives 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -58
- package/dist/formatters.d.ts +1 -1
- package/dist/formatters.d.ts.map +1 -1
- package/dist/formatters.js +1 -1
- package/dist/formatters.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +22 -44
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +25 -97
- package/dist/react.js.map +1 -1
- package/dist/schemas.d.ts +118 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +35 -0
- package/dist/schemas.js.map +1 -0
- package/dist/string.d.ts +2 -2
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +1 -1
- package/dist/string.js.map +1 -1
- package/package.json +1 -3
package/README.md
CHANGED
|
@@ -8,56 +8,53 @@ Shared directive system for Sanity Agent.
|
|
|
8
8
|
pnpm add @sanity/agent-directives
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## React Usage
|
|
11
|
+
## React Usage
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
//
|
|
14
|
+
// kit.ts
|
|
15
15
|
import { createDirectiveKit } from "@sanity/agent-directives/react";
|
|
16
|
-
import { useThreadApplication } from "../hooks/useThreadResource";
|
|
17
16
|
|
|
18
17
|
export const { defineDirective } = createDirectiveKit({
|
|
19
18
|
useApplication: useThreadApplication,
|
|
20
19
|
});
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
// directives/Document.tsx
|
|
25
|
-
import { defineDirective } from "./kit";
|
|
26
20
|
|
|
21
|
+
// Document.tsx
|
|
27
22
|
export const Document = defineDirective("document", ({ id, application }) => {
|
|
28
|
-
|
|
29
|
-
return <DocumentCard document={doc} />;
|
|
23
|
+
return <DocumentCard id={id} application={application} />;
|
|
30
24
|
});
|
|
31
|
-
```
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
// AgentMessage.tsx
|
|
27
|
+
import { remarkAgentDirectives } from "@sanity/agent-directives/react";
|
|
28
|
+
import ReactMarkdown from "react-markdown";
|
|
29
|
+
|
|
30
|
+
function AgentMessage({ content }: { content: string }) {
|
|
31
|
+
return (
|
|
32
|
+
<ReactMarkdown
|
|
33
|
+
remarkPlugins={[remarkAgentDirectives]}
|
|
34
|
+
components={{
|
|
35
|
+
Document: DocumentDirective,
|
|
36
|
+
Release: ReleaseDirective,
|
|
37
|
+
// ...
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{content}
|
|
41
|
+
</ReactMarkdown>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
34
45
|
|
|
35
|
-
## String Usage (
|
|
46
|
+
## String Usage (Server-side)
|
|
36
47
|
|
|
37
48
|
```ts
|
|
38
|
-
//
|
|
49
|
+
// kit.ts
|
|
39
50
|
import { createDirectiveKit } from "@sanity/agent-directives/string";
|
|
40
51
|
|
|
41
|
-
interface SlackContext {
|
|
42
|
-
accessToken: string;
|
|
43
|
-
applications: Application[];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
interface SlackOutput {
|
|
47
|
-
text?: string;
|
|
48
|
-
blocks?: SlackBlock[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
52
|
export const { defineDirective, renderDirective } = createDirectiveKit<
|
|
52
53
|
SlackContext,
|
|
53
54
|
SlackOutput
|
|
54
55
|
>();
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
// directives/document.ts
|
|
59
|
-
import { defineDirective } from "./kit";
|
|
60
56
|
|
|
57
|
+
// document.ts
|
|
61
58
|
export const Document = defineDirective(
|
|
62
59
|
"document",
|
|
63
60
|
async ({ id, _context }) => {
|
|
@@ -67,43 +64,34 @@ export const Document = defineDirective(
|
|
|
67
64
|
);
|
|
68
65
|
```
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
// Render directives from remark AST
|
|
72
|
-
import { renderDirective } from "./kit";
|
|
73
|
-
|
|
74
|
-
const output = await renderDirective(node, context);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Formatters (Agent Backend)
|
|
67
|
+
## Formatters
|
|
78
68
|
|
|
79
69
|
```ts
|
|
80
|
-
import {
|
|
81
|
-
createDocumentDirective,
|
|
82
|
-
createChangesDirective,
|
|
83
|
-
} from "@sanity/agent-directives/formatters";
|
|
70
|
+
import { createDocumentDirective } from "@sanity/agent-directives/formatters";
|
|
84
71
|
|
|
85
72
|
createDocumentDirective({ id: "doc-123", type: "article" });
|
|
86
73
|
// => '::document{id="doc-123" type="article"}'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Adding a New Directive
|
|
87
77
|
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
1. Add the schema in `src/schemas.ts`:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
export const MyDirectiveSchema = z.object({
|
|
82
|
+
id: z.string(),
|
|
83
|
+
// ... props
|
|
84
|
+
});
|
|
90
85
|
```
|
|
91
86
|
|
|
92
|
-
|
|
87
|
+
2. Add to `DirectiveSchemas`, `DIRECTIVE_NAMES`, and `DirectivePropsMap` in the same file
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
| ---------- | ------------------------------ |
|
|
96
|
-
| `document` | `id`, `type?`, `source?` |
|
|
97
|
-
| `release` | `id`, `source?` |
|
|
98
|
-
| `resource` | `source` |
|
|
99
|
-
| `set` | `id` |
|
|
100
|
-
| `changes` | `createdCount`, `updatedCount` |
|
|
89
|
+
3. Add a formatter helper in `src/formatters.ts` (optional):
|
|
101
90
|
|
|
102
|
-
|
|
91
|
+
```ts
|
|
92
|
+
export function createMyDirective(props: MyDirectiveProps): string {
|
|
93
|
+
return formatDirective(DIRECTIVE_NAMES.my, props);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
103
96
|
|
|
104
|
-
|
|
105
|
-
| ------------------------------------- | ------------------------------------ |
|
|
106
|
-
| `@sanity/agent-directives` | Schemas and formatters |
|
|
107
|
-
| `@sanity/agent-directives/react` | `createDirectiveKit` for React |
|
|
108
|
-
| `@sanity/agent-directives/string` | `createDirectiveKit` for server-side |
|
|
109
|
-
| `@sanity/agent-directives/formatters` | Directive string formatters |
|
|
97
|
+
4. Consumers define their render function using `defineDirective('my', ...)`
|
package/dist/formatters.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChangesDirectiveProps, type DirectiveName, type DocumentDirectiveProps, type ReleaseDirectiveProps, type ResourceDirectiveProps, type SetDirectiveProps } from '
|
|
1
|
+
import { type ChangesDirectiveProps, type DirectiveName, type DocumentDirectiveProps, type ReleaseDirectiveProps, type ResourceDirectiveProps, type SetDirectiveProps } from './schemas.js';
|
|
2
2
|
export declare function formatDirective(name: DirectiveName, props: Record<string, unknown>): string;
|
|
3
3
|
export declare function createDocumentDirective(props: DocumentDirectiveProps): string;
|
|
4
4
|
export declare function createReleaseDirective(props: ReleaseDirectiveProps): string;
|
package/dist/formatters.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAA;AASrB,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAG3F;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAE7E;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAE3E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAE7E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAEnE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAE3E"}
|
package/dist/formatters.js
CHANGED
package/dist/formatters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAMhB,MAAM,
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAMhB,MAAM,cAAc,CAAA;AAErB,SAAS,eAAe,CAAC,MAA+B;IACtD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;SAC5D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,KAAK,GAAG,CAAC;SAC1C,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAmB,EAAE,KAA8B;IACjF,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAA6B;IACnE,OAAO,eAAe,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAA4B;IACjE,OAAO,eAAe,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,KAA6B;IACnE,OAAO,eAAe,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AACzD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAwB;IACzD,OAAO,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAA4B;IACjE,OAAO,eAAe,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AACxD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { type ChangesDirectiveProps, ChangesDirectiveSchema, DIRECTIVE_NAMES, type DirectiveName, DirectiveSchemas, type DocumentDirectiveProps, DocumentDirectiveSchema, type ReleaseDirectiveProps, ReleaseDirectiveSchema, type ResourceDirectiveProps, ResourceDirectiveSchema, type SetDirectiveProps, SetDirectiveSchema, } from '@sanity/agent-types';
|
|
2
1
|
export { createChangesDirective, createDocumentDirective, createReleaseDirective, createResourceDirective, createSetDirective, formatDirective, } from './formatters.js';
|
|
2
|
+
export { type ChangesDirectiveProps, ChangesDirectiveSchema, DIRECTIVE_NAMES, type DirectiveName, type DirectivePropsMap, DirectiveSchemas, type DocumentDirectiveProps, DocumentDirectiveSchema, type ReleaseDirectiveProps, ReleaseDirectiveSchema, type ResourceDirectiveProps, ResourceDirectiveSchema, type SetDirectiveProps, SetDirectiveSchema, } from './schemas.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,eAAe,EACf,KAAK,aAAa,EAClB,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,kBAAkB,GACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,GAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,kBAAkB,GACnB,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ChangesDirectiveSchema, DIRECTIVE_NAMES, DirectiveSchemas, DocumentDirectiveSchema, ReleaseDirectiveSchema, ResourceDirectiveSchema, SetDirectiveSchema, } from '@sanity/agent-types';
|
|
2
1
|
export { createChangesDirective, createDocumentDirective, createReleaseDirective, createResourceDirective, createSetDirective, formatDirective, } from './formatters.js';
|
|
2
|
+
export { ChangesDirectiveSchema, DIRECTIVE_NAMES, DirectiveSchemas, DocumentDirectiveSchema, ReleaseDirectiveSchema, ResourceDirectiveSchema, SetDirectiveSchema, } from './schemas.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,GAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAEL,sBAAsB,EACtB,eAAe,EAGf,gBAAgB,EAEhB,uBAAuB,EAEvB,sBAAsB,EAEtB,uBAAuB,EAEvB,kBAAkB,GACnB,MAAM,cAAc,CAAA"}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type ComponentType, type ReactNode } from 'react';
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
3
2
|
import type { Processor } from 'unified';
|
|
4
3
|
import type { Node } from 'unist';
|
|
4
|
+
import { type DirectiveName, type DirectivePropsMap } from './schemas.js';
|
|
5
5
|
type DirectiveProps<T extends DirectiveName> = DirectivePropsMap[T];
|
|
6
6
|
export interface NodeProps {
|
|
7
7
|
node?: {
|
|
8
8
|
properties?: Record<string, unknown>;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export type DirectiveRenderProps<TName extends DirectiveName, TApplication> = DirectiveProps<TName> & {
|
|
11
|
+
export type DirectiveRenderProps<TName extends DirectiveName, TApplication = undefined, TRequiresApplication extends boolean = true> = DirectiveProps<TName> & (TRequiresApplication extends true ? TApplication extends undefined ? {} : {
|
|
12
12
|
application: TApplication;
|
|
13
|
-
};
|
|
13
|
+
} : {});
|
|
14
|
+
export interface DefineDirectiveOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Whether this directive requires application context.
|
|
17
|
+
* If true (default), the directive will not render if application is unavailable.
|
|
18
|
+
* If false, the directive renders without application injection.
|
|
19
|
+
*/
|
|
20
|
+
requiresApplication?: boolean;
|
|
21
|
+
}
|
|
14
22
|
export type DirectiveComponentProps<TName extends DirectiveName> = DirectiveProps<TName> & {
|
|
15
23
|
source?: string;
|
|
16
24
|
} & NodeProps;
|
|
17
|
-
export declare function remarkAgentDirectives(this: Processor): (tree: Node) => void;
|
|
18
|
-
interface DirectivesStackProps {
|
|
19
|
-
children?: ReactNode;
|
|
20
|
-
}
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
26
|
+
* Remark plugin for agent directive support.
|
|
27
|
+
* Parses and transforms directive syntax into React components.
|
|
24
28
|
*
|
|
25
29
|
* @example
|
|
26
30
|
* ```tsx
|
|
27
|
-
* import {
|
|
28
|
-
*
|
|
29
|
-
* // Use default
|
|
30
|
-
* components={{ DirectivesStack }}
|
|
31
|
+
* import { remarkAgentDirectives } from '@sanity/agent-directives/react'
|
|
31
32
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
33
|
+
* <ReactMarkdown remarkPlugins={[remarkAgentDirectives]}>
|
|
34
|
+
* {content}
|
|
35
|
+
* </ReactMarkdown>
|
|
34
36
|
* ```
|
|
35
37
|
*/
|
|
36
|
-
export declare function
|
|
38
|
+
export declare function remarkAgentDirectives(this: Processor): (tree: Node) => void;
|
|
37
39
|
export interface DirectiveKitOptions<TApplication> {
|
|
38
|
-
useApplication
|
|
40
|
+
useApplication?: (source: string | undefined) => TApplication | undefined;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Creates a directive kit with application injection.
|
|
@@ -43,9 +45,6 @@ export interface DirectiveKitOptions<TApplication> {
|
|
|
43
45
|
* @example
|
|
44
46
|
* ```tsx
|
|
45
47
|
* // kit.ts
|
|
46
|
-
* import { createDirectiveKit } from '@sanity/agent-directives/react'
|
|
47
|
-
* import type { Application } from '@sanity/agent-types'
|
|
48
|
-
*
|
|
49
48
|
* export const { defineDirective } = createDirectiveKit<Application>({
|
|
50
49
|
* useApplication: (source) => useThreadApplication(source),
|
|
51
50
|
* })
|
|
@@ -56,29 +55,8 @@ export interface DirectiveKitOptions<TApplication> {
|
|
|
56
55
|
* })
|
|
57
56
|
* ```
|
|
58
57
|
*/
|
|
59
|
-
export declare function createDirectiveKit<TApplication>(options
|
|
60
|
-
defineDirective: <TName extends DirectiveName>(name: TName, render: (props: DirectiveRenderProps<TName, TApplication>) => ReactNode) => ComponentType<DirectiveComponentProps<TName>>;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Default components map including DirectivesStack.
|
|
64
|
-
* Spread this into your components and override as needed.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* import { defaultComponents } from '@sanity/agent-directives/react'
|
|
69
|
-
*
|
|
70
|
-
* <ReactMarkdown
|
|
71
|
-
* components={{
|
|
72
|
-
* ...defaultComponents,
|
|
73
|
-
* Document: DocumentDirective,
|
|
74
|
-
* }}
|
|
75
|
-
* >
|
|
76
|
-
* {content}
|
|
77
|
-
* </ReactMarkdown>
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
export declare const defaultComponents: {
|
|
81
|
-
readonly DirectivesStack: typeof DirectivesStack;
|
|
58
|
+
export declare function createDirectiveKit<TApplication = undefined>(options?: DirectiveKitOptions<TApplication>): {
|
|
59
|
+
defineDirective: <TName extends DirectiveName, TRequiresApplication extends boolean = true>(name: TName, render: (props: DirectiveRenderProps<TName, TApplication, TRequiresApplication>) => ReactNode, directiveOptions?: DefineDirectiveOptions) => ComponentType<DirectiveComponentProps<TName>>;
|
|
82
60
|
};
|
|
83
61
|
export {};
|
|
84
62
|
//# sourceMappingURL=react.d.ts.map
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.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AAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,YAAY,GAAG,SAAS,CAAA;CAC1E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,GAAG,SAAS,EACzD,OAAO,GAAE,mBAAmB,CAAC,YAAY,CAAM;sBAK7C,KAAK,SAAS,aAAa,EAC3B,oBAAoB,SAAS,OAAO,eAE9B,KAAK,UACH,CAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,KAAK,SAAS,qBAC3E,sBAAsB,KACvC,aAAa,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;EA+BjD"}
|
package/dist/react.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { DirectiveSchemas } from '@sanity/agent-types';
|
|
2
1
|
import { pascalCase } from 'es-toolkit';
|
|
3
2
|
import { directiveFromMarkdown, directiveToMarkdown } from 'mdast-util-directive';
|
|
4
3
|
import { directive } from 'micromark-extension-directive';
|
|
5
|
-
import { Children, createElement, useState, } from 'react';
|
|
6
4
|
import { visit } from 'unist-util-visit';
|
|
5
|
+
import { DirectiveSchemas } from './schemas.js';
|
|
7
6
|
const DIRECTIVE_TYPES = ['textDirective', 'leafDirective', 'containerDirective'];
|
|
8
7
|
const isDirectiveNode = (node) => 'name' in node &&
|
|
9
8
|
typeof node.name === 'string' &&
|
|
@@ -21,7 +20,6 @@ const isListItemWithOnlyDirective = (node) => {
|
|
|
21
20
|
/**
|
|
22
21
|
* Remark plugin that transforms directive syntax into React components.
|
|
23
22
|
*
|
|
24
|
-
* Features:
|
|
25
23
|
* - Validates directive names (letters and hyphens only)
|
|
26
24
|
* - Extracts directives from list items
|
|
27
25
|
* - Groups consecutive leaf directives into DirectivesStack wrappers
|
|
@@ -124,73 +122,31 @@ function remarkDirectivesTransform() {
|
|
|
124
122
|
});
|
|
125
123
|
};
|
|
126
124
|
}
|
|
127
|
-
export function remarkAgentDirectives() {
|
|
128
|
-
// Set up micromark extensions for parsing directive syntax (from remark-directive)
|
|
129
|
-
const data = this.data();
|
|
130
|
-
const micromarkExtensions = data.micromarkExtensions || (data.micromarkExtensions = []);
|
|
131
|
-
const fromMarkdownExtensions = data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []);
|
|
132
|
-
const toMarkdownExtensions = data.toMarkdownExtensions || (data.toMarkdownExtensions = []);
|
|
133
|
-
micromarkExtensions.push(directive());
|
|
134
|
-
fromMarkdownExtensions.push(directiveFromMarkdown());
|
|
135
|
-
toMarkdownExtensions.push(directiveToMarkdown());
|
|
136
|
-
// Return our transformer for processing the parsed directives
|
|
137
|
-
return remarkDirectivesTransform();
|
|
138
|
-
}
|
|
139
|
-
const stackStyles = {
|
|
140
|
-
display: 'flex',
|
|
141
|
-
flexDirection: 'column',
|
|
142
|
-
gap: '1px',
|
|
143
|
-
borderRadius: '8px',
|
|
144
|
-
overflow: 'hidden',
|
|
145
|
-
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.1)',
|
|
146
|
-
margin: '8px 0',
|
|
147
|
-
};
|
|
148
|
-
const collapsedStackStyles = {
|
|
149
|
-
...stackStyles,
|
|
150
|
-
maxHeight: '280px',
|
|
151
|
-
overflowY: 'auto',
|
|
152
|
-
};
|
|
153
|
-
const expandButtonStyles = {
|
|
154
|
-
display: 'flex',
|
|
155
|
-
justifyContent: 'flex-end',
|
|
156
|
-
padding: '4px 0',
|
|
157
|
-
};
|
|
158
|
-
const buttonStyles = {
|
|
159
|
-
background: 'none',
|
|
160
|
-
border: 'none',
|
|
161
|
-
padding: '4px 8px',
|
|
162
|
-
cursor: 'pointer',
|
|
163
|
-
fontSize: '12px',
|
|
164
|
-
color: 'inherit',
|
|
165
|
-
opacity: 0.7,
|
|
166
|
-
};
|
|
167
125
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
126
|
+
* Remark plugin for agent directive support.
|
|
127
|
+
* Parses and transforms directive syntax into React components.
|
|
170
128
|
*
|
|
171
129
|
* @example
|
|
172
130
|
* ```tsx
|
|
173
|
-
* import {
|
|
174
|
-
*
|
|
175
|
-
* // Use default
|
|
176
|
-
* components={{ DirectivesStack }}
|
|
131
|
+
* import { remarkAgentDirectives } from '@sanity/agent-directives/react'
|
|
177
132
|
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
133
|
+
* <ReactMarkdown remarkPlugins={[remarkAgentDirectives]}>
|
|
134
|
+
* {content}
|
|
135
|
+
* </ReactMarkdown>
|
|
180
136
|
* ```
|
|
181
137
|
*/
|
|
182
|
-
export function
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (!
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
138
|
+
export function remarkAgentDirectives() {
|
|
139
|
+
const data = this.data();
|
|
140
|
+
if (!data.micromarkExtensions)
|
|
141
|
+
data.micromarkExtensions = [];
|
|
142
|
+
if (!data.fromMarkdownExtensions)
|
|
143
|
+
data.fromMarkdownExtensions = [];
|
|
144
|
+
if (!data.toMarkdownExtensions)
|
|
145
|
+
data.toMarkdownExtensions = [];
|
|
146
|
+
data.micromarkExtensions.push(directive());
|
|
147
|
+
data.fromMarkdownExtensions.push(directiveFromMarkdown());
|
|
148
|
+
data.toMarkdownExtensions.push(directiveToMarkdown());
|
|
149
|
+
return remarkDirectivesTransform();
|
|
194
150
|
}
|
|
195
151
|
/**
|
|
196
152
|
* Creates a directive kit with application injection.
|
|
@@ -198,9 +154,6 @@ export function DirectivesStack({ children }) {
|
|
|
198
154
|
* @example
|
|
199
155
|
* ```tsx
|
|
200
156
|
* // kit.ts
|
|
201
|
-
* import { createDirectiveKit } from '@sanity/agent-directives/react'
|
|
202
|
-
* import type { Application } from '@sanity/agent-types'
|
|
203
|
-
*
|
|
204
157
|
* export const { defineDirective } = createDirectiveKit<Application>({
|
|
205
158
|
* useApplication: (source) => useThreadApplication(source),
|
|
206
159
|
* })
|
|
@@ -211,17 +164,16 @@ export function DirectivesStack({ children }) {
|
|
|
211
164
|
* })
|
|
212
165
|
* ```
|
|
213
166
|
*/
|
|
214
|
-
export function createDirectiveKit(options) {
|
|
167
|
+
export function createDirectiveKit(options = {}) {
|
|
215
168
|
const { useApplication } = options;
|
|
216
|
-
function defineDirective(name, render) {
|
|
169
|
+
function defineDirective(name, render, directiveOptions = {}) {
|
|
170
|
+
const { requiresApplication = true } = directiveOptions;
|
|
217
171
|
function Directive(props) {
|
|
218
172
|
const { node, source, ...rest } = props;
|
|
219
|
-
const application = useApplication(source);
|
|
220
|
-
if (!application)
|
|
173
|
+
const application = useApplication?.(source);
|
|
174
|
+
if (requiresApplication && useApplication && !application)
|
|
221
175
|
return null;
|
|
222
|
-
// Merge node properties with component props (component props take precedence)
|
|
223
176
|
const merged = { ...(node?.properties ?? {}), ...rest };
|
|
224
|
-
// Validate against schema
|
|
225
177
|
const schema = DirectiveSchemas[name];
|
|
226
178
|
const result = schema.safeParse(merged);
|
|
227
179
|
if (!result.success) {
|
|
@@ -230,7 +182,7 @@ export function createDirectiveKit(options) {
|
|
|
230
182
|
}
|
|
231
183
|
const renderProps = {
|
|
232
184
|
...result.data,
|
|
233
|
-
application,
|
|
185
|
+
...(requiresApplication && useApplication ? { application } : {}),
|
|
234
186
|
};
|
|
235
187
|
return render(renderProps);
|
|
236
188
|
}
|
|
@@ -239,28 +191,4 @@ export function createDirectiveKit(options) {
|
|
|
239
191
|
}
|
|
240
192
|
return { defineDirective };
|
|
241
193
|
}
|
|
242
|
-
// ============================================================================
|
|
243
|
-
// Convenience: Default Components
|
|
244
|
-
// ============================================================================
|
|
245
|
-
/**
|
|
246
|
-
* Default components map including DirectivesStack.
|
|
247
|
-
* Spread this into your components and override as needed.
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
* ```tsx
|
|
251
|
-
* import { defaultComponents } from '@sanity/agent-directives/react'
|
|
252
|
-
*
|
|
253
|
-
* <ReactMarkdown
|
|
254
|
-
* components={{
|
|
255
|
-
* ...defaultComponents,
|
|
256
|
-
* Document: DocumentDirective,
|
|
257
|
-
* }}
|
|
258
|
-
* >
|
|
259
|
-
* {content}
|
|
260
|
-
* </ReactMarkdown>
|
|
261
|
-
* ```
|
|
262
|
-
*/
|
|
263
|
-
export const defaultComponents = {
|
|
264
|
-
DirectivesStack,
|
|
265
|
-
};
|
|
266
194
|
//# sourceMappingURL=react.js.map
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAIzD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAA8C,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAsD3F,MAAM,eAAe,GAAoB,CAAC,eAAe,EAAE,eAAe,EAAE,oBAAoB,CAAC,CAAA;AAEjG,MAAM,eAAe,GAAG,CAAC,IAAU,EAAyB,EAAE,CAC5D,MAAM,IAAI,IAAI;IACd,OAAQ,IAAsB,CAAC,IAAI,KAAK,QAAQ;IAChD,cAAc,CAAC,IAAI,CAAE,IAAsB,CAAC,IAAI,CAAC;IACjD,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAqB,CAAC,CAAA;AAEtD,MAAM,2BAA2B,GAAG,CAAC,IAAU,EAAW,EAAE;IAC1D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,KAAK,CAAA;IAC1C,MAAM,QAAQ,GAAI,IAAsB,CAAC,QAAQ,IAAI,EAAE,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,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;YAEvC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC,MAAM,CAAC,CAAA;YAC5C,IAAI,mBAAmB,IAAI,cAAc,IAAI,CAAC,WAAW;gBAAE,OAAO,IAAI,CAAA;YAEtE,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,UAAU,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAA;YAEvD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAA;YACrC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;YACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,cAAc,IAAI,qBAAqB,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;gBAC7E,OAAO,IAAI,CAAA;YACb,CAAC;YAED,MAAM,WAAW,GAAG;gBAClB,GAAI,MAAM,CAAC,IAA8B;gBACzC,GAAG,CAAC,mBAAmB,IAAI,cAAc,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACC,CAAA;YAEpE,OAAO,MAAM,CAAC,WAAW,CAAC,CAAA;QAC5B,CAAC;QAED,SAAS,CAAC,WAAW,GAAG,aAAa,IAAI,GAAG,CAAA;QAC5C,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,EAAE,eAAe,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DocumentDirectiveSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
type: z.ZodOptional<z.ZodString>;
|
|
5
|
+
source: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
id: string;
|
|
8
|
+
type?: string | undefined;
|
|
9
|
+
source?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
id: string;
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
source?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const ReleaseDirectiveSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
source: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
id: string;
|
|
20
|
+
source?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
id: string;
|
|
23
|
+
source?: string | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const ResourceDirectiveSchema: z.ZodObject<{
|
|
26
|
+
source: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
source: string;
|
|
29
|
+
}, {
|
|
30
|
+
source: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const SetDirectiveSchema: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
id: string;
|
|
36
|
+
}, {
|
|
37
|
+
id: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare const ChangesDirectiveSchema: z.ZodObject<{
|
|
40
|
+
createdCount: z.ZodNumber;
|
|
41
|
+
updatedCount: z.ZodNumber;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
createdCount: number;
|
|
44
|
+
updatedCount: number;
|
|
45
|
+
}, {
|
|
46
|
+
createdCount: number;
|
|
47
|
+
updatedCount: number;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const DirectiveSchemas: {
|
|
50
|
+
readonly document: z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
type: z.ZodOptional<z.ZodString>;
|
|
53
|
+
source: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
id: string;
|
|
56
|
+
type?: string | undefined;
|
|
57
|
+
source?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
id: string;
|
|
60
|
+
type?: string | undefined;
|
|
61
|
+
source?: string | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
readonly release: z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
source: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
id: string;
|
|
68
|
+
source?: string | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
id: string;
|
|
71
|
+
source?: string | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
readonly resource: z.ZodObject<{
|
|
74
|
+
source: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
source: string;
|
|
77
|
+
}, {
|
|
78
|
+
source: string;
|
|
79
|
+
}>;
|
|
80
|
+
readonly set: z.ZodObject<{
|
|
81
|
+
id: z.ZodString;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
id: string;
|
|
84
|
+
}, {
|
|
85
|
+
id: string;
|
|
86
|
+
}>;
|
|
87
|
+
readonly changes: z.ZodObject<{
|
|
88
|
+
createdCount: z.ZodNumber;
|
|
89
|
+
updatedCount: z.ZodNumber;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
createdCount: number;
|
|
92
|
+
updatedCount: number;
|
|
93
|
+
}, {
|
|
94
|
+
createdCount: number;
|
|
95
|
+
updatedCount: number;
|
|
96
|
+
}>;
|
|
97
|
+
};
|
|
98
|
+
export declare const DIRECTIVE_NAMES: {
|
|
99
|
+
readonly document: "document";
|
|
100
|
+
readonly release: "release";
|
|
101
|
+
readonly resource: "resource";
|
|
102
|
+
readonly set: "set";
|
|
103
|
+
readonly changes: "changes";
|
|
104
|
+
};
|
|
105
|
+
export type DirectiveName = (typeof DIRECTIVE_NAMES)[keyof typeof DIRECTIVE_NAMES];
|
|
106
|
+
export type DocumentDirectiveProps = z.infer<typeof DocumentDirectiveSchema>;
|
|
107
|
+
export type ReleaseDirectiveProps = z.infer<typeof ReleaseDirectiveSchema>;
|
|
108
|
+
export type ResourceDirectiveProps = z.infer<typeof ResourceDirectiveSchema>;
|
|
109
|
+
export type SetDirectiveProps = z.infer<typeof SetDirectiveSchema>;
|
|
110
|
+
export type ChangesDirectiveProps = z.infer<typeof ChangesDirectiveSchema>;
|
|
111
|
+
export interface DirectivePropsMap {
|
|
112
|
+
document: DocumentDirectiveProps;
|
|
113
|
+
release: ReleaseDirectiveProps;
|
|
114
|
+
resource: ResourceDirectiveProps;
|
|
115
|
+
set: SetDirectiveProps;
|
|
116
|
+
changes: ChangesDirectiveProps;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAIlC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAA;AAEV,eAAO,MAAM,eAAe;;;;;;CAMlB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAA;AAElF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAC1E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC5E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAClE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE1E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,sBAAsB,CAAA;IAChC,OAAO,EAAE,qBAAqB,CAAA;IAC9B,QAAQ,EAAE,sBAAsB,CAAA;IAChC,GAAG,EAAE,iBAAiB,CAAA;IACtB,OAAO,EAAE,qBAAqB,CAAA;CAC/B"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const DocumentDirectiveSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
type: z.string().optional(),
|
|
5
|
+
source: z.string().optional(),
|
|
6
|
+
});
|
|
7
|
+
export const ReleaseDirectiveSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
source: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
export const ResourceDirectiveSchema = z.object({
|
|
12
|
+
source: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const SetDirectiveSchema = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
});
|
|
17
|
+
export const ChangesDirectiveSchema = z.object({
|
|
18
|
+
createdCount: z.coerce.number().min(0),
|
|
19
|
+
updatedCount: z.coerce.number().min(0),
|
|
20
|
+
});
|
|
21
|
+
export const DirectiveSchemas = {
|
|
22
|
+
document: DocumentDirectiveSchema,
|
|
23
|
+
release: ReleaseDirectiveSchema,
|
|
24
|
+
resource: ResourceDirectiveSchema,
|
|
25
|
+
set: SetDirectiveSchema,
|
|
26
|
+
changes: ChangesDirectiveSchema,
|
|
27
|
+
};
|
|
28
|
+
export const DIRECTIVE_NAMES = {
|
|
29
|
+
document: 'document',
|
|
30
|
+
release: 'release',
|
|
31
|
+
resource: 'resource',
|
|
32
|
+
set: 'set',
|
|
33
|
+
changes: 'changes',
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACvC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,uBAAuB;IACjC,OAAO,EAAE,sBAAsB;IAC/B,QAAQ,EAAE,uBAAuB;IACjC,GAAG,EAAE,kBAAkB;IACvB,OAAO,EAAE,sBAAsB;CACvB,CAAA;AAEV,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACV,CAAA"}
|
package/dist/string.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type DirectiveName, type DirectivePropsMap } from '
|
|
1
|
+
import { type DirectiveName, type DirectivePropsMap } from './schemas.js';
|
|
2
|
+
export type { DirectiveName };
|
|
2
3
|
type DirectiveProps<T extends DirectiveName> = DirectivePropsMap[T];
|
|
3
4
|
export interface DirectiveNode {
|
|
4
5
|
type: 'textDirective' | 'leafDirective' | 'containerDirective';
|
|
@@ -30,5 +31,4 @@ export interface DirectiveRenderResult<TBlock = unknown> {
|
|
|
30
31
|
export type DirectiveOutput<TBlock = unknown> = string | DirectiveRenderResult<TBlock> | null;
|
|
31
32
|
export declare function hasBlocks<TBlock>(output: DirectiveOutput<TBlock>): output is DirectiveRenderResult<TBlock>;
|
|
32
33
|
export declare function normalizeOutput<TBlock>(output: DirectiveOutput<TBlock>): DirectiveRenderResult<TBlock> | null;
|
|
33
|
-
export {};
|
|
34
34
|
//# sourceMappingURL=string.d.ts.map
|
package/dist/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"string.d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GAAG,OAAO;sBAG7C,KAAK,SAAS,aAAa,QAC5C,KAAK,UACH,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,KAClD,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC;4BAMP,aAAa,WAAW,QAAQ,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;;EAgChG;AAED,MAAM,WAAW,qBAAqB,CAAC,MAAM,GAAG,OAAO;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,GAAG,OAAO,IAAI,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;AAE7F,wBAAgB,SAAS,CAAC,MAAM,EAC9B,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,GAC9B,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAEzC;AAED,wBAAgB,eAAe,CAAC,MAAM,EACpC,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,GAC9B,qBAAqB,CAAC,MAAM,CAAC,GAAG,IAAI,CAQtC"}
|
package/dist/string.js
CHANGED
package/dist/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAgC3F,SAAS,eAAe,CAAC,IAAmB;IAC1C,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,SAAS,WAAW,CAA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": "Shared directive system for Sanity Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"zod": "^3.25.76"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@sanity/agent-types": "workspace:*",
|
|
56
55
|
"@testing-library/jest-dom": "^6.6.3",
|
|
57
56
|
"@testing-library/react": "^16.0.0",
|
|
58
57
|
"@types/react": "^19.0.0",
|
|
@@ -66,7 +65,6 @@
|
|
|
66
65
|
"vitest": "^3.0.9"
|
|
67
66
|
},
|
|
68
67
|
"peerDependencies": {
|
|
69
|
-
"@sanity/agent-types": "*",
|
|
70
68
|
"react": "^18.0.0 || ^19.0.0"
|
|
71
69
|
},
|
|
72
70
|
"peerDependenciesMeta": {
|