@rws-framework/client 2.8.1 → 2.8.4
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/package.json +3 -2
- package/rws.webpack.config.js +17 -12
- package/service_worker/src/_service_worker.ts +3 -6
- package/src/client/components.ts +1 -1
- package/src/client/config.ts +2 -2
- package/src/client/services.ts +1 -1
- package/src/client.ts +8 -3
- package/src/components/_component.ts +2 -2
- package/src/components/_container.ts +1 -1
- package/src/components/_decorator.ts +2 -1
- package/src/components/_decorators/RWSFillBuild.ts +1 -1
- package/src/components/progress/component.ts +1 -1
- package/src/index.ts +3 -3
- package/src/plugins/_plugin.ts +2 -2
- package/src/services/ConfigService.ts +1 -1
- package/src/services/_service.ts +1 -1
- package/src/styles/_darkreader.scss +30 -0
- package/src/styles/_grid.scss +76 -0
- package/src/styles/_misc.scss +9 -0
- package/src/styles/_scrollbars.scss +41 -0
- package/src/styles/includes.scss +4 -99
- package/types/declarations.d.ts +1 -3
- package/webpack/loaders/rws_fast_html_loader.js +5 -17
- package/webpack/loaders/rws_fast_scss_loader.js +1 -1
- package/webpack/loaders/rws_fast_ts_loader.js +14 -38
- package/webpack/loaders/ts/html_error.js +20 -0
- /package/src/{interfaces → types}/IRWSConfig.ts +0 -0
- /package/src/{interfaces → types}/IRWSUser.ts +0 -0
- /package/src/{interfaces → types}/IRWSViewComponent.ts +0 -0
- /package/src/{interfaces → types}/RWSWindow.ts +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rws-framework/client",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.8.
|
|
4
|
+
"version": "2.8.4",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"docs": "typedoc --tsconfig ./tsconfig.json"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@microsoft/fast-element": "^1.12.0",
|
|
30
30
|
"@microsoft/fast-foundation": "^2.46.2",
|
|
31
|
-
"@rws-framework/console": "
|
|
31
|
+
"@rws-framework/console": "*",
|
|
32
32
|
"@types/moment": "^2.13.0",
|
|
33
33
|
"dragula": "^3.7.3",
|
|
34
34
|
"he": "^1.2.0",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"style-loader": "^3.3.3",
|
|
75
75
|
"terser-webpack-plugin": "^5.3.9",
|
|
76
76
|
"ts-loader": "^9.4.4",
|
|
77
|
+
"html-loader": "^5.0.0",
|
|
77
78
|
"ts-node": "^10.9.1",
|
|
78
79
|
"tsconfig-paths": "^4.2.0",
|
|
79
80
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
package/rws.webpack.config.js
CHANGED
|
@@ -8,22 +8,19 @@ const chalk = require('chalk');
|
|
|
8
8
|
const RWSAfterPlugin = require('./webpack/rws_after_plugin');
|
|
9
9
|
const tools = require('./_tools');
|
|
10
10
|
const { _DEFAULT_CONFIG } = require('./cfg/_default.cfg');
|
|
11
|
-
const RWSConfigBuilder = require('@rws-framework/console').RWSConfigBuilder;
|
|
12
|
-
const RWSPath = require('@rws-framework/console').rwsPath;
|
|
13
|
-
|
|
14
11
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
15
12
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
16
13
|
const JsMinimizerPlugin = require('terser-webpack-plugin');
|
|
17
14
|
|
|
18
15
|
const json5 = require('json5');
|
|
19
|
-
const { rwsPath } = require('@rws-framework/console');
|
|
16
|
+
const { rwsPath, RWSConfigBuilder } = require('@rws-framework/console');
|
|
20
17
|
|
|
21
18
|
const RWSWebpackWrapper = async (config) => {
|
|
22
|
-
const BuildConfigurator = new RWSConfigBuilder(
|
|
19
|
+
const BuildConfigurator = new RWSConfigBuilder(rwsPath.findPackageDir(process.cwd()) + '/.rws.json', {..._DEFAULT_CONFIG, ...config});
|
|
23
20
|
|
|
24
|
-
config.packageDir =
|
|
21
|
+
config.packageDir = rwsPath.findPackageDir(process.cwd());
|
|
25
22
|
|
|
26
|
-
const executionDir =
|
|
23
|
+
const executionDir = rwsPath.relativize(BuildConfigurator.get('executionDir') || config.executionDir || process.cwd(), config.packageDir);
|
|
27
24
|
|
|
28
25
|
const isDev = BuildConfigurator.get('dev', config.dev);
|
|
29
26
|
const isHotReload = BuildConfigurator.get('hot', config.hot);
|
|
@@ -35,7 +32,7 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
35
32
|
|
|
36
33
|
let partedComponentsLocations = BuildConfigurator.get('partedComponentsLocations', config.partedComponentsLocations);
|
|
37
34
|
const customServiceLocations = BuildConfigurator.get('customServiceLocations', config.customServiceLocations); //@todo: check if needed
|
|
38
|
-
const outputDir =
|
|
35
|
+
const outputDir = rwsPath.relativize(BuildConfigurator.get('outputDir', config.outputDir), config.packageDir);
|
|
39
36
|
|
|
40
37
|
const outputFileName = BuildConfigurator.get('outputFileName') || config.outputFileName;
|
|
41
38
|
const publicDir = BuildConfigurator.get('publicDir') || config.publicDir;
|
|
@@ -43,6 +40,7 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
43
40
|
|
|
44
41
|
const publicIndex = BuildConfigurator.get('publicIndex') || config.publicIndex;
|
|
45
42
|
|
|
43
|
+
const devTools = isDev ? (config.devtool || 'inline-source-map') : false;
|
|
46
44
|
|
|
47
45
|
const tsConfigPath = rwsPath.relativize(BuildConfigurator.get('tsConfigPath') || config.tsConfigPath, executionDir);
|
|
48
46
|
const rwsPlugins = {};
|
|
@@ -54,7 +52,7 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
rwsPath.removeDirectory(outputDir, true);
|
|
58
56
|
|
|
59
57
|
console.log(chalk.green('Build started with'))
|
|
60
58
|
console.log({
|
|
@@ -65,7 +63,8 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
65
63
|
publicDir,
|
|
66
64
|
parted: isParted,
|
|
67
65
|
partedPrefix,
|
|
68
|
-
partedDirUrlPrefix
|
|
66
|
+
partedDirUrlPrefix,
|
|
67
|
+
devtool: devTools
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
|
|
@@ -227,7 +226,7 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
227
226
|
},
|
|
228
227
|
mode: isDev ? 'development' : 'production',
|
|
229
228
|
target: 'web',
|
|
230
|
-
devtool:
|
|
229
|
+
devtool: devTools,
|
|
231
230
|
output: {
|
|
232
231
|
path: outputDir,
|
|
233
232
|
filename: isParted ? (partedPrefix || 'rws') + '.[name].js' : outputFileName,
|
|
@@ -245,6 +244,9 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
245
244
|
{
|
|
246
245
|
test: /\.html$/,
|
|
247
246
|
use: [
|
|
247
|
+
{
|
|
248
|
+
loader: 'html-loader'
|
|
249
|
+
},
|
|
248
250
|
path.resolve(__dirname, './webpack/loaders/rws_fast_html_loader.js')
|
|
249
251
|
],
|
|
250
252
|
},
|
|
@@ -274,7 +276,10 @@ const RWSWebpackWrapper = async (config) => {
|
|
|
274
276
|
loader: path.resolve(__dirname, './webpack/loaders/rws_fast_ts_loader.js'),
|
|
275
277
|
}
|
|
276
278
|
],
|
|
277
|
-
exclude: [
|
|
279
|
+
exclude: [
|
|
280
|
+
/node_modules\/(?!\@rws-framework\/client)/,
|
|
281
|
+
/\.debug\.ts$/,
|
|
282
|
+
],
|
|
278
283
|
}
|
|
279
284
|
],
|
|
280
285
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import IRWSUser from '../../src/
|
|
1
|
+
import IRWSUser from '../../src/types/IRWSUser';
|
|
2
2
|
import RWSContainer from '../../src/components/_container';
|
|
3
3
|
|
|
4
4
|
//@4DI
|
|
5
|
-
import { WSServiceInstance } from '../../src/services/WSService';
|
|
6
5
|
import { Container } from '@microsoft/fast-foundation';
|
|
7
6
|
|
|
8
7
|
type SWMsgType = {
|
|
@@ -14,8 +13,7 @@ type SWMsgType = {
|
|
|
14
13
|
abstract class RWSServiceWorker<UserType extends IRWSUser> {
|
|
15
14
|
protected DI: Container;
|
|
16
15
|
protected user: UserType = null;
|
|
17
|
-
protected ignoredUrls: RegExp[] = [];
|
|
18
|
-
protected wsService: WSServiceInstance;
|
|
16
|
+
protected ignoredUrls: RegExp[] = [];
|
|
19
17
|
protected regExTypes: { [key: string]: RegExp };
|
|
20
18
|
|
|
21
19
|
public workerScope: ServiceWorkerGlobalScope;
|
|
@@ -28,8 +26,7 @@ abstract class RWSServiceWorker<UserType extends IRWSUser> {
|
|
|
28
26
|
onActivate(): Promise<void> { return; }
|
|
29
27
|
|
|
30
28
|
constructor(workerScope: ServiceWorkerGlobalScope, DI: Container){
|
|
31
|
-
this.DI = DI;
|
|
32
|
-
this.wsService = DI.get<WSServiceInstance>(WSServiceInstance);
|
|
29
|
+
this.DI = DI;
|
|
33
30
|
this.workerScope = workerScope;
|
|
34
31
|
|
|
35
32
|
this.onInit().then(() => {
|
package/src/client/components.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RWSWindow, { RWSWindowComponentRegister } from "../
|
|
1
|
+
import RWSWindow, { RWSWindowComponentRegister } from "../types/RWSWindow";
|
|
2
2
|
import { RWSClientInstance } from "../client";
|
|
3
3
|
import RWSViewComponent, { IWithCompose } from "../components/_component";
|
|
4
4
|
import { RWSPlugin } from "../plugins/_plugin";
|
package/src/client/config.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IRWSConfig, IRWSUser } from "../index";
|
|
|
2
2
|
import { RWSClientInstance } from "../client";
|
|
3
3
|
|
|
4
4
|
import { RWSPlugin, DefaultRWSPluginOptionsType } from "../plugins/_plugin";
|
|
5
|
-
import RWSWindow, {loadRWSRichWindow } from '../
|
|
5
|
+
import RWSWindow, {loadRWSRichWindow } from '../types/RWSWindow';
|
|
6
6
|
|
|
7
7
|
type RWSInfoType = { components: string[] };
|
|
8
8
|
|
|
@@ -139,7 +139,7 @@ async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
|
|
|
139
139
|
function getBinds(this: RWSClientInstance) {
|
|
140
140
|
return {
|
|
141
141
|
start: start.bind(this),
|
|
142
|
-
setup: setup.bind(this),
|
|
142
|
+
setup: setup.bind(this),
|
|
143
143
|
get: get.bind(this),
|
|
144
144
|
setUser: setUser.bind(this),
|
|
145
145
|
getUser: getUser.bind(this),
|
package/src/client/services.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IRWSConfig from './
|
|
1
|
+
import IRWSConfig, { RWSPluginEntry } from './types/IRWSConfig';
|
|
2
2
|
|
|
3
3
|
import RWSNotify from './types/RWSNotify';
|
|
4
4
|
|
|
@@ -10,8 +10,8 @@ import NotifyService, { NotifyServiceInstance } from './services/NotifyService';
|
|
|
10
10
|
|
|
11
11
|
import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
|
|
12
12
|
import { IBackendRoute } from './services/ApiService';
|
|
13
|
-
import IRWSUser from './
|
|
14
|
-
import RWSWindow, { RWSWindowComponentRegister, loadRWSRichWindow } from './
|
|
13
|
+
import IRWSUser from './types/IRWSUser';
|
|
14
|
+
import RWSWindow, { RWSWindowComponentRegister, loadRWSRichWindow } from './types/RWSWindow';
|
|
15
15
|
|
|
16
16
|
import { DI, Container, Registration } from '@microsoft/fast-foundation';
|
|
17
17
|
|
|
@@ -72,6 +72,11 @@ class RWSClient {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
addPlugin(pluginEntry: RWSPluginEntry<any>)
|
|
76
|
+
{
|
|
77
|
+
this.config.plugins.push(pluginEntry);
|
|
78
|
+
}
|
|
79
|
+
|
|
75
80
|
async setup(config: IRWSConfig = {}): Promise<IRWSConfig> {
|
|
76
81
|
return this.configHelper.setup(config);
|
|
77
82
|
}
|
|
@@ -5,8 +5,8 @@ import UtilsService, { UtilsServiceInstance } from '../services/UtilsService';
|
|
|
5
5
|
import DOMService, { DOMServiceInstance, DOMOutputType } from '../services/DOMService';
|
|
6
6
|
import ApiService, { ApiServiceInstance } from '../services/ApiService';
|
|
7
7
|
import NotifyService, { NotifyServiceInstance } from '../services/NotifyService';
|
|
8
|
-
import { IRWSViewComponent, IAssetShowOptions } from '../
|
|
9
|
-
import RWSWindow, { RWSWindowComponentInterface, loadRWSRichWindow } from '../
|
|
8
|
+
import { IRWSViewComponent, IAssetShowOptions } from '../types/IRWSViewComponent';
|
|
9
|
+
import RWSWindow, { RWSWindowComponentInterface, loadRWSRichWindow } from '../types/RWSWindow';
|
|
10
10
|
import { applyConstructor, RWSInject } from './_decorator';
|
|
11
11
|
|
|
12
12
|
import 'reflect-metadata';
|
|
@@ -13,6 +13,7 @@ interface RWSDecoratorOptions {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//const _PARAMTYPES_METADATA_KEY = 'design:paramtypes';
|
|
16
|
+
type HtmlBinderType = (context: RWSViewComponent) => ViewTemplate;
|
|
16
17
|
|
|
17
18
|
function RWSView<Component extends RWSViewComponent>(name: string, data?: RWSDecoratorOptions | null, override?: { styles?: ElementStyles, template?: ViewTemplate, options?: any }): (type: any, args?: any) => void {
|
|
18
19
|
return (theComponent: IWithCompose<Component>, args?: any) => {
|
|
@@ -24,7 +25,7 @@ function RWSView<Component extends RWSViewComponent>(name: string, data?: RWSDec
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
if(override.template){
|
|
27
|
-
theComponent.definition.template =
|
|
28
|
+
theComponent.definition.template = override.template;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transformer as HTMLTagTransformerType, Tag as HTMLTag, Attributes as HTMLAttributes } from 'sanitize-html';
|
|
2
2
|
import { observable, attr } from '@microsoft/fast-element';
|
|
3
|
-
import IRWSConfig from './
|
|
3
|
+
import IRWSConfig from './types/IRWSConfig';
|
|
4
4
|
import RWSNotify, { NotifyUiType, NotifyLogType } from './types/RWSNotify';
|
|
5
5
|
import { provideRWSDesignSystem } from './components/_design_system';
|
|
6
6
|
import RWSService from './services/_service';
|
|
@@ -14,8 +14,8 @@ import { sanitizedAttr } from './components/_attrs/sanitize-html';
|
|
|
14
14
|
import { ngAttr } from './components/_attrs/angular-attr';
|
|
15
15
|
import { RWSPlugin, DefaultRWSPluginOptionsType } from './plugins/_plugin';
|
|
16
16
|
import RWSClient, { RWSClientInstance } from './client';
|
|
17
|
-
import { RWSPluginEntry } from './
|
|
18
|
-
import IRWSUser from './
|
|
17
|
+
import { RWSPluginEntry } from './types/IRWSConfig';
|
|
18
|
+
import IRWSUser from './types/IRWSUser';
|
|
19
19
|
import RWSViewComponent, { IAssetShowOptions } from './components/_component';
|
|
20
20
|
|
|
21
21
|
import RWSContainer from './components/_container';
|
package/src/plugins/_plugin.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import RWSContainer from "../components/_container";
|
|
2
2
|
import { Container } from "@microsoft/fast-foundation";
|
|
3
|
-
import RWSWindow, {loadRWSRichWindow } from '../
|
|
4
|
-
import IRWSUser from "../
|
|
3
|
+
import RWSWindow, {loadRWSRichWindow } from '../types/RWSWindow';
|
|
4
|
+
import IRWSUser from "../types/IRWSUser";
|
|
5
5
|
import { RWSInfoType } from "../client/components";
|
|
6
6
|
|
|
7
7
|
type DefaultRWSPluginOptionsType = { enabled: boolean };
|
package/src/services/_service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DI, InterfaceSymbol, Key, Registration } from '@microsoft/fast-foundation';
|
|
2
2
|
import RWSContainer from '../components/_container';
|
|
3
|
-
import { loadRWSRichWindow } from '../
|
|
3
|
+
import { loadRWSRichWindow } from '../types/RWSWindow';
|
|
4
4
|
|
|
5
5
|
export interface IWithDI<T> {
|
|
6
6
|
new (...args: any[]): T;
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
$mediaQuerySteps: (
|
|
2
|
+
'md': var(--rws-md-width, 1200px),
|
|
3
|
+
'sm': var(--rws-sm-width, 992px),
|
|
4
|
+
'xs': var(--rws-xs-width, 768px)
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
// Mixin for the grid container
|
|
8
|
+
@mixin grid-container() {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@mixin grid-container-gap($gap) {
|
|
14
|
+
gap: $gap;
|
|
15
|
+
margin-right: -#{$gap};
|
|
16
|
+
margin-left: -#{$gap};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Mixin for grid columns
|
|
20
|
+
|
|
21
|
+
@mixin internal-grid-column($columns: 12) {
|
|
22
|
+
flex: 0 0 calc(100% / 12 * $columns);
|
|
23
|
+
max-width: calc(100% / 12 * $columns);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@mixin grid-column($columns: 12) {
|
|
27
|
+
@include internal-grid-column($columns);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin grid-column($columns: 12, $mdColumns: 12) {
|
|
31
|
+
@include internal-grid-column($columns);
|
|
32
|
+
|
|
33
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'md')) {
|
|
34
|
+
@include internal-grid-column($mdColumns);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@mixin grid-column($columns: 12, $mdColumns: 12, $smColumns: 12) {
|
|
39
|
+
@include internal-grid-column($columns);
|
|
40
|
+
|
|
41
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'md')) {
|
|
42
|
+
@include internal-grid-column($mdColumns);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'sm')) {
|
|
46
|
+
@include internal-grid-column($smColumns);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@mixin grid-column($columns: 12, $mdColumns: 12, $smColumns: 12, $xsColumns: 12) {
|
|
51
|
+
@include internal-grid-column($columns);
|
|
52
|
+
|
|
53
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'md')) {
|
|
54
|
+
@include internal-grid-column($mdColumns);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'sm')) {
|
|
58
|
+
@include internal-grid-column($smColumns);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media screen and (max-width: map-get($mediaQuerySteps, 'xs')) {
|
|
62
|
+
@include internal-grid-column($xsColumns);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Mixins for grid alignment
|
|
67
|
+
|
|
68
|
+
@mixin grid-flex-align-items($horizontal, $vertical: top) {
|
|
69
|
+
justify-content: $horizontal;
|
|
70
|
+
align-items: $vertical;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@mixin center-container() {
|
|
74
|
+
margin-left: auto;
|
|
75
|
+
margin-right: auto;
|
|
76
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@mixin customScrollbars($width: 10px, $trackColor: #f1f1f1, $thumbColor: #888) {
|
|
2
|
+
|
|
3
|
+
/* WebKit (Safari/Chrome) */
|
|
4
|
+
&::-webkit-scrollbar {
|
|
5
|
+
width: $width;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&::-webkit-scrollbar-track {
|
|
9
|
+
background: $trackColor;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&::-webkit-scrollbar-thumb {
|
|
13
|
+
background: $thumbColor;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Firefox */
|
|
17
|
+
&::-moz-scrollbar {
|
|
18
|
+
width: $width;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&::-moz-scrollbar-track {
|
|
22
|
+
background: $trackColor;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&::-moz-scrollbar-thumb {
|
|
26
|
+
background: $thumbColor;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* IE/Edge */
|
|
30
|
+
&::-ms-scrollbar {
|
|
31
|
+
width: $width;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&::-ms-scrollbar-track {
|
|
35
|
+
background: $trackColor;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&::-ms-scrollbar-thumb {
|
|
39
|
+
background: $thumbColor;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/styles/includes.scss
CHANGED
|
@@ -1,99 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
@
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// Mixin for the grid container
|
|
8
|
-
@mixin grid-container {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
// gap: px-to-em(15);
|
|
12
|
-
// margin-right: -#{px-to-em(15)}; // Adjust as needed
|
|
13
|
-
// margin-left: -#{px-to-em(15)}; // Adjust as needed
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Mixin for grid columns
|
|
17
|
-
|
|
18
|
-
@mixin grid-column($columns: 12) {
|
|
19
|
-
flex: 0 0 calc(100% / 12 * $columns);
|
|
20
|
-
max-width: calc(100% / 12 * $columns);
|
|
21
|
-
// padding-right: #{px-to-em(15)}; // Adjust as needed
|
|
22
|
-
// padding-left: #{px-to-em(15)}; // Adjust as needed
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@mixin grid-column($columns: 12, $mdColumns: 12) {
|
|
26
|
-
flex: 0 0 calc(100% / 12 * $columns);
|
|
27
|
-
max-width: calc(100% / 12 * $columns);
|
|
28
|
-
// padding-right: #{px-to-em(15)}; // Adjust as needed
|
|
29
|
-
// padding-left: #{px-to-em(15)}; // Adjust as needed
|
|
30
|
-
|
|
31
|
-
@media screen and (max-width: $mdWidth) {
|
|
32
|
-
flex: 0 0 calc(100% / 12 * $mdColumns);
|
|
33
|
-
max-width: calc(100% / 12 * $mdColumns);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@mixin grid-flex-self-align($alignment) {
|
|
38
|
-
align-self: $alignment;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@mixin grid-flex-align-items($horizontal, $vertical: top) {
|
|
42
|
-
justify-content: $horizontal;
|
|
43
|
-
align-items: $vertical;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@mixin auto-left() {
|
|
47
|
-
margin-left: auto;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@mixin auto-right() {
|
|
51
|
-
margin-right: auto;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@mixin center-container() {
|
|
55
|
-
margin-left: auto;
|
|
56
|
-
margin-right: auto;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@mixin customScrollbars($width: 10px, $trackColor: #f1f1f1, $thumbColor: #888) {
|
|
60
|
-
|
|
61
|
-
/* WebKit (Safari/Chrome) */
|
|
62
|
-
&::-webkit-scrollbar {
|
|
63
|
-
width: $width;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&::-webkit-scrollbar-track {
|
|
67
|
-
background: $trackColor;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&::-webkit-scrollbar-thumb {
|
|
71
|
-
background: $thumbColor;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* Firefox */
|
|
75
|
-
&::-moz-scrollbar {
|
|
76
|
-
width: $width;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&::-moz-scrollbar-track {
|
|
80
|
-
background: $trackColor;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&::-moz-scrollbar-thumb {
|
|
84
|
-
background: $thumbColor;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/* IE/Edge */
|
|
88
|
-
&::-ms-scrollbar {
|
|
89
|
-
width: $width;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&::-ms-scrollbar-track {
|
|
93
|
-
background: $trackColor;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&::-ms-scrollbar-thumb {
|
|
97
|
-
background: $thumbColor;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
@import "_misc";
|
|
2
|
+
@import "_scrollbars";
|
|
3
|
+
@import "_grid";
|
|
4
|
+
@import "_darkreader";
|
package/types/declarations.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
//@ts-ignore all
|
|
2
|
-
|
|
3
1
|
declare module '*.scss' {
|
|
4
2
|
const content: import('@microsoft/fast-element').ElementStyles;
|
|
5
3
|
export default content;
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
declare module '*.html' {
|
|
9
|
-
const content:
|
|
7
|
+
const content: string;
|
|
10
8
|
export default content;
|
|
11
9
|
}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
1
|
|
|
4
|
-
module.exports = function(content) {
|
|
5
|
-
const filePath = this.resourcePath;
|
|
6
|
-
|
|
7
|
-
const dirPath = path.dirname(filePath);
|
|
8
|
-
const tsPath = `${dirPath}/component.ts`;
|
|
9
|
-
|
|
10
|
-
fs.readFile(tsPath, { encoding: 'utf-8' }, (err, content) => {
|
|
11
|
-
fs.writeFileSync(tsPath, content);
|
|
12
2
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return '';
|
|
3
|
+
module.exports = async function(content) {
|
|
4
|
+
const filePath = this.resourcePath;
|
|
5
|
+
const isDev = this._compiler.options.mode === 'development';
|
|
6
|
+
|
|
7
|
+
return content;
|
|
20
8
|
};
|
|
@@ -9,7 +9,7 @@ module.exports = function(content) {
|
|
|
9
9
|
|
|
10
10
|
const options = this.getOptions() || { minify: false };
|
|
11
11
|
|
|
12
|
-
const isDev = this._compiler.options.
|
|
12
|
+
const isDev = this._compiler.options.mode === 'development';
|
|
13
13
|
|
|
14
14
|
const saveFile = content.indexOf('@save') > -1;
|
|
15
15
|
let fromTs = false;
|
|
@@ -4,6 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const ts = require('typescript');
|
|
5
5
|
const tools = require('../../_tools');
|
|
6
6
|
const chalk = require('chalk');
|
|
7
|
+
const {html_error_proof} = require('./ts/html_error');
|
|
7
8
|
|
|
8
9
|
const _defaultRWSLoaderOptions = {
|
|
9
10
|
templatePath: 'template.html',
|
|
@@ -11,35 +12,14 @@ const _defaultRWSLoaderOptions = {
|
|
|
11
12
|
fastOptions: { shadowOptions: { mode: 'open' } }
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
const code = `
|
|
16
|
-
async function handleError(error: Error | any) {
|
|
17
|
-
const errorMessage = \`RWS HTML Error:\n\${error.stack}\`;
|
|
18
|
-
console.error('RWS HTML error', errorMessage);
|
|
19
|
-
return T.html\`<div class="rws-error"><h1>RWS HTML template error</h1>\${errorMessage}</div>\`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
//@ts-ignore
|
|
24
|
-
rwsTemplate =
|
|
25
|
-
T.html\`
|
|
26
|
-
${isDev ? htmlContent : htmlContent.replace(/\n/g, '')}\`;
|
|
27
|
-
} catch (error: Error | any) {
|
|
28
|
-
rwsTemplate = handleError(error);
|
|
29
|
-
}`;
|
|
30
|
-
|
|
31
|
-
if(!isDev){
|
|
32
|
-
return code;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return code.replace(/\n/g, '');
|
|
36
|
-
};
|
|
15
|
+
let htmlFastImports = null;
|
|
37
16
|
|
|
38
17
|
module.exports = async function(content) {
|
|
39
18
|
let processedContent = content;
|
|
40
19
|
const filePath = this.resourcePath;
|
|
41
|
-
const isDev = this._compiler.options.
|
|
42
|
-
|
|
20
|
+
const isDev = this._compiler.options.mode === 'development';
|
|
21
|
+
|
|
22
|
+
const htmlMinify = this._compiler.options.htmlMinify || true;
|
|
43
23
|
|
|
44
24
|
const RWSViewRegex = /(@RWSView\([^)]*)\)/;
|
|
45
25
|
const tsSourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
@@ -100,19 +80,14 @@ module.exports = async function(content) {
|
|
|
100
80
|
const templateName = 'template';
|
|
101
81
|
const templatePath = path.dirname(filePath) + `/${templateName}.html`;
|
|
102
82
|
const templateExists = fs.existsSync(templatePath, 'utf-8');
|
|
103
|
-
let template = 'const
|
|
83
|
+
let template = 'const rwsTemplate: null = null;';
|
|
104
84
|
|
|
105
85
|
if(templateExists){
|
|
86
|
+
htmlFastImports = `import * as T from '@microsoft/fast-element';\nimport RWSTemplateHTML from './${templateName}.html';`;
|
|
106
87
|
this.addDependency(templatePath);
|
|
107
|
-
|
|
108
|
-
let htmlContent = fs.readFileSync(templatePath, 'utf-8');
|
|
109
|
-
const originalContent = htmlContent;
|
|
110
|
-
|
|
111
88
|
template = `
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
${ERROR_HANDLER_CODE(originalContent, isDev && !htmlMinify)}
|
|
115
|
-
`;
|
|
89
|
+
let rwsTemplate: any = T.html\`\${RWSTemplateHTML}\`;
|
|
90
|
+
`;
|
|
116
91
|
}
|
|
117
92
|
|
|
118
93
|
const viewReg = /@RWSView\(['"]([a-zA-Z0-9_-]+)['"],?.*\)\sclass\s([a-zA-Z0-9_-]+) extends RWSViewComponent/gs
|
|
@@ -142,7 +117,7 @@ ${ERROR_HANDLER_CODE(originalContent, isDev && !htmlMinify)}
|
|
|
142
117
|
processedContent = `${template}\n${styles}\n${addedParamDefs.join('\n')}\n` + replacedViewDecoratorContent;
|
|
143
118
|
}
|
|
144
119
|
|
|
145
|
-
processedContent =
|
|
120
|
+
processedContent = `${htmlFastImports ? htmlFastImports + '\n' : ''}${processedContent}`;
|
|
146
121
|
}
|
|
147
122
|
|
|
148
123
|
const debugTsPath = filePath.replace('.ts','.debug.ts');
|
|
@@ -157,9 +132,10 @@ ${ERROR_HANDLER_CODE(originalContent, isDev && !htmlMinify)}
|
|
|
157
132
|
}
|
|
158
133
|
|
|
159
134
|
return processedContent;
|
|
160
|
-
|
|
161
135
|
}catch(e){
|
|
162
|
-
console.error
|
|
163
|
-
|
|
136
|
+
console.log(chalk.red('RWS Typescript loader error:'));
|
|
137
|
+
console.error(e);
|
|
138
|
+
|
|
139
|
+
throw new Error('RWS Build failed on: ' + filePath);
|
|
164
140
|
}
|
|
165
141
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function html_error_proof(htmlContent){
|
|
2
|
+
return `async function handleError(error: Error | any) {
|
|
3
|
+
const errorMessage = \`RWS HTML Error:\n\${error.stack}\`;
|
|
4
|
+
console.error('RWS HTML error', errorMessage);
|
|
5
|
+
return T.html\`<div class="rws-error"><h1>RWS HTML template error</h1>\${errorMessage}</div>\`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
//@rws-template-source
|
|
10
|
+
rwsTemplate =
|
|
11
|
+
T.html\`
|
|
12
|
+
${htmlContent}\`;
|
|
13
|
+
} catch (error: Error | any) {
|
|
14
|
+
rwsTemplate = handleError(error);
|
|
15
|
+
}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
html_error_proof
|
|
20
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|