Skip to content

Commit 293e8af

Browse files
committed
chore: demos update
1 parent a899d71 commit 293e8af

File tree

6 files changed

+1671
-1129
lines changed

6 files changed

+1671
-1129
lines changed

demo-snippets/ng/bottom-sheet/bottom-sheet.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
1+
import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
22
import { NativeScriptCommonModule } from '@nativescript/angular';
33
import { NativeScriptMaterialBottomSheetModule } from '@nativescript-community/ui-material-bottomsheet/angular';
44

@@ -7,7 +7,7 @@ import { BottomSheetComponent } from './bottom-sheet.component';
77

88
@NgModule({
99
declarations: [BottomSheetComponent, LoginOptionsComponent],
10-
entryComponents: [LoginOptionsComponent],
10+
// entryComponents: [LoginOptionsComponent],
1111
// Recommendation: The NativeScriptMaterialBottomSheetModule should be imported in your app.module
1212
// Right now the Module doesn't work well with HMR
1313
// so if you are having troubles enable the legacy workflow in your nsconfig.json

demo-snippets/ng/tabs/tabs.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
1+
import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
22
import { NativeScriptCommonModule } from '@nativescript/angular';
33
import { NativeScriptMaterialTabsModule } from '@nativescript-community/ui-material-tabs/angular';
44
import { TabsComponent } from './tabs.component';

demo-snippets/ng/text-field/text-field.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
1+
import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
22
import { NativeScriptCommonModule } from '@nativescript/angular';
33
import { NativeScriptMaterialTextFieldModule } from '@nativescript-community/ui-material-textfield/angular';
44
import { TextFieldComponent } from './text-field.component';

demo-snippets/vue/install.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@ export function installPlugin() {
7575
}
7676

7777
export const demos = [
78-
{ name: 'Mixins', path: 'Mixins', component: Mixins },
7978
{ name: 'ActivityIndicators', path: 'ActivityIndicators', component: ActivityIndicators },
8079
{ name: 'BottomNavigationBar', path: 'BottomNavigationBar', component: BottomNavigationBar },
8180
{ name: 'BottomNavigation', path: 'BottomNavigation', component: BottomNavigation },
81+
{ name: 'BottomSheet', path: 'BottomSheet', component: BottomSheet },
8282
{ name: 'Buttons', path: 'Buttons', component: Buttons },
8383
{ name: 'CardViews', path: 'CardViews', component: CardViews },
8484
{ name: 'Dialogs', path: 'Dialogs', component: Dialogs },
85+
{ name: 'Mixins', path: 'Mixins', component: Mixins },
8586
{ name: 'ProgressBars', path: 'ProgressBars', component: ProgressBars },
8687
{ name: 'Ripples', path: 'Ripples', component: Ripples },
8788
{ name: 'Sliders', path: 'Sliders', component: Sliders },
8889
{ name: 'SnackBar', path: 'SnackBar', component: SnackBar },
90+
{ name: 'SpeedDial', path: 'SpeedDial', component: SpeedDial },
8991
{ name: 'TextFields', path: 'TextFields', component: TextFields },
9092
{ name: 'TextViews', path: 'TextViews', component: TextViews },
91-
{ name: 'BottomSheet', path: 'BottomSheet', component: BottomSheet },
92-
{ name: 'SpeedDial', path: 'SpeedDial', component: SpeedDial },
9393
{ name: 'Tabs', path: 'Tabs', component: Tabs }
9494
];

demo-snippets/webpack.config.ng.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
const { readFileSync } = require('fs');
2+
const CopyWebpackPlugin = require('copy-webpack-plugin');
3+
4+
const { resolve } = require('path');
5+
function fixedFromCharCode(codePt) {
6+
if (codePt > 0xffff) {
7+
codePt -= 0x10000;
8+
return String.fromCharCode(0xd800 + (codePt >> 10), 0xdc00 + (codePt & 0x3ff));
9+
} else {
10+
return String.fromCharCode(codePt);
11+
}
12+
}
13+
14+
15+
module.exports = (env, webpack) => {
16+
const platform = env && ((env.android && 'android') || (env.ios && 'ios'));
17+
webpack.chainWebpack((config) => {
18+
19+
20+
21+
const symbolsParser = require('scss-symbols-parser');
22+
const mdiSymbols = symbolsParser.parseSymbols(readFileSync(resolve(__dirname, './node_modules/@mdi/font/scss/_variables.scss')).toString());
23+
const mdiIcons = JSON.parse(`{${mdiSymbols.variables[mdiSymbols.variables.length - 1].value.replace(/" (F|0)(.*?)([,\n]|$)/g, '": "$1$2"$3')}}`);
24+
25+
const scssPrepend = `$mdi-fontFamily: ${platform === 'android' ? 'materialdesignicons-webfont' : 'Material Design Icons'};`;
26+
config.module.rule('scss').use('sass-loader').options({
27+
additionalData: scssPrepend
28+
});
29+
config.module
30+
.rule('replace_mdi')
31+
.exclude.add(/node_modules/)
32+
.end()
33+
.test(/\.(ts|js|scss|css|vue)$/)
34+
.use('string-replace-loader')
35+
.loader(resolve(__dirname, './node_modules/string-replace-loader'))
36+
.options({
37+
search: 'mdi-([a-z0-9-_]+)',
38+
replace: (match, p1, offset, str) => {
39+
if (mdiIcons[p1]) {
40+
return fixedFromCharCode(parseInt(mdiIcons[p1], 16));
41+
}
42+
return match;
43+
},
44+
flags: 'g'
45+
});
46+
config.plugin('material-font').use(CopyWebpackPlugin, [
47+
{
48+
patterns: [
49+
{
50+
from: resolve(__dirname, './node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf'),
51+
to: 'fonts'
52+
}
53+
]
54+
}
55+
]);
56+
});
57+
};

0 commit comments

Comments
 (0)