${panels.filter(panel => !panel.isSlot).map(panel => `<${panel.tag}${getClass(panel)}${getStyle(panel)}>${panel.content}${panel.tag}>`).join("\n ")}
${slots.length ? `\n ${slots.map(slot => `<${slot.tag}${getClass(slot)}${getStyle(slot)}>${slot.content}${slot.tag}>`).join("\n ")}` : ""}
diff --git a/docs/src/component/code/PreactCode.tsx b/docs/src/component/code/PreactCode.tsx
index d6f0337bbe..3cb8542f61 100644
--- a/docs/src/component/code/PreactCode.tsx
+++ b/docs/src/component/code/PreactCode.tsx
@@ -4,7 +4,7 @@ import CodeBlock from "@theme/CodeBlock";
import { SourceContext } from "./type";
import { getClass, getImports, getPlugins, getStyle } from "./utils";
-export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [] }: SourceContext) => {
+export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [], viewportClass="" }: SourceContext) => {
const declarePlugins = plugins ? `\n private _plugins = [${getPlugins(plugins)}];\n` : "";
const slots = panels.filter(panel => panel.isSlot);
@@ -35,7 +35,7 @@ export default ({ options, panels, events = {}, methods = {}, plugins, siblings,
${declareVars}
export default class DemoComponent extends Component {${declarePlugins}
public render() {
- return ${siblings ? "<>\n " : ""}
`${key}=${typeof options[key] === "string" ? `"${options[key]}"` : `{${options[key]}}`}`).join(" ")}` : ""}${plugins ? " plugins={this._plugins}" : ""}${eventStatement}>
+ return ${siblings ? "<>\n " : ""} `${key}=${typeof options[key] === "string" ? `"${options[key]}"` : `{${options[key]}}`}`).join(" ")}` : ""}${plugins ? " plugins={this._plugins}" : ""}${eventStatement}>
${panels.filter(panel => !panel.isSlot).map(panel => `<${panel.tag}${getClass(panel, "className")}${getStyle(panel, true)}>${panel.content.replace(/class/g, "className")}${panel.tag}>`).join("\n ")}${slotsTemplate}
${siblings ? `\n ${siblings.map(el => `<${el.tag}${getClass(el, "className")}${getStyle(el, true)}>${el.content.replace(/class/g, "className")}${el.tag}>`).join("\n ")}\n >` : ""};
}
diff --git a/docs/src/component/code/ReactCode.tsx b/docs/src/component/code/ReactCode.tsx
index f337c16829..6b5eb05acd 100644
--- a/docs/src/component/code/ReactCode.tsx
+++ b/docs/src/component/code/ReactCode.tsx
@@ -4,7 +4,7 @@ import CodeBlock from "@theme/CodeBlock";
import { SourceContext } from "./type";
import { getClass, getImports, getPlugins, getStyle } from "./utils";
-export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [] }: SourceContext) => {
+export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [], viewportClass="" }: SourceContext) => {
const declarePlugins = plugins ? `\n private _plugins = [${getPlugins(plugins)}];\n` : "";
const slots = panels.filter(panel => panel.isSlot);
@@ -35,7 +35,7 @@ export default ({ options, panels, events = {}, methods = {}, plugins, siblings,
${declareVars}
export default class DemoComponent extends Component {${declarePlugins}
public render() {
- return ${siblings ? "<>\n " : ""} `${key}=${typeof options[key] === "string" ? `"${options[key]}"` : `{${options[key]}}`}`).join(" ")}` : ""}${plugins ? " plugins={this._plugins}" : ""}${eventStatement}>
+ return ${siblings ? "<>\n " : ""} `${key}=${typeof options[key] === "string" ? `"${options[key]}"` : `{${options[key]}}`}`).join(" ")}` : ""}${plugins ? " plugins={this._plugins}" : ""}${eventStatement}>
${panels.filter(panel => !panel.isSlot).map(panel => `<${panel.tag}${getClass(panel, "className")}${getStyle(panel, true)}>${panel.content.replace(/class/g, "className")}${panel.tag}>`).join("\n ")}${slotsTemplate}
${siblings ? `\n ${siblings.map(el => `<${el.tag}${getClass(el, "className")}${getStyle(el, true)}>${el.content.replace(/class/g, "className")}${el.tag}>`).join("\n ")}\n >` : ""};
}
diff --git a/docs/src/component/code/SvelteCode.tsx b/docs/src/component/code/SvelteCode.tsx
index b3c3582e80..d738330f8d 100644
--- a/docs/src/component/code/SvelteCode.tsx
+++ b/docs/src/component/code/SvelteCode.tsx
@@ -4,7 +4,7 @@ import CodeBlock from "@theme/CodeBlock";
import { SourceContext } from "./type";
import { getClass, getImports, getOptionsObject, getPlugins, getStyle } from "./utils";
-export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [] }: SourceContext) => {
+export default ({ options, panels, events = {}, methods = {}, plugins, siblings, imports = [], viewportClass="" }: SourceContext) => {
const optionsObject = getOptionsObject(options);
const declarePlugins = plugins ? `\n\nconst plugins = [${getPlugins(plugins)}];` : "";
const slots = panels.filter(panel => panel.isSlot);
@@ -34,7 +34,7 @@ export default ({ options, panels, events = {}, methods = {}, plugins, siblings,
${getImports(defaultImports, { includeFlicking: false })}${declarePlugins}${declareMethods}
-
+
${panels.filter(panel => !panel.isSlot).map(panel => `${panel.content}`).join("\n ")}${slotsTemplate}
${siblings ? `\n${siblings.map(el => `<${el.tag}${getClass(el)}${getStyle(el)}>${el.content}${el.tag}>`).join("\n")}` : ""}`}
;
diff --git a/docs/src/component/code/Vue3Code.tsx b/docs/src/component/code/Vue3Code.tsx
index 0673c06656..9ad02e1612 100644
--- a/docs/src/component/code/Vue3Code.tsx
+++ b/docs/src/component/code/Vue3Code.tsx
@@ -4,7 +4,7 @@ import CodeBlock from "@theme/CodeBlock";
import { SourceContext } from "./type";
import { getClass, getImports, getOptionsObject, getPlugins, getStyle } from "./utils";
-export default ({ options, panels, events = {}, methods = {}, plugins, siblings = [], imports = [] }: SourceContext) => {
+export default ({ options, panels, events = {}, methods = {}, plugins, siblings = [], imports = [], viewportClass="" }: SourceContext) => {
const optionsObject = getOptionsObject(options);
const slots = panels.filter(panel => panel.isSlot);
const declarePlugins = plugins ? `,
@@ -31,7 +31,7 @@ export default ({ options, panels, events = {}, methods = {}, plugins, siblings
const eventStatement = Object.keys(events).map(evt => ` @${evt.replace(/([A-Z])/g, "-$1").toLowerCase()}="${events[evt]}"`).join("");
return <>
- {`
+ {`
${panels.filter(panel => !panel.isSlot).map(panel => `<${panel.tag}${getClass(panel)}${getStyle(panel)}>${panel.content}${panel.tag}>`).join("\n ")}${slotsTemplate}
${siblings ? `\n${siblings.map(el => `<${el.tag}${getClass(el)}${getStyle(el)}>${el.content}${el.tag}>`).join("\n")}` : ""}`}
diff --git a/docs/src/component/code/VueCode.tsx b/docs/src/component/code/VueCode.tsx
index 3bda1f9c5e..8dc9e0def1 100644
--- a/docs/src/component/code/VueCode.tsx
+++ b/docs/src/component/code/VueCode.tsx
@@ -4,7 +4,7 @@ import CodeBlock from "@theme/CodeBlock";
import { SourceContext } from "./type";
import { getClass, getImports, getOptionsObject, getPlugins, getStyle } from "./utils";
-export default ({ options, panels, events = {}, methods = {}, plugins, siblings = [], imports = [] }: SourceContext) => {
+export default ({ options, panels, events = {}, methods = {}, plugins, siblings = [], imports = [], viewportClass="" }: SourceContext) => {
const optionsObject = getOptionsObject(options);
const declarePlugins = plugins ? `,
data() {
@@ -23,7 +23,7 @@ export default ({ options, panels, events = {}, methods = {}, plugins, siblings
const eventStatement = Object.keys(events).map(evt => ` @${evt.replace(/([A-Z])/g, "-$1").toLowerCase()}="${events[evt]}"`).join("");
return <>
- {`
+ {`
${panels.map(panel => `<${panel.tag}${panel.isSlot ? " slot=\"viewport\"" : ""}${getClass(panel)}${getStyle(panel)}>${panel.content}${panel.tag}>`).join("\n ")}
${siblings ? `\n${siblings.map(el => `<${el.tag}${getClass(el)}${getStyle(el)}>${el.content}${el.tag}>`).join("\n")}` : ""}`}
diff --git a/docs/src/component/code/type.ts b/docs/src/component/code/type.ts
index b4f1a7d3df..0809aa3d42 100644
--- a/docs/src/component/code/type.ts
+++ b/docs/src/component/code/type.ts
@@ -13,6 +13,8 @@ export interface SourceContext {
angular?: React.ReactElement;
preact?: React.ReactElement;
svelte?: React.ReactElement;
+ viewportClass?: string;
+ style?: string;
}
export interface InnerElement {
diff --git a/docs/src/component/code/utils.ts b/docs/src/component/code/utils.ts
index cf9d398ac3..fbc28a7acc 100644
--- a/docs/src/component/code/utils.ts
+++ b/docs/src/component/code/utils.ts
@@ -25,4 +25,4 @@ export const getImports = (otherImports, {
return `${imports.map(imp => Array.isArray(imp) ? `import ${imp[0]} from "${imp[1]}";` : `import "${imp}";`).join("\n")}`;
};
-export const getPlugins = (plugins) => `${plugins.map(plugin => `new ${plugin[0]}(${plugin[1] ? `{ ${getOptionsObject(plugin[1])} }` : ""}`).join(", ")})`;
+export const getPlugins = (plugins) => `${plugins.map(plugin => `new ${plugin[0]}(${typeof plugin[1] === "object" ? `{ ${getOptionsObject(plugin[1])} }` : plugin[1] ?? ""}`).join(", ")})`;
diff --git a/docs/src/css/demo/plugins.css b/docs/src/css/demo/plugins.css
index 7f05af452a..04dc9f000a 100644
--- a/docs/src/css/demo/plugins.css
+++ b/docs/src/css/demo/plugins.css
@@ -1,13 +1,9 @@
.plugins-panel {
position: relative;
- display: block;
border-radius: 5px;
width: 80%;
margin-right: 10px;
- background: #f55;
height: 200px;
- text-align: center;
- line-height: 200px;
overflow: hidden;
}
.plugins-panel:after {
diff --git a/docs/src/demo/plugins/Arrow.tsx b/docs/src/demo/plugins/Arrow.tsx
index 55bd8b6738..e5a0dd3f7e 100644
--- a/docs/src/demo/plugins/Arrow.tsx
+++ b/docs/src/demo/plugins/Arrow.tsx
@@ -34,13 +34,53 @@ export default () => {