@rws-framework/client 2.14.1 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/builder/vite/index.ts +0 -0
  2. package/builder/vite/loaders/html.ts +0 -0
  3. package/builder/vite/loaders/index.ts +0 -0
  4. package/builder/vite/loaders/loader.type.ts +0 -0
  5. package/builder/vite/loaders/scss.ts +0 -0
  6. package/builder/vite/loaders/ts.ts +0 -0
  7. package/builder/vite/rws.vite.config.ts +0 -0
  8. package/builder/vite/rws_scss_plugin.ts +0 -0
  9. package/builder/vite/scss/_compiler.ts +0 -0
  10. package/builder/vite/scss/_fonts.ts +0 -0
  11. package/builder/vite/scss/_fs.ts +0 -0
  12. package/builder/vite/scss/_import.ts +0 -0
  13. package/builder/webpack/after/copy.js +1 -0
  14. package/builder/webpack/loaders/rws_fast_scss_loader.js +3 -1
  15. package/builder/webpack/loaders/rws_fast_ts_loader.js +2 -3
  16. package/builder/webpack/rws.webpack.config.js +12 -25
  17. package/builder/webpack/rws_scss_plugin.js +18 -9
  18. package/builder/webpack/scss/_compiler.js +5 -6
  19. package/builder/webpack/scss/_fonts.js +2 -2
  20. package/builder/webpack/scss/_fs.js +3 -2
  21. package/builder/webpack/scss/_import.js +53 -19
  22. package/cfg/build_steps/vite/_build_config.ts +0 -0
  23. package/cfg/build_steps/vite/_env_defines.ts +0 -0
  24. package/cfg/build_steps/vite/_loaders.ts +0 -0
  25. package/cfg/build_steps/vite/index.ts +0 -0
  26. package/cfg/build_steps/vite/types.ts +0 -0
  27. package/cfg/build_steps/webpack/_actions.js +0 -0
  28. package/cfg/build_steps/webpack/_aliases.js +1 -2
  29. package/cfg/build_steps/webpack/_build_config.js +10 -11
  30. package/cfg/build_steps/webpack/_component_handling.js +1 -1
  31. package/cfg/build_steps/webpack/_dev_servers.js +0 -0
  32. package/cfg/build_steps/webpack/_env_defines.js +1 -1
  33. package/cfg/build_steps/webpack/_info.js +12 -5
  34. package/cfg/build_steps/webpack/_loaders.js +39 -19
  35. package/cfg/build_steps/webpack/_parser.js +118 -0
  36. package/cfg/build_steps/webpack/_plugins.js +6 -6
  37. package/cfg/build_steps/webpack/_production.js +8 -10
  38. package/cfg/build_steps/webpack/_rws_externals.js +2 -2
  39. package/cfg/build_steps/webpack/_webpack_config.js +6 -12
  40. package/cfg/tsconfigSetup.js +4 -7
  41. package/package.json +13 -13
  42. package/src/styles/README.md +158 -0
  43. package/src/styles/_grid_legacy.scss +50 -0
  44. package/tsconfig.json +20 -31
@@ -2,20 +2,20 @@ const path = require('path');
2
2
  const fs = require('fs');
3
3
  const os = require('os');
4
4
 
5
+ const { parseWebpackPath } = require('./_parser');
6
+
5
7
  const RWSCssPlugin = require("../../../builder/webpack/rws_scss_plugin");
6
- const plugin = new RWSCssPlugin();
7
- const JSON5 = require('json5');
8
+
8
9
  const chalk = require('chalk');
9
10
  const { timingCounterStart, timingCounterStop } = require('./_timing');
10
- const { rwsRuntimeHelper } = require('@rws-framework/console');
11
+ const { rwsRuntimeHelper, rwsPath } = require('@rws-framework/console');
11
12
 
12
- function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
13
- const scssLoader = packageDir + '/builder/webpack/loaders/rws_fast_scss_loader.js';
14
- const tsLoader = packageDir + '/builder/webpack/loaders/rws_fast_ts_loader.js';
15
- const htmlLoader = packageDir + '/builder/webpack/loaders/rws_fast_html_loader.js';
13
+ function getRWSLoaders(packageDir, executionDir, tsConfig, entrypoint) {
14
+ const scssLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_scss_loader.js');
15
+ const tsLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_ts_loader.js');
16
+ const htmlLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_html_loader.js');
16
17
 
17
-
18
- return [
18
+ const loaders = [
19
19
  {
20
20
  test: /\.html$/,
21
21
  use: [
@@ -30,19 +30,34 @@ function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
30
30
  {
31
31
  loader: 'ts-loader',
32
32
  options: {
33
- transpileOnly: true,
34
- allowTsInNodeModules: true,
35
- configFile: path.resolve(tsConfigPath)
33
+ transpileOnly: false,
34
+ logLevel: "info", // Show more detailed errors
35
+ logInfoToStdOut: true,
36
+ context: executionDir,
37
+ errorFormatter: (message, colors) => {
38
+ const messageText = message.message || message;
39
+ return `\nTS Error: ${messageText}\n`;
40
+ },
41
+ ...tsConfig
36
42
  }
37
43
  },
38
44
  {
39
45
  loader: tsLoader,
46
+ options: {
47
+ rwsWorkspaceDir: executionDir
48
+ }
40
49
  }
41
50
  ],
51
+ include: [
52
+ path.resolve(executionDir, 'src'),
53
+ path.resolve(executionDir, '@dev', 'client', 'src'),
54
+ path.resolve(packageDir, 'src'),
55
+ path.resolve(packageDir, 'foundation', 'rws-foundation.d.ts')
56
+ ],
42
57
  exclude: [
43
58
  /node_modules\/(?!\@rws-framework\/[A-Z0-9a-z])/,
44
59
  /\.debug\.ts$/,
45
- /\.d\.ts$/,
60
+ /\.d\.ts$/
46
61
  ],
47
62
  },
48
63
  {
@@ -51,7 +66,9 @@ function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
51
66
  scssLoader,
52
67
  ],
53
68
  },
54
- ]
69
+ ];
70
+
71
+ return loaders;
55
72
  }
56
73
 
57
74
  function _extractRWSViewDefs(fastOptions = {}, decoratorArgs = {})
@@ -98,7 +115,7 @@ function extractRWSViewArgs(content, noReplace = false) {
98
115
  if (groupIndex === 2) {
99
116
  if (match) {
100
117
  try {
101
- decoratorArgs = JSON5.parse(match);
118
+ decoratorArgs = JSON.parse(JSON.stringify(match));
102
119
  } catch(e){
103
120
  console.log(chalk.red('Decorator options parse error: ') + e.message + '\n Problematic line:');
104
121
  console.log(`
@@ -107,6 +124,8 @@ function extractRWSViewArgs(content, noReplace = false) {
107
124
  console.log(chalk.yellowBright(`Decorator options failed to parse for "${tagName}" component.`) + ' { decoratorArgs } defaulting to null.');
108
125
  console.log(match);
109
126
 
127
+ console.error(e);
128
+
110
129
  throw new Error('Failed parsing @RWSView')
111
130
  }
112
131
  }
@@ -161,18 +180,19 @@ function extractRWSViewArgs(content, noReplace = false) {
161
180
  }
162
181
  }
163
182
 
164
- async function getStyles(filePath, addDependency, templateExists, stylesPath = null, isDev = false) {
183
+ async function getStyles(filePath, rwsWorkspaceDir, addDependency, templateExists, stylesPath = null, isDev = false) {
165
184
  if(!stylesPath){
166
185
  stylesPath = 'styles/layout.scss';
167
186
  }
168
187
 
169
188
  let styles = 'const styles: null = null;'
170
- const stylesFilePath = path.dirname(filePath) + '/' + stylesPath;
189
+ const stylesFilePath = path.join(path.dirname(filePath), stylesPath);
171
190
 
172
191
  if (fs.existsSync(stylesFilePath)) {
173
192
  const scsscontent = fs.readFileSync(stylesFilePath, 'utf-8');
174
193
  timingCounterStart();
175
- const codeData = await plugin.compileScssCode(scsscontent, path.dirname(filePath) + '/styles', null, filePath, !isDev);
194
+ const plugin = new RWSCssPlugin({ rwsWorkspaceDir });
195
+ const codeData = await plugin.compileScssCode(scsscontent, path.join(path.dirname(filePath), 'styles'), null, filePath, !isDev);
176
196
  const elapsed = timingCounterStop();
177
197
  let currentTimingList = rwsRuntimeHelper.getRWSVar('_timer_css');
178
198
 
@@ -193,7 +213,7 @@ async function getStyles(filePath, addDependency, templateExists, stylesPath = n
193
213
  }
194
214
  styles += `const styles = ${templateExists ? 'T.' : ''}css\`${cssCode}\`;\n`;
195
215
 
196
- addDependency(path.dirname(filePath) + '/' + stylesPath);
216
+ addDependency(path.join(path.dirname(filePath), '/', stylesPath));
197
217
  }
198
218
 
199
219
  return styles;
@@ -0,0 +1,118 @@
1
+ // _parser.js
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+
5
+ function checkIfPackageIsLinked(basePath, packageName) {
6
+ try {
7
+ // Check package.json first
8
+ const packageJsonPath = path.join(basePath, 'package.json');
9
+ if (fs.existsSync(packageJsonPath)) {
10
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
11
+
12
+ // Check if it's in dependencies or devDependencies
13
+ const version = packageJson.dependencies?.[packageName] || packageJson.devDependencies?.[packageName];
14
+
15
+ // If version starts with 'file:' or 'link:', it's linked
16
+ if (version && (version.startsWith('file:') || version.startsWith('link:'))) {
17
+ return {
18
+ isLinked: true,
19
+ source: 'package.json',
20
+ linkPath: version.replace(/^(file:|link:)/, '')
21
+ };
22
+ }
23
+ }
24
+
25
+ // Check yarn.lock
26
+ const yarnLockPath = path.join(basePath, 'yarn.lock');
27
+ if (fs.existsSync(yarnLockPath)) {
28
+ const yarnLockContent = fs.readFileSync(yarnLockPath, 'utf8');
29
+ const packageEntry = yarnLockContent.split('\n\n').find(entry =>
30
+ entry.includes(`"${packageName}@`)
31
+ );
32
+
33
+ if (packageEntry && packageEntry.includes('link:')) {
34
+ const linkMatch = packageEntry.match(/link: (.+)/);
35
+ return {
36
+ isLinked: true,
37
+ source: 'yarn.lock',
38
+ linkPath: linkMatch ? linkMatch[1] : null
39
+ };
40
+ }
41
+ }
42
+
43
+ // Check package-lock.json
44
+ const packageLockPath = path.join(basePath, 'package-lock.json');
45
+ if (fs.existsSync(packageLockPath)) {
46
+ const packageLock = JSON.parse(fs.readFileSync(packageLockPath, 'utf8'));
47
+ const packageInfo = packageLock.dependencies?.[packageName] ||
48
+ packageLock.devDependencies?.[packageName];
49
+
50
+ if (packageInfo && packageInfo.link) {
51
+ return {
52
+ isLinked: true,
53
+ source: 'package-lock.json',
54
+ linkPath: packageInfo.link
55
+ };
56
+ }
57
+ }
58
+
59
+ return {
60
+ isLinked: false,
61
+ source: null,
62
+ linkPath: null
63
+ };
64
+ } catch (e) {
65
+ console.error('Error checking package link status:', e);
66
+ return {
67
+ isLinked: false,
68
+ source: null,
69
+ linkPath: null,
70
+ error: e.message
71
+ };
72
+ }
73
+ }
74
+
75
+ function parseWebpackPath(stack) {
76
+ const currentFileLine = stack.split('\n').find(line => line.includes('_loaders.js'));
77
+ if (!currentFileLine) return null;
78
+
79
+ const match = currentFileLine.match(/\((.+?):\d+:\d+\)/);
80
+ if (!match) return null;
81
+
82
+ const originalPath = match[1];
83
+
84
+ if (originalPath.includes('webpack:')) {
85
+ const [fsPath, webpackPath] = originalPath.split('webpack:');
86
+ const basePath = fsPath.replace('/build/', '/');
87
+
88
+ // Check if @rws-framework/client is linked
89
+ const linkInfo = checkIfPackageIsLinked(basePath, '@rws-framework/client');
90
+
91
+ // Check both possible locations
92
+ const possiblePaths = [
93
+ // Check in @dev/client
94
+ path.join(basePath, '../@dev/client', webpackPath),
95
+ // Check in node_modules
96
+ path.join(basePath, 'node_modules/@rws-framework/client', webpackPath.replace('/client/', '/'))
97
+ ];
98
+
99
+ for (const possiblePath of possiblePaths) {
100
+ if (fs.existsSync(possiblePath)) {
101
+ return {
102
+ original: originalPath,
103
+ fsPath: basePath,
104
+ webpackPath,
105
+ exists: true,
106
+ realPath: fs.realpathSync(possiblePath),
107
+ resolvedPath: possiblePath,
108
+ location: possiblePath.includes('node_modules') ? 'node_modules' : '@dev',
109
+ linkInfo // Include the link information
110
+ };
111
+ }
112
+ }
113
+ }
114
+
115
+ return null;
116
+ }
117
+
118
+ module.exports = { parseWebpackPath, checkIfPackageIsLinked };
@@ -48,7 +48,7 @@ function getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
48
48
  ]
49
49
  }
50
50
 
51
- function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug) {
51
+ function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, devDebug) {
52
52
  if(!devDebug?.profiling){
53
53
  return [];
54
54
  }
@@ -63,18 +63,18 @@ function getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath
63
63
  ]
64
64
  }
65
65
 
66
- function getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath) {
66
+ function getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig) {
67
67
  return [
68
68
 
69
69
  ]
70
70
  }
71
71
 
72
- function addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport, tsConfigPath) {
72
+ function addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotReload, isReport) {
73
73
 
74
74
  RWS_WEBPACK_PLUGINS_BAG.add([
75
75
  ...getDefinesPlugins(BuildConfigurator, rwsFrontendConfig, devDebug),
76
- ...getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath, devDebug),
77
- ...getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig, tsConfigPath),
76
+ ...getBuilderDevPlugins(BuildConfigurator, rwsFrontendConfig, devDebug),
77
+ ...getBuilderOptimPlugins(BuildConfigurator, rwsFrontendConfig),
78
78
  ...getPackageModPlugins()
79
79
  ]);
80
80
 
@@ -84,7 +84,7 @@ function addStartPlugins(rwsFrontendConfig, BuildConfigurator, devDebug, isHotRe
84
84
  }
85
85
 
86
86
  RWS_WEBPACK_PLUGINS_BAG.add(new HtmlWebpackPlugin({
87
- template: publicDir + '/' + publicIndex,
87
+ template: path.join(publicDir, '/', publicIndex),
88
88
  }));
89
89
  }
90
90
 
@@ -1,28 +1,26 @@
1
1
  const TerserPlugin = require('terser-webpack-plugin');
2
2
  const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
3
3
 
4
-
5
4
  function getRWSProductionSetup(optimConfig){
6
-
7
5
  return {
8
6
  ...optimConfig,
9
7
  minimize: true,
10
8
  minimizer: [
11
9
  new TerserPlugin({
10
+ parallel: true,
11
+ extractComments: false,
12
12
  terserOptions: {
13
13
  keep_classnames: true, // Prevent mangling of class names
14
- mangle: false, //@error breaks FAST view stuff if enabled for all assets
14
+ mangle: false, //@error breaks FAST view stuff if enabled for all assets
15
15
  compress: {
16
16
  dead_code: true,
17
- pure_funcs: ['console.log', 'console.info', 'console.warn']
17
+ pure_funcs: ['console.log', 'console.info', 'console.warn']
18
18
  },
19
- output: {
19
+ format: {
20
20
  comments: false,
21
- beautify: false
22
- },
23
- },
24
- extractComments: false,
25
- parallel: true,
21
+ beautify: false
22
+ }
23
+ }
26
24
  }),
27
25
  new CssMinimizerPlugin({
28
26
  minimizerOptions: {
@@ -12,7 +12,7 @@ const _defaultOpts = {
12
12
  }
13
13
  }
14
14
 
15
- const externals = (declaredCodeBase, nodeModules, automatedChunks, externalOptions = _defaultOpts) => ({context, request}, callback) => {
15
+ const externals = (pkgPath, declaredCodeBase, nodeModules, automatedChunks, externalOptions = _defaultOpts) => ({context, request}, callback) => {
16
16
  let theOptions = _defaultOpts;
17
17
 
18
18
  if(externalOptions !== null){
@@ -36,7 +36,7 @@ const externals = (declaredCodeBase, nodeModules, automatedChunks, externalOptio
36
36
 
37
37
  const frontendDirs = [
38
38
  codeBase,
39
- path.resolve(__dirname,'..','..','..')
39
+ pkgPath
40
40
  ];
41
41
 
42
42
  const inFrontendContext = frontendDirs.some(dir => context.startsWith(dir)) ||
@@ -3,7 +3,6 @@ const path = require('path');
3
3
 
4
4
  function createWebpackConfig(
5
5
  executionDir,
6
- clientPkgPath,
7
6
  _packageDir,
8
7
  isDev,
9
8
  devTools,
@@ -15,10 +14,11 @@ function createWebpackConfig(
15
14
  automatedChunks,
16
15
  modules_setup,
17
16
  aliases,
18
- tsConfigPath,
17
+ tsConfig,
19
18
  WEBPACK_PLUGINS,
20
19
  rwsExternals,
21
- devExternalsVars
20
+ devExternalsVars,
21
+ entrypoint
22
22
  ) {
23
23
  return {
24
24
  context: executionDir,
@@ -41,18 +41,12 @@ function createWebpackConfig(
41
41
  }
42
42
  },
43
43
  module: {
44
- rules: getRWSLoaders(clientPkgPath, path.resolve(_packageDir, 'node_modules'), tsConfigPath, devDebug),
44
+ rules: getRWSLoaders(_packageDir, executionDir, tsConfig, entrypoint),
45
45
  },
46
46
  plugins: WEBPACK_PLUGINS,
47
- externals: rwsExternals(executionDir, modules_setup, automatedChunks, {
47
+ externals: rwsExternals(_packageDir, executionDir, modules_setup, automatedChunks, {
48
48
  _vars: devExternalsVars
49
- }),
50
- cache: {
51
- type: 'filesystem',
52
- buildDependencies: {
53
- config: [__filename],
54
- },
55
- }
49
+ })
56
50
  }
57
51
  }
58
52
 
@@ -5,7 +5,7 @@ const { rwsPath } = require('@rws-framework/console');
5
5
  const path = require('path');
6
6
  const fs = require('fs');
7
7
 
8
- function setupTsConfig(tsConfigPath, executionDir, userAliases = {}) {
8
+ function setupTsConfig(tsConfigPath, executionDir, pkgPath, userAliases = {}) {
9
9
 
10
10
  if (!fs.existsSync(tsConfigPath)) {
11
11
  throw new Error(`Typescript config file "${tsConfigPath}" does not exist`);
@@ -16,16 +16,15 @@ function setupTsConfig(tsConfigPath, executionDir, userAliases = {}) {
16
16
  try {
17
17
  let tsConfig = JSON.parse(tsConfigContents);
18
18
 
19
- const declarationsPath = path.resolve(__dirname, '..', 'types') + '/declarations.d.ts';
20
- const foundationPath = path.resolve(__dirname, '..', 'foundation');
21
- const testsPath = path.resolve(__dirname, '..', 'tests');
19
+ const declarationsPath = path.resolve(pkgPath, 'types') + '/declarations.d.ts';
20
+ const foundationPath = path.resolve(pkgPath, 'foundation');
21
+ const testsPath = path.resolve(pkgPath, 'tests');
22
22
 
23
23
 
24
24
  const relativeDeclarationsPath = path.relative(path.dirname(tsConfigPath), declarationsPath);
25
25
  const relativeTestsPath = path.relative(path.dirname(tsConfigPath), testsPath);
26
26
  const relativeFoundationPath = path.relative(path.dirname(tsConfigPath), foundationPath);
27
27
 
28
-
29
28
  const includedMD5 = [];
30
29
  const srcPath = 'src/index.ts';
31
30
 
@@ -93,8 +92,6 @@ function setupTsConfig(tsConfigPath, executionDir, userAliases = {}) {
93
92
 
94
93
  tsPaths[alias] = [path.relative(executionDir, aliasPath)];
95
94
 
96
- console.log({alias, x: tsPaths[alias]});
97
-
98
95
  changedPaths = true;
99
96
  }
100
97
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.14.1",
4
+ "version": "2.15.0",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -59,6 +59,7 @@
59
59
  "clean-webpack-plugin": "^4.0.0",
60
60
  "css-loader": "^6.8.1",
61
61
  "css-minimizer-webpack-plugin": "^5.0.1",
62
+ "emoji-regex": "^10.3.0",
62
63
  "eslint": "^6.0.0",
63
64
  "file-loader": "^6.2.0",
64
65
  "html-webpack-plugin": "^5.5.3",
@@ -67,36 +68,35 @@
67
68
  "minimatch": "^9.0.4",
68
69
  "node-sass": "^9.0.0",
69
70
  "raw-loader": "^4.0.2",
70
- "source-map": "^0.7.4",
71
- "source-map-support": "^0.5.21",
72
- "stacktrace-gps": "^3.1.2",
73
71
  "sass": "1.69.7",
72
+ "sass-embedded": "^1.83.4",
74
73
  "sass-loader": "^13.3.2",
75
74
  "scss-loading-animations": "^1.0.1",
76
- "sass-embedded": "^1.83.4",
75
+ "source-map": "^0.7.4",
76
+ "source-map-support": "^0.5.21",
77
77
  "speed-measure-webpack-plugin": "^1.5.0",
78
+ "stacktrace-gps": "^3.1.2",
78
79
  "style-loader": "^3.3.3",
79
80
  "terser-webpack-plugin": "^5.3.9",
80
81
  "ts-loader": "^9.4.4",
81
82
  "ts-node": "^10.9.1",
83
+ "ts-transformer-keys": "^0.4.4",
84
+ "tsc-watch": "^6.0.4",
82
85
  "tsconfig-paths": "^4.2.0",
83
86
  "tsconfig-paths-webpack-plugin": "^4.1.0",
87
+ "tslib": "^2.6.2",
84
88
  "typedoc": "^0.25.4",
85
89
  "typedoc-plugin-mermaid": "^1.10.0",
86
90
  "typedoc-plugin-not-exported": "^0.1.6",
87
91
  "typedoc-plugin-rename-defaults": "^0.7.0",
88
92
  "typedoc-theme-hierarchy": "^4.1.2",
89
93
  "typescript": "^5.1.6",
90
- "url-loader": "^4.1.1",
91
- "emoji-regex": "^10.3.0",
92
- "ts-transformer-keys": "^0.4.4",
93
- "tsc-watch": "^6.0.4",
94
- "tslib": "^2.6.2",
95
94
  "uglify-js": "^3.17.4",
95
+ "url-loader": "^4.1.1",
96
96
  "vite": "^6.0.11",
97
- "webpack": "^5.97.1",
98
- "webpack-cli": "^6.0.1",
97
+ "webpack": "^5.97.1",
99
98
  "webpack-bundle-analyzer": "^4.10.1",
99
+ "webpack-cli": "^6.0.1",
100
100
  "webpack-dev-server": "^4.15.1",
101
101
  "webpack-node-externals": "^3.0.0"
102
102
  },
@@ -106,4 +106,4 @@
106
106
  "overrides": {
107
107
  "lodash": "^4.17.21"
108
108
  }
109
- }
109
+ }
@@ -0,0 +1,158 @@
1
+ # RWS Grid System
2
+ A flexible SASS-based grid system providing responsive column layouts with simple syntax.
3
+
4
+ ## Table of Contents
5
+ - [Installation](#installation)
6
+ - [Breakpoints](#breakpoints)
7
+ - [Basic Usage](#basic-usage)
8
+ - [Mixins](#mixins)
9
+ - [Examples](#examples)
10
+
11
+ ## Installation
12
+ Import the mixins file into your SASS project:
13
+
14
+ ```scss
15
+ @import '@rws-mixins';
16
+ ```
17
+
18
+ ## Breakpoints
19
+ The system uses three main breakpoint values:
20
+
21
+ | Name | Default Width | CSS Variable |
22
+ |------|---------------|-------------|
23
+ | md | 1200px | --rws-md-width |
24
+ | sm | 992px | --rws-sm-width |
25
+ | xs | 768px | --rws-xs-width |
26
+
27
+ Breakpoints can be customized using CSS variables or directly in the `$breakpoints` map.
28
+
29
+ ## Basic Usage
30
+
31
+ ### Grid Container
32
+ ```scss
33
+ .container {
34
+ @include rws-gr; // Basic flex container
35
+ @include rws-gr-gap(20px); // Adds gaps between columns
36
+ }
37
+ ```
38
+
39
+ ### Responsive Columns
40
+ ```scss
41
+ .column {
42
+ @include rws-gr-col(3, 4, 6, 12);
43
+ // 3 columns on large screens
44
+ // 4 columns on medium screens (< 1200px)
45
+ // 6 columns on small screens (< 992px)
46
+ // 12 columns on extra small screens (< 768px)
47
+ }
48
+ ```
49
+
50
+ ## Mixins
51
+
52
+ ### rws-gr
53
+ Creates a basic flexbox container with wrap enabled.
54
+ ```scss
55
+ @include rws-gr;
56
+ ```
57
+
58
+ ### rws-gr-gap($gap)
59
+ Adds spacing between columns.
60
+ ```scss
61
+ @include rws-gr-gap(20px);
62
+ ```
63
+
64
+ ### rws-gr-col($lg, $md, $sm, $xs)
65
+ Defines column width for different breakpoints.
66
+ - `$lg`: width for large screens (default 12)
67
+ - `$md`: width for medium screens (optional)
68
+ - `$sm`: width for small screens (optional)
69
+ - `$xs`: width for extra small screens (optional)
70
+
71
+ ### rws-gr-align($h, $v)
72
+ Controls alignment of items in the container.
73
+ - `$h`: horizontal alignment (default flex-start)
74
+ - `$v`: vertical alignment (default top)
75
+
76
+ ### rws-gr-center
77
+ Centers the container relative to its parent.
78
+
79
+ ## Examples
80
+
81
+ ### Basic Layout with Gaps
82
+ ```scss
83
+ .container {
84
+ @include rws-gr;
85
+ @include rws-gr-gap(20px);
86
+ @include rws-gr-center;
87
+
88
+ .column {
89
+ @include rws-gr-col(4, 6, 12);
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### Aligned Layout
95
+ ```scss
96
+ .aligned-container {
97
+ @include rws-gr;
98
+ @include rws-gr-align(center, center);
99
+
100
+ .column {
101
+ @include rws-gr-col(3);
102
+ }
103
+ }
104
+ ```
105
+
106
+ ### Complete Responsive Layout Example
107
+ ```scss
108
+ .page-layout {
109
+ @include rws-gr;
110
+ @include rws-gr-gap(30px);
111
+ @include rws-gr-center;
112
+
113
+ .sidebar {
114
+ @include rws-gr-col(3, 4, 12);
115
+ }
116
+
117
+ .main-content {
118
+ @include rws-gr-col(9, 8, 12);
119
+ }
120
+
121
+ .footer {
122
+ @include rws-gr-col(12);
123
+ }
124
+ }
125
+ ```
126
+
127
+ ## Advanced Tips
128
+
129
+ ### Custom Breakpoints
130
+ You can override default breakpoints using CSS variables:
131
+ ```css
132
+ :root {
133
+ --rws-md-width: 1400px;
134
+ --rws-sm-width: 1024px;
135
+ --rws-xs-width: 800px;
136
+ }
137
+ ```
138
+
139
+ ### Column Calculation
140
+ The system uses a 12-column grid by default. Column widths are calculated using:
141
+ ```scss
142
+ width = (100% / 12) * columns
143
+ ```
144
+
145
+ ### Best Practices
146
+ 1. Always start with mobile layout first
147
+ 2. Use semantic class names
148
+ 3. Avoid deeply nested grids
149
+ 4. Consider using the gap mixin for consistent spacing
150
+ 5. Test layouts across different screen sizes
151
+
152
+ ## Browser Support
153
+ This grid system relies on modern CSS features including:
154
+ - Flexbox
155
+ - CSS Custom Properties (CSS Variables)
156
+ - CSS calc()
157
+
158
+ Ensure your target browsers support these features or include appropriate fallbacks.