From f12ecc421d823ba87f8dbd0a94f4963fbf3cb2d4 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Wed, 15 Mar 2023 14:20:56 -0700 Subject: [PATCH 001/869] Update Gitignore --- .gitignore | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 235 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index a250f036..d55d2d5a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ bin ~*.tmp ~$*.dotm +# Files to keep (primarily book content) !.gitignore !.gitattributes !EssentialC#.dotx @@ -27,29 +28,251 @@ bin !Michaelis_Acknowledgments.docx !Michaelis_Forward.docx !Michaelis_TableOfContents.docx + +# Old or generated files to not commit wwwroot/sitemap.xml +wwwroot/Chapters +EssentialCSharp.Web/wwwroot/Chapters +EssentialCSharp.Web/wwwroot/sitemap.xml +EssentialCSharp.Web/Chapters/ +Utilities/EssentialCSharp.Web/Chapters/ +Utilities/EssentialCSharp.Web/wwwroot/sitemap.xml +Utilities/EssentialCSharp.Web/wwwroot/Chapters/ *.user Utilities/Parser.Web/.local-chromium -# Local History for Visual Studio Code -.history/ +[Ee]xpress/ -# Visual Studio code coverage results -*.coverage -*.coveragexml -Utilities/EssentialCSharp.Web/wwwroot/Chapters/ +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html -#JetBrains Rider IDE Settings -*/.idea/ +# Click-Once directory +publish/ -Utilities/EssentialCSharp.Web/Chapters/ +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: 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 -Utilities/EssentialCSharp.Web/wwwroot/sitemap.xml +# 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 +PublishScripts/ -Utilities/EssentialCSharpUtilities.lutconfig +# NuGet Packages +*.nupkg +# 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 +*.nuget.props +*.nuget.targets -EssentialCSharp.Web/Chapters/ +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +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/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +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/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_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/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log msbuild.binlog +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml From 2175c0bbf4e145ba48d0da1c5eed9b966427efdf Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Wed, 15 Mar 2023 15:19:11 -0700 Subject: [PATCH 002/869] Minor: Add Space (#63) --- EssentialCSharp.Web/Views/Home/TermsOfService.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EssentialCSharp.Web/Views/Home/TermsOfService.cshtml b/EssentialCSharp.Web/Views/Home/TermsOfService.cshtml index 50226e0f..bc01affc 100644 --- a/EssentialCSharp.Web/Views/Home/TermsOfService.cshtml +++ b/EssentialCSharp.Web/Views/Home/TermsOfService.cshtml @@ -27,7 +27,7 @@
Privacy and Protection of Personal Information
-

Your privacy is important to us. Please read theIntelliTect Privacy Statement (the "Privacy Statement") as it describes the types of data we collect from you and your devices, how we use that data, and the legal bases we have to process that data.

+

Your privacy is important to us. Please read the IntelliTect Privacy Statement (the "Privacy Statement") as it describes the types of data we collect from you and your devices, how we use that data, and the legal bases we have to process that data.

From 2d8e4144d73b3f1881cd9a3abafb2c57e4762511 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 06:54:57 -0700 Subject: [PATCH 003/869] Bump ContentFeedNuget from 1.0.0-344 to 1.0.0-345 (#65) --- EssentialCSharp.Web/EssentialCSharp.Web.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EssentialCSharp.Web/EssentialCSharp.Web.csproj b/EssentialCSharp.Web/EssentialCSharp.Web.csproj index 996e9ff7..3ae5a6fc 100644 --- a/EssentialCSharp.Web/EssentialCSharp.Web.csproj +++ b/EssentialCSharp.Web/EssentialCSharp.Web.csproj @@ -8,7 +8,7 @@ - + From 6e181298b6b61665f95df86a7bc42439702db3c7 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 16 Mar 2023 06:56:52 -0700 Subject: [PATCH 004/869] Bye Bye cdn issues (#64) --- .../Views/Shared/_Layout.cshtml | 12 +- .../wwwroot/lib/docsearch/style.css | 2 + .../wwwroot/lib/es-module-shims/LICENSE | 10 + .../wwwroot/lib/es-module-shims/README.md | 909 + .../es-module-shims/dist/es-module-shims.js | 898 + .../dist/es-module-shims.wasm.js | 898 + .../wwwroot/lib/es-module-shims/index.d.ts | 212 + .../wwwroot/lib/es-module-shims/package.json | 50 + .../wwwroot/lib/vue-window-size/LICENSE | 21 + .../wwwroot/lib/vue-window-size/README.md | 190 + .../composition-api/dist/index.cjs | 1 + .../composition-api/dist/index.d.ts | 8 + .../composition-api/dist/index.js | 1 + .../composition-api/package.json | 31 + .../lib/vue-window-size/mixin/dist/index.cjs | 1 + .../lib/vue-window-size/mixin/dist/index.d.ts | 26 + .../lib/vue-window-size/mixin/dist/index.js | 1 + .../lib/vue-window-size/mixin/package.json | 30 + .../wwwroot/lib/vue-window-size/package.json | 74 + .../lib/vue-window-size/plugin/dist/index.cjs | 1 + .../vue-window-size/plugin/dist/index.d.ts | 24 + .../lib/vue-window-size/plugin/dist/index.js | 1 + .../lib/vue-window-size/plugin/package.json | 30 + EssentialCSharp.Web/wwwroot/lib/vue/LICENSE | 21 + EssentialCSharp.Web/wwwroot/lib/vue/README.md | 54 + .../wwwroot/lib/vue/compiler-sfc/index.d.ts | 1 + .../wwwroot/lib/vue/compiler-sfc/index.js | 1 + .../wwwroot/lib/vue/compiler-sfc/index.mjs | 1 + .../wwwroot/lib/vue/compiler-sfc/package.json | 5 + .../wwwroot/lib/vue/dist/vue.cjs.js | 81 + .../wwwroot/lib/vue/dist/vue.cjs.prod.js | 69 + .../wwwroot/lib/vue/dist/vue.d.ts | 9 + .../wwwroot/lib/vue/dist/vue.esm-browser.js | 16095 ++++++++++++++++ .../lib/vue/dist/vue.esm-browser.prod.js | 1 + .../wwwroot/lib/vue/dist/vue.esm-bundler.js | 71 + .../wwwroot/lib/vue/dist/vue.global.js | 16081 +++++++++++++++ .../wwwroot/lib/vue/dist/vue.global.prod.js | 1 + .../lib/vue/dist/vue.runtime.esm-browser.js | 10966 +++++++++++ .../vue/dist/vue.runtime.esm-browser.prod.js | 1 + .../lib/vue/dist/vue.runtime.esm-bundler.js | 22 + .../lib/vue/dist/vue.runtime.global.js | 11100 +++++++++++ .../lib/vue/dist/vue.runtime.global.prod.js | 1 + EssentialCSharp.Web/wwwroot/lib/vue/index.js | 7 + EssentialCSharp.Web/wwwroot/lib/vue/index.mjs | 1 + .../wwwroot/lib/vue/macros-global.d.ts | 19 + .../wwwroot/lib/vue/macros.d.ts | 112 + .../wwwroot/lib/vue/package.json | 77 + .../wwwroot/lib/vue/ref-macros.d.ts | 2 + .../lib/vue/server-renderer/index.d.ts | 1 + .../wwwroot/lib/vue/server-renderer/index.js | 1 + .../wwwroot/lib/vue/server-renderer/index.mjs | 1 + .../lib/vue/server-renderer/package.json | 5 + 52 files changed, 58232 insertions(+), 6 deletions(-) create mode 100644 EssentialCSharp.Web/wwwroot/lib/docsearch/style.css create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/LICENSE create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/README.md create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/dist/es-module-shims.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/dist/es-module-shims.wasm.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/es-module-shims/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/LICENSE create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/README.md create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.cjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.cjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.cjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/LICENSE create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/README.md create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/compiler-sfc/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/compiler-sfc/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/compiler-sfc/index.mjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/compiler-sfc/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.cjs.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.cjs.prod.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.esm-browser.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.esm-browser.prod.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.esm-bundler.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.global.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.global.prod.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.runtime.esm-browser.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.runtime.esm-browser.prod.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.runtime.esm-bundler.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.runtime.global.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/dist/vue.runtime.global.prod.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/index.mjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/macros-global.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/macros.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/package.json create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/ref-macros.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/server-renderer/index.d.ts create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/server-renderer/index.js create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/server-renderer/index.mjs create mode 100644 EssentialCSharp.Web/wwwroot/lib/vue/server-renderer/package.json diff --git a/EssentialCSharp.Web/Views/Shared/_Layout.cshtml b/EssentialCSharp.Web/Views/Shared/_Layout.cshtml index 15cad478..040ab034 100644 --- a/EssentialCSharp.Web/Views/Shared/_Layout.cshtml +++ b/EssentialCSharp.Web/Views/Shared/_Layout.cshtml @@ -27,7 +27,7 @@ Essential C# - + @*Font Family*@ @@ -41,13 +41,13 @@ @*So that Safari can import modules*@ - + @@ -56,8 +56,8 @@ diff --git a/EssentialCSharp.Web/wwwroot/lib/docsearch/style.css b/EssentialCSharp.Web/wwwroot/lib/docsearch/style.css new file mode 100644 index 00000000..68aad247 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/docsearch/style.css @@ -0,0 +1,2 @@ +/*! @docsearch/css 3.3.3 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */ +:root{--docsearch-primary-color:#5468ff;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:rgba(101,108,133,0.8);--docsearch-logo-color:#5468ff;--docsearch-modal-width:560px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 hsla(0,0%,100%,0.5),0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px rgba(30,35,90,0.4);--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 rgba(69,98,155,0.12)}html[data-theme=dark]{--docsearch-text-color:#f5f6f7;--docsearch-container-background:rgba(9,10,17,0.8);--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 rgba(3,4,9,0.3);--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 rgba(73,76,106,0.5),0 -4px 8px 0 rgba(0,0,0,0.2);--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}.DocSearch-Button{align-items:center;background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;display:flex;font-weight:500;height:36px;justify-content:space-between;margin:0 0 0 16px;padding:0 8px;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:none}.DocSearch-Button-Container{align-items:center;display:flex}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;position:relative;padding:0 0 2px;border:0;top:-1px;width:20px}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder{display:none}}.DocSearch--active{overflow:hidden!important}.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.DocSearch-Container{background-color:var(--docsearch-container-background);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:200}.DocSearch-Container a{text-decoration:none}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;font:inherit;margin:0;padding:0}.DocSearch-Modal{background:var(--docsearch-modal-background);border-radius:6px;box-shadow:var(--docsearch-modal-shadow);flex-direction:column;margin:60px auto auto;max-width:var(--docsearch-modal-width);position:relative}.DocSearch-SearchBar{display:flex;padding:var(--docsearch-spacing) var(--docsearch-spacing) 0}.DocSearch-Form{align-items:center;background:var(--docsearch-searchbox-focus-background);border-radius:4px;box-shadow:var(--docsearch-searchbox-shadow);display:flex;height:var(--docsearch-searchbox-height);margin:0;padding:0 var(--docsearch-spacing);position:relative;width:100%}.DocSearch-Input{appearance:none;background:transparent;border:0;color:var(--docsearch-text-color);flex:1;font:inherit;font-size:1.2em;height:100%;outline:none;padding:0 0 0 8px;width:80%}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator{display:none}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{animation:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0;stroke-width:var(--docsearch-icon-stroke-width)}}.DocSearch-Reset{animation:fade-in .1s ease-in forwards;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;padding:2px;right:0;stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Cancel{display:none}.DocSearch-Dropdown{max-height:calc(var(--docsearch-modal-height) - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height));min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:overlay;padding:0 var(--docsearch-spacing);scrollbar-color:var(--docsearch-muted-color) var(--docsearch-modal-background);scrollbar-width:thin}.DocSearch-Dropdown::-webkit-scrollbar{width:12px}.DocSearch-Dropdown::-webkit-scrollbar-track{background:transparent}.DocSearch-Dropdown::-webkit-scrollbar-thumb{background-color:var(--docsearch-muted-color);border:3px solid var(--docsearch-modal-background);border-radius:20px}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Help{font-size:.9em;margin:0;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{color:var(--docsearch-muted-color);display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--deleting{transition:none}}.DocSearch-Hit--deleting{opacity:0;transition:all .25s linear}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--favoriting{transition:none}}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:all .25s linear;transition-delay:.25s}.DocSearch-Hit a{background:var(--docsearch-hit-background);border-radius:4px;box-shadow:var(--docsearch-hit-shadow);display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:var(--docsearch-modal-background);color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;stroke-width:var(--docsearch-icon-stroke-width);width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:var(--docsearch-highlight-color)}.DocSearch-Hit[aria-selected=true] mark{text-decoration:underline}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color);stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:background-color .1s ease-in}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{transition:none}}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:.9em}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] mark{color:var(--docsearch-hit-active-color)!important}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:none}}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:none;text-decoration:underline}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;box-shadow:var(--docsearch-footer-shadow);display:flex;flex-direction:row-reverse;flex-shrink:0;height:var(--docsearch-footer-height);justify-content:space-between;padding:0 var(--docsearch-spacing);position:relative;user-select:none;width:100%;z-index:300}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:2px;box-shadow:var(--docsearch-key-shadow);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;color:var(--docsearch-muted-color);border:0;width:20px}@media (max-width:768px){:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);position:absolute}.DocSearch-Footer{border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Dropdown{max-height:calc(var(--docsearch-vh, 1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Cancel{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:none;overflow:hidden;padding:0;user-select:none;white-space:nowrap}.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}}@keyframes fade-in{0%{opacity:0}to{opacity:1}} \ No newline at end of file diff --git a/EssentialCSharp.Web/wwwroot/lib/es-module-shims/LICENSE b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/LICENSE new file mode 100644 index 00000000..e67426b5 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/LICENSE @@ -0,0 +1,10 @@ +MIT License +----------- + +Copyright (C) 2018-2021 Guy Bedford + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/EssentialCSharp.Web/wwwroot/lib/es-module-shims/README.md b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/README.md new file mode 100644 index 00000000..44a59b15 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/README.md @@ -0,0 +1,909 @@ +# ES Module Shims + +Shims modern ES Modules features like import maps on top of the baseline modules support in browsers supported by [95% of users](https://caniuse.com/#feat=es6-module). + +When running in polyfill mode, [the 72% of users](https://caniuse.com/import-maps) with import maps entirely bypass the shim code entirely. + +For the remaining 28% of users, the highly performant (see [benchmarks](#benchmarks)) production and [CSP-compatible](#csp-support) shim kicks in to rewrite module specifiers driven by the [Web Assembly ES Module Lexer](https://github.com/guybedford/es-module-lexer). + +The following modules features are polyfilled: + +* [Import Maps](#import-maps) support. +* Dynamic `import()` shimming when necessary in eg older Firefox versions. +* `import.meta` and `import.meta.url`. +* [JSON](#json-modules) and [CSS modules](#css-modules) with import assertions (when enabled). +* [`` polyfill](#modulepreload) in non Chromium browsers for both shimmed and unshimmed preloading scenarios. + +When running in shim mode, module rewriting is applied for all users and custom [resolve](#resolve-hook) and [fetch](#fetch-hook) hooks can be implemented allowing for custom resolution and streaming in-browser transform workflows. + +Because we are still using the native module loader the edge cases work out comprehensively, including: + +* Live bindings in ES modules +* Dynamic import expressions (`import('src/' + varname')`) +* Circular references, with the execption that live bindings are disabled for the first unexecuted circular parent. + +> [Built with](https://github.com/guybedford/es-module-shims/blob/main/chompfile.toml) [Chomp](https://chompbuild.com/) + +## Usage + +Include ES Module Shims with a `async` attribute on the script, then include an import map and module scripts normally: + +```html + + + + + + +``` + +## Polyfill Explainer + +When running the previous example in a browser without import maps support, the browser will output the following console error: + +``` +Uncaught TypeError: Failed to resolve module specifier "react". Relative references must start with either "/", "./", or "../". + at :1:15 +``` + +This error is important - it means that the native browser loader didn't execute any of the code at all because this error happens +at link time, and before execution time. And this is what allows the polyfill to be able to reexecute the modules and their dependencies +without risk of duplicate execution. + +The ES Module Shims polyfill will analyze the browser to see if it supports import maps. If it does, it doesn't do anything more, +otherwise it will analyze all module scripts on the page to see if any of them have bare specifier imports that will fail like this. +If one is found, it will then be reexecuted through ES Module Shims using its internal shimming of modules features. + +When the polyfill kicks in another console log message is output(which can be disabled or customized via the [polyfill hook](#polyfill-hook)): + +``` +^^ Module TypeError above is polyfilled and can be ignored ^^ +``` + +### Polyfill Edge Case: Dynamic Import + +Only static link-time errors are polyfilled, not runtime errors. + +Module feature errors that are not _static errors_ but rather _runtime errors_ will bypass the polyfill detection. + +For example: + +```html + +``` + +In the above, the native browser loader without import maps support will execute the above module, but fail the dynamic import. + +See the log output in various scenarios: + +* Native with Import Maps: `Static Ok`, `Dynamic Ok` +* Native without Import Maps: `Static Ok`, `Dynamic Fail` +* Native without Import Maps running ES Module Shims: `Static Ok`, `Dynamic Fail` + +ES Module Shims **does not polyfill the dynamic import**. The reason for this is that if it did, it would need to reexecute the entire outer module resulting in `Static Ok`, `Dynamic Fail`, `Static Ok`, `Dynamic Ok`. This _double execution_ would be a change of the normal execution in running code twice that would not be deemed suitable for calling it a polyfill. + +This is why it is advisable to always ensure modules use a bare specifier early to avoid non-execution. + +If a static failure is not possible and dynamic import must be used, one alternative is to use the `importShim` ES Module Shims top-level loader: + +```html + +``` + +`importShim` will automatically pass-through to the native dynamic import or polyfill as necessary, just like it does for script tags. + +### Polyfill Edge Case: Instance Sharing + +When running in polyfill mode, it can be thought of that are effectively two loaders running on the page - the ES Module Shims polyfill loader, and the native loader. + +Note that instances are not shared between these loaders for consistency and performance, since some browsers do not properly share the fetch cache and native loader cache resulting in a double fetch which would be inefficient. + +As a result, if you have two module graphs - one native and one polyfilled, they will not share the same dependency instance, for example: + +```html + + + +``` + +```dep +console.log('DEP'); +``` + +When polyfilling import maps, ES Module Shims will pick up on the second import failure and reexecute `/dep.js` as a new instance, logging `"DEP"` twice. + +For this reason it is important to always ensure all modules hit the polyfill path, either by having all graphs use import maps at the top-level, or via `importShim` directly. + +If you really need to support instance sharing with the native loader, a useful workaround is to use the [`skip` option](#skip) to list modules which should always be loaded via the native loader: + +```html + +``` + +The above would then fully cause dependency module instance to be shared between ES Module Shims and the native loader, with the polyfill then logging `"DEP"` only once. + +#### No Shim Scripts + +If the polyfill is analyzing or applying to a module script that doesn't need to or shouldn't be polyfilled, adding the `"noshim"` attribute to the script tag will ensure that ES Module Shims ignores processing this script entirely: + +```html + +``` + + +### Polyfill Features + +If using more modern features like CSS Modules or JSON Modules, these need to be manually enabled via the [`polyfillEnable` init option](#polyfill-enable-option) to raise the native baseline from just checking import maps to also checking that browsers support these features: + +```html + +``` + +To verify when the polyfill is actively engaging as opposed to relying on the native loader, [a `polyfill` hook](#polyfill-hook) is also provided. + +## Shim Mode + +Shim mode is an alternative to polyfill mode and doesn't rely on native modules erroring - instead it is triggered by the existence of any ` + +``` + +All modules are still loaded with the native browser module loader, but with their specifiers rewritten then executed as Blob URLs, so there is a relatively minimal overhead to using a polyfill approach like this. + +#### Multiple Import Maps + +Multiple import maps are not currently supported in any native implementation, Chromium support is currently being tracked in https://bugs.chromium.org/p/chromium/issues/detail?id=927119. + +In polyfill mode, multiple import maps are therefore not supported. + +In shim mode, support for multiple `importmap-shim` scripts follows the [import map extensions](https://github.com/guybedford/import-maps-extensions) proposal. + +#### External Import Maps + +External import maps (using a `"src"` attribute) are not currently supported in any native implementation. + +In polyfill mode, external import maps are therefore not supported. + +In shim mode, external import maps are fully supported. + +#### Dynamic Import Maps + +Support for dynamically injecting import maps with JavaScript via eg: + +```js +document.body.appendChild(Object.assign(document.createElement('script'), { + type: 'importmap', + innerHTML: JSON.stringify({ imports: { x: './y.js' } }), +})); +``` + +is supported in Chromium, provided it is injected before any module loads and there is no other import map yet loaded (multiple import maps are not supported). + +Both modes in ES Module Shims support dynamic injection using DOM Mutation Observers. + +While in polyfill mode the same restrictions apply that multiple import maps, import maps with a `src` attribute, and import maps loaded after the first module load are not supported, in shim mode all of these behaviours are fully enabled for `"importmap-shim"`. + +#### Reading current import map state + +To make it easy to keep track of import map state, es-module-shims provides a `importShim.getImportMap` utility function, available only in shim mode. + +```js +const importMap = importShim.getImportMap(); + +// importMap will be an object in the same shape as the json in a importmap script +``` + +#### Setting current import map state +To make it easy to set the import map state, es-module-shims provides a `importShim.addImportMap` utility function, available only in shim mode. + +```js +// importMap will be an object in the same shape as the json in a importmap script +const importMap = { imports: {/*...*/}, scopes: {/*...*/} }; + +importShim.addImportMap(importMap); +``` + + +### Dynamic Import + +> Stability: Stable browser standard + +Dynamic `import(...)` within any modules loaded will be rewritten as `importShim(...)` automatically +providing full support for all es-module-shims features through dynamic import. + +To load code dynamically (say from the browser console), `importShim` can be called similarly: + +```js +importShim('/path/to/module.js').then(x => console.log(x)); +``` + +### import.meta.url + +> Stability: Stable browser standard + +`import.meta.url` provides the full URL of the current module within the context of the module execution. + +### modulepreload + +> Stability: WhatWG Standard, Single Browser Implementer + +Preloading of modules can be achieved by including a `` tag in the HTML or injecting it dynamically. + +This tag also supports the `"integrity"`, `"crossorigin"` and `"referrerpolicy"` attributes as supported on module scripts. + +This tag just initiates a fetch request in the browser and thus works equally as a preload polyfill in both shimmed and unshimmed modes, with integrity validation support. + +Unlike the browser specification, the modulepreload polyfill does not request dependency modules by default, in order to avoid unnecessary +code analysis in the polyfill scenarios. **It is recommended to preload deep imports anyway so that this feature shouldn't be necessary.** + +#### Preload shim + +When in shim mode, `` must be used to properly cache the preloaded modules. + +### CSP Support + +By default ES Module Shims provides full support for CSP by using the asm.js ES Module Lexer build. This is absolutely identical in performance to the Wasm version in Firefox and Chrome, while in Safari the asm.js version is actually faster than Wasm making this build preferable. + +The CSP nonce to use for module scripts will be picked up from the first script on the page or via the [`nonce` init option](#nonce). + +A full example of such a CSP workflow is provided below: + +```html + + + + +``` + +#### Wasm Build + +To use the Web Assembly / non-CSP build of ES Module Shims, this is available as a self-contained single file at `es-module-shims/wasm` or `es-module-shims/dist/es-module-shims.wasm.js` in the package folder. + +### JSON Modules + +> Stability: WhatWG Standard, Single Browser Implementer + +In shim mode, JSON modules are always supported. In polyfill mode, JSON modules require the `polyfillEnable: ['json-modules']` [init option](#polyfill-enable-option). + +JSON Modules are currently supported in Chrome when using them via an import assertion: + +```html + +``` + +In addition JSON modules need to be served with a valid JSON content type. + +Checks for assertion failures are not currently included. + +### CSS Modules + +> Stability: WhatWG Standard, Single Browser Implementer + +In shim mode, CSS modules are always supported. In polyfill mode, CSS modules require the `polyfillEnable: ['css-modules']` [init option](#polyfill-enable-option). + +CSS Modules are currently supported in Chrome when using them via an import assertion: + +```html + +``` + +To support the polyfill or shim of this feature, the [Constructable Stylesheets polyfill](https://github.com/calebdwilliams/construct-style-sheets#readme) must be separately included in browsers not supporting [Constructable Stylesheets](https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/CSSStyleSheet) eg via: + +```html + +``` + +For more information see the [web.dev article](https://web.dev/css-module-scripts/). + +In addition CSS modules need to be served with a valid CSS content type. + +Checks for assertion failures are not currently included. + +### Resolve + +> Stability: Draft HTML PR + +`import.meta.resolve` provides a contextual resolver within modules. It is synchronous, changed from being formerly asynchronous due to following the [browser specification PR](https://github.com/whatwg/html/pull/5572). + +The second argument to `import.meta.resolve` permits a custom parent URL scope for the resolution (not currently in the browser spec), which defaults to `import.meta.url`. + +```js +// resolve a relative path to a module +var resolvedUrl = import.meta.resolve('./relative.js'); +// resolve a dependency from a module +var resolvedUrl = import.meta.resolve('dep'); +// resolve a path +var resolvedUrlPath = import.meta.resolve('dep/'); +// resolve with a custom parent scope +var resolvedUrl = import.meta.resolve('dep', 'https://site.com/another/scope'); +``` + +Node.js also implements a similar API, although it's in the process of shifting to a synchronous resolver. + +### Module Workers + +ES Module Shims can be used in module workers in browsers that provide dynamic import in worker environments, which at the moment are Chrome(80+), Edge(80+) and Safari(15+). + +By default, when there is no DOM present, ES Module Shims will switch into shim mode. An example of ES Module Shims usage through shim mode in web workers is provided below: + +```js +/** + * + * @param {string} aURL a string representing the URL of the module script the worker will execute. + * @returns {string} The string representing the URL of the script the worker will execute. + */ +function getWorkerScriptURL(aURL) { + // baseURL, esModuleShimsURL are considered to be known in advance + // esModuleShimsURL - must point to the non-CSP build of ES Module Shims, + // namely the `es-module-shim.wasm.js` output: es-module-shims/dist/es-module-shims.wasm.js + + return URL.createObjectURL(new Blob( + [ + `importScripts('${new URL(esModuleShimsURL, baseURL).href}'); + importShim.addImportMap(${JSON.stringify(importShim.getImportMap())}); + importShim('${new URL(aURL, baseURL).href}').catch(e => setTimeout(() => { throw e; }))` + ], + { type: 'application/javascript' })) +} + +const worker = new Worker(getWorkerScriptURL('myEsModule.js')); +``` + +> Web workers must use the non-CSP build of ES Module Shims via `es-module-shim.wasm.js` from the `dist/` folder, since the CSP build currently assumes a DOM. + +## Init Options + +Provide a `esmsInitOptions` on the global scope before `es-module-shims` is loaded to configure various aspects of the module loading process: + +* [shimMode](#shim-mode-option) +* [polyfillEnable](#polyfill-enable-option) +* [enforceIntegrity](#enforce-integrity) +* [nonce](#nonce) +* [noLoadEventRetriggers](#no-load-event-retriggers) +* [skip](#skip) +* [onerror](#error-hook) +* [onpolyfill](#polyfill-hook) +* [resolve](#resolve-hook) +* [fetch](#fetch-hook) +* [revokeBlobURLs](#revoke-blob-urls) +* [mapOverrides](#overriding-import-map-entries) + +```html + + +``` + +` +``` + +This can be convenient when using a CSP policy. Function strings correspond to global function names. + +### Shim Mode Option + +[Shim Mode](#shim-mode) can be overridden using the `shimMode` option: + +```html + +``` + +For example, if lazy loading ` +``` + +The above is necessary to enable CSS modules and JSON modules. + +#### Baseline Support Analysis Opt-Out + +The reason the `polyfillEnable` option is needed is because ES Module Shims implements a performance optimization where if a browser supports modern modules features to an expected baseline of import maps support, it will skip all polyfill source analysis resulting in full native passthrough performance. + +If the application code then tries to use modern features like CSS modules beyond this baseline it won't support those features. As a result all modules features which are considered newer or beyond the recommended baseline require explicit enabling. This common baseline itself will change to track the common future modules baseline supported by this project for each release cycle. + +This option can also be set to `true` to entirely disable the native passthrough system and ensure all sources are fetched and analyzed through ES Module Shims. This will still avoid duplicate execution since module graphs are still only reexecuted when they use unsupported native features, but there is a small extra cost in doing the analysis. + +### Enforce Integrity + +When enabled, `enforceIntegrity` will ensure that all modules loaded through ES Module Shims must have integrity defined either on a `` or on +a `` preload tag in shim mode. Modules without integrity will throw at fetch time. + +For example in the following, only the listed `app.js` and `dep.js` modules will be able to execute with the provided integrity: + +```html + +\ + + +``` + +Strong execution guarantees are only possible in shim mode since in polyfill mode it is not possible to stop the native loader from executing code without an integrity. + +Future versions of this option may provide support for origin-specific allow lists. + +### Nonce + +The `nonce` option allows setting a CSP nonce to be used with all script injections for full CSP compatibility supported by the [CSP build](#csp-build) of ES Module Shims. + +Alternatively, add a `blob:` URL policy with the CSP build to get CSP compatibility. + +```js + +``` + +### No Load Event Retriggers + +Because of the extra processing done by ES Module Shims it is possible for static module scripts to execute after the `DOMContentLoaded` or `readystatechange` events they expect, which can cause missed attachment. + +In order to ensure libraries that rely on these event still behave correctly, ES Module Shims will always double trigger these events that would normally have executed before the document ready state transition to completion, once all the static module scripts in the page have been completely executed through ES module shims. + +In such a case, this double event firing can be disabled with the `noLoadEventRetriggers` option: + +```js + + +``` + +### Skip + +When loading modules that you know will only use baseline modules features, it is possible to set a rule to explicitly opt-out modules from being polyfilled to always load and be referenced through the native loader only. This enables instance sharing with the native loader and also improves performance because those modules then do not need to be processed or transformed at all, so that only local application code is handled and not library code. + +The `skip` option supports a string regular expression or array of exact module URLs to check: + +```js + + +``` + +When passing an array, relative URLs or paths ending in `/` can be provided: + +```js + + +``` + +### Revoke Blob URLs + +When polyfilling the missing features `es-module-shims` would create in-memory blobs using `URL.createObjectURL()` for each processed module. +In most cases, memory footprint of these blobs is negligible so there is no need to call `URL.revokeObjectURL()` +for them, and we don't do that by default. + +That said, in some scenarios, e.g. when evaluating some continuously changing modules without a page reload, like in a web-based code editor, +you might want to reduce the growth of memory usage by revoking those blob URLs after they were already `import`ed. + +You can do that by enabling the `revokeBlobURLs` init option: + +```js + + +``` + +NOTE: revoking object URLs is not entirely free, while we are trying to be smart about it and make sure it doesn't +cause janks, we recommend enabling this option only if you have done the measurements and identified that you really need it. + +### Overriding import map entries + +When [dynamically injecting import maps](#dynamic-import-maps), an error will be thrown in both polyfill and shim modes if the new import map would override existing entries with a different value. + +It is possible to disable this behavior in shim mode by setting the `mapOverrides` option: + +```js + + + +``` + +This can be useful for HMR workflows. + +### Hooks + +#### Polyfill hook + +The polyfill hook is called when running in polyfill mode and the polyfill is kicking in instead of passing through to the native loader. + +This can be a useful way to verify that the native passthrough is working correctly in latest browsers for performance, while also allowing eg the ability to analyze or get metrics reports of how many users are getting the polyfill actively applying to their browser application loads. + +```js + + +``` + +The default hook will log a message to the console with `console.info` noting that polyfill mode is enabled and that the native error can be ignored. + +Overriding this hook with an empty function will disable the default polyfill log output. + +In the above, running in latest Chromium browsers, nothing will be logged, while running in an older browser that does not support newer features like import maps the console log will be output. + +#### Error hook + +You can provide a function to handle errors during the module loading process by providing an `onerror` option: + +```js + + +``` + +#### Import Hook + +The import hook is supported for both shim and polyfill modes and provides an async hook which can ensure any necessary work is done before a top-level module import or dynamic `import()` starts further processing. + +```js + +``` + +#### Resolve Hook + +The resolve hook is supported for both shim and polyfill modes and allows full customization of the resolver, while still having access to the original resolve function. + +Note that in polyfill mode the resolve hook may not be called for all modules when native passthrough is occurring and that it still will not affect +the native passthrough executions. + +If the resolve hook should apply for all modules in the entire module graph, make sure to set `polyfillEnable: true` to [disable the baseline support analysis opt-out](#baseline-support-analysis-opt-out). + +```js + +``` + +Support for an asynchronous resolve hook has been deprecated as of 1.5.0 and will be removed in the next major. + +Instead async work should be done with the import hook. + +#### Meta Hook + +The meta hook allows customizing the `import.meta` object in each module scope. + +The function takes as arguments the `import.meta` object itself (with `import.meta.url` an `import.meta.resolve` already present), and the URL of the module as its second argument. + +Example: + +```js + +``` + +Where within the module the following would be supported: + +```js +import assert from 'assert'; +assert.ok(import.meta.custom.startsWith('custom value')); +``` + +#### Fetch Hook + +The fetch hook is supported for shim mode only. + +The ES Module Shims fetch hook can be used to implement transform plugins. + +For example TypeScript support: + +```js + + +``` + +Because the dependency analysis applies by ES Module Shims takes care of ensuring all dependencies run through the same fetch hook, +the above is all that is needed to implement custom plugins. + +Streaming support is also provided, for example here is a hook with streaming support for JSON: + +```js +window.esmsInitOptions = { + shimMode: true, + fetch: async function (url, options) { + const res = await fetch(url, options); + if (!res.ok || !/^application\/json($|;)/.test(res.headers.get('content-type'))) + return res; + const reader = res.body.getReader(); + const headers = new Headers(res.headers); + headers.set('Content-Type', 'application/javascript'); + return new Response(new ReadableStream({ + async start (controller) { + let done, value; + controller.enqueue(new TextEncoder().encode('export default ')); + while (({ done, value } = await reader.read()) && !done) { + controller.enqueue(value); + } + controller.close(); + } + }), { headers }); + } +} +``` + +## Implementation Details + +### Import Rewriting + +* Sources are fetched, import specifiers are rewritten to reference exact URLs, and then executed as BlobURLs through the whole module graph. +* The [lexer](https://github.com/guybedford/es-module-lexer) handles the full language grammar including nested template strings, comments, regexes and division operator ambiguity based on backtracking. +* When executing a circular reference A -> B -> A, a shell module technique is used to acyclify into the graph A -> B -> A Shell, with A -> A Shell. The shell module exports an update function which is called by the original once after the last import statement, and again after the last statement of the source file. + +## Inspiration + +Huge thanks to Rich Harris for inspiring this approach with [Shimport](https://github.com/rich-harris/shimport). + +## License + +MIT diff --git a/EssentialCSharp.Web/wwwroot/lib/es-module-shims/dist/es-module-shims.js b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/dist/es-module-shims.js new file mode 100644 index 00000000..1a8dd9e3 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/es-module-shims/dist/es-module-shims.js @@ -0,0 +1,898 @@ +/* ES Module Shims 1.6.3 */ +(function () { + + const hasWindow = typeof window !== 'undefined'; + const hasDocument = typeof document !== 'undefined'; + + const noop = () => {}; + + const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined; + + const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {}; + Object.assign(esmsInitOptions, self.esmsInitOptions || {}); + + let shimMode = hasDocument ? !!esmsInitOptions.shimMode : true; + + const importHook = globalHook(shimMode && esmsInitOptions.onimport); + const resolveHook = globalHook(shimMode && esmsInitOptions.resolve); + let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch; + const metaHook = esmsInitOptions.meta ? globalHook(shimMode && esmsInitOptions.meta) : noop; + + const mapOverrides = esmsInitOptions.mapOverrides; + + let nonce = esmsInitOptions.nonce; + if (!nonce && hasDocument) { + const nonceElement = document.querySelector('script[nonce]'); + if (nonceElement) + nonce = nonceElement.nonce || nonceElement.getAttribute('nonce'); + } + + const onerror = globalHook(esmsInitOptions.onerror || noop); + const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => { + console.log('%c^^ Module TypeError above is polyfilled and can be ignored ^^', 'font-weight:900;color:#391'); + }; + + const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions; + + function globalHook (name) { + return typeof name === 'string' ? self[name] : name; + } + + const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : []; + const cssModulesEnabled = enable.includes('css-modules'); + const jsonModulesEnabled = enable.includes('json-modules'); + + const edge = !navigator.userAgentData && !!navigator.userAgent.match(/Edge\/\d+\.\d+/); + + const baseUrl = hasDocument + ? document.baseURI + : `${location.protocol}//${location.host}${location.pathname.includes('/') + ? location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1) + : location.pathname}`; + + const createBlob = (source, type = 'text/javascript') => URL.createObjectURL(new Blob([source], { type })); + let { skip } = esmsInitOptions; + if (Array.isArray(skip)) { + const l = skip.map(s => new URL(s, baseUrl).href); + skip = s => l.some(i => i[i.length - 1] === '/' && s.startsWith(i) || s === i); + } + else if (typeof skip === 'string') { + const r = new RegExp(skip); + skip = s => r.test(s); + } + + const eoop = err => setTimeout(() => { throw err }); + + const throwError = err => { (self.reportError || hasWindow && window.safari && console.error || eoop)(err), void onerror(err); }; + + function fromParent (parent) { + return parent ? ` imported from ${parent}` : ''; + } + + let importMapSrcOrLazy = false; + + function setImportMapSrcOrLazy () { + importMapSrcOrLazy = true; + } + + // shim mode is determined on initialization, no late shim mode + if (!shimMode) { + if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) { + shimMode = true; + } + else { + let seenScript = false; + for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) { + if (!seenScript) { + if (script.type === 'module' && !script.ep) + seenScript = true; + } + else if (script.type === 'importmap' && seenScript) { + importMapSrcOrLazy = true; + break; + } + } + } + } + + const backslashRegEx = /\\/g; + + function isURL (url) { + if (url.indexOf(':') === -1) return false; + try { + new URL(url); + return true; + } + catch (_) { + return false; + } + } + + function resolveUrl (relUrl, parentUrl) { + return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl)); + } + + function resolveIfNotPlainOrUrl (relUrl, parentUrl) { + const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?'); + if (hIdx + qIdx > -2) + parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx); + if (relUrl.indexOf('\\') !== -1) + relUrl = relUrl.replace(backslashRegEx, '/'); + // protocol-relative + if (relUrl[0] === '/' && relUrl[1] === '/') { + return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl; + } + // relative-url + else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) || + relUrl.length === 1 && (relUrl += '/')) || + relUrl[0] === '/') { + const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1); + // Disabled, but these cases will give inconsistent results for deep backtracking + //if (parentUrl[parentProtocol.length] !== '/') + // throw new Error('Cannot resolve'); + // read pathname from parent URL + // pathname taken to be part after leading "/" + let pathname; + if (parentUrl[parentProtocol.length + 1] === '/') { + // resolving to a :// so we need to read out the auth and host + if (parentProtocol !== 'file:') { + pathname = parentUrl.slice(parentProtocol.length + 2); + pathname = pathname.slice(pathname.indexOf('/') + 1); + } + else { + pathname = parentUrl.slice(8); + } + } + else { + // resolving to :/ so pathname is the /... part + pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/')); + } + + if (relUrl[0] === '/') + return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl; + + // join together and split for removal of .. and . segments + // looping the string instead of anything fancy for perf reasons + // '../../../../../z' resolved to 'x/y' is just 'z' + const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl; + + const output = []; + let segmentIndex = -1; + for (let i = 0; i < segmented.length; i++) { + // busy reading a segment - only terminate on '/' + if (segmentIndex !== -1) { + if (segmented[i] === '/') { + output.push(segmented.slice(segmentIndex, i + 1)); + segmentIndex = -1; + } + continue; + } + // new segment - check if it is relative + else if (segmented[i] === '.') { + // ../ segment + if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) { + output.pop(); + i += 2; + continue; + } + // ./ segment + else if (segmented[i + 1] === '/' || i + 1 === segmented.length) { + i += 1; + continue; + } + } + // it is the start of a new segment + while (segmented[i] === '/') i++; + segmentIndex = i; + } + // finish reading out the last segment + if (segmentIndex !== -1) + output.push(segmented.slice(segmentIndex)); + return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join(''); + } + } + + function resolveAndComposeImportMap (json, baseUrl, parentMap) { + const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) }; + + if (json.imports) + resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap); + + if (json.scopes) + for (let s in json.scopes) { + const resolvedScope = resolveUrl(s, baseUrl); + resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap); + } + + return outMap; + } + + function getMatch (path, matchObj) { + if (matchObj[path]) + return path; + let sepIndex = path.length; + do { + const segment = path.slice(0, sepIndex + 1); + if (segment in matchObj) + return segment; + } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1) + } + + function applyPackages (id, packages) { + const pkgName = getMatch(id, packages); + if (pkgName) { + const pkg = packages[pkgName]; + if (pkg === null) return; + return pkg + id.slice(pkgName.length); + } + } + + + function resolveImportMap (importMap, resolvedOrPlain, parentUrl) { + let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes); + while (scopeUrl) { + const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]); + if (packageResolution) + return packageResolution; + scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes); + } + return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain; + } + + function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) { + for (let p in packages) { + const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p; + if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) { + throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`); + } + let target = packages[p]; + if (typeof target !== 'string') + continue; + const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl); + if (mapped) { + outPackages[resolvedLhs] = mapped; + continue; + } + console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`); + } + } + + let dynamicImport = !hasDocument && (0, eval)('u=>import(u)'); + + let supportsDynamicImport; + + const dynamicImportCheck = hasDocument && new Promise(resolve => { + const s = Object.assign(document.createElement('script'), { + src: createBlob('self._d=u=>import(u)'), + ep: true + }); + s.setAttribute('nonce', nonce); + s.addEventListener('load', () => { + if (!(supportsDynamicImport = !!(dynamicImport = self._d))) { + let err; + window.addEventListener('error', _err => err = _err); + dynamicImport = (url, opts) => new Promise((resolve, reject) => { + const s = Object.assign(document.createElement('script'), { + type: 'module', + src: createBlob(`import*as m from'${url}';self._esmsi=m`) + }); + err = undefined; + s.ep = true; + if (nonce) + s.setAttribute('nonce', nonce); + // Safari is unique in supporting module script error events + s.addEventListener('error', cb); + s.addEventListener('load', cb); + function cb (_err) { + document.head.removeChild(s); + if (self._esmsi) { + resolve(self._esmsi, baseUrl); + self._esmsi = undefined; + } + else { + reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading ${opts && opts.errUrl || url} (${s.src}).`)); + err = undefined; + } + } + document.head.appendChild(s); + }); + } + document.head.removeChild(s); + delete self._d; + resolve(); + }); + document.head.appendChild(s); + }); + + // support browsers without dynamic import support (eg Firefox 6x) + let supportsJsonAssertions = false; + let supportsCssAssertions = false; + + let supportsImportMaps = hasDocument && HTMLScriptElement.supports ? HTMLScriptElement.supports('importmap') : false; + let supportsImportMeta = supportsImportMaps; + + const importMetaCheck = 'import.meta'; + const cssModulesCheck = `import"x"assert{type:"css"}`; + const jsonModulesCheck = `import"x"assert{type:"json"}`; + + const featureDetectionPromise = Promise.resolve(dynamicImportCheck).then(() => { + if (!supportsDynamicImport || supportsImportMaps && !cssModulesEnabled && !jsonModulesEnabled) + return; + + if (!hasDocument) + return Promise.all([ + supportsImportMaps || dynamicImport(createBlob(importMetaCheck)).then(() => supportsImportMeta = true, noop), + cssModulesEnabled && dynamicImport(createBlob(cssModulesCheck.replace('x', createBlob('', 'text/css')))).then(() => supportsCssAssertions = true, noop), + jsonModulesEnabled && dynamicImport(createBlob(jsonModulescheck.replace('x', createBlob('{}', 'text/json')))).then(() => supportsJsonAssertions = true, noop), + ]); + + return new Promise(resolve => { + const iframe = document.createElement('iframe'); + iframe.style.display = 'none'; + iframe.setAttribute('nonce', nonce); + function cb ({ data: [a, b, c, d] }) { + supportsImportMaps = a; + supportsImportMeta = b; + supportsCssAssertions = c; + supportsJsonAssertions = d; + resolve(); + document.head.removeChild(iframe); + window.removeEventListener('message', cb, false); + } + window.addEventListener('message', cb, false); + + const importMapTest = ` + + +``` + +> note: useWindowSize handles a Resize Event only when it is in use. +> Even if it is called by multiple components, the Resize event is processed only once. +> If it is not used, it will not be handled. + +### Plugin + +Install plugin + +```TypeScript +import { createApp } from 'vue'; +import App from "./App.vue"; // your App component +import { VueWindowSizePlugin } from 'vue-window-size/plugin'; + +const app = createApp(App); +app.use(VueWindowSizePlugin); +``` + +Use with component + +```HTML + +``` + +### Mixin + +Use with component + +```TypeScript + + + +``` + +## Config for Option API + +### `delay` (option) + +- type: `Number` +- default: `33` + - About 30 FPS + +Change delay time of resize event. + +e.g. + +```TypeScript +import { createApp } from 'vue'; +import App from "./App.vue"; // your App component +import { VueWindowSizePlugin } from 'vue-window-size/plugin'; + +const app = createApp(App); +app.use(VueWindowSizePlugin, { + delay: 100, +}); +``` + +## Public API for Option API + +### `config(config: VueWindowSizeOptionApiConfig)` + +Same as config for Option API. + +```TypeScript +import { vueWindowSizeAPI } from 'vue-window-size/plugin'; // or 'vue-window-size/mixin' + +vueWindowSizeAPI.config({ + delay: 100, +}); +``` + +### `init()` + +Initialize the plugin. +Usually called automatically. +Please call it if you want to use it again after destroy. + +```JavaScript +import { vueWindowSizeAPI } from 'vue-window-size/plugin'; // or 'vue-window-size/mixin' + +vueWindowSizeAPI.init(); +``` + +### `destroy()` + +Remove the resize event. + +```JavaScript +import { vueWindowSizeAPI } from'vue-window-size/plugin'; // or 'vue-window-size/mixin' + +vueWindowSizeAPI.destroy(); +``` + +## FAQ + +### Why is there no Config in the Composition API? + +`useWindowSize` is a singleton and handles the resize event. +Therefore, using `useWindowSize(config)` will affect all components in used. +Due to the nature of the Composition API, this is not the desired behavior. +I also think that there are not many use cases that need to be set individually. +If requested, I will create a `useAtomicWindowSize(config)` that can be set atomically, so please create an issue. +Or create a factory function for `createUseWindowSize(config)`. + +### When is the removeEventListener called when using plugin and mixin?? + +vue-window-size adds addEventListener only once, even if it is used in mixin. +So basically you do not need to call removeEventListener. +If you want to call removeEventListener please call [destroy](#destroy) method. + +## Contribution + +If you find a bug or want to contribute to the code or documentation, you can help by submitting an [issue](https://github.com/mya-ake/vue-window-size/issues) or a [pull request](https://github.com/mya-ake/vue-window-size/pulls). + +## License + +[MIT](https://github.com/mya-ake/vue-window-size/blob/master/LICENSE) diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.cjs b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.cjs new file mode 100644 index 00000000..0801e062 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var d=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var i in e)d(t,i,{get:e[i],enumerable:!0})},W=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of S(e))!l.call(t,s)&&s!==i&&d(t,s,{get:()=>e[s],enumerable:!(r=z(e,s))||r.enumerable});return t};var O=t=>W(d({},"__esModule",{value:!0}),t);var x={};f(x,{useWindowSize:()=>E});module.exports=O(x);var n=require("vue");var u=typeof window<"u",y=()=>u?window.innerWidth:0,g=()=>u?window.innerHeight:0,j=t=>t??y(),R=t=>t??g(),b=t=>({width:j(t?.width),height:R(t?.height)});var c=t=>{let e=0,i=t(),r=(0,n.reactive)(b()),s=({width:p,height:m})=>{r.width=p,r.height=m};i.addObserver("composition-api",s);let w=()=>{++e},v=()=>{e=Math.max(e-1,0)};return()=>(e===0&&i.subscribe().dispatch(),w(),(0,n.onUnmounted)(()=>{v(),e===0&&i.unsubscribe()}),{width:(0,n.computed)(()=>r.width),height:(0,n.computed)(()=>r.height)})};var o=class{#e=new Map;#r;#s;#t=!1;#i;constructor(e){let{delay:i=33}=e??{};this.#r=i,this.#i=this.#d.bind(this)}addObserver(e,i){return this.#e.set(e,i),i(this.#n()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(i=>{i(e)}),this}subscribe(){return typeof window>"u"?this:this.#t?this:(window.addEventListener("resize",this.#i),window.addEventListener("orientationchange",this.#i),this.#t=!0,this)}unsubscribe(){return this.#t?(window.removeEventListener("resize",this.#i),window.removeEventListener("orientationchange",this.#i),this.#t=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#t,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#n(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#n();this.notifyObservers(e)}#d(){clearTimeout(this.#s),window.setTimeout(()=>{},1),this.#s=window.setTimeout(()=>{this.#o()},this.#r)}};var h,a=()=>(h||(h=new o),h);var E=c(a);0&&(module.exports={useWindowSize}); diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.d.ts b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.d.ts new file mode 100644 index 00000000..93020774 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.d.ts @@ -0,0 +1,8 @@ +import * as vue from 'vue'; + +declare const useWindowSize: () => { + width: vue.ComputedRef; + height: vue.ComputedRef; +}; + +export { useWindowSize }; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.js b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.js new file mode 100644 index 00000000..c79b0e17 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/dist/index.js @@ -0,0 +1 @@ +import{reactive as f,computed as h,onUnmounted as W}from"vue";var o=typeof window<"u",m=()=>o?window.innerWidth:0,z=()=>o?window.innerHeight:0,S=i=>i??m(),l=i=>i??z(),d=i=>({width:S(i?.width),height:l(i?.height)});var u=i=>{let e=0,t=i(),r=f(d()),c=({width:v,height:p})=>{r.width=v,r.height=p};t.addObserver("composition-api",c);let a=()=>{++e},w=()=>{e=Math.max(e-1,0)};return()=>(e===0&&t.subscribe().dispatch(),a(),W(()=>{w(),e===0&&t.unsubscribe()}),{width:h(()=>r.width),height:h(()=>r.height)})};var s=class{#e=new Map;#r;#s;#t=!1;#i;constructor(e){let{delay:t=33}=e??{};this.#r=t,this.#i=this.#d.bind(this)}addObserver(e,t){return this.#e.set(e,t),t(this.#n()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(t=>{t(e)}),this}subscribe(){return typeof window>"u"?this:this.#t?this:(window.addEventListener("resize",this.#i),window.addEventListener("orientationchange",this.#i),this.#t=!0,this)}unsubscribe(){return this.#t?(window.removeEventListener("resize",this.#i),window.removeEventListener("orientationchange",this.#i),this.#t=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#t,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#n(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#n();this.notifyObservers(e)}#d(){clearTimeout(this.#s),window.setTimeout(()=>{},1),this.#s=window.setTimeout(()=>{this.#o()},this.#r)}};var n,b=()=>(n||(n=new s),n);var N=u(b);export{N as useWindowSize}; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/package.json b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/package.json new file mode 100644 index 00000000..58aaa06c --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/composition-api/package.json @@ -0,0 +1,31 @@ +{ + "name": "vue-window-size-composition-api", + "version": "1.0.0", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "packageManager": "yarn@3.3.1", + "scripts": { + "build": "tsup", + "test:unit": "vitest --dir src --run", + "test:integration": "vitest --dir tests --run" + }, + "devDependencies": { + "@types/node": "^18.11.18", + "@vitejs/plugin-vue": "^4.0.0", + "@vue/compiler-dom": "^3.2.45", + "@vue/runtime-core": "^3.2.45", + "@vue/test-utils": "^2.2.7", + "happy-dom": "^8.1.4", + "tsup": "^6.5.0", + "typescript": "^4.9.4", + "vite": "^4.0.4", + "vite-tsconfig-paths": "^4.0.3", + "vitest": "^0.27.1", + "vue": "^3.2.45" + }, + "peerDependencies": { + "vue": "^3.0 || ^2.7" + } +} diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.cjs b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.cjs new file mode 100644 index 00000000..bdbd93b5 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var z=(i,e)=>{for(var t in e)o(i,t,{get:e[t],enumerable:!0})},f=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!l.call(i,r)&&r!==t&&o(i,r,{get:()=>e[r],enumerable:!(n=m(e,r))||n.enumerable});return i};var S=i=>f(o({},"__esModule",{value:!0}),i);var j={};z(j,{vueWindowSizeAPI:()=>R,vueWindowSizeMixin:()=>g});module.exports=S(j);var c=require("vue");var b=typeof window<"u",W=()=>b?window.innerWidth:0,y=()=>b?window.innerHeight:0,x=i=>i??W(),O=i=>i??y(),w=i=>({width:x(i?.width),height:O(i?.height)});var a=i=>{let e=(0,c.reactive)(w()),t=({width:n,height:r})=>{e.width=n,e.height=r};return i().addObserver("option-api",t).subscribe(),{computed:{$windowWidth(){return e.width},$windowHeight(){return e.height}}}};var s=class{#e=new Map;#r;#n;#i=!1;#t;constructor(e){let{delay:t=33}=e??{};this.#r=t,this.#t=this.#d.bind(this)}addObserver(e,t){return this.#e.set(e,t),t(this.#s()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(t=>{t(e)}),this}subscribe(){return typeof window>"u"?this:this.#i?this:(window.addEventListener("resize",this.#t),window.addEventListener("orientationchange",this.#t),this.#i=!0,this)}unsubscribe(){return this.#i?(window.removeEventListener("resize",this.#t),window.removeEventListener("orientationchange",this.#t),this.#i=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#i,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#s(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#s();this.notifyObservers(e)}#d(){clearTimeout(this.#n),window.setTimeout(()=>{},1),this.#n=window.setTimeout(()=>{this.#o()},this.#r)}};var d,u=()=>(d||(d=new s),d);var p=i=>({config(e){typeof e.delay=="number"&&i().setDelay(e.delay)},init(){i().subscribe()},destroy(){i().unsubscribe()}});var h,g=()=>(h||(h=a(u)),h),R=p(u);0&&(module.exports={vueWindowSizeAPI,vueWindowSizeMixin}); diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.d.ts b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.d.ts new file mode 100644 index 00000000..5ec3da75 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.d.ts @@ -0,0 +1,26 @@ +type Config = { + delay?: number; +}; + +type Mixin = { + computed: { + $windowWidth: () => number; + $windowHeight: () => number; + }; +}; + +declare const vueWindowSizeMixin: () => Mixin; +declare const vueWindowSizeAPI: { + config(config: Config): void; + init(): void; + destroy(): void; +}; +/** types */ +declare module '@vue/runtime-core' { + interface ComponentCustomProperties { + $windowWidth: number; + $windowHeight: number; + } +} + +export { vueWindowSizeAPI, vueWindowSizeMixin }; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.js b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.js new file mode 100644 index 00000000..d7f96c26 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/dist/index.js @@ -0,0 +1 @@ +import{reactive as l}from"vue";var d=typeof window<"u",a=()=>d?window.innerWidth:0,p=()=>d?window.innerHeight:0,m=i=>i??a(),v=i=>i??p(),u=i=>({width:m(i?.width),height:v(i?.height)});var h=i=>{let e=l(u()),t=({width:w,height:c})=>{e.width=w,e.height=c};return i().addObserver("option-api",t).subscribe(),{computed:{$windowWidth(){return e.width},$windowHeight(){return e.height}}}};var r=class{#e=new Map;#r;#n;#i=!1;#t;constructor(e){let{delay:t=33}=e??{};this.#r=t,this.#t=this.#d.bind(this)}addObserver(e,t){return this.#e.set(e,t),t(this.#s()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(t=>{t(e)}),this}subscribe(){return typeof window>"u"?this:this.#i?this:(window.addEventListener("resize",this.#t),window.addEventListener("orientationchange",this.#t),this.#i=!0,this)}unsubscribe(){return this.#i?(window.removeEventListener("resize",this.#t),window.removeEventListener("orientationchange",this.#t),this.#i=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#i,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#s(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#s();this.notifyObservers(e)}#d(){clearTimeout(this.#n),window.setTimeout(()=>{},1),this.#n=window.setTimeout(()=>{this.#o()},this.#r)}};var n,s=()=>(n||(n=new r),n);var b=i=>({config(e){typeof e.delay=="number"&&i().setDelay(e.delay)},init(){i().subscribe()},destroy(){i().unsubscribe()}});var o,M=()=>(o||(o=h(s)),o),V=b(s);export{V as vueWindowSizeAPI,M as vueWindowSizeMixin}; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/package.json b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/package.json new file mode 100644 index 00000000..8d9a2e9c --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/mixin/package.json @@ -0,0 +1,30 @@ +{ + "name": "vue-window-size-mixin", + "version": "1.0.0", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "packageManager": "yarn@3.3.1", + "scripts": { + "build": "tsup", + "test:integration": "vitest --dir tests --run" + }, + "devDependencies": { + "@types/node": "^18.11.18", + "@vitejs/plugin-vue": "^4.0.0", + "@vue/compiler-dom": "^3.2.45", + "@vue/runtime-core": "^3.2.45", + "@vue/test-utils": "^2.2.7", + "happy-dom": "^8.1.4", + "tsup": "^6.5.0", + "typescript": "^4.9.4", + "vite": "^4.0.4", + "vite-tsconfig-paths": "^4.0.3", + "vitest": "^0.27.1", + "vue": "^3.2.45" + }, + "peerDependencies": { + "vue": "^3.0 || ^2.7" + } +} diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/package.json b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/package.json new file mode 100644 index 00000000..f04a9ad2 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/package.json @@ -0,0 +1,74 @@ +{ + "name": "vue-window-size", + "version": "2.0.0", + "description": "Reactivity window size for Vue.js.", + "type": "module", + "main": "./composition-api/dist/index.cjs", + "module": "./composition-api/dist/index.js", + "types": "./composition-api/dist/index.d.js", + "exports": { + ".": { + "import": "./composition-api/dist/index.js", + "types": "./composition-api/dist/index.d.js", + "require": "./composition-api/dist/index.cjs" + }, + "./plugin": { + "import": "./plugin/dist/index.js", + "types": "./plugin/dist/index.d.js", + "require": "./plugin/dist/index.cjs" + }, + "./mixin": { + "import": "./mixin/dist/index.js", + "types": "./mixin/dist/index.d.js", + "require": "./mixin/dist/index.cjs" + }, + "./package.json": "./package.json", + "./plugin/package.json": "./plugin/package.json", + "./mixin/package.json": "./mixin/package.json" + }, + "repository": "https://github.com/mya-ake/vue-window-size.git", + "bugs": { + "url": "https://github.com/mya-ake/vue-window-size/issues" + }, + "author": "mya-ake ", + "license": "MIT", + "packageManager": "yarn@3.3.1", + "scripts": { + "format": "prettier --write .", + "format:check": "prettier --check .", + "build": "nx run-many --target=build", + "test:unit": "nx run-many --target=test:unit", + "test:integration": "nx run-many --target=test:integration", + "prepare": "husky install" + }, + "devDependencies": { + "@types/node": "^18.11.18", + "@vitest/coverage-c8": "^0.27.1", + "@vue/compiler-dom": "^3.2.45", + "happy-dom": "^8.1.4", + "husky": "^8.0.3", + "lint-staged": "^13.1.0", + "nx": "^15.5.1", + "prettier": "^2.8.3", + "typescript": "^4.9.4" + }, + "peerDependencies": { + "vue": "^3.0 || ^2.7" + }, + "files": [ + "composition-api", + "plugin", + "mixin" + ], + "keywords": [ + "vue.js", + "window size" + ], + "lint-staged": { + "*.{js,ts,json,md,yml}": "prettier --write" + }, + "workspaces": [ + "packages/*", + "examples/*" + ] +} \ No newline at end of file diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.cjs b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.cjs new file mode 100644 index 00000000..911ce49e --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var l=(i,e)=>{for(var t in e)d(i,t,{get:e[t],enumerable:!0})},f=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!v.call(i,r)&&r!==t&&d(i,r,{get:()=>e[r],enumerable:!(n=p(e,r))||n.enumerable});return i};var z=i=>f(d({},"__esModule",{value:!0}),i);var j={};l(j,{VueWindowSizePlugin:()=>R,vueWindowSizeAPI:()=>O});module.exports=z(j);var w=require("vue");var h=typeof window<"u",S=()=>h?window.innerWidth:0,y=()=>h?window.innerHeight:0,W=i=>i??S(),g=i=>i??y(),b=i=>({width:W(i?.width),height:g(i?.height)});var c=i=>{let e=(0,w.reactive)(b()),t=({width:n,height:r})=>{e.width=n,e.height=r};return i().addObserver("option-api",t).subscribe(),{computed:{$windowWidth(){return e.width},$windowHeight(){return e.height}}}};var s=class{#e=new Map;#r;#n;#i=!1;#t;constructor(e){let{delay:t=33}=e??{};this.#r=t,this.#t=this.#d.bind(this)}addObserver(e,t){return this.#e.set(e,t),t(this.#s()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(t=>{t(e)}),this}subscribe(){return typeof window>"u"?this:this.#i?this:(window.addEventListener("resize",this.#t),window.addEventListener("orientationchange",this.#t),this.#i=!0,this)}unsubscribe(){return this.#i?(window.removeEventListener("resize",this.#t),window.removeEventListener("orientationchange",this.#t),this.#i=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#i,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#s(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#s();this.notifyObservers(e)}#d(){clearTimeout(this.#n),window.setTimeout(()=>{},1),this.#n=window.setTimeout(()=>{this.#o()},this.#r)}};var u,o=()=>(u||(u=new s),u);var a=i=>({config(e){typeof e.delay=="number"&&i().setDelay(e.delay)},init(){i().subscribe()},destroy(){i().unsubscribe()}});var O=a(o);function x(i,{delay:e=33}={}){let t=c(o);o().setDelay(e),i.mixin({mixins:[t]})}var R={install:x};0&&(module.exports={VueWindowSizePlugin,vueWindowSizeAPI}); diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.d.ts b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.d.ts new file mode 100644 index 00000000..36c43642 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.d.ts @@ -0,0 +1,24 @@ +import { App } from 'vue'; + +type Config = { + delay?: number; +}; + +declare const vueWindowSizeAPI: { + config(config: Config): void; + init(): void; + destroy(): void; +}; +declare function install(app: App, { delay }?: Config): void; +declare const VueWindowSizePlugin: { + install: typeof install; +}; +declare module 'vue' { + interface ComponentCustomProperties { + $windowWidth: number; + $windowHeight: number; + } +} +type VueWindowSizeOptionApiConfig = Config; + +export { VueWindowSizeOptionApiConfig, VueWindowSizePlugin, vueWindowSizeAPI }; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.js b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.js new file mode 100644 index 00000000..34a8a14a --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/dist/index.js @@ -0,0 +1 @@ +import{reactive as v}from"vue";var o=typeof window<"u",c=()=>o?window.innerWidth:0,a=()=>o?window.innerHeight:0,p=i=>i??c(),m=i=>i??a(),d=i=>({width:p(i?.width),height:m(i?.height)});var u=i=>{let e=v(d()),t=({width:b,height:w})=>{e.width=b,e.height=w};return i().addObserver("option-api",t).subscribe(),{computed:{$windowWidth(){return e.width},$windowHeight(){return e.height}}}};var r=class{#e=new Map;#r;#n;#i=!1;#t;constructor(e){let{delay:t=33}=e??{};this.#r=t,this.#t=this.#d.bind(this)}addObserver(e,t){return this.#e.set(e,t),t(this.#s()),this}deleteObserver(e){return this.#e.delete(e),this}deleteObservers(){return this.#e.clear(),this}notifyObservers(e){return this.#e.forEach(t=>{t(e)}),this}subscribe(){return typeof window>"u"?this:this.#i?this:(window.addEventListener("resize",this.#t),window.addEventListener("orientationchange",this.#t),this.#i=!0,this)}unsubscribe(){return this.#i?(window.removeEventListener("resize",this.#t),window.removeEventListener("orientationchange",this.#t),this.#i=!1,this):this}setDelay(e){return this.#r=e,this}info(){return{delay:this.#r,subscribed:this.#i,observersCount:this.#e.size}}dispatch(){return this.#o(),this}#s(){return typeof window>"u"?{width:0,height:0}:{width:window.innerWidth,height:window.innerHeight}}#o(){let e=this.#s();this.notifyObservers(e)}#d(){clearTimeout(this.#n),window.setTimeout(()=>{},1),this.#n=window.setTimeout(()=>{this.#o()},this.#r)}};var s,n=()=>(s||(s=new r),s);var h=i=>({config(e){typeof e.delay=="number"&&i().setDelay(e.delay)},init(){i().subscribe()},destroy(){i().unsubscribe()}});var V=h(n);function l(i,{delay:e=33}={}){let t=u(n);n().setDelay(e),i.mixin({mixins:[t]})}var I={install:l};export{I as VueWindowSizePlugin,V as vueWindowSizeAPI}; diff --git a/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/package.json b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/package.json new file mode 100644 index 00000000..165866c6 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue-window-size/plugin/package.json @@ -0,0 +1,30 @@ +{ + "name": "vue-window-size-plugin", + "version": "1.0.0", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "packageManager": "yarn@3.3.1", + "scripts": { + "build": "tsup", + "test:integration": "vitest --dir tests --run" + }, + "devDependencies": { + "@types/node": "^18.11.18", + "@vitejs/plugin-vue": "^4.0.0", + "@vue/compiler-dom": "^3.2.45", + "@vue/runtime-core": "^3.2.45", + "@vue/test-utils": "^2.2.7", + "happy-dom": "^8.1.4", + "tsup": "^6.5.0", + "typescript": "^4.9.4", + "vite": "^4.0.4", + "vite-tsconfig-paths": "^4.0.3", + "vitest": "^0.27.1", + "vue": "^3.2.45" + }, + "peerDependencies": { + "vue": "^3.0 || ^2.7" + } +} diff --git a/EssentialCSharp.Web/wwwroot/lib/vue/LICENSE b/EssentialCSharp.Web/wwwroot/lib/vue/LICENSE new file mode 100644 index 00000000..15f1f7e7 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018-present, Yuxi (Evan) You + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/EssentialCSharp.Web/wwwroot/lib/vue/README.md b/EssentialCSharp.Web/wwwroot/lib/vue/README.md new file mode 100644 index 00000000..a98bd997 --- /dev/null +++ b/EssentialCSharp.Web/wwwroot/lib/vue/README.md @@ -0,0 +1,54 @@ +# vue + +## Which dist file to use? + +### From CDN or without a Bundler + +- **`vue(.runtime).global(.prod).js`**: + - For direct use via ` +
+
+
+ + } *@

Welcome to Essential C#

Written by Mark Michaelis with Eric Lippert & Kevin Bost

diff --git a/EssentialCSharp.Web/Views/Shared/_Layout.cshtml b/EssentialCSharp.Web/Views/Shared/_Layout.cshtml index 68f1409c..7cfac0a5 100644 --- a/EssentialCSharp.Web/Views/Shared/_Layout.cshtml +++ b/EssentialCSharp.Web/Views/Shared/_Layout.cshtml @@ -7,9 +7,9 @@ @{ - const string imageUrl = "https://essentialcsharp.com/images/icon.png"; - const string description = "Accelerate your development knowledge with C# expert Mark Michaelis' free, online comprehensive C# tutorial and reference that is updated through C# 11.0"; - string title = $"Essential C#{(string.IsNullOrEmpty(ViewBag.PageTitle) ? string.Empty : $": {ViewBag.PageTitle}")}"; + const string imageUrl = "https://essentialcsharp.com/images/icon.png"; + const string description = "Accelerate your development knowledge with C# expert Mark Michaelis' free, online comprehensive C# tutorial and reference that is updated through C# 11.0"; + string title = $"Essential C#{(string.IsNullOrEmpty(ViewBag.PageTitle) ? string.Empty : $": {ViewBag.PageTitle}")}"; } @@ -175,9 +175,9 @@
Build: @if (ReleaseDateAttribute.GetReleaseDate() is DateTime date) - { - @TimeZoneInfo.ConvertTimeFromUtc(date, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")).ToString("d MMM, yyyy h:mm:ss tt", CultureInfo.InvariantCulture) - } + { + @TimeZoneInfo.ConvertTimeFromUtc(date, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")).ToString("d MMM, yyyy h:mm:ss tt", CultureInfo.InvariantCulture) + }