@rws-framework/client 2.20.1 → 2.20.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.
- package/.bin/emerge.sh +15 -15
- package/builder/vite/index.ts +4 -4
- package/builder/vite/rws.vite.config.ts +132 -132
- package/builder/vite/rws_scss_plugin.ts +61 -61
- package/builder/webpack/index.js +10 -10
- package/builder/webpack/rws.webpack.config.js +161 -161
- package/builder/webpack/rws_scss_plugin.js +90 -90
- package/builder/webpack/rws_webpack_plugin.js +137 -137
- package/cfg/_default.cfg.js +26 -26
- package/cfg/_storage.d.ts +22 -22
- package/cfg/_storage.js +42 -42
- package/cfg/tsconfigSetup.js +146 -146
- package/docs/assets/26e93147f10415a0ed4a.svg +6 -6
- package/docs/assets/75c9471662e97ee24f29.svg +7 -7
- package/docs/assets/db90e4df2373980c497d.svg +9 -9
- package/docs/assets/highlight.css +127 -127
- package/docs/assets/main.js +59 -59
- package/docs/assets/style.css +1414 -1414
- package/docs/classes/ApiServiceInstance.html +25 -25
- package/docs/classes/ConfigServiceInstance.html +21 -21
- package/docs/classes/DOMServiceInstance.html +17 -17
- package/docs/classes/NotifyServiceInstance.html +15 -15
- package/docs/classes/RWSClientInstance.html +45 -45
- package/docs/classes/RWSPlugin.html +13 -13
- package/docs/classes/RWSService.html +10 -10
- package/docs/classes/RWSViewComponent.html +1022 -1022
- package/docs/classes/ServiceWorkerServiceInstance.html +13 -13
- package/docs/classes/UtilsServiceInstance.html +13 -13
- package/docs/functions/attr.html +5 -5
- package/docs/functions/observable.html +3 -3
- package/docs/index.html +179 -179
- package/docs/interfaces/HTMLTag.html +3 -3
- package/docs/interfaces/IRWSConfig.html +20 -20
- package/docs/interfaces/IRWSDecoratorOptions.html +5 -5
- package/docs/interfaces/IRWSHttpRoute.html +2 -2
- package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
- package/docs/interfaces/IRWSUser.html +5 -5
- package/docs/modules.html +45 -45
- package/foundation/index.js +1 -1
- package/foundation/rws-foundation.d.ts +7 -7
- package/foundation/rws-foundation.js +7 -7
- package/package.json +1 -1
- package/service_worker/src/_service_worker.ts +83 -83
- package/service_worker/tsconfig.json +20 -20
- package/service_worker/webpack.config.js +66 -66
- package/src/client/components.ts +67 -67
- package/src/client/config.ts +175 -175
- package/src/client/hotReload.ts +22 -22
- package/src/client/services.ts +27 -27
- package/src/client.ts +208 -208
- package/src/components/_component.ts +247 -247
- package/src/components/_container.ts +15 -15
- package/src/components/_decorator.ts +122 -122
- package/src/components/_definitions.ts +64 -64
- package/src/components/_event_handling.ts +40 -40
- package/src/components/index.ts +25 -25
- package/src/index.ts +86 -86
- package/src/plugins/_builder.js +31 -31
- package/src/plugins/_plugin.ts +60 -60
- package/src/services/ApiService.ts +105 -105
- package/src/services/ConfigService.ts +125 -125
- package/src/services/DOMService.ts +93 -93
- package/src/services/NotifyService.ts +47 -47
- package/src/services/ServiceWorkerService.ts +60 -60
- package/src/services/UtilsService.ts +60 -60
- package/src/services/_service.ts +64 -64
- package/src/styles/README.md +157 -157
- package/src/styles/_darkreader.scss +30 -30
- package/src/styles/_grid.scss +75 -75
- package/src/styles/_grid_legacy.scss +49 -49
- package/src/styles/_misc.scss +8 -8
- package/src/styles/_scrollbars.scss +40 -40
- package/src/styles/includes.scss +6 -6
- package/src/types/IBackendCore.ts +11 -11
- package/src/types/IRWSConfig.ts +29 -29
- package/src/types/IRWSPlugin.ts +23 -23
- package/src/types/IRWSResource.ts +4 -4
- package/src/types/IRWSUser.ts +6 -6
- package/src/types/IRWSViewComponent.ts +36 -36
- package/src/types/IReFormerField.ts +4 -4
- package/src/types/RWSNotify.ts +6 -6
- package/src/types/RWSWindow.ts +41 -41
- package/types/declarations.d.ts +8 -8
- package/types/docs-typings.d.ts +15 -15
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import TheService from './_service';
|
|
2
|
-
import ApiService, {ApiServiceInstance} from './ApiService';
|
|
3
|
-
|
|
4
|
-
import { RawSourceMap } from 'source-map';
|
|
5
|
-
|
|
6
|
-
class UtilsService extends TheService {
|
|
7
|
-
static _DEFAULT: boolean = true;
|
|
8
|
-
mergeDeep<T>(target: T | any, source: T | any): T
|
|
9
|
-
{
|
|
10
|
-
const isObject = (obj: any) => obj && typeof obj === 'object';
|
|
11
|
-
|
|
12
|
-
if (!isObject(target) || !isObject(source)) {
|
|
13
|
-
return source;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
Object.keys(source).forEach(key => {
|
|
17
|
-
const targetValue = target[key];
|
|
18
|
-
const sourceValue = source[key];
|
|
19
|
-
|
|
20
|
-
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
|
21
|
-
target[key] = targetValue.concat(sourceValue);
|
|
22
|
-
} else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
23
|
-
target[key] = this.mergeDeep(Object.assign({}, targetValue), sourceValue);
|
|
24
|
-
} else {
|
|
25
|
-
target[key] = sourceValue;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return target;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async fetchSourceMap(jsFilePath: string): Promise<RawSourceMap>
|
|
33
|
-
{
|
|
34
|
-
// Assuming the source map URL is the JS file URL with a '.map' extension
|
|
35
|
-
const sourceMapUrl = jsFilePath;
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
const response = await fetch(sourceMapUrl);
|
|
39
|
-
if (!response.ok) {
|
|
40
|
-
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
41
|
-
}
|
|
42
|
-
return await response.json();
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error('Failed to fetch source map:', error);
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async getCurrentLineNumber(error: Error = null): Promise<number> {
|
|
50
|
-
if(!error){
|
|
51
|
-
error = new Error();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export default UtilsService.getSingleton();
|
|
59
|
-
|
|
60
|
-
export { UtilsService as UtilsServiceInstance };
|
|
1
|
+
import TheService from './_service';
|
|
2
|
+
import ApiService, {ApiServiceInstance} from './ApiService';
|
|
3
|
+
|
|
4
|
+
import { RawSourceMap } from 'source-map';
|
|
5
|
+
|
|
6
|
+
class UtilsService extends TheService {
|
|
7
|
+
static _DEFAULT: boolean = true;
|
|
8
|
+
mergeDeep<T>(target: T | any, source: T | any): T
|
|
9
|
+
{
|
|
10
|
+
const isObject = (obj: any) => obj && typeof obj === 'object';
|
|
11
|
+
|
|
12
|
+
if (!isObject(target) || !isObject(source)) {
|
|
13
|
+
return source;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Object.keys(source).forEach(key => {
|
|
17
|
+
const targetValue = target[key];
|
|
18
|
+
const sourceValue = source[key];
|
|
19
|
+
|
|
20
|
+
if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
|
|
21
|
+
target[key] = targetValue.concat(sourceValue);
|
|
22
|
+
} else if (isObject(targetValue) && isObject(sourceValue)) {
|
|
23
|
+
target[key] = this.mergeDeep(Object.assign({}, targetValue), sourceValue);
|
|
24
|
+
} else {
|
|
25
|
+
target[key] = sourceValue;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return target;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async fetchSourceMap(jsFilePath: string): Promise<RawSourceMap>
|
|
33
|
+
{
|
|
34
|
+
// Assuming the source map URL is the JS file URL with a '.map' extension
|
|
35
|
+
const sourceMapUrl = jsFilePath;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const response = await fetch(sourceMapUrl);
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
41
|
+
}
|
|
42
|
+
return await response.json();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Failed to fetch source map:', error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async getCurrentLineNumber(error: Error = null): Promise<number> {
|
|
50
|
+
if(!error){
|
|
51
|
+
error = new Error();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default UtilsService.getSingleton();
|
|
59
|
+
|
|
60
|
+
export { UtilsService as UtilsServiceInstance };
|
package/src/services/_service.ts
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import RWSContainer, { DI, InterfaceSymbol, Key, Registration } from '../components/_container';
|
|
2
|
-
import { loadRWSRichWindow } from '../types/RWSWindow';
|
|
3
|
-
|
|
4
|
-
export interface IWithDI<T> {
|
|
5
|
-
new (...args: any[]): T;
|
|
6
|
-
getSingleton: <T extends Key>(this: IWithDI<T>) => InterfaceSymbol<T>;
|
|
7
|
-
register: <T extends Key>(this: IWithDI<T>) => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default abstract class TheRWSService {
|
|
11
|
-
_RELOADABLE: boolean = false;
|
|
12
|
-
static _IN_CLIENT: boolean = false;
|
|
13
|
-
static _DEFAULT: boolean = false;
|
|
14
|
-
|
|
15
|
-
constructor() {
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
register<T extends Key>(this: IWithDI<T>): void
|
|
19
|
-
{
|
|
20
|
-
this.getSingleton();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getSingleton<T extends Key>(this: IWithDI<T>): InterfaceSymbol<T>
|
|
24
|
-
{
|
|
25
|
-
return this.getSingleton();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static register<T extends Key>(this: IWithDI<T>): void
|
|
29
|
-
{
|
|
30
|
-
this.getSingleton();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public static getSingleton<T extends Key>(this: IWithDI<T>, serviceName: string = null): InterfaceSymbol<T>
|
|
34
|
-
{
|
|
35
|
-
const richWindow = loadRWSRichWindow();
|
|
36
|
-
|
|
37
|
-
if(!serviceName){
|
|
38
|
-
serviceName = this.name;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if(Object.keys(richWindow.RWS._registered).includes(serviceName)){
|
|
42
|
-
return richWindow.RWS._registered[serviceName];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const interf = DI.createInterface<T>(serviceName);
|
|
46
|
-
|
|
47
|
-
RWSContainer().register(
|
|
48
|
-
Registration.singleton(interf, this)
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
richWindow.RWS._registered[serviceName] = interf;
|
|
52
|
-
|
|
53
|
-
return interf;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
isDefault(): boolean
|
|
57
|
-
{
|
|
58
|
-
return (this as any).constructor._DEFAULT;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
isInClient(): boolean
|
|
62
|
-
{
|
|
63
|
-
return (this as any).constructor._IN_CLIENT;
|
|
64
|
-
}
|
|
1
|
+
import RWSContainer, { DI, InterfaceSymbol, Key, Registration } from '../components/_container';
|
|
2
|
+
import { loadRWSRichWindow } from '../types/RWSWindow';
|
|
3
|
+
|
|
4
|
+
export interface IWithDI<T> {
|
|
5
|
+
new (...args: any[]): T;
|
|
6
|
+
getSingleton: <T extends Key>(this: IWithDI<T>) => InterfaceSymbol<T>;
|
|
7
|
+
register: <T extends Key>(this: IWithDI<T>) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default abstract class TheRWSService {
|
|
11
|
+
_RELOADABLE: boolean = false;
|
|
12
|
+
static _IN_CLIENT: boolean = false;
|
|
13
|
+
static _DEFAULT: boolean = false;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
register<T extends Key>(this: IWithDI<T>): void
|
|
19
|
+
{
|
|
20
|
+
this.getSingleton();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getSingleton<T extends Key>(this: IWithDI<T>): InterfaceSymbol<T>
|
|
24
|
+
{
|
|
25
|
+
return this.getSingleton();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static register<T extends Key>(this: IWithDI<T>): void
|
|
29
|
+
{
|
|
30
|
+
this.getSingleton();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public static getSingleton<T extends Key>(this: IWithDI<T>, serviceName: string = null): InterfaceSymbol<T>
|
|
34
|
+
{
|
|
35
|
+
const richWindow = loadRWSRichWindow();
|
|
36
|
+
|
|
37
|
+
if(!serviceName){
|
|
38
|
+
serviceName = this.name;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if(Object.keys(richWindow.RWS._registered).includes(serviceName)){
|
|
42
|
+
return richWindow.RWS._registered[serviceName];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const interf = DI.createInterface<T>(serviceName);
|
|
46
|
+
|
|
47
|
+
RWSContainer().register(
|
|
48
|
+
Registration.singleton(interf, this)
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
richWindow.RWS._registered[serviceName] = interf;
|
|
52
|
+
|
|
53
|
+
return interf;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
isDefault(): boolean
|
|
57
|
+
{
|
|
58
|
+
return (this as any).constructor._DEFAULT;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
isInClient(): boolean
|
|
62
|
+
{
|
|
63
|
+
return (this as any).constructor._IN_CLIENT;
|
|
64
|
+
}
|
|
65
65
|
}
|
package/src/styles/README.md
CHANGED
|
@@ -1,158 +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
|
-
|
|
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
158
|
Ensure your target browsers support these features or include appropriate fallbacks.
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
$darkreader-base-globals: (
|
|
2
|
-
'neutral-background': var(--rws-darkreader-neutral-background, #212222),
|
|
3
|
-
'neutral-text': var(--rws-darkreader-neutral-text, #eae3d9),
|
|
4
|
-
'selection-background': var(--rws-darkreader-selection-background, #165aaa),
|
|
5
|
-
'selection-text': var(--rws-darkreader-selection-text, #624e2f)
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
$darkreader-elements: ('text', 'bg', 'border', 'neutral', 'selection');
|
|
9
|
-
|
|
10
|
-
@mixin darkreader-for-var($element, $variable_name, $color){
|
|
11
|
-
--darkreader-#{$element}--#{$variable_name}: #{$color};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
@mixin darkreader-for-varmap($element, $variable-map){
|
|
15
|
-
@each $key, $value in $variable-map {
|
|
16
|
-
@include darkreader-for-var($element, $key, $value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@mixin darkreader-all-for-varmap($variable-map){
|
|
21
|
-
@each $element in $darkreader-elements {
|
|
22
|
-
@include darkreader-for-varmap($element, $variable-map);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@mixin darkreader-global(){
|
|
27
|
-
@each $field, $color in $darkreader-base-globals {
|
|
28
|
-
--darkreader-#{$field}: #{$color};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
$darkreader-base-globals: (
|
|
2
|
+
'neutral-background': var(--rws-darkreader-neutral-background, #212222),
|
|
3
|
+
'neutral-text': var(--rws-darkreader-neutral-text, #eae3d9),
|
|
4
|
+
'selection-background': var(--rws-darkreader-selection-background, #165aaa),
|
|
5
|
+
'selection-text': var(--rws-darkreader-selection-text, #624e2f)
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
$darkreader-elements: ('text', 'bg', 'border', 'neutral', 'selection');
|
|
9
|
+
|
|
10
|
+
@mixin darkreader-for-var($element, $variable_name, $color){
|
|
11
|
+
--darkreader-#{$element}--#{$variable_name}: #{$color};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin darkreader-for-varmap($element, $variable-map){
|
|
15
|
+
@each $key, $value in $variable-map {
|
|
16
|
+
@include darkreader-for-var($element, $key, $value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@mixin darkreader-all-for-varmap($variable-map){
|
|
21
|
+
@each $element in $darkreader-elements {
|
|
22
|
+
@include darkreader-for-varmap($element, $variable-map);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@mixin darkreader-global(){
|
|
27
|
+
@each $field, $color in $darkreader-base-globals {
|
|
28
|
+
--darkreader-#{$field}: #{$color};
|
|
29
|
+
}
|
|
30
|
+
}
|