@atlaskit/adf-schema 33.2.3 → 34.0.1
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 +12 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/schema/marks/text-color.js +8 -1
- package/dist/cjs/schema/nodes/multi-bodied-extension.js +1 -1
- package/dist/cjs/schema/nodes/tableNodes.js +8 -1
- package/dist/cjs/utils/index.js +8 -1
- package/dist/cjs/utils/lch-color-inversion.js +150 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/marks/text-color.js +8 -1
- package/dist/es2019/schema/nodes/multi-bodied-extension.js +1 -1
- package/dist/es2019/schema/nodes/tableNodes.js +8 -1
- package/dist/es2019/utils/index.js +2 -1
- package/dist/es2019/utils/lch-color-inversion.js +128 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/marks/text-color.js +8 -1
- package/dist/esm/schema/nodes/multi-bodied-extension.js +1 -1
- package/dist/esm/schema/nodes/tableNodes.js +8 -1
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/lch-color-inversion.js +142 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/lch-color-inversion.d.ts +2 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 34.0.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 726054a: ED-21266: updated extensionFrame to be non-selectable to address selection issue
|
8
|
+
|
9
|
+
## 34.0.0
|
10
|
+
|
11
|
+
### Major Changes
|
12
|
+
|
13
|
+
- 8132ac3: ED-20699 Add LCH color inversion method behind feature flag platform.editor.use-lch-for-color-inversion_1qv8ol for text and table cell background colors. Also adds @atlaskit/platform-feature-flags as a devDep.
|
14
|
+
|
3
15
|
## 33.2.3
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
@@ -567,6 +567,12 @@ Object.defineProperty(exports, "getCellDomAttrs", {
|
|
567
567
|
return _schema.getCellDomAttrs;
|
568
568
|
}
|
569
569
|
});
|
570
|
+
Object.defineProperty(exports, "getDarkModeLCHColor", {
|
571
|
+
enumerable: true,
|
572
|
+
get: function get() {
|
573
|
+
return _utils.getDarkModeLCHColor;
|
574
|
+
}
|
575
|
+
});
|
570
576
|
Object.defineProperty(exports, "getEmojiAcName", {
|
571
577
|
enumerable: true,
|
572
578
|
get: function get() {
|
@@ -10,6 +10,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
10
10
|
var _editorPalette = require("../../utils/editor-palette");
|
11
11
|
var _groups = require("../groups");
|
12
12
|
var _colors = require("../../utils/colors");
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
14
|
+
var _lchColorInversion = require("../../utils/lch-color-inversion");
|
13
15
|
/**
|
14
16
|
* @name textColor_mark
|
15
17
|
*/
|
@@ -197,7 +199,12 @@ var textColor = {
|
|
197
199
|
} else {
|
198
200
|
if (getGlobalTheme().colorMode === 'dark') {
|
199
201
|
// if we have a custom color, we need to check if we are in dark mode
|
200
|
-
|
202
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
203
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
204
|
+
paletteColorValue = (0, _lchColorInversion.getDarkModeLCHColor)(mark.attrs.color);
|
205
|
+
} else {
|
206
|
+
paletteColorValue = invertCustomColor(mark.attrs.color);
|
207
|
+
}
|
201
208
|
} else {
|
202
209
|
// if we are in light mode, we can just set the color
|
203
210
|
paletteColorValue = mark.attrs.color;
|
@@ -10,6 +10,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
10
10
|
var _editorPalette = require("../../utils/editor-palette");
|
11
11
|
var _colors = require("../../utils/colors");
|
12
12
|
var _uuid = require("../../utils/uuid");
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
14
|
+
var _lchColorInversion = require("../../utils/lch-color-inversion");
|
13
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
14
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
15
17
|
var tablePrefixSelector = 'pm-table';
|
@@ -170,7 +172,12 @@ var getCellDomAttrs = function getCellDomAttrs(node) {
|
|
170
172
|
// if we have a custom color, we need to check if we are in dark mode
|
171
173
|
if (getGlobalTheme().colorMode === 'dark') {
|
172
174
|
// if we have a custom color, we need to check if we are in dark mode
|
173
|
-
|
175
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
176
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
177
|
+
attrs.style = "background-color: ".concat((0, _lchColorInversion.getDarkModeLCHColor)(color), ";");
|
178
|
+
} else {
|
179
|
+
attrs.style = "background-color: ".concat(invertCustomColor(color), ";");
|
180
|
+
}
|
174
181
|
} else {
|
175
182
|
// if we are in light mode, we can just set the color
|
176
183
|
attrs.style = "background-color: ".concat(background, ";");
|
package/dist/cjs/utils/index.js
CHANGED
@@ -297,6 +297,12 @@ Object.defineProperty(exports, "generateUuid", {
|
|
297
297
|
return _uuid.generateUuid;
|
298
298
|
}
|
299
299
|
});
|
300
|
+
Object.defineProperty(exports, "getDarkModeLCHColor", {
|
301
|
+
enumerable: true,
|
302
|
+
get: function get() {
|
303
|
+
return _lchColorInversion.getDarkModeLCHColor;
|
304
|
+
}
|
305
|
+
});
|
300
306
|
Object.defineProperty(exports, "getEmojiAcName", {
|
301
307
|
enumerable: true,
|
302
308
|
get: function get() {
|
@@ -378,4 +384,5 @@ Object.defineProperty(exports, "uuid", {
|
|
378
384
|
var _emoji = require("./confluence/emoji");
|
379
385
|
var _uuid = require("./uuid");
|
380
386
|
var _colors = require("./colors");
|
381
|
-
var _url = require("./url");
|
387
|
+
var _url = require("./url");
|
388
|
+
var _lchColorInversion = require("./lch-color-inversion");
|
@@ -0,0 +1,150 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getDarkModeLCHColor = exports.clampLightness = void 0;
|
7
|
+
// https://en.wikipedia.org/wiki/HCL_color_space
|
8
|
+
|
9
|
+
// https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
|
10
|
+
|
11
|
+
// https://en.wikipedia.org/wiki/CIELAB_color_space
|
12
|
+
|
13
|
+
var clamp = function clamp(i, min, max) {
|
14
|
+
return Math.round(Math.min(Math.max(i, min), max));
|
15
|
+
};
|
16
|
+
var expandShorthandHex = function expandShorthandHex(input) {
|
17
|
+
return input.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) {
|
18
|
+
return r + r + g + g + b + b;
|
19
|
+
});
|
20
|
+
};
|
21
|
+
var rgbFromHex = function rgbFromHex(input) {
|
22
|
+
var fullHex = expandShorthandHex(input);
|
23
|
+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(fullHex);
|
24
|
+
return result === null ? null : {
|
25
|
+
r: parseInt(result[1], 16),
|
26
|
+
g: parseInt(result[2], 16),
|
27
|
+
b: parseInt(result[3], 16)
|
28
|
+
};
|
29
|
+
};
|
30
|
+
var rgbToHex = function rgbToHex(_ref) {
|
31
|
+
var r = _ref.r,
|
32
|
+
g = _ref.g,
|
33
|
+
b = _ref.b;
|
34
|
+
var convertComponent = function convertComponent(c) {
|
35
|
+
var cBase16 = c.toString(16);
|
36
|
+
return cBase16.length === 1 ? "0".concat(cBase16) : cBase16;
|
37
|
+
};
|
38
|
+
return "#".concat(convertComponent(r)).concat(convertComponent(g)).concat(convertComponent(b));
|
39
|
+
};
|
40
|
+
var rgbToXyz = function rgbToXyz(rgb) {
|
41
|
+
var convertRgbComponent = function convertRgbComponent(c) {
|
42
|
+
return c > 0.04045 ? Math.pow((c + 0.055) / 1.055, 2.4) : c / 12.92;
|
43
|
+
};
|
44
|
+
var convertXyzComponent = function convertXyzComponent(c) {
|
45
|
+
return c > 0.008856452 ? Math.pow(c, 1 / 3) : c / 0.12841855 + 0.137931034;
|
46
|
+
};
|
47
|
+
var r = convertRgbComponent(rgb.r / 255);
|
48
|
+
var g = convertRgbComponent(rgb.g / 255);
|
49
|
+
var b = convertRgbComponent(rgb.b / 255);
|
50
|
+
return {
|
51
|
+
x: convertXyzComponent((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047),
|
52
|
+
y: convertXyzComponent(0.2126729 * r + 0.7151522 * g + 0.072175 * b),
|
53
|
+
z: convertXyzComponent((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883)
|
54
|
+
};
|
55
|
+
};
|
56
|
+
var xyzToLab = function xyzToLab(_ref2) {
|
57
|
+
var x = _ref2.x,
|
58
|
+
y = _ref2.y,
|
59
|
+
z = _ref2.z;
|
60
|
+
return {
|
61
|
+
l: Math.max(116 * y - 16, 0),
|
62
|
+
a: 500 * (x - y),
|
63
|
+
b: 200 * (y - z)
|
64
|
+
};
|
65
|
+
};
|
66
|
+
var labToLch = function labToLch(_ref3) {
|
67
|
+
var l = _ref3.l,
|
68
|
+
a = _ref3.a,
|
69
|
+
b = _ref3.b;
|
70
|
+
var h = (Math.atan2(b, a) * (180 / Math.PI) + 360) % 360;
|
71
|
+
var c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
|
72
|
+
if (Math.round(c * 10000) === 0) h = Number.NaN;
|
73
|
+
return {
|
74
|
+
l: l,
|
75
|
+
c: c,
|
76
|
+
h: h
|
77
|
+
};
|
78
|
+
};
|
79
|
+
var lchToLab = function lchToLab(_ref4) {
|
80
|
+
var l = _ref4.l,
|
81
|
+
c = _ref4.c,
|
82
|
+
h = _ref4.h;
|
83
|
+
var convertH = Number.isNaN(h) ? 0 : h * (Math.PI / 180);
|
84
|
+
return {
|
85
|
+
l: l,
|
86
|
+
a: Math.cos(convertH) * c,
|
87
|
+
b: Math.sin(convertH) * c
|
88
|
+
};
|
89
|
+
};
|
90
|
+
var labToXyz = function labToXyz(_ref5) {
|
91
|
+
var l = _ref5.l,
|
92
|
+
a = _ref5.a,
|
93
|
+
b = _ref5.b;
|
94
|
+
var convertComponent = function convertComponent(c) {
|
95
|
+
return c > 0.206896552 ? Math.pow(c, 3) : 0.12841855 * (c - 0.137931034);
|
96
|
+
};
|
97
|
+
var y = (l + 16) / 116;
|
98
|
+
var x = a / 500 + y;
|
99
|
+
var z = y - b / 200;
|
100
|
+
return {
|
101
|
+
x: convertComponent(x) * 0.95047,
|
102
|
+
y: convertComponent(y),
|
103
|
+
z: convertComponent(z) * 1.08883
|
104
|
+
};
|
105
|
+
};
|
106
|
+
var xyzToRgb = function xyzToRgb(_ref6) {
|
107
|
+
var x = _ref6.x,
|
108
|
+
y = _ref6.y,
|
109
|
+
z = _ref6.z;
|
110
|
+
var convertComponent = function convertComponent(c) {
|
111
|
+
return 255 * (c <= 0.00304 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055);
|
112
|
+
};
|
113
|
+
return {
|
114
|
+
r: clamp(convertComponent(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), 0, 255),
|
115
|
+
g: clamp(convertComponent(-0.969266 * x + 1.8760108 * y + 0.041556 * z), 0, 255),
|
116
|
+
b: clamp(convertComponent(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), 0, 255)
|
117
|
+
};
|
118
|
+
};
|
119
|
+
var rgbToLch = function rgbToLch(rgb) {
|
120
|
+
return labToLch(xyzToLab(rgbToXyz(rgb)));
|
121
|
+
};
|
122
|
+
var lchToRgb = function lchToRgb(lch) {
|
123
|
+
return xyzToRgb(labToXyz(lchToLab(lch)));
|
124
|
+
};
|
125
|
+
var clampLightness = function clampLightness(color, newPercent) {
|
126
|
+
var rgb = rgbFromHex(color);
|
127
|
+
if (rgb === null) {
|
128
|
+
return color;
|
129
|
+
}
|
130
|
+
|
131
|
+
// LCH (rather than HSL) gives the best results here as the L component in LCH is based on human color perception
|
132
|
+
var lch = rgbToLch(rgb);
|
133
|
+
lch.l = clamp(newPercent, 0, 100);
|
134
|
+
return rgbToHex(lchToRgb(lch));
|
135
|
+
};
|
136
|
+
exports.clampLightness = clampLightness;
|
137
|
+
var getLightness = function getLightness(color) {
|
138
|
+
var rgb = rgbFromHex(color);
|
139
|
+
if (rgb === null) {
|
140
|
+
return 0;
|
141
|
+
}
|
142
|
+
var lch = rgbToLch(rgb);
|
143
|
+
return lch.l;
|
144
|
+
};
|
145
|
+
var getDarkModeLCHColor = function getDarkModeLCHColor(currentBackgroundColor) {
|
146
|
+
var lightness = getLightness(currentBackgroundColor);
|
147
|
+
var newLightness = Math.abs(100 - lightness);
|
148
|
+
return clampLightness(currentBackgroundColor, newLightness).toUpperCase();
|
149
|
+
};
|
150
|
+
exports.getDarkModeLCHColor = getDarkModeLCHColor;
|
package/dist/es2019/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
2
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension } from './schema';
|
3
|
-
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
3
|
+
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor } from './utils';
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
|
2
2
|
import { COLOR } from '../groups';
|
3
3
|
import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, isHex, isRgb } from '../../utils/colors';
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
5
|
+
import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
|
4
6
|
|
5
7
|
/**
|
6
8
|
* @name textColor_mark
|
@@ -181,7 +183,12 @@ export const textColor = {
|
|
181
183
|
} else {
|
182
184
|
if (getGlobalTheme().colorMode === 'dark') {
|
183
185
|
// if we have a custom color, we need to check if we are in dark mode
|
184
|
-
|
186
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
187
|
+
if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
188
|
+
paletteColorValue = getDarkModeLCHColor(mark.attrs.color);
|
189
|
+
} else {
|
190
|
+
paletteColorValue = invertCustomColor(mark.attrs.color);
|
191
|
+
}
|
185
192
|
} else {
|
186
193
|
// if we are in light mode, we can just set the color
|
187
194
|
paletteColorValue = mark.attrs.color;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { hexToEditorBackgroundPaletteRawValue } from '../../utils/editor-palette';
|
2
2
|
import { B100, B50, B75, G200, G50, G75, hexToRgba, isHex, isRgb, N0, N20, N60, N800, P100, P50, P75, R100, R50, R75, rgbToHex, T100, T50, T75, Y200, Y50, Y75 } from '../../utils/colors';
|
3
3
|
import { uuid } from '../../utils/uuid';
|
4
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
5
|
+
import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
|
4
6
|
export const tablePrefixSelector = 'pm-table';
|
5
7
|
export const tableCellSelector = `${tablePrefixSelector}-cell-content-wrap`;
|
6
8
|
export const tableHeaderSelector = `${tablePrefixSelector}-header-content-wrap`;
|
@@ -153,7 +155,12 @@ export const getCellDomAttrs = node => {
|
|
153
155
|
// if we have a custom color, we need to check if we are in dark mode
|
154
156
|
if (getGlobalTheme().colorMode === 'dark') {
|
155
157
|
// if we have a custom color, we need to check if we are in dark mode
|
156
|
-
|
158
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
159
|
+
if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
160
|
+
attrs.style = `background-color: ${getDarkModeLCHColor(color)};`;
|
161
|
+
} else {
|
162
|
+
attrs.style = `background-color: ${invertCustomColor(color)};`;
|
163
|
+
}
|
157
164
|
} else {
|
158
165
|
// if we are in light mode, we can just set the color
|
159
166
|
attrs.style = `background-color: ${background};`;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export { acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, getEmojiAcName } from './confluence/emoji';
|
2
2
|
export { generateUuid, uuid } from './uuid';
|
3
3
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, hexToRgb, hexToRgba, isHex, isRgb, normalizeHexColor, rgbToHex } from './colors';
|
4
|
-
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch } from './url';
|
4
|
+
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch } from './url';
|
5
|
+
export { getDarkModeLCHColor } from './lch-color-inversion';
|
@@ -0,0 +1,128 @@
|
|
1
|
+
// https://en.wikipedia.org/wiki/HCL_color_space
|
2
|
+
|
3
|
+
// https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
|
4
|
+
|
5
|
+
// https://en.wikipedia.org/wiki/CIELAB_color_space
|
6
|
+
|
7
|
+
const clamp = (i, min, max) => Math.round(Math.min(Math.max(i, min), max));
|
8
|
+
const expandShorthandHex = input => input.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => r + r + g + g + b + b);
|
9
|
+
const rgbFromHex = input => {
|
10
|
+
const fullHex = expandShorthandHex(input);
|
11
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(fullHex);
|
12
|
+
return result === null ? null : {
|
13
|
+
r: parseInt(result[1], 16),
|
14
|
+
g: parseInt(result[2], 16),
|
15
|
+
b: parseInt(result[3], 16)
|
16
|
+
};
|
17
|
+
};
|
18
|
+
const rgbToHex = ({
|
19
|
+
r,
|
20
|
+
g,
|
21
|
+
b
|
22
|
+
}) => {
|
23
|
+
const convertComponent = c => {
|
24
|
+
const cBase16 = c.toString(16);
|
25
|
+
return cBase16.length === 1 ? `0${cBase16}` : cBase16;
|
26
|
+
};
|
27
|
+
return `#${convertComponent(r)}${convertComponent(g)}${convertComponent(b)}`;
|
28
|
+
};
|
29
|
+
const rgbToXyz = rgb => {
|
30
|
+
const convertRgbComponent = c => c > 0.04045 ? Math.pow((c + 0.055) / 1.055, 2.4) : c / 12.92;
|
31
|
+
const convertXyzComponent = c => c > 0.008856452 ? Math.pow(c, 1 / 3) : c / 0.12841855 + 0.137931034;
|
32
|
+
const r = convertRgbComponent(rgb.r / 255);
|
33
|
+
const g = convertRgbComponent(rgb.g / 255);
|
34
|
+
const b = convertRgbComponent(rgb.b / 255);
|
35
|
+
return {
|
36
|
+
x: convertXyzComponent((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047),
|
37
|
+
y: convertXyzComponent(0.2126729 * r + 0.7151522 * g + 0.072175 * b),
|
38
|
+
z: convertXyzComponent((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883)
|
39
|
+
};
|
40
|
+
};
|
41
|
+
const xyzToLab = ({
|
42
|
+
x,
|
43
|
+
y,
|
44
|
+
z
|
45
|
+
}) => ({
|
46
|
+
l: Math.max(116 * y - 16, 0),
|
47
|
+
a: 500 * (x - y),
|
48
|
+
b: 200 * (y - z)
|
49
|
+
});
|
50
|
+
const labToLch = ({
|
51
|
+
l,
|
52
|
+
a,
|
53
|
+
b
|
54
|
+
}) => {
|
55
|
+
let h = (Math.atan2(b, a) * (180 / Math.PI) + 360) % 360;
|
56
|
+
const c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
|
57
|
+
if (Math.round(c * 10000) === 0) h = Number.NaN;
|
58
|
+
return {
|
59
|
+
l,
|
60
|
+
c,
|
61
|
+
h
|
62
|
+
};
|
63
|
+
};
|
64
|
+
const lchToLab = ({
|
65
|
+
l,
|
66
|
+
c,
|
67
|
+
h
|
68
|
+
}) => {
|
69
|
+
const convertH = Number.isNaN(h) ? 0 : h * (Math.PI / 180);
|
70
|
+
return {
|
71
|
+
l,
|
72
|
+
a: Math.cos(convertH) * c,
|
73
|
+
b: Math.sin(convertH) * c
|
74
|
+
};
|
75
|
+
};
|
76
|
+
const labToXyz = ({
|
77
|
+
l,
|
78
|
+
a,
|
79
|
+
b
|
80
|
+
}) => {
|
81
|
+
const convertComponent = c => c > 0.206896552 ? Math.pow(c, 3) : 0.12841855 * (c - 0.137931034);
|
82
|
+
const y = (l + 16) / 116;
|
83
|
+
const x = a / 500 + y;
|
84
|
+
const z = y - b / 200;
|
85
|
+
return {
|
86
|
+
x: convertComponent(x) * 0.95047,
|
87
|
+
y: convertComponent(y),
|
88
|
+
z: convertComponent(z) * 1.08883
|
89
|
+
};
|
90
|
+
};
|
91
|
+
const xyzToRgb = ({
|
92
|
+
x,
|
93
|
+
y,
|
94
|
+
z
|
95
|
+
}) => {
|
96
|
+
const convertComponent = c => 255 * (c <= 0.00304 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055);
|
97
|
+
return {
|
98
|
+
r: clamp(convertComponent(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), 0, 255),
|
99
|
+
g: clamp(convertComponent(-0.969266 * x + 1.8760108 * y + 0.041556 * z), 0, 255),
|
100
|
+
b: clamp(convertComponent(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), 0, 255)
|
101
|
+
};
|
102
|
+
};
|
103
|
+
const rgbToLch = rgb => labToLch(xyzToLab(rgbToXyz(rgb)));
|
104
|
+
const lchToRgb = lch => xyzToRgb(labToXyz(lchToLab(lch)));
|
105
|
+
export const clampLightness = (color, newPercent) => {
|
106
|
+
const rgb = rgbFromHex(color);
|
107
|
+
if (rgb === null) {
|
108
|
+
return color;
|
109
|
+
}
|
110
|
+
|
111
|
+
// LCH (rather than HSL) gives the best results here as the L component in LCH is based on human color perception
|
112
|
+
const lch = rgbToLch(rgb);
|
113
|
+
lch.l = clamp(newPercent, 0, 100);
|
114
|
+
return rgbToHex(lchToRgb(lch));
|
115
|
+
};
|
116
|
+
const getLightness = color => {
|
117
|
+
const rgb = rgbFromHex(color);
|
118
|
+
if (rgb === null) {
|
119
|
+
return 0;
|
120
|
+
}
|
121
|
+
const lch = rgbToLch(rgb);
|
122
|
+
return lch.l;
|
123
|
+
};
|
124
|
+
export const getDarkModeLCHColor = currentBackgroundColor => {
|
125
|
+
const lightness = getLightness(currentBackgroundColor);
|
126
|
+
const newLightness = Math.abs(100 - lightness);
|
127
|
+
return clampLightness(currentBackgroundColor, newLightness).toUpperCase();
|
128
|
+
};
|
package/dist/esm/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
2
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension } from './schema';
|
3
|
-
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
3
|
+
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor } from './utils';
|
@@ -3,6 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
|
4
4
|
import { COLOR } from '../groups';
|
5
5
|
import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, isHex, isRgb } from '../../utils/colors';
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
7
|
+
import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
|
6
8
|
|
7
9
|
/**
|
8
10
|
* @name textColor_mark
|
@@ -188,7 +190,12 @@ export var textColor = {
|
|
188
190
|
} else {
|
189
191
|
if (getGlobalTheme().colorMode === 'dark') {
|
190
192
|
// if we have a custom color, we need to check if we are in dark mode
|
191
|
-
|
193
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
194
|
+
if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
195
|
+
paletteColorValue = getDarkModeLCHColor(mark.attrs.color);
|
196
|
+
} else {
|
197
|
+
paletteColorValue = invertCustomColor(mark.attrs.color);
|
198
|
+
}
|
192
199
|
} else {
|
193
200
|
// if we are in light mode, we can just set the color
|
194
201
|
paletteColorValue = mark.attrs.color;
|
@@ -5,6 +5,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
5
5
|
import { hexToEditorBackgroundPaletteRawValue } from '../../utils/editor-palette';
|
6
6
|
import { B100, B50, B75, G200, G50, G75, hexToRgba, isHex, isRgb, N0, N20, N60, N800, P100, P50, P75, R100, R50, R75, rgbToHex, T100, T50, T75, Y200, Y50, Y75 } from '../../utils/colors';
|
7
7
|
import { uuid } from '../../utils/uuid';
|
8
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
9
|
+
import { getDarkModeLCHColor } from '../../utils/lch-color-inversion';
|
8
10
|
export var tablePrefixSelector = 'pm-table';
|
9
11
|
export var tableCellSelector = "".concat(tablePrefixSelector, "-cell-content-wrap");
|
10
12
|
export var tableHeaderSelector = "".concat(tablePrefixSelector, "-header-content-wrap");
|
@@ -156,7 +158,12 @@ export var getCellDomAttrs = function getCellDomAttrs(node) {
|
|
156
158
|
// if we have a custom color, we need to check if we are in dark mode
|
157
159
|
if (getGlobalTheme().colorMode === 'dark') {
|
158
160
|
// if we have a custom color, we need to check if we are in dark mode
|
159
|
-
|
161
|
+
// and if the feature flag is enabled we need to use the LCH conversion method
|
162
|
+
if (getBooleanFF('platform.editor.use-lch-for-color-inversion_1qv8ol')) {
|
163
|
+
attrs.style = "background-color: ".concat(getDarkModeLCHColor(color), ";");
|
164
|
+
} else {
|
165
|
+
attrs.style = "background-color: ".concat(invertCustomColor(color), ";");
|
166
|
+
}
|
160
167
|
} else {
|
161
168
|
// if we are in light mode, we can just set the color
|
162
169
|
attrs.style = "background-color: ".concat(background, ";");
|
package/dist/esm/utils/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export { acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, getEmojiAcName } from './confluence/emoji';
|
2
2
|
export { generateUuid, uuid } from './uuid';
|
3
3
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, hexToRgb, hexToRgba, isHex, isRgb, normalizeHexColor, rgbToHex } from './colors';
|
4
|
-
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch } from './url';
|
4
|
+
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch } from './url';
|
5
|
+
export { getDarkModeLCHColor } from './lch-color-inversion';
|
@@ -0,0 +1,142 @@
|
|
1
|
+
// https://en.wikipedia.org/wiki/HCL_color_space
|
2
|
+
|
3
|
+
// https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space
|
4
|
+
|
5
|
+
// https://en.wikipedia.org/wiki/CIELAB_color_space
|
6
|
+
|
7
|
+
var clamp = function clamp(i, min, max) {
|
8
|
+
return Math.round(Math.min(Math.max(i, min), max));
|
9
|
+
};
|
10
|
+
var expandShorthandHex = function expandShorthandHex(input) {
|
11
|
+
return input.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (m, r, g, b) {
|
12
|
+
return r + r + g + g + b + b;
|
13
|
+
});
|
14
|
+
};
|
15
|
+
var rgbFromHex = function rgbFromHex(input) {
|
16
|
+
var fullHex = expandShorthandHex(input);
|
17
|
+
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(fullHex);
|
18
|
+
return result === null ? null : {
|
19
|
+
r: parseInt(result[1], 16),
|
20
|
+
g: parseInt(result[2], 16),
|
21
|
+
b: parseInt(result[3], 16)
|
22
|
+
};
|
23
|
+
};
|
24
|
+
var rgbToHex = function rgbToHex(_ref) {
|
25
|
+
var r = _ref.r,
|
26
|
+
g = _ref.g,
|
27
|
+
b = _ref.b;
|
28
|
+
var convertComponent = function convertComponent(c) {
|
29
|
+
var cBase16 = c.toString(16);
|
30
|
+
return cBase16.length === 1 ? "0".concat(cBase16) : cBase16;
|
31
|
+
};
|
32
|
+
return "#".concat(convertComponent(r)).concat(convertComponent(g)).concat(convertComponent(b));
|
33
|
+
};
|
34
|
+
var rgbToXyz = function rgbToXyz(rgb) {
|
35
|
+
var convertRgbComponent = function convertRgbComponent(c) {
|
36
|
+
return c > 0.04045 ? Math.pow((c + 0.055) / 1.055, 2.4) : c / 12.92;
|
37
|
+
};
|
38
|
+
var convertXyzComponent = function convertXyzComponent(c) {
|
39
|
+
return c > 0.008856452 ? Math.pow(c, 1 / 3) : c / 0.12841855 + 0.137931034;
|
40
|
+
};
|
41
|
+
var r = convertRgbComponent(rgb.r / 255);
|
42
|
+
var g = convertRgbComponent(rgb.g / 255);
|
43
|
+
var b = convertRgbComponent(rgb.b / 255);
|
44
|
+
return {
|
45
|
+
x: convertXyzComponent((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047),
|
46
|
+
y: convertXyzComponent(0.2126729 * r + 0.7151522 * g + 0.072175 * b),
|
47
|
+
z: convertXyzComponent((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883)
|
48
|
+
};
|
49
|
+
};
|
50
|
+
var xyzToLab = function xyzToLab(_ref2) {
|
51
|
+
var x = _ref2.x,
|
52
|
+
y = _ref2.y,
|
53
|
+
z = _ref2.z;
|
54
|
+
return {
|
55
|
+
l: Math.max(116 * y - 16, 0),
|
56
|
+
a: 500 * (x - y),
|
57
|
+
b: 200 * (y - z)
|
58
|
+
};
|
59
|
+
};
|
60
|
+
var labToLch = function labToLch(_ref3) {
|
61
|
+
var l = _ref3.l,
|
62
|
+
a = _ref3.a,
|
63
|
+
b = _ref3.b;
|
64
|
+
var h = (Math.atan2(b, a) * (180 / Math.PI) + 360) % 360;
|
65
|
+
var c = Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
|
66
|
+
if (Math.round(c * 10000) === 0) h = Number.NaN;
|
67
|
+
return {
|
68
|
+
l: l,
|
69
|
+
c: c,
|
70
|
+
h: h
|
71
|
+
};
|
72
|
+
};
|
73
|
+
var lchToLab = function lchToLab(_ref4) {
|
74
|
+
var l = _ref4.l,
|
75
|
+
c = _ref4.c,
|
76
|
+
h = _ref4.h;
|
77
|
+
var convertH = Number.isNaN(h) ? 0 : h * (Math.PI / 180);
|
78
|
+
return {
|
79
|
+
l: l,
|
80
|
+
a: Math.cos(convertH) * c,
|
81
|
+
b: Math.sin(convertH) * c
|
82
|
+
};
|
83
|
+
};
|
84
|
+
var labToXyz = function labToXyz(_ref5) {
|
85
|
+
var l = _ref5.l,
|
86
|
+
a = _ref5.a,
|
87
|
+
b = _ref5.b;
|
88
|
+
var convertComponent = function convertComponent(c) {
|
89
|
+
return c > 0.206896552 ? Math.pow(c, 3) : 0.12841855 * (c - 0.137931034);
|
90
|
+
};
|
91
|
+
var y = (l + 16) / 116;
|
92
|
+
var x = a / 500 + y;
|
93
|
+
var z = y - b / 200;
|
94
|
+
return {
|
95
|
+
x: convertComponent(x) * 0.95047,
|
96
|
+
y: convertComponent(y),
|
97
|
+
z: convertComponent(z) * 1.08883
|
98
|
+
};
|
99
|
+
};
|
100
|
+
var xyzToRgb = function xyzToRgb(_ref6) {
|
101
|
+
var x = _ref6.x,
|
102
|
+
y = _ref6.y,
|
103
|
+
z = _ref6.z;
|
104
|
+
var convertComponent = function convertComponent(c) {
|
105
|
+
return 255 * (c <= 0.00304 ? 12.92 * c : 1.055 * Math.pow(c, 1 / 2.4) - 0.055);
|
106
|
+
};
|
107
|
+
return {
|
108
|
+
r: clamp(convertComponent(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), 0, 255),
|
109
|
+
g: clamp(convertComponent(-0.969266 * x + 1.8760108 * y + 0.041556 * z), 0, 255),
|
110
|
+
b: clamp(convertComponent(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), 0, 255)
|
111
|
+
};
|
112
|
+
};
|
113
|
+
var rgbToLch = function rgbToLch(rgb) {
|
114
|
+
return labToLch(xyzToLab(rgbToXyz(rgb)));
|
115
|
+
};
|
116
|
+
var lchToRgb = function lchToRgb(lch) {
|
117
|
+
return xyzToRgb(labToXyz(lchToLab(lch)));
|
118
|
+
};
|
119
|
+
export var clampLightness = function clampLightness(color, newPercent) {
|
120
|
+
var rgb = rgbFromHex(color);
|
121
|
+
if (rgb === null) {
|
122
|
+
return color;
|
123
|
+
}
|
124
|
+
|
125
|
+
// LCH (rather than HSL) gives the best results here as the L component in LCH is based on human color perception
|
126
|
+
var lch = rgbToLch(rgb);
|
127
|
+
lch.l = clamp(newPercent, 0, 100);
|
128
|
+
return rgbToHex(lchToRgb(lch));
|
129
|
+
};
|
130
|
+
var getLightness = function getLightness(color) {
|
131
|
+
var rgb = rgbFromHex(color);
|
132
|
+
if (rgb === null) {
|
133
|
+
return 0;
|
134
|
+
}
|
135
|
+
var lch = rgbToLch(rgb);
|
136
|
+
return lch.l;
|
137
|
+
};
|
138
|
+
export var getDarkModeLCHColor = function getDarkModeLCHColor(currentBackgroundColor) {
|
139
|
+
var lightness = getLightness(currentBackgroundColor);
|
140
|
+
var newLightness = Math.abs(100 - lightness);
|
141
|
+
return clampLightness(currentBackgroundColor, newLightness).toUpperCase();
|
142
|
+
};
|
package/dist/types/index.d.ts
CHANGED
@@ -2,5 +2,5 @@ export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation
|
|
2
2
|
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
3
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension, } from './schema';
|
4
4
|
export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DatasourceAttributes, DatasourceAttributeProperties, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionLayout, ExternalMediaAttributes, FragmentAttributes, FragmentDefinition, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, ExtendedMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, BorderMarkAttributes, BorderMarkDefinition, MultiBodiedExtensionDefinition, ExtensionFrameDefinition, } from './schema';
|
5
|
-
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, } from './utils';
|
5
|
+
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid, getDarkModeLCHColor, } from './utils';
|
6
6
|
export type { Match, NameToEmoji } from './utils';
|
@@ -4,3 +4,4 @@ export { generateUuid, uuid } from './uuid';
|
|
4
4
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, hexToRgb, hexToRgba, isHex, isRgb, normalizeHexColor, rgbToHex, } from './colors';
|
5
5
|
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch, } from './url';
|
6
6
|
export type { Match } from './url';
|
7
|
+
export { getDarkModeLCHColor } from './lch-color-inversion';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "
|
3
|
+
"version": "34.0.1",
|
4
4
|
"description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
|
5
5
|
"publishConfig": {
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
@@ -41,6 +41,7 @@
|
|
41
41
|
"memoize-one": "^6.0.0"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
|
+
"@atlaskit/platform-feature-flags": "^0.2.4",
|
44
45
|
"@atlassian/adf-schema-json": "^1.2.0",
|
45
46
|
"@babel/cli": "^7.22.9",
|
46
47
|
"@babel/core": "^7.22.9",
|