@instructure/canvas-rce 5.10.1 → 5.10.2

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.
@@ -24,7 +24,7 @@ import { Button, IconButton, CondensedButton } from '@instructure/ui-buttons';
24
24
  import { Flex } from '@instructure/ui-flex';
25
25
  import { View } from '@instructure/ui-view';
26
26
  import { Badge } from '@instructure/ui-badge';
27
- import { InstUISettingsProvider } from '@instructure/emotion';
27
+ import { ApplyTheme } from '@instructure/ui-themeable';
28
28
  import { Text } from '@instructure/ui-text';
29
29
  import { SVGIcon } from '@instructure/ui-svg-images';
30
30
  import { IconA11yLine, IconKeyboardShortcutsLine, IconMiniArrowEndLine, IconFullScreenLine, IconExitFullScreenLine } from '@instructure/ui-icons';
@@ -190,12 +190,10 @@ export default function StatusBar(props) {
190
190
  return button;
191
191
  }
192
192
 
193
- return /*#__PURE__*/React.createElement(InstUISettingsProvider, {
193
+ return /*#__PURE__*/React.createElement(ApplyTheme, {
194
194
  theme: {
195
- componentOverrides: {
196
- Badge: {
197
- colorPrimary: props.a11yBadgeColor
198
- }
195
+ [Badge.theme]: {
196
+ colorPrimary: props.a11yBadgeColor
199
197
  }
200
198
  }
201
199
  }, /*#__PURE__*/React.createElement(Badge, {
@@ -36,7 +36,7 @@ import { TextInput } from '@instructure/ui-text-input';
36
36
  import { TextArea } from '@instructure/ui-text-area';
37
37
  import { SimpleSelect } from '@instructure/ui-simple-select';
38
38
  import { IconQuestionLine } from '@instructure/ui-icons';
39
- import { InstUISettingsProvider } from '@instructure/emotion';
39
+ import { ApplyTheme } from '@instructure/ui-themeable';
40
40
  import { Alert } from '@instructure/ui-alerts';
41
41
  import ColorField from './color-field';
42
42
  import PlaceholderSVG from './placeholder-svg';
@@ -428,12 +428,10 @@ export default class Checker extends React.Component {
428
428
  onClick: () => this.setState({
429
429
  showWhyPopover: false
430
430
  })
431
- }, formatMessage('Close')), /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement("p", null, rule.why()), /*#__PURE__*/React.createElement("p", null, rule.link && rule.link.length && /*#__PURE__*/React.createElement(InstUISettingsProvider, {
431
+ }, formatMessage('Close')), /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement("p", null, rule.why()), /*#__PURE__*/React.createElement("p", null, rule.link && rule.link.length && /*#__PURE__*/React.createElement(ApplyTheme, {
432
432
  theme: {
433
- componentOverrides: {
434
- Link: {
435
- textDecoration: 'underline'
436
- }
433
+ [Link.theme]: {
434
+ textDecoration: 'underline'
437
435
  }
438
436
  }
439
437
  }, /*#__PURE__*/React.createElement(Link, {
@@ -0,0 +1,127 @@
1
+ /*
2
+ * Copyright (C) 2019 - present Instructure, Inc.
3
+ *
4
+ * This file is part of Canvas.
5
+ *
6
+ * Canvas is free software: you can redistribute it and/or modify it under
7
+ * the terms of the GNU Affero General Public License as published by the Free
8
+ * Software Foundation, version 3 of the License.
9
+ *
10
+ * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
+ * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
+ * details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License along
16
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { darken, lighten, alpha } from '@instructure/ui-color-utils'; // pull canvas theme values we need for the rce skin
19
+
20
+ export default function generator(_ref) {
21
+ let {
22
+ borders,
23
+ colors,
24
+ forms,
25
+ shadows,
26
+ spacing,
27
+ typography
28
+ } = _ref;
29
+ const vars = {
30
+ canvasBackgroundColor: colors.white,
31
+ canvasTextColor: colors.textDarkest,
32
+ canvasErrorColor: colors.textDanger,
33
+ canvasWarningColor: colors.textWarning,
34
+ canvasInfoColor: colors.textInfo,
35
+ canvasSuccessColor: colors.textSuccess,
36
+ canvasBorderColor: colors.borderMedium,
37
+ toolbarButtonHoverBackground: darken(colors.backgroundLightest, 5),
38
+ // copied from INSTUI "light" Button
39
+ canvasBrandColor: colors.brand,
40
+ activeMenuItemBackground: colors.backgroundBrand,
41
+ activeMenuItemLabelColor: colors.textLightest,
42
+ tableSelectorHighlightColor: alpha(lighten(colors.brand, 10), 50),
43
+ canvasLinkColor: colors.link,
44
+ canvasLinkDecoration: 'none',
45
+ // the instui default button
46
+ canvasButtonBackground: colors.backgroundLightest,
47
+ canvasButtonBorderColor: 'transparent',
48
+ canvasButtonColor: colors.textDarkest,
49
+ canvasButtonHoverBackground: colors.backgroundLightest,
50
+ canvasButtonHoverColor: colors.brand,
51
+ canvasButtonActiveBackground: colors.backgroundLightest,
52
+ canvasButtonFontWeight: typography.fontWeightNormal,
53
+ canvasButtonFontSize: typography.fontSizeMedium,
54
+ canvasButtonLineHeight: forms.inputHeightMedium,
55
+ canvasButtonPadding: `0 ${spacing.small}`,
56
+ // the instui primary button
57
+ canvasPrimaryButtonBackground: colors.backgroundBrand,
58
+ canvasPrimaryButtonColor: colors.textLightest,
59
+ canvasPrimaryButtonBorderColor: 'transparent',
60
+ canvasPrimaryButtonHoverBackground: darken(colors.backgroundBrand, 10),
61
+ canvasPrimaryButtonHoverColor: colors.textLightest,
62
+ // the instui secondary button
63
+ canvasSecondaryButtonBackground: colors.backgroundLight,
64
+ canvasSecondaryButtonColor: colors.textDarkest,
65
+ canvasSecondaryButtonBorderColor: darken(colors.backgroundLight, 10),
66
+ canvasSecondaryButtonHoverBackground: darken(colors.backgroundLight, 10),
67
+ canvasSecondaryButtonHoverColor: colors.textDarkest,
68
+ canvasFocusBorderColor: borders.brand,
69
+ canvasFocusBorderWidth: borders.widthSmall,
70
+ // canvas really uses widthMedium
71
+ canvasFocusBoxShadow: `0 0 0 2px ${colors.brand}`,
72
+ canvasEnabledColor: borders.brand,
73
+ canvasEnabledBoxShadow: `inset 0 0 0.1875rem 0.0625rem ${darken(colors.borderLightest, 25)}`,
74
+ canvasFontFamily: typography.fontFamily,
75
+ canvasFontSize: '1rem',
76
+ canvasFontSizeSmall: typography.fontSizeSmall,
77
+ // modal dialogs
78
+ canvasModalShadow: shadows.depth3,
79
+ canvasModalHeadingPadding: spacing.medium,
80
+ canvasModalHeadingFontSize: typography.fontSizeXLarge,
81
+ canvasModalHeadingFontWeight: typography.fontWeightNormal,
82
+ canvasModalBodyPadding: spacing.medium,
83
+ canvasModalFooterPadding: spacing.small,
84
+ canvasModalFooterBackground: colors.backgroundLight,
85
+ canvasFormElementMargin: `0 0 ${spacing.medium} 0`,
86
+ canvasFormElementLabelColor: colors.textDarkest,
87
+ canvasFormElementLabelMargin: `0 0 ${spacing.small} 0`,
88
+ canvasFormElementLabelFontSize: typography.fontSizeMedium,
89
+ canvasFormElementLabelFontWeight: typography.fontWeightBold,
90
+ // a11y button badge
91
+ canvasBadgeBackgroundColor: colors.textInfo
92
+ };
93
+ vars.tinySplitButtonChevronHoverBackground = darken(vars.toolbarButtonHoverBackground, 10);
94
+ return vars;
95
+ }
96
+
97
+ generator.canvas = function (variables) {
98
+ return {
99
+ canvasLinkColor: variables['ic-link-color'],
100
+ canvasLinkDecoration: variables['ic-link-decoration'],
101
+ canvasTextColor: variables['ic-brand-font-color-dark'],
102
+ canvasBrandColor: variables['ic-brand-primary'],
103
+ canvasFocusBorderColor: variables['ic-brand-primary'],
104
+ canvasFocusBoxShadow: `0 0 0 2px ${variables['ic-brand-primary']}`,
105
+ canvasEnabledColor: variables['ic-brand-primary'],
106
+ canvasPrimaryButtonBackground: variables['ic-brand-primary'],
107
+ canvasPrimaryButtonColor: variables['ic-brand-button--primary-text'],
108
+ canvasPrimaryButtonHoverBackground: darken(variables['ic-brand-button--primary-bgd'], 10),
109
+ activeMenuItemBackground: variables['ic-brand-button--primary-bgd'],
110
+ activeMenuItemLabelColor: variables['ic-brand-button--primary-text'],
111
+ tableSelectorHighlightColor: alpha(lighten(variables['ic-brand-primary'], 10), 50)
112
+ };
113
+ };
114
+
115
+ generator['canvas-a11y'] = generator['canvas-high-contrast'] = function (_ref2) {
116
+ let {
117
+ colors
118
+ } = _ref2;
119
+ return {
120
+ canvasButtonBackground: colors.backgroundLight,
121
+ canvasSecondaryButtonBorderColor: colors.borderMedium,
122
+ canvasLinkDecoration: 'underline',
123
+ canvasFocusBorderColor: colors.borderBrand,
124
+ canvasFocusBoxShadow: `0 0 0 2px ${colors.brand}`,
125
+ canvasBrandColor: colors.brand
126
+ };
127
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/canvas-rce",
3
- "version": "5.10.1",
3
+ "version": "5.10.2",
4
4
  "description": "A component wrapping Canvas's usage of Tinymce",
5
5
  "main": "es/index.js",
6
6
  "scripts": {
@@ -76,9 +76,8 @@
76
76
  "@instructure/canvas-media": "*",
77
77
  "@instructure/canvas-theme": "7",
78
78
  "@instructure/debounce": "^7",
79
- "@instructure/emotion": "^8.38.1",
80
79
  "@instructure/k5uploader": "*",
81
- "@instructure/media-capture": "^9.0.0",
80
+ "@instructure/media-capture": "~8.4.1-rc.16",
82
81
  "@instructure/ui-a11y-content": "^7",
83
82
  "@instructure/ui-a11y-utils": "^7",
84
83
  "@instructure/ui-alerts": "^7",
@@ -99,7 +98,7 @@
99
98
  "@instructure/ui-img": "^7",
100
99
  "@instructure/ui-link": "^7",
101
100
  "@instructure/ui-list": "^7",
102
- "@instructure/ui-media-player": "^9.0.0",
101
+ "@instructure/ui-media-player": "7",
103
102
  "@instructure/ui-menu": "^7",
104
103
  "@instructure/ui-modal": "^7",
105
104
  "@instructure/ui-motion": "^7",
@@ -158,18 +157,18 @@
158
157
  "redux-batch-middleware": "^0.2.0",
159
158
  "redux-thunk": "^2",
160
159
  "scroll-into-view": "https://github.com/bkirkby/scroll-into-view.git#588b0ced98eeecf84e6fb2074aa076e80b7cffab",
161
- "text-field-edit": "^3.2.0",
162
160
  "tinymce": "^5",
161
+ "text-field-edit": "^3.2.0",
163
162
  "uri-js": "^4.2.2",
164
163
  "wcag-element-contrast": "^1.0.1"
165
164
  },
166
165
  "devDependencies": {
167
166
  "@babel/cli": "^7",
168
167
  "@babel/core": "^7",
169
- "@babel/plugin-proposal-optional-chaining": "^7.20.7",
170
- "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
171
168
  "@babel/preset-typescript": "^7",
172
169
  "@babel/register": "7",
170
+ "@babel/plugin-proposal-optional-chaining": "^7.20.7",
171
+ "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3",
173
172
  "@instructure/babel-plugin-themeable-styles": "7.19.0-canvas",
174
173
  "@instructure/browserslist-config-canvas-lms": ">=2",
175
174
  "@instructure/translations": ">=1",
@@ -198,7 +197,6 @@
198
197
  "jest": "^28",
199
198
  "jest-canvas-mock": "^2",
200
199
  "jest-junit": "^7",
201
- "jest-mock-proxy": "3.1.2",
202
200
  "mathjax": "^3.2.0",
203
201
  "mocha": "^6",
204
202
  "mocha-junit-reporter": "^1.18.0",
@@ -210,7 +208,6 @@
210
208
  "shelljs": "^0.8.3",
211
209
  "sinon": "^7",
212
210
  "skin-deep": "^1",
213
- "source-map-support": "0.5.21",
214
211
  "testcafe": "1.14.2",
215
212
  "testcafe-browser-provider-selenium": "^1.2.0",
216
213
  "testcafe-react-selectors": "^3.3.0",
@@ -220,7 +217,9 @@
220
217
  "webpack": "^5",
221
218
  "webpack-merge": "^5",
222
219
  "webpack-nano": "^1",
223
- "webpack-plugin-serve": "^1"
220
+ "webpack-plugin-serve": "^1",
221
+ "source-map-support": "0.5.21",
222
+ "jest-mock-proxy": "3.1.2"
224
223
  },
225
224
  "resolutions": {
226
225
  "format-message-estree-util": "./packages/format-message-estree-util"
@@ -1,46 +0,0 @@
1
- /*
2
- * Copyright (C) 2023 - present Instructure, Inc.
3
- *
4
- * This file is part of Canvas.
5
- *
6
- * Canvas is free software: you can redistribute it and/or modify it under
7
- * the terms of the GNU Affero General Public License as published by the Free
8
- * Software Foundation, version 3 of the License.
9
- *
10
- * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
11
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
- * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
13
- * details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License along
16
- * with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
- import { ThemeRegistry } from '@instructure/ui-themeable'; // ^^ at InstUI 8, just directly import getRegistry directly from @instructure/theme-registry
19
-
20
- import { merge, cloneDeep } from 'lodash'; // The running theme is the running theme for this page load, and it never
21
- // changes, so there's no point in doing the work more than once.
22
-
23
- let memoizedVariables;
24
-
25
- function getThemeVars() {
26
- if (memoizedVariables) return memoizedVariables;
27
- const {
28
- defaultThemeKey,
29
- overrides,
30
- themes
31
- } = ThemeRegistry.getRegistry(); // Just assume the "canvas" theme if the default key is null. This will
32
- // never happen in the live app because one way or another a theme gets
33
- // used, but unit tests don't always do that.
34
- // Also we have to cloneDeep this because the merge below is about to
35
- // mutate the whole thing.
36
-
37
- const variables = cloneDeep(themes[defaultThemeKey !== null && defaultThemeKey !== void 0 ? defaultThemeKey : 'canvas'].variables);
38
- merge(variables, overrides);
39
- memoizedVariables = {
40
- variables,
41
- key: defaultThemeKey
42
- };
43
- return memoizedVariables;
44
- }
45
-
46
- export { getThemeVars };