@widgetic/editor 3.11.4 → 4.0.2

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.
Files changed (497) hide show
  1. package/README.md +245 -0
  2. package/dist/assets/fonts.json +331 -0
  3. package/dist/assets/icons/ic-browser/audio.svg +7 -0
  4. package/dist/assets/icons/ic-browser/document.svg +11 -0
  5. package/dist/assets/icons/ic-browser/error.svg +5 -0
  6. package/dist/assets/icons/ic-browser/folder.svg +28 -0
  7. package/dist/assets/icons/ic-browser/player-pause.svg +1 -0
  8. package/dist/assets/icons/ic-browser/player-play.svg +1 -0
  9. package/dist/assets/icons/ic-browser/trash.svg +1 -0
  10. package/dist/assets/icons/ic-fixed-position/background-deselected.svg +3 -0
  11. package/dist/assets/icons/ic-fixed-position/background-selected.svg +3 -0
  12. package/dist/assets/icons/ic-fixed-position/bottom-left-background-deselected.svg +3 -0
  13. package/dist/assets/icons/ic-fixed-position/bottom-left-background-selected.svg +3 -0
  14. package/dist/assets/icons/ic-fixed-position/bottom-left-icon.svg +4 -0
  15. package/dist/assets/icons/ic-fixed-position/bottom-right-background-deselected.svg +3 -0
  16. package/dist/assets/icons/ic-fixed-position/bottom-right-background-selected.svg +3 -0
  17. package/dist/assets/icons/ic-fixed-position/bottom-right-icon.svg +4 -0
  18. package/dist/assets/icons/ic-fixed-position/center-bottom-icon.svg +5 -0
  19. package/dist/assets/icons/ic-fixed-position/center-center-icon.svg +3 -0
  20. package/dist/assets/icons/ic-fixed-position/center-left-icon.svg +5 -0
  21. package/dist/assets/icons/ic-fixed-position/center-right-icon.svg +5 -0
  22. package/dist/assets/icons/ic-fixed-position/center-top-icon.svg +5 -0
  23. package/dist/assets/icons/ic-fixed-position/top-left-background-deselected.svg +3 -0
  24. package/dist/assets/icons/ic-fixed-position/top-left-background-selected.svg +3 -0
  25. package/dist/assets/icons/ic-fixed-position/top-left-icon.svg +4 -0
  26. package/dist/assets/icons/ic-fixed-position/top-right-background-deselected.svg +3 -0
  27. package/dist/assets/icons/ic-fixed-position/top-right-background-selected.svg +3 -0
  28. package/dist/assets/icons/ic-fixed-position/top-right-icon.svg +4 -0
  29. package/dist/assets/icons/trash.svg +1 -0
  30. package/dist/components/MockWidget.svelte +108 -0
  31. package/dist/components/MockWidget.svelte.d.ts +22 -0
  32. package/dist/components/WidgetPreview.svelte +852 -0
  33. package/dist/components/WidgetPreview.svelte.d.ts +100 -0
  34. package/dist/components/color-select/ColorSelect.svelte +258 -0
  35. package/dist/components/color-select/ColorSelect.svelte.d.ts +42 -0
  36. package/dist/components/color-select/color.d.ts +25 -0
  37. package/dist/components/color-select/color.js +21 -0
  38. package/dist/components/color-select/constants.d.ts +5 -0
  39. package/dist/components/color-select/constants.js +5 -0
  40. package/dist/components/color-select/render.d.ts +5 -0
  41. package/dist/components/color-select/render.js +77 -0
  42. package/dist/components/color-select/shaders.d.ts +3 -0
  43. package/dist/components/color-select/shaders.js +8 -0
  44. package/dist/components/editors/EmbedEditor.svelte +700 -0
  45. package/dist/components/editors/EmbedEditor.svelte.d.ts +50 -0
  46. package/dist/components/editors/PropsEditor.svelte +4009 -0
  47. package/dist/components/editors/PropsEditor.svelte.d.ts +62 -0
  48. package/dist/components/editors/props-editor.css +73 -0
  49. package/dist/components/ic/AngleInputController.svelte +276 -0
  50. package/dist/components/ic/AngleInputController.svelte.d.ts +26 -0
  51. package/dist/components/ic/BrowserInputController.svelte +731 -0
  52. package/dist/components/ic/BrowserInputController.svelte.d.ts +39 -0
  53. package/dist/components/ic/CheckboxInputController.svelte +203 -0
  54. package/dist/components/ic/CheckboxInputController.svelte.d.ts +41 -0
  55. package/dist/components/ic/ColorPickerInputController.svelte +1584 -0
  56. package/dist/components/ic/ColorPickerInputController.svelte.d.ts +50 -0
  57. package/dist/components/ic/DateFieldInputController.svelte +453 -0
  58. package/dist/components/ic/DateFieldInputController.svelte.d.ts +35 -0
  59. package/dist/components/ic/DatePickerInputController.svelte +364 -0
  60. package/dist/components/ic/DatePickerInputController.svelte.d.ts +28 -0
  61. package/dist/components/ic/DropdownInputController.svelte +226 -0
  62. package/dist/components/ic/DropdownInputController.svelte.d.ts +43 -0
  63. package/dist/components/ic/FixedPositionInputController.svelte +353 -0
  64. package/dist/components/ic/FixedPositionInputController.svelte.d.ts +23 -0
  65. package/dist/components/ic/FontInputController.svelte +2098 -0
  66. package/dist/components/ic/FontInputController.svelte.d.ts +47 -0
  67. package/dist/components/ic/InputControllerHeader.svelte +147 -0
  68. package/dist/components/ic/InputControllerHeader.svelte.d.ts +23 -0
  69. package/dist/components/ic/NumberControls.svelte +299 -0
  70. package/dist/components/ic/NumberControls.svelte.d.ts +30 -0
  71. package/dist/components/ic/NumberInputController.svelte +397 -0
  72. package/dist/components/ic/NumberInputController.svelte.d.ts +30 -0
  73. package/dist/components/ic/PositionInputController.svelte +252 -0
  74. package/dist/components/ic/PositionInputController.svelte.d.ts +37 -0
  75. package/dist/components/ic/RadioGroupInputController.svelte +162 -0
  76. package/dist/components/ic/RadioGroupInputController.svelte.d.ts +38 -0
  77. package/dist/components/ic/RangeCalendarInputController.svelte +262 -0
  78. package/dist/components/ic/RangeCalendarInputController.svelte.d.ts +32 -0
  79. package/dist/components/ic/RoundedCornersInputController.svelte +469 -0
  80. package/dist/components/ic/RoundedCornersInputController.svelte.d.ts +37 -0
  81. package/dist/components/ic/SliderInputController.svelte +411 -0
  82. package/dist/components/ic/SliderInputController.svelte.d.ts +46 -0
  83. package/dist/components/ic/SliderRangeInputController.svelte +155 -0
  84. package/dist/components/ic/SliderRangeInputController.svelte.d.ts +33 -0
  85. package/dist/components/ic/SwitchInputController.svelte +107 -0
  86. package/dist/components/ic/SwitchInputController.svelte.d.ts +24 -0
  87. package/dist/components/ic/TagsInputController.svelte +125 -0
  88. package/dist/components/ic/TagsInputController.svelte.d.ts +27 -0
  89. package/dist/components/ic/TextAreaInputController.svelte +1932 -0
  90. package/dist/components/ic/TextAreaInputController.svelte.d.ts +14 -0
  91. package/dist/components/ic/TextAreaPreviewInputController.svelte +478 -0
  92. package/dist/components/ic/TextAreaPreviewInputController.svelte.d.ts +28 -0
  93. package/dist/components/ic/TextInputController.svelte +70 -0
  94. package/dist/components/ic/TextInputController.svelte.d.ts +30 -0
  95. package/dist/components/ic/TimeInputController.svelte +434 -0
  96. package/dist/components/ic/TimeInputController.svelte.d.ts +25 -0
  97. package/dist/components/ic/VectorInputController.svelte +1826 -0
  98. package/dist/components/ic/VectorInputController.svelte.d.ts +47 -0
  99. package/dist/components/ic/index.d.ts +39 -0
  100. package/dist/components/ic/index.js +24 -0
  101. package/dist/components/ic/shared/CategoryTabs.svelte +40 -0
  102. package/dist/components/ic/shared/CategoryTabs.svelte.d.ts +25 -0
  103. package/dist/components/ic/shared/ItemGrid.svelte +181 -0
  104. package/dist/components/ic/shared/ItemGrid.svelte.d.ts +35 -0
  105. package/dist/components/ic/shared/RecentItemsSection.svelte +260 -0
  106. package/dist/components/ic/shared/RecentItemsSection.svelte.d.ts +35 -0
  107. package/dist/components/ic/shared/index.d.ts +8 -0
  108. package/dist/components/ic/shared/index.js +9 -0
  109. package/dist/components/icons/addnew.svelte +21 -0
  110. package/dist/components/icons/addnew.svelte.d.ts +20 -0
  111. package/dist/components/icons/drag.svelte +29 -0
  112. package/dist/components/icons/drag.svelte.d.ts +20 -0
  113. package/dist/components/icons/drag.svg +1 -0
  114. package/dist/components/icons/locked.svelte +4 -0
  115. package/dist/components/icons/locked.svelte.d.ts +26 -0
  116. package/dist/components/icons/locked.svg +4 -0
  117. package/dist/components/icons/ok.svelte +20 -0
  118. package/dist/components/icons/ok.svelte.d.ts +20 -0
  119. package/dist/components/icons/ok.svg +11 -0
  120. package/dist/components/icons/unlocked.svelte +4 -0
  121. package/dist/components/icons/unlocked.svelte.d.ts +26 -0
  122. package/dist/components/icons/unlocked.svg +4 -0
  123. package/dist/components/icons/x.svelte +14 -0
  124. package/dist/components/icons/x.svelte.d.ts +20 -0
  125. package/dist/components/icons/x.svg +5 -0
  126. package/dist/components/ui/arrows/OpacitySliderArrows.svelte +43 -0
  127. package/dist/components/ui/arrows/OpacitySliderArrows.svelte.d.ts +23 -0
  128. package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte +15 -0
  129. package/dist/components/ui/checkerboard-background/CheckerboardBackground.svelte.d.ts +20 -0
  130. package/dist/config.d.ts +11 -0
  131. package/dist/config.js +31 -0
  132. package/dist/index.d.ts +5 -0
  133. package/dist/index.js +9 -0
  134. package/dist/stores/userSession.d.ts +7 -0
  135. package/dist/stores/userSession.js +28 -0
  136. package/dist/utils/FontManager.d.ts +278 -0
  137. package/dist/utils/FontManager.js +1302 -0
  138. package/dist/utils/MediaManager.d.ts +35 -0
  139. package/dist/utils/MediaManager.js +59 -0
  140. package/dist/utils/VectorManager.d.ts +190 -0
  141. package/dist/utils/VectorManager.js +754 -0
  142. package/dist/utils/colorAutocomplete.d.ts +10 -0
  143. package/dist/utils/colorAutocomplete.js +28 -0
  144. package/dist/utils/colorNames.d.ts +3 -0
  145. package/dist/utils/colorNames.js +152 -0
  146. package/dist/utils/colorTransparency.d.ts +52 -0
  147. package/dist/utils/colorTransparency.js +114 -0
  148. package/dist/utils/fontUtils.d.ts +34 -0
  149. package/dist/utils/fontUtils.js +132 -0
  150. package/dist/utils/passiveEvents.js +20 -0
  151. package/dist/utils/recentColors.d.ts +10 -0
  152. package/dist/utils/recentColors.js +63 -0
  153. package/dist/utils/skipFonts.d.ts +3 -0
  154. package/dist/utils/skipFonts.js +49 -0
  155. package/dist/utils/vectorUtils.d.ts +34 -0
  156. package/dist/utils/vectorUtils.js +71 -0
  157. package/dist/utils.d.ts +11 -0
  158. package/dist/utils.js +38 -0
  159. package/package.json +134 -74
  160. package/.babelrc +0 -10
  161. package/.bowerrc +0 -4
  162. package/.nvmrc +0 -1
  163. package/Gruntfile.coffee +0 -69
  164. package/bower.json +0 -28
  165. package/css/browser/entries/activateable.styl +0 -29
  166. package/css/browser/entries/audio.styl +0 -39
  167. package/css/browser/entries/folder.styl +0 -79
  168. package/css/browser/entries/image.styl +0 -26
  169. package/css/browser/entries/index.styl +0 -66
  170. package/css/browser/entries/rss.styl +0 -11
  171. package/css/browser/entries/video.styl +0 -11
  172. package/css/browser/index.styl +0 -86
  173. package/css/browser/intent/index.styl +0 -61
  174. package/css/browser/nav/index.styl +0 -73
  175. package/css/browser/social-browser.styl +0 -23
  176. package/css/controls/clock.styl +0 -110
  177. package/css/controls/config.styl +0 -6
  178. package/css/controls/control-audio-details.styl +0 -63
  179. package/css/controls/control-audio.styl +0 -28
  180. package/css/controls/control-browser.styl +0 -48
  181. package/css/controls/control-color.styl +0 -423
  182. package/css/controls/control-date_time.styl +0 -191
  183. package/css/controls/control-dropdown.styl +0 -79
  184. package/css/controls/control-font.styl +0 -147
  185. package/css/controls/control-image-details.styl +0 -35
  186. package/css/controls/control-image.styl +0 -43
  187. package/css/controls/control-order-picker.styl +0 -29
  188. package/css/controls/control-position.styl +0 -390
  189. package/css/controls/control-range.styl +0 -68
  190. package/css/controls/control-scale.styl +0 -30
  191. package/css/controls/control-slider.styl +0 -38
  192. package/css/controls/control-spinner.styl +0 -39
  193. package/css/controls/control-textarea.styl +0 -52
  194. package/css/controls/control-toggle.styl +0 -34
  195. package/css/controls/control-url.styl +0 -32
  196. package/css/controls/control-video-details.styl +0 -85
  197. package/css/controls/control-video.styl +0 -43
  198. package/css/controls/general.styl +0 -98
  199. package/css/controls/index.styl +0 -25
  200. package/css/editor/colors.styl +0 -7
  201. package/css/editor/content/directinput.styl +0 -47
  202. package/css/editor/content/index.styl +0 -111
  203. package/css/editor/content/message.styl +0 -53
  204. package/css/editor/content/tabs.styl +0 -75
  205. package/css/editor/copied-from-old-style.styl +0 -197
  206. package/css/editor/details/bulk-editor.styl +0 -104
  207. package/css/editor/details/index.styl +0 -21
  208. package/css/editor/details/item.styl +0 -153
  209. package/css/editor/embed.styl +0 -106
  210. package/css/editor/footer.styl +0 -180
  211. package/css/editor/full-editor.styl +0 -16
  212. package/css/editor/index.styl +0 -124
  213. package/css/editor/login-popup.styl +0 -13
  214. package/css/editor/preview.styl +0 -257
  215. package/css/editor/skin/editor/index.styl +0 -54
  216. package/css/editor/skin/editor/tabs.styl +0 -111
  217. package/css/editor/skin/index.styl +0 -138
  218. package/css/editor/skin/popup.styl +0 -152
  219. package/css/editor/skin/presets/dropdown.styl +0 -61
  220. package/css/editor/skin/presets/index.styl +0 -86
  221. package/css/editor/skin/presets/list.styl +0 -244
  222. package/css/editor/tooltips.styl +0 -85
  223. package/css/fonts.styl +0 -47
  224. package/css/icons/BlogvioEditor.dev.svg +0 -112
  225. package/css/icons.styl +0 -16
  226. package/css/img/arrow-right-rounded-v-small.png +0 -0
  227. package/css/img/browser-folder-separator.png +0 -0
  228. package/css/img/calendar-input-icons.png +0 -0
  229. package/css/img/check.png +0 -0
  230. package/css/img/close.png +0 -0
  231. package/css/img/composition/edit-icon.png +0 -0
  232. package/css/img/content/audio-icon.png +0 -0
  233. package/css/img/content/folder-icon.png +0 -0
  234. package/css/img/content/messages/error-background.png +0 -0
  235. package/css/img/content/messages/error-icon.png +0 -0
  236. package/css/img/content/messages/notification-background.png +0 -0
  237. package/css/img/content/messages/notification-icon.png +0 -0
  238. package/css/img/content/no-files-audio.png +0 -0
  239. package/css/img/content/no-files-image.png +0 -0
  240. package/css/img/content/no-files-video.png +0 -0
  241. package/css/img/content/no-files.png +0 -0
  242. package/css/img/content/rss-icon.png +0 -0
  243. package/css/img/content/selected.png +0 -0
  244. package/css/img/content/video-icon.png +0 -0
  245. package/css/img/content/with-control-text.png +0 -0
  246. package/css/img/control-dropdown-arrow.png +0 -0
  247. package/css/img/control-image-valid.png +0 -0
  248. package/css/img/control-position-icon.png +0 -0
  249. package/css/img/control-scale-lock-icon.png +0 -0
  250. package/css/img/control-slider-arrows-hover.png +0 -0
  251. package/css/img/control-slider-arrows.png +0 -0
  252. package/css/img/control-spinner-buttons-hover.png +0 -0
  253. package/css/img/control-spinner-buttons.png +0 -0
  254. package/css/img/control-textarea-bold-active.png +0 -0
  255. package/css/img/control-textarea-bold.png +0 -0
  256. package/css/img/control-textarea-italic-active.png +0 -0
  257. package/css/img/control-textarea-italic.png +0 -0
  258. package/css/img/control-textarea-underline-active.png +0 -0
  259. package/css/img/control-textarea-underline.png +0 -0
  260. package/css/img/custom-checkbox-sprite.png +0 -0
  261. package/css/img/details/item-collapse-icon.png +0 -0
  262. package/css/img/details/item-expand-icon.png +0 -0
  263. package/css/img/details/item-sort-icon.png +0 -0
  264. package/css/img/done-arrow.png +0 -0
  265. package/css/img/fb-logo-icon-w.png +0 -0
  266. package/css/img/grid-icons.png +0 -0
  267. package/css/img/icon-reference.png +0 -0
  268. package/css/img/indicator.png +0 -0
  269. package/css/img/loader.gif +0 -0
  270. package/css/img/loaders/audio-white.png +0 -0
  271. package/css/img/loaders/audio.png +0 -0
  272. package/css/img/loaders/photo-white.png +0 -0
  273. package/css/img/loaders/photo.png +0 -0
  274. package/css/img/loaders/util-white.png +0 -0
  275. package/css/img/loaders/util.png +0 -0
  276. package/css/img/loaders/video-white.png +0 -0
  277. package/css/img/loaders/video.png +0 -0
  278. package/css/img/maximize.png +0 -0
  279. package/css/img/minimize.png +0 -0
  280. package/css/img/next-btn.png +0 -0
  281. package/css/img/search-icon-sprite.png +0 -0
  282. package/css/img/services/blogvio.png +0 -0
  283. package/css/img/services/drive.png +0 -0
  284. package/css/img/services/dropbox-login.png +0 -0
  285. package/css/img/services/dropbox.png +0 -0
  286. package/css/img/services/facebook-login.png +0 -0
  287. package/css/img/services/facebook.png +0 -0
  288. package/css/img/services/flickr-login.png +0 -0
  289. package/css/img/services/flickr.png +0 -0
  290. package/css/img/services/instagram-login.png +0 -0
  291. package/css/img/services/instagram.png +0 -0
  292. package/css/img/services/text.png +0 -0
  293. package/css/img/services/uploads.png +0 -0
  294. package/css/img/services/uploads.svg +0 -689
  295. package/css/img/services/webaddress-bw.png +0 -0
  296. package/css/img/services/webaddress.png +0 -0
  297. package/css/img/services/webadress.png +0 -0
  298. package/css/img/services/websearch.png +0 -0
  299. package/css/img/services/wix.png +0 -0
  300. package/css/img/skin/item-active-indicator.png +0 -0
  301. package/css/img/skin/item-hover-icon.png +0 -0
  302. package/css/img/skin/overwrite.png +0 -0
  303. package/css/img/skin/popup-name-icon.png +0 -0
  304. package/css/img/skin/popup-save.png +0 -0
  305. package/css/img/skin/preset.png +0 -0
  306. package/css/img/skin/presets-arrow-purple.png +0 -0
  307. package/css/img/tw-icon-w.png +0 -0
  308. package/css/img/warning.png +0 -0
  309. package/css/img/white-rounded-check.png +0 -0
  310. package/css/index.styl +0 -9
  311. package/css/mixins.styl +0 -62
  312. package/css/scrollable.styl +0 -101
  313. package/karma.conf.js +0 -73
  314. package/lib/control.js +0 -1
  315. package/lib/controls.js +0 -1
  316. package/lib/core.editor.js +0 -4
  317. package/lib/core.js +0 -1
  318. package/lib/core.vendor.js +0 -3
  319. package/lib/dev/control.js +0 -845
  320. package/lib/dev/controls.js +0 -7774
  321. package/lib/dev/core.editor.js +0 -6439
  322. package/lib/dev/core.js +0 -1486
  323. package/lib/dev/core.vendor.js +0 -10708
  324. package/lib/dev/editor.css +0 -166
  325. package/lib/dev/editor.js +0 -29710
  326. package/lib/dev/editor.vendor.js +0 -15119
  327. package/lib/dev/jquery.nanoscroller.js.map +0 -10
  328. package/lib/editor.css +0 -167
  329. package/lib/editor.js +0 -49
  330. package/lib/editor.vendor.js +0 -11
  331. package/src/api/index.coffee +0 -23
  332. package/src/api/mixin.coffee +0 -89
  333. package/src/browser/controller/entry/audio.coffee +0 -38
  334. package/src/browser/controller/entry/button.coffee +0 -16
  335. package/src/browser/controller/entry/file.coffee +0 -35
  336. package/src/browser/controller/entry/folder.coffee +0 -14
  337. package/src/browser/controller/entry/image.coffee +0 -24
  338. package/src/browser/controller/entry/index.coffee +0 -18
  339. package/src/browser/controller/entry/rss.coffee +0 -5
  340. package/src/browser/controller/entry/video.coffee +0 -4
  341. package/src/browser/controller/index.coffee +0 -289
  342. package/src/browser/controller/instagram.coffee +0 -129
  343. package/src/browser/controller/navbar.coffee +0 -48
  344. package/src/browser/controller/social.coffee +0 -213
  345. package/src/browser/model/entry.coffee +0 -18
  346. package/src/browser/model/index.coffee +0 -34
  347. package/src/core/controller/font-loader.coffee +0 -65
  348. package/src/core/controller/lazyload.coffee +0 -14
  349. package/src/core/controller/overlay.coffee +0 -146
  350. package/src/core/controller/popup.coffee +0 -36
  351. package/src/core/controller/scrollable.coffee +0 -68
  352. package/src/core/controls/audio.coffee +0 -56
  353. package/src/core/controls/browser.coffee +0 -271
  354. package/src/core/controls/color.coffee +0 -121
  355. package/src/core/controls/date-time/calendar/index.coffee +0 -99
  356. package/src/core/controls/date-time/calendar/months.coffee +0 -52
  357. package/src/core/controls/date-time/calendar/years.coffee +0 -58
  358. package/src/core/controls/date-time/clock.coffee +0 -62
  359. package/src/core/controls/date-time/helper.coffee +0 -31
  360. package/src/core/controls/date-time/index.coffee +0 -62
  361. package/src/core/controls/date-time/popup.coffee +0 -56
  362. package/src/core/controls/details/audio.coffee +0 -33
  363. package/src/core/controls/details/image.coffee +0 -19
  364. package/src/core/controls/details/video.coffee +0 -14
  365. package/src/core/controls/dropdown.coffee +0 -100
  366. package/src/core/controls/font/font-item.coffee +0 -22
  367. package/src/core/controls/font/font-list.coffee +0 -108
  368. package/src/core/controls/font/fonts-popup.coffee +0 -91
  369. package/src/core/controls/font/index.coffee +0 -66
  370. package/src/core/controls/image.coffee +0 -37
  371. package/src/core/controls/index.coffee +0 -88
  372. package/src/core/controls/orderPicker.coffee +0 -93
  373. package/src/core/controls/position/grid-panel.coffee +0 -75
  374. package/src/core/controls/position/index.coffee +0 -98
  375. package/src/core/controls/position/panel.coffee +0 -68
  376. package/src/core/controls/position/pixel-panel.coffee +0 -54
  377. package/src/core/controls/position/popup.coffee +0 -63
  378. package/src/core/controls/position/reference-panel.coffee +0 -26
  379. package/src/core/controls/range.coffee +0 -191
  380. package/src/core/controls/rss.coffee +0 -16
  381. package/src/core/controls/scale.coffee +0 -78
  382. package/src/core/controls/slider.coffee +0 -122
  383. package/src/core/controls/stepper.coffee +0 -97
  384. package/src/core/controls/text.coffee +0 -54
  385. package/src/core/controls/textarea.coffee +0 -78
  386. package/src/core/controls/toggle.coffee +0 -29
  387. package/src/core/controls/url.coffee +0 -88
  388. package/src/core/controls/video.coffee +0 -9
  389. package/src/core/embed/api.js +0 -178
  390. package/src/core/embed/controller.js +0 -331
  391. package/src/core/models/composition.coffee +0 -178
  392. package/src/core/models/content.coffee +0 -79
  393. package/src/core/models/skin.coffee +0 -91
  394. package/src/core/models/user.coffee +0 -6
  395. package/src/core/models/widget.coffee +0 -88
  396. package/src/core/router/index.coffee +0 -44
  397. package/src/core/services/container/index.js +0 -18
  398. package/src/core/services/container/instance.js +0 -3
  399. package/src/core/services/content.js +0 -80
  400. package/src/core/services/instagram.coffee +0 -47
  401. package/src/core/services/mixin/events.js +0 -17
  402. package/src/core/services/service.js +0 -1
  403. package/src/core/services/sounds.js +0 -81
  404. package/src/core/services/uploads.js +0 -299
  405. package/src/core/utils/popup.coffee +0 -67
  406. package/src/core/utils/should-show.coffee +0 -12
  407. package/src/core/views/audio-details.pug +0 -9
  408. package/src/core/views/audio.pug +0 -7
  409. package/src/core/views/browser.pug +0 -4
  410. package/src/core/views/color.pug +0 -8
  411. package/src/core/views/date-time/calendar.pug +0 -3
  412. package/src/core/views/date-time/clock.pug +0 -12
  413. package/src/core/views/date-time/grid.pug +0 -6
  414. package/src/core/views/date-time/input.pug +0 -4
  415. package/src/core/views/date-time/table.pug +0 -6
  416. package/src/core/views/dropdown.pug +0 -9
  417. package/src/core/views/font/font-item.pug +0 -3
  418. package/src/core/views/font/fonts-list.pug +0 -7
  419. package/src/core/views/font/fonts-popup.pug +0 -5
  420. package/src/core/views/font/index.pug +0 -7
  421. package/src/core/views/image-details.pug +0 -6
  422. package/src/core/views/image.pug +0 -5
  423. package/src/core/views/input-layout.pug +0 -15
  424. package/src/core/views/order-items.pug +0 -7
  425. package/src/core/views/order-picker.pug +0 -7
  426. package/src/core/views/pixelpanel.pug +0 -69
  427. package/src/core/views/position.pug +0 -10
  428. package/src/core/views/range.pug +0 -9
  429. package/src/core/views/scale.pug +0 -7
  430. package/src/core/views/slider.pug +0 -6
  431. package/src/core/views/stepper.pug +0 -6
  432. package/src/core/views/text.pug +0 -4
  433. package/src/core/views/textarea.pug +0 -8
  434. package/src/core/views/toggle.pug +0 -5
  435. package/src/core/views/video-details.pug +0 -7
  436. package/src/core/views/video.pug +0 -4
  437. package/src/core/widget/index.coffee +0 -66
  438. package/src/editor/content/browser/dropzone.html +0 -268
  439. package/src/editor/content/browser/file.html +0 -124
  440. package/src/editor/content/browser/scroll-pane.html +0 -32
  441. package/src/editor/content/browser/service.html +0 -53
  442. package/src/editor/content/browser/upload.coffee +0 -44
  443. package/src/editor/content/browser/upload.html +0 -439
  444. package/src/editor/content/index.coffee +0 -294
  445. package/src/editor/content/input/field.coffee +0 -45
  446. package/src/editor/content/input/index.coffee +0 -115
  447. package/src/editor/content/service/base/photoitem.coffee +0 -49
  448. package/src/editor/content/service/cache.coffee +0 -20
  449. package/src/editor/content/service/default.coffee +0 -59
  450. package/src/editor/content/service/dropbox.coffee +0 -71
  451. package/src/editor/content/service/facebook.coffee +0 -143
  452. package/src/editor/content/service/flickr.coffee +0 -85
  453. package/src/editor/content/service/google-drive-sdk.coffee +0 -18
  454. package/src/editor/content/service/google-drive.coffee +0 -144
  455. package/src/editor/content/service/instagram-social.coffee +0 -84
  456. package/src/editor/content/service/instagram.coffee +0 -168
  457. package/src/editor/content/service/share-popup.coffee +0 -15
  458. package/src/editor/content/service/soundcloud.coffee +0 -163
  459. package/src/editor/content/tab.coffee +0 -27
  460. package/src/editor/details/bulk-editor/attributes-panel.coffee +0 -11
  461. package/src/editor/details/bulk-editor/index.coffee +0 -86
  462. package/src/editor/details/index.coffee +0 -156
  463. package/src/editor/details/item/attributes.coffee +0 -45
  464. package/src/editor/details/item/index.coffee +0 -82
  465. package/src/editor/editor.coffee +0 -274
  466. package/src/editor/footer/breadcrumb.coffee +0 -17
  467. package/src/editor/footer/index.coffee +0 -36
  468. package/src/editor/index.coffee +0 -79
  469. package/src/editor/listeners/embed-listener.coffee +0 -143
  470. package/src/editor/login-popup.coffee +0 -29
  471. package/src/editor/notification-controller.coffee +0 -35
  472. package/src/editor/popup.coffee +0 -68
  473. package/src/editor/remote-preview.coffee +0 -68
  474. package/src/editor/save/index.coffee +0 -62
  475. package/src/editor/skin/delete.coffee +0 -33
  476. package/src/editor/skin/editor/index.coffee +0 -188
  477. package/src/editor/skin/editor/panel.coffee +0 -37
  478. package/src/editor/skin/index.coffee +0 -126
  479. package/src/editor/skin/save.coffee +0 -58
  480. package/src/editor/skin/selector/index.coffee +0 -59
  481. package/src/editor/skin/selector/item.coffee +0 -123
  482. package/src/editor/skin/selector/list.coffee +0 -97
  483. package/src/editor/views/embed.pug +0 -10
  484. package/src/editor/views/loginbutton.pug +0 -8
  485. package/src/editor/views/popup.pug +0 -17
  486. package/src/editor/views/presets.pug +0 -8
  487. package/src/editor/views/presetslist-header.pug +0 -8
  488. package/src/editor/views/skinitem.pug +0 -13
  489. package/src/modules/control.js +0 -3
  490. package/src/modules/controls.js +0 -29
  491. package/src/modules/core.js +0 -19
  492. package/src/modules/editor.js +0 -80
  493. package/test/config.js +0 -3
  494. package/test/core/models/skin-spec.js +0 -209
  495. package/webpack.config.js +0 -46
  496. package/webpack.config.prod.js +0 -9
  497. /package/{src/core/views/date-time/popup.pug → dist/utils/passiveEvents.d.ts} +0 -0
package/lib/dev/core.js DELETED
@@ -1,1486 +0,0 @@
1
- /******/ (function(modules) { // webpackBootstrap
2
- /******/ // The module cache
3
- /******/ var installedModules = {};
4
- /******/
5
- /******/ // The require function
6
- /******/ function __webpack_require__(moduleId) {
7
- /******/
8
- /******/ // Check if module is in cache
9
- /******/ if(installedModules[moduleId]) {
10
- /******/ return installedModules[moduleId].exports;
11
- /******/ }
12
- /******/ // Create a new module (and put it into the cache)
13
- /******/ var module = installedModules[moduleId] = {
14
- /******/ i: moduleId,
15
- /******/ l: false,
16
- /******/ exports: {}
17
- /******/ };
18
- /******/
19
- /******/ // Execute the module function
20
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
- /******/
22
- /******/ // Flag the module as loaded
23
- /******/ module.l = true;
24
- /******/
25
- /******/ // Return the exports of the module
26
- /******/ return module.exports;
27
- /******/ }
28
- /******/
29
- /******/
30
- /******/ // expose the modules object (__webpack_modules__)
31
- /******/ __webpack_require__.m = modules;
32
- /******/
33
- /******/ // expose the module cache
34
- /******/ __webpack_require__.c = installedModules;
35
- /******/
36
- /******/ // define getter function for harmony exports
37
- /******/ __webpack_require__.d = function(exports, name, getter) {
38
- /******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, {
40
- /******/ configurable: false,
41
- /******/ enumerable: true,
42
- /******/ get: getter
43
- /******/ });
44
- /******/ }
45
- /******/ };
46
- /******/
47
- /******/ // getDefaultExport function for compatibility with non-harmony modules
48
- /******/ __webpack_require__.n = function(module) {
49
- /******/ var getter = module && module.__esModule ?
50
- /******/ function getDefault() { return module['default']; } :
51
- /******/ function getModuleExports() { return module; };
52
- /******/ __webpack_require__.d(getter, 'a', getter);
53
- /******/ return getter;
54
- /******/ };
55
- /******/
56
- /******/ // Object.prototype.hasOwnProperty.call
57
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58
- /******/
59
- /******/ // __webpack_public_path__
60
- /******/ __webpack_require__.p = "";
61
- /******/
62
- /******/ // Load entry module and return exports
63
- /******/ return __webpack_require__(__webpack_require__.s = 123);
64
- /******/ })
65
- /************************************************************************/
66
- /******/ ({
67
-
68
- /***/ 10:
69
- /***/ (function(module, exports) {
70
-
71
- var FontLoader, fl, readyDef, readyPromise,
72
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
73
- slice = [].slice;
74
-
75
- readyDef = new $.Deferred;
76
-
77
- readyPromise = readyDef.promise();
78
-
79
- FontLoader = (function() {
80
- FontLoader.prototype.fontList = {};
81
-
82
- function FontLoader() {
83
- this._getFontList = bind(this._getFontList, this);
84
- this.loadFontList = bind(this.loadFontList, this);
85
- this.loadGoogleFont = bind(this.loadGoogleFont, this);
86
- this.loadFontLoader();
87
- }
88
-
89
- FontLoader.prototype.loadFontLoader = function() {
90
- var s, wf;
91
- wf = document.createElement('script');
92
- wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.16/webfont.js';
93
- wf.type = 'text/javascript';
94
- wf.async = 'true';
95
- wf.onload = function() {
96
- return readyDef.resolve();
97
- };
98
- s = document.getElementsByTagName('script')[0];
99
- return s.parentNode.insertBefore(wf, s);
100
- };
101
-
102
- FontLoader.prototype.load = function(options, context, source) {
103
- if (options == null) {
104
- options = {};
105
- }
106
- if (context == null) {
107
- context = window;
108
- }
109
- return readyPromise.then(function() {
110
- var fontFamily;
111
- fontFamily = options.families[0];
112
- source || (source = options.source || 'google');
113
- if ((context.fontDefs != null) && (context.fontDefs[fontFamily] != null)) {
114
- return context.fontDefs[fontFamily];
115
- }
116
- context.fontDefs || (context.fontDefs = {});
117
- if (source === 'local') {
118
- return context.fontDefs[fontFamily] = (new $.Deferred).resolve().promise();
119
- }
120
- return context.fontDefs[fontFamily] = fl.loadGoogleFont(options, context);
121
- });
122
- };
123
-
124
- FontLoader.prototype.loadGoogleFont = function(options, context) {
125
- var def;
126
- def = new $.Deferred;
127
- WebFont.load({
128
- google: options,
129
- context: context,
130
- fontactive: (function(def) {
131
- return function() {
132
- return def.resolve(arguments);
133
- };
134
- })(def),
135
- fontinactive: (function(def) {
136
- return function() {
137
- return def.resolve(arguments);
138
- };
139
- })(def),
140
- timeout: 600
141
- });
142
- return def.promise();
143
- };
144
-
145
- FontLoader.prototype.loadFontList = function() {
146
- var def;
147
- if (this.fontListRdy != null) {
148
- return this.fontListRdy;
149
- }
150
- def = Blogvio.Aye.defer();
151
- this._getFontList().then((function(_this) {
152
- return function() {
153
- var _, f;
154
- return def.resolve($.extend.apply($, [{}].concat(slice.call((function() {
155
- var ref, results;
156
- ref = this.fontList;
157
- results = [];
158
- for (_ in ref) {
159
- f = ref[_];
160
- results.push(f);
161
- }
162
- return results;
163
- }).call(_this)))));
164
- };
165
- })(this));
166
- return this.fontListRdy = def.promise;
167
- };
168
-
169
- FontLoader.prototype._getFontList = function() {
170
- var def, rdy;
171
- def = new $.Deferred;
172
- rdy = function(source, fonts) {
173
- var font, opts;
174
- if (source) {
175
- for (font in fonts) {
176
- opts = fonts[font];
177
- fonts[font].source = source;
178
- }
179
- this.fontList[source] = fonts;
180
- } else {
181
- this.fontList = $.extend({}, this.fontList, fonts);
182
- }
183
- if ((this.fontList.google != null) && (this.fontList.local != null)) {
184
- return def.resolve();
185
- }
186
- };
187
- $.getJSON('/fonts-list').then(rdy.bind(this, null));
188
- $.getJSON('/fonts.json').then(rdy.bind(this, 'local'));
189
- return def.promise();
190
- };
191
-
192
- return FontLoader;
193
-
194
- })();
195
-
196
- module.exports = fl = new FontLoader;
197
-
198
-
199
- /***/ }),
200
-
201
- /***/ 105:
202
- /***/ (function(module, exports, __webpack_require__) {
203
-
204
- var Content, Helper, Model, defaultAtts, isArray,
205
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
206
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
207
- hasProp = {}.hasOwnProperty;
208
-
209
- Model = window.require('spine/model');
210
-
211
- Helper = window.require('spine/utils/helper');
212
-
213
- isArray = Helper.isArray;
214
-
215
- defaultAtts = ['order', 'metadata', 'composition_id', '_isDemoContent'];
216
-
217
- Content = (function(superClass) {
218
- extend(Content, superClass);
219
-
220
- Content.records = [];
221
-
222
- Content.irecords = {};
223
-
224
- Content.crecords = {};
225
-
226
- Content.configure('Content');
227
-
228
-
229
- /*
230
- Sort function used to sort items
231
- */
232
-
233
- Content.comparator = function(a, b) {
234
- return (a.order || a.id) - (b.order || b.id);
235
- };
236
-
237
- function Content(atts) {
238
- var attr, mattr;
239
- if (atts == null) {
240
- atts = {};
241
- }
242
- this.attrMeta = bind(this.attrMeta, this);
243
- this.editedMeta = bind(this.editedMeta, this);
244
- this._metadata = bind(this._metadata, this);
245
- if (!atts.composition_id) {
246
- throw new Error('Content must be associated to a composition.');
247
- }
248
- this.composition_id = atts.composition_id;
249
- this._meta = atts._meta;
250
- for (attr in (mattr = this.meta().attributes)) {
251
- if ((atts[attr] == null) && (mattr[attr] != null)) {
252
- atts[attr] = mattr[attr].options["default"];
253
- }
254
- }
255
- Content.__super__.constructor.call(this, atts);
256
- this.id || (this.id = this.cid);
257
- }
258
-
259
- Content.prototype.meta = function() {
260
- return this._meta || (this._meta = this.composition().contentMeta());
261
- };
262
-
263
- Content.prototype.composition = function() {
264
- return (__webpack_require__(44)).find(this.composition_id);
265
- };
266
-
267
- Content.prototype.attributes = function() {
268
- var attribute, attributes, i, key, len, meta_attributes, options, result;
269
- attributes = defaultAtts.slice(0);
270
- meta_attributes = (function() {
271
- var ref, results;
272
- ref = this.meta().attributes;
273
- results = [];
274
- for (attribute in ref) {
275
- options = ref[attribute];
276
- results.push(attribute);
277
- }
278
- return results;
279
- }).call(this);
280
- attributes.push.apply(attributes, meta_attributes);
281
- result = {};
282
- for (i = 0, len = attributes.length; i < len; i++) {
283
- key = attributes[i];
284
- if (key in this) {
285
- if (typeof this[key] === 'function') {
286
- result[key] = this[key]();
287
- } else {
288
- result[key] = this[key];
289
- }
290
- }
291
- }
292
- if (this.id) {
293
- result.id = this.id;
294
- }
295
- if (this._meta) {
296
- result._meta = this._meta;
297
- }
298
- return result;
299
- };
300
-
301
- Content.prototype._metadata = function(key, value, options) {
302
- if (options == null) {
303
- options = {};
304
- }
305
- if (key == null) {
306
- return this.metadata || (this.metadata = {});
307
- }
308
- if (value == null) {
309
- return this._metadata()[key];
310
- }
311
- if (this._metadata()[key] === value) {
312
- return this._metadata()[key];
313
- }
314
- this._metadata()[key] = value;
315
- options.attribute = 'metadata';
316
- return this.updateAttribute('metadata', this.metadata, options);
317
- };
318
-
319
- Content.prototype.editedMeta = function(attr, set) {
320
- var editedMeta;
321
- if (attr == null) {
322
- return this._metadata('edited') || [];
323
- }
324
- if (attr && (set == null)) {
325
- return 1 + this.editedMeta().indexOf(attr);
326
- }
327
- if (!(attr && (set != null))) {
328
- return;
329
- }
330
- editedMeta = this.editedMeta().concat(attr).filter((function(_this) {
331
- return function(f) {
332
- return set || f !== attr;
333
- };
334
- })(this));
335
- return this._metadata('edited', editedMeta);
336
- };
337
-
338
- Content.prototype.attrMeta = function(attr, value, options) {
339
- var attr_meta;
340
- if (attr == null) {
341
- return this._metadata('attr_meta') || {};
342
- }
343
- if ((attr != null) && (value == null)) {
344
- return this.attrMeta()[attr];
345
- }
346
- if ((attr != null) && (value != null)) {
347
- (attr_meta = this.attrMeta())[attr] = value;
348
- return this._metadata('attr_meta', attr_meta, options);
349
- }
350
- };
351
-
352
- Content.prototype.toJSON = function() {
353
- var result;
354
- result = Content.__super__.toJSON.apply(this, arguments);
355
- delete result._meta;
356
- return result;
357
- };
358
-
359
- return Content;
360
-
361
- })(Model);
362
-
363
- module.exports = Content;
364
-
365
-
366
- /***/ }),
367
-
368
- /***/ 123:
369
- /***/ (function(module, exports, __webpack_require__) {
370
-
371
- var define = function define(m) {
372
- return function (_, __, module) {
373
- module.exports = m;
374
- };
375
- };
376
- window.require.define({
377
- // models
378
- 'core/models/content': define(__webpack_require__(105)),
379
- 'core/models/composition': define(__webpack_require__(44)),
380
- 'core/models/widget': define(__webpack_require__(38)),
381
- 'core/models/skin': define(__webpack_require__(45)),
382
- 'core/models/user': define(__webpack_require__(125)),
383
- // widget stuff
384
- 'core/widget': define(__webpack_require__(126)),
385
- 'core/controller/overlay': define(__webpack_require__(127)),
386
- 'core/controller/font-loader': define(__webpack_require__(10))
387
- });
388
-
389
- /***/ }),
390
-
391
- /***/ 124:
392
- /***/ (function(module, exports) {
393
-
394
- var Api;
395
-
396
- Api = {
397
- enabled: true,
398
- app_id: '528495b81d8a0c3130000000_5zjgq5bllucc4ok88404occgcgsckswcc40g8ggs08ckswc4kw',
399
- redirect_uri: "http://local.blogvio.com/connect/blogvio.html",
400
-
401
- /*
402
- Runs a callback with the API disabled
403
-
404
- This allows changes to models without triggering persist
405
- */
406
- disable: function(callback) {
407
- var e;
408
- if (this.enabled) {
409
- this.enabled = false;
410
- try {
411
- return callback();
412
- } catch (error) {
413
- e = error;
414
- throw e;
415
- } finally {
416
- this.enabled = true;
417
- }
418
- } else {
419
- return callback();
420
- }
421
- }
422
- };
423
-
424
- module.exports = Api;
425
-
426
-
427
- /***/ }),
428
-
429
- /***/ 125:
430
- /***/ (function(module, exports, __webpack_require__) {
431
-
432
- var AjaxMixin, Model, User,
433
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
434
- hasProp = {}.hasOwnProperty;
435
-
436
- Model = window.require('spine/model');
437
-
438
- AjaxMixin = __webpack_require__(37);
439
-
440
- User = (function(superClass) {
441
- extend(User, superClass);
442
-
443
- function User() {
444
- return User.__super__.constructor.apply(this, arguments);
445
- }
446
-
447
- User.extend(AjaxMixin);
448
-
449
- User.configure('User', 'loggedIn', 'email', 'max_allowed_hosts', 'hosts', 'name', 'lastname', 'username', 'subscription');
450
-
451
- return User;
452
-
453
- })(Model);
454
-
455
- module.exports = User;
456
-
457
-
458
- /***/ }),
459
-
460
- /***/ 126:
461
- /***/ (function(module, exports) {
462
-
463
- var Container, Controller, Widget,
464
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
465
- hasProp = {}.hasOwnProperty;
466
-
467
- Controller = window.require('spine/controller');
468
-
469
- Container = window.require('spine/controller/container');
470
-
471
-
472
- /*
473
- Base class for all widgets
474
- */
475
-
476
- Widget = (function(superClass) {
477
- extend(Widget, superClass);
478
-
479
- Widget.prototype.className = 'blogvio-widget';
480
-
481
- Widget.include(Container);
482
-
483
- function Widget(opts, skin, content) {
484
- Widget.__super__.constructor.apply(this, arguments);
485
- if (this.VERSION) {
486
- this.el.attr('data-version', this.VERSION);
487
- }
488
- this.style = $('<style>');
489
- if (skin != null) {
490
- this.setSkin(skin);
491
- }
492
- if (content != null) {
493
- this.setContent(content);
494
- }
495
- this.append(this.style);
496
- }
497
-
498
-
499
- /*
500
- Set the current skin
501
- */
502
-
503
- Widget.prototype.setSkin = function(skin) {
504
- this.stopListening(this.skin);
505
- this.stopListening(skin);
506
- this.skin = skin;
507
- if (this.skin.bind != null) {
508
- this.listenTo(this.skin, 'update', (function(_this) {
509
- return function() {
510
- return _this.changeSkin.apply(_this, arguments);
511
- };
512
- })(this));
513
- }
514
- this.changeSkin(skin);
515
- return this;
516
- };
517
-
518
-
519
- /*
520
- Change a list of properties in the current skin
521
- this function should be overrided in the widget main component
522
- */
523
-
524
- Widget.prototype.changeSkin = function(skin) {
525
- return this;
526
- };
527
-
528
-
529
- /*
530
- Set current content
531
- */
532
-
533
- Widget.prototype.setContent = function(content) {
534
- var i, item, len;
535
- if (content == null) {
536
- content = [];
537
- }
538
- this.content = content;
539
- this.clearContent();
540
- for (i = 0, len = content.length; i < len; i++) {
541
- item = content[i];
542
- this.addContent(item);
543
- }
544
- return this;
545
- };
546
-
547
-
548
- /*
549
- Add one content item
550
- */
551
-
552
- Widget.prototype.addContent = function(item) {
553
- return this;
554
- };
555
-
556
-
557
- /*
558
- Remove all content from the widget
559
- */
560
-
561
- Widget.prototype.clearContent = function() {
562
- return this;
563
- };
564
-
565
- Widget.prototype.resize = function(w, h) {};
566
-
567
- return Widget;
568
-
569
- })(Controller);
570
-
571
- module.exports = Widget;
572
-
573
-
574
- /***/ }),
575
-
576
- /***/ 127:
577
- /***/ (function(module, exports) {
578
-
579
- var Controller, Overlay,
580
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
581
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
582
- hasProp = {}.hasOwnProperty;
583
-
584
- Controller = window.require('spine/controller');
585
-
586
- Overlay = (function(superClass) {
587
- extend(Overlay, superClass);
588
-
589
- Overlay.prototype.className = 'overlay';
590
-
591
- function Overlay(options) {
592
- if (options == null) {
593
- options = {};
594
- }
595
- this._hide = bind(this._hide, this);
596
- this._show = bind(this._show, this);
597
- if (!options.parent) {
598
- throw new Error('The parent option is missing!');
599
- }
600
- if (!options.events) {
601
- throw new Error('The events option is missing!');
602
- }
603
- Overlay.__super__.constructor.apply(this, arguments);
604
- }
605
-
606
- Overlay.prototype.delegateEvents = function(events) {
607
- var eventName, key, match, method, results, selector;
608
- if (events == null) {
609
- events = this.events;
610
- }
611
- this.eventsDelegated = true;
612
- results = [];
613
- for (key in events) {
614
- method = events[key];
615
- if (this.parent[method]) {
616
- match = key.match(this.eventSplitter);
617
- eventName = match[1];
618
- selector = match[2];
619
- method = (function(_this) {
620
- return function(method) {
621
- return function() {
622
- var ref;
623
- (ref = _this.parent)[method].apply(ref, arguments);
624
- return true;
625
- };
626
- };
627
- })(this)(method);
628
- }
629
- if (selector === '') {
630
- results.push(this.el.bind(eventName, method));
631
- } else {
632
- results.push(this.el.on(eventName, selector, method));
633
- }
634
- }
635
- return results;
636
- };
637
-
638
- Overlay.prototype.append = function(el) {
639
- if (el.el) {
640
- el = el.el;
641
- }
642
- return this.el.append(el);
643
- };
644
-
645
- Overlay.prototype.preload = function() {
646
- return this._createPopup();
647
- };
648
-
649
- Overlay.prototype.toggle = function() {
650
- return this._createPopup().then((function(_this) {
651
- return function() {
652
- if (_this.popup.visible) {
653
- return _this._hide();
654
- } else {
655
- return _this._show();
656
- }
657
- };
658
- })(this));
659
- };
660
-
661
- Overlay.prototype.show = function() {
662
- return this._createPopup().then(this._show);
663
- };
664
-
665
- Overlay.prototype.hide = function() {
666
- return this._createPopup().then(this._hide);
667
- };
668
-
669
- Overlay.prototype.style = function(style) {
670
- if (style) {
671
- this.styleCache = style;
672
- }
673
- if (!this.popup) {
674
- return;
675
- }
676
- return this.popup.style(this.styleCache);
677
- };
678
-
679
- Overlay.prototype.release = function() {
680
- Overlay.__super__.release.apply(this, arguments);
681
- this.eventsDelegated = false;
682
- this.popupPromise = null;
683
- this.popup.release();
684
- return this;
685
- };
686
-
687
- Overlay.prototype._show = function() {
688
- return this.popup.show().then((function(_this) {
689
- return function() {
690
- return _this.el.trigger('overlay-shown');
691
- };
692
- })(this));
693
- };
694
-
695
- Overlay.prototype._hide = function() {
696
- return this.popup.hide().then((function(_this) {
697
- return function() {
698
- return _this.el.trigger('overlay-hidden');
699
- };
700
- })(this));
701
- };
702
-
703
- Overlay.prototype._createPopup = function() {
704
- if (this.popupPromise) {
705
- return this.popupPromise;
706
- }
707
- return this.popupPromise = Blogvio.UI.popup["new"]({
708
- type: 'overlay'
709
- }).then((function(_this) {
710
- return function(popup) {
711
- _this.popup = popup;
712
- _this.style();
713
- _this.popup.append(_this.el);
714
- if (!_this.eventsDelegated) {
715
- return _this.delegateEvents();
716
- }
717
- };
718
- })(this)).fail(function(err) {
719
- return console.error(err.stack);
720
- });
721
- };
722
-
723
- return Overlay;
724
-
725
- })(Controller);
726
-
727
- module.exports = Overlay;
728
-
729
-
730
- /***/ }),
731
-
732
- /***/ 37:
733
- /***/ (function(module, exports, __webpack_require__) {
734
-
735
- var Api, Base, Collection, Extend, Helper, Include, Mixin, Singleton, stringify, url,
736
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
737
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
738
- hasProp = {}.hasOwnProperty;
739
-
740
- Api = __webpack_require__(124);
741
-
742
- stringify = Widgetic.JSON.stringify;
743
-
744
- Helper = window.require('spine/utils/helper');
745
-
746
- url = function(object, id) {
747
- var u;
748
- if (id == null) {
749
- id = true;
750
- }
751
- u = (object.className || object.constructor.className).toLowerCase() + 's';
752
- if (id && object.id && (!/^c\-[\d]+/.test(object.id))) {
753
- u += '/' + encodeURIComponent(object.id);
754
- }
755
- return u;
756
- };
757
-
758
- Base = (function() {
759
- function Base() {}
760
-
761
- Base.prototype.request = function() {
762
- var def;
763
- if (Api.enabled) {
764
- return Widgetic.api.apply(Widgetic, arguments);
765
- }
766
- def = Widgetic.Aye.defer();
767
- def.reject('Widgetic API is disabled.');
768
- return def.promise;
769
- };
770
-
771
- return Base;
772
-
773
- })();
774
-
775
- Singleton = (function(superClass) {
776
- extend(Singleton, superClass);
777
-
778
- function Singleton(record1) {
779
- this.record = record1;
780
- this.failedWithData = bind(this.failedWithData, this);
781
- this.recordResponse = bind(this.recordResponse, this);
782
- this.model = this.record.constructor;
783
- }
784
-
785
- Singleton.prototype.reload = function(options) {
786
- return this.request(url(this.record)).then(this.recordResponse(options), this.failedReload(options));
787
- };
788
-
789
- Singleton.prototype.create = function(options) {
790
- return this.request(url(this.record, false), 'POST', stringify(this.record)).then(this.recordResponse(options), this.failedWithData(options));
791
- };
792
-
793
- Singleton.prototype.update = function(options) {
794
- var isNew;
795
- isNew = /^c\-[\d]+/.test(this.record.id);
796
- return this.request(url(this.record, !isNew), (isNew ? 'POST' : 'PUT'), stringify(this.record)).then(this.recordResponse(options), this.failedWithData(options));
797
- };
798
-
799
- Singleton.prototype.destroy = function(options) {
800
- return this.request(url(this.record), 'DELETE').then(this.recordResponse(options), this.failedWithData(options));
801
- };
802
-
803
- Singleton.prototype.recordResponse = function(options) {
804
- if (options == null) {
805
- options = {};
806
- }
807
- return (function(_this) {
808
- return function(data) {
809
- var blank, ref;
810
- if ((data = (blank = Helper.isBlank(data)) ? false : _this.model.fromJSON(data))) {
811
- Api.disable(function() {
812
- if (data.id && _this.record.id !== data.id) {
813
- _this.record.changeID(data.id);
814
- }
815
- return _this.record.updateAttributes({
816
- id: data.id
817
- }, {
818
- fromApi: true
819
- });
820
- });
821
- }
822
- _this.record.trigger('apiSuccess', data);
823
- if ((ref = options.done) != null) {
824
- ref.apply(_this.record, arguments);
825
- }
826
- return _this.record;
827
- };
828
- })(this);
829
- };
830
-
831
- Singleton.prototype.failedWithData = function(options) {
832
- if (options == null) {
833
- options = {};
834
- }
835
- return (function(_this) {
836
- return function(error) {
837
- var ref;
838
- _this.record.trigger('apiError', error);
839
- if ((ref = options.fail) != null) {
840
- ref.apply(_this.record, arguments);
841
- }
842
- throw error;
843
- };
844
- })(this);
845
- };
846
-
847
- return Singleton;
848
-
849
- })(Base);
850
-
851
- Collection = (function(superClass) {
852
- extend(Collection, superClass);
853
-
854
- function Collection(model) {
855
- this.model = model;
856
- this.failResponse = bind(this.failResponse, this);
857
- this.recordsResponse = bind(this.recordsResponse, this);
858
- }
859
-
860
- Collection.prototype.find = function(id, params) {
861
- if (params == null) {
862
- params = {};
863
- }
864
- return this.request(url(new this.model({
865
- id: id
866
- })), null, params).then(this.recordsResponse, this.failResponse);
867
- };
868
-
869
- Collection.prototype.all = function(params) {
870
- if (params == null) {
871
- params = {};
872
- }
873
- return this.request(url(this.model), false, params).then(this.recordsResponse, this.failResponse);
874
- };
875
-
876
- Collection.prototype.fetch = function(params, options) {
877
- var id;
878
- if (params == null) {
879
- params = {};
880
- }
881
- if (options == null) {
882
- options = {};
883
- }
884
- if (id = params.id) {
885
- delete params.id;
886
- }
887
- return (id ? this.find(id, params) : this.all(params)).then((function(_this) {
888
- return function(record) {
889
- return _this.model.refresh(record, options);
890
- };
891
- })(this));
892
- };
893
-
894
- Collection.prototype.recordsResponse = function(data) {
895
- this.model.trigger('apiSuccess');
896
- return data;
897
- };
898
-
899
- Collection.prototype.failResponse = function(error) {
900
- this.model.trigger('apiError', null, error);
901
- throw new Error(error.message);
902
- };
903
-
904
- return Collection;
905
-
906
- })(Base);
907
-
908
- Include = {
909
- ajax: function() {
910
- return new Singleton(this);
911
- }
912
- };
913
-
914
- Extend = {
915
- ajax: function() {
916
- return new Collection(this);
917
- }
918
- };
919
-
920
- Mixin = {
921
- extended: function() {
922
- this.extend(Extend);
923
- return this.include(Include);
924
- },
925
- ajaxFetch: function() {
926
- var ref;
927
- return (ref = this.ajax()).fetch.apply(ref, arguments);
928
- },
929
- ajaxChange: function(record, type, options) {
930
- if (options == null) {
931
- options = {};
932
- }
933
- if (options.ajax === false) {
934
- return;
935
- }
936
- return record.ajax()[type](options);
937
- }
938
- };
939
-
940
- module.exports = Mixin;
941
-
942
-
943
- /***/ }),
944
-
945
- /***/ 38:
946
- /***/ (function(module, exports, __webpack_require__) {
947
-
948
- var AjaxMixin, Model, Skin, Widget, _loadSkins, hasRequiredFields,
949
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
950
- hasProp = {}.hasOwnProperty;
951
-
952
- Model = window.require('spine/model');
953
-
954
- Skin = __webpack_require__(45);
955
-
956
- AjaxMixin = __webpack_require__(37);
957
-
958
- _loadSkins = function(widget) {
959
- if (widget.hasAllSkins) {
960
- Skin.refresh(widget.skins);
961
- return widget;
962
- } else {
963
- return Skin.ajaxFetch({
964
- widget_id: widget.id
965
- }).then(function(data) {
966
- Skin.refresh(data);
967
- widget.updateAttribute('hasAllSkins', true);
968
- return widget;
969
- });
970
- }
971
- };
972
-
973
- hasRequiredFields = function(w, fields) {
974
- var field, i, len;
975
- for (i = 0, len = fields.length; i < len; i++) {
976
- field = fields[i];
977
- if (!w[field]) {
978
- return false;
979
- }
980
- }
981
- return true;
982
- };
983
-
984
- Widget = (function(superClass) {
985
- extend(Widget, superClass);
986
-
987
- function Widget() {
988
- return Widget.__super__.constructor.apply(this, arguments);
989
- }
990
-
991
- Widget.extend(AjaxMixin);
992
-
993
- Widget.configure('Widget', 'name', 'module', 'category', 'slug', 'skinMeta', 'contentMeta', 'skins', 'content', 'css', 'js', 'width', 'height', 'hasAllSkins');
994
-
995
- Widget.current = null;
996
-
997
- Widget.load = function(id, options) {
998
- var e, fields, hasLoaded, process, w;
999
- fields = options != null ? options.fields : void 0;
1000
- hasLoaded = Blogvio.Aye.defer();
1001
- process = Blogvio.Aye.defer();
1002
- process.promise.then(_loadSkins).fail(hasLoaded.reject).then(hasLoaded.resolve);
1003
- try {
1004
- w = Widget.find(id);
1005
- if (fields && !hasRequiredFields(w, fields)) {
1006
- throw new Error("Widget[" + id + "] does not have all required fields: " + fields);
1007
- }
1008
- process.resolve(w);
1009
- } catch (error) {
1010
- e = error;
1011
- console.warn(e);
1012
- this.ajax().fetch({
1013
- id: id
1014
- }).then(function(widgets) {
1015
- return widgets[0];
1016
- }).then(process.resolve).fail(process.reject);
1017
- }
1018
- return hasLoaded.promise;
1019
- };
1020
-
1021
- Widget.prototype.getSkins = function() {
1022
- return Skin.findAllByAttribute('widget_id', this.id);
1023
- };
1024
-
1025
- return Widget;
1026
-
1027
- })(Model);
1028
-
1029
- module.exports = Widget;
1030
-
1031
-
1032
- /***/ }),
1033
-
1034
- /***/ 44:
1035
- /***/ (function(module, exports, __webpack_require__) {
1036
-
1037
- var AjaxMixin, Composition, Content, Model, Skin, Widget, _loadWidget,
1038
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
1039
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1040
- hasProp = {}.hasOwnProperty;
1041
-
1042
- Model = window.require('spine/model');
1043
-
1044
- AjaxMixin = __webpack_require__(37);
1045
-
1046
- Skin = __webpack_require__(45);
1047
-
1048
- Widget = __webpack_require__(38);
1049
-
1050
- Content = __webpack_require__(105);
1051
-
1052
- _loadWidget = function(composition) {
1053
- return Widget.load(composition.widget_id).then(function() {
1054
- return composition;
1055
- });
1056
- };
1057
-
1058
- Composition = (function(superClass) {
1059
- extend(Composition, superClass);
1060
-
1061
- Composition.extend(AjaxMixin);
1062
-
1063
- Composition.configure("Composition", 'name', 'content', 'bulk_content', 'skin_id', 'widget_id', 'width', 'height', 'widget_category', 'user_id', 'metadata');
1064
-
1065
- Composition.fetch(Composition.ajaxFetch);
1066
-
1067
- function Composition(atts) {
1068
- if (atts == null) {
1069
- atts = {};
1070
- }
1071
- this._onContentChange = bind(this._onContentChange, this);
1072
- this._metadata = bind(this._metadata, this);
1073
- this.listen = bind(this.listen, this);
1074
- this.bulkContent = bind(this.bulkContent, this);
1075
- this.maxFreeErrorMsg = bind(this.maxFreeErrorMsg, this);
1076
- this.maxErrorMsg = bind(this.maxErrorMsg, this);
1077
- this.minErrorMsg = bind(this.minErrorMsg, this);
1078
- this.opts = bind(this.opts, this);
1079
- atts.name || (atts.name = 'Untitled Composition');
1080
- atts.width || (atts.width = 500);
1081
- atts.height || (atts.height = 500);
1082
- Composition.__super__.constructor.call(this, atts);
1083
- }
1084
-
1085
- Composition.prototype.opts = function() {
1086
- var max, min, ref, ref1;
1087
- return this._opts || (this._opts = {
1088
- min: ((min = (ref = this.contentMeta().options) != null ? ref.min : void 0) != null) && min || 1,
1089
- max: ((max = (ref1 = this.contentMeta().options) != null ? ref1.max : void 0) != null) && max || 999
1090
- });
1091
- };
1092
-
1093
- Composition.prototype.minErrorMsg = function() {
1094
- return this.contentMeta().options.notification.min || 'Please add at least one item!';
1095
- };
1096
-
1097
- Composition.prototype.maxErrorMsg = function() {
1098
- return this.contentMeta().options.notification.max || 'You reached the maximum number of items!';
1099
- };
1100
-
1101
- Composition.prototype.maxFreeErrorMsg = function() {
1102
- return 'Upgrade to add more items, and get more features!';
1103
- };
1104
-
1105
- Composition.prototype.toJSON = function() {
1106
- var base, result;
1107
- result = Composition.__super__.toJSON.apply(this, arguments);
1108
- if (!result.content) {
1109
- result.content = this.getContent();
1110
- }
1111
- if (this.contentMeta().bulkEditor) {
1112
- result.bulk_content = typeof (base = this.bulkContent()).toJSON === "function" ? base.toJSON() : void 0;
1113
- }
1114
- return result;
1115
- };
1116
-
1117
- Composition.prototype.changeID = function(id) {
1118
- var oldId;
1119
- oldId = this.id;
1120
- Composition.__super__.changeID.apply(this, arguments);
1121
- return Content.findAllByAttribute('composition_id', oldId).forEach((function(_this) {
1122
- return function(c) {
1123
- return c.updateAttribute('composition_id', _this.id, {
1124
- attribute: 'composition_id'
1125
- });
1126
- };
1127
- })(this));
1128
- };
1129
-
1130
- Composition.prototype.validateLength = function(options) {
1131
- var error, errorMsg, name, valid;
1132
- if (options == null) {
1133
- options = {};
1134
- }
1135
- valid = this.hasEnoughContent();
1136
- error = !valid && (this.maxContentReached() ? 'max' : 'min');
1137
- errorMsg = typeof this[name = error + 'ErrorMsg'] === "function" ? this[name]() : void 0;
1138
- return {
1139
- valid: valid,
1140
- error: error,
1141
- errorMsg: errorMsg
1142
- };
1143
- };
1144
-
1145
- Composition.prototype.getWidget = function() {
1146
- var e;
1147
- if (!this.widget_id) {
1148
- throw new Error('This composition is missing the widget_id.');
1149
- }
1150
- try {
1151
- return (__webpack_require__(38)).find(this.widget_id);
1152
- } catch (error1) {
1153
- e = error1;
1154
- throw new Error("The widget " + this.widget_id + " is not loaded");
1155
- }
1156
- };
1157
-
1158
- Composition.prototype.setWidgetId = function(widget_id) {
1159
- this.widget_id = widget_id;
1160
- this.save({
1161
- ajax: false
1162
- });
1163
- return this;
1164
- };
1165
-
1166
- Composition.prototype.getSkin = function() {
1167
- var e;
1168
- try {
1169
- return Skin.find(this.skin_id);
1170
- } catch (error1) {
1171
- e = error1;
1172
- return false;
1173
- }
1174
- };
1175
-
1176
- Composition.prototype.getContent = function(filter) {
1177
- if (filter == null) {
1178
- filter = function(c) {
1179
- return !c._isDemoContent;
1180
- };
1181
- }
1182
- return Content.findAllByAttribute('composition_id', this.id).filter(filter).sort(function(a, b) {
1183
- return a.order - b.order;
1184
- });
1185
- };
1186
-
1187
- Composition.prototype.contentMeta = function() {
1188
- var widget;
1189
- widget = this.getWidget();
1190
- return widget != null ? widget.contentMeta : void 0;
1191
- };
1192
-
1193
- Composition.prototype.bulkContent = function() {
1194
- var _meta, attr, attributes, i, len, ref;
1195
- if (this._bkc != null) {
1196
- return this._bkc;
1197
- }
1198
- _meta = this.contentMeta();
1199
- attributes = {};
1200
- ref = _meta.bulkEditor.attributes;
1201
- for (i = 0, len = ref.length; i < len; i++) {
1202
- attr = ref[i];
1203
- attributes[attr] = _meta.attributes[attr];
1204
- }
1205
- _meta = $.extend({}, _meta, {
1206
- attributes: attributes
1207
- });
1208
- this.bulk_content = $.extend(this.bulk_content || {}, {
1209
- _meta: _meta,
1210
- composition_id: 1
1211
- });
1212
- return this._bkc = Content.refresh(this.bulk_content)[0];
1213
- };
1214
-
1215
-
1216
- /*
1217
- Test if the composition has less than maximum content
1218
- */
1219
-
1220
- Composition.prototype.maxContentReached = function(max) {
1221
- if (max == null) {
1222
- max = this.opts().max;
1223
- }
1224
- return this.getContent().length >= max;
1225
- };
1226
-
1227
- Composition.prototype.hasEnoughContent = function() {
1228
- var ref;
1229
- return (this.opts().min <= (ref = this.getContent().length) && ref <= this.opts().max);
1230
- };
1231
-
1232
- Composition.prototype.persist = function() {
1233
- var promise;
1234
- this._stopListen();
1235
- if (this.isPersisted()) {
1236
- promise = this.ajax().update();
1237
- } else {
1238
- promise = this.ajax().create();
1239
- }
1240
- return promise.then(this.listen);
1241
- };
1242
-
1243
- Composition.prototype.isPersisted = function() {
1244
- return this.id.slice(0, 1) !== 'c';
1245
- };
1246
-
1247
- Composition.prototype.listen = function() {
1248
- this._stopListen();
1249
- this.listenTo(Content, 'change', this._onContentChange);
1250
- return this;
1251
- };
1252
-
1253
- Composition.prototype._stopListen = function() {
1254
- this.stopListening(Content, 'change', this._onContentChange);
1255
- return this;
1256
- };
1257
-
1258
- Composition.prototype.embed = function() {
1259
- return ("<span>&lt;script async src=&quot;http://blogvio.com/embedder.js&quot;</span><br/> <span>data-blogvio-composition=&quot;" + this.id + "&quot;</span><br/> ") + ("<span>data-width=&quot;" + this.width + "&quot; data-height=&quot;" + this.height + "&quot;&gt;&lt;/script&gt;</span>");
1260
- };
1261
-
1262
- Composition.prototype._metadata = function(key, value, options) {
1263
- if (options == null) {
1264
- options = {};
1265
- }
1266
- if (key == null) {
1267
- return this.metadata || (this.metadata = {});
1268
- }
1269
- if (value == null) {
1270
- return this._metadata()[key];
1271
- }
1272
- this._metadata()[key] = value;
1273
- options.attribute = 'metadata';
1274
- return this.updateAttribute('metadata', this.metadata, options);
1275
- };
1276
-
1277
- Composition.load = function(id) {
1278
- var e, hasLoaded, process;
1279
- hasLoaded = Blogvio.Aye.defer();
1280
- process = Blogvio.Aye.defer();
1281
- process.promise.then(_loadWidget).then(function(composition) {
1282
- return composition._stopListen();
1283
- }).then(function(composition) {
1284
- composition.listen();
1285
- return composition;
1286
- }).fail(hasLoaded.reject).then(hasLoaded.resolve);
1287
- try {
1288
- process.resolve(Composition.find(id));
1289
- } catch (error1) {
1290
- e = error1;
1291
- this.ajax().fetch({
1292
- id: id
1293
- }).then(function(compositions) {
1294
- return compositions[0];
1295
- }).then(process.resolve).fail(process.reject);
1296
- }
1297
- return hasLoaded.promise;
1298
- };
1299
-
1300
- Composition.prototype._onContentChange = function(model, type, options) {
1301
- return this.updateAttribute('content', this.getContent(), {
1302
- ajax: false
1303
- });
1304
- };
1305
-
1306
- return Composition;
1307
-
1308
- })(Model);
1309
-
1310
- Composition.bind('destroy', function(item) {
1311
- var skin;
1312
- try {
1313
- skin = Skin.find(item.skin_id);
1314
- return skin != null ? skin.used() : void 0;
1315
- } catch (error1) {}
1316
- });
1317
-
1318
- module.exports = Composition;
1319
-
1320
-
1321
- /***/ }),
1322
-
1323
- /***/ 45:
1324
- /***/ (function(module, exports, __webpack_require__) {
1325
-
1326
- var AjaxMixin, Helper, Model, Skin, defaultAtts, isArray,
1327
- extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
1328
- hasProp = {}.hasOwnProperty,
1329
- slice = [].slice;
1330
-
1331
- Model = window.require('spine/model');
1332
-
1333
- AjaxMixin = __webpack_require__(37);
1334
-
1335
- Helper = window.require('spine/utils/helper');
1336
-
1337
- isArray = Helper.isArray;
1338
-
1339
- defaultAtts = ["name", "user_id", 'uses', "metas", "widget_id"];
1340
-
1341
- Skin = (function(superClass) {
1342
- extend(Skin, superClass);
1343
-
1344
- Skin.extend(AjaxMixin);
1345
-
1346
- Skin.configure('Skin');
1347
-
1348
- Skin.change(AjaxMixin.ajaxChange);
1349
-
1350
- Skin.meta = function(widget_id) {
1351
- return (__webpack_require__(38)).find(widget_id).skinMeta;
1352
- };
1353
-
1354
- function Skin(atts) {
1355
- if (atts == null) {
1356
- atts = {};
1357
- }
1358
- atts.name || (atts.name = 'Untitled Theme');
1359
- atts.uses || (atts.uses = 0);
1360
- atts.metas || (atts.metas = {});
1361
- Skin.__super__.constructor.call(this, atts);
1362
- }
1363
-
1364
- Skin.prototype.attributes = function() {
1365
- var attributes, atts, i, key, len, meta_attributes, meta_props, result, tab, tabs, value;
1366
- attributes = defaultAtts.slice(0);
1367
- try {
1368
- tabs = this.constructor.meta(this.widget_id).tabs;
1369
- if (!tabs) {
1370
- throw new Error("Widget[" + this.widget_id + "].tabs is not loaded.");
1371
- }
1372
- meta_props = (function() {
1373
- var results;
1374
- results = [];
1375
- for (tab in tabs) {
1376
- atts = tabs[tab];
1377
- results.push($.extend({}, atts));
1378
- }
1379
- return results;
1380
- })();
1381
- meta_attributes = $.extend.apply($, [{}].concat(slice.call(meta_props)));
1382
- attributes.push.apply(attributes, (function() {
1383
- var results;
1384
- results = [];
1385
- for (key in meta_attributes) {
1386
- value = meta_attributes[key];
1387
- results.push(key);
1388
- }
1389
- return results;
1390
- })());
1391
- } catch (error) {
1392
- attributes = Object.keys(this);
1393
- if (Object.getPrototypeOf(this) instanceof Skin) {
1394
- attributes = $.extend([], attributes, Object.keys(Object.getPrototypeOf(this)));
1395
- }
1396
- }
1397
- result = {};
1398
- for (i = 0, len = attributes.length; i < len; i++) {
1399
- key = attributes[i];
1400
- if (key in this) {
1401
- if (typeof this[key] !== 'function') {
1402
- result[key] = this[key];
1403
- }
1404
- }
1405
- }
1406
- if (this.id) {
1407
- result.id = this.id;
1408
- }
1409
- return result;
1410
- };
1411
-
1412
- Skin.prototype.used = function(inc) {
1413
- if (inc == null) {
1414
- inc = -1;
1415
- }
1416
- return this.updateAttribute('uses', Math.max((this.uses >> 0) + inc, 0), {
1417
- used: true
1418
- });
1419
- };
1420
-
1421
- Skin.prototype.updateAttributes = function(atts, options) {
1422
- if (options == null) {
1423
- options = {};
1424
- }
1425
- options.ajax = false;
1426
- return Skin.__super__.updateAttributes.apply(this, arguments);
1427
- };
1428
-
1429
- Skin.prototype.changeID = function(id) {
1430
- var Composition, comps, oldId;
1431
- Composition = __webpack_require__(44);
1432
- oldId = this.id;
1433
- Skin.__super__.changeID.apply(this, arguments);
1434
- comps = Composition.findAllByAttribute('skin_id', oldId);
1435
- comps.forEach((function(_this) {
1436
- return function(comp) {
1437
- return comp.updateAttribute('skin_id', _this.id);
1438
- };
1439
- })(this));
1440
- return this.used(comps.length);
1441
- };
1442
-
1443
- Skin.prototype.freeze = function() {
1444
- this.original = this.attributes();
1445
- this.original.id = null;
1446
- delete this.original.uses;
1447
- return delete this.original.id;
1448
- };
1449
-
1450
- Skin.prototype.reset = function() {
1451
- return this.updateAttributes(this.original, {
1452
- ajax: false
1453
- });
1454
- };
1455
-
1456
- Skin.prototype.isPersisted = function() {
1457
- if (!this.id) {
1458
- return false;
1459
- }
1460
- return this.id.slice(0, 1) !== 'c';
1461
- };
1462
-
1463
- Skin.prototype.isPreset = function() {
1464
- return !this.user_id;
1465
- };
1466
-
1467
- Skin.prototype.persist = function() {
1468
- var promise;
1469
- if (this.isPersisted()) {
1470
- promise = this.ajax().update();
1471
- } else {
1472
- promise = this.ajax().create();
1473
- }
1474
- return promise;
1475
- };
1476
-
1477
- return Skin;
1478
-
1479
- })(Model);
1480
-
1481
- module.exports = Skin;
1482
-
1483
-
1484
- /***/ })
1485
-
1486
- /******/ });