@atlaskit/ads-mcp 1.0.0 → 1.1.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 +11 -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 +19 -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 +19 -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 +19 -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
|
@@ -9,7 +9,7 @@ exports.atlaskitComponents = void 0;
|
|
|
9
9
|
*
|
|
10
10
|
* Structured content components from design-system *.docs.tsx files
|
|
11
11
|
*
|
|
12
|
-
* @codegen <<SignedSource::
|
|
12
|
+
* @codegen <<SignedSource::9a2dd503a8c88989c93926372eaa84c1>>
|
|
13
13
|
* @codegenCommand yarn workspace @af/ads-ai-tooling codegen:atlaskit-components
|
|
14
14
|
*/
|
|
15
15
|
/* eslint-disable @repo/internal/react/boolean-prop-naming-convention -- not our types */
|
|
@@ -256,6 +256,9 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
256
256
|
}, {
|
|
257
257
|
name: 'insertMenuItems',
|
|
258
258
|
type: 'MenuItem[]'
|
|
259
|
+
}, {
|
|
260
|
+
name: 'isEditorModernisationEnabled',
|
|
261
|
+
type: 'boolean'
|
|
259
262
|
}, {
|
|
260
263
|
name: 'legacyImageUploadProvider',
|
|
261
264
|
type: 'Promise<ImageUploadProvider>'
|
|
@@ -414,7 +417,7 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
414
417
|
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}"],
|
|
415
418
|
props: [{
|
|
416
419
|
name: 'api',
|
|
417
|
-
type: '{ blockControls: BasePluginDependenciesAPI<{ actions: { registerNodeDecoration: (factory: NodeDecorationFactory) => void; unregisterNodeDecoration: (type: string) => void; }; commands: { ...; }; dependencies:
|
|
420
|
+
type: '{ blockControls: BasePluginDependenciesAPI<{ actions: { getTextInfo: (editorView: EditorView) => { textContent: string; textLength: number; }; registerNodeDecoration: (factory: NodeDecorationFactory) => void; unregisterNodeDecoration: (type: string) => void; }; commands: { ...; }; dependencies: BlockControlsPluginDe...'
|
|
418
421
|
}, {
|
|
419
422
|
name: 'config',
|
|
420
423
|
type: '{ quickInsertButtonEnabled?: boolean; rightSideControlsEnabled?: boolean; }',
|
|
@@ -833,6 +836,10 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
833
836
|
}, {
|
|
834
837
|
name: 'onColumnResize',
|
|
835
838
|
type: '(key: string, width: number) => void'
|
|
839
|
+
}, {
|
|
840
|
+
name: 'onColumnSort',
|
|
841
|
+
type: '(key: string) => void',
|
|
842
|
+
description: 'Callback to be invoked whenever a user sorts a datasource table by a column.'
|
|
836
843
|
}, {
|
|
837
844
|
name: 'onVisibleColumnKeysChange',
|
|
838
845
|
type: '(visibleColumnKeys: string[]) => void',
|
|
@@ -850,6 +857,9 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
850
857
|
name: 'scrollableContainerHeight',
|
|
851
858
|
type: 'number',
|
|
852
859
|
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.'
|
|
860
|
+
}, {
|
|
861
|
+
name: 'sortState',
|
|
862
|
+
type: '{ direction: DatasourceTableSortDirection; key: string; }'
|
|
853
863
|
}, {
|
|
854
864
|
name: 'url',
|
|
855
865
|
type: 'string',
|
|
@@ -1075,6 +1085,9 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
1075
1085
|
}, {
|
|
1076
1086
|
name: 'allowCustomPanels',
|
|
1077
1087
|
type: 'boolean'
|
|
1088
|
+
}, {
|
|
1089
|
+
name: 'allowDownloadCodeBlock',
|
|
1090
|
+
type: 'boolean'
|
|
1078
1091
|
}, {
|
|
1079
1092
|
name: 'allowFixedColumnWidthOption',
|
|
1080
1093
|
type: 'boolean'
|
|
@@ -1318,8 +1331,8 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
1318
1331
|
description: 'Show selected state of smart link.'
|
|
1319
1332
|
}, {
|
|
1320
1333
|
name: 'onClick',
|
|
1321
|
-
type: '(event: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element
|
|
1322
|
-
description: 'A callback function
|
|
1334
|
+
type: '(event: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>, data?: OnClickData) => void',
|
|
1335
|
+
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); }}'
|
|
1323
1336
|
}, {
|
|
1324
1337
|
name: 'onError',
|
|
1325
1338
|
type: '(data: { err?: Error; status: "errored" | "fallback" | "unauthorized" | "forbidden" | "not_found"; url: string; }) => void',
|
|
@@ -1773,8 +1786,8 @@ var atlaskitComponents = exports.atlaskitComponents = [{
|
|
|
1773
1786
|
description: 'Show selected state of smart link.'
|
|
1774
1787
|
}, {
|
|
1775
1788
|
name: 'onClick',
|
|
1776
|
-
type: '(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element
|
|
1777
|
-
description: 'A callback function
|
|
1789
|
+
type: '(event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>, data?: OnClickData) => void',
|
|
1790
|
+
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); }}'
|
|
1778
1791
|
}, {
|
|
1779
1792
|
name: 'onError',
|
|
1780
1793
|
type: '(data: { err?: Error; status: "errored" | "fallback" | "unauthorized" | "forbidden" | "not_found"; url: string; }) => void',
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.atlaskitHooks = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
+
*
|
|
10
|
+
* Structured content hooks from design-system *.docs.tsx files
|
|
11
|
+
*
|
|
12
|
+
* @codegen <<SignedSource::54db052ad53f695704ea4e9666a1ee4d>>
|
|
13
|
+
* @codegenCommand yarn workspace @af/ads-ai-tooling codegen:atlaskit-hooks
|
|
14
|
+
*/
|
|
15
|
+
/* eslint-disable @repo/internal/react/boolean-prop-naming-convention -- not our types */
|
|
16
|
+
|
|
17
|
+
var atlaskitHooks = exports.atlaskitHooks = [{
|
|
18
|
+
name: 'useAnalyticsEvents',
|
|
19
|
+
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.',
|
|
20
|
+
status: 'general-availability',
|
|
21
|
+
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.'],
|
|
22
|
+
keywords: ['analytics', 'hook', 'useAnalyticsEvents', 'analytics-next'],
|
|
23
|
+
category: 'analytics',
|
|
24
|
+
parameters: [],
|
|
25
|
+
returns: {
|
|
26
|
+
type: '{ createAnalyticsEvent: (payload: AnalyticsEventPayload) => UIAnalyticsEvent }',
|
|
27
|
+
description: '`createAnalyticsEvent` is referentially stable per nearest `AnalyticsContext`, so it is safe to put in dependency arrays.'
|
|
28
|
+
},
|
|
29
|
+
package: '@atlaskit/analytics-next',
|
|
30
|
+
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;"]
|
|
31
|
+
}, {
|
|
32
|
+
name: 'useCloseOnEscapePress',
|
|
33
|
+
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.',
|
|
34
|
+
status: 'general-availability',
|
|
35
|
+
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.'],
|
|
36
|
+
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.'],
|
|
37
|
+
keywords: ['layering', 'hook', 'useCloseOnEscapePress', 'escape', 'dismiss'],
|
|
38
|
+
category: 'layering',
|
|
39
|
+
parameters: [{
|
|
40
|
+
name: 'options',
|
|
41
|
+
type: '{ onClose: (e: KeyboardEvent) => void; isDisabled?: boolean }',
|
|
42
|
+
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).'
|
|
43
|
+
}],
|
|
44
|
+
returns: {
|
|
45
|
+
type: 'void'
|
|
46
|
+
},
|
|
47
|
+
package: '@atlaskit/layering',
|
|
48
|
+
examples: []
|
|
49
|
+
}, {
|
|
50
|
+
name: 'useInterval',
|
|
51
|
+
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.',
|
|
52
|
+
status: 'general-availability',
|
|
53
|
+
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.'],
|
|
54
|
+
keywords: ['hook', 'useInterval', 'setInterval', 'polling', 'frontend-utilities'],
|
|
55
|
+
category: 'hooks',
|
|
56
|
+
parameters: [{
|
|
57
|
+
name: 'callback',
|
|
58
|
+
type: '() => void',
|
|
59
|
+
description: 'Function to run on each tick. The hook keeps a ref to the latest callback, so changing it does not reset the interval.'
|
|
60
|
+
}, {
|
|
61
|
+
name: 'delay',
|
|
62
|
+
type: 'number | null',
|
|
63
|
+
description: 'Interval in milliseconds. Pass `null` to pause the timer.'
|
|
64
|
+
}],
|
|
65
|
+
returns: {
|
|
66
|
+
type: 'void'
|
|
67
|
+
},
|
|
68
|
+
package: '@atlaskit/frontend-utilities',
|
|
69
|
+
examples: []
|
|
70
|
+
}, {
|
|
71
|
+
name: 'useLayering',
|
|
72
|
+
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.',
|
|
73
|
+
status: 'general-availability',
|
|
74
|
+
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.'],
|
|
75
|
+
keywords: ['layering', 'hook', 'useLayering', 'top-layer'],
|
|
76
|
+
category: 'layering',
|
|
77
|
+
parameters: [],
|
|
78
|
+
returns: {
|
|
79
|
+
type: '{ currentLevel: number; isLayerDisabled: () => boolean; getTopLevel: () => number | null }',
|
|
80
|
+
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.'
|
|
81
|
+
},
|
|
82
|
+
package: '@atlaskit/layering',
|
|
83
|
+
examples: []
|
|
84
|
+
}, {
|
|
85
|
+
name: 'useLocalStorage',
|
|
86
|
+
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.',
|
|
87
|
+
status: 'general-availability',
|
|
88
|
+
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.'],
|
|
89
|
+
keywords: ['hook', 'useLocalStorage', 'storage', 'persistence', 'frontend-utilities'],
|
|
90
|
+
category: 'hooks',
|
|
91
|
+
parameters: [{
|
|
92
|
+
name: 'key',
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'Storage key. Changing the key swaps the underlying storage entry.'
|
|
95
|
+
}, {
|
|
96
|
+
name: 'defaultValue',
|
|
97
|
+
type: 'T',
|
|
98
|
+
description: 'Returned (and persisted) when nothing is stored under `key` yet.'
|
|
99
|
+
}],
|
|
100
|
+
returns: {
|
|
101
|
+
type: '[value: T, setValue: (value: T) => void]',
|
|
102
|
+
description: 'A React-style tuple. `setValue` writes both to component state and to local storage.'
|
|
103
|
+
},
|
|
104
|
+
package: '@atlaskit/frontend-utilities',
|
|
105
|
+
examples: []
|
|
106
|
+
}, {
|
|
107
|
+
name: 'useLocalStorageRecord',
|
|
108
|
+
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.',
|
|
109
|
+
status: 'general-availability',
|
|
110
|
+
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.'],
|
|
111
|
+
keywords: ['hook', 'useLocalStorageRecord', 'history', 'storage', 'frontend-utilities'],
|
|
112
|
+
category: 'hooks',
|
|
113
|
+
parameters: [{
|
|
114
|
+
name: 'key',
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Local storage key used to persist the list.'
|
|
117
|
+
}, {
|
|
118
|
+
name: 'initialValue',
|
|
119
|
+
type: 'T[]',
|
|
120
|
+
description: 'Initial list contents when nothing is stored yet.',
|
|
121
|
+
defaultValue: '[]',
|
|
122
|
+
isOptional: true
|
|
123
|
+
}, {
|
|
124
|
+
name: 'maxLength',
|
|
125
|
+
type: 'number',
|
|
126
|
+
description: 'Cap on stored records. Once reached, the oldest entry is dropped on the next `putRecord`. Pass `0` to disable the cap.',
|
|
127
|
+
defaultValue: '100',
|
|
128
|
+
isOptional: true
|
|
129
|
+
}],
|
|
130
|
+
returns: {
|
|
131
|
+
type: '{ records: T[]; actions: { putRecord: (record: T) => void; removeRecord: (query: string) => void } }',
|
|
132
|
+
description: '`actions` are NOT referentially stable — wrap in `useCallback` if you put them in dependency arrays.'
|
|
133
|
+
},
|
|
134
|
+
package: '@atlaskit/frontend-utilities',
|
|
135
|
+
examples: []
|
|
136
|
+
}, {
|
|
137
|
+
name: 'usePrevious',
|
|
138
|
+
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.',
|
|
139
|
+
status: 'general-availability',
|
|
140
|
+
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.'],
|
|
141
|
+
keywords: ['hook', 'usePrevious', 'previous-value', 'frontend-utilities'],
|
|
142
|
+
category: 'hooks',
|
|
143
|
+
parameters: [{
|
|
144
|
+
name: 'value',
|
|
145
|
+
type: 'T',
|
|
146
|
+
description: 'The value to track across renders.'
|
|
147
|
+
}],
|
|
148
|
+
returns: {
|
|
149
|
+
type: 'T | undefined',
|
|
150
|
+
description: '`undefined` on the first render, otherwise the value passed on the previous render.'
|
|
151
|
+
},
|
|
152
|
+
package: '@atlaskit/frontend-utilities',
|
|
153
|
+
examples: []
|
|
154
|
+
}, {
|
|
155
|
+
name: 'useWhyDidUpdate',
|
|
156
|
+
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.',
|
|
157
|
+
status: 'general-availability',
|
|
158
|
+
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."],
|
|
159
|
+
keywords: ['hook', 'useWhyDidUpdate', 'debug', 'rerender', 'frontend-utilities'],
|
|
160
|
+
category: 'hooks',
|
|
161
|
+
parameters: [{
|
|
162
|
+
name: 'name',
|
|
163
|
+
type: 'string',
|
|
164
|
+
description: 'Label printed in the console log (typically the component name).'
|
|
165
|
+
}, {
|
|
166
|
+
name: 'deps',
|
|
167
|
+
type: 'any[]',
|
|
168
|
+
description: 'Dependency array to compare across renders.'
|
|
169
|
+
}, {
|
|
170
|
+
name: 'depsNames',
|
|
171
|
+
type: 'string[]',
|
|
172
|
+
description: 'Optional per-dependency labels for the log output. Falls back to `dep_<index>`.',
|
|
173
|
+
isOptional: true
|
|
174
|
+
}],
|
|
175
|
+
returns: {
|
|
176
|
+
type: 'void'
|
|
177
|
+
},
|
|
178
|
+
package: '@atlaskit/frontend-utilities',
|
|
179
|
+
examples: []
|
|
180
|
+
}, {
|
|
181
|
+
name: 'useWhyDidUpdateShallow',
|
|
182
|
+
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.',
|
|
183
|
+
status: 'general-availability',
|
|
184
|
+
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.'],
|
|
185
|
+
keywords: ['hook', 'useWhyDidUpdateShallow', 'debug', 'rerender', 'frontend-utilities'],
|
|
186
|
+
category: 'hooks',
|
|
187
|
+
parameters: [{
|
|
188
|
+
name: 'name',
|
|
189
|
+
type: 'string',
|
|
190
|
+
description: 'Label printed in the console log (typically the component name).'
|
|
191
|
+
}, {
|
|
192
|
+
name: 'deps',
|
|
193
|
+
type: 'any[]',
|
|
194
|
+
description: 'Dependency array to compare across renders.'
|
|
195
|
+
}, {
|
|
196
|
+
name: 'depsNames',
|
|
197
|
+
type: 'string[]',
|
|
198
|
+
description: 'Optional per-dependency labels for the log output.',
|
|
199
|
+
isOptional: true
|
|
200
|
+
}],
|
|
201
|
+
returns: {
|
|
202
|
+
type: 'void'
|
|
203
|
+
},
|
|
204
|
+
package: '@atlaskit/frontend-utilities',
|
|
205
|
+
examples: []
|
|
206
|
+
}];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getAtlaskitHooksTool = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _atlaskitHooks = require("./atlaskit-hooks.codegen");
|
|
11
|
+
/* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
12
|
+
|
|
13
|
+
var getAtlaskitHooksTool = exports.getAtlaskitHooksTool = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
15
|
+
var hooks;
|
|
16
|
+
return _regenerator.default.wrap(function (_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
hooks = _atlaskitHooks.atlaskitHooks.map(function (hook) {
|
|
20
|
+
return {
|
|
21
|
+
name: hook.name,
|
|
22
|
+
package: hook.package
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return _context.abrupt("return", {
|
|
26
|
+
content: [{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: JSON.stringify(hooks, null, 2)
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
case 1:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}, _callee);
|
|
36
|
+
}));
|
|
37
|
+
return function getAtlaskitHooksTool() {
|
|
38
|
+
return _ref.apply(this, arguments);
|
|
39
|
+
};
|
|
40
|
+
}();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.listGetAtlaskitHooksTool = void 0;
|
|
7
|
+
var _zod = require("zod");
|
|
8
|
+
var _helpers = require("../../helpers");
|
|
9
|
+
/* eslint-disable-next-line import/extensions -- MCP SDK requires .js extensions for ESM imports */
|
|
10
|
+
|
|
11
|
+
var listGetAtlaskitHooksTool = exports.listGetAtlaskitHooksTool = {
|
|
12
|
+
name: 'atlaskit_get_hooks',
|
|
13
|
+
description: "Returns the names and packages of all atlaskit hooks excluding hooks covered by the Atlassian Design System.\n\nWHEN TO USE:\nUse this when you want to see what hooks are available without the full metadata payload.\n\nNo parameters.",
|
|
14
|
+
annotations: {
|
|
15
|
+
title: 'Get all Atlaskit hooks',
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: true,
|
|
19
|
+
openWorldHint: true
|
|
20
|
+
},
|
|
21
|
+
inputSchema: (0, _helpers.zodToJsonSchema)(_zod.z.object({}))
|
|
22
|
+
};
|