@plasmicpkgs/plasmic-keen-slider 0.0.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Latipov Abdukhamid
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ Plasmic components and registration calls for Keen slider
@@ -0,0 +1,18 @@
1
+ import registerComponent, { CodeComponentMeta } from "@plasmicapp/host/registerComponent";
2
+ import React from "react";
3
+ import { KeenSliderOptions } from "keen-slider";
4
+ interface KeenSliderProps extends KeenSliderOptions {
5
+ }
6
+ export declare const sliderMeta: CodeComponentMeta<KeenSliderProps>;
7
+ export declare const SliderWrapper: React.ForwardRefExoticComponent<KeenSliderProps & {
8
+ className?: string | undefined;
9
+ editingSlide?: number | undefined;
10
+ children?: any;
11
+ setControlContextData?: ((data: {
12
+ editingSlide: number | undefined;
13
+ }) => void) | undefined;
14
+ } & React.RefAttributes<HTMLDivElement>>;
15
+ export declare function registerSlider(loader?: {
16
+ registerComponent: typeof registerComponent;
17
+ }, customSliderMeta?: CodeComponentMeta<KeenSliderOptions>): void;
18
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+
2
+ 'use strict'
3
+
4
+ if (process.env.NODE_ENV === 'production') {
5
+ module.exports = require('./plasmic-keen-slider.cjs.production.min.js')
6
+ } else {
7
+ module.exports = require('./plasmic-keen-slider.cjs.development.js')
8
+ }
@@ -0,0 +1,320 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var registerComponent = _interopDefault(require('@plasmicapp/host/registerComponent'));
8
+ var antd = require('antd');
9
+ var React = require('react');
10
+ var React__default = _interopDefault(React);
11
+ var react = require('keen-slider/react');
12
+ var composeRefs = _interopDefault(require('@seznam/compose-react-refs'));
13
+
14
+ function _extends() {
15
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i];
18
+ for (var key in source) {
19
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
20
+ target[key] = source[key];
21
+ }
22
+ }
23
+ }
24
+ return target;
25
+ };
26
+ return _extends.apply(this, arguments);
27
+ }
28
+ function _objectWithoutPropertiesLoose(source, excluded) {
29
+ if (source == null) return {};
30
+ var target = {};
31
+ var sourceKeys = Object.keys(source);
32
+ var key, i;
33
+ for (i = 0; i < sourceKeys.length; i++) {
34
+ key = sourceKeys[i];
35
+ if (excluded.indexOf(key) >= 0) continue;
36
+ target[key] = source[key];
37
+ }
38
+ return target;
39
+ }
40
+
41
+ var _excluded = ["editingSlide", "children", "className", "setControlContextData"];
42
+ var Option = antd.Select.Option;
43
+ var ResizePlugin = function ResizePlugin(slider) {
44
+ var observer = new ResizeObserver(function () {
45
+ slider.update();
46
+ });
47
+ slider.on("created", function () {
48
+ observer.observe(slider.container);
49
+ });
50
+ slider.on("destroyed", function () {
51
+ observer.unobserve(slider.container);
52
+ });
53
+ };
54
+ function CurrentSlideDropdown(_ref) {
55
+ var _componentProps$editi, _componentProps$child;
56
+ var componentProps = _ref.componentProps,
57
+ studioOps = _ref.studioOps;
58
+ var editingSlide = (_componentProps$editi = componentProps.editingSlide) != null ? _componentProps$editi : 0;
59
+ var slidesCnt = (_componentProps$child = componentProps.children.length) != null ? _componentProps$child : componentProps.children.type === "img" ? 1 : 0;
60
+ var options = Array.from({
61
+ length: slidesCnt
62
+ }, function (_, i) {
63
+ return i;
64
+ }).map(function (i) {
65
+ return React__default.createElement(Option, {
66
+ value: i.toString()
67
+ }, "Slide ", i + 1);
68
+ });
69
+ var handleChange = function handleChange(value) {
70
+ var slideIdx = Number(value);
71
+ studioOps.updateProps({
72
+ editingSlide: slideIdx % slidesCnt
73
+ });
74
+ };
75
+ return React__default.createElement("div", {
76
+ style: {
77
+ width: "100%",
78
+ display: "flex",
79
+ flexDirection: "row",
80
+ gap: "10px",
81
+ justifyContent: "space-between"
82
+ }
83
+ }, React__default.createElement("div", null, "Current slide:"), React__default.createElement(antd.Select, {
84
+ defaultValue: editingSlide.toString(),
85
+ style: {
86
+ width: "100%"
87
+ },
88
+ onChange: handleChange,
89
+ value: editingSlide.toString()
90
+ }, options));
91
+ }
92
+ function NavigateSlides(_ref2) {
93
+ var _componentProps$editi2;
94
+ var componentProps = _ref2.componentProps,
95
+ studioOps = _ref2.studioOps;
96
+ var slidesCnt = componentProps.children.length;
97
+ var editingSlide = (_componentProps$editi2 = componentProps.editingSlide) != null ? _componentProps$editi2 : 0;
98
+ return React__default.createElement("div", {
99
+ style: {
100
+ width: "100%",
101
+ display: "flex",
102
+ flexDirection: "row",
103
+ gap: "10px",
104
+ justifyContent: "space-between"
105
+ }
106
+ }, React__default.createElement(antd.Button, {
107
+ style: {
108
+ width: "100%"
109
+ },
110
+ onClick: function onClick() {
111
+ var prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;
112
+ studioOps.updateProps({
113
+ editingSlide: prevSlide
114
+ });
115
+ }
116
+ }, "Prev slide"), React__default.createElement(antd.Button, {
117
+ style: {
118
+ width: "100%"
119
+ },
120
+ onClick: function onClick() {
121
+ var nextSlide = (editingSlide + 1) % slidesCnt;
122
+ studioOps.updateProps({
123
+ editingSlide: nextSlide
124
+ });
125
+ }
126
+ }, "Next slide"));
127
+ }
128
+ function OutlineMessage() {
129
+ return React__default.createElement("div", null, "* To re-arrange slides, use the Outline panel");
130
+ }
131
+ var sliderMeta = {
132
+ name: "hostless-slider",
133
+ displayName: "Slider",
134
+ importName: "Slider",
135
+ importPath: "keen-slider",
136
+ actions: [{
137
+ type: "custom-action",
138
+ control: CurrentSlideDropdown
139
+ }, {
140
+ type: "custom-action",
141
+ control: NavigateSlides
142
+ }, {
143
+ type: "button-action",
144
+ label: "Append new slide",
145
+ onClick: function onClick(_ref3) {
146
+ var componentProps = _ref3.componentProps,
147
+ studioOps = _ref3.studioOps;
148
+ var slidesCnt = componentProps.children.length;
149
+ studioOps.appendToSlot({
150
+ type: "img",
151
+ src: ""
152
+ }, "children");
153
+ studioOps.updateProps({
154
+ editingSlide: slidesCnt
155
+ });
156
+ }
157
+ }, {
158
+ type: "button-action",
159
+ label: "Delete current slide",
160
+ onClick: function onClick(_ref4) {
161
+ var _contextData$editingS;
162
+ var componentProps = _ref4.componentProps,
163
+ contextData = _ref4.contextData,
164
+ studioOps = _ref4.studioOps;
165
+ var editingSlide = (_contextData$editingS = contextData.editingSlide) != null ? _contextData$editingS : 0;
166
+ studioOps.removeFromSlotAt(editingSlide, "children");
167
+ var slidesCnt = componentProps.children.length - 1;
168
+ studioOps.updateProps({
169
+ editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt
170
+ });
171
+ }
172
+ }, {
173
+ type: "custom-action",
174
+ control: OutlineMessage
175
+ }],
176
+ props: {
177
+ children: {
178
+ type: "slot",
179
+ defaultValue: /*#__PURE__*/[0, 1, 2].map(function (i) {
180
+ return {
181
+ type: "vbox",
182
+ children: {
183
+ type: "img",
184
+ src: "https://static1.plasmic.app/components/react-slick/slide" + (i + 1) + ".png",
185
+ styles: {
186
+ maxWidth: "100%"
187
+ }
188
+ }
189
+ };
190
+ })
191
+ },
192
+ editingSlide: {
193
+ displayName: "Currently edited slide",
194
+ type: "number",
195
+ description: "Switch to the specified slide (first is 0). Only affects the editor, not the final page.",
196
+ defaultValueHint: 0,
197
+ editOnly: true,
198
+ hidden: function hidden() {
199
+ return true;
200
+ }
201
+ },
202
+ disabled: {
203
+ displayName: "Disabled",
204
+ type: "boolean",
205
+ description: "Disable or enable slider",
206
+ defaultValueHint: false
207
+ },
208
+ drag: {
209
+ displayName: "Drag",
210
+ type: "boolean",
211
+ description: "Enables or disables mouse and touch control",
212
+ defaultValueHint: true
213
+ },
214
+ dragSpeed: {
215
+ displayName: "Drag Speed",
216
+ type: "number",
217
+ description: "Set the speed that is applied to the slider when dragging it.",
218
+ defaultValueHint: 1
219
+ },
220
+ initial: {
221
+ displayName: "Initial slide",
222
+ type: "number",
223
+ description: "Sets the index of initially visible slide",
224
+ defaultValueHint: 1
225
+ },
226
+ loop: {
227
+ displayName: "Loop",
228
+ type: "boolean",
229
+ description: "Enable or disables carousel/loop functionality of the slider",
230
+ defaultValueHint: false
231
+ },
232
+ mode: {
233
+ displayName: "Carousel mode",
234
+ type: "choice",
235
+ options: ["snap", "free", "free-snap"],
236
+ description: "Sets the animation that is applied after a drag ends",
237
+ defaultValueHint: "snap"
238
+ },
239
+ renderMode: {
240
+ displayName: "Render mode",
241
+ type: "choice",
242
+ options: ["precision", "performance", "custom"],
243
+ 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'.",
244
+ defaultValueHint: "precision"
245
+ },
246
+ rtl: {
247
+ displayName: "Reverse",
248
+ type: "boolean",
249
+ description: "Reverses the slide order",
250
+ defaultValueHint: false
251
+ },
252
+ rubberband: {
253
+ displayName: "Rubberband ",
254
+ type: "boolean",
255
+ description: "Enables or disables rubberband behavior for dragging and animation after a drag.",
256
+ defaultValueHint: true
257
+ },
258
+ slides: {
259
+ displayName: "Number of slides",
260
+ type: "number",
261
+ description: "Specifies number of slider "
262
+ },
263
+ vertical: {
264
+ displayName: "Vertical",
265
+ type: "boolean",
266
+ description: "Vertical slide mode",
267
+ defaultValueHint: false,
268
+ helpText: "(Note: The height of the container must be defined if vertical is true)"
269
+ }
270
+ },
271
+ defaultStyles: {
272
+ width: "stretch",
273
+ maxWidth: "100%",
274
+ flexDirection: "column"
275
+ }
276
+ };
277
+ var SliderWrapper = /*#__PURE__*/React.forwardRef(function SliderWrapper_(_ref5, userRef) {
278
+ var editingSlide = _ref5.editingSlide,
279
+ children = _ref5.children,
280
+ className = _ref5.className,
281
+ setControlContextData = _ref5.setControlContextData,
282
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded);
283
+ setControlContextData == null ? void 0 : setControlContextData({
284
+ editingSlide: editingSlide
285
+ });
286
+ var _useKeenSlider = react.useKeenSlider(_extends({}, props), [ResizePlugin]),
287
+ sliderRef = _useKeenSlider[0],
288
+ instanceRef = _useKeenSlider[1];
289
+ React.useEffect(function () {
290
+ if (editingSlide !== undefined) {
291
+ instanceRef.current.moveToIdx(editingSlide);
292
+ }
293
+ }, [editingSlide]);
294
+ return React__default.createElement("div", {
295
+ className: className
296
+ }, React__default.createElement("div", Object.assign({
297
+ ref: composeRefs(sliderRef, userRef),
298
+ className: "keen-slider"
299
+ }, props, {
300
+ style: {
301
+ height: "100%"
302
+ }
303
+ }), React__default.Children.map(children, function (child) {
304
+ return React__default.cloneElement(child, {
305
+ className: "keen-slider__slide " + className
306
+ });
307
+ }), children));
308
+ });
309
+ function registerSlider(loader, customSliderMeta) {
310
+ if (loader) {
311
+ loader.registerComponent(SliderWrapper, customSliderMeta != null ? customSliderMeta : sliderMeta);
312
+ } else {
313
+ registerComponent(SliderWrapper, customSliderMeta != null ? customSliderMeta : sliderMeta);
314
+ }
315
+ }
316
+
317
+ exports.SliderWrapper = SliderWrapper;
318
+ exports.registerSlider = registerSlider;
319
+ exports.sliderMeta = sliderMeta;
320
+ //# sourceMappingURL=plasmic-keen-slider.cjs.development.js.map
@@ -0,0 +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 { Button, Select } from \"antd\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\nimport { useKeenSlider, KeenSliderPlugin } from \"keen-slider/react\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { KeenSliderOptions } from \"keen-slider\";\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-slider\",\n displayName: \"Slider\",\n importName: \"Slider\",\n importPath: \"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","componentProps","studioOps","editingSlide","slidesCnt","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","appendToSlot","src","contextData","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","userRef","className","setControlContextData","useKeenSlider","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,YAAY,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,oBAAoB;;MAAGC,cAAc,QAAdA,cAAc;IAAEC,SAAS,QAATA,SAAS;EACvD,IAAMC,YAAY,4BAAGF,cAAc,CAACE,YAAY,oCAAI,CAAC;EACrD,IAAMC,SAAS,4BACbH,cAAc,CAACI,QAAQ,CAACC,MAAM,oCAC7BL,cAAc,CAACI,QAAQ,CAACE,IAAI,KAAK,KAAK,GAAG,CAAC,GAAG,CAAE;EAElD,IAAMC,OAAO,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEJ,MAAM,EAAEF;GAAW,EAAE,UAACO,CAAC,EAAEC,CAAC;IAAA,OAAKA,CAAC;IAAC,CAACC,G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,SAASC,cAAc,QAgB7DC,OAA6B;MAd3BnE,YAAY,SAAZA,YAAY;IACZE,QAAQ,SAARA,QAAQ;IAERkE,SAAS,SAATA,SAAS;IACTC,qBAAqB,SAArBA,qBAAqB;IAClBzB,KAAK;EAWVyB,qBAAqB,oBAArBA,qBAAqB,CAAG;IAAErE,YAAY,EAAEA;GAAc,CAAC;EACvD,qBAAiCsE,mBAAa,cAEvC1B,KAAK,GAEV,CAACxD,YAAY,CAAC,CACf;IALMmF,SAAS;IAAEC,WAAW;EAO7BC,eAAS,CAAC;IACR,IAAIzE,YAAY,KAAK0E,SAAS,EAAE;MAC9BF,WAAW,CAACG,OAAQ,CAACC,SAAS,CAAC5E,YAAY,CAAC;;GAE/C,EAAE,CAACA,YAAY,CAAC,CAAC;EAElB,OACEW;IAAKyD,SAAS,EAAEA;KACdzD;IACEkE,GAAG,EAAEC,WAAW,CAACP,SAAS,EAAEJ,OAAO,CAAC;IACpCC,SAAS,EAAC;KACNxB,KAAK;IACT1B,KAAK,EAAE;MAAE6D,MAAM,EAAE;;MAEhBpE,cAAK,CAACqE,QAAQ,CAACtE,GAAG,CAACR,QAAQ,EAAE,UAAC+E,KAAK;IAAA,OAClCtE,cAAK,CAACuE,YAAY,CAACD,KAAK,EAAE;MACxBb,SAAS,0BAAwBA;KAClC,CAAC;IACH,EACAlE,QAAQ,CACL,CACF;AAEV,CAAC;SAEeiF,cAAc,CAC5BC,MAAwD,EACxDC,gBAAuD;EAEvD,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAACtB,aAAa,EAAEqB,gBAAgB,WAAhBA,gBAAgB,GAAIrD,UAAU,CAAC;GACxE,MAAM;IACLsD,iBAAiB,CAACtB,aAAa,EAAEqB,gBAAgB,WAAhBA,gBAAgB,GAAIrD,UAAU,CAAC;;AAEpE;;;;;;"}
@@ -0,0 +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=require("antd"),n=require("react"),r=e(n),l=require("keen-slider/react"),o=e(require("@seznam/compose-react-refs"));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)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var s=["editingSlide","children","className","setControlContextData"],d=i.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-slider",displayName:"Slider",importName:"Slider",importPath:"keen-slider",actions:[{type:"custom-action",control:function(e){var t,n,l=e.componentProps,o=e.studioOps,a=null!=(t=l.editingSlide)?t:0,s=null!=(n=l.children.length)?n:"img"===l.children.type?1:0,c=Array.from({length:s},(function(e,t){return t})).map((function(e){return r.createElement(d,{value:e.toString()},"Slide ",e+1)}));return r.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},r.createElement("div",null,"Current slide:"),r.createElement(i.Select,{defaultValue:a.toString(),style:{width:"100%"},onChange:function(e){var t=Number(e);o.updateProps({editingSlide:t%s})},value:a.toString()},c))}},{type:"custom-action",control:function(e){var t,n=e.componentProps,l=e.studioOps,o=n.children.length,a=null!=(t=n.editingSlide)?t:0;return r.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:"10px",justifyContent:"space-between"}},r.createElement(i.Button,{style:{width:"100%"},onClick:function(){l.updateProps({editingSlide:(a-1+o)%o})}},"Prev slide"),r.createElement(i.Button,{style:{width:"100%"},onClick:function(){l.updateProps({editingSlide:(a+1)%o})}},"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 r.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=n.forwardRef((function(e,t){var i=e.editingSlide,d=e.children,p=e.className,u=e.setControlContextData,f=function(e,t){if(null==e)return{};var i,n,r={},l=Object.keys(e);for(n=0;n<l.length;n++)t.indexOf(i=l[n])>=0||(r[i]=e[i]);return r}(e,s);null==u||u({editingSlide:i});var m=l.useKeenSlider(a({},f),[c]),h=m[0],y=m[1];return n.useEffect((function(){void 0!==i&&y.current.moveToIdx(i)}),[i]),r.createElement("div",{className:p},r.createElement("div",Object.assign({ref:o(h,t),className:"keen-slider"},f,{style:{height:"100%"}}),r.Children.map(d,(function(e){return r.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
+ //# sourceMappingURL=plasmic-keen-slider.cjs.production.min.js.map
@@ -0,0 +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 { Button, Select } from \"antd\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\nimport { useKeenSlider, KeenSliderPlugin } from \"keen-slider/react\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { KeenSliderOptions } from \"keen-slider\";\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-slider\",\n displayName: \"Slider\",\n importName: \"Slider\",\n importPath: \"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","componentProps","studioOps","editingSlide","slidesCnt","children","length","options","Array","from","_","i","map","React","value","toString","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","slideIdx","Number","updateProps","Button","onClick","label","appendToSlot","src","contextData","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","userRef","className","setControlContextData","useKeenSlider","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,kBACNC,YAAa,SACbC,WAAY,SACZC,WAAY,cACZC,QAAS,CACP,CACEC,KAAM,gBACNC,QAxFN,oBAAgCC,IAAAA,eAAgBC,IAAAA,UACxCC,WAAeF,EAAeE,gBAAgB,EAC9CC,WACJH,EAAeI,SAASC,UACU,QAAjCL,EAAeI,SAASN,KAAiB,EAAI,EAE1CQ,EAAUC,MAAMC,KAAK,CAAEH,OAAQF,IAAa,SAACM,EAAGC,GAAC,OAAKA,KAAGC,KAAI,SAACD,GAClE,OAAOE,gBAAC/B,GAAOgC,MAAOH,EAAEI,qBAAmBJ,EAAI,MAQjD,OACEE,uBACEG,MAAO,CACLC,MAAO,OACPC,QAAS,OACTC,cAAe,MACfC,IAAK,OACLC,eAAgB,kB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IAJI4E,OAAWC,OAalB,OANAC,aAAU,gBACaC,IAAjB5D,GACF0D,EAAYG,QAASC,UAAU9D,KAEhC,CAACA,IAGFU,uBAAK4C,UAAWA,GACd5C,qCACEqD,IAAKC,EAAYP,EAAWJ,GAC5BC,UAAU,eACNvB,GACJlB,MAAO,CAAEoD,OAAQ,UAEhBvD,EAAMwD,SAASzD,IAAIP,GAAU,SAACiE,GAAK,OAClCzD,EAAM0D,aAAaD,EAAO,CACxBb,gCAAiCA,OAGpCpD,+DAOPmE,EACAC,GAEID,EACFA,EAAOE,kBAAkBpB,QAAemB,EAAAA,EAAoBhF,GAE5DiF,EAAkBpB,QAAemB,EAAAA,EAAoBhF"}
@@ -0,0 +1,311 @@
1
+ import registerComponent from '@plasmicapp/host/registerComponent';
2
+ import { Select, Button } from 'antd';
3
+ import React, { forwardRef, useEffect } from 'react';
4
+ import { useKeenSlider } from 'keen-slider/react';
5
+ import composeRefs from '@seznam/compose-react-refs';
6
+
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+ function _objectWithoutPropertiesLoose(source, excluded) {
22
+ if (source == null) return {};
23
+ var target = {};
24
+ var sourceKeys = Object.keys(source);
25
+ var key, i;
26
+ for (i = 0; i < sourceKeys.length; i++) {
27
+ key = sourceKeys[i];
28
+ if (excluded.indexOf(key) >= 0) continue;
29
+ target[key] = source[key];
30
+ }
31
+ return target;
32
+ }
33
+
34
+ var _excluded = ["editingSlide", "children", "className", "setControlContextData"];
35
+ var Option = Select.Option;
36
+ var ResizePlugin = function ResizePlugin(slider) {
37
+ var observer = new ResizeObserver(function () {
38
+ slider.update();
39
+ });
40
+ slider.on("created", function () {
41
+ observer.observe(slider.container);
42
+ });
43
+ slider.on("destroyed", function () {
44
+ observer.unobserve(slider.container);
45
+ });
46
+ };
47
+ function CurrentSlideDropdown(_ref) {
48
+ var _componentProps$editi, _componentProps$child;
49
+ var componentProps = _ref.componentProps,
50
+ studioOps = _ref.studioOps;
51
+ var editingSlide = (_componentProps$editi = componentProps.editingSlide) != null ? _componentProps$editi : 0;
52
+ var slidesCnt = (_componentProps$child = componentProps.children.length) != null ? _componentProps$child : componentProps.children.type === "img" ? 1 : 0;
53
+ var options = Array.from({
54
+ length: slidesCnt
55
+ }, function (_, i) {
56
+ return i;
57
+ }).map(function (i) {
58
+ return React.createElement(Option, {
59
+ value: i.toString()
60
+ }, "Slide ", i + 1);
61
+ });
62
+ var handleChange = function handleChange(value) {
63
+ var slideIdx = Number(value);
64
+ studioOps.updateProps({
65
+ editingSlide: slideIdx % slidesCnt
66
+ });
67
+ };
68
+ return React.createElement("div", {
69
+ style: {
70
+ width: "100%",
71
+ display: "flex",
72
+ flexDirection: "row",
73
+ gap: "10px",
74
+ justifyContent: "space-between"
75
+ }
76
+ }, React.createElement("div", null, "Current slide:"), React.createElement(Select, {
77
+ defaultValue: editingSlide.toString(),
78
+ style: {
79
+ width: "100%"
80
+ },
81
+ onChange: handleChange,
82
+ value: editingSlide.toString()
83
+ }, options));
84
+ }
85
+ function NavigateSlides(_ref2) {
86
+ var _componentProps$editi2;
87
+ var componentProps = _ref2.componentProps,
88
+ studioOps = _ref2.studioOps;
89
+ var slidesCnt = componentProps.children.length;
90
+ var editingSlide = (_componentProps$editi2 = componentProps.editingSlide) != null ? _componentProps$editi2 : 0;
91
+ return React.createElement("div", {
92
+ style: {
93
+ width: "100%",
94
+ display: "flex",
95
+ flexDirection: "row",
96
+ gap: "10px",
97
+ justifyContent: "space-between"
98
+ }
99
+ }, React.createElement(Button, {
100
+ style: {
101
+ width: "100%"
102
+ },
103
+ onClick: function onClick() {
104
+ var prevSlide = (editingSlide - 1 + slidesCnt) % slidesCnt;
105
+ studioOps.updateProps({
106
+ editingSlide: prevSlide
107
+ });
108
+ }
109
+ }, "Prev slide"), React.createElement(Button, {
110
+ style: {
111
+ width: "100%"
112
+ },
113
+ onClick: function onClick() {
114
+ var nextSlide = (editingSlide + 1) % slidesCnt;
115
+ studioOps.updateProps({
116
+ editingSlide: nextSlide
117
+ });
118
+ }
119
+ }, "Next slide"));
120
+ }
121
+ function OutlineMessage() {
122
+ return React.createElement("div", null, "* To re-arrange slides, use the Outline panel");
123
+ }
124
+ var sliderMeta = {
125
+ name: "hostless-slider",
126
+ displayName: "Slider",
127
+ importName: "Slider",
128
+ importPath: "keen-slider",
129
+ actions: [{
130
+ type: "custom-action",
131
+ control: CurrentSlideDropdown
132
+ }, {
133
+ type: "custom-action",
134
+ control: NavigateSlides
135
+ }, {
136
+ type: "button-action",
137
+ label: "Append new slide",
138
+ onClick: function onClick(_ref3) {
139
+ var componentProps = _ref3.componentProps,
140
+ studioOps = _ref3.studioOps;
141
+ var slidesCnt = componentProps.children.length;
142
+ studioOps.appendToSlot({
143
+ type: "img",
144
+ src: ""
145
+ }, "children");
146
+ studioOps.updateProps({
147
+ editingSlide: slidesCnt
148
+ });
149
+ }
150
+ }, {
151
+ type: "button-action",
152
+ label: "Delete current slide",
153
+ onClick: function onClick(_ref4) {
154
+ var _contextData$editingS;
155
+ var componentProps = _ref4.componentProps,
156
+ contextData = _ref4.contextData,
157
+ studioOps = _ref4.studioOps;
158
+ var editingSlide = (_contextData$editingS = contextData.editingSlide) != null ? _contextData$editingS : 0;
159
+ studioOps.removeFromSlotAt(editingSlide, "children");
160
+ var slidesCnt = componentProps.children.length - 1;
161
+ studioOps.updateProps({
162
+ editingSlide: (editingSlide - 1 + slidesCnt) % slidesCnt
163
+ });
164
+ }
165
+ }, {
166
+ type: "custom-action",
167
+ control: OutlineMessage
168
+ }],
169
+ props: {
170
+ children: {
171
+ type: "slot",
172
+ defaultValue: /*#__PURE__*/[0, 1, 2].map(function (i) {
173
+ return {
174
+ type: "vbox",
175
+ children: {
176
+ type: "img",
177
+ src: "https://static1.plasmic.app/components/react-slick/slide" + (i + 1) + ".png",
178
+ styles: {
179
+ maxWidth: "100%"
180
+ }
181
+ }
182
+ };
183
+ })
184
+ },
185
+ editingSlide: {
186
+ displayName: "Currently edited slide",
187
+ type: "number",
188
+ description: "Switch to the specified slide (first is 0). Only affects the editor, not the final page.",
189
+ defaultValueHint: 0,
190
+ editOnly: true,
191
+ hidden: function hidden() {
192
+ return true;
193
+ }
194
+ },
195
+ disabled: {
196
+ displayName: "Disabled",
197
+ type: "boolean",
198
+ description: "Disable or enable slider",
199
+ defaultValueHint: false
200
+ },
201
+ drag: {
202
+ displayName: "Drag",
203
+ type: "boolean",
204
+ description: "Enables or disables mouse and touch control",
205
+ defaultValueHint: true
206
+ },
207
+ dragSpeed: {
208
+ displayName: "Drag Speed",
209
+ type: "number",
210
+ description: "Set the speed that is applied to the slider when dragging it.",
211
+ defaultValueHint: 1
212
+ },
213
+ initial: {
214
+ displayName: "Initial slide",
215
+ type: "number",
216
+ description: "Sets the index of initially visible slide",
217
+ defaultValueHint: 1
218
+ },
219
+ loop: {
220
+ displayName: "Loop",
221
+ type: "boolean",
222
+ description: "Enable or disables carousel/loop functionality of the slider",
223
+ defaultValueHint: false
224
+ },
225
+ mode: {
226
+ displayName: "Carousel mode",
227
+ type: "choice",
228
+ options: ["snap", "free", "free-snap"],
229
+ description: "Sets the animation that is applied after a drag ends",
230
+ defaultValueHint: "snap"
231
+ },
232
+ renderMode: {
233
+ displayName: "Render mode",
234
+ type: "choice",
235
+ options: ["precision", "performance", "custom"],
236
+ 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'.",
237
+ defaultValueHint: "precision"
238
+ },
239
+ rtl: {
240
+ displayName: "Reverse",
241
+ type: "boolean",
242
+ description: "Reverses the slide order",
243
+ defaultValueHint: false
244
+ },
245
+ rubberband: {
246
+ displayName: "Rubberband ",
247
+ type: "boolean",
248
+ description: "Enables or disables rubberband behavior for dragging and animation after a drag.",
249
+ defaultValueHint: true
250
+ },
251
+ slides: {
252
+ displayName: "Number of slides",
253
+ type: "number",
254
+ description: "Specifies number of slider "
255
+ },
256
+ vertical: {
257
+ displayName: "Vertical",
258
+ type: "boolean",
259
+ description: "Vertical slide mode",
260
+ defaultValueHint: false,
261
+ helpText: "(Note: The height of the container must be defined if vertical is true)"
262
+ }
263
+ },
264
+ defaultStyles: {
265
+ width: "stretch",
266
+ maxWidth: "100%",
267
+ flexDirection: "column"
268
+ }
269
+ };
270
+ var SliderWrapper = /*#__PURE__*/forwardRef(function SliderWrapper_(_ref5, userRef) {
271
+ var editingSlide = _ref5.editingSlide,
272
+ children = _ref5.children,
273
+ className = _ref5.className,
274
+ setControlContextData = _ref5.setControlContextData,
275
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded);
276
+ setControlContextData == null ? void 0 : setControlContextData({
277
+ editingSlide: editingSlide
278
+ });
279
+ var _useKeenSlider = useKeenSlider(_extends({}, props), [ResizePlugin]),
280
+ sliderRef = _useKeenSlider[0],
281
+ instanceRef = _useKeenSlider[1];
282
+ useEffect(function () {
283
+ if (editingSlide !== undefined) {
284
+ instanceRef.current.moveToIdx(editingSlide);
285
+ }
286
+ }, [editingSlide]);
287
+ return React.createElement("div", {
288
+ className: className
289
+ }, React.createElement("div", Object.assign({
290
+ ref: composeRefs(sliderRef, userRef),
291
+ className: "keen-slider"
292
+ }, props, {
293
+ style: {
294
+ height: "100%"
295
+ }
296
+ }), React.Children.map(children, function (child) {
297
+ return React.cloneElement(child, {
298
+ className: "keen-slider__slide " + className
299
+ });
300
+ }), children));
301
+ });
302
+ function registerSlider(loader, customSliderMeta) {
303
+ if (loader) {
304
+ loader.registerComponent(SliderWrapper, customSliderMeta != null ? customSliderMeta : sliderMeta);
305
+ } else {
306
+ registerComponent(SliderWrapper, customSliderMeta != null ? customSliderMeta : sliderMeta);
307
+ }
308
+ }
309
+
310
+ export { SliderWrapper, registerSlider, sliderMeta };
311
+ //# sourceMappingURL=plasmic-keen-slider.esm.js.map
@@ -0,0 +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 { Button, Select } from \"antd\";\nimport React, { forwardRef, Ref, useEffect } from \"react\";\nimport { useKeenSlider, KeenSliderPlugin } from \"keen-slider/react\";\nimport composeRefs from \"@seznam/compose-react-refs\";\nimport { KeenSliderOptions } from \"keen-slider\";\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-slider\",\n displayName: \"Slider\",\n importName: \"Slider\",\n importPath: \"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","componentProps","studioOps","editingSlide","slidesCnt","children","length","type","options","Array","from","_","i","map","React","value","toString","handleChange","slideIdx","Number","updateProps","style","width","display","flexDirection","gap","justifyContent","defaultValue","onChange","NavigateSlides","Button","onClick","prevSlide","nextSlide","OutlineMessage","sliderMeta","name","displayName","importName","importPath","actions","control","label","appendToSlot","src","contextData","removeFromSlotAt","props","styles","maxWidth","description","defaultValueHint","editOnly","hidden","disabled","drag","dragSpeed","initial","loop","mode","renderMode","rtl","rubberband","slides","vertical","helpText","defaultStyles","SliderWrapper","forwardRef","SliderWrapper_","userRef","className","setControlContextData","useKeenSlider","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,YAAY,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,oBAAoB;;MAAGC,cAAc,QAAdA,cAAc;IAAEC,SAAS,QAATA,SAAS;EACvD,IAAMC,YAAY,4BAAGF,cAAc,CAACE,YAAY,oCAAI,CAAC;EACrD,IAAMC,SAAS,4BACbH,cAAc,CAACI,QAAQ,CAACC,MAAM,oCAC7BL,cAAc,CAACI,QAAQ,CAACE,IAAI,KAAK,KAAK,GAAG,CAAC,GAAG,CAAE;EAElD,IAAMC,OAAO,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEJ,MAAM,EAAEF;GAAW,EAAE,UAACO,CAAC,EAAEC,CAAC;IAAA,OAAKA,CAAC;IAAC,CAACC,GAAG,CAAC,UAACD,CAAC;IACnE,OAAOE,oBAACzB,MAAM;MAAC0B,KAAK,EAAEH,CAAC,CAACI,QAAQ;iBAAWJ,CAAC,GAAG,CAAC,CAAU;GAC3D,CAAC;EAEF,IAAMK,YAAY,GAAG,SAAfA,YAAY,CAAIF,KAAa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AAG;IAAErE,YAAY,EAAEA;GAAc,CAAC;EACvD,qBAAiCsE,aAAa,cAEvC1B,KAAK,GAEV,CAACxD,YAAY,CAAC,CACf;IALMmF,SAAS;IAAEC,WAAW;EAO7BC,SAAS,CAAC;IACR,IAAIzE,YAAY,KAAK0E,SAAS,EAAE;MAC9BF,WAAW,CAACG,OAAQ,CAACC,SAAS,CAAC5E,YAAY,CAAC;;GAE/C,EAAE,CAACA,YAAY,CAAC,CAAC;EAElB,OACEW;IAAKyD,SAAS,EAAEA;KACdzD;IACEkE,GAAG,EAAEC,WAAW,CAACP,SAAS,EAAEJ,OAAO,CAAC;IACpCC,SAAS,EAAC;KACNxB,KAAK;IACT1B,KAAK,EAAE;MAAE6D,MAAM,EAAE;;MAEhBpE,KAAK,CAACqE,QAAQ,CAACtE,GAAG,CAACR,QAAQ,EAAE,UAAC+E,KAAK;IAAA,OAClCtE,KAAK,CAACuE,YAAY,CAACD,KAAK,EAAE;MACxBb,SAAS,0BAAwBA;KAClC,CAAC;IACH,EACAlE,QAAQ,CACL,CACF;AAEV,CAAC;SAEeiF,cAAc,CAC5BC,MAAwD,EACxDC,gBAAuD;EAEvD,IAAID,MAAM,EAAE;IACVA,MAAM,CAACE,iBAAiB,CAACtB,aAAa,EAAEqB,gBAAgB,WAAhBA,gBAAgB,GAAIrD,UAAU,CAAC;GACxE,MAAM;IACLsD,iBAAiB,CAACtB,aAAa,EAAEqB,gBAAgB,WAAhBA,gBAAgB,GAAIrD,UAAU,CAAC;;AAEpE;;;;"}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@plasmicpkgs/plasmic-keen-slider",
3
+ "version": "0.0.4",
4
+ "description": "Plasmic Keen slider components.",
5
+ "main": "dist/index.js",
6
+ "typings": "dist/index.d.ts",
7
+ "module": "dist/plasmic-keen-slider.esm.js",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "start": "tsdx watch",
16
+ "build": "tsdx build",
17
+ "test": "yarn --cwd=../.. test --passWithNoTests",
18
+ "lint": "tsdx lint",
19
+ "prepare": "if-env PREPARE_NO_BUILD=true || yarn build",
20
+ "size": "size-limit",
21
+ "analyze": "size-limit --why"
22
+ },
23
+ "peerDependencies": {
24
+ "react": ">=16"
25
+ },
26
+ "size-limit": [
27
+ {
28
+ "path": "dist/plasmic-keen-slider.cjs.production.min.js",
29
+ "limit": "10 KB"
30
+ },
31
+ {
32
+ "path": "dist/plasmic-keen-slider.esm.js",
33
+ "limit": "10 KB"
34
+ }
35
+ ],
36
+ "devDependencies": {
37
+ "@plasmicapp/host": "1.0.161",
38
+ "@size-limit/preset-small-lib": "^7.0.8",
39
+ "@types/react": "^18.0.27",
40
+ "@types/react-dom": "^18.0.10",
41
+ "@types/resize-observer-browser": "^0.1.7",
42
+ "react": "^18.2.0",
43
+ "react-dom": "^18.2.0",
44
+ "size-limit": "^7.0.8",
45
+ "tsdx": "^0.14.1",
46
+ "tslib": "^2.3.1"
47
+ },
48
+ "dependencies": {
49
+ "@seznam/compose-react-refs": "^1.0.6",
50
+ "antd": "^5.8.4",
51
+ "keen-slider": "^6.8.6"
52
+ },
53
+ "gitHead": "10ab82db81f1654102ff8ed100c5ee16c61465e0"
54
+ }