@plasmicpkgs/plasmic-keen-slider 0.0.54 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plasmic-keen-slider.cjs.development.js +13 -21
- package/dist/plasmic-keen-slider.cjs.development.js.map +1 -1
- package/dist/plasmic-keen-slider.cjs.production.min.js +1 -1
- package/dist/plasmic-keen-slider.cjs.production.min.js.map +1 -1
- package/dist/plasmic-keen-slider.esm.js +13 -21
- package/dist/plasmic-keen-slider.esm.js.map +1 -1
- package/package.json +3 -3
|
@@ -12,30 +12,22 @@ var React = require('react');
|
|
|
12
12
|
var React__default = _interopDefault(React);
|
|
13
13
|
|
|
14
14
|
function _extends() {
|
|
15
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
16
|
-
for (var
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20
|
-
target[key] = source[key];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
15
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
16
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
17
|
+
var t = arguments[e];
|
|
18
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
23
19
|
}
|
|
24
|
-
return
|
|
25
|
-
};
|
|
26
|
-
return _extends.apply(this, arguments);
|
|
20
|
+
return n;
|
|
21
|
+
}, _extends.apply(null, arguments);
|
|
27
22
|
}
|
|
28
|
-
function _objectWithoutPropertiesLoose(
|
|
29
|
-
if (
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
key = sourceKeys[i];
|
|
35
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
36
|
-
target[key] = source[key];
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
24
|
+
if (null == r) return {};
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
27
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
28
|
+
t[n] = r[n];
|
|
37
29
|
}
|
|
38
|
-
return
|
|
30
|
+
return t;
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
var _excluded = ["editingSlide", "children", "className", "setControlContextData"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plasmic-keen-slider.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","CurrentSlideDropdown","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","_ref2","_componentProps$editi2","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","_ref3","appendToSlot","src","_ref4","contextData","_contextData$editingS","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","registerSlider","loader","customSliderMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAQA,MAAM,GAAKC,WAAM,CAAjBD,MAAM;AAEd,IAAME,YAAY,GAAqB,SAAjCA,YAAYA,CAAsBC,MAAM;EAC5C,IAAMC,QAAQ,GAAG,IAAIC,cAAc,CAAC;IAClCF,MAAM,CAACG,MAAM,EAAE;GAChB,CAAC;EAEFH,MAAM,CAACI,EAAE,CAAC,SAAS,EAAE;IACnBH,QAAQ,CAACI,OAAO,CAACL,MAAM,CAACM,SAAS,CAAC;GACnC,CAAC;EACFN,MAAM,CAACI,EAAE,CAAC,WAAW,EAAE;IACrBH,QAAQ,CAACM,SAAS,CAACP,MAAM,CAACM,SAAS,CAAC;GACrC,CAAC;AACJ,CAAC;AAED,SAASE,oBAAoBA,CAAAC,IAAA;;MAAGC,cAAc,GAAAD,IAAA,CAAdC,cAAc;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;EACvD,IAAMC,YAAY,IAAAC,qBAAA,GAAGH,cAAc,CAACE,YAAY,YAAAC,qBAAA,GAAI,CAAC;EACrD,IAAMC,SAAS,IAAAC,qBAAA,GACbL,cAAc,CAACM,QAAQ,CAACC,MAAM,YAAAF,qBAAA,GAC7BL,cAAc,CAACM,QAA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KAAK,EAAE;MAAEuE,MAAM,EAAE;;MAEhB9E,cAAK,CAAC+E,QAAQ,CAAChF,GAAG,CAACR,QAAQ,EAAE,UAACyF,KAAK;IAAA,OAClChF,cAAK,CAACiF,YAAY,CAACD,KAAK,EAAE;MACxBjB,SAAS,0BAAwBA;KAClC,CAAC;IACH,EACAxE,QAAQ,CACL,CACF;AAEV,CAAC;SAEe2F,cAAcA,CAC5BC,MAAwD,EACxDC,gBAAuD;EAEvD,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;GACxE,MAAM;IACL8D,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;;AAEpE;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plasmic-keen-slider.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","CurrentSlideDropdown","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","_ref2","_componentProps$editi2","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","_ref3","appendToSlot","src","_ref4","contextData","_contextData$editingS","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","registerSlider","loader","customSliderMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAQA,MAAM,GAAKC,WAAM,CAAjBD,MAAM;AAEd,IAAME,YAAY,GAAqB,SAAjCA,YAAYA,CAAsBC,MAAM;EAC5C,IAAMC,QAAQ,GAAG,IAAIC,cAAc,CAAC;IAClCF,MAAM,CAACG,MAAM,EAAE;GAChB,CAAC;EAEFH,MAAM,CAACI,EAAE,CAAC,SAAS,EAAE;IACnBH,QAAQ,CAACI,OAAO,CAACL,MAAM,CAACM,SAAS,CAAC;GACnC,CAAC;EACFN,MAAM,CAACI,EAAE,CAAC,WAAW,EAAE;IACrBH,QAAQ,CAACM,SAAS,CAACP,MAAM,CAACM,SAAS,CAAC;GACrC,CAAC;AACJ,CAAC;AAED,SAASE,oBAAoBA,CAAAC,IAAA;;MA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,IAAIrF,YAAY,KAAKsF,SAAS,EAAE;MAC9BF,WAAW,CAACG,OAAQ,CAACC,SAAS,CAACxF,YAAY,CAAC;;GAE/C,EAAE,CAACA,YAAY,CAAC,CAAC;EAElB,OACEa;IAAK+D,SAAS,EAAEA;KACd/D;IACE4E,GAAG,EAAEC,WAAW,CAACP,SAAS,EAAER,OAAO,CAAC;IACpCC,SAAS,EAAC;KACNzB,KAAK;IACT/B,KAAK,EAAE;MAAEuE,MAAM,EAAE;;MAEhB9E,cAAK,CAAC+E,QAAQ,CAAChF,GAAG,CAACR,QAAQ,EAAE,UAACyF,KAAK;IAAA,OAClChF,cAAK,CAACiF,YAAY,CAACD,KAAK,EAAE;MACxBjB,SAAS,0BAAwBA;KAClC,CAAC;IACH,EACAxE,QAAQ,CACL,CACF;AAEV,CAAC;SAEe2F,cAAcA,CAC5BC,MAAwD,EACxDC,gBAAuD;EAEvD,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;GACxE,MAAM;IACL8D,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;;AAEpE;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),i=e(require("@seznam/compose-react-refs")),n=require("antd"),r=require("keen-slider/react"),l=require("react"),o=e(l);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),i=e(require("@seznam/compose-react-refs")),n=require("antd"),r=require("keen-slider/react"),l=require("react"),o=e(l);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(null,arguments)}var s=["editingSlide","children","className","setControlContextData"],d=n.Select.Option,c=function(e){var t=new ResizeObserver((function(){e.update()}));e.on("created",(function(){t.observe(e.container)})),e.on("destroyed",(function(){t.unobserve(e.container)}))},p={name:"hostless-keen-slider",displayName:"Keen Slider",importName:"Slider",importPath:"@plasmicpkgs/plasmic-keen-slider",actions:[{type:"custom-action",control:function(e){var t,i,r=e.componentProps,l=e.studioOps,a=null!=(t=r.editingSlide)?t:0,s=null!=(i=r.children.length)?i:"img"===r.children.type?1:0,c=Array.from({length:s},(function(e,t){return t})).map((function(e){return o.createElement(d,{value:e.toString()},"Slide ",e+1)}));return o.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},o.createElement("div",null,"Current slide:"),o.createElement(n.Select,{defaultValue:a.toString(),style:{width:"100%"},onChange:function(e){var t=Number(e);l.updateProps({editingSlide:t%s})},value:a.toString()},c))}},{type:"custom-action",control:function(e){var t,i=e.componentProps,r=e.studioOps,l=i.children.length,a=null!=(t=i.editingSlide)?t:0;return o.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},o.createElement(n.Button,{style:{width:"100%"},onClick:function(){r.updateProps({editingSlide:(a-1+l)%l})}},"Prev slide"),o.createElement(n.Button,{style:{width:"100%"},onClick:function(){r.updateProps({editingSlide:(a+1)%l})}},"Next slide"))}},{type:"button-action",label:"Append new slide",onClick:function(e){var t=e.studioOps,i=e.componentProps.children.length;t.appendToSlot({type:"img",src:""},"children"),t.updateProps({editingSlide:i})}},{type:"button-action",label:"Delete current slide",onClick:function(e){var t,i=e.componentProps,n=e.studioOps,r=null!=(t=e.contextData.editingSlide)?t:0;n.removeFromSlotAt(r,"children");var l=i.children.length-1;n.updateProps({editingSlide:(r-1+l)%l})}},{type:"custom-action",control:function(){return o.createElement("div",null,"* To re-arrange slides, use the Outline panel")}}],props:{children:{type:"slot",defaultValue:[0,1,2].map((function(e){return{type:"vbox",children:{type:"img",src:"https://static1.plasmic.app/components/react-slick/slide"+(e+1)+".png",styles:{maxWidth:"100%"}}}}))},editingSlide:{displayName:"Currently edited slide",type:"number",description:"Switch to the specified slide (first is 0). Only affects the editor, not the final page.",defaultValueHint:0,editOnly:!0,hidden:function(){return!0}},disabled:{displayName:"Disabled",type:"boolean",description:"Disable or enable slider",defaultValueHint:!1},drag:{displayName:"Drag",type:"boolean",description:"Enables or disables mouse and touch control",defaultValueHint:!0},dragSpeed:{displayName:"Drag Speed",type:"number",description:"Set the speed that is applied to the slider when dragging it.",defaultValueHint:1},initial:{displayName:"Initial slide",type:"number",description:"Sets the index of initially visible slide",defaultValueHint:1},loop:{displayName:"Loop",type:"boolean",description:"Enable or disables carousel/loop functionality of the slider",defaultValueHint:!1},mode:{displayName:"Carousel mode",type:"choice",options:["snap","free","free-snap"],description:"Sets the animation that is applied after a drag ends",defaultValueHint:"snap"},renderMode:{displayName:"Render mode",type:"choice",options:["precision","performance","custom"],description:"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.",defaultValueHint:"precision"},rtl:{displayName:"Reverse",type:"boolean",description:"Reverses the slide order",defaultValueHint:!1},rubberband:{displayName:"Rubberband ",type:"boolean",description:"Enables or disables rubberband behavior for dragging and animation after a drag.",defaultValueHint:!0},slides:{displayName:"Number of slides",type:"number",description:"Specifies number of slider "},vertical:{displayName:"Vertical",type:"boolean",description:"Vertical slide mode",defaultValueHint:!1,helpText:"(Note: The height of the container must be defined if vertical is true)"}},defaultStyles:{width:"stretch",maxWidth:"100%",flexDirection:"column"}},u=l.forwardRef((function(e,t){var n=e.editingSlide,d=e.children,p=e.className,u=e.setControlContextData,f=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;i[n]=e[n]}return i}(e,s);null==u||u({editingSlide:n});var m=r.useKeenSlider(a({},f),[c]),h=m[0],y=m[1];return l.useEffect((function(){void 0!==n&&y.current.moveToIdx(n)}),[n]),o.createElement("div",{className:p},o.createElement("div",Object.assign({ref:i(h,t),className:"keen-slider"},f,{style:{height:"100%"}}),o.Children.map(d,(function(e){return o.cloneElement(e,{className:"keen-slider__slide "+p})})),d))}));exports.SliderWrapper=u,exports.registerSlider=function(e,i){e?e.registerComponent(u,null!=i?i:p):t(u,null!=i?i:p)},exports.sliderMeta=p;
|
|
2
2
|
//# sourceMappingURL=plasmic-keen-slider.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plasmic-keen-slider.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","sliderMeta","name","displayName","importName","importPath","actions","type","control","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","options","Array","from","_","i","map","React","value","toString","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","slideIdx","Number","updateProps","_ref2","_componentProps$editi2","Button","onClick","label","_ref3","appendToSlot","src","_ref4","_contextData$editingS","contextData","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","loader","customSliderMeta","registerComponent"],"mappings":"gmBAUQA,EAAWC,SAAXD,OAEFE,EAAiC,SAACC,GACtC,IAAMC,EAAW,IAAIC,gBAAe,WAClCF,EAAOG,YAGTH,EAAOI,GAAG,WAAW,WACnBH,EAASI,QAAQL,EAAOM,cAE1BN,EAAOI,GAAG,aAAa,WACrBH,EAASM,UAAUP,EAAOM,eAoFjBE,EAAiD,CAC5DC,KAAM,uBACNC,YAAa,cACbC,WAAY,SACZC,WAAY,mCACZC,QAAS,CACP,CACEC,KAAM,gBACNC,QAxFN,SAA6BC,WAAGC,EAAcD,EAAdC,eAAgBC,EAASF,EAATE,UACxCC,SAAYC,EAAGH,EAAeE,cAAYC,EAAI,EAC9CC,SAASC,EACbL,EAAeM,SAASC,QAAMF,EACI,QAAjCL,EAAeM,SAAST,KAAiB,EAAI,EAE1CW,EAAUC,MAAMC,KAAK,CAAEH,OAAQH,IAAa,SAACO,EAAGC,GAAC,OAAKA,KAAGC,KAAI,SAACD,GAClE,OAAOE,g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AkB,EAClBc,SACE,4EAINC,cAAe,CACbzC,MAAO,UACPwB,SAAU,OACVtB,cAAe,WAINwC,EAAgBC,cAAW,SAAuBC,EAgB7DC,OAdE7D,EAAY4D,EAAZ5D,aACAI,EAAQwD,EAARxD,SAEA0D,EAASF,EAATE,UACAC,EAAqBH,EAArBG,sBACGzB,oIAAK0B,CAAAJ,EAAAK,SAWVF,GAAAA,EAAwB,CAAE/D,aAAcA,IACxC,IAAAkE,EAAiCC,gBAAaC,KAEvC9B,GAEL,CAAC1D,IAJIyF,EAASH,KAAEI,EAAWJ,KAa7B,OANAK,aAAU,gBACaC,IAAjBxE,GACFsE,EAAYG,QAASC,UAAU1E,KAEhC,CAACA,IAGFY,uBAAKkD,UAAWA,GACdlD,qCACE+D,IAAKC,EAAYP,EAAWR,GAC5BC,UAAU,eACNxB,GACJvB,MAAO,CAAE8D,OAAQ,UAEhBjE,EAAMkE,SAASnE,IAAIP,GAAU,SAAC2E,GAAK,OAClCnE,EAAMoE,aAAaD,EAAO,CACxBjB,gCAAiCA,OAGpC1D,+DAOP6E,EACAC,GAEID,EACFA,EAAOE,kBAAkBzB,QAAewB,EAAAA,EAAoB7F,GAE5D8F,EAAkBzB,QAAewB,EAAAA,EAAoB7F"}
|
|
1
|
+
{"version":3,"file":"plasmic-keen-slider.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","sliderMeta","name","displayName","importName","importPath","actions","type","control","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","options","Array","from","_","i","map","React","value","toString","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","slideIdx","Number","updateProps","_ref2","_componentProps$editi2","Button","onClick","label","_ref3","appendToSlot","src","_ref4","_contextData$editingS","contextData","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","loader","customSliderMeta","registerComponent"],"mappings":"olBAUQA,EAAWC,SAAXD,OAEFE,EAAiC,SAACC,GACtC,IAAMC,EAAW,IAAIC,gBAAe,WAClCF,EAAOG,YAGTH,EAAOI,GAAG,WAAW,WACnBH,EAASI,QAAQL,EAAOM,cAE1BN,EAAOI,GAAG,aAAa,WACrBH,EAASM,UAAUP,EAAOM,eAoFjBE,EAAiD,CAC5DC,KAAM,uBACNC,YAAa,cACbC,WAAY,SACZC,WAAY,mCACZC,QAAS,CACP,CACEC,KAAM,gBACNC,QAxFN,SAA6B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,YACE,gTACFC,iBAAkB,aAEpBU,IAAK,CACH7D,YAAa,UACbI,KAAM,UACN8C,YAAa,2BACbC,kBAAkB,GAGpBW,WAAY,CACV9D,YAAa,cACbI,KAAM,UACN8C,YACE,mFACFC,kBAAkB,GAEpBY,OAAQ,CACN/D,YAAa,mBACbI,KAAM,SACN8C,YAAa,+BAGfc,SAAU,CACRhE,YAAa,WACbI,KAAM,UACN8C,YAAa,sBACbC,kBAAkB,EAClBc,SACE,4EAINC,cAAe,CACbzC,MAAO,UACPwB,SAAU,OACVtB,cAAe,WAINwC,EAAgBC,cAAW,SAAuBC,EAgB7DC,OAdE7D,EAAY4D,EAAZ5D,aACAI,EAAQwD,EAARxD,SAEA0D,EAASF,EAATE,UACAC,EAAqBH,EAArBG,sBACGzB,6IAAK0B,CAAAJ,EAAAK,SAWVF,GAAAA,EAAwB,CAAE/D,aAAcA,IACxC,IAAAkE,EAAiCC,gBAAaC,KAEvC9B,GAEL,CAAC1D,IAJIyF,EAASH,KAAEI,EAAWJ,KAa7B,OANAK,aAAU,gBACaC,IAAjBxE,GACFsE,EAAYG,QAASC,UAAU1E,KAEhC,CAACA,IAGFY,uBAAKkD,UAAWA,GACdlD,qCACE+D,IAAKC,EAAYP,EAAWR,GAC5BC,UAAU,eACNxB,GACJvB,MAAO,CAAE8D,OAAQ,UAEhBjE,EAAMkE,SAASnE,IAAIP,GAAU,SAAC2E,GAAK,OAClCnE,EAAMoE,aAAaD,EAAO,CACxBjB,gCAAiCA,OAGpC1D,+DAOP6E,EACAC,GAEID,EACFA,EAAOE,kBAAkBzB,QAAewB,EAAAA,EAAoB7F,GAE5D8F,EAAkBzB,QAAewB,EAAAA,EAAoB7F"}
|
|
@@ -5,30 +5,22 @@ import { useKeenSlider } from 'keen-slider/react';
|
|
|
5
5
|
import React, { forwardRef, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
function _extends() {
|
|
8
|
-
_extends = Object.assign ? Object.assign.bind() : function (
|
|
9
|
-
for (var
|
|
10
|
-
var
|
|
11
|
-
for (var
|
|
12
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13
|
-
target[key] = source[key];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
8
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
9
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
10
|
+
var t = arguments[e];
|
|
11
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
16
12
|
}
|
|
17
|
-
return
|
|
18
|
-
};
|
|
19
|
-
return _extends.apply(this, arguments);
|
|
13
|
+
return n;
|
|
14
|
+
}, _extends.apply(null, arguments);
|
|
20
15
|
}
|
|
21
|
-
function _objectWithoutPropertiesLoose(
|
|
22
|
-
if (
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
key = sourceKeys[i];
|
|
28
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
29
|
-
target[key] = source[key];
|
|
16
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
17
|
+
if (null == r) return {};
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
20
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
21
|
+
t[n] = r[n];
|
|
30
22
|
}
|
|
31
|
-
return
|
|
23
|
+
return t;
|
|
32
24
|
}
|
|
33
25
|
|
|
34
26
|
var _excluded = ["editingSlide", "children", "className", "setControlContextData"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plasmic-keen-slider.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","CurrentSlideDropdown","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","_ref2","_componentProps$editi2","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","_ref3","appendToSlot","src","_ref4","contextData","_contextData$editingS","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","registerSlider","loader","customSliderMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAQA,MAAM,GAAKC,MAAM,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version":3,"file":"plasmic-keen-slider.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ActionProps,\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { Button, Select } from \"antd\";\nimport { KeenSliderOptions } from \"keen-slider\";\nimport { KeenSliderPlugin, useKeenSlider } from \"keen-slider/react\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\n\nconst { Option } = Select;\n\nconst ResizePlugin: KeenSliderPlugin = (slider) => {\n const observer = new ResizeObserver(function () {\n slider.update();\n });\n\n slider.on(\"created\", () => {\n observer.observe(slider.container);\n });\n slider.on(\"destroyed\", () => {\n observer.unobserve(slider.container);\n });\n};\n\nfunction CurrentSlideDropdown({ componentProps, studioOps }: ActionProps<any>) {\n const editingSlide = componentProps.editingSlide ?? 0;\n const slidesCnt =\n componentProps.children.length ??\n (componentProps.children.type === \"img\" ? 1 : 0);\n\n const options = Array.from({ length: slidesCnt }, (_, i) => i).map((i) => {\n return <Option value={i.toString()}>Slide {i + 1}</Option>;\n });\n\n const handleChange = (value: string) => {\n const slideIdx = Number(value);\n studioOps.updateProps({ editingSlide: slideIdx % slidesCnt });\n };\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <div>Current slide:</div>\n <Select\n defaultValue={editingSlide.toString()}\n style={{ width: \"100%\" }}\n onChange={handleChange}\n value={editingSlide.toString()}\n >\n {options}\n </Select>\n </div>\n );\n}\n\nfunction NavigateSlides({ componentProps, studioOps }: ActionProps<any>) {\n const slidesCnt = componentProps.children.length;\n const editingSlide = componentProps.editingSlide ?? 0;\n\n return (\n <div\n style={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: \"10px\",\n justifyContent: \"space-between\",\n }}\n >\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;\n studioOps.updateProps({ editingSlide: prevSlide });\n }}\n >\n Prev slide\n </Button>\n <Button\n style={{ width: \"100%\" }}\n onClick={() => {\n const nextSlide = (editingSlide + 1) % slidesCnt;\n studioOps.updateProps({ editingSlide: nextSlide });\n }}\n >\n Next slide\n </Button>\n </div>\n );\n}\n\nfunction OutlineMessage() {\n return <div>* To re-arrange slides, use the Outline panel</div>;\n}\n\ninterface KeenSliderProps extends KeenSliderOptions {}\n\nexport const sliderMeta: CodeComponentMeta<KeenSliderProps> = {\n name: \"hostless-keen-slider\",\n displayName: \"Keen Slider\",\n importName: \"Slider\",\n importPath: \"@plasmicpkgs/plasmic-keen-slider\",\n actions: [\n {\n type: \"custom-action\",\n control: CurrentSlideDropdown,\n },\n {\n type: \"custom-action\",\n control: NavigateSlides,\n },\n {\n type: \"button-action\",\n label: \"Append new slide\",\n onClick: ({ componentProps, studioOps }: ActionProps<any>) => {\n const slidesCnt = componentProps.children.length;\n studioOps.appendToSlot(\n {\n type: \"img\",\n src: \"\",\n },\n \"children\"\n );\n studioOps.updateProps({ editingSlide: slidesCnt });\n },\n },\n {\n type: \"button-action\",\n label: \"Delete current slide\",\n onClick: ({\n componentProps,\n contextData,\n studioOps,\n }: ActionProps<any>) => {\n const editingSlide = contextData.editingSlide ?? 0;\n studioOps.removeFromSlotAt(editingSlide, \"children\");\n const slidesCnt = componentProps.children.length - 1;\n studioOps.updateProps({\n editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt,\n });\n },\n },\n {\n type: \"custom-action\",\n control: OutlineMessage,\n },\n ],\n props: {\n children: {\n type: \"slot\",\n defaultValue: [0, 1, 2].map((i) => ({\n type: \"vbox\",\n children: {\n type: \"img\",\n src:\n \"https://static1.plasmic.app/components/react-slick/slide\" +\n (i + 1) +\n \".png\",\n styles: {\n maxWidth: \"100%\",\n },\n },\n })),\n },\n editingSlide: {\n displayName: \"Currently edited slide\",\n type: \"number\",\n description:\n \"Switch to the specified slide (first is 0). Only affects the editor, not the final page.\",\n defaultValueHint: 0,\n editOnly: true,\n hidden: () => true,\n },\n disabled: {\n displayName: \"Disabled\",\n type: \"boolean\",\n description: \"Disable or enable slider\",\n defaultValueHint: false,\n },\n drag: {\n displayName: \"Drag\",\n type: \"boolean\",\n description: \"Enables or disables mouse and touch control\",\n defaultValueHint: true,\n },\n dragSpeed: {\n displayName: \"Drag Speed\",\n type: \"number\",\n description:\n \"Set the speed that is applied to the slider when dragging it.\",\n defaultValueHint: 1,\n },\n initial: {\n displayName: \"Initial slide\",\n type: \"number\",\n description: \"Sets the index of initially visible slide\",\n defaultValueHint: 1,\n },\n loop: {\n displayName: \"Loop\",\n type: \"boolean\",\n description:\n \"Enable or disables carousel/loop functionality of the slider\",\n defaultValueHint: false,\n },\n\n mode: {\n displayName: \"Carousel mode\",\n type: \"choice\",\n options: [\"snap\", \"free\", \"free-snap\"],\n description: \"Sets the animation that is applied after a drag ends\",\n defaultValueHint: \"snap\",\n },\n renderMode: {\n displayName: \"Render mode\",\n type: \"choice\",\n options: [\"precision\", \"performance\", \"custom\"],\n description:\n \"It is possible that the render performance of the browser slows down, if you have slides with some complexity in markup and CSS. To counteract this problem, you can set this option to 'performance'. If you want to create your own renderer, you can set this options to 'custom'. Default is 'precision'.\",\n defaultValueHint: \"precision\",\n },\n rtl: {\n displayName: \"Reverse\",\n type: \"boolean\",\n description: \"Reverses the slide order\",\n defaultValueHint: false,\n },\n\n rubberband: {\n displayName: \"Rubberband \",\n type: \"boolean\",\n description:\n \"Enables or disables rubberband behavior for dragging and animation after a drag.\",\n defaultValueHint: true,\n },\n slides: {\n displayName: \"Number of slides\",\n type: \"number\",\n description: \"Specifies number of slider \",\n },\n\n vertical: {\n displayName: \"Vertical\",\n type: \"boolean\",\n description: \"Vertical slide mode\",\n defaultValueHint: false,\n helpText:\n \"(Note: The height of the container must be defined if vertical is true)\",\n },\n },\n\n defaultStyles: {\n width: \"stretch\",\n maxWidth: \"100%\",\n flexDirection: \"column\",\n },\n};\n\nexport const SliderWrapper = forwardRef(function SliderWrapper_(\n {\n editingSlide,\n children,\n\n className,\n setControlContextData,\n ...props\n }: KeenSliderProps & {\n className?: string;\n editingSlide?: number;\n children?: any;\n setControlContextData?: (data: {\n editingSlide: number | undefined;\n }) => void;\n },\n userRef?: Ref<HTMLDivElement>\n) {\n setControlContextData?.({ editingSlide: editingSlide });\n const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>(\n {\n ...props,\n },\n [ResizePlugin]\n );\n\n useEffect(() => {\n if (editingSlide !== undefined) {\n instanceRef.current!.moveToIdx(editingSlide);\n }\n }, [editingSlide]);\n\n return (\n <div className={className}>\n <div\n ref={composeRefs(sliderRef, userRef)}\n className=\"keen-slider\"\n {...props}\n style={{ height: \"100%\" }}\n >\n {React.Children.map(children, (child) =>\n React.cloneElement(child, {\n className: `keen-slider__slide ${className}`,\n })\n )}\n {children}\n </div>\n </div>\n );\n});\n\nexport function registerSlider(\n loader?: { registerComponent: typeof registerComponent },\n customSliderMeta?: CodeComponentMeta<KeenSliderOptions>\n) {\n if (loader) {\n loader.registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n } else {\n registerComponent(SliderWrapper, customSliderMeta ?? sliderMeta);\n }\n}\n"],"names":["Option","Select","ResizePlugin","slider","observer","ResizeObserver","update","on","observe","container","unobserve","CurrentSlideDropdown","_ref","componentProps","studioOps","editingSlide","_componentProps$editi","slidesCnt","_componentProps$child","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","_ref2","_componentProps$editi2","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","_ref3","appendToSlot","src","_ref4","contextData","_contextData$editingS","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","_ref5","userRef","className","setControlContextData","_objectWithoutPropertiesLoose","_excluded","_useKeenSlider","useKeenSlider","_extends","sliderRef","instanceRef","useEffect","undefined","current","moveToIdx","ref","composeRefs","height","Children","child","cloneElement","registerSlider","loader","customSliderMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAQA,MAAM,GAAKC,MAAM,CAAjBD,MAAM;AAEd,IAAME,YAAY,GAAqB,SAAjCA,YAAYA,CAAsBC,MAAM;EAC5C,IAAMC,QAAQ,GAAG,IAAIC,cAAc,CAAC;IAClCF,MAAM,CAACG,MAAM,EAAE;GAChB,CAAC;EAEFH,MAAM,CAACI,EAAE,CAAC,SAAS,EAAE;IACnBH,QAAQ,CAACI,OAAO,CAACL,MAAM,CAACM,SAAS,CAAC;GACnC,CAAC;EACFN,MAAM,CAACI,EAAE,CAAC,WAAW,EAAE;IACrBH,QAAQ,CAACM,SAAS,CAACP,MAAM,CAACM,SAAS,CAAC;GACrC,CAAC;AACJ,CAAC;AAED,SAASE,oBAAoBA,CAAAC,IAAA;;MAAGC,cAAc,GAAAD,IAAA,CAAdC,cAAc;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;EACvD,IAAMC,YAAY,IAAAC,qBAAA,GAAGH,cAAc,CAACE,YAAY,YAAAC,qBAAA,GAAI,CAAC;EACrD,IAAMC,SAAS,IAAAC,qBAAA,GACbL,cAAc,CAACM,QAAQ,CAACC,MAAM,YAAAF,qBAAA,GAC7BL,cAAc,CAACM,QAAQ,CAACE,IAAI,KAAK,KAAK,GAAG,CAAC,GAAG,CAAE;EAElD,IAAMC,OAAO,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEJ,MAAM,EAAEH;GAAW,EAAE,UAACQ,CAAC,EAAEC,CAAC;IAAA,OAAKA,CAAC;IAAC,CAACC,GAAG,CAAC,UAACD,CAAC;IACnE,OAAOE,oBAAC5B,MAAM;MAAC6B,KAAK,EAAEH,CAAC,C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BAAuD;EAEvD,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;GACxE,MAAM;IACL8D,iBAAiB,CAAC3B,aAAa,EAAE0B,gBAAgB,WAAhBA,gBAAgB,GAAI7D,UAAU,CAAC;;AAEpE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/plasmic-keen-slider",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "Plasmic Keen slider components.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@plasmicapp/host": "1.0.
|
|
37
|
+
"@plasmicapp/host": "1.0.212",
|
|
38
38
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
39
39
|
"@types/react": "^18.0.27",
|
|
40
40
|
"@types/react-dom": "^18.0.10",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"antd": "^5.8.4",
|
|
51
51
|
"keen-slider": "^6.8.6"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "e14716fd42ea79a35e4844d660f6d12aa97a9768"
|
|
54
54
|
}
|