@atlaskit/ads-mcp 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/tools/get-all-components/components.codegen.js +2 -2
- package/dist/cjs/tools/get-all-components/types.js +5 -1
- package/dist/cjs/tools/get-atlaskit-components/atlaskit-components.codegen.js +35 -6
- package/dist/cjs/tools/get-atlaskit-hooks/atlaskit-hooks.codegen.js +206 -0
- package/dist/cjs/tools/get-atlaskit-hooks/get-atlaskit-hooks-tool.js +40 -0
- package/dist/cjs/tools/get-atlaskit-hooks/list-get-atlaskit-hooks-tool.js +22 -0
- package/dist/cjs/tools/get-atlaskit-hooks/types.js +5 -0
- package/dist/cjs/tools/get-atlaskit-utilities/atlaskit-utilities.codegen.js +836 -0
- package/dist/cjs/tools/get-atlaskit-utilities/get-atlaskit-utilities-tool.js +40 -0
- package/dist/cjs/tools/get-atlaskit-utilities/list-get-atlaskit-utilities-tool.js +22 -0
- package/dist/cjs/tools/get-atlaskit-utilities/types.js +5 -0
- package/dist/cjs/tools/get-guidelines/guidelines-structured-content.codegen.js +4 -4
- package/dist/cjs/tools/get-lint-rules/lint-rules-structured-content.codegen.js +31 -11
- package/dist/cjs/tools/i18n-conversion/guide.js +7 -7
- package/dist/cjs/tools/i18n-conversion/list-i18n-conversion-tool.js +1 -1
- package/dist/cjs/tools/search-atlaskit-hooks/list-search-atlaskit-hooks-tool.js +22 -0
- package/dist/cjs/tools/search-atlaskit-hooks/search-atlaskit-hooks-input-schema.js +11 -0
- package/dist/cjs/tools/search-atlaskit-hooks/search-atlaskit-hooks-tool.js +109 -0
- package/dist/cjs/tools/search-atlaskit-utilities/list-search-atlaskit-utilities-tool.js +22 -0
- package/dist/cjs/tools/search-atlaskit-utilities/search-atlaskit-utilities-input-schema.js +11 -0
- package/dist/cjs/tools/search-atlaskit-utilities/search-atlaskit-utilities-tool.js +111 -0
- package/dist/cjs/tools/types.js +1 -0
- package/dist/es2019/index.js +30 -0
- package/dist/es2019/tools/get-all-components/components.codegen.js +2 -2
- package/dist/es2019/tools/get-all-components/types.js +1 -0
- package/dist/es2019/tools/get-atlaskit-components/atlaskit-components.codegen.js +35 -6
- package/dist/es2019/tools/get-atlaskit-hooks/atlaskit-hooks.codegen.js +200 -0
- package/dist/es2019/tools/get-atlaskit-hooks/get-atlaskit-hooks-tool.js +14 -0
- package/dist/es2019/tools/get-atlaskit-hooks/list-get-atlaskit-hooks-tool.js +21 -0
- package/dist/es2019/tools/get-atlaskit-hooks/types.js +1 -0
- package/dist/es2019/tools/get-atlaskit-utilities/atlaskit-utilities.codegen.js +830 -0
- package/dist/es2019/tools/get-atlaskit-utilities/get-atlaskit-utilities-tool.js +14 -0
- package/dist/es2019/tools/get-atlaskit-utilities/list-get-atlaskit-utilities-tool.js +21 -0
- package/dist/es2019/tools/get-atlaskit-utilities/types.js +1 -0
- package/dist/es2019/tools/get-guidelines/guidelines-structured-content.codegen.js +4 -4
- package/dist/es2019/tools/get-lint-rules/lint-rules-structured-content.codegen.js +31 -11
- package/dist/es2019/tools/i18n-conversion/guide.js +7 -7
- package/dist/es2019/tools/i18n-conversion/list-i18n-conversion-tool.js +1 -1
- package/dist/es2019/tools/search-atlaskit-hooks/list-search-atlaskit-hooks-tool.js +19 -0
- package/dist/es2019/tools/search-atlaskit-hooks/search-atlaskit-hooks-input-schema.js +5 -0
- package/dist/es2019/tools/search-atlaskit-hooks/search-atlaskit-hooks-tool.js +79 -0
- package/dist/es2019/tools/search-atlaskit-utilities/list-search-atlaskit-utilities-tool.js +19 -0
- package/dist/es2019/tools/search-atlaskit-utilities/search-atlaskit-utilities-input-schema.js +5 -0
- package/dist/es2019/tools/search-atlaskit-utilities/search-atlaskit-utilities-tool.js +81 -0
- package/dist/es2019/tools/types.js +0 -0
- package/dist/esm/index.js +27 -1
- package/dist/esm/tools/get-all-components/components.codegen.js +2 -2
- package/dist/esm/tools/get-all-components/types.js +1 -0
- package/dist/esm/tools/get-atlaskit-components/atlaskit-components.codegen.js +35 -6
- package/dist/esm/tools/get-atlaskit-hooks/atlaskit-hooks.codegen.js +200 -0
- package/dist/esm/tools/get-atlaskit-hooks/get-atlaskit-hooks-tool.js +32 -0
- package/dist/esm/tools/get-atlaskit-hooks/list-get-atlaskit-hooks-tool.js +16 -0
- package/dist/esm/tools/get-atlaskit-hooks/types.js +1 -0
- package/dist/esm/tools/get-atlaskit-utilities/atlaskit-utilities.codegen.js +830 -0
- package/dist/esm/tools/get-atlaskit-utilities/get-atlaskit-utilities-tool.js +32 -0
- package/dist/esm/tools/get-atlaskit-utilities/list-get-atlaskit-utilities-tool.js +16 -0
- package/dist/esm/tools/get-atlaskit-utilities/types.js +1 -0
- package/dist/esm/tools/get-guidelines/guidelines-structured-content.codegen.js +4 -4
- package/dist/esm/tools/get-lint-rules/lint-rules-structured-content.codegen.js +31 -11
- package/dist/esm/tools/i18n-conversion/guide.js +7 -7
- package/dist/esm/tools/i18n-conversion/list-i18n-conversion-tool.js +1 -1
- package/dist/esm/tools/search-atlaskit-hooks/list-search-atlaskit-hooks-tool.js +16 -0
- package/dist/esm/tools/search-atlaskit-hooks/search-atlaskit-hooks-input-schema.js +5 -0
- package/dist/esm/tools/search-atlaskit-hooks/search-atlaskit-hooks-tool.js +102 -0
- package/dist/esm/tools/search-atlaskit-utilities/list-search-atlaskit-utilities-tool.js +16 -0
- package/dist/esm/tools/search-atlaskit-utilities/search-atlaskit-utilities-input-schema.js +5 -0
- package/dist/esm/tools/search-atlaskit-utilities/search-atlaskit-utilities-tool.js +106 -0
- package/dist/esm/tools/types.js +0 -0
- package/dist/types/tools/get-all-components/components.codegen.d.ts +1 -1
- package/dist/types/tools/get-all-components/types.d.ts +2 -1
- package/dist/types/tools/get-atlaskit-components/atlaskit-components.codegen.d.ts +1 -1
- package/dist/types/tools/get-atlaskit-hooks/atlaskit-hooks.codegen.d.ts +10 -0
- package/dist/types/tools/get-atlaskit-hooks/get-atlaskit-hooks-tool.d.ts +6 -0
- package/dist/types/tools/get-atlaskit-hooks/list-get-atlaskit-hooks-tool.d.ts +2 -0
- package/dist/types/tools/get-atlaskit-hooks/types.d.ts +14 -0
- package/dist/types/tools/get-atlaskit-utilities/atlaskit-utilities.codegen.d.ts +10 -0
- package/dist/types/tools/get-atlaskit-utilities/get-atlaskit-utilities-tool.d.ts +6 -0
- package/dist/types/tools/get-atlaskit-utilities/list-get-atlaskit-utilities-tool.d.ts +2 -0
- package/dist/types/tools/get-atlaskit-utilities/types.d.ts +41 -0
- package/dist/types/tools/get-guidelines/guidelines-structured-content.codegen.d.ts +1 -1
- package/dist/types/tools/get-lint-rules/lint-rules-structured-content.codegen.d.ts +1 -1
- package/dist/types/tools/search-atlaskit-hooks/list-search-atlaskit-hooks-tool.d.ts +2 -0
- package/dist/types/tools/search-atlaskit-hooks/search-atlaskit-hooks-input-schema.d.ts +11 -0
- package/dist/types/tools/search-atlaskit-hooks/search-atlaskit-hooks-tool.d.ts +4 -0
- package/dist/types/tools/search-atlaskit-utilities/list-search-atlaskit-utilities-tool.d.ts +2 -0
- package/dist/types/tools/search-atlaskit-utilities/search-atlaskit-utilities-input-schema.d.ts +11 -0
- package/dist/types/tools/search-atlaskit-utilities/search-atlaskit-utilities-tool.d.ts +4 -0
- package/dist/types/tools/types.d.ts +12 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Structured content components from design-system *.docs.tsx files
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::c074026b3760583a882b411542329528>>
|
|
7
7
|
* @codegenCommand yarn workspace @af/ads-ai-tooling codegen:atlaskit-components
|
|
8
8
|
*/
|
|
9
9
|
/* eslint-disable @repo/internal/react/boolean-prop-naming-convention -- not our types */
|
|
@@ -250,6 +250,9 @@ export const atlaskitComponents = [{
|
|
|
250
250
|
}, {
|
|
251
251
|
name: 'insertMenuItems',
|
|
252
252
|
type: 'MenuItem[]'
|
|
253
|
+
}, {
|
|
254
|
+
name: 'isEditorModernisationEnabled',
|
|
255
|
+
type: 'boolean'
|
|
253
256
|
}, {
|
|
254
257
|
name: 'legacyImageUploadProvider',
|
|
255
258
|
type: 'Promise<ImageUploadProvider>'
|
|
@@ -408,7 +411,7 @@ export const atlaskitComponents = [{
|
|
|
408
411
|
examples: ["import applyDevTools from 'prosemirror-dev-tools';\nimport { ComposableEditor } from '@atlaskit/editor-core/composable-editor';\nimport { usePreset } from '@atlaskit/editor-core/use-preset';\nimport { analyticsPlugin } from '@atlaskit/editor-plugins/analytics';\nimport { annotationPlugin } from '@atlaskit/editor-plugins/annotation';\nimport type { AnnotationProviders } from '@atlaskit/editor-plugins/annotation';\nimport { basePlugin } from '@atlaskit/editor-plugins/base';\nimport { blockControlsPlugin } from '@atlaskit/editor-plugins/block-controls';\nimport { blockTypePlugin } from '@atlaskit/editor-plugins/block-type';\nimport { breakoutPlugin } from '@atlaskit/editor-plugins/breakout';\nimport { codeBlockPlugin } from '@atlaskit/editor-plugins/code-block';\nimport { compositionPlugin } from '@atlaskit/editor-plugins/composition';\nimport { contentInsertionPlugin } from '@atlaskit/editor-plugins/content-insertion';\nimport { copyButtonPlugin } from '@atlaskit/editor-plugins/copy-button';\nimport { decorationsPlugin } from '@atlaskit/editor-plugins/decorations';\nimport { editorDisabledPlugin } from '@atlaskit/editor-plugins/editor-disabled';\nimport { emojiPlugin } from '@atlaskit/editor-plugins/emoji';\nimport { expandPlugin } from '@atlaskit/editor-plugins/expand';\nimport { extensionPlugin } from '@atlaskit/editor-plugins/extension';\nimport { floatingToolbarPlugin } from '@atlaskit/editor-plugins/floating-toolbar';\nimport { focusPlugin } from '@atlaskit/editor-plugins/focus';\nimport { gridPlugin } from '@atlaskit/editor-plugins/grid';\nimport { guidelinePlugin } from '@atlaskit/editor-plugins/guideline';\nimport { layoutPlugin } from '@atlaskit/editor-plugins/layout';\nimport { listPlugin } from '@atlaskit/editor-plugins/list';\nimport { mediaPlugin } from '@atlaskit/editor-plugins/media';\nimport { panelPlugin } from '@atlaskit/editor-plugins/panel';\nimport { quickInsertPlugin } from '@atlaskit/editor-plugins/quick-insert';\nimport { rulePlugin } from '@atlaskit/editor-plugins/rule';\nimport { selectionPlugin } from '@atlaskit/editor-plugins/selection';\nimport { selectionToolbarPlugin } from '@atlaskit/editor-plugins/selection-toolbar';\nimport { tablesPlugin } from '@atlaskit/editor-plugins/table';\nimport { tasksAndDecisionsPlugin } from '@atlaskit/editor-plugins/tasks-and-decisions';\nimport { textFormattingPlugin } from '@atlaskit/editor-plugins/text-formatting';\nimport { typeAheadPlugin } from '@atlaskit/editor-plugins/type-ahead';\nimport { widthPlugin } from '@atlaskit/editor-plugins/width';\nimport { defaultValue } from './default-value';\nexport default function Editor(): React.JSX.Element {\n\tconst { preset } = usePreset((builder) =>\n\t\tbuilder\n\t\t\t.add(basePlugin)\n\t\t\t.add(blockTypePlugin)\n\t\t\t.add(focusPlugin)\n\t\t\t.add(typeAheadPlugin)\n\t\t\t.add(quickInsertPlugin)\n\t\t\t.add(selectionPlugin)\n\t\t\t.add(decorationsPlugin)\n\t\t\t.add(layoutPlugin)\n\t\t\t.add(listPlugin)\n\t\t\t.add([analyticsPlugin, {}])\n\t\t\t.add(contentInsertionPlugin)\n\t\t\t.add(widthPlugin)\n\t\t\t.add(guidelinePlugin)\n\t\t\t.add(textFormattingPlugin)\n\t\t\t.add([\n\t\t\t\ttablesPlugin,\n\t\t\t\t{\n\t\t\t\t\ttableOptions: {\n\t\t\t\t\t\tadvanced: true,\n\t\t\t\t\t\tallowColumnResizing: true,\n\t\t\t\t\t\tallowHeaderRow: true,\n\t\t\t\t\t\tallowTableResizing: true,\n\t\t\t\t\t},\n\t\t\t\t\tisTableScalingEnabled: true,\n\t\t\t\t\tallowContextualMenu: true,\n\t\t\t\t\tfullWidthEnabled: true,\n\t\t\t\t},\n\t\t\t])\n\t\t\t.add(emojiPlugin)\n\t\t\t.add(panelPlugin)\n\t\t\t.add(rulePlugin)\n\t\t\t.add(tasksAndDecisionsPlugin)\n\t\t\t.add([expandPlugin, { allowInsertion: true, appearance: 'full-page' }])\n\t\t\t.add(editorDisabledPlugin)\n\t\t\t.add(copyButtonPlugin)\n\t\t\t.add(compositionPlugin)\n\t\t\t.add(codeBlockPlugin)\n\t\t\t.add(blockControlsPlugin)\n\t\t\t.add(breakoutPlugin)\n\t\t\t.add(gridPlugin)\n\t\t\t.add(floatingToolbarPlugin)\n\t\t\t.add([selectionToolbarPlugin, { preferenceToolbarAboveSelection: true }])\n\t\t\t.add([\n\t\t\t\tmediaPlugin,\n\t\t\t\t{\n\t\t\t\t\tallowMediaSingle: { disableLayout: true },\n\t\t\t\t\tallowMediaGroup: false,\n\t\t\t\t\tallowResizing: true,\n\t\t\t\t\tisCopyPasteEnabled: true,\n\t\t\t\t\tallowBreakoutSnapPoints: true,\n\t\t\t\t\tallowAdvancedToolBarOptions: true,\n\t\t\t\t\tallowDropzoneDropLine: true,\n\t\t\t\t\tallowMediaSingleEditable: true,\n\t\t\t\t\tallowImagePreview: true,\n\t\t\t\t\tfullWidthEnabled: true,\n\t\t\t\t\twaitForMediaUpload: true,\n\t\t\t\t},\n\t\t\t])\n\t\t\t.add([\n\t\t\t\tannotationPlugin,\n\t\t\t\t{\n\t\t\t\t\tinlineComment: {},\n\t\t\t\t} as AnnotationProviders,\n\t\t\t])\n\t\t\t.add(extensionPlugin),\n\t);\n\treturn (\n\t\t<ComposableEditor\n\t\t\tappearance=\"full-page\"\n\t\t\tonEditorReady={(editorAction) => {\n\t\t\t\teditorAction.replaceDocument(defaultValue);\n\t\t\t}}\n\t\t\tonChange={(view) => {\n\t\t\t\tapplyDevTools(view);\n\t\t\t}}\n\t\t\tpreset={preset}\n\t\t/>\n\t);\n}"],
|
|
409
412
|
props: [{
|
|
410
413
|
name: 'api',
|
|
411
|
-
type: '{ blockControls: BasePluginDependenciesAPI<{ actions: { registerNodeDecoration: (factory: NodeDecorationFactory) => void; unregisterNodeDecoration: (type: string) => void; }; commands: { ...; }; dependencies:
|
|
414
|
+
type: '{ blockControls: BasePluginDependenciesAPI<{ actions: { getTextInfo: (editorView: EditorView) => { textContent: string; textLength: number; }; registerNodeDecoration: (factory: NodeDecorationFactory) => void; unregisterNodeDecoration: (type: string) => void; }; commands: { ...; }; dependencies: BlockControlsPluginDe...'
|
|
412
415
|
}, {
|
|
413
416
|
name: 'config',
|
|
414
417
|
type: '{ quickInsertButtonEnabled?: boolean; rightSideControlsEnabled?: boolean; }',
|
|
@@ -675,6 +678,14 @@ export const atlaskitComponents = [{
|
|
|
675
678
|
name: 'portalProviderAPI',
|
|
676
679
|
type: 'PortalProviderAPI',
|
|
677
680
|
isRequired: true
|
|
681
|
+
}, {
|
|
682
|
+
name: 'prebuiltEditorState',
|
|
683
|
+
type: 'EditorState',
|
|
684
|
+
description: "Pre-built EditorState from ReactEditorView's ssrDeps.\nWhen provided, skips internal EditorState creation to avoid double work."
|
|
685
|
+
}, {
|
|
686
|
+
name: 'prebuiltPMPlugins',
|
|
687
|
+
type: 'SafePlugin<any>[]',
|
|
688
|
+
description: "Pre-built SafePlugins from ReactEditorView's ssrDeps.\nWhen provided, skips internal PM plugin creation to avoid double work."
|
|
678
689
|
}, {
|
|
679
690
|
name: 'schema',
|
|
680
691
|
type: 'Schema<any, any>',
|
|
@@ -827,6 +838,10 @@ export const atlaskitComponents = [{
|
|
|
827
838
|
}, {
|
|
828
839
|
name: 'onColumnResize',
|
|
829
840
|
type: '(key: string, width: number) => void'
|
|
841
|
+
}, {
|
|
842
|
+
name: 'onColumnSort',
|
|
843
|
+
type: '(key: string) => void',
|
|
844
|
+
description: 'Callback to be invoked whenever a user sorts a datasource table by a column.'
|
|
830
845
|
}, {
|
|
831
846
|
name: 'onVisibleColumnKeysChange',
|
|
832
847
|
type: '(visibleColumnKeys: string[]) => void',
|
|
@@ -844,6 +859,9 @@ export const atlaskitComponents = [{
|
|
|
844
859
|
name: 'scrollableContainerHeight',
|
|
845
860
|
type: 'number',
|
|
846
861
|
description: 'If this number is set it will restrict (max-height) maximum size of the component AND make main container a scrollable container.\nIt this number is 0 it will not restrict height and not make container scrollable.'
|
|
862
|
+
}, {
|
|
863
|
+
name: 'sortState',
|
|
864
|
+
type: '{ direction: DatasourceTableSortDirection; key: string; }'
|
|
847
865
|
}, {
|
|
848
866
|
name: 'url',
|
|
849
867
|
type: 'string',
|
|
@@ -947,6 +965,10 @@ export const atlaskitComponents = [{
|
|
|
947
965
|
name: 'customMessages',
|
|
948
966
|
type: '{ linkLabel?: MessageDescriptor; linkAriaLabel?: MessageDescriptor; linkPlaceholder?: MessageDescriptor; linkTextLabel?: MessageDescriptor; linkTextPlaceholder?: MessageDescriptor; linkHelperTextLabel?: MessageDescriptor; submitButtonLabel?: MessageDescriptor; }',
|
|
949
967
|
description: 'Allows for customisation of text in the link picker.'
|
|
968
|
+
}, {
|
|
969
|
+
name: 'disableManualUrlInsert',
|
|
970
|
+
type: 'boolean',
|
|
971
|
+
description: 'When true, disables the Insert button when the user has manually typed a URL but no search\nresult has been selected. This prevents inserting external/manual links when only\nresult-based links are desired.'
|
|
950
972
|
}, {
|
|
951
973
|
name: 'disableWidth',
|
|
952
974
|
type: 'boolean',
|
|
@@ -1069,6 +1091,9 @@ export const atlaskitComponents = [{
|
|
|
1069
1091
|
}, {
|
|
1070
1092
|
name: 'allowCustomPanels',
|
|
1071
1093
|
type: 'boolean'
|
|
1094
|
+
}, {
|
|
1095
|
+
name: 'allowDownloadCodeBlock',
|
|
1096
|
+
type: 'boolean'
|
|
1072
1097
|
}, {
|
|
1073
1098
|
name: 'allowFixedColumnWidthOption',
|
|
1074
1099
|
type: 'boolean'
|
|
@@ -1146,6 +1171,10 @@ export const atlaskitComponents = [{
|
|
|
1146
1171
|
}, {
|
|
1147
1172
|
name: 'getExtensionHeight',
|
|
1148
1173
|
type: '(node: PMNode) => string'
|
|
1174
|
+
}, {
|
|
1175
|
+
name: 'headingIdPrefix',
|
|
1176
|
+
type: 'string',
|
|
1177
|
+
description: 'Optional prefix to prepend to all generated heading IDs.\nUsed by nested renderers to namespace heading IDs and avoid collisions with the host page.'
|
|
1149
1178
|
}, {
|
|
1150
1179
|
name: 'includeNodesCountInStats',
|
|
1151
1180
|
type: 'boolean'
|
|
@@ -1312,8 +1341,8 @@ export const atlaskitComponents = [{
|
|
|
1312
1341
|
description: 'Show selected state of smart link.'
|
|
1313
1342
|
}, {
|
|
1314
1343
|
name: 'onClick',
|
|
1315
|
-
type: '(event: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element
|
|
1316
|
-
description: 'A callback function
|
|
1344
|
+
type: '(event: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>, data?: OnClickData) => void',
|
|
1345
|
+
description: 'A callback function triggered when a Smart Link is clicked.\n\nWhen defined, the default browser navigation is prevented and your handler\nis responsible for navigation — except for Flexible Card, which always opens\nthe link and then calls the callback.\n\nThe optional second argument `data` provides additional context about the click:\n- `data.destinationUrl` — the resolved URL Smart Link will navigate to.\n This may differ from the original `url` prop if Smart Link resolved a\n preferred URL from metadata or appended analytics parameters.\n- `data.url` — the original `url` prop passed to the component.\n\n@example\n// Basic usage\nonClick={(e) => { e.preventDefault(); window.location.href = myUrl; }}\n\n// With destination URL\nonClick={(e, data) => { navigate(data?.destinationUrl ?? url); }}'
|
|
1317
1346
|
}, {
|
|
1318
1347
|
name: 'onError',
|
|
1319
1348
|
type: '(data: { err?: Error; status: "errored" | "fallback" | "unauthorized" | "forbidden" | "not_found"; url: string; }) => void',
|
|
@@ -1767,8 +1796,8 @@ export const atlaskitComponents = [{
|
|
|
1767
1796
|
description: 'Show selected state of smart link.'
|
|
1768
1797
|
}, {
|
|
1769
1798
|
name: 'onClick',
|
|
1770
|
-
type: '(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element
|
|
1771
|
-
description: 'A callback function
|
|
1799
|
+
type: '(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, data?: OnClickData) => void',
|
|
1800
|
+
description: 'A callback function triggered when a Smart Link is clicked.\n\nWhen defined, the default browser navigation is prevented and your handler\nis responsible for navigation — except for Flexible Card, which always opens\nthe link and then calls the callback.\n\nThe optional second argument `data` provides additional context about the click:\n- `data.destinationUrl` — the resolved URL Smart Link will navigate to.\n This may differ from the original `url` prop if Smart Link resolved a\n preferred URL from metadata or appended analytics parameters.\n- `data.url` — the original `url` prop passed to the component.\n\n@example\n// Basic usage\nonClick={(e) => { e.preventDefault(); window.location.href = myUrl; }}\n\n// With destination URL\nonClick={(e, data) => { navigate(data?.destinationUrl ?? url); }}'
|
|
1772
1801
|
}, {
|
|
1773
1802
|
name: 'onError',
|
|
1774
1803
|
type: '(data: { err?: Error; status: "errored" | "fallback" | "unauthorized" | "forbidden" | "not_found"; url: string; }) => void',
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Structured content hooks from design-system *.docs.tsx files
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::54db052ad53f695704ea4e9666a1ee4d>>
|
|
7
|
+
* @codegenCommand yarn workspace @af/ads-ai-tooling codegen:atlaskit-hooks
|
|
8
|
+
*/
|
|
9
|
+
/* eslint-disable @repo/internal/react/boolean-prop-naming-convention -- not our types */
|
|
10
|
+
|
|
11
|
+
export const atlaskitHooks = [{
|
|
12
|
+
name: 'useAnalyticsEvents',
|
|
13
|
+
description: 'Returns `createAnalyticsEvent`, a stable callback that produces a `UIAnalyticsEvent` pre-wired with the surrounding analytics context and handlers. Call `.fire(channel)` on the returned event to dispatch it.',
|
|
14
|
+
status: 'general-availability',
|
|
15
|
+
usageGuidelines: ['Use inside any component that needs to fire events. Always pair with a parent `AnalyticsListener`, otherwise events fire into the void.', 'Build the payload with the smallest information the listener needs — heavy serialisation belongs in the handler, not the call site.'],
|
|
16
|
+
keywords: ['analytics', 'hook', 'useAnalyticsEvents', 'analytics-next'],
|
|
17
|
+
category: 'analytics',
|
|
18
|
+
parameters: [],
|
|
19
|
+
returns: {
|
|
20
|
+
type: '{ createAnalyticsEvent: (payload: AnalyticsEventPayload) => UIAnalyticsEvent }',
|
|
21
|
+
description: '`createAnalyticsEvent` is referentially stable per nearest `AnalyticsContext`, so it is safe to put in dependency arrays.'
|
|
22
|
+
},
|
|
23
|
+
package: '@atlaskit/analytics-next',
|
|
24
|
+
examples: ["import React, { type FC, type MouseEvent, useCallback } from 'react';\nimport {\n\tAnalyticsListener,\n\ttype UIAnalyticsEvent,\n\tuseAnalyticsEvents,\n\tuseCallbackWithAnalytics,\n\tusePlatformLeafEventHandler,\n\twithAnalyticsEvents,\n\ttype WithAnalyticsEventsProps,\n} from '../src';\ninterface Props extends WithAnalyticsEventsProps {\n\tchildren: React.ReactNode;\n\tonClick: (e: MouseEvent<HTMLButtonElement>) => void;\n}\nconst ButtonBase = ({ createAnalyticsEvent, onClick, ...rest }: Props) => {\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\t// Create our analytics event\n\t\t\tconst analyticsEvent = createAnalyticsEvent!({\n\t\t\t\taction: 'click',\n\t\t\t});\n\t\t\t// Fire our analytics event on the 'atlaskit' channel\n\t\t\tanalyticsEvent.fire('atlaskit');\n\t\t\tif (onClick) {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t},\n\t\t[onClick, createAnalyticsEvent],\n\t);\n\treturn <button {...rest} onClick={handleClick} />;\n};\nconst Button = withAnalyticsEvents()(ButtonBase);\nconst ButtonUsingHook: FC<Props> = ({ onClick, ...props }) => {\n\t// Decompose function from the hook\n\tconst { createAnalyticsEvent } = useAnalyticsEvents();\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLButtonElement>) => {\n\t\t\t// Create our analytics event\n\t\t\tconst analyticsEvent = createAnalyticsEvent({ action: 'click' });\n\t\t\t// Fire our analytics event\n\t\t\tanalyticsEvent.fire('atlaskit');\n\t\t\tif (onClick) {\n\t\t\t\tonClick(e);\n\t\t\t}\n\t\t},\n\t\t[onClick, createAnalyticsEvent],\n\t);\n\treturn <button {...props} onClick={handleClick} />;\n};\nconst ButtonUsingCallback: FC<Props> = ({ onClick, ...props }) => {\n\tconst handleClick = useCallbackWithAnalytics(onClick, { action: 'click' }, 'atlaskit');\n\treturn <button {...props} onClick={handleClick} />;\n};\nconst ButtonUsingEventHandlerHook = ({\n\tonClick,\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n\tonClick: (\n\t\tmouseEvent: React.MouseEvent<HTMLButtonElement>,\n\t\tanalyticsEvent: UIAnalyticsEvent,\n\t) => void;\n}) => {\n\tconst handleClick = usePlatformLeafEventHandler({\n\t\tfn: onClick,\n\t\taction: 'clicked',\n\t\tcomponentName: 'fancy-button',\n\t\tpackageName: '@atlaskit/fancy-button',\n\t\tpackageVersion: '0.1.0',\n\t});\n\treturn <button onClick={handleClick}>{children}</button>;\n};\nconst App: FC = () => {\n\tconst handleEvent = (analyticsEvent: UIAnalyticsEvent) => {\n\t\tconst { payload, context } = analyticsEvent;\n\t\tconsole.log('Received event:', { payload, context });\n\t};\n\tconst onClickHandler = () => console.log('onClickCallback');\n\treturn (\n\t\t<AnalyticsListener channel=\"atlaskit\" onEvent={handleEvent}>\n\t\t\t<Button onClick={onClickHandler}>Click me (withAnalyticsEvents)</Button>\n\t\t\t<br />\n\t\t\t<ButtonUsingHook onClick={onClickHandler}>Click me (useAnalyticsEvents)</ButtonUsingHook>\n\t\t\t<br />\n\t\t\t<ButtonUsingCallback onClick={onClickHandler}>\n\t\t\t\tClick me (useCallbackWithAnalytics)\n\t\t\t</ButtonUsingCallback>\n\t\t\t<br />\n\t\t\t<ButtonUsingEventHandlerHook onClick={onClickHandler}>\n\t\t\t\tClick me (usePlatformLeafEventHandler)\n\t\t\t</ButtonUsingEventHandlerHook>\n\t\t</AnalyticsListener>\n\t);\n};\nexport default App;"]
|
|
25
|
+
}, {
|
|
26
|
+
name: 'useCloseOnEscapePress',
|
|
27
|
+
description: 'Calls `onClose` when the Escape key is pressed and this layer is currently on top of the layering tree. Layers covered by a deeper layer are skipped, so Escape closes the topmost surface first.',
|
|
28
|
+
status: 'general-availability',
|
|
29
|
+
usageGuidelines: ['Mount inside the component that owns the surface (modal body, popup body, drawer body). Wrap that component in `<Layering>` or it will not receive layer information.', 'Do not pair with a second top-level Escape listener — the hook already coordinates dismissal across stacked layers.'],
|
|
30
|
+
accessibilityGuidelines: ['Escape-to-close is the expected dismissal pattern for overlay surfaces (WAI-ARIA Authoring Practices). Always wire it up alongside an explicit close button.'],
|
|
31
|
+
keywords: ['layering', 'hook', 'useCloseOnEscapePress', 'escape', 'dismiss'],
|
|
32
|
+
category: 'layering',
|
|
33
|
+
parameters: [{
|
|
34
|
+
name: 'options',
|
|
35
|
+
type: '{ onClose: (e: KeyboardEvent) => void; isDisabled?: boolean }',
|
|
36
|
+
description: '`onClose` runs on the first Escape keydown per press. Set `isDisabled` to opt out without unmounting the hook (for example, when the surface is mounted but in a non-closable state).'
|
|
37
|
+
}],
|
|
38
|
+
returns: {
|
|
39
|
+
type: 'void'
|
|
40
|
+
},
|
|
41
|
+
package: '@atlaskit/layering',
|
|
42
|
+
examples: []
|
|
43
|
+
}, {
|
|
44
|
+
name: 'useInterval',
|
|
45
|
+
description: 'Declarative wrapper around `setInterval`. Re-runs the latest `callback` every `delay` milliseconds and clears the timer on unmount or when `delay` changes. Passing `null` for `delay` pauses the timer without unmounting the hook.',
|
|
46
|
+
status: 'general-availability',
|
|
47
|
+
usageGuidelines: ['Use for polling, ticking clocks, or any callback that needs to fire on a fixed cadence inside a React component.', 'Pass `null` for `delay` to pause — do not unmount the component just to stop the timer.', 'The callback is captured by ref, so referencing the latest props/state in it does not require putting them in any dependency array.'],
|
|
48
|
+
keywords: ['hook', 'useInterval', 'setInterval', 'polling', 'frontend-utilities'],
|
|
49
|
+
category: 'hooks',
|
|
50
|
+
parameters: [{
|
|
51
|
+
name: 'callback',
|
|
52
|
+
type: '() => void',
|
|
53
|
+
description: 'Function to run on each tick. The hook keeps a ref to the latest callback, so changing it does not reset the interval.'
|
|
54
|
+
}, {
|
|
55
|
+
name: 'delay',
|
|
56
|
+
type: 'number | null',
|
|
57
|
+
description: 'Interval in milliseconds. Pass `null` to pause the timer.'
|
|
58
|
+
}],
|
|
59
|
+
returns: {
|
|
60
|
+
type: 'void'
|
|
61
|
+
},
|
|
62
|
+
package: '@atlaskit/frontend-utilities',
|
|
63
|
+
examples: []
|
|
64
|
+
}, {
|
|
65
|
+
name: 'useLayering',
|
|
66
|
+
description: 'Returns information about the current layer in the layering tree: the layer depth, a check for whether this layer is currently disabled (i.e. not on top), and the top-most depth in the tree.',
|
|
67
|
+
status: 'general-availability',
|
|
68
|
+
usageGuidelines: ['Use inside a layered surface to gate behaviour that should only run for the top-most layer (for example, registering global keyboard listeners or auto-focusing content).', 'Prefer `useCloseOnEscapePress` for the common case of closing on Escape — only reach for `useLayering` when you need raw level info.'],
|
|
69
|
+
keywords: ['layering', 'hook', 'useLayering', 'top-layer'],
|
|
70
|
+
category: 'layering',
|
|
71
|
+
parameters: [],
|
|
72
|
+
returns: {
|
|
73
|
+
type: '{ currentLevel: number; isLayerDisabled: () => boolean; getTopLevel: () => number | null }',
|
|
74
|
+
description: '`currentLevel` is the depth of the calling layer. `isLayerDisabled()` returns true when a deeper layer is currently on top. `getTopLevel()` returns the deepest registered layer, or `null` if no layers are mounted.'
|
|
75
|
+
},
|
|
76
|
+
package: '@atlaskit/layering',
|
|
77
|
+
examples: []
|
|
78
|
+
}, {
|
|
79
|
+
name: 'useLocalStorage',
|
|
80
|
+
description: '`useState`-shaped wrapper around `window.localStorage` with built-in JSON serialisation and a wrapper that survives the storage being unavailable (e.g. private browsing modes that throw). Persists `value` under `key` and rehydrates it on mount.',
|
|
81
|
+
status: 'general-availability',
|
|
82
|
+
usageGuidelines: ['Use for user-scoped preferences that should survive a page refresh (collapsed sidebar state, last-used view, etc.).', 'Do not store secrets or large blobs — `localStorage` is plaintext and capped at ~5 MB per origin.', 'Values are JSON-serialised; non-serialisable values (functions, `Symbol`, circular refs) will be lost on rehydrate.'],
|
|
83
|
+
keywords: ['hook', 'useLocalStorage', 'storage', 'persistence', 'frontend-utilities'],
|
|
84
|
+
category: 'hooks',
|
|
85
|
+
parameters: [{
|
|
86
|
+
name: 'key',
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'Storage key. Changing the key swaps the underlying storage entry.'
|
|
89
|
+
}, {
|
|
90
|
+
name: 'defaultValue',
|
|
91
|
+
type: 'T',
|
|
92
|
+
description: 'Returned (and persisted) when nothing is stored under `key` yet.'
|
|
93
|
+
}],
|
|
94
|
+
returns: {
|
|
95
|
+
type: '[value: T, setValue: (value: T) => void]',
|
|
96
|
+
description: 'A React-style tuple. `setValue` writes both to component state and to local storage.'
|
|
97
|
+
},
|
|
98
|
+
package: '@atlaskit/frontend-utilities',
|
|
99
|
+
examples: []
|
|
100
|
+
}, {
|
|
101
|
+
name: 'useLocalStorageRecord',
|
|
102
|
+
description: 'Persistent bounded log built on top of `useLocalStorage`. Stores up to `maxLength` items keyed by stringified equality and exposes `putRecord` / `removeRecord` actions for append-only collections like recent searches.',
|
|
103
|
+
status: 'general-availability',
|
|
104
|
+
usageGuidelines: ['Use for capped histories (recent searches, recently visited items, undo stacks).', '`removeRecord(query)` matches by JSON-stringified inclusion, not by identity — pass a stable substring of the record to remove.', 'Equality is structural via `JSON.stringify`: pushing a record that stringifies the same as an existing one is a no-op.'],
|
|
105
|
+
keywords: ['hook', 'useLocalStorageRecord', 'history', 'storage', 'frontend-utilities'],
|
|
106
|
+
category: 'hooks',
|
|
107
|
+
parameters: [{
|
|
108
|
+
name: 'key',
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'Local storage key used to persist the list.'
|
|
111
|
+
}, {
|
|
112
|
+
name: 'initialValue',
|
|
113
|
+
type: 'T[]',
|
|
114
|
+
description: 'Initial list contents when nothing is stored yet.',
|
|
115
|
+
defaultValue: '[]',
|
|
116
|
+
isOptional: true
|
|
117
|
+
}, {
|
|
118
|
+
name: 'maxLength',
|
|
119
|
+
type: 'number',
|
|
120
|
+
description: 'Cap on stored records. Once reached, the oldest entry is dropped on the next `putRecord`. Pass `0` to disable the cap.',
|
|
121
|
+
defaultValue: '100',
|
|
122
|
+
isOptional: true
|
|
123
|
+
}],
|
|
124
|
+
returns: {
|
|
125
|
+
type: '{ records: T[]; actions: { putRecord: (record: T) => void; removeRecord: (query: string) => void } }',
|
|
126
|
+
description: '`actions` are NOT referentially stable — wrap in `useCallback` if you put them in dependency arrays.'
|
|
127
|
+
},
|
|
128
|
+
package: '@atlaskit/frontend-utilities',
|
|
129
|
+
examples: []
|
|
130
|
+
}, {
|
|
131
|
+
name: 'usePrevious',
|
|
132
|
+
description: 'Returns the previous render-cycle value of `value`. On the first render the hook returns `undefined`; subsequent renders return the value supplied on the prior render.',
|
|
133
|
+
status: 'general-availability',
|
|
134
|
+
usageGuidelines: ['Use for change-detection effects — e.g. firing analytics only when a prop transitions from one value to another.', 'Do not store derived state in `usePrevious`; prefer a `useEffect` that mirrors the change you care about.', '`undefined` on the first render is intentional — initialise downstream logic to handle that case.'],
|
|
135
|
+
keywords: ['hook', 'usePrevious', 'previous-value', 'frontend-utilities'],
|
|
136
|
+
category: 'hooks',
|
|
137
|
+
parameters: [{
|
|
138
|
+
name: 'value',
|
|
139
|
+
type: 'T',
|
|
140
|
+
description: 'The value to track across renders.'
|
|
141
|
+
}],
|
|
142
|
+
returns: {
|
|
143
|
+
type: 'T | undefined',
|
|
144
|
+
description: '`undefined` on the first render, otherwise the value passed on the previous render.'
|
|
145
|
+
},
|
|
146
|
+
package: '@atlaskit/frontend-utilities',
|
|
147
|
+
examples: []
|
|
148
|
+
}, {
|
|
149
|
+
name: 'useWhyDidUpdate',
|
|
150
|
+
description: 'Development-only debug hook that logs which dependencies changed since the previous render, using deep equality (`lodash.isEqual`). Useful for diagnosing unexpected re-renders when the data inside a prop looks identical but the reference changed.',
|
|
151
|
+
status: 'general-availability',
|
|
152
|
+
usageGuidelines: ['Use locally while debugging; remove before shipping. The hook short-circuits in production (`NODE_ENV === "production"`) but the import and call still ship.', 'Pass the same array shape you would pass to `useEffect` deps for the comparison to mean anything.', "Prefer `useWhyDidUpdateShallow` when you want to mirror React's own re-render trigger."],
|
|
153
|
+
keywords: ['hook', 'useWhyDidUpdate', 'debug', 'rerender', 'frontend-utilities'],
|
|
154
|
+
category: 'hooks',
|
|
155
|
+
parameters: [{
|
|
156
|
+
name: 'name',
|
|
157
|
+
type: 'string',
|
|
158
|
+
description: 'Label printed in the console log (typically the component name).'
|
|
159
|
+
}, {
|
|
160
|
+
name: 'deps',
|
|
161
|
+
type: 'any[]',
|
|
162
|
+
description: 'Dependency array to compare across renders.'
|
|
163
|
+
}, {
|
|
164
|
+
name: 'depsNames',
|
|
165
|
+
type: 'string[]',
|
|
166
|
+
description: 'Optional per-dependency labels for the log output. Falls back to `dep_<index>`.',
|
|
167
|
+
isOptional: true
|
|
168
|
+
}],
|
|
169
|
+
returns: {
|
|
170
|
+
type: 'void'
|
|
171
|
+
},
|
|
172
|
+
package: '@atlaskit/frontend-utilities',
|
|
173
|
+
examples: []
|
|
174
|
+
}, {
|
|
175
|
+
name: 'useWhyDidUpdateShallow',
|
|
176
|
+
description: 'Variant of `useWhyDidUpdate` that compares dependencies with `Object.is` (shallow / reference equality) — the same comparison React itself uses to decide whether to re-render. Useful when you want to find out which prop is changing identity from one render to the next.',
|
|
177
|
+
status: 'general-availability',
|
|
178
|
+
usageGuidelines: ['Reach for this hook first when chasing "why is this re-rendering" — it matches React\'s own equality semantics. Drop to `useWhyDidUpdate` only when you suspect the content changed but the reference did not.', 'Same production-stripping behaviour as `useWhyDidUpdate` — log calls are no-ops in prod builds.'],
|
|
179
|
+
keywords: ['hook', 'useWhyDidUpdateShallow', 'debug', 'rerender', 'frontend-utilities'],
|
|
180
|
+
category: 'hooks',
|
|
181
|
+
parameters: [{
|
|
182
|
+
name: 'name',
|
|
183
|
+
type: 'string',
|
|
184
|
+
description: 'Label printed in the console log (typically the component name).'
|
|
185
|
+
}, {
|
|
186
|
+
name: 'deps',
|
|
187
|
+
type: 'any[]',
|
|
188
|
+
description: 'Dependency array to compare across renders.'
|
|
189
|
+
}, {
|
|
190
|
+
name: 'depsNames',
|
|
191
|
+
type: 'string[]',
|
|
192
|
+
description: 'Optional per-dependency labels for the log output.',
|
|
193
|
+
isOptional: true
|
|
194
|
+
}],
|
|
195
|
+
returns: {
|
|
196
|
+
type: 'void'
|
|
197
|
+
},
|
|
198
|
+
package: '@atlaskit/frontend-utilities',
|
|
199
|
+
examples: []
|
|
200
|
+
}];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
2
|
+
import { atlaskitHooks } from './atlaskit-hooks.codegen';
|
|
3
|
+
export const getAtlaskitHooksTool = async () => {
|
|
4
|
+
const hooks = atlaskitHooks.map(hook => ({
|
|
5
|
+
name: hook.name,
|
|
6
|
+
package: hook.package
|
|
7
|
+
}));
|
|
8
|
+
return {
|
|
9
|
+
content: [{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: JSON.stringify(hooks, null, 2)
|
|
12
|
+
}]
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { zodToJsonSchema } from '../../helpers';
|
|
5
|
+
export const listGetAtlaskitHooksTool = {
|
|
6
|
+
name: 'atlaskit_get_hooks',
|
|
7
|
+
description: `Returns the names and packages of all atlaskit hooks excluding hooks covered by the Atlassian Design System.
|
|
8
|
+
|
|
9
|
+
WHEN TO USE:
|
|
10
|
+
Use this when you want to see what hooks are available without the full metadata payload.
|
|
11
|
+
|
|
12
|
+
No parameters.`,
|
|
13
|
+
annotations: {
|
|
14
|
+
title: 'Get all Atlaskit hooks',
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
destructiveHint: false,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
openWorldHint: true
|
|
19
|
+
},
|
|
20
|
+
inputSchema: zodToJsonSchema(z.object({}))
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|