@atlaskit/editor-common 134.18.0 → 134.20.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/alignment-icon-map/package.json +10 -0
  3. package/credit-guard/check-ai-credit-status/package.json +10 -0
  4. package/credit-guard/popup/package.json +10 -0
  5. package/credit-guard/types/package.json +10 -0
  6. package/credit-guard/use-ai-credit-guard/package.json +10 -0
  7. package/credit-guard/use-ai-credit-status/package.json +10 -0
  8. package/credit-guard/use-credit-checked-action/package.json +10 -0
  9. package/dist/cjs/credit-guard/useAICreditStatus.js +40 -0
  10. package/dist/cjs/credit-guard/useCreditCheckedAction.js +19 -0
  11. package/dist/cjs/extensibility/Extension/InlineExtension/index.js +15 -5
  12. package/dist/cjs/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  13. package/dist/cjs/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  14. package/dist/cjs/media/messages/caption.js +5 -0
  15. package/dist/cjs/messages/rule.js +10 -0
  16. package/dist/cjs/monitoring/error.js +1 -1
  17. package/dist/cjs/table/normalize-column-widths.js +68 -0
  18. package/dist/cjs/ui/DropList/index.js +1 -1
  19. package/dist/cjs/ui/OverflowShadow/index.js +31 -1
  20. package/dist/cjs/ui/alignment-icon-map.js +40 -0
  21. package/dist/es2019/credit-guard/useAICreditStatus.js +26 -0
  22. package/dist/es2019/credit-guard/useCreditCheckedAction.js +13 -0
  23. package/dist/es2019/extensibility/Extension/InlineExtension/index.js +15 -5
  24. package/dist/es2019/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  25. package/dist/es2019/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  26. package/dist/es2019/media/messages/caption.js +5 -0
  27. package/dist/es2019/messages/rule.js +10 -0
  28. package/dist/es2019/monitoring/error.js +1 -1
  29. package/dist/es2019/table/normalize-column-widths.js +46 -0
  30. package/dist/es2019/ui/DropList/index.js +1 -1
  31. package/dist/es2019/ui/OverflowShadow/index.js +29 -1
  32. package/dist/es2019/ui/alignment-icon-map.js +34 -0
  33. package/dist/esm/credit-guard/useAICreditStatus.js +33 -0
  34. package/dist/esm/credit-guard/useCreditCheckedAction.js +13 -0
  35. package/dist/esm/extensibility/Extension/InlineExtension/index.js +15 -5
  36. package/dist/esm/extensibility/Extension/Lozenge/ExtensionLabel.js +19 -5
  37. package/dist/esm/extensibility/Extension/Lozenge/LozengeComponent.js +4 -1
  38. package/dist/esm/media/messages/caption.js +5 -0
  39. package/dist/esm/messages/rule.js +10 -0
  40. package/dist/esm/monitoring/error.js +1 -1
  41. package/dist/esm/table/normalize-column-widths.js +63 -0
  42. package/dist/esm/ui/DropList/index.js +1 -1
  43. package/dist/esm/ui/OverflowShadow/index.js +31 -1
  44. package/dist/esm/ui/alignment-icon-map.js +33 -0
  45. package/dist/types/credit-guard/types.d.ts +16 -1
  46. package/dist/types/credit-guard/useAICreditStatus.d.ts +3 -0
  47. package/dist/types/credit-guard/useCreditCheckedAction.d.ts +3 -0
  48. package/dist/types/media/messages/caption.d.ts +5 -0
  49. package/dist/types/messages/rule.d.ts +10 -0
  50. package/dist/types/table/normalize-column-widths.d.ts +10 -0
  51. package/dist/types/ui/OverflowShadow/index.d.ts +2 -0
  52. package/dist/types/ui/alignment-icon-map.d.ts +8 -0
  53. package/package.json +10 -10
  54. package/table/normalize-column-widths/package.json +10 -0
@@ -108,6 +108,9 @@ export default function overflowShadow(Component, options) {
108
108
  return _createClass(OverflowShadow, [{
109
109
  key: "isDisabled",
110
110
  get: function get() {
111
+ if (this.props.disableShadowTracking) {
112
+ return true;
113
+ }
111
114
  if (this.disabled === undefined) {
112
115
  var _options$isDisabled, _options$isDisabled2;
113
116
  this.disabled = (_options$isDisabled = (_options$isDisabled2 = options.isDisabled) === null || _options$isDisabled2 === void 0 ? void 0 : _options$isDisabled2.call(options)) !== null && _options$isDisabled !== void 0 ? _options$isDisabled : false;
@@ -129,7 +132,20 @@ export default function overflowShadow(Component, options) {
129
132
  }
130
133
  }, {
131
134
  key: "componentDidUpdate",
132
- value: function componentDidUpdate() {
135
+ value: function componentDidUpdate(prevProps) {
136
+ if (this.props.disableShadowTracking !== prevProps.disableShadowTracking) {
137
+ if (this.props.disableShadowTracking) {
138
+ var _this$shadowObserver, _this$overflowContain;
139
+ (_this$shadowObserver = this.shadowObserver) === null || _this$shadowObserver === void 0 || _this$shadowObserver.dispose();
140
+ this.shadowObserver = undefined;
141
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
142
+ (_this$overflowContain = this.overflowContainer) === null || _this$overflowContain === void 0 || _this$overflowContain.removeEventListener('scroll', this.handleScroll);
143
+ } else if (prevProps.disableShadowTracking && this.container) {
144
+ var container = this.container;
145
+ this.container = undefined;
146
+ this.handleContainer(container);
147
+ }
148
+ }
133
149
  if (!options.useShadowObserver) {
134
150
  this.updateShadows();
135
151
  }
@@ -144,6 +160,9 @@ export default function overflowShadow(Component, options) {
144
160
  this.shadowObserver = new ShadowObserver({
145
161
  scrollContainer: this.overflowContainer,
146
162
  onUpdateShadows: function onUpdateShadows(shadowStates) {
163
+ if (_this2.props.disableShadowTracking) {
164
+ return;
165
+ }
147
166
  _this2.setState(function (prevState) {
148
167
  var showLeftShadow = shadowStates.showLeftShadow,
149
168
  showRightShadow = shadowStates.showRightShadow;
@@ -182,6 +201,17 @@ export default function overflowShadow(Component, options) {
182
201
  // eslint-disable-next-line react/jsx-props-no-spreading -- Spreading props to pass all component props through to wrapped generic component
183
202
  }, this.props));
184
203
  }
204
+ }], [{
205
+ key: "getDerivedStateFromProps",
206
+ value: function getDerivedStateFromProps(props, state) {
207
+ if (props.disableShadowTracking && (state.showLeftShadow || state.showRightShadow)) {
208
+ return {
209
+ showLeftShadow: false,
210
+ showRightShadow: false
211
+ };
212
+ }
213
+ return null;
214
+ }
185
215
  }]);
186
216
  }(React.Component);
187
217
  }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import AlignTextCenterIcon from '@atlaskit/icon/core/align-text-center';
4
+ import AlignTextLeftIcon from '@atlaskit/icon/core/align-text-left';
5
+ import AlignTextRightIcon from '@atlaskit/icon/core/align-text-right';
6
+ import { alignmentMessages as messages } from '../messages/alignment';
7
+ var iconAndMessageMap = {
8
+ start: {
9
+ Component: AlignTextLeftIcon,
10
+ label: messages.alignLeft
11
+ },
12
+ end: {
13
+ Component: AlignTextRightIcon,
14
+ label: messages.alignRight
15
+ },
16
+ center: {
17
+ Component: AlignTextCenterIcon,
18
+ label: messages.alignCenter
19
+ }
20
+ };
21
+ export var AlignmentIconMap = function AlignmentIconMap(props) {
22
+ var _iconAndMessageMap$pr, _props$size;
23
+ var _ref = (_iconAndMessageMap$pr = iconAndMessageMap[props.alignment]) !== null && _iconAndMessageMap$pr !== void 0 ? _iconAndMessageMap$pr : iconAndMessageMap.center,
24
+ Component = _ref.Component,
25
+ label = _ref.label;
26
+ var intl = useIntl();
27
+ return /*#__PURE__*/React.createElement(Component, {
28
+ label: intl.formatMessage(label),
29
+ color: "currentColor",
30
+ spacing: "spacious",
31
+ size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : 'medium'
32
+ });
33
+ };
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- export type EditorAICreditFeatureName = 'blockMenu-askRovo' | 'selectionToolbar-askRovo' | 'selectionToolbar-remix' | 'commentEditor-askRovo' | 'quickInsert-askRovo' | 'elementBrowser-askRovo' | 'panelFloatingToolbar-remix' | 'primaryToolbar-write' | 'mediaFloatingToolbar-editImage' | 'tableFloatingToolbar-remix' | 'smartLinkFloatingToolbar-askRovo' | 'codeBlockFloatingToolbar-remix' | 'imageGenerationMediaInsert';
2
+ export type EditorAICreditFeatureName = 'blockMenu-askRovo' | 'selectionToolbar-askRovo' | 'selectionToolbar-remix' | 'commentEditor-askRovo' | 'quickInsert-askRovo' | 'elementBrowser-askRovo' | 'panelFloatingToolbar-remix' | 'primaryToolbar-write' | 'mediaFloatingToolbar-editImage' | 'tableFloatingToolbar-remix' | 'smartLinkFloatingToolbar-askRovo' | 'codeBlockFloatingToolbar-remix' | 'imageGenerationMediaInsert' | 'blockControls-remix';
3
3
  export type AICreditCheck = {
4
4
  featureName: EditorAICreditFeatureName;
5
5
  };
@@ -11,3 +11,18 @@ export type AICreditStatus = {
11
11
  };
12
12
  /** Supply a synchronous cached decision. Promise typing remains temporarily for legacy consumers. */
13
13
  export type GetAICreditStatus = (context: AICreditCheck) => AICreditStatus | Promise<AICreditStatus>;
14
+ /** Product-owned credit decisions, optionally invalidated without rebuilding an Editor preset. */
15
+ export type EditorAICreditStatusProvider = {
16
+ /**
17
+ * Supply a synchronous cached product decision. The entry point identifies the requested
18
+ * feature; products own rollout policy, analytics attribution, and blocked content.
19
+ * Unavailable or legacy Promise decisions fail open. Omit to preserve existing behavior.
20
+ */
21
+ getAICreditStatus?: GetAICreditStatus;
22
+ /**
23
+ * Optional notification that cached decisions changed. Consumers synchronously re-read
24
+ * getAICreditStatus. Products own the subscription and return an unsubscribe function.
25
+ * Omit for action-time checks that need no live updates.
26
+ */
27
+ subscribeToAICreditStatus?: (onChange: () => void) => () => void;
28
+ };
@@ -0,0 +1,3 @@
1
+ import type { AICreditCheck, AICreditStatus, EditorAICreditStatusProvider } from './types';
2
+ /** Reuses cached product decisions; notifications preserve live depletion and recovery. */
3
+ export declare const useAICreditStatus: (provider: EditorAICreditStatusProvider | undefined, featureName: AICreditCheck['featureName'], isActive?: boolean) => AICreditStatus;
@@ -0,0 +1,3 @@
1
+ import type { AICreditCheck, EditorAICreditStatusProvider } from './types';
2
+ /** Recheck synchronously at activation using the same shared guard as other Editor actions. */
3
+ export declare const useCreditCheckedAction: (provider: EditorAICreditStatusProvider | undefined, featureName: AICreditCheck['featureName']) => ((action: () => void) => void);
@@ -4,6 +4,11 @@ export declare const captionMessages: {
4
4
  defaultMessage: string;
5
5
  description: string;
6
6
  };
7
+ placeholderWithClickAgainPrompt: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
7
12
  placeholderWithDoubleClickPrompt: {
8
13
  id: string;
9
14
  defaultMessage: string;
@@ -1,4 +1,14 @@
1
1
  export declare const ruleMessages: {
2
+ addText: {
3
+ defaultMessage: string;
4
+ description: string;
5
+ id: string;
6
+ };
7
+ alignText: {
8
+ defaultMessage: string;
9
+ description: string;
10
+ id: string;
11
+ };
2
12
  boldGrayDividerColor: {
3
13
  defaultMessage: string;
4
14
  description: string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Fits columns to a saved table width, independently of the viewport. Zero widths share the
3
+ * remaining space; minimum widths can require overflow when the saved table is too narrow.
4
+ */
5
+ export declare const normalizeTableColumnWidths: ({ columnWidths, isNumberColumnEnabled, skipMinWidth, tableWidth, }: {
6
+ columnWidths: number[];
7
+ isNumberColumnEnabled: boolean;
8
+ skipMinWidth?: boolean;
9
+ tableWidth: number;
10
+ }) => number[];
@@ -4,6 +4,8 @@ export declare const shadowClassNames: {
4
4
  LEFT_SHADOW: string;
5
5
  };
6
6
  export interface OverflowShadowProps {
7
+ /** Skip shadow observers and listeners, rather than only hiding their output. */
8
+ disableShadowTracking?: boolean;
7
9
  disableTableOverflowShadow?: boolean;
8
10
  handleRef?: (ref: HTMLElement | null) => void;
9
11
  shadowClassNames?: string;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { IconSize } from '@atlaskit/icon/types';
3
+ type Props = {
4
+ alignment: 'start' | 'end' | 'center';
5
+ size?: IconSize;
6
+ };
7
+ export declare const AlignmentIconMap: (props: Props) => React.JSX.Element;
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "134.18.0",
3
+ "version": "134.20.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -47,12 +47,12 @@
47
47
  "@atlaskit/editor-prosemirror": "^9.0.0",
48
48
  "@atlaskit/editor-shared-styles": "^5.1.0",
49
49
  "@atlaskit/editor-tables": "^3.2.0",
50
- "@atlaskit/editor-toolbar": "^2.10.0",
50
+ "@atlaskit/editor-toolbar": "^2.11.0",
51
51
  "@atlaskit/editor-toolbar-model": "^1.2.0",
52
52
  "@atlaskit/editor-ui-control-model": "^3.0.0",
53
53
  "@atlaskit/emoji": "^73.6.0",
54
54
  "@atlaskit/feature-gate-js-client": "^8.0.0",
55
- "@atlaskit/icon": "^38.0.0",
55
+ "@atlaskit/icon": "^38.1.0",
56
56
  "@atlaskit/link": "^5.1.0",
57
57
  "@atlaskit/link-datasource": "^7.13.0",
58
58
  "@atlaskit/link-picker": "^6.20.0",
@@ -63,9 +63,9 @@
63
63
  "@atlaskit/media-common": "^14.7.0",
64
64
  "@atlaskit/media-file-preview": "^2.0.0",
65
65
  "@atlaskit/media-picker": "^73.3.0",
66
- "@atlaskit/media-ui": "^31.9.0",
66
+ "@atlaskit/media-ui": "^31.10.0",
67
67
  "@atlaskit/media-viewer": "^54.12.0",
68
- "@atlaskit/mention": "^30.9.0",
68
+ "@atlaskit/mention": "^30.10.0",
69
69
  "@atlaskit/menu": "^11.0.0",
70
70
  "@atlaskit/object": "^2.3.0",
71
71
  "@atlaskit/onboarding": "^15.4.0",
@@ -75,19 +75,19 @@
75
75
  "@atlaskit/popper": "^9.4.0",
76
76
  "@atlaskit/popup": "^10.2.0",
77
77
  "@atlaskit/primitives": "^22.7.0",
78
- "@atlaskit/profilecard": "^27.9.0",
78
+ "@atlaskit/profilecard": "^27.10.0",
79
79
  "@atlaskit/prosemirror-history": "^1.3.0",
80
80
  "@atlaskit/react-compiler-gating": "^0.2.0",
81
- "@atlaskit/react-ufo": "^8.4.0",
82
- "@atlaskit/section-message": "^10.2.0",
81
+ "@atlaskit/react-ufo": "^8.5.0",
82
+ "@atlaskit/section-message": "^10.3.0",
83
83
  "@atlaskit/smart-card": "^46.14.0",
84
84
  "@atlaskit/smart-user-picker": "^12.12.0",
85
85
  "@atlaskit/spinner": "^20.4.0",
86
86
  "@atlaskit/task-decision": "^21.16.0",
87
87
  "@atlaskit/teams-app-config": "^3.1.0",
88
88
  "@atlaskit/textfield": "^10.3.0",
89
- "@atlaskit/tmp-editor-statsig": "^262.0.0",
90
- "@atlaskit/tokens": "^20.11.0",
89
+ "@atlaskit/tmp-editor-statsig": "^263.0.0",
90
+ "@atlaskit/tokens": "^20.12.0",
91
91
  "@atlaskit/tooltip": "^24.4.0",
92
92
  "@atlaskit/width-detector": "^7.2.0",
93
93
  "@babel/runtime": "^7.0.0",
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/table/normalize-column-widths",
3
+ "main": "../../dist/cjs/table/normalize-column-widths.js",
4
+ "module": "../../dist/esm/table/normalize-column-widths.js",
5
+ "module:es2019": "../../dist/es2019/table/normalize-column-widths.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/table/normalize-column-widths.d.ts"
10
+ }