Skip to content

Commit

Permalink
Merge branch 'release/1.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Nov 19, 2023
2 parents b886994 + ab57810 commit 66fe28d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pdanpdan/quasar-play",
"version": "1.0.5",
"version": "1.0.6",
"description": "Playground for Quasar Framework",
"productName": "Quasar Play",
"author": {
Expand Down
37 changes: 27 additions & 10 deletions src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,27 @@

<div>
<div class="row q-gutter-sm">
<q-btn
style="min-width: 9ch"
flat
:color="ssr === true ? 'primary' : ''"
padding="sm"
:label="`SSR ${ ssr === true ? 'ON' : 'OFF' }`"
@click="toggleSSR"
/>
<q-btn-group flat>
<q-btn
style="min-width: 7ch"
flat
:color="productionMode === true ? 'accent' : 'primary'"
padding="sm"
:label="productionMode === true ? 'PROD' : 'DEV'"
@click="toggleProductionMode"
/>

<q-btn
style="min-width: 9ch"
flat
:color="ssr === true ? 'accent' : 'primary'"
padding="sm"
:label="`SSR ${ ssr === true ? 'ON' : 'OFF' }`"
@click="toggleSSR"
/>
</q-btn-group>

<q-space v-if="$q.screen.lt.lg" />

<q-btn
flat
Expand Down Expand Up @@ -279,11 +292,15 @@ onUnmounted(() => {
window.removeEventListener('blur', handleWindowBlur);
});
const { ssr } = props.store;
const { ssr, productionMode } = props.store;
function toggleSSR() {
ssr.value = ssr.value !== true;
}
function toggleProductionMode() {
productionMode.value = productionMode.value !== true;
}
function toggleDark() {
$q.dark.set($q.dark.isActive !== true);
}
Expand Down Expand Up @@ -385,7 +402,7 @@ body.desktop .q-select__options-list
.play
&__top-bar
z-index: 1
z-index: 20
position: relative
background: var(--play-bg-color-base)
transform-style: preserve-3d
Expand Down
12 changes: 8 additions & 4 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const counterFile = 'src/counter.ts';
const settingsFile = 'src/QuasarSettings.vue';

const pkgPathMap: Record<string, string | PathMeta> = {
vue: 'dist/vue.runtime.esm-browser.js',
vue: 'dist/vue.{{production}}esm-browser.js',
'vue/server-renderer': {
pkg: '@vue/server-renderer',
path: 'dist/server-renderer.esm-browser.js',
Expand Down Expand Up @@ -154,6 +154,8 @@ export function useReplStore( options: ReplOptions = {} ) {
typescriptVersion: computed( () => versions.typescript || 'latest' ),
} );

const productionMode = ref( false );

const customImports = computed( () => {
const code = state.files[ IMPORT_MAP ]?.code.trim();
let map: ImportMap = {};
Expand All @@ -168,7 +170,7 @@ export function useReplStore( options: ReplOptions = {} ) {

return map;
} );
const internalImports = computed( () => buildImports( versions ) );
const internalImports = computed( () => buildImports( versions, productionMode.value ) );
const importMap = computed( () => {
return <ImportMap>{
imports: {
Expand Down Expand Up @@ -219,7 +221,7 @@ export function useReplStore( options: ReplOptions = {} ) {
return `src/${ origin }`;
}

function buildImports( versions: Record<string, string> = {} ) {
function buildImports( versions: Record<string, string> = {}, prod: boolean = false ) {
const imports: Record<string, string> = {};

for ( const name of Object.keys( pkgPathMap ) ) {
Expand All @@ -238,7 +240,8 @@ export function useReplStore( options: ReplOptions = {} ) {

if ( !pkg || !path ) continue;

imports[ name ] = getCdnUrl( pkg, path, versions[ pkg ] || 'latest' );
const prodReplace = prod === true ? 'runtime.' : '';
imports[ name ] = getCdnUrl( pkg, path, versions[ pkg ] || 'latest' ).replace( '{{production}}', prodReplace );
}

return imports;
Expand Down Expand Up @@ -371,6 +374,7 @@ export function useReplStore( options: ReplOptions = {} ) {
...store,

ssr: ref( false ),
productionMode,
versions,
init,
serialize,
Expand Down

0 comments on commit 66fe28d

Please sign in to comment.