wjec-one 5.0.0-alpha.0 → 5.0.0-alpha.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.
@@ -25,8 +25,19 @@ module.exports = (_env, { mode }) => ({
25
25
  }
26
26
  }]
27
27
  },
28
+ {
29
+ test: /(.*)\.favicon\.(ico|svg)$/,
30
+ use: {
31
+ loader: 'file-loader',
32
+ options: {
33
+ name: './[name].[ext]',
34
+ publicPath: '../'
35
+ }
36
+ }
37
+ },
28
38
  {
29
39
  test: /\.svg$/,
40
+ exclude: /(.*)\.favicon\.svg$/,
30
41
  use: [{
31
42
  loader: '@svgr/webpack',
32
43
  options: {
@@ -38,14 +49,17 @@ module.exports = (_env, { mode }) => ({
38
49
  '#2E3638': 'currentColor'
39
50
  },
40
51
  svgoConfig: {
41
- plugins: [{
42
- name: 'preset-default',
43
- params: {
44
- overrides: {
45
- removeViewBox: false
46
- }
52
+ plugins: [
53
+ {
54
+ name: 'preset-default',
55
+ params: {
56
+ overrides: {
57
+ removeViewBox: false,
58
+ cleanupIds: false
59
+ }
60
+ },
47
61
  }
48
- }]
62
+ ]
49
63
  },
50
64
  svgProps: {
51
65
  xmlns: 'http://www.w3.org/2000/svg'
@@ -53,19 +67,6 @@ module.exports = (_env, { mode }) => ({
53
67
  }
54
68
  }]
55
69
  },
56
- {
57
- type: 'javascript/auto',
58
- test: /\.json$/,
59
- include: /config/,
60
- exclude: /node_modules/,
61
- use: {
62
- loader: 'file-loader',
63
- options: {
64
- name: './config/[name].json',
65
- publicPath: '../'
66
- }
67
- }
68
- },
69
70
  {
70
71
  test: /\.(ttf|eot|woff|woff2)$/,
71
72
  use: {
@@ -1,6 +1,8 @@
1
+ const babelConfig = require('./babel.config');
1
2
  const CopyWebpackPlugin = require('copy-webpack-plugin');
2
3
  const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
3
4
  const fs = require('fs');
5
+ const glob = require('glob');
4
6
  const HtmlWebpackPlugin = require('html-webpack-plugin');
5
7
  const path = require('path');
6
8
  const webpack = require('webpack');
@@ -14,79 +16,136 @@ const { overrides = {} } = require(path.join(appPath, 'package.json'));
14
16
  const devServerHost = overrides.devServerHost || 'localhost';
15
17
  const devServerPort = overrides.devServerPort === undefined ? 9001 : overrides.devServerPort;
16
18
 
17
- module.exports = () => ({
18
- // Common config
19
- extends: path.resolve(__dirname, './webpack.common.config.js'),
19
+ const workerPathGlob = './!(node_modules|dist)/**/*.worker.@(js|ts)'.replaceAll(path.sep, path.posix.sep);
20
+ const workerPaths = glob.sync(workerPathGlob).reduce((workers, filePath) => {
21
+ const fileName = filePath.substring(filePath.lastIndexOf(path.sep) + 1, filePath.lastIndexOf('.'));
20
22
 
21
- // Overrides
22
- context: appPath,
23
- devServer: {
24
- host: devServerHost === 'localIp' ? '0.0.0.0' : devServerHost,
25
- port: devServerPort,
26
- historyApiFallback: true,
27
- server: 'http',
28
- static: {
29
- directory: path.resolve(appPath, './'),
30
- staticOptions: { redirect: false }
31
- }
32
- },
33
- entry: { index: `${appPath}/index.tsx` },
23
+ return {
24
+ ...workers,
25
+ [fileName]: `./${filePath}`
26
+ };
27
+ }, {});
28
+
29
+ const workerConfig = () => ({
30
+ extends: path.resolve(__dirname, './webpack.common.config.js'),
31
+ entry: workerPaths,
34
32
  module: {
35
- rules: [{
36
- type: 'javascript/auto',
37
- test: /\.json$/,
38
- include: /config/,
39
- exclude: /node_modules/,
40
- use: {
41
- loader: 'file-loader',
42
- options: {
43
- name: `./config/${generateFilename('[name]', '.json')}`,
44
- publicPath: '../'
45
- }
33
+ rules: [
34
+ {
35
+ loader: 'babel-loader',
36
+ options: babelConfig,
37
+ test: /\.(js|jsx|mjs|ts|tsx)$/,
38
+ exclude: /core-js/
46
39
  }
47
- }]
40
+ ]
48
41
  },
49
- output: {
50
- chunkFilename: generateFilename(),
51
- filename: generateFilename(),
52
- path: path.join(appPath, 'dist'),
53
- publicPath: '/'
54
- },
55
- plugins: [
56
- new CopyWebpackPlugin({
57
- patterns: [
58
- ...fs.readdirSync(path.join(appPath, 'config')).map((fileName) => ({
59
- from: path.join(appPath, 'config', fileName),
60
- to: `config/${generateFilename('[name]', '.json')}`
61
- }))
62
- ].filter(Boolean)
63
- }),
64
- new webpack.DefinePlugin({
65
- 'process.env.FILENAME_SUFFIX': JSON.stringify(getFilenameSuffix()),
66
- 'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG),
67
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
68
- }),
69
- new ForkTsCheckerWebpackPlugin({
70
- typescript: {
71
- configFile: path.join(configPath, './tsconfig.json')
72
- }
73
- }),
74
- new HtmlWebpackPlugin({
75
- template: path.join(appPath, 'index.html'),
76
- filename: './index.html',
77
- tsconfig: path.join(configPath, './tsconfig.json')
78
- })
79
- ],
80
42
  resolve: {
81
- fallback: {
82
- stream: require.resolve('stream-browserify'),
83
- process: require.resolve('process')
84
- },
85
43
  extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
86
44
  alias: {
87
45
  config: path.join(appPath, 'config'),
88
46
  src: path.join(appPath, 'src'),
89
47
  test: path.join(appPath, 'test')
90
48
  }
49
+ },
50
+ output: {
51
+ chunkFilename: generateFilename(),
52
+ filename: generateFilename(),
53
+ path: path.join(appPath, 'dist'),
54
+ publicPath: '/'
91
55
  }
92
56
  });
57
+
58
+ module.exports = () => ([
59
+ {
60
+ // Common config
61
+ extends: path.resolve(__dirname, './webpack.common.config.js'),
62
+
63
+ // Overrides
64
+ context: appPath,
65
+ devServer: {
66
+ host: devServerHost === 'localIp' ? '0.0.0.0' : devServerHost,
67
+ port: devServerPort,
68
+ historyApiFallback: true,
69
+ server: 'http',
70
+ static: {
71
+ directory: path.resolve(appPath, './'),
72
+ staticOptions: { redirect: false }
73
+ }
74
+ },
75
+ entry: { index: `${appPath}/index.tsx` },
76
+ module: {
77
+ rules: [
78
+ {
79
+ type: 'javascript/auto',
80
+ test: /\.json$/,
81
+ include: /config/,
82
+ exclude: /node_modules/,
83
+ use: {
84
+ loader: 'file-loader',
85
+ options: {
86
+ name: `./config/${generateFilename('[name]', '.json')}`,
87
+ publicPath: '../'
88
+ }
89
+ }
90
+ },
91
+ {
92
+ type: 'javascript/auto',
93
+ test: /\.worker\.(js|ts)$/,
94
+ exclude: /node_modules/,
95
+ use: {
96
+ loader: 'file-loader',
97
+ options: {
98
+ name: `./${generateFilename()}`,
99
+ publicPath: '',
100
+ emitFile: false
101
+ }
102
+ }
103
+ },
104
+ ],
105
+ },
106
+ output: {
107
+ chunkFilename: generateFilename(),
108
+ filename: generateFilename(),
109
+ path: path.join(appPath, 'dist'),
110
+ publicPath: '/'
111
+ },
112
+ plugins: [
113
+ new CopyWebpackPlugin({
114
+ patterns: [
115
+ ...fs.readdirSync(path.join(appPath, 'config')).map((fileName) => ({
116
+ from: path.join(appPath, 'config', fileName),
117
+ to: `config/${generateFilename('[name]', '.json')}`
118
+ }))
119
+ ].filter(Boolean)
120
+ }),
121
+ new webpack.DefinePlugin({
122
+ 'process.env.FILENAME_SUFFIX': JSON.stringify(getFilenameSuffix()),
123
+ 'process.env.NODE_DEBUG': JSON.stringify(process.env.NODE_DEBUG),
124
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
125
+ }),
126
+ new ForkTsCheckerWebpackPlugin({
127
+ typescript: {
128
+ configFile: path.join(configPath, './tsconfig.json')
129
+ }
130
+ }),
131
+ new HtmlWebpackPlugin({
132
+ template: path.join(appPath, 'index.html'),
133
+ filename: './index.html',
134
+ tsconfig: path.join(configPath, './tsconfig.json')
135
+ })
136
+ ],
137
+ resolve: {
138
+ fallback: {
139
+ stream: require.resolve('stream-browserify'),
140
+ process: require.resolve('process')
141
+ },
142
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json'],
143
+ alias: {
144
+ config: path.join(appPath, 'config'),
145
+ src: path.join(appPath, 'src'),
146
+ test: path.join(appPath, 'test')
147
+ }
148
+ }
149
+ },
150
+ (workerPaths && Object.keys(workerPaths).length > 0) && workerConfig()
151
+ ].filter(Boolean));
package/index.d.ts CHANGED
@@ -1460,7 +1460,7 @@ type Options = KeyframeAnimationOptions & {
1460
1460
  declare const useAnimation: <T extends KeyframeParams>(elementRef: MutableRefObject<HTMLElement | SVGElement>, keyframes: KeyframesArray<T> | KeyframesObject<T>, { onCancelled, onFinished, onStarted, playImmediately, ...options }?: Options) => {
1461
1461
  cancel: () => void;
1462
1462
  pause: () => void;
1463
- play: (values?: KeyframeValues<T>, optionOverrides?: Partial<Options>) => Animation;
1463
+ play: (values?: KeyframeValues<T>, optionOverrides?: KeyframeAnimationOptions) => Animation;
1464
1464
  readonly playState: AnimationPlayState;
1465
1465
  };
1466
1466
 
@@ -1477,6 +1477,7 @@ declare const useEventListener: EventListenerHook;
1477
1477
  type FocusTrapOptions = {
1478
1478
  dependencies?: unknown[];
1479
1479
  focusElement?: false | HTMLElement | number | string;
1480
+ returnFocusTo?: HTMLElement;
1480
1481
  shouldTrapFocus?: boolean | (() => boolean);
1481
1482
  };
1482
1483
  declare const useFocusTrap: (eventTarget: HTMLElement | MutableRefObject<HTMLElement>, options?: FocusTrapOptions) => void;