Initial Commit

This commit is contained in:
Ben Parsons 2020-11-10 21:44:20 +11:00
parent 43e9398507
commit 1aac34878e
44 changed files with 70899 additions and 73 deletions

6
.directory Normal file
View File

@ -0,0 +1,6 @@
[Dolphin]
Timestamp=2020,11,7,16,37,54
Version=4
[Settings]
HiddenFilesShown=true

371
.gitignore vendored
View File

@ -1,11 +1,12 @@
# ---> VisualStudio
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,aspnetcore,csharp,node,intellij
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,aspnetcore,csharp,node,intellij
### ASPNETCore ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@ -14,9 +15,6 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@ -24,58 +22,42 @@ mono_crash.*
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
# NUNIT
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
@ -85,7 +67,6 @@ StyleCopReport.xml
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
@ -114,9 +95,6 @@ ipch/
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
@ -128,19 +106,15 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
*.coverage
*.coveragexml
@ -176,7 +150,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
@ -188,15 +162,13 @@ PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
**/packages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
@ -213,15 +185,12 @@ AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
!*.[Cc]ache/
# Others
ClientBin/
@ -232,12 +201,9 @@ ClientBin/
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
@ -252,22 +218,15 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
@ -277,7 +236,6 @@ FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
@ -285,9 +243,6 @@ node_modules/
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
@ -303,13 +258,187 @@ paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/
### Csharp ###
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
mono_crash.*
# Build results
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
# NUnit
nunit-*.xml
# Build Results of an ATL Project
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_h.h
*.iobj
*.ipdb
*_wpftmp.csproj
# Chutzpah Test files
# Visual C++ cache files
# Visual Studio profiler
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
# Guidance Automation Toolkit
# ReSharper is a .NET coding add-in
# TeamCity is a build add-in
# DotCover is a Code Coverage Tool
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
# NCrunch
# MightyMoose
# Web workbench (sass)
# Installshield output folder
# DocProject is a documentation generator add-in
# Click-Once directory
# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
# NuGet Packages
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output
# Microsoft Azure Emulator
# Windows Store app package directories and files
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
# RIA/Silverlight projects
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.ndf
# Business Intelligence projects
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
# GhostDoc plugin setting file
# Node.js Tools for Visual Studio
# Visual Studio 6 build log
# Visual Studio 6 workspace options file
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
# Paket dependency manager
# FAKE - F# Make
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
@ -353,10 +482,112 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# ---> Node
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
@ -394,7 +625,6 @@ bower_components
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
@ -427,9 +657,11 @@ typings/
# dotenv environment variables file
.env
.env.test
.env*.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
@ -461,4 +693,3 @@ dist
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

0
Infrastructure/.keep Normal file
View File

View File

@ -0,0 +1,166 @@
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace Infrastructure.Data.OliVerse
{
public class OutputCommandInterceptor : IDbCommandInterceptor
{
public List<string> NonQueries = new List<string>();
public InterceptionResult<DbCommand> CommandCreating(CommandCorrelatedEventData eventData, InterceptionResult<DbCommand> result)
{
return result;
}
public DbCommand CommandCreated(CommandEndEventData eventData, DbCommand result)
{
return result;
}
public InterceptionResult<DbDataReader> ReaderExecuting(
DbCommand command,
CommandEventData eventData,
InterceptionResult<DbDataReader> result
)
{
var cmd = command.CommandText;
var paramRegex = new Regex("@\\w+");
var matches = paramRegex.Matches(cmd);
//cmd = matches.Cast<Match>().Aggregate(cmd, (current, match) => current.Replace(match.Value, command.Parameters.Cast<SqParameter>().First(p => p.ParameterName == match.Value).Value.ToString())); ;
if (matches.Count > 0)
{
}
NonQueries.Add(command.CommandText);
return result;
}
public InterceptionResult<object> ScalarExecuting(DbCommand command, CommandEventData eventData, InterceptionResult<object> result)
{
return result;
}
public InterceptionResult<int> NonQueryExecuting(DbCommand command, CommandEventData eventData, InterceptionResult<int> result)
{
var cmd = command.CommandText;
foreach (DbParameter parameter in command.Parameters)
{
cmd = parameter.DbType == DbType.String
? cmd.Replace(parameter.ParameterName, "'" + parameter.Value + "'")
: cmd.Replace(parameter.ParameterName, parameter.Value.ToString());
}
NonQueries.Add(cmd);
//(command as En SqlCeMultiCommand)
//command.Cancel();
return result;
}
public Task<InterceptionResult<DbDataReader>> ReaderExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<DbDataReader> result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public Task<InterceptionResult<object>> ScalarExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<object> result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public Task<InterceptionResult<int>> NonQueryExecutingAsync(
DbCommand command,
CommandEventData eventData,
InterceptionResult<int> result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public DbDataReader ReaderExecuted(DbCommand command, CommandExecutedEventData eventData, DbDataReader result)
{
return result;
}
public object ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object result)
{
return result;
}
public int NonQueryExecuted(DbCommand command, CommandExecutedEventData eventData, int result)
{
NonQueries.Add(command.CommandText);
return result;
}
public Task<DbDataReader> ReaderExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
DbDataReader result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public Task<object> ScalarExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
object result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public Task<int> NonQueryExecutedAsync(
DbCommand command,
CommandExecutedEventData eventData,
int result,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.FromResult(result);
}
public void CommandFailed(DbCommand command, CommandErrorEventData eventData)
{
NonQueries.Add(command.CommandText);
}
public Task CommandFailedAsync(
DbCommand command,
CommandErrorEventData eventData,
CancellationToken cancellationToken = new CancellationToken()
)
{
return Task.CompletedTask;
}
public InterceptionResult DataReaderDisposing(DbCommand command, DataReaderDisposingEventData eventData, InterceptionResult result)
{
return result;
}
}
}

View File

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore;
namespace Infrastructure.Data
{
public class ExDbContext : DbContext
{
private string connectionString;
public ExDbContext()
{ }
public ExDbContext(DbContextOptions options) : base(options)
{ }
public ExDbContext(string connectionString)
{
this.connectionString = connectionString;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
if (!string.IsNullOrWhiteSpace(connectionString))
{
optionsBuilder.UseSqlServer(connectionString);
}
//optionsBuilder.UseSqlServer("Server=tcp:kyljx9pxvr-dev.database.windows.net,1433;Database=oliverse_db_dev;User ID=olipos_admin@kyljx9pxvr-dev;Password=Mentor21;Trusted_Connection=False;Encrypt=True;Connection Timeout=150;");
}
}
}

View File

@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Services\**" />
<EmbeddedResource Remove="Services\**" />
<None Remove="Services\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0" />
<PackageReference Include="NLog" Version="4.6.8" />
<PackageReference Include="NLog.Config" Version="4.6.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.1" />
<PackageReference Include="NLog.Schema" Version="4.6.8" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

View File

@ -1,3 +0,0 @@
# exsvelte
ProEX GUI in Svelte & ASP.NET Core MVC

View File

@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc;
namespace Web.Controllers
{
[Route("Home")]
public class HomeController : Controller
{
[Route("Hello")]
public JsonResult Hello(Hello request)
{
return new JsonResult(new HelloResponse() {Result = $"hello, {request?.Name ?? "System.NullReferenceException"}"});
}
public IActionResult Index()
{
return View();
}
}
public class Hello
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}
}

41
Web/NLog.config Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
</rules>
</nlog>

44
Web/Program.cs Normal file
View File

@ -0,0 +1,44 @@
using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Web;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
namespace Web
{
public class Program
{
public static void Main(string[] args)
{
var logger = LogManager/*NLogBuilder/*.ConfigureNLog("nlog.config")*/.GetCurrentClassLogger();
try
{
logger.Debug("init main");
CreateHostBuilder(args).Build().Run();
}
catch (Exception exception)
{
//NLog: catch setup errors
logger.Fatal(exception, "Program stopped due to exception");
throw;
}
finally
{
NLog.LogManager.Shutdown();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); })
.ConfigureLogging(logging =>
{
// prefer NLog for logging
//logging.ClearProviders();
logging.SetMinimumLevel(LogLevel.Trace);
})
.UseNLog();
}
}

View File

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:5001/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001/"
}
}
}

22
Web/README.md Normal file
View File

@ -0,0 +1,22 @@
# exsvelte
ProEX GUI in Svelte & ASP.NET Core MVC
### To setup dev:
Install Node.js, then, in a command prompt:
If you do not have yarn, install that first:
```
$ npm install --global yarn
```
Then, after clone, navigate to Web/ and run:
```
$ yarn install
```
###To dev:
Run in a command prompt:
```
$ rollup -c -w
```

119
Web/Startup.cs Normal file
View File

@ -0,0 +1,119 @@
using System.IO;
using Infrastructure.Data;
using Infrastructure.Data.OliVerse;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Rewrite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using Westwind.AspNetCore.LiveReload;
namespace Web
{
public class Startup
{
public Startup(IConfiguration configuration, IWebHostEnvironment hostEnvironment)
{
Configuration = configuration;
Env = hostEnvironment;
}
public IWebHostEnvironment Env { get; }
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddLiveReload(config =>
{
config.FolderToMonitor = Path.GetFullPath(Path.Combine(Env.ContentRootPath, ".."));
});
services.AddDbContext<ExDbContext>(opt =>
opt.UseSqlServer(Configuration.GetConnectionString("" /*TODO*/))
.AddInterceptors(new OutputCommandInterceptor()));
services.AddRazorPages(options => { });
services.AddControllersWithViews(options => { }); //(options => options.EnableEndpointRouting = false);
//.AddJsonOptions(options => { options.JsonSerializerOptions.; });
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// dont redirect if in development
app.UseHttpsRedirection();
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseLiveReload();
app.UseStaticFiles(new StaticFileOptions() {ServeUnknownFileTypes = true, });
app.UseRouting();
// app.UseRewriter(new RewriteOptions().AddRedirect("", "/"));
// example of custom Endpoint-based routing examples:
// https://github.com/dotnet/aspnetcore/issues/4221#issuecomment-488596903
// https://github.com/dotnet/aspnetcore/blob/master/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs
// old way of doing routing, requires options => options.EnableEndpointRouting = false
// app.UseMvc(routes =>
// {
// routes.MapRoute("default", "{controller=Home}");
// routes.MapSpaFallbackRoute("spa-fallback",
// new
// {
// controller = "Home",
// action = "Index"
// });
// });
//
//*/
app.UseEndpoints(endpoints =>
{
//endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}");
// try and match the URL to razor pages first
endpoints.MapRazorPages();
// then try and map the URL to Controllers (including the API)
//endpoints.MapControllerRoute("default", "/{controller}/");
endpoints.MapControllers();
// and if that doesnt work, send them the homepage, but leave their URI path intact as for handling by the SPA
endpoints.MapFallbackToController("Index", "Home");
// endpoints.MapFallbackToPage("/");
//endpoints.MapToSpaCliProxy("/");
// Note: only use spacliproxy in development.
// Production should use "UseSpaStaticFiles()"
}); //*/
// app.UseEndpoints(endpoints =>
// {
// endpoints.MapRazorPages();
// endpoints.MapControllers();
// });
}
}
}

25
Web/Views/Error.cshtml Normal file
View File

@ -0,0 +1,25 @@
@page
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@*
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
*@
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -0,0 +1,3 @@
@{
ViewData["Title"] = "Home";
}

7
Web/Views/Privacy.cshtml Normal file
View File

@ -0,0 +1,7 @@
@page
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon"
type="image/png" href="favicon.png"/>
<title>@ViewData["Title"] - Web</title>
@* <link rel="stylesheet" href="/css/bootstrap.min.css"/> *@
@* <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> *@
<link rel="stylesheet" href="~/build/bundle.css" asp-append-version="true"/>
@* <link rel="stylesheet" href="~/site.css" asp-append-version="true"/> *@
<environment include="Development">
<script> basePath = ''</script>
</environment>
<environment exclude="Development">
<script> basePath = '@Url.Content("~")'; </script>
</environment>
</head>
<body>
@RenderBody()
<!-- Load the "module" version on browsers that can support it. -->
<script type="module" src="https://unpkg.com/dimport?module" data-main="/build/main.js"></script>
<!-- Load the "nomodule" version on older browsers acts as fallback! -->
<script type="nomodule" nomodule src="https://unpkg.com/dimport/nomodule" data-main="/build/main.js">
</script>
<!-- Old style JS library -->
<!--script type="text/javascript" src="~/dist/bundle.js" asp-append-version="true"></script-->
@RenderSection("scripts", required: false)
</body>
</html>

View File

@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@ -0,0 +1,3 @@
@namespace Web.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Microsoft.AspNetCore.SpaServices

View File

@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}

51
Web/Web.csproj Normal file
View File

@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models" />
<Folder Include="src\components" />
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0" />
<PackageReference Include="NLog" Version="4.7.5" />
<PackageReference Include="NLog.Config" Version="4.7.5" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.5" />
<PackageReference Include="NLog.Schema" Version="4.7.5" />
<PackageReference Include="NLog.Web" Version="4.9.3" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
<PackageReference Include="Westwind.AspNetCore.LiveReload" Version="0.2.14" />
</ItemGroup>
<ItemGroup>
<None Remove="node_modules\**" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\build\wwwroot\bundle.css" />
<_ContentIncludedByDefault Remove="wwwroot\build\wwwroot\bundle.css.map" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
{
"DebugMode": true,
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"Console": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
}

15
Web/appsettings.json Normal file
View File

@ -0,0 +1,15 @@
{
"Logging": {
"IncludeScopes": false,
"Debug": {
"LogLevel": {
"Default": "Warning"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
}
}
}

25
Web/gulpfile.js Normal file
View File

@ -0,0 +1,25 @@
(function () {
var SCRIPTS = {
'dev': 'npm run dev',
'dtos': 'npm run dtos',
'build': 'npm run build',
'publish': 'npm run publish'
};
var gulp = require('gulp');
var exec = require('child_process').exec;
function runScript(script, done) {
process.env.FORCE_COLOR = 1;
var proc = exec(script + (script.startsWith("npm") ? " --silent" : ""));
proc.stdout.pipe(process.stdout);
proc.stderr.pipe(process.stderr);
proc.on('exit', () => done());
}
// Tasks
Object.keys(SCRIPTS).forEach(name => {
gulp.task(name, done => runScript(SCRIPTS[name], done));
});
})();

71
Web/package.json Normal file
View File

@ -0,0 +1,71 @@
{
"name": "exsvelte",
"version": "0.1.0",
"repository": "https://quartznet.info/git/MiniJack/exsvelte",
"author": "Ben Parsons <9parsonsb@gmail.com>",
"license": "MIT",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv wwwroot"
},
"devDependencies": {
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.8.3",
"@beyonk/svelte-toggle": "^0.1.2",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-typescript": "^2.1.0",
"@types/node": "^13.1.8",
"aspnet-webpack": "^3.0.0",
"autoprefixer": "^10.0.1",
"babel-cli": "^6.23.0",
"css-loader": "^3.4.2",
"eslint-plugin-svelte3": "^2.7.3",
"event-source-polyfill": "^1.0.12",
"file-loader": "^5.0.2",
"gulp": "^4.0.2",
"install": "^0.13.0",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.5.1",
"node-sass": "^5.0.0",
"rollup": "^2.33.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-sass": "^1.2.2",
"rollup-plugin-scss": "^2.6.1",
"rollup-plugin-svelte": "^6.0.0",
"rollup-plugin-terser": "^7.0.0",
"sass": "^1.29.0",
"sirv": "^1.0.7",
"sirv-cli": "^1.0.0",
"svelte": "^3.29.4",
"svelte-loader": "^2.13.6",
"svelte-navaid": "^0.1.1",
"svelte-preprocess": "^4.5.2",
"ts-loader": "^6.2.1",
"tslib": "^1.10.0",
"typescript": "^3.7.5",
"uglifyjs-webpack-plugin": "^2.2.0",
"url-loader": "^3.0.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-middleware": "^3.7.2",
"webpack-hot-middleware": "^2.25.0",
"webpack-virtual-modules": "^0.2.1"
},
"dependencies": {
"@beyonk/svelte-carousel": "^2.8.0",
"bootstrap": "^4.5.3",
"jquery": "^3.5.1",
"popper.js": "^1.16.1",
"postcss": "^8.1.6",
"scss": "^0.2.4",
"siema": "^1.5.1",
"svelte-feather-icons": "^3.3.0",
"svelte-swipe": "^1.7.1"
}
}

122
Web/rollup.config.js Normal file
View File

@ -0,0 +1,122 @@
import babel from 'rollup-plugin-babel';
import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';
import json from "@rollup/plugin-json";
import scss from 'rollup-plugin-scss'
import { nodeResolve } from '@rollup/plugin-node-resolve';
const production = !process.env.ROLLUP_WATCH;
const port = process.env.PORT;
const buildDir = 'wwwroot/build';
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}
export default {
input: 'src/main.ts',
output: {
sourcemap: true,
format: 'esm',
name: 'app',
//file: 'wwwroot/bundle.js'
dir: buildDir,
},
plugins: [
svelte({
// enable run-time checks when not in production
dev: !production,
// // we'll extract any component CSS out into
// // a separate file - better for performance
// css: css => {
// css.write('bundle.css');
// },
preprocess: sveltePreprocess({
scss: {
includePaths: ['src'],
excludePaths: ['wwwroot', 'node_modules'],
minify: !production
},
postcss: {
plugins: [require('autoprefixer')],
},
}),
emitCss: true
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/')
}),
commonjs({
extensions: ['.js'],
namedExports: {
'node_modules/bootstrap/dist/js/bootstrap.min.js' : ['bootstrap'],
jquery : 'jQuery',
'popper.js': 'Popper'
},
exclude: "node_modules/**"
}),
json(),
globals(),
builtins(),
babel({exclude: "node_modules/**"}),
nodeResolve(),
typescript({ sourceMap: !production }),
scss({
exclude: ['node_modules'],
sass: require('sass'),
minify: !production,
output: 'wwwroot/build/bundle.css',
sourcemap: true
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
//!production && serve(),
// Watch the `wwwroot` directory and refresh the
// browser on changes when not in production
// note that livereload will not work when running under aspnetcore. use the livereload nuget package when running under aspnetcore
!production && livereload({
watch: './wwwroot',
port,
}),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};

View File

@ -0,0 +1,128 @@
// @ts-check
/** This script modifies the project to support TS code in .svelte files like:
<script lang="ts">
export let name: string;
</script>
As well as validating the code for CI.
*/
/** To work on this script:
rm -rf test-template template && git clone sveltejs/template test-template && node scripts/setupTypeScript.js test-template
*/
const fs = require("fs")
const path = require("path")
const { argv } = require("process")
const projectRoot = argv[2] || path.join(__dirname, "..")
// Add deps to pkg.json
const packageJSON = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf8"))
packageJSON.devDependencies = Object.assign(packageJSON.devDependencies, {
"svelte-check": "^1.0.0",
"svelte-preprocess": "^4.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"typescript": "^3.9.3",
"tslib": "^2.0.0",
"@tsconfig/svelte": "^1.0.0"
})
// Add script for checking
packageJSON.scripts = Object.assign(packageJSON.scripts, {
"validate": "svelte-check"
})
// Write the package JSON
fs.writeFileSync(path.join(projectRoot, "package.json"), JSON.stringify(packageJSON, null, " "))
// mv src/main.js to main.ts - note, we need to edit rollup.config.js for this too
const beforeMainJSPath = path.join(projectRoot, "src", "main.js")
const afterMainTSPath = path.join(projectRoot, "src", "main.ts")
fs.renameSync(beforeMainJSPath, afterMainTSPath)
// Switch the app.svelte file to use TS
const appSveltePath = path.join(projectRoot, "src", "App.svelte")
let appFile = fs.readFileSync(appSveltePath, "utf8")
appFile = appFile.replace("<script>", '<script lang="ts">')
appFile = appFile.replace("export let name;", 'export let name: string;')
fs.writeFileSync(appSveltePath, appFile)
// Edit rollup config
const rollupConfigPath = path.join(projectRoot, "rollup.config.js")
let rollupConfig = fs.readFileSync(rollupConfigPath, "utf8")
// Edit imports
rollupConfig = rollupConfig.replace(`'rollup-plugin-terser';`, `'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript';`)
// Replace name of entry point
rollupConfig = rollupConfig.replace(`'src/main.js'`, `'src/main.ts'`)
// Add preprocess to the svelte config, this is tricky because there's no easy signifier.
// Instead we look for `css:` then the next `}` and add the preprocessor to that
let foundCSS = false
let match
// https://regex101.com/r/OtNjwo/1
const configEditor = new RegExp(/css:.|\n*}/gmi)
while (( match = configEditor.exec(rollupConfig)) != null) {
if (foundCSS) {
const endOfCSSIndex = match.index + 1
rollupConfig = rollupConfig.slice(0, endOfCSSIndex) + ",\n preprocess: sveltePreprocess()," + rollupConfig.slice(endOfCSSIndex);
break
}
if (match[0].includes("css:")) foundCSS = true
}
// Add TypeScript
rollupConfig = rollupConfig.replace(
'commonjs(),',
'commonjs(),\n\t\ttypescript({\n\t\t\tsourceMap: !production,\n\t\t\tinlineSources: !production\n\t\t}),'
);
fs.writeFileSync(rollupConfigPath, rollupConfig)
// Add TSConfig
const tsconfig = `{
"extends": "@tsconfig/svelte/tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
}`
const tsconfigPath = path.join(projectRoot, "tsconfig.json")
fs.writeFileSync(tsconfigPath, tsconfig)
// Delete this script, but not during testing
if (!argv[2]) {
// Remove the script
fs.unlinkSync(path.join(__filename))
// Check for Mac's DS_store file, and if it's the only one left remove it
const remainingFiles = fs.readdirSync(path.join(__dirname))
if (remainingFiles.length === 1 && remainingFiles[0] === '.DS_store') {
fs.unlinkSync(path.join(__dirname, '.DS_store'))
}
// Check if the scripts folder is empty
if (fs.readdirSync(path.join(__dirname)).length === 0) {
// Remove the scripts folder
fs.rmdirSync(path.join(__dirname))
}
}
// Adds the extension recommendation
fs.mkdirSync(path.join(projectRoot, ".vscode"))
fs.writeFileSync(path.join(projectRoot, ".vscode", "extensions.json"), `{
"recommendations": ["svelte.svelte-vscode"]
}
`)
console.log("Converted to TypeScript.")
if (fs.existsSync(path.join(projectRoot, "node_modules"))) {
console.log("\nYou will need to re-run your dependency manager to get started.")
}

46
Web/src/App.svelte Normal file
View File

@ -0,0 +1,46 @@
<script>
import Router from 'svelte-navaid/Router.svelte';
import Route from 'svelte-navaid/Route.svelte';
import {onDestroy} from 'svelte';
import Nav from './components/Nav.svelte';
import Home from './routes/Home.svelte'
import Button from './routes/Button.svelte'
import tmp from './routes/temp.svelte'
import Joe from './routes/Joe.svelte'
let navigate;
const routes = [
{path: "/", component: Home},
{path: "Button", component: Button},
{path: "tmp", component: tmp},
{path: 'joe', component: Joe}
];
</script>
<Router bind:navigate >
<Nav {navigate}/>
<main>
{#each routes as route}
<Route path={route.path} component={route.component}/>
{/each}
<Route>
<h1 style="text-align: center; margin: 0 auto; font-size: 10em">404</h1>
</Route>
</main>
</Router>
<style>
main {
position: relative;
max-width: 80em;
background-color: white;
padding: 2em;
margin: 0 auto;
box-sizing: border-box;
}
</style>

View File

@ -0,0 +1,36 @@
<script>
import { getContext } from 'svelte';
import { writable } from 'svelte/store';
const navigate = getContext('navigate');
const navaid = getContext('navaid');
const base = navaid && navaid.base || writable('/');
const library = navaid && navaid.library || writable(null);
let props;
let href;
export let append;
$: {
props = { ...$$props };
href = props.href;
delete props.href;
href = ($library && $library.prefix ? $library.prefix : '') + (!append ? $base : '') + href.replace(/^\//, '');
}
const click = () => {
navigate(href);
}
</script>
<style>
span {
text-decoration: none;
padding: 1rem 0.5rem;
display: block;
color: #005de6;
}
</style>
<span {...props} on:click={click}><slot></slot></span>

View File

@ -0,0 +1,72 @@
<script>
import Link from './Link.svelte';
import {getContext} from 'svelte';
const {routes, active, params} = getContext('navaid');
export let navigate;
let current;
$: isActive = str => {
active.subscribe(v=>current=v);
if (str === "/" && $active.path === "")
return "selected";
return $active.path === str ? 'selected' : '';
};
</script>
{#if $active}
<nav>
<ul>
<li><Link class="{ isActive('') }" href="/">Home</Link></li>
<li><Link class="{ isActive('Button') }" href="Button">Button</Link></li>
<li><Link class="{ isActive('tmp') }" href="tmp">tmp</Link></li>
<li><Link class="{ isActive('joe') }" href="joe">joe</Link></li>
</ul>
</nav>
{/if}
<style>
nav {
border-bottom: 1px solid rgba(170, 30, 30, 0.1);
font-weight: 300;
padding: 0 1em;
}
ul {
margin: 0;
padding: 0;
}
/* clearfix */
ul::after {
content: '';
display: block;
clear: both;
}
li {
display: block;
float: left;
}
:global(.selected) {
position: relative;
display: inline-block;
}
:global(.selected::after) {
position: absolute;
content: '';
width: calc(100% - 1em);
height: 2px;
background-color: rgb(170, 30, 30);
display: block;
bottom: -1px;
}
</style>

17
Web/src/main.ts Normal file
View File

@ -0,0 +1,17 @@
import 'bootstrap/dist/css/bootstrap.css';
import 'jquery'
import 'bootstrap'
import '../wwwroot/site.scss'
// @ts-ignore
import App from './App.svelte';
const app = new App({
target: document.body,
props: {
name: 'world'
}
});
export default app;

View File

@ -0,0 +1,13 @@
<svelte:head>
<title>Test Page!</title>
</svelte:head>
<script>
let number = 0;
</script>
<h3>Number: {number}</h3>
<br/>
<button class="btn-primary btn btn-lg" on:click="{()=>number+=1}">INCREMENT!</button>
<button class="btn-primary btn btn-lg" on:click="{()=>number-=1}">DECREMENT!</button>

View File

@ -0,0 +1,65 @@
<svelte:head>
<title>Test!</title>
</svelte:head>
<h1>Great success!</h1>
<figure>
<img alt="Borat" src="https://raw.githubusercontent.com/Kiho/aspcore-spa-cli/master/samples/SvelteCliSample/wwwroot/great-success.png">
<figcaption>HIGH FIVE!</figcaption>
</figure>
<ul>
<li><p><strong> Live reloading.</strong></p>
<p>Try editing this file (routes/index.html) to test</p>
<li>
<p>
<strong>sass/scss</strong>
</p>
<p>
Add `lang="sass/scss"` to a &lt;style&gt; tag to use SASS/SCSS (i.e "&lt;style lang='scss'&gt;")
</p>
</li>
</ul>
<style>
h1, figure, p, h3 {
text-align: center;
vertical-align: middle;
margin: 0 auto;
}
ul {
list-style: none;
}
h1 {
font-size: 2.8em;
text-transform: uppercase;
font-weight: 700;
margin: 0 0 0.5em 0;
}
figure {
margin: 0 0 1em 0;
}
img {
width: 100%;
max-width: 400px;
margin: 0 0 1em 0;
}
p {
margin: 1em auto;
}
@media (min-width: 480px) {
h1 {
font-size: 4em;
}
}
</style>

View File

@ -0,0 +1,48 @@
<script>
import {Swipe, SwipeItem} from 'svelte-swipe'
import {ChevronLeftIcon, ChevronRightIcon} from 'svelte-feather-icons'
const swipeConfig = {
autoplay: false,
delay: 2000,
showIndicators: true,
transitionDuration: 1000,
defaultIndex: 0,
};
</script>
<div class="swipe-holder">
<Swipe>
<SwipeItem>
<div class="swipe-content">Slide 1</div>
</SwipeItem>
<SwipeItem>
<div class="swipe-content">Slide 2</div>
</SwipeItem>
<SwipeItem>
<div class="swipe-content">Slide 3</div>
</SwipeItem>
</Swipe>
</div>
<style>
.swipe-holder
{
max-width: max-content;
left:0;
display: block;
position: absolute;
height:100%;
width:100%;
background: blue;
}
.swipe-content
{
top:0;
bottom:0;
right:0;
background: red;
height:100%;
width:100%;
}
</style>

6
Web/tsconfig.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules/*", "__sapper__/*", "public/*", "bin/*", "wwwroot/*"],
}

21087
Web/wwwroot/build/bundle.css Normal file

File diff suppressed because one or more lines are too long

19814
Web/wwwroot/build/main.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

20991
Web/wwwroot/bundle.css Normal file

File diff suppressed because it is too large Load Diff

BIN
Web/wwwroot/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

2
Web/wwwroot/site.scss Normal file
View File

@ -0,0 +1,2 @@
@import "../node_modules/bootstrap/scss/bootstrap";

7348
Web/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

22
exsvelte.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure", "Infrastructure\Infrastructure.csproj", "{91FDCF69-8B98-4CDE-8E70-56AAF92EC7A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "Web\Web.csproj", "{DC31914D-D841-4CCB-93FC-9EC7D72062CE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{91FDCF69-8B98-4CDE-8E70-56AAF92EC7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91FDCF69-8B98-4CDE-8E70-56AAF92EC7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91FDCF69-8B98-4CDE-8E70-56AAF92EC7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91FDCF69-8B98-4CDE-8E70-56AAF92EC7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{DC31914D-D841-4CCB-93FC-9EC7D72062CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC31914D-D841-4CCB-93FC-9EC7D72062CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC31914D-D841-4CCB-93FC-9EC7D72062CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC31914D-D841-4CCB-93FC-9EC7D72062CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal