@atlaskit/adf-schema 29.0.1 → 29.1.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/schema/index.js +17 -1
- package/dist/cjs/schema/marks/border.js +1 -1
- package/dist/cjs/schema/marks/text-color.js +1 -1
- package/dist/cjs/schema/nodes/tableNodes.js +1 -1
- package/dist/cjs/utils/editor-palette.js +286 -0
- package/dist/es2019/schema/index.js +7 -1
- package/dist/es2019/schema/marks/border.js +1 -1
- package/dist/es2019/schema/marks/text-color.js +1 -1
- package/dist/es2019/schema/nodes/tableNodes.js +1 -1
- package/dist/es2019/utils/editor-palette.js +233 -0
- package/dist/esm/schema/index.js +13 -1
- package/dist/esm/schema/marks/border.js +1 -1
- package/dist/esm/schema/marks/text-color.js +1 -1
- package/dist/esm/schema/nodes/tableNodes.js +1 -1
- package/dist/esm/utils/editor-palette.js +275 -0
- package/dist/types/schema/index.d.ts +3 -0
- package/dist/types/utils/editor-palette.d.ts +221 -0
- package/package.json +1 -3
package/CHANGELOG.md
CHANGED
package/dist/cjs/schema/index.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
4
5
|
value: true
|
5
6
|
});
|
@@ -345,6 +346,7 @@ Object.defineProperty(exports, "listItem", {
|
|
345
346
|
return _nodes.listItem;
|
346
347
|
}
|
347
348
|
});
|
349
|
+
exports.marks = void 0;
|
348
350
|
Object.defineProperty(exports, "media", {
|
349
351
|
enumerable: true,
|
350
352
|
get: function get() {
|
@@ -423,6 +425,7 @@ Object.defineProperty(exports, "nestedExpand", {
|
|
423
425
|
return _nodes.nestedExpand;
|
424
426
|
}
|
425
427
|
});
|
428
|
+
exports.nodes = void 0;
|
426
429
|
Object.defineProperty(exports, "orderedList", {
|
427
430
|
enumerable: true,
|
428
431
|
get: function get() {
|
@@ -669,8 +672,21 @@ Object.defineProperty(exports, "unsupportedNodeTypesForMediaCards", {
|
|
669
672
|
return _unsupported.unsupportedNodeTypesForMediaCards;
|
670
673
|
}
|
671
674
|
});
|
675
|
+
var _fs = _interopRequireDefault(require("fs"));
|
676
|
+
var _path = _interopRequireDefault(require("path"));
|
672
677
|
var _nodes = require("./nodes");
|
673
678
|
var _marks = require("./marks");
|
674
679
|
var _unsupported = require("./unsupported");
|
675
680
|
var _inlineNodes = require("./inline-nodes");
|
676
|
-
var _createSchema = require("./create-schema");
|
681
|
+
var _createSchema = require("./create-schema");
|
682
|
+
var buildFilesList = function buildFilesList(dirPath) {
|
683
|
+
return _fs.default.readdirSync(dirPath).filter(function (node) {
|
684
|
+
return !node.startsWith('.') && node !== 'index';
|
685
|
+
}).map(function (node) {
|
686
|
+
return _path.default.basename(node, _path.default.extname(node));
|
687
|
+
});
|
688
|
+
};
|
689
|
+
var nodes = buildFilesList(_path.default.join(__dirname, 'nodes'));
|
690
|
+
exports.nodes = nodes;
|
691
|
+
var marks = buildFilesList(_path.default.join(__dirname, 'marks'));
|
692
|
+
exports.marks = marks;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.borderColorPalette = exports.border = void 0;
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
-
var _editorPalette = require("
|
9
|
+
var _editorPalette = require("../../utils/editor-palette");
|
10
10
|
var _colors = require("../../utils/colors");
|
11
11
|
/**
|
12
12
|
* @name border_mark
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.textColor = exports.colorPaletteExtended = exports.colorPalette = void 0;
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
-
var _editorPalette = require("
|
10
|
+
var _editorPalette = require("../../utils/editor-palette");
|
11
11
|
var _groups = require("../groups");
|
12
12
|
var _colors = require("../../utils/colors");
|
13
13
|
/**
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.toJSONTableHeader = exports.toJSONTableCell = exports.tableWithCustomWidth = exports.tableToJSON = exports.tableRow = exports.tablePrefixSelector = exports.tableHeaderSelector = exports.tableHeader = exports.tableCellSelector = exports.tableCellContentWrapperSelector = exports.tableCellContentDomSelector = exports.tableCell = exports.tableBackgroundColorPalette = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.table = exports.getCellDomAttrs = exports.getCellAttrs = void 0;
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
-
var _editorPalette = require("
|
10
|
+
var _editorPalette = require("../../utils/editor-palette");
|
11
11
|
var _colors = require("../../utils/colors");
|
12
12
|
var _uuid = require("../../utils/uuid");
|
13
13
|
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; }
|
@@ -0,0 +1,286 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.editorTextPalette = exports.editorBorderPalette = exports.editorBackgroundPalette = void 0;
|
7
|
+
exports.hexToEditorBackgroundPaletteRawValue = hexToEditorBackgroundPaletteRawValue;
|
8
|
+
exports.hexToEditorBorderPaletteColor = hexToEditorBorderPaletteColor;
|
9
|
+
exports.hexToEditorTextPaletteColor = hexToEditorTextPaletteColor;
|
10
|
+
/**
|
11
|
+
* This takes an adf hex color and returns a matching border palette color.
|
12
|
+
*
|
13
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
14
|
+
*
|
15
|
+
* Example usage
|
16
|
+
* ```tsx
|
17
|
+
* const cssValue = hexToEditorBorderPaletteColor('#091E4224');
|
18
|
+
* // ^? const cssValue: string
|
19
|
+
* <div style={{borderColor: cssValue}} />
|
20
|
+
* ```
|
21
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
22
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
23
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
24
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
25
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
26
|
+
*/
|
27
|
+
function hexToEditorBorderPaletteColor(hexColor) {
|
28
|
+
// Ts ignore used to allow use of conditional return type
|
29
|
+
// (preferencing better type on consumption over safety in implementation)
|
30
|
+
// @ts-ignore
|
31
|
+
return editorBorderPalette[hexColor.toUpperCase()];
|
32
|
+
}
|
33
|
+
var editorBorderPalette = {
|
34
|
+
/** gray - subtle */
|
35
|
+
'#091E4224': 'var(--ds-border, #091E4224)',
|
36
|
+
/** gray */
|
37
|
+
'#758195': 'var(--ds-border-bold, #758195)',
|
38
|
+
/** gray - bold */
|
39
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
40
|
+
};
|
41
|
+
|
42
|
+
/**
|
43
|
+
* This takes an adf hex color and returns a matching text palette color.
|
44
|
+
*
|
45
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
46
|
+
*
|
47
|
+
* Example usage
|
48
|
+
* ```tsx
|
49
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
50
|
+
* // ^? const cssValue: string
|
51
|
+
* <span style={{textColor: cssValue}} />
|
52
|
+
* ```
|
53
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
54
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
55
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
56
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
57
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
58
|
+
*/
|
59
|
+
exports.editorBorderPalette = editorBorderPalette;
|
60
|
+
function hexToEditorTextPaletteColor(hexColor) {
|
61
|
+
// Ts ignore used to allow use of conditional return type
|
62
|
+
// (preferencing better type on consumption over safety in implementation)
|
63
|
+
// @ts-ignore
|
64
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
65
|
+
}
|
66
|
+
var editorTextPalette = {
|
67
|
+
/** blue - light */
|
68
|
+
'#B3D4FF': 'var(--ds-background-accent-blue-subtler, #B3D4FF)',
|
69
|
+
/** blue - medium */
|
70
|
+
'#4C9AFF': 'var(--ds-icon-accent-blue, #4C9AFF)',
|
71
|
+
/** blue - strong */
|
72
|
+
'#0747A6': 'var(--ds-text-accent-blue, #0747A6)',
|
73
|
+
/** teal - light */
|
74
|
+
'#B3F5FF': 'var(--ds-background-accent-teal-subtler, #B3F5FF)',
|
75
|
+
/** teal - medium */
|
76
|
+
'#00B8D9': 'var(--ds-icon-accent-teal, #00B8D9)',
|
77
|
+
/** teal - strong */
|
78
|
+
'#008DA6': 'var(--ds-text-accent-teal, #008DA6)',
|
79
|
+
/** green - light */
|
80
|
+
'#ABF5D1': 'var(--ds-background-accent-green-subtler, #ABF5D1)',
|
81
|
+
/** green - medium */
|
82
|
+
'#36B37E': 'var(--ds-icon-accent-green, #36B37E)',
|
83
|
+
/** green - strong */
|
84
|
+
'#006644': 'var(--ds-text-accent-green, #006644)',
|
85
|
+
/** yellowOrange - light */
|
86
|
+
'#FFF0B3': 'var(--ds-background-accent-yellow-subtler, #FFF0B3)',
|
87
|
+
/** yellowOrange - medium */
|
88
|
+
'#FFC400': 'var(--ds-background-accent-orange-subtle, #FFC400)',
|
89
|
+
/** yellowOrange - strong */
|
90
|
+
'#FF991F': 'var(--ds-icon-accent-orange, #FF991F)',
|
91
|
+
/** red - light */
|
92
|
+
'#FFBDAD': 'var(--ds-background-accent-red-subtler, #FFBDAD)',
|
93
|
+
/** red - medium */
|
94
|
+
'#FF5630': 'var(--ds-icon-accent-red, #FF5630)',
|
95
|
+
/** red - strong */
|
96
|
+
'#BF2600': 'var(--ds-text-accent-red, #BF2600)',
|
97
|
+
/** purple - light */
|
98
|
+
'#EAE6FF': 'var(--ds-background-accent-purple-subtler, #EAE6FF)',
|
99
|
+
/** purple - medium */
|
100
|
+
'#6554C0': 'var(--ds-icon-accent-purple, #6554C0)',
|
101
|
+
/** purple - strong */
|
102
|
+
'#403294': 'var(--ds-text-accent-purple, #403294)',
|
103
|
+
/** whiteGray - light */
|
104
|
+
'#FFFFFF': 'var(--ds-text-inverse, #FFFFFF)',
|
105
|
+
/** whiteGray - medium */
|
106
|
+
'#97A0AF': 'var(--ds-icon-accent-gray, #97A0AF)',
|
107
|
+
/** whiteGray - strong */
|
108
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
109
|
+
};
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
113
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
114
|
+
*
|
115
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
116
|
+
* or to enable cross-app copy/paste.
|
117
|
+
*
|
118
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
119
|
+
* the surrounding UI and will need to be re-fetched.
|
120
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
121
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
122
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
123
|
+
*/
|
124
|
+
exports.editorTextPalette = editorTextPalette;
|
125
|
+
function hexToEditorBackgroundPaletteRawValue(hexColor) {
|
126
|
+
// Ts ignore used to allow use of conditional return type
|
127
|
+
// (preferencing better type on consumption over safety in implementation)
|
128
|
+
// @ts-ignore
|
129
|
+
var tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
130
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
131
|
+
}
|
132
|
+
/**
|
133
|
+
* Values are asserted to improve generated type declarations
|
134
|
+
* Using object structure as getValue() function needed for table values, and other
|
135
|
+
* properties may be needed in the future.
|
136
|
+
*/
|
137
|
+
var editorBackgroundPalette = {
|
138
|
+
/** blue - light */
|
139
|
+
'#DEEBFF': {
|
140
|
+
getValue: function getValue(fallback) {
|
141
|
+
return '#DEEBFF';
|
142
|
+
},
|
143
|
+
token: 'var(--ds-background-accent-blue-subtlest, #DEEBFF)'
|
144
|
+
},
|
145
|
+
/** blue - medium */
|
146
|
+
'#B3D4FF': {
|
147
|
+
getValue: function getValue(fallback) {
|
148
|
+
return '#B3D4FF';
|
149
|
+
},
|
150
|
+
token: 'var(--ds-background-accent-blue-subtler, #B3D4FF)'
|
151
|
+
},
|
152
|
+
/** blue - strong */
|
153
|
+
'#4C9AFF': {
|
154
|
+
getValue: function getValue(fallback) {
|
155
|
+
return '#4C9AFF';
|
156
|
+
},
|
157
|
+
token: 'var(--ds-background-accent-blue-subtle, #4C9AFF)'
|
158
|
+
},
|
159
|
+
/** teal - light */
|
160
|
+
'#E6FCFF': {
|
161
|
+
getValue: function getValue(fallback) {
|
162
|
+
return '#E6FCFF';
|
163
|
+
},
|
164
|
+
token: 'var(--ds-background-accent-teal-subtlest, #E6FCFF)'
|
165
|
+
},
|
166
|
+
/** teal - medium */
|
167
|
+
'#B3F5FF': {
|
168
|
+
getValue: function getValue(fallback) {
|
169
|
+
return '#B3F5FF';
|
170
|
+
},
|
171
|
+
token: 'var(--ds-background-accent-teal-subtler, #B3F5FF)'
|
172
|
+
},
|
173
|
+
/** teal - strong */
|
174
|
+
'#79E2F2': {
|
175
|
+
getValue: function getValue(fallback) {
|
176
|
+
return '#79E2F2';
|
177
|
+
},
|
178
|
+
token: 'var(--ds-background-accent-teal-subtle, #79E2F2)'
|
179
|
+
},
|
180
|
+
/** green - light */
|
181
|
+
'#E3FCEF': {
|
182
|
+
getValue: function getValue(fallback) {
|
183
|
+
return '#E3FCEF';
|
184
|
+
},
|
185
|
+
token: 'var(--ds-background-accent-green-subtlest, #E3FCEF)'
|
186
|
+
},
|
187
|
+
/** green - medium */
|
188
|
+
'#ABF5D1': {
|
189
|
+
getValue: function getValue(fallback) {
|
190
|
+
return '#ABF5D1';
|
191
|
+
},
|
192
|
+
token: 'var(--ds-background-accent-green-subtler, #ABF5D1)'
|
193
|
+
},
|
194
|
+
/** green - strong */
|
195
|
+
'#57D9A3': {
|
196
|
+
getValue: function getValue(fallback) {
|
197
|
+
return '#57D9A3';
|
198
|
+
},
|
199
|
+
token: 'var(--ds-background-accent-green-subtle, #57D9A3)'
|
200
|
+
},
|
201
|
+
/** yellowOrange - light */
|
202
|
+
'#FFFAE6': {
|
203
|
+
getValue: function getValue(fallback) {
|
204
|
+
return '#FFFAE6';
|
205
|
+
},
|
206
|
+
token: 'var(--ds-background-accent-yellow-subtlest, #FFFAE6)'
|
207
|
+
},
|
208
|
+
/** yellowOrange - medium */
|
209
|
+
'#FFF0B3': {
|
210
|
+
getValue: function getValue(fallback) {
|
211
|
+
return '#FFF0B3';
|
212
|
+
},
|
213
|
+
token: 'var(--ds-background-accent-yellow-subtler, #FFF0B3)'
|
214
|
+
},
|
215
|
+
/** yellowOrange - strong */
|
216
|
+
'#FFC400': {
|
217
|
+
getValue: function getValue(fallback) {
|
218
|
+
return '#FFC400';
|
219
|
+
},
|
220
|
+
token: 'var(--ds-background-accent-orange-subtle, #FFC400)'
|
221
|
+
},
|
222
|
+
/** red - light */
|
223
|
+
'#FFEBE6': {
|
224
|
+
getValue: function getValue(fallback) {
|
225
|
+
return '#FFEBE6';
|
226
|
+
},
|
227
|
+
token: 'var(--ds-background-accent-red-subtlest, #FFEBE6)'
|
228
|
+
},
|
229
|
+
/** red - medium */
|
230
|
+
'#FFBDAD': {
|
231
|
+
getValue: function getValue(fallback) {
|
232
|
+
return '#FFBDAD';
|
233
|
+
},
|
234
|
+
token: 'var(--ds-background-accent-red-subtler, #FFBDAD)'
|
235
|
+
},
|
236
|
+
/** red - strong */
|
237
|
+
'#FF8F73': {
|
238
|
+
getValue: function getValue(fallback) {
|
239
|
+
return '#FF8F73';
|
240
|
+
},
|
241
|
+
token: 'var(--ds-background-accent-red-subtle, #FF8F73)'
|
242
|
+
},
|
243
|
+
/** purple - light */
|
244
|
+
'#EAE6FF': {
|
245
|
+
getValue: function getValue(fallback) {
|
246
|
+
return '#EAE6FF';
|
247
|
+
},
|
248
|
+
token: 'var(--ds-background-accent-purple-subtlest, #EAE6FF)'
|
249
|
+
},
|
250
|
+
/** purple - medium */
|
251
|
+
'#C0B6F2': {
|
252
|
+
getValue: function getValue(fallback) {
|
253
|
+
return '#C0B6F2';
|
254
|
+
},
|
255
|
+
token: 'var(--ds-background-accent-purple-subtler, #C0B6F2)'
|
256
|
+
},
|
257
|
+
/** purple - strong */
|
258
|
+
'#998DD9': {
|
259
|
+
getValue: function getValue(fallback) {
|
260
|
+
return '#998DD9';
|
261
|
+
},
|
262
|
+
token: 'var(--ds-background-accent-purple-subtle, #998DD9)'
|
263
|
+
},
|
264
|
+
/** whiteGray - light */
|
265
|
+
'#FFFFFF': {
|
266
|
+
getValue: function getValue(fallback) {
|
267
|
+
return '#FFFFFF';
|
268
|
+
},
|
269
|
+
token: 'var(--ds-surface, #FFFFFF)'
|
270
|
+
},
|
271
|
+
/** whiteGray - medium */
|
272
|
+
'#F4F5F7': {
|
273
|
+
getValue: function getValue(fallback) {
|
274
|
+
return '#F4F5F7';
|
275
|
+
},
|
276
|
+
token: 'var(--ds-background-accent-gray-subtlest, #F4F5F7)'
|
277
|
+
},
|
278
|
+
/** whiteGray - strong */
|
279
|
+
'#B3BAC5': {
|
280
|
+
getValue: function getValue(fallback) {
|
281
|
+
return '#B3BAC5';
|
282
|
+
},
|
283
|
+
token: 'var(--ds-background-accent-gray-subtle, #B3BAC5)'
|
284
|
+
}
|
285
|
+
};
|
286
|
+
exports.editorBackgroundPalette = editorBackgroundPalette;
|
@@ -1,6 +1,12 @@
|
|
1
|
+
import fs from 'fs';
|
2
|
+
import path from 'path';
|
1
3
|
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
4
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
5
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
6
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
5
7
|
export { inlineNodes } from './inline-nodes';
|
6
|
-
export { sanitizeNodes, createSchema } from './create-schema';
|
8
|
+
export { sanitizeNodes, createSchema } from './create-schema';
|
9
|
+
const buildFilesList = dirPath => fs.readdirSync(dirPath).filter(node => !node.startsWith('.') && node !== 'index').map(node => path.basename(node, path.extname(node)));
|
10
|
+
const nodes = buildFilesList(path.join(__dirname, 'nodes'));
|
11
|
+
const marks = buildFilesList(path.join(__dirname, 'marks'));
|
12
|
+
export { nodes, marks };
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { hexToEditorTextPaletteColor } from '
|
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 } from '../../utils/colors';
|
4
4
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { hexToEditorBackgroundPaletteRawValue } from '
|
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
4
|
export const tablePrefixSelector = 'pm-table';
|
@@ -0,0 +1,233 @@
|
|
1
|
+
/**
|
2
|
+
* This takes an adf hex color and returns a matching border palette color.
|
3
|
+
*
|
4
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
5
|
+
*
|
6
|
+
* Example usage
|
7
|
+
* ```tsx
|
8
|
+
* const cssValue = hexToEditorBorderPaletteColor('#091E4224');
|
9
|
+
* // ^? const cssValue: string
|
10
|
+
* <div style={{borderColor: cssValue}} />
|
11
|
+
* ```
|
12
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
13
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
14
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
15
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
16
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
17
|
+
*/
|
18
|
+
export function hexToEditorBorderPaletteColor(hexColor) {
|
19
|
+
// Ts ignore used to allow use of conditional return type
|
20
|
+
// (preferencing better type on consumption over safety in implementation)
|
21
|
+
// @ts-ignore
|
22
|
+
return editorBorderPalette[hexColor.toUpperCase()];
|
23
|
+
}
|
24
|
+
export const editorBorderPalette = {
|
25
|
+
/** gray - subtle */
|
26
|
+
'#091E4224': 'var(--ds-border, #091E4224)',
|
27
|
+
/** gray */
|
28
|
+
'#758195': 'var(--ds-border-bold, #758195)',
|
29
|
+
/** gray - bold */
|
30
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
31
|
+
};
|
32
|
+
|
33
|
+
/**
|
34
|
+
* This takes an adf hex color and returns a matching text palette color.
|
35
|
+
*
|
36
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
37
|
+
*
|
38
|
+
* Example usage
|
39
|
+
* ```tsx
|
40
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
41
|
+
* // ^? const cssValue: string
|
42
|
+
* <span style={{textColor: cssValue}} />
|
43
|
+
* ```
|
44
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
45
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
46
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
47
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
48
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
49
|
+
*/
|
50
|
+
export function hexToEditorTextPaletteColor(hexColor) {
|
51
|
+
// Ts ignore used to allow use of conditional return type
|
52
|
+
// (preferencing better type on consumption over safety in implementation)
|
53
|
+
// @ts-ignore
|
54
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
55
|
+
}
|
56
|
+
export const editorTextPalette = {
|
57
|
+
/** blue - light */
|
58
|
+
'#B3D4FF': 'var(--ds-background-accent-blue-subtler, #B3D4FF)',
|
59
|
+
/** blue - medium */
|
60
|
+
'#4C9AFF': 'var(--ds-icon-accent-blue, #4C9AFF)',
|
61
|
+
/** blue - strong */
|
62
|
+
'#0747A6': 'var(--ds-text-accent-blue, #0747A6)',
|
63
|
+
/** teal - light */
|
64
|
+
'#B3F5FF': 'var(--ds-background-accent-teal-subtler, #B3F5FF)',
|
65
|
+
/** teal - medium */
|
66
|
+
'#00B8D9': 'var(--ds-icon-accent-teal, #00B8D9)',
|
67
|
+
/** teal - strong */
|
68
|
+
'#008DA6': 'var(--ds-text-accent-teal, #008DA6)',
|
69
|
+
/** green - light */
|
70
|
+
'#ABF5D1': 'var(--ds-background-accent-green-subtler, #ABF5D1)',
|
71
|
+
/** green - medium */
|
72
|
+
'#36B37E': 'var(--ds-icon-accent-green, #36B37E)',
|
73
|
+
/** green - strong */
|
74
|
+
'#006644': 'var(--ds-text-accent-green, #006644)',
|
75
|
+
/** yellowOrange - light */
|
76
|
+
'#FFF0B3': 'var(--ds-background-accent-yellow-subtler, #FFF0B3)',
|
77
|
+
/** yellowOrange - medium */
|
78
|
+
'#FFC400': 'var(--ds-background-accent-orange-subtle, #FFC400)',
|
79
|
+
/** yellowOrange - strong */
|
80
|
+
'#FF991F': 'var(--ds-icon-accent-orange, #FF991F)',
|
81
|
+
/** red - light */
|
82
|
+
'#FFBDAD': 'var(--ds-background-accent-red-subtler, #FFBDAD)',
|
83
|
+
/** red - medium */
|
84
|
+
'#FF5630': 'var(--ds-icon-accent-red, #FF5630)',
|
85
|
+
/** red - strong */
|
86
|
+
'#BF2600': 'var(--ds-text-accent-red, #BF2600)',
|
87
|
+
/** purple - light */
|
88
|
+
'#EAE6FF': 'var(--ds-background-accent-purple-subtler, #EAE6FF)',
|
89
|
+
/** purple - medium */
|
90
|
+
'#6554C0': 'var(--ds-icon-accent-purple, #6554C0)',
|
91
|
+
/** purple - strong */
|
92
|
+
'#403294': 'var(--ds-text-accent-purple, #403294)',
|
93
|
+
/** whiteGray - light */
|
94
|
+
'#FFFFFF': 'var(--ds-text-inverse, #FFFFFF)',
|
95
|
+
/** whiteGray - medium */
|
96
|
+
'#97A0AF': 'var(--ds-icon-accent-gray, #97A0AF)',
|
97
|
+
/** whiteGray - strong */
|
98
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
99
|
+
};
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
103
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
104
|
+
*
|
105
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
106
|
+
* or to enable cross-app copy/paste.
|
107
|
+
*
|
108
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
109
|
+
* the surrounding UI and will need to be re-fetched.
|
110
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
111
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
112
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
113
|
+
*/
|
114
|
+
export function hexToEditorBackgroundPaletteRawValue(hexColor) {
|
115
|
+
// Ts ignore used to allow use of conditional return type
|
116
|
+
// (preferencing better type on consumption over safety in implementation)
|
117
|
+
// @ts-ignore
|
118
|
+
const tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
119
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Values are asserted to improve generated type declarations
|
123
|
+
* Using object structure as getValue() function needed for table values, and other
|
124
|
+
* properties may be needed in the future.
|
125
|
+
*/
|
126
|
+
export const editorBackgroundPalette = {
|
127
|
+
/** blue - light */
|
128
|
+
'#DEEBFF': {
|
129
|
+
getValue: fallback => '#DEEBFF',
|
130
|
+
token: 'var(--ds-background-accent-blue-subtlest, #DEEBFF)'
|
131
|
+
},
|
132
|
+
/** blue - medium */
|
133
|
+
'#B3D4FF': {
|
134
|
+
getValue: fallback => '#B3D4FF',
|
135
|
+
token: 'var(--ds-background-accent-blue-subtler, #B3D4FF)'
|
136
|
+
},
|
137
|
+
/** blue - strong */
|
138
|
+
'#4C9AFF': {
|
139
|
+
getValue: fallback => '#4C9AFF',
|
140
|
+
token: 'var(--ds-background-accent-blue-subtle, #4C9AFF)'
|
141
|
+
},
|
142
|
+
/** teal - light */
|
143
|
+
'#E6FCFF': {
|
144
|
+
getValue: fallback => '#E6FCFF',
|
145
|
+
token: 'var(--ds-background-accent-teal-subtlest, #E6FCFF)'
|
146
|
+
},
|
147
|
+
/** teal - medium */
|
148
|
+
'#B3F5FF': {
|
149
|
+
getValue: fallback => '#B3F5FF',
|
150
|
+
token: 'var(--ds-background-accent-teal-subtler, #B3F5FF)'
|
151
|
+
},
|
152
|
+
/** teal - strong */
|
153
|
+
'#79E2F2': {
|
154
|
+
getValue: fallback => '#79E2F2',
|
155
|
+
token: 'var(--ds-background-accent-teal-subtle, #79E2F2)'
|
156
|
+
},
|
157
|
+
/** green - light */
|
158
|
+
'#E3FCEF': {
|
159
|
+
getValue: fallback => '#E3FCEF',
|
160
|
+
token: 'var(--ds-background-accent-green-subtlest, #E3FCEF)'
|
161
|
+
},
|
162
|
+
/** green - medium */
|
163
|
+
'#ABF5D1': {
|
164
|
+
getValue: fallback => '#ABF5D1',
|
165
|
+
token: 'var(--ds-background-accent-green-subtler, #ABF5D1)'
|
166
|
+
},
|
167
|
+
/** green - strong */
|
168
|
+
'#57D9A3': {
|
169
|
+
getValue: fallback => '#57D9A3',
|
170
|
+
token: 'var(--ds-background-accent-green-subtle, #57D9A3)'
|
171
|
+
},
|
172
|
+
/** yellowOrange - light */
|
173
|
+
'#FFFAE6': {
|
174
|
+
getValue: fallback => '#FFFAE6',
|
175
|
+
token: 'var(--ds-background-accent-yellow-subtlest, #FFFAE6)'
|
176
|
+
},
|
177
|
+
/** yellowOrange - medium */
|
178
|
+
'#FFF0B3': {
|
179
|
+
getValue: fallback => '#FFF0B3',
|
180
|
+
token: 'var(--ds-background-accent-yellow-subtler, #FFF0B3)'
|
181
|
+
},
|
182
|
+
/** yellowOrange - strong */
|
183
|
+
'#FFC400': {
|
184
|
+
getValue: fallback => '#FFC400',
|
185
|
+
token: 'var(--ds-background-accent-orange-subtle, #FFC400)'
|
186
|
+
},
|
187
|
+
/** red - light */
|
188
|
+
'#FFEBE6': {
|
189
|
+
getValue: fallback => '#FFEBE6',
|
190
|
+
token: 'var(--ds-background-accent-red-subtlest, #FFEBE6)'
|
191
|
+
},
|
192
|
+
/** red - medium */
|
193
|
+
'#FFBDAD': {
|
194
|
+
getValue: fallback => '#FFBDAD',
|
195
|
+
token: 'var(--ds-background-accent-red-subtler, #FFBDAD)'
|
196
|
+
},
|
197
|
+
/** red - strong */
|
198
|
+
'#FF8F73': {
|
199
|
+
getValue: fallback => '#FF8F73',
|
200
|
+
token: 'var(--ds-background-accent-red-subtle, #FF8F73)'
|
201
|
+
},
|
202
|
+
/** purple - light */
|
203
|
+
'#EAE6FF': {
|
204
|
+
getValue: fallback => '#EAE6FF',
|
205
|
+
token: 'var(--ds-background-accent-purple-subtlest, #EAE6FF)'
|
206
|
+
},
|
207
|
+
/** purple - medium */
|
208
|
+
'#C0B6F2': {
|
209
|
+
getValue: fallback => '#C0B6F2',
|
210
|
+
token: 'var(--ds-background-accent-purple-subtler, #C0B6F2)'
|
211
|
+
},
|
212
|
+
/** purple - strong */
|
213
|
+
'#998DD9': {
|
214
|
+
getValue: fallback => '#998DD9',
|
215
|
+
token: 'var(--ds-background-accent-purple-subtle, #998DD9)'
|
216
|
+
},
|
217
|
+
/** whiteGray - light */
|
218
|
+
'#FFFFFF': {
|
219
|
+
getValue: fallback => '#FFFFFF',
|
220
|
+
token: 'var(--ds-surface, #FFFFFF)'
|
221
|
+
},
|
222
|
+
/** whiteGray - medium */
|
223
|
+
'#F4F5F7': {
|
224
|
+
getValue: fallback => '#F4F5F7',
|
225
|
+
token: 'var(--ds-background-accent-gray-subtlest, #F4F5F7)'
|
226
|
+
},
|
227
|
+
/** whiteGray - strong */
|
228
|
+
'#B3BAC5': {
|
229
|
+
getValue: fallback => '#B3BAC5',
|
230
|
+
token: 'var(--ds-background-accent-gray-subtle, #B3BAC5)'
|
231
|
+
}
|
232
|
+
};
|
233
|
+
export {};
|
package/dist/esm/schema/index.js
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
+
import fs from 'fs';
|
2
|
+
import path from 'path';
|
1
3
|
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
4
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
5
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
6
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
5
7
|
export { inlineNodes } from './inline-nodes';
|
6
|
-
export { sanitizeNodes, createSchema } from './create-schema';
|
8
|
+
export { sanitizeNodes, createSchema } from './create-schema';
|
9
|
+
var buildFilesList = function buildFilesList(dirPath) {
|
10
|
+
return fs.readdirSync(dirPath).filter(function (node) {
|
11
|
+
return !node.startsWith('.') && node !== 'index';
|
12
|
+
}).map(function (node) {
|
13
|
+
return path.basename(node, path.extname(node));
|
14
|
+
});
|
15
|
+
};
|
16
|
+
var nodes = buildFilesList(path.join(__dirname, 'nodes'));
|
17
|
+
var marks = buildFilesList(path.join(__dirname, 'marks'));
|
18
|
+
export { nodes, marks };
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
-
import { hexToEditorBorderPaletteColor } from '
|
2
|
+
import { hexToEditorBorderPaletteColor } from '../../utils/editor-palette';
|
3
3
|
import { N300A, N600, N1000 } from '../../utils/colors';
|
4
4
|
|
5
5
|
/**
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
-
import { hexToEditorTextPaletteColor } from '
|
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 } from '../../utils/colors';
|
6
6
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
3
|
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; }
|
4
4
|
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) { _defineProperty(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; }
|
5
|
-
import { hexToEditorBackgroundPaletteRawValue } from '
|
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
8
|
export var tablePrefixSelector = 'pm-table';
|
@@ -0,0 +1,275 @@
|
|
1
|
+
/**
|
2
|
+
* This takes an adf hex color and returns a matching border palette color.
|
3
|
+
*
|
4
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
5
|
+
*
|
6
|
+
* Example usage
|
7
|
+
* ```tsx
|
8
|
+
* const cssValue = hexToEditorBorderPaletteColor('#091E4224');
|
9
|
+
* // ^? const cssValue: string
|
10
|
+
* <div style={{borderColor: cssValue}} />
|
11
|
+
* ```
|
12
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
13
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
14
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
15
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
16
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
17
|
+
*/
|
18
|
+
export function hexToEditorBorderPaletteColor(hexColor) {
|
19
|
+
// Ts ignore used to allow use of conditional return type
|
20
|
+
// (preferencing better type on consumption over safety in implementation)
|
21
|
+
// @ts-ignore
|
22
|
+
return editorBorderPalette[hexColor.toUpperCase()];
|
23
|
+
}
|
24
|
+
export var editorBorderPalette = {
|
25
|
+
/** gray - subtle */
|
26
|
+
'#091E4224': 'var(--ds-border, #091E4224)',
|
27
|
+
/** gray */
|
28
|
+
'#758195': 'var(--ds-border-bold, #758195)',
|
29
|
+
/** gray - bold */
|
30
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
31
|
+
};
|
32
|
+
|
33
|
+
/**
|
34
|
+
* This takes an adf hex color and returns a matching text palette color.
|
35
|
+
*
|
36
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
37
|
+
*
|
38
|
+
* Example usage
|
39
|
+
* ```tsx
|
40
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
41
|
+
* // ^? const cssValue: string
|
42
|
+
* <span style={{textColor: cssValue}} />
|
43
|
+
* ```
|
44
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
45
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
46
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
47
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
48
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
49
|
+
*/
|
50
|
+
export function hexToEditorTextPaletteColor(hexColor) {
|
51
|
+
// Ts ignore used to allow use of conditional return type
|
52
|
+
// (preferencing better type on consumption over safety in implementation)
|
53
|
+
// @ts-ignore
|
54
|
+
return editorTextPalette[hexColor.toUpperCase()];
|
55
|
+
}
|
56
|
+
export var editorTextPalette = {
|
57
|
+
/** blue - light */
|
58
|
+
'#B3D4FF': 'var(--ds-background-accent-blue-subtler, #B3D4FF)',
|
59
|
+
/** blue - medium */
|
60
|
+
'#4C9AFF': 'var(--ds-icon-accent-blue, #4C9AFF)',
|
61
|
+
/** blue - strong */
|
62
|
+
'#0747A6': 'var(--ds-text-accent-blue, #0747A6)',
|
63
|
+
/** teal - light */
|
64
|
+
'#B3F5FF': 'var(--ds-background-accent-teal-subtler, #B3F5FF)',
|
65
|
+
/** teal - medium */
|
66
|
+
'#00B8D9': 'var(--ds-icon-accent-teal, #00B8D9)',
|
67
|
+
/** teal - strong */
|
68
|
+
'#008DA6': 'var(--ds-text-accent-teal, #008DA6)',
|
69
|
+
/** green - light */
|
70
|
+
'#ABF5D1': 'var(--ds-background-accent-green-subtler, #ABF5D1)',
|
71
|
+
/** green - medium */
|
72
|
+
'#36B37E': 'var(--ds-icon-accent-green, #36B37E)',
|
73
|
+
/** green - strong */
|
74
|
+
'#006644': 'var(--ds-text-accent-green, #006644)',
|
75
|
+
/** yellowOrange - light */
|
76
|
+
'#FFF0B3': 'var(--ds-background-accent-yellow-subtler, #FFF0B3)',
|
77
|
+
/** yellowOrange - medium */
|
78
|
+
'#FFC400': 'var(--ds-background-accent-orange-subtle, #FFC400)',
|
79
|
+
/** yellowOrange - strong */
|
80
|
+
'#FF991F': 'var(--ds-icon-accent-orange, #FF991F)',
|
81
|
+
/** red - light */
|
82
|
+
'#FFBDAD': 'var(--ds-background-accent-red-subtler, #FFBDAD)',
|
83
|
+
/** red - medium */
|
84
|
+
'#FF5630': 'var(--ds-icon-accent-red, #FF5630)',
|
85
|
+
/** red - strong */
|
86
|
+
'#BF2600': 'var(--ds-text-accent-red, #BF2600)',
|
87
|
+
/** purple - light */
|
88
|
+
'#EAE6FF': 'var(--ds-background-accent-purple-subtler, #EAE6FF)',
|
89
|
+
/** purple - medium */
|
90
|
+
'#6554C0': 'var(--ds-icon-accent-purple, #6554C0)',
|
91
|
+
/** purple - strong */
|
92
|
+
'#403294': 'var(--ds-text-accent-purple, #403294)',
|
93
|
+
/** whiteGray - light */
|
94
|
+
'#FFFFFF': 'var(--ds-text-inverse, #FFFFFF)',
|
95
|
+
/** whiteGray - medium */
|
96
|
+
'#97A0AF': 'var(--ds-icon-accent-gray, #97A0AF)',
|
97
|
+
/** whiteGray - strong */
|
98
|
+
'#172B4D': 'var(--ds-text, #172B4D)'
|
99
|
+
};
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
103
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
104
|
+
*
|
105
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
106
|
+
* or to enable cross-app copy/paste.
|
107
|
+
*
|
108
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
109
|
+
* the surrounding UI and will need to be re-fetched.
|
110
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
111
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
112
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
113
|
+
*/
|
114
|
+
export function hexToEditorBackgroundPaletteRawValue(hexColor) {
|
115
|
+
// Ts ignore used to allow use of conditional return type
|
116
|
+
// (preferencing better type on consumption over safety in implementation)
|
117
|
+
// @ts-ignore
|
118
|
+
var tokenData = editorBackgroundPalette[hexColor.toUpperCase()];
|
119
|
+
return tokenData ? tokenData.getValue(hexColor) : undefined;
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Values are asserted to improve generated type declarations
|
123
|
+
* Using object structure as getValue() function needed for table values, and other
|
124
|
+
* properties may be needed in the future.
|
125
|
+
*/
|
126
|
+
export var editorBackgroundPalette = {
|
127
|
+
/** blue - light */
|
128
|
+
'#DEEBFF': {
|
129
|
+
getValue: function getValue(fallback) {
|
130
|
+
return '#DEEBFF';
|
131
|
+
},
|
132
|
+
token: 'var(--ds-background-accent-blue-subtlest, #DEEBFF)'
|
133
|
+
},
|
134
|
+
/** blue - medium */
|
135
|
+
'#B3D4FF': {
|
136
|
+
getValue: function getValue(fallback) {
|
137
|
+
return '#B3D4FF';
|
138
|
+
},
|
139
|
+
token: 'var(--ds-background-accent-blue-subtler, #B3D4FF)'
|
140
|
+
},
|
141
|
+
/** blue - strong */
|
142
|
+
'#4C9AFF': {
|
143
|
+
getValue: function getValue(fallback) {
|
144
|
+
return '#4C9AFF';
|
145
|
+
},
|
146
|
+
token: 'var(--ds-background-accent-blue-subtle, #4C9AFF)'
|
147
|
+
},
|
148
|
+
/** teal - light */
|
149
|
+
'#E6FCFF': {
|
150
|
+
getValue: function getValue(fallback) {
|
151
|
+
return '#E6FCFF';
|
152
|
+
},
|
153
|
+
token: 'var(--ds-background-accent-teal-subtlest, #E6FCFF)'
|
154
|
+
},
|
155
|
+
/** teal - medium */
|
156
|
+
'#B3F5FF': {
|
157
|
+
getValue: function getValue(fallback) {
|
158
|
+
return '#B3F5FF';
|
159
|
+
},
|
160
|
+
token: 'var(--ds-background-accent-teal-subtler, #B3F5FF)'
|
161
|
+
},
|
162
|
+
/** teal - strong */
|
163
|
+
'#79E2F2': {
|
164
|
+
getValue: function getValue(fallback) {
|
165
|
+
return '#79E2F2';
|
166
|
+
},
|
167
|
+
token: 'var(--ds-background-accent-teal-subtle, #79E2F2)'
|
168
|
+
},
|
169
|
+
/** green - light */
|
170
|
+
'#E3FCEF': {
|
171
|
+
getValue: function getValue(fallback) {
|
172
|
+
return '#E3FCEF';
|
173
|
+
},
|
174
|
+
token: 'var(--ds-background-accent-green-subtlest, #E3FCEF)'
|
175
|
+
},
|
176
|
+
/** green - medium */
|
177
|
+
'#ABF5D1': {
|
178
|
+
getValue: function getValue(fallback) {
|
179
|
+
return '#ABF5D1';
|
180
|
+
},
|
181
|
+
token: 'var(--ds-background-accent-green-subtler, #ABF5D1)'
|
182
|
+
},
|
183
|
+
/** green - strong */
|
184
|
+
'#57D9A3': {
|
185
|
+
getValue: function getValue(fallback) {
|
186
|
+
return '#57D9A3';
|
187
|
+
},
|
188
|
+
token: 'var(--ds-background-accent-green-subtle, #57D9A3)'
|
189
|
+
},
|
190
|
+
/** yellowOrange - light */
|
191
|
+
'#FFFAE6': {
|
192
|
+
getValue: function getValue(fallback) {
|
193
|
+
return '#FFFAE6';
|
194
|
+
},
|
195
|
+
token: 'var(--ds-background-accent-yellow-subtlest, #FFFAE6)'
|
196
|
+
},
|
197
|
+
/** yellowOrange - medium */
|
198
|
+
'#FFF0B3': {
|
199
|
+
getValue: function getValue(fallback) {
|
200
|
+
return '#FFF0B3';
|
201
|
+
},
|
202
|
+
token: 'var(--ds-background-accent-yellow-subtler, #FFF0B3)'
|
203
|
+
},
|
204
|
+
/** yellowOrange - strong */
|
205
|
+
'#FFC400': {
|
206
|
+
getValue: function getValue(fallback) {
|
207
|
+
return '#FFC400';
|
208
|
+
},
|
209
|
+
token: 'var(--ds-background-accent-orange-subtle, #FFC400)'
|
210
|
+
},
|
211
|
+
/** red - light */
|
212
|
+
'#FFEBE6': {
|
213
|
+
getValue: function getValue(fallback) {
|
214
|
+
return '#FFEBE6';
|
215
|
+
},
|
216
|
+
token: 'var(--ds-background-accent-red-subtlest, #FFEBE6)'
|
217
|
+
},
|
218
|
+
/** red - medium */
|
219
|
+
'#FFBDAD': {
|
220
|
+
getValue: function getValue(fallback) {
|
221
|
+
return '#FFBDAD';
|
222
|
+
},
|
223
|
+
token: 'var(--ds-background-accent-red-subtler, #FFBDAD)'
|
224
|
+
},
|
225
|
+
/** red - strong */
|
226
|
+
'#FF8F73': {
|
227
|
+
getValue: function getValue(fallback) {
|
228
|
+
return '#FF8F73';
|
229
|
+
},
|
230
|
+
token: 'var(--ds-background-accent-red-subtle, #FF8F73)'
|
231
|
+
},
|
232
|
+
/** purple - light */
|
233
|
+
'#EAE6FF': {
|
234
|
+
getValue: function getValue(fallback) {
|
235
|
+
return '#EAE6FF';
|
236
|
+
},
|
237
|
+
token: 'var(--ds-background-accent-purple-subtlest, #EAE6FF)'
|
238
|
+
},
|
239
|
+
/** purple - medium */
|
240
|
+
'#C0B6F2': {
|
241
|
+
getValue: function getValue(fallback) {
|
242
|
+
return '#C0B6F2';
|
243
|
+
},
|
244
|
+
token: 'var(--ds-background-accent-purple-subtler, #C0B6F2)'
|
245
|
+
},
|
246
|
+
/** purple - strong */
|
247
|
+
'#998DD9': {
|
248
|
+
getValue: function getValue(fallback) {
|
249
|
+
return '#998DD9';
|
250
|
+
},
|
251
|
+
token: 'var(--ds-background-accent-purple-subtle, #998DD9)'
|
252
|
+
},
|
253
|
+
/** whiteGray - light */
|
254
|
+
'#FFFFFF': {
|
255
|
+
getValue: function getValue(fallback) {
|
256
|
+
return '#FFFFFF';
|
257
|
+
},
|
258
|
+
token: 'var(--ds-surface, #FFFFFF)'
|
259
|
+
},
|
260
|
+
/** whiteGray - medium */
|
261
|
+
'#F4F5F7': {
|
262
|
+
getValue: function getValue(fallback) {
|
263
|
+
return '#F4F5F7';
|
264
|
+
},
|
265
|
+
token: 'var(--ds-background-accent-gray-subtlest, #F4F5F7)'
|
266
|
+
},
|
267
|
+
/** whiteGray - strong */
|
268
|
+
'#B3BAC5': {
|
269
|
+
getValue: function getValue(fallback) {
|
270
|
+
return '#B3BAC5';
|
271
|
+
},
|
272
|
+
token: 'var(--ds-background-accent-gray-subtle, #B3BAC5)'
|
273
|
+
}
|
274
|
+
};
|
275
|
+
export {};
|
@@ -7,3 +7,6 @@ export type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttrib
|
|
7
7
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
8
8
|
export { inlineNodes } from './inline-nodes';
|
9
9
|
export { sanitizeNodes, createSchema } from './create-schema';
|
10
|
+
declare const nodes: string[];
|
11
|
+
declare const marks: string[];
|
12
|
+
export { nodes, marks };
|
@@ -0,0 +1,221 @@
|
|
1
|
+
/**
|
2
|
+
* This takes an adf hex color and returns a matching border palette color.
|
3
|
+
*
|
4
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
5
|
+
*
|
6
|
+
* Example usage
|
7
|
+
* ```tsx
|
8
|
+
* const cssValue = hexToEditorBorderPaletteColor('#091E4224');
|
9
|
+
* // ^? const cssValue: string
|
10
|
+
* <div style={{borderColor: cssValue}} />
|
11
|
+
* ```
|
12
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
13
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
14
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
15
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
16
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
17
|
+
*/
|
18
|
+
export declare function hexToEditorBorderPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends EditorBorderPaletteKey ? EditorBorderPalette[HexColor] : string | undefined;
|
19
|
+
type EditorBorderPalette = typeof editorBorderPalette;
|
20
|
+
export type EditorBorderPaletteKey = keyof EditorBorderPalette;
|
21
|
+
export declare const editorBorderPalette: {
|
22
|
+
/** gray - subtle */
|
23
|
+
'#091E4224': string;
|
24
|
+
/** gray */
|
25
|
+
'#758195': string;
|
26
|
+
/** gray - bold */
|
27
|
+
'#172B4D': string;
|
28
|
+
};
|
29
|
+
/**
|
30
|
+
* This takes an adf hex color and returns a matching text palette color.
|
31
|
+
*
|
32
|
+
* By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
|
33
|
+
*
|
34
|
+
* Example usage
|
35
|
+
* ```tsx
|
36
|
+
* const cssValue = hexToTextPaletteColor('#0747A6');
|
37
|
+
* // ^? const cssValue: string
|
38
|
+
* <span style={{textColor: cssValue}} />
|
39
|
+
* ```
|
40
|
+
* The names of tokens can change over time, and the values of tokens will differ between themes.
|
41
|
+
* The exact output of this function is an implementation detail and should only be used when rendering
|
42
|
+
* content to the user, on a client with a matching major version of `@atlaskit/tokens`.
|
43
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
44
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
|
45
|
+
*/
|
46
|
+
export declare function hexToEditorTextPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends EditorTextPaletteKey ? EditorTextPalette[HexColor] : string | undefined;
|
47
|
+
type EditorTextPalette = typeof editorTextPalette;
|
48
|
+
export type EditorTextPaletteKey = keyof EditorTextPalette;
|
49
|
+
export declare const editorTextPalette: {
|
50
|
+
/** blue - light */
|
51
|
+
'#B3D4FF': string;
|
52
|
+
/** blue - medium */
|
53
|
+
'#4C9AFF': string;
|
54
|
+
/** blue - strong */
|
55
|
+
'#0747A6': string;
|
56
|
+
/** teal - light */
|
57
|
+
'#B3F5FF': string;
|
58
|
+
/** teal - medium */
|
59
|
+
'#00B8D9': string;
|
60
|
+
/** teal - strong */
|
61
|
+
'#008DA6': string;
|
62
|
+
/** green - light */
|
63
|
+
'#ABF5D1': string;
|
64
|
+
/** green - medium */
|
65
|
+
'#36B37E': string;
|
66
|
+
/** green - strong */
|
67
|
+
'#006644': string;
|
68
|
+
/** yellowOrange - light */
|
69
|
+
'#FFF0B3': string;
|
70
|
+
/** yellowOrange - medium */
|
71
|
+
'#FFC400': string;
|
72
|
+
/** yellowOrange - strong */
|
73
|
+
'#FF991F': string;
|
74
|
+
/** red - light */
|
75
|
+
'#FFBDAD': string;
|
76
|
+
/** red - medium */
|
77
|
+
'#FF5630': string;
|
78
|
+
/** red - strong */
|
79
|
+
'#BF2600': string;
|
80
|
+
/** purple - light */
|
81
|
+
'#EAE6FF': string;
|
82
|
+
/** purple - medium */
|
83
|
+
'#6554C0': string;
|
84
|
+
/** purple - strong */
|
85
|
+
'#403294': string;
|
86
|
+
/** whiteGray - light */
|
87
|
+
'#FFFFFF': string;
|
88
|
+
/** whiteGray - medium */
|
89
|
+
'#97A0AF': string;
|
90
|
+
/** whiteGray - strong */
|
91
|
+
'#172B4D': string;
|
92
|
+
};
|
93
|
+
/**
|
94
|
+
* Takes an ADF hex color and returns the rendered hex code for the associated background palette design token using getTokenValue.
|
95
|
+
* If the provided color does not exist in the Editor color palette, this function returns undefined.
|
96
|
+
*
|
97
|
+
* This should only be used when rendering content where CSS variables are not feasible, such as a non-CSS environment
|
98
|
+
* or to enable cross-app copy/paste.
|
99
|
+
*
|
100
|
+
* WARNING: If the rendered theme changes (such as from light -> dark mode) the value returned here will no longer match
|
101
|
+
* the surrounding UI and will need to be re-fetched.
|
102
|
+
* In addition, the values of tokens will differ between themes and the value for a given theme can and will change.
|
103
|
+
* - **DO NOT**: store the output of these functions in any user-generated content or back-end.
|
104
|
+
* - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color.
|
105
|
+
*/
|
106
|
+
export declare function hexToEditorBackgroundPaletteRawValue<HexColor extends string>(hexColor: HexColor): HexColor extends EditorBackgroundPaletteKey ? string : undefined;
|
107
|
+
type EditorBackgroundPalette = typeof editorBackgroundPalette;
|
108
|
+
export type EditorBackgroundPaletteKey = keyof EditorBackgroundPalette;
|
109
|
+
/**
|
110
|
+
* Values are asserted to improve generated type declarations
|
111
|
+
* Using object structure as getValue() function needed for table values, and other
|
112
|
+
* properties may be needed in the future.
|
113
|
+
*/
|
114
|
+
export declare const editorBackgroundPalette: {
|
115
|
+
/** blue - light */
|
116
|
+
'#DEEBFF': {
|
117
|
+
getValue: (fallback: string) => string;
|
118
|
+
token: string;
|
119
|
+
};
|
120
|
+
/** blue - medium */
|
121
|
+
'#B3D4FF': {
|
122
|
+
getValue: (fallback: string) => string;
|
123
|
+
token: string;
|
124
|
+
};
|
125
|
+
/** blue - strong */
|
126
|
+
'#4C9AFF': {
|
127
|
+
getValue: (fallback: string) => string;
|
128
|
+
token: string;
|
129
|
+
};
|
130
|
+
/** teal - light */
|
131
|
+
'#E6FCFF': {
|
132
|
+
getValue: (fallback: string) => string;
|
133
|
+
token: string;
|
134
|
+
};
|
135
|
+
/** teal - medium */
|
136
|
+
'#B3F5FF': {
|
137
|
+
getValue: (fallback: string) => string;
|
138
|
+
token: string;
|
139
|
+
};
|
140
|
+
/** teal - strong */
|
141
|
+
'#79E2F2': {
|
142
|
+
getValue: (fallback: string) => string;
|
143
|
+
token: string;
|
144
|
+
};
|
145
|
+
/** green - light */
|
146
|
+
'#E3FCEF': {
|
147
|
+
getValue: (fallback: string) => string;
|
148
|
+
token: string;
|
149
|
+
};
|
150
|
+
/** green - medium */
|
151
|
+
'#ABF5D1': {
|
152
|
+
getValue: (fallback: string) => string;
|
153
|
+
token: string;
|
154
|
+
};
|
155
|
+
/** green - strong */
|
156
|
+
'#57D9A3': {
|
157
|
+
getValue: (fallback: string) => string;
|
158
|
+
token: string;
|
159
|
+
};
|
160
|
+
/** yellowOrange - light */
|
161
|
+
'#FFFAE6': {
|
162
|
+
getValue: (fallback: string) => string;
|
163
|
+
token: string;
|
164
|
+
};
|
165
|
+
/** yellowOrange - medium */
|
166
|
+
'#FFF0B3': {
|
167
|
+
getValue: (fallback: string) => string;
|
168
|
+
token: string;
|
169
|
+
};
|
170
|
+
/** yellowOrange - strong */
|
171
|
+
'#FFC400': {
|
172
|
+
getValue: (fallback: string) => string;
|
173
|
+
token: string;
|
174
|
+
};
|
175
|
+
/** red - light */
|
176
|
+
'#FFEBE6': {
|
177
|
+
getValue: (fallback: string) => string;
|
178
|
+
token: string;
|
179
|
+
};
|
180
|
+
/** red - medium */
|
181
|
+
'#FFBDAD': {
|
182
|
+
getValue: (fallback: string) => string;
|
183
|
+
token: string;
|
184
|
+
};
|
185
|
+
/** red - strong */
|
186
|
+
'#FF8F73': {
|
187
|
+
getValue: (fallback: string) => string;
|
188
|
+
token: string;
|
189
|
+
};
|
190
|
+
/** purple - light */
|
191
|
+
'#EAE6FF': {
|
192
|
+
getValue: (fallback: string) => string;
|
193
|
+
token: string;
|
194
|
+
};
|
195
|
+
/** purple - medium */
|
196
|
+
'#C0B6F2': {
|
197
|
+
getValue: (fallback: string) => string;
|
198
|
+
token: string;
|
199
|
+
};
|
200
|
+
/** purple - strong */
|
201
|
+
'#998DD9': {
|
202
|
+
getValue: (fallback: string) => string;
|
203
|
+
token: string;
|
204
|
+
};
|
205
|
+
/** whiteGray - light */
|
206
|
+
'#FFFFFF': {
|
207
|
+
getValue: (fallback: string) => string;
|
208
|
+
token: string;
|
209
|
+
};
|
210
|
+
/** whiteGray - medium */
|
211
|
+
'#F4F5F7': {
|
212
|
+
getValue: (fallback: string) => string;
|
213
|
+
token: string;
|
214
|
+
};
|
215
|
+
/** whiteGray - strong */
|
216
|
+
'#B3BAC5': {
|
217
|
+
getValue: (fallback: string) => string;
|
218
|
+
token: string;
|
219
|
+
};
|
220
|
+
};
|
221
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "29.
|
3
|
+
"version": "29.1.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/"
|
@@ -32,11 +32,9 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@atlaskit/codemod-utils": "^4.2.0",
|
35
|
-
"@atlaskit/editor-palette": "1.5.0",
|
36
35
|
"@atlaskit/editor-prosemirror": "*",
|
37
36
|
"@atlaskit/editor-tables": "^2.3.0",
|
38
37
|
"@atlaskit/json-schema-generator": "^3.3.6",
|
39
|
-
"@atlaskit/tokens": "1.19.0",
|
40
38
|
"@babel/runtime": "^7.0.0",
|
41
39
|
"css-color-names": "0.0.4",
|
42
40
|
"linkify-it": "^2.0.3",
|