Changes for ssr

pull/3420/head
Bahadır Sofuoğlu 2022-12-13 13:23:13 +03:00
parent 6c9f6323d5
commit cc98fb55eb
3 changed files with 190 additions and 186 deletions

View File

@ -64,7 +64,7 @@ export default {
linkElement.remove();
cloneLinkElement.setAttribute('id', elementId);
});
linkElement.parentNode.insertBefore(cloneLinkElement, linkElement.nextSibling);
linkElement.parentNode?.insertBefore(cloneLinkElement, linkElement.nextSibling);
this.$appState.theme = event.theme;
this.$appState.darkTheme = event.dark;

View File

@ -1,19 +1,21 @@
<template>
<div :class="landingClass">
<div class="landing-intro">
<AppNews v-if="$appState.newsActive" />
<HeaderSection @theme-toggle="onThemeToggle" />
<HeroSection />
<ClientOnly>
<div :class="landingClass">
<div class="landing-intro">
<AppNews v-if="$appState.newsActive" />
<HeaderSection @theme-toggle="onThemeToggle" />
<HeroSection />
</div>
<ComponentSection />
<ThemeSection :theme="tableTheme" @table-theme-change="onTableThemeChange" />
<BlockSection />
<DesignerSection />
<TemplateSection />
<UsersSection />
<FeaturesSection />
<FooterSection />
</div>
<ComponentSection />
<ThemeSection :theme="tableTheme" @table-theme-change="onTableThemeChange" />
<BlockSection />
<DesignerSection />
<TemplateSection />
<UsersSection />
<FeaturesSection />
<FooterSection />
</div>
</ClientOnly>
</template>
<script>

View File

@ -6,23 +6,24 @@
<p>PrimeVue is a rich set of open source native components for Vue.</p>
</div>
</div>
<div class="content-section documentation">
<h3>Module Loader</h3>
<p>
This is the recommended way if your application uses <a href="https://cli.vuejs.org">Vue CLI</a>, <a href="https://vitejs.dev">Vite</a> or has a webpack based build with
<a href="https://github.com/vuejs/vue-loader">vue-loader</a> configured.
</p>
<ClientOnly>
<div class="content-section documentation">
<h3>Module Loader</h3>
<p>
This is the recommended way if your application uses <a href="https://cli.vuejs.org">Vue CLI</a>, <a href="https://vitejs.dev">Vite</a> or has a webpack based build with
<a href="https://github.com/vuejs/vue-loader">vue-loader</a> configured.
</p>
<p>PrimeVue is available at <a href="https://www.npmjs.com/package/primevue">npm</a>, if you have an existing application run the following commands to download PrimeVue and PrimeIcons to your project.</p>
<p>PrimeVue is available at <a href="https://www.npmjs.com/package/primevue">npm</a>, if you have an existing application run the following commands to download PrimeVue and PrimeIcons to your project.</p>
<pre v-code.script><code>
<pre v-code.script><code>
npm install primevue@^3 --save
npm install primeicons --save
</code></pre>
<p>Next step is setting up PrimeVue configuration.</p>
<pre v-code.script><code>
<p>Next step is setting up PrimeVue configuration.</p>
<pre v-code.script><code>
import {createApp} from 'vue';
import App from './App.vue';
import PrimeVue from 'primevue/config';
@ -32,8 +33,8 @@ app.use(PrimeVue);
</code></pre>
<p>Then import and register a component from the library. Import path is available in the documentation of the corresponding component.</p>
<pre v-code.script><code>
<p>Then import and register a component from the library. Import path is available in the documentation of the corresponding component.</p>
<pre v-code.script><code>
import {createApp} from 'vue';
import App from './App.vue';
import PrimeVue from 'primevue/config';
@ -46,31 +47,31 @@ app.component('Dialog', Dialog);
</code></pre>
<p>Finally you'll be able to utilize the component in your application. See the <b>Styles</b> section to apply styling.</p>
<pre v-code><code>
<p>Finally you'll be able to utilize the component in your application. See the <b>Styles</b> section to apply styling.</p>
<pre v-code><code>
&lt;Dialog&gt;&lt;/Dialog&gt;
</code></pre>
<p>Watch the video tutorial that goes through these steps.</p>
<div class="video-container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/FjYesOz95MM" frameborder="0" allowfullscreen></iframe>
</div>
<p>Watch the video tutorial that goes through these steps.</p>
<div class="video-container">
<iframe width="560" height="315" src="https://www.youtube.com/embed/FjYesOz95MM" frameborder="0" allowfullscreen></iframe>
</div>
<h5>Single File Components</h5>
<p>
SFC files are available in the npm distribution and if you'd like to use SFCs directly, add <i>/sfc</i> as a suffix when referencing an import path. This will instruct your bundler to process the *.vue files in your local build
instead of using the compiled output. One use case for this approach is optimizing for SSR by removing whitespaces.
</p>
<h5>Single File Components</h5>
<p>
SFC files are available in the npm distribution and if you'd like to use SFCs directly, add <i>/sfc</i> as a suffix when referencing an import path. This will instruct your bundler to process the *.vue files in your local build
instead of using the compiled output. One use case for this approach is optimizing for SSR by removing whitespaces.
</p>
<pre v-code.script><code>
<pre v-code.script><code>
import Dialog from 'primevue/dialog/sfc';
</code></pre>
<h3>Script Tag</h3>
<p>Other alternative is utilizing the components directly within the browser with the <i>iife</i> build. Note that PrimeVue does not provide a <i>umd</i> build.</p>
<pre v-code><code><template v-pre>
<h3>Script Tag</h3>
<p>Other alternative is utilizing the components directly within the browser with the <i>iife</i> build. Note that PrimeVue does not provide a <i>umd</i> build.</p>
<pre v-code><code><template v-pre>
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
@ -113,19 +114,19 @@ import Dialog from 'primevue/dialog/sfc';
</template>
</code></pre>
<h3>Styles</h3>
<p>The css dependencies are as follows, note that you may change the theme with another one of your choice. If you are using a bundler such as webpack with a css loader you may import them to your main application component.</p>
<h3>Styles</h3>
<p>The css dependencies are as follows, note that you may change the theme with another one of your choice. If you are using a bundler such as webpack with a css loader you may import them to your main application component.</p>
<pre v-code.script><code>
<pre v-code.script><code>
primevue/resources/themes/saga-blue/theme.css //theme
primevue/resources/primevue.min.css //core css
primeicons/primeicons.css //icons
</code></pre>
<h5>Free Themes</h5>
<p>PrimeVue ships with various free themes to choose from.</p>
<pre v-code.css><code>
<h5>Free Themes</h5>
<p>PrimeVue ships with various free themes to choose from.</p>
<pre v-code.css><code>
primevue/resources/themes/bootstrap4-light-blue/theme.css
primevue/resources/themes/bootstrap4-light-purple/theme.css
primevue/resources/themes/bootstrap4-dark-blue/theme.css
@ -172,18 +173,18 @@ primevue/resources/themes/rhea/theme.css
</code></pre>
<h5>PrimeFlex</h5>
<p>
PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more. Although it is not required, it is highly recommended to add PrimeFlex as it is likely to need such utilities
when developing applications. View the <a href="https://www.primefaces.org/primeflex">PrimeFlex</a> homepage for the more information.
</p>
<h5>PrimeFlex</h5>
<p>
PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more. Although it is not required, it is highly recommended to add PrimeFlex as it is likely to need such
utilities when developing applications. View the <a href="https://www.primefaces.org/primeflex">PrimeFlex</a> homepage for the more information.
</p>
<h3>Nuxt Integration</h3>
<p>Nuxt 3 is currently in beta and an official module is planned after the final release. At the moment, PrimeVue can easily be used with Nuxt 3 using a custom plugin.</p>
<h3>Nuxt Integration</h3>
<p>Nuxt 3 is currently in beta and an official module is planned after the final release. At the moment, PrimeVue can easily be used with Nuxt 3 using a custom plugin.</p>
<h6>nuxt.config.js</h6>
<p>Open the nuxt configuration file and add the css dependencies.</p>
<pre v-code.script><code>
<h6>nuxt.config.js</h6>
<p>Open the nuxt configuration file and add the css dependencies.</p>
<pre v-code.script><code>
import { defineNuxtConfig } from 'nuxt3'
export default defineNuxtConfig({
@ -199,10 +200,10 @@ export default defineNuxtConfig({
</code></pre>
<h6>primevue.js</h6>
<p>Create a file like <i>primevue.js</i> under the plugins directory for the configuration.</p>
<h6>primevue.js</h6>
<p>Create a file like <i>primevue.js</i> under the plugins directory for the configuration.</p>
<pre v-code.script><code>
<pre v-code.script><code>
import { defineNuxtPlugin } from "#app";
import PrimeVue from "primevue/config";
import Button from "primevue/button";
@ -215,13 +216,13 @@ export default defineNuxtPlugin((nuxtApp) => {
</code></pre>
<h3>Configuration</h3>
<h5>Dependencies</h5>
<p>PrimeVue components are not wrappers and implemented natively with the Vue APIs. There are some exceptions having 3rd party dependencies such as Quill for Editor.</p>
<p>In addition, components require PrimeIcons library for icons.</p>
<h3>Configuration</h3>
<h5>Dependencies</h5>
<p>PrimeVue components are not wrappers and implemented natively with the Vue APIs. There are some exceptions having 3rd party dependencies such as Quill for Editor.</p>
<p>In addition, components require PrimeIcons library for icons.</p>
<h6>Mandatory</h6>
<pre v-code.script><code>
<h6>Mandatory</h6>
<pre v-code.script><code>
dependencies: {
"vue": "^3.0.0",
"primeicons": "^6.0.0"
@ -229,36 +230,36 @@ dependencies: {
</code></pre>
<h6>Optional</h6>
<p>Here is the list of components with 3rd party dependencies. Documentation of each component has a dependencies section as well.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Component</th>
<th>Dependency</th>
</tr>
</thead>
<tbody>
<tr>
<td>Charts</td>
<td>Charts.js 3.3.2+</td>
</tr>
<tr>
<td>Editor</td>
<td>Quill.js 1.3.3+</td>
</tr>
<tr>
<td>PrimeFlex</td>
<td>DataView</td>
</tr>
</tbody>
</table>
</div>
<h6>Optional</h6>
<p>Here is the list of components with 3rd party dependencies. Documentation of each component has a dependencies section as well.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Component</th>
<th>Dependency</th>
</tr>
</thead>
<tbody>
<tr>
<td>Charts</td>
<td>Charts.js 3.3.2+</td>
</tr>
<tr>
<td>Editor</td>
<td>Quill.js 1.3.3+</td>
</tr>
<tr>
<td>PrimeFlex</td>
<td>DataView</td>
</tr>
</tbody>
</table>
</div>
<h5>Prop Cases</h5>
<p>Component prop names are described as camel case throughout the documentation however camel-case is also fully supported. Events on the other hand should always be camel-case.</p>
<pre v-code><code>
<h5>Prop Cases</h5>
<p>Component prop names are described as camel case throughout the documentation however camel-case is also fully supported. Events on the other hand should always be camel-case.</p>
<pre v-code><code>
&lt;Dialog :showHeader="false"&gt;&lt;/Dialog&gt;
&lt;!-- can be written as --&gt;
@ -267,9 +268,9 @@ dependencies: {
</code></pre>
<h5>Ripple</h5>
<p>Ripple is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at your app's entry file (e.g. main.js) during the PrimeVue setup.</p>
<pre v-code.script><code>
<h5>Ripple</h5>
<p>Ripple is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at your app's entry file (e.g. main.js) during the PrimeVue setup.</p>
<pre v-code.script><code>
import {createApp} from 'vue';
import PrimeVue from 'primevue/config';
const app = createApp(App);
@ -278,15 +279,15 @@ app.use(PrimeVue, {ripple: true});
</code></pre>
<h5>Outlined vs Filled Input Styles</h5>
<p>
Input fields come in two styles, default is <i>outlined</i> with borders around the field whereas <i>filled</i> alternative adds a background color to the field. Applying <i>p-input-filled</i> to an ancestor of an input enables the
filled style. If you prefer to use filled inputs in the entire application, use a global container such as the document body or the application element to apply the style class. Note that in case you add it to the application element,
components that are teleported to the document body such as Dialog will not be able to display filled inputs as they are not a descendant of the application root element in the DOM tree, to resolve this case set inputStyle to 'filled'
at PrimeVue configuration as well.
</p>
<h5>Outlined vs Filled Input Styles</h5>
<p>
Input fields come in two styles, default is <i>outlined</i> with borders around the field whereas <i>filled</i> alternative adds a background color to the field. Applying <i>p-input-filled</i> to an ancestor of an input enables
the filled style. If you prefer to use filled inputs in the entire application, use a global container such as the document body or the application element to apply the style class. Note that in case you add it to the application
element, components that are teleported to the document body such as Dialog will not be able to display filled inputs as they are not a descendant of the application root element in the DOM tree, to resolve this case set
inputStyle to 'filled' at PrimeVue configuration as well.
</p>
<pre v-code.script><code>
<pre v-code.script><code>
import {createApp} from 'vue';
import PrimeVue from 'primevue/config';
const app = createApp(App);
@ -295,13 +296,13 @@ app.use(PrimeVue, {inputStyle: 'filled'});
</code></pre>
<h5>ZIndex Layering</h5>
<p>
ZIndexes are managed automatically to make sure layering of overlay components work seamlessly when combining multiple components. Still there may be cases where you'd like to configure the configure default values such as a custom
layout where header section is fixed. In a case like this, dropdown needs to be displayed below the application header but a modal dialog should be displayed above. PrimeVue configuration offers the <i>zIndex</i> property to customize
the default values for components categories. Default values are described below and can be customized when setting up PrimeVue.
</p>
<pre v-code.script><code>
<h5>ZIndex Layering</h5>
<p>
ZIndexes are managed automatically to make sure layering of overlay components work seamlessly when combining multiple components. Still there may be cases where you'd like to configure the configure default values such as a
custom layout where header section is fixed. In a case like this, dropdown needs to be displayed below the application header but a modal dialog should be displayed above. PrimeVue configuration offers the <i>zIndex</i> property
to customize the default values for components categories. Default values are described below and can be customized when setting up PrimeVue.
</p>
<pre v-code.script><code>
import {createApp} from 'vue';
import PrimeVue from 'primevue/config';
const app = createApp(App);
@ -316,79 +317,80 @@ app.use(PrimeVue, {
});
</code></pre>
<h5>Locale</h5>
<p>PrimeVue provides a Locale API to support i18n and l7n, visit the <router-link to="/locale">Locale</router-link> documentation for more information.</p>
<h5>Locale</h5>
<p>PrimeVue provides a Locale API to support i18n and l7n, visit the <router-link to="/locale">Locale</router-link> documentation for more information.</p>
<h5>Browser Support</h5>
<div class="doc-tablewrapper">
<table class="doc-table browsers">
<thead>
<tr>
<th>
<div class="flex align-items-center">
<img src="../../assets/images//browsers/edge.svg" alt="edge" style="width: 1.5rem" class="mr-2" />
Edge
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/firefox.svg" alt="firefox" style="width: 1.5rem" class="mr-2" />
Firefox
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/chrome.svg" alt="chrome" style="width: 1.5rem" class="mr-2" />
Chrome
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/safari.svg" alt="safari" style="width: 1.5rem" class="mr-2" />
Safari
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/opera.svg" alt="opera" style="width: 1.5rem" class="mr-2" />
Opera
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Edge</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
</tr>
</tbody>
</table>
<h5>Browser Support</h5>
<div class="doc-tablewrapper">
<table class="doc-table browsers">
<thead>
<tr>
<th>
<div class="flex align-items-center">
<img src="../../assets/images//browsers/edge.svg" alt="edge" style="width: 1.5rem" class="mr-2" />
Edge
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/firefox.svg" alt="firefox" style="width: 1.5rem" class="mr-2" />
Firefox
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/chrome.svg" alt="chrome" style="width: 1.5rem" class="mr-2" />
Chrome
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/safari.svg" alt="safari" style="width: 1.5rem" class="mr-2" />
Safari
</div>
</th>
<th>
<div class="flex align-items-center">
<img src="../../assets/images/browsers/opera.svg" alt="opera" style="width: 1.5rem" class="mr-2" />
Opera
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Edge</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
<td>Last 2 versions</td>
</tr>
</tbody>
</table>
</div>
<h3>Samples</h3>
<h5>Quickstart with Create Vue</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart-create-vue">example application</a> based on Create Vue is available at github.</p>
<h5>Quickstart with Create Vue TypeScript</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart-create-vue-ts">sample application</a> based on Create Vue is available at github.</p>
<h5>Typescript</h5>
<p>
Typescript is fully supported as type definition files are provided in the npm package of PrimeVue. A sample <a href="https://github.com/primefaces/primevue-typescript-quickstart">typescript-primevue</a> application with Vue CLI
is available as at github.
</p>
<h5>Quickstart with Vite</h5>
<p>A <a href="https://github.com/primefaces/primevue-quickstart-vite">starter application</a> is also provided for Vite users.</p>
<h5>Quickstart with Nuxt</h5>
<p>A <a href="https://github.com/primefaces/primevue-quickstart-nuxt3">sample application</a> is created for Nuxt 3 users.</p>
<h5>Quickstart with Vue CLI</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart">example application</a> based on Vue CLI is available at github.</p>
</div>
<h3>Samples</h3>
<h5>Quickstart with Create Vue</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart-create-vue">example application</a> based on Create Vue is available at github.</p>
<h5>Quickstart with Create Vue TypeScript</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart-create-vue-ts">sample application</a> based on Create Vue is available at github.</p>
<h5>Typescript</h5>
<p>
Typescript is fully supported as type definition files are provided in the npm package of PrimeVue. A sample <a href="https://github.com/primefaces/primevue-typescript-quickstart">typescript-primevue</a> application with Vue CLI is
available as at github.
</p>
<h5>Quickstart with Vite</h5>
<p>A <a href="https://github.com/primefaces/primevue-quickstart-vite">starter application</a> is also provided for Vite users.</p>
<h5>Quickstart with Nuxt</h5>
<p>A <a href="https://github.com/primefaces/primevue-quickstart-nuxt3">sample application</a> is created for Nuxt 3 users.</p>
<h5>Quickstart with Vue CLI</h5>
<p>An <a href="https://github.com/primefaces/primevue-quickstart">example application</a> based on Vue CLI is available at github.</p>
</div>
</ClientOnly>
</div>
</template>