@blokkli/editor 1.0.0

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 (395) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/module.cjs +5 -0
  4. package/dist/module.d.mts +129 -0
  5. package/dist/module.d.ts +129 -0
  6. package/dist/module.json +12 -0
  7. package/dist/module.mjs +5430 -0
  8. package/dist/runtime/adapter/drupal/graphql/base.graphql +906 -0
  9. package/dist/runtime/adapter/drupal/graphql/comments.graphql +56 -0
  10. package/dist/runtime/adapter/drupal/graphql/fragments.graphql +25 -0
  11. package/dist/runtime/adapter/drupal/graphql/library.graphql +66 -0
  12. package/dist/runtime/adapter/drupal/graphql/search.graphql +19 -0
  13. package/dist/runtime/adapter/drupal/graphql/transform.graphql +27 -0
  14. package/dist/runtime/adapter/drupal/graphqlMiddleware.d.ts +2 -0
  15. package/dist/runtime/adapter/drupal/graphqlMiddleware.js +643 -0
  16. package/dist/runtime/adapter/index.d.ts +352 -0
  17. package/dist/runtime/adapter/index.js +3 -0
  18. package/dist/runtime/blokkliPlugins/AddAction/index.vue +87 -0
  19. package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +95 -0
  20. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +49 -0
  21. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue +34 -0
  22. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +73 -0
  23. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +132 -0
  24. package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +42 -0
  25. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +74 -0
  26. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +334 -0
  27. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +286 -0
  28. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +104 -0
  29. package/dist/runtime/blokkliPlugins/TourItem/index.vue +45 -0
  30. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +106 -0
  31. package/dist/runtime/blokkliPlugins/index.d.ts +12 -0
  32. package/dist/runtime/blokkliPlugins/index.js +24 -0
  33. package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -0
  34. package/dist/runtime/components/Blocks/Fragment/index.vue +24 -0
  35. package/dist/runtime/components/Blocks/FromLibrary/index.vue +58 -0
  36. package/dist/runtime/components/BlokkliEditable.vue +73 -0
  37. package/dist/runtime/components/BlokkliField.vue +157 -0
  38. package/dist/runtime/components/BlokkliItem.vue +79 -0
  39. package/dist/runtime/components/BlokkliProvider.vue +160 -0
  40. package/dist/runtime/components/Edit/Actions/index.vue +263 -0
  41. package/dist/runtime/components/Edit/AddListItem/index.vue +116 -0
  42. package/dist/runtime/components/Edit/AnimationCanvas/index.vue +122 -0
  43. package/dist/runtime/components/Edit/AppMenu/index.vue +60 -0
  44. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +64 -0
  45. package/dist/runtime/components/Edit/Dialog/index.vue +163 -0
  46. package/dist/runtime/components/Edit/DragInteractions/index.vue +439 -0
  47. package/dist/runtime/components/Edit/DraggableList.vue +110 -0
  48. package/dist/runtime/components/Edit/EditIndicator.vue +82 -0
  49. package/dist/runtime/components/Edit/EditProvider.vue +213 -0
  50. package/dist/runtime/components/Edit/Features/AddList/docs.md +4 -0
  51. package/dist/runtime/components/Edit/Features/AddList/index.vue +205 -0
  52. package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.d.ts +204 -0
  53. package/dist/runtime/components/Edit/Features/Artboard/Manager/Artboard.js +748 -0
  54. package/dist/runtime/components/Edit/Features/Artboard/Manager/Scrollbar/index.vue +176 -0
  55. package/dist/runtime/components/Edit/Features/Artboard/Manager/index.vue +317 -0
  56. package/dist/runtime/components/Edit/Features/Artboard/index.vue +45 -0
  57. package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue +17 -0
  58. package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +147 -0
  59. package/dist/runtime/components/Edit/Features/Assistant/docs.md +7 -0
  60. package/dist/runtime/components/Edit/Features/Assistant/index.vue +68 -0
  61. package/dist/runtime/components/Edit/Features/BlockAddList/docs.md +15 -0
  62. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +440 -0
  63. package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue +68 -0
  64. package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue +56 -0
  65. package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +69 -0
  66. package/dist/runtime/components/Edit/Features/Clipboard/docs.md +16 -0
  67. package/dist/runtime/components/Edit/Features/Clipboard/index.vue +485 -0
  68. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +61 -0
  69. package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +280 -0
  70. package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +51 -0
  71. package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +32 -0
  72. package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +53 -0
  73. package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +100 -0
  74. package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +133 -0
  75. package/dist/runtime/components/Edit/Features/Comments/docs.md +13 -0
  76. package/dist/runtime/components/Edit/Features/Comments/index.vue +110 -0
  77. package/dist/runtime/components/Edit/Features/Conversions/index.vue +98 -0
  78. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +55 -0
  79. package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +93 -0
  80. package/dist/runtime/components/Edit/Features/Debug/docs.md +3 -0
  81. package/dist/runtime/components/Edit/Features/Debug/index.vue +178 -0
  82. package/dist/runtime/components/Edit/Features/Delete/index.vue +43 -0
  83. package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +420 -0
  84. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +58 -0
  85. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +808 -0
  86. package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +57 -0
  87. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +410 -0
  88. package/dist/runtime/components/Edit/Features/Duplicate/index.vue +109 -0
  89. package/dist/runtime/components/Edit/Features/Edit/index.vue +63 -0
  90. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +73 -0
  91. package/dist/runtime/components/Edit/Features/EditForm/index.vue +217 -0
  92. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue +42 -0
  93. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +68 -0
  94. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +81 -0
  95. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +357 -0
  96. package/dist/runtime/components/Edit/Features/EditableField/index.vue +192 -0
  97. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +64 -0
  98. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +108 -0
  99. package/dist/runtime/components/Edit/Features/Exit/index.vue +38 -0
  100. package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +33 -0
  101. package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +43 -0
  102. package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +68 -0
  103. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +137 -0
  104. package/dist/runtime/components/Edit/Features/Fragments/docs.md +101 -0
  105. package/dist/runtime/components/Edit/Features/Fragments/index.vue +86 -0
  106. package/dist/runtime/components/Edit/Features/Grid/index.vue +40 -0
  107. package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue +71 -0
  108. package/dist/runtime/components/Edit/Features/Help/index.vue +53 -0
  109. package/dist/runtime/components/Edit/Features/History/index.vue +263 -0
  110. package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +140 -0
  111. package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +92 -0
  112. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +0 -0
  113. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +73 -0
  114. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +184 -0
  115. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +88 -0
  116. package/dist/runtime/components/Edit/Features/Library/docs.md +127 -0
  117. package/dist/runtime/components/Edit/Features/Library/index.vue +184 -0
  118. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +184 -0
  119. package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +182 -0
  120. package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +57 -0
  121. package/dist/runtime/components/Edit/Features/MediaLibrary/types.js +0 -0
  122. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +90 -0
  123. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +289 -0
  124. package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +182 -0
  125. package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +76 -0
  126. package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +52 -0
  127. package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue +129 -0
  128. package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue +38 -0
  129. package/dist/runtime/components/Edit/Features/Options/Form/Group.vue +25 -0
  130. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +155 -0
  131. package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue +74 -0
  132. package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +135 -0
  133. package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue +47 -0
  134. package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue +38 -0
  135. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +342 -0
  136. package/dist/runtime/components/Edit/Features/Options/index.vue +88 -0
  137. package/dist/runtime/components/Edit/Features/Ownership/index.vue +57 -0
  138. package/dist/runtime/components/Edit/Features/Preview/index.vue +45 -0
  139. package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +30 -0
  140. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +73 -0
  141. package/dist/runtime/components/Edit/Features/Publish/index.vue +50 -0
  142. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +81 -0
  143. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +217 -0
  144. package/dist/runtime/components/Edit/Features/Revert/index.vue +68 -0
  145. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +165 -0
  146. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +211 -0
  147. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +214 -0
  148. package/dist/runtime/components/Edit/Features/Search/index.vue +79 -0
  149. package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +99 -0
  150. package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +144 -0
  151. package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +85 -0
  152. package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +50 -0
  153. package/dist/runtime/components/Edit/Features/Selection/index.vue +295 -0
  154. package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +141 -0
  155. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +138 -0
  156. package/dist/runtime/components/Edit/Features/Settings/index.vue +92 -0
  157. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +181 -0
  158. package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +149 -0
  159. package/dist/runtime/components/Edit/Features/Structure/List/index.vue +55 -0
  160. package/dist/runtime/components/Edit/Features/Structure/index.vue +83 -0
  161. package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +81 -0
  162. package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue +24 -0
  163. package/dist/runtime/components/Edit/Features/Theme/index.vue +122 -0
  164. package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue +26 -0
  165. package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +42 -0
  166. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +270 -0
  167. package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +36 -0
  168. package/dist/runtime/components/Edit/Features/Tour/docs.md +0 -0
  169. package/dist/runtime/components/Edit/Features/Tour/index.vue +46 -0
  170. package/dist/runtime/components/Edit/Features/Transform/docs.md +67 -0
  171. package/dist/runtime/components/Edit/Features/Transform/index.vue +177 -0
  172. package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +50 -0
  173. package/dist/runtime/components/Edit/Features/Translations/index.vue +193 -0
  174. package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue +50 -0
  175. package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue +51 -0
  176. package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +50 -0
  177. package/dist/runtime/components/Edit/Features/Validations/index.vue +70 -0
  178. package/dist/runtime/components/Edit/Features/index.vue +67 -0
  179. package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +39 -0
  180. package/dist/runtime/components/Edit/FormOverlay/index.vue +52 -0
  181. package/dist/runtime/components/Edit/Highlight/index.vue +94 -0
  182. package/dist/runtime/components/Edit/Icon/index.vue +21 -0
  183. package/dist/runtime/components/Edit/ItemIcon/index.vue +27 -0
  184. package/dist/runtime/components/Edit/Loading/index.vue +19 -0
  185. package/dist/runtime/components/Edit/Messages/Item/index.vue +107 -0
  186. package/dist/runtime/components/Edit/Messages/index.vue +37 -0
  187. package/dist/runtime/components/Edit/PreviewProvider.vue +223 -0
  188. package/dist/runtime/components/Edit/RelativeTime/index.vue +37 -0
  189. package/dist/runtime/components/Edit/Resizable/index.vue +90 -0
  190. package/dist/runtime/components/Edit/ScaleToFit/index.vue +57 -0
  191. package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +90 -0
  192. package/dist/runtime/components/Edit/Sortli/index.vue +92 -0
  193. package/dist/runtime/components/Edit/SystemRequirements/index.vue +91 -0
  194. package/dist/runtime/components/Edit/Toolbar/index.vue +106 -0
  195. package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +75 -0
  196. package/dist/runtime/components/Edit/index.d.ts +14 -0
  197. package/dist/runtime/components/Edit/index.js +28 -0
  198. package/dist/runtime/composables/defineBlokkli.d.ts +6 -0
  199. package/dist/runtime/composables/defineBlokkli.js +108 -0
  200. package/dist/runtime/composables/defineBlokkliFeature.d.ts +28 -0
  201. package/dist/runtime/composables/defineBlokkliFeature.js +62 -0
  202. package/dist/runtime/composables/defineBlokkliFragment.d.ts +3 -0
  203. package/dist/runtime/composables/defineBlokkliFragment.js +54 -0
  204. package/dist/runtime/composables/useBlokkli.d.ts +8 -0
  205. package/dist/runtime/composables/useBlokkli.js +5 -0
  206. package/dist/runtime/constants/index.d.ts +4 -0
  207. package/dist/runtime/constants/index.js +2 -0
  208. package/dist/runtime/css/output.css +1 -0
  209. package/dist/runtime/helpers/Artboard/index.d.ts +16 -0
  210. package/dist/runtime/helpers/Artboard/index.js +20 -0
  211. package/dist/runtime/helpers/DragStyle/index.d.ts +12 -0
  212. package/dist/runtime/helpers/DragStyle/index.js +86 -0
  213. package/dist/runtime/helpers/animationProvider.d.ts +25 -0
  214. package/dist/runtime/helpers/animationProvider.js +116 -0
  215. package/dist/runtime/helpers/broadcastProvider.d.ts +7 -0
  216. package/dist/runtime/helpers/broadcastProvider.js +26 -0
  217. package/dist/runtime/helpers/commandsProvider.d.ts +9 -0
  218. package/dist/runtime/helpers/commandsProvider.js +16 -0
  219. package/dist/runtime/helpers/composables/defineCommands.d.ts +2 -0
  220. package/dist/runtime/helpers/composables/defineCommands.js +10 -0
  221. package/dist/runtime/helpers/composables/defineDropAreas.d.ts +2 -0
  222. package/dist/runtime/helpers/composables/defineDropAreas.js +10 -0
  223. package/dist/runtime/helpers/composables/defineShortcut.d.ts +2 -0
  224. package/dist/runtime/helpers/composables/defineShortcut.js +19 -0
  225. package/dist/runtime/helpers/composables/defineTourItem.d.ts +2 -0
  226. package/dist/runtime/helpers/composables/defineTourItem.js +10 -0
  227. package/dist/runtime/helpers/composables/onBlokkliEvent.d.ts +2 -0
  228. package/dist/runtime/helpers/composables/onBlokkliEvent.js +10 -0
  229. package/dist/runtime/helpers/composables/useAnimationFrame.d.ts +1 -0
  230. package/dist/runtime/helpers/composables/useAnimationFrame.js +14 -0
  231. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +2 -0
  232. package/dist/runtime/helpers/composables/useDebugLogger.js +5 -0
  233. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.d.ts +5 -0
  234. package/dist/runtime/helpers/composables/useDelayedIntersectionObserver.js +26 -0
  235. package/dist/runtime/helpers/debugProvider.d.ts +23 -0
  236. package/dist/runtime/helpers/debugProvider.js +65 -0
  237. package/dist/runtime/helpers/dom/index.d.ts +5 -0
  238. package/dist/runtime/helpers/dom/index.js +37 -0
  239. package/dist/runtime/helpers/domProvider.d.ts +46 -0
  240. package/dist/runtime/helpers/domProvider.js +446 -0
  241. package/dist/runtime/helpers/dropAreaProvider.d.ts +9 -0
  242. package/dist/runtime/helpers/dropAreaProvider.js +22 -0
  243. package/dist/runtime/helpers/easing.d.ts +3 -0
  244. package/dist/runtime/helpers/easing.js +16 -0
  245. package/dist/runtime/helpers/eventBus.d.ts +3 -0
  246. package/dist/runtime/helpers/eventBus.js +5 -0
  247. package/dist/runtime/helpers/featuresProvider.d.ts +23 -0
  248. package/dist/runtime/helpers/featuresProvider.js +16 -0
  249. package/dist/runtime/helpers/frameEventBus.d.ts +9 -0
  250. package/dist/runtime/helpers/frameEventBus.js +2 -0
  251. package/dist/runtime/helpers/index.d.ts +87 -0
  252. package/dist/runtime/helpers/index.js +467 -0
  253. package/dist/runtime/helpers/keyboardProvider.d.ts +17 -0
  254. package/dist/runtime/helpers/keyboardProvider.js +79 -0
  255. package/dist/runtime/helpers/options.d.ts +2 -0
  256. package/dist/runtime/helpers/options.js +21 -0
  257. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +10 -0
  258. package/dist/runtime/helpers/runtimeHelpers/index.js +35 -0
  259. package/dist/runtime/helpers/selectionProvider.d.ts +62 -0
  260. package/dist/runtime/helpers/selectionProvider.js +149 -0
  261. package/dist/runtime/helpers/stateProvider.d.ts +35 -0
  262. package/dist/runtime/helpers/stateProvider.js +226 -0
  263. package/dist/runtime/helpers/storageProvider.d.ts +15 -0
  264. package/dist/runtime/helpers/storageProvider.js +61 -0
  265. package/dist/runtime/helpers/symbols.d.ts +16 -0
  266. package/dist/runtime/helpers/symbols.js +18 -0
  267. package/dist/runtime/helpers/textProvider.d.ts +4 -0
  268. package/dist/runtime/helpers/textProvider.js +20 -0
  269. package/dist/runtime/helpers/themeProvider.d.ts +27 -0
  270. package/dist/runtime/helpers/themeProvider.js +124 -0
  271. package/dist/runtime/helpers/tourProvider.d.ts +11 -0
  272. package/dist/runtime/helpers/tourProvider.js +19 -0
  273. package/dist/runtime/helpers/transform.d.ts +2 -0
  274. package/dist/runtime/helpers/transform.js +17 -0
  275. package/dist/runtime/helpers/typesProvider.d.ts +36 -0
  276. package/dist/runtime/helpers/typesProvider.js +138 -0
  277. package/dist/runtime/helpers/uiProvider.d.ts +36 -0
  278. package/dist/runtime/helpers/uiProvider.js +278 -0
  279. package/dist/runtime/helpers/webgl/index.d.ts +32 -0
  280. package/dist/runtime/helpers/webgl/index.js +132 -0
  281. package/dist/runtime/icons/alert.svg +6 -0
  282. package/dist/runtime/icons/area.svg +5 -0
  283. package/dist/runtime/icons/arrow-down.svg +1 -0
  284. package/dist/runtime/icons/arrow-left.svg +1 -0
  285. package/dist/runtime/icons/arrow-right.svg +1 -0
  286. package/dist/runtime/icons/arrow-up.svg +1 -0
  287. package/dist/runtime/icons/artboard-disabled.svg +9 -0
  288. package/dist/runtime/icons/artboard-enabled.svg +29 -0
  289. package/dist/runtime/icons/artboard.svg +1 -0
  290. package/dist/runtime/icons/bug.svg +1 -0
  291. package/dist/runtime/icons/button-pointer.svg +1 -0
  292. package/dist/runtime/icons/caret.svg +12 -0
  293. package/dist/runtime/icons/cellphone.svg +1 -0
  294. package/dist/runtime/icons/chat-question.svg +1 -0
  295. package/dist/runtime/icons/check.svg +1 -0
  296. package/dist/runtime/icons/checkbox.svg +5 -0
  297. package/dist/runtime/icons/checks.svg +1 -0
  298. package/dist/runtime/icons/chevron-left.svg +1 -0
  299. package/dist/runtime/icons/chevron-right.svg +1 -0
  300. package/dist/runtime/icons/clipboard.svg +5 -0
  301. package/dist/runtime/icons/close.svg +5 -0
  302. package/dist/runtime/icons/cog.svg +5 -0
  303. package/dist/runtime/icons/command.svg +1 -0
  304. package/dist/runtime/icons/comment.svg +5 -0
  305. package/dist/runtime/icons/comment_add.svg +5 -0
  306. package/dist/runtime/icons/convert.svg +1 -0
  307. package/dist/runtime/icons/cursor-move.svg +1 -0
  308. package/dist/runtime/icons/dead.svg +1 -0
  309. package/dist/runtime/icons/delete.svg +8 -0
  310. package/dist/runtime/icons/detach.svg +7 -0
  311. package/dist/runtime/icons/drag.svg +1 -0
  312. package/dist/runtime/icons/duplicate.svg +12 -0
  313. package/dist/runtime/icons/edit.svg +8 -0
  314. package/dist/runtime/icons/exit.svg +6 -0
  315. package/dist/runtime/icons/expand.svg +1 -0
  316. package/dist/runtime/icons/file.svg +1 -0
  317. package/dist/runtime/icons/form.svg +1 -0
  318. package/dist/runtime/icons/fragment.svg +1 -0
  319. package/dist/runtime/icons/grid.svg +13 -0
  320. package/dist/runtime/icons/group.svg +5 -0
  321. package/dist/runtime/icons/help.svg +1 -0
  322. package/dist/runtime/icons/history.svg +1 -0
  323. package/dist/runtime/icons/image.svg +1 -0
  324. package/dist/runtime/icons/import.svg +5 -0
  325. package/dist/runtime/icons/laptop.svg +1 -0
  326. package/dist/runtime/icons/list-view-grid.svg +1 -0
  327. package/dist/runtime/icons/list-view-horizontal.svg +1 -0
  328. package/dist/runtime/icons/loader.svg +1 -0
  329. package/dist/runtime/icons/logo.svg +5 -0
  330. package/dist/runtime/icons/magnifier.svg +5 -0
  331. package/dist/runtime/icons/menu.svg +1 -0
  332. package/dist/runtime/icons/minus.svg +1 -0
  333. package/dist/runtime/icons/monitor.svg +1 -0
  334. package/dist/runtime/icons/multi-select.svg +1 -0
  335. package/dist/runtime/icons/multimedia.svg +1 -0
  336. package/dist/runtime/icons/opacity.svg +5 -0
  337. package/dist/runtime/icons/open_in_new.svg +3 -0
  338. package/dist/runtime/icons/palette.svg +1 -0
  339. package/dist/runtime/icons/plus-box.svg +1 -0
  340. package/dist/runtime/icons/plus.svg +1 -0
  341. package/dist/runtime/icons/preview.svg +5 -0
  342. package/dist/runtime/icons/publish.svg +12 -0
  343. package/dist/runtime/icons/puzzle.svg +1 -0
  344. package/dist/runtime/icons/qrcode.svg +5 -0
  345. package/dist/runtime/icons/question.svg +5 -0
  346. package/dist/runtime/icons/redo.svg +12 -0
  347. package/dist/runtime/icons/resize.svg +1 -0
  348. package/dist/runtime/icons/reusable.svg +5 -0
  349. package/dist/runtime/icons/revert.svg +5 -0
  350. package/dist/runtime/icons/robot.svg +1 -0
  351. package/dist/runtime/icons/rotate-phone.svg +1 -0
  352. package/dist/runtime/icons/sad.svg +1 -0
  353. package/dist/runtime/icons/save.svg +1 -0
  354. package/dist/runtime/icons/script.svg +1 -0
  355. package/dist/runtime/icons/scrolltotop.svg +6 -0
  356. package/dist/runtime/icons/search.svg +1 -0
  357. package/dist/runtime/icons/selection.svg +5 -0
  358. package/dist/runtime/icons/spinner.svg +15 -0
  359. package/dist/runtime/icons/star.svg +1 -0
  360. package/dist/runtime/icons/swap-horizontal.svg +1 -0
  361. package/dist/runtime/icons/tablet.svg +1 -0
  362. package/dist/runtime/icons/textbox.svg +1 -0
  363. package/dist/runtime/icons/texturebox.svg +5 -0
  364. package/dist/runtime/icons/tiktok.svg +1 -0
  365. package/dist/runtime/icons/title.svg +1 -0
  366. package/dist/runtime/icons/tools.svg +1 -0
  367. package/dist/runtime/icons/translate.svg +5 -0
  368. package/dist/runtime/icons/tree.svg +5 -0
  369. package/dist/runtime/icons/tutor.svg +1 -0
  370. package/dist/runtime/icons/ui-list-horizontal.svg +19 -0
  371. package/dist/runtime/icons/ui-list-sidebar.svg +21 -0
  372. package/dist/runtime/icons/ui-list-vertical.svg +9 -0
  373. package/dist/runtime/icons/undo.svg +12 -0
  374. package/dist/runtime/icons/unstar.svg +1 -0
  375. package/dist/runtime/icons/upload.svg +1 -0
  376. package/dist/runtime/icons/user.svg +1 -0
  377. package/dist/runtime/icons/video-outline.svg +1 -0
  378. package/dist/runtime/icons/vimeo.svg +3 -0
  379. package/dist/runtime/icons/window-maximize.svg +1 -0
  380. package/dist/runtime/icons/window-minimize.svg +1 -0
  381. package/dist/runtime/icons/youtube.svg +3 -0
  382. package/dist/runtime/plugins/blokkliEditable.d.ts +2 -0
  383. package/dist/runtime/plugins/blokkliEditable.js +31 -0
  384. package/dist/runtime/public/Inter.var.woff2 +0 -0
  385. package/dist/runtime/types/blokkOptions.d.ts +83 -0
  386. package/dist/runtime/types/blokkOptions.js +0 -0
  387. package/dist/runtime/types/generatedModuleTypes.d.ts +41 -0
  388. package/dist/runtime/types/generatedModuleTypes.js +0 -0
  389. package/dist/runtime/types/index.d.ts +1052 -0
  390. package/dist/runtime/types/index.js +1 -0
  391. package/dist/runtime/types/theme.d.ts +33 -0
  392. package/dist/runtime/types/theme.js +0 -0
  393. package/dist/types.d.mts +1 -0
  394. package/dist/types.d.ts +1 -0
  395. package/package.json +103 -0
@@ -0,0 +1,223 @@
1
+ <template>
2
+ <slot :mutated-entity="mutatedEntity" />
3
+ </template>
4
+
5
+ <script lang="ts" setup generic="T">
6
+ import {
7
+ ref,
8
+ reactive,
9
+ computed,
10
+ provide,
11
+ onMounted,
12
+ onBeforeUnmount,
13
+ useRouter,
14
+ useAsyncData,
15
+ } from '#imports'
16
+ import type {
17
+ MutatedOptions,
18
+ MutatedField,
19
+ UpdateBlockOptionEvent,
20
+ ItemEditContext,
21
+ } from '#blokkli/types'
22
+ import '#blokkli/styles'
23
+ import getAdapter from '#blokkli/compiled-edit-adapter'
24
+ import {
25
+ INJECT_EDIT_CONTEXT,
26
+ INJECT_IS_PREVIEW,
27
+ INJECT_MUTATED_FIELDS_MAP,
28
+ } from '#blokkli/helpers/symbols'
29
+ import { frameEventBus } from '#blokkli/helpers/frameEventBus'
30
+ import broadcastProvider from '#blokkli/helpers/broadcastProvider'
31
+ import { getFieldKey, intersects } from '#blokkli/helpers'
32
+ import type { AdapterContext } from '../../adapter'
33
+ import { eventBus } from '#blokkli/helpers/eventBus'
34
+
35
+ const props = defineProps<{
36
+ entity?: T
37
+ entityType: string
38
+ entityUuid: string
39
+ entityBundle: string
40
+ language: string
41
+ }>()
42
+
43
+ const context = computed<AdapterContext>(() => {
44
+ return {
45
+ entityType: props.entityType,
46
+ entityBundle: props.entityBundle,
47
+ entityUuid: props.entityUuid,
48
+ language: props.language,
49
+ }
50
+ })
51
+ const adapter = await getAdapter(context)
52
+ const router = useRouter()
53
+ const broadcast = broadcastProvider()
54
+
55
+ let timeout: any = null
56
+ let lastChanged: number = 0
57
+ const mutatedFieldsMap = reactive<Record<string, MutatedField | undefined>>({})
58
+ const mutatedOptions = reactive<MutatedOptions>({})
59
+ const mutatedEntityFromState = ref<T | null>(null)
60
+
61
+ const mutatedEntity = computed(
62
+ () => mutatedEntityFromState.value || props.entity,
63
+ )
64
+
65
+ const { data, refresh } = await useAsyncData(() =>
66
+ adapter.loadState().then((v) => adapter.mapState(v)),
67
+ )
68
+
69
+ function updateMutatedFields(fields: MutatedField[]) {
70
+ fields.forEach((field) => {
71
+ const key = getFieldKey(field.entityUuid, field.name)
72
+ mutatedFieldsMap[key] = field
73
+ })
74
+ }
75
+
76
+ const updateState = () => {
77
+ const fields = data.value?.mutatedState?.fields || []
78
+ updateMutatedFields(fields)
79
+ mutatedEntityFromState.value = data.value?.mutatedEntity
80
+
81
+ const options = (mutatedOptions.value =
82
+ data.value?.mutatedState?.mutatedOptions || {})
83
+ const optionKeys = Object.keys(options)
84
+
85
+ for (let i = 0; i < optionKeys.length; i++) {
86
+ const key = optionKeys[i]
87
+ const newOptions = options[key]
88
+ const existing = mutatedOptions[key]
89
+ if (!existing || JSON.stringify(existing) !== JSON.stringify(newOptions)) {
90
+ mutatedOptions[key] = newOptions
91
+ }
92
+ }
93
+ }
94
+
95
+ updateState()
96
+
97
+ provide(INJECT_MUTATED_FIELDS_MAP, mutatedFieldsMap)
98
+ provide(INJECT_IS_PREVIEW, true)
99
+ provide<ItemEditContext>(INJECT_EDIT_CONTEXT, {
100
+ mutatedOptions,
101
+ eventBus,
102
+ })
103
+
104
+ /**
105
+ * Listen to window messages and emit the matching frameEventBus event.
106
+ */
107
+ function onMessage(e: MessageEvent) {
108
+ if (
109
+ e.data &&
110
+ typeof e.data === 'object' &&
111
+ e.data.name &&
112
+ typeof e.data.name === 'string' &&
113
+ e.data.name.startsWith('blokkli__')
114
+ ) {
115
+ const name = e.data.name.replace('blokkli__', '')
116
+ const data = e.data.data
117
+ frameEventBus.emit(name, data)
118
+ }
119
+ }
120
+
121
+ const onMouseDown = () => {
122
+ broadcast.emit('previewFocused')
123
+ }
124
+
125
+ /**
126
+ * Check the last changed date and update the mutated state if there is an
127
+ * update.
128
+ */
129
+ function checkChangedDate() {
130
+ clearTimeout(timeout)
131
+
132
+ const delay = adapter.getLastChanged ? 1000 : 5000
133
+
134
+ timeout = setTimeout(async () => {
135
+ const changed = adapter.getLastChanged
136
+ ? await adapter.getLastChanged()
137
+ : Date.now()
138
+ if (changed) {
139
+ if (lastChanged !== 0 && lastChanged !== changed) {
140
+ await refresh()
141
+ updateState()
142
+ }
143
+ lastChanged = changed
144
+ checkChangedDate()
145
+ }
146
+ }, delay)
147
+ }
148
+
149
+ const onWheel = (e: WheelEvent) => {
150
+ if (e.ctrlKey) {
151
+ e.preventDefault()
152
+ }
153
+ }
154
+
155
+ const isInIframe = () => window.parent !== window
156
+
157
+ const onFocusItem = (uuid: string) => {
158
+ const el = document.querySelector(`[data-uuid="${uuid}"]`)
159
+ if (el) {
160
+ const elRect = el.getBoundingClientRect()
161
+ if (
162
+ !intersects(elRect, {
163
+ x: 0,
164
+ y: 0,
165
+ width: window.innerWidth,
166
+ height: window.innerHeight,
167
+ })
168
+ ) {
169
+ el.scrollIntoView({
170
+ behavior: 'smooth',
171
+ block: 'center',
172
+ inline: 'center',
173
+ })
174
+ }
175
+ }
176
+ }
177
+ const onUpdateOption = (option: UpdateBlockOptionEvent) => {
178
+ const { uuid, key, value } = option
179
+
180
+ if (!mutatedOptions.value[uuid]) {
181
+ mutatedOptions[uuid] = {}
182
+ }
183
+ if (!mutatedOptions.value[uuid]) {
184
+ mutatedOptions[uuid] = {}
185
+ }
186
+ mutatedOptions[uuid][key] = value
187
+ }
188
+
189
+ onMounted(() => {
190
+ if (isInIframe()) {
191
+ frameEventBus.on('mutatedFields', updateMutatedFields)
192
+ frameEventBus.on('focus', onFocusItem)
193
+ frameEventBus.on('updateOption', onUpdateOption)
194
+ // We are a preview inside the iframe of the main editing app.
195
+ // In this case updated state is passed in via postMessage from the main
196
+ // editing app.
197
+ document.body.classList.add('bk-body-preview')
198
+ document.documentElement.classList.add('bk-html-preview')
199
+ window.addEventListener('message', onMessage)
200
+ window.addEventListener('wheel', onWheel, { passive: false })
201
+ document.documentElement.addEventListener('mousedown', onMouseDown)
202
+
203
+ // Prevent navigating away from the preview when clicking Nuxt links.
204
+ router.push = () => Promise.resolve()
205
+ router.replace = () => Promise.resolve()
206
+ } else {
207
+ // We are a standalone page in preview mode. Setup polling for changes.
208
+ checkChangedDate()
209
+ }
210
+ })
211
+
212
+ onBeforeUnmount(() => {
213
+ clearTimeout(timeout)
214
+ document.body.classList.remove('bk-body-preview')
215
+ document.documentElement.classList.remove('bk-html-preview')
216
+ window.removeEventListener('wheel', onWheel)
217
+ window.removeEventListener('message', onMessage)
218
+ document.documentElement.removeEventListener('mousedown', onMouseDown)
219
+ frameEventBus.off('mutatedFields', updateMutatedFields)
220
+ frameEventBus.off('focus', onFocusItem)
221
+ frameEventBus.off('updateOption', onUpdateOption)
222
+ })
223
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <slot :formatted="formatted" />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { ref, computed, onMounted, onBeforeUnmount } from '#imports'
7
+ import { getRelativeTimeString } from '#blokkli/helpers'
8
+
9
+ const props = defineProps<{
10
+ timestamp: number
11
+ }>()
12
+
13
+ const incrementToggle = ref(0)
14
+ let interval: any = null
15
+
16
+ const formatted = computed(() => {
17
+ // Adding the toggle value forces an update every 5 seconds, so the relative time stays correct.
18
+ const date = new Date(props.timestamp * 1000 + incrementToggle.value)
19
+ return getRelativeTimeString(date)
20
+ })
21
+
22
+ onMounted(() => {
23
+ interval = setInterval(() => {
24
+ incrementToggle.value = incrementToggle.value ? 0 : 1
25
+ }, 1000)
26
+ })
27
+
28
+ onBeforeUnmount(() => {
29
+ clearInterval(interval)
30
+ })
31
+ </script>
32
+
33
+ <script lang="ts">
34
+ export default {
35
+ name: 'RelativeTime',
36
+ }
37
+ </script>
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <div
3
+ class="bk-resizable"
4
+ :style="style"
5
+ :class="{ 'bk-is-resizing': isResizing }"
6
+ @wheel.passive.stop
7
+ >
8
+ <div class="bk-resizable-inner">
9
+ <slot />
10
+ </div>
11
+ <button class="bk-resizable-handle" @mousedown="onMouseDown" />
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { ref, useBlokkli, computed, onBeforeUnmount } from '#imports'
17
+
18
+ const { storage, ui } = useBlokkli()
19
+
20
+ const props = defineProps<{
21
+ id: string
22
+ }>()
23
+
24
+ const storageKey = computed(() => 'resizable:width:' + props.id)
25
+ const persistedWidth = storage.use(storageKey, 600)
26
+ const width = ref(persistedWidth.value)
27
+ const startX = ref(0)
28
+ const startWidth = ref(0)
29
+ const isResizing = ref(false)
30
+
31
+ const style = computed(() => {
32
+ if (ui.isMobile.value) {
33
+ return {}
34
+ }
35
+
36
+ return { width: width.value + 'px' }
37
+ })
38
+
39
+ function onMouseMove(e: MouseEvent) {
40
+ if (ui.isMobile.value) {
41
+ return
42
+ }
43
+ e.stopPropagation()
44
+ e.preventDefault()
45
+ width.value = Math.max(
46
+ Math.min(
47
+ startWidth.value + (startX.value - e.clientX),
48
+ window.innerWidth - 200,
49
+ ),
50
+ 350,
51
+ )
52
+ }
53
+
54
+ function onMouseUp(e: MouseEvent) {
55
+ if (ui.isMobile.value) {
56
+ return
57
+ }
58
+ e.stopPropagation()
59
+ e.preventDefault()
60
+ isResizing.value = false
61
+ window.removeEventListener('mousemove', onMouseMove)
62
+ window.removeEventListener('mouseup', onMouseUp)
63
+ persistedWidth.value = width.value
64
+ }
65
+
66
+ function onMouseDown(e: MouseEvent) {
67
+ if (ui.isMobile.value || e.button !== 0) {
68
+ return
69
+ }
70
+ startX.value = e.clientX
71
+ startWidth.value = width.value
72
+ isResizing.value = true
73
+ e.preventDefault()
74
+ e.stopPropagation()
75
+
76
+ window.addEventListener('mousemove', onMouseMove)
77
+ window.addEventListener('mouseup', onMouseUp)
78
+ }
79
+
80
+ onBeforeUnmount(() => {
81
+ window.removeEventListener('mousemove', onMouseMove)
82
+ window.removeEventListener('mouseup', onMouseUp)
83
+ })
84
+ </script>
85
+
86
+ <script lang="ts">
87
+ export default {
88
+ name: 'Resizable',
89
+ }
90
+ </script>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div ref="root" class="bk-scale-to-fit" :style="style">
3
+ <div ref="wrapper" class="bk-scale-to-fit-wrapper">
4
+ <div ref="inner" class="bk-scale-to-fit-wrapper-item" :style="innerStyle">
5
+ <slot />
6
+ </div>
7
+ </div>
8
+ </div>
9
+ </template>
10
+
11
+ <script lang="ts" setup>
12
+ import useAnimationFrame from '#blokkli/helpers/composables/useAnimationFrame'
13
+ import { ref, computed } from '#imports'
14
+
15
+ const props = defineProps<{
16
+ width?: number
17
+ }>()
18
+
19
+ const root = ref<HTMLDivElement | null>(null)
20
+ const inner = ref<HTMLDivElement | null>(null)
21
+ const wrapper = ref<HTMLDivElement | null>(null)
22
+ const rootWidth = ref(260)
23
+ const nativeWidth = ref(0)
24
+ const nativeHeight = ref(0)
25
+ const computedHeight = ref(0)
26
+
27
+ const style = computed(() => {
28
+ return {
29
+ height: computedHeight.value + 'px',
30
+ }
31
+ })
32
+
33
+ const innerStyle = computed(() => {
34
+ return {
35
+ width: props.width ? props.width + 'px' : 'auto',
36
+ transform: `scale(${rootWidth.value / nativeWidth.value})`,
37
+ }
38
+ })
39
+
40
+ useAnimationFrame(() => {
41
+ if (root.value) {
42
+ rootWidth.value = root.value.offsetWidth
43
+ }
44
+ if (inner.value) {
45
+ const rect = inner.value.getBoundingClientRect()
46
+ nativeHeight.value = inner.value.offsetHeight
47
+ nativeWidth.value = Math.max(inner.value.offsetWidth, rootWidth.value)
48
+ computedHeight.value = rect.height
49
+ }
50
+ })
51
+ </script>
52
+
53
+ <script lang="ts">
54
+ export default {
55
+ name: 'ScaleToFit',
56
+ }
57
+ </script>
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <kbd :title="label" class="bk-shortcut">
3
+ <template v-if="meta"> <kbd>CTRL</kbd> + </template>
4
+ <template v-if="shift"> <kbd>SHIFT</kbd> + </template>
5
+ <kbd>{{ keyLabel }}</kbd>
6
+ </kbd>
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { computed, useBlokkli, onMounted, onBeforeUnmount } from '#imports'
11
+ import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
12
+ import defineShortcut from '#blokkli/helpers/composables/defineShortcut'
13
+
14
+ const props = defineProps<{
15
+ group?: string
16
+ viewOnly?: boolean
17
+ meta?: boolean
18
+ shift?: boolean
19
+ keyCode: string
20
+ label: string
21
+ }>()
22
+
23
+ const emit = defineEmits(['pressed'])
24
+
25
+ const { state } = useBlokkli()
26
+
27
+ const key = computed(() =>
28
+ [props.meta, props.shift, props.keyCode.toLowerCase()].join('-'),
29
+ )
30
+
31
+ const keyLabel = computed(() => {
32
+ if (props.keyCode === 'Delete') {
33
+ return '⌫'
34
+ } else if (props.keyCode === 'ArrowDown') {
35
+ return '↓'
36
+ } else if (props.keyCode === 'ArrowUp') {
37
+ return '↑'
38
+ } else if (props.keyCode === 'ArrowRight') {
39
+ return '→'
40
+ } else if (props.keyCode === 'ArrowLeft') {
41
+ return '←'
42
+ } else if (props.keyCode === 'Digit0' || props.keyCode === '0') {
43
+ return ''
44
+ }
45
+
46
+ return props.keyCode.toUpperCase()
47
+ })
48
+
49
+ if (!props.viewOnly) {
50
+ defineShortcut({
51
+ meta: props.meta,
52
+ shift: props.shift,
53
+ code: props.keyCode,
54
+ label: props.label,
55
+ group: props.group,
56
+ })
57
+ }
58
+
59
+ onBlokkliEvent('keyPressed', (e) => {
60
+ const checkKey = [e.meta, e.shift, e.code.toLowerCase()].join('-')
61
+ if (key.value !== checkKey) {
62
+ return
63
+ }
64
+
65
+ e.originalEvent.preventDefault()
66
+
67
+ if (state.isLoading.value) {
68
+ return
69
+ }
70
+ emit('pressed')
71
+ })
72
+
73
+ onMounted(() => {
74
+ if (props.viewOnly) {
75
+ return
76
+ }
77
+ })
78
+
79
+ onBeforeUnmount(() => {
80
+ if (props.viewOnly) {
81
+ return
82
+ }
83
+ })
84
+ </script>
85
+
86
+ <script lang="ts">
87
+ export default {
88
+ name: 'ShortcutIndicator',
89
+ }
90
+ </script>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div
3
+ @pointerdown.capture.prevent="onPointerDown"
4
+ @pointerup.capture.prevent="onPointerUp"
5
+ @pointermove.capture.prevent="onPointerMove"
6
+ >
7
+ <slot />
8
+ </div>
9
+ </template>
10
+
11
+ <script lang="ts" setup>
12
+ import type { Coord, DraggableItem } from '#blokkli/types'
13
+ import { useBlokkli } from '#imports'
14
+ import {
15
+ buildDraggableItem,
16
+ getDistance,
17
+ getInteractionCoordinates,
18
+ } from '#blokkli/helpers'
19
+
20
+ const { eventBus } = useBlokkli()
21
+
22
+ let pointerStartCoords: Coord | null = null
23
+ let activeItem: DraggableItem | null = null
24
+
25
+ function onPointerDown(e: PointerEvent) {
26
+ if (!(e.target instanceof HTMLElement || e.target instanceof SVGElement)) {
27
+ return
28
+ }
29
+ if (e.button !== 0) {
30
+ pointerStartCoords = null
31
+ return
32
+ }
33
+ pointerStartCoords = getInteractionCoordinates(e)
34
+
35
+ const sortliItem = e.target.closest('[data-sortli-id]')
36
+ if (!sortliItem) {
37
+ return
38
+ }
39
+
40
+ const item = buildDraggableItem(sortliItem)
41
+
42
+ if (!item) {
43
+ return
44
+ }
45
+
46
+ activeItem = item
47
+ }
48
+
49
+ function onPointerMove(e: PointerEvent) {
50
+ if (!pointerStartCoords || !activeItem || e.pointerType === 'touch') {
51
+ return
52
+ }
53
+
54
+ const coords = getInteractionCoordinates(e)
55
+ const distance = getDistance(coords, pointerStartCoords)
56
+
57
+ if (distance > 7) {
58
+ eventBus.emit('dragging:start', {
59
+ items: [activeItem],
60
+ coords,
61
+ mode: 'mouse',
62
+ })
63
+ activeItem = null
64
+ pointerStartCoords = null
65
+ }
66
+ }
67
+
68
+ function onPointerUp(e: PointerEvent) {
69
+ if (!pointerStartCoords || !activeItem) {
70
+ pointerStartCoords = null
71
+ activeItem = null
72
+ return
73
+ }
74
+ const coords = getInteractionCoordinates(e)
75
+ const distance = getDistance(coords, pointerStartCoords)
76
+ if (e.pointerType === 'touch' && distance < 5) {
77
+ eventBus.emit('dragging:start', {
78
+ items: [activeItem],
79
+ coords,
80
+ mode: 'touch',
81
+ })
82
+ }
83
+
84
+ pointerStartCoords = null
85
+ }
86
+ </script>
87
+
88
+ <script lang="ts">
89
+ export default {
90
+ name: 'Sortli',
91
+ }
92
+ </script>
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <Teleport v-if="showDialog" to="body">
3
+ <transition appear name="bk-slide-up">
4
+ <DialogModal
5
+ :title="$t('systemRequirementsDialogTitle', 'System Requirements')"
6
+ :width="700"
7
+ :submit-label="$t('systemRequirementsDialogButton', 'Continue anyway')"
8
+ :lead="
9
+ $t(
10
+ 'systemRequirementsDialogLead',
11
+ 'blökkli has detected that your browser does not meet one or more system requirements. For the best experience, please use a browser that supports all the listed requirements.',
12
+ )
13
+ "
14
+ icon="sad"
15
+ @submit="dismiss"
16
+ @cancel="dismiss"
17
+ >
18
+ <ul class="bk-system-requirements">
19
+ <li
20
+ v-for="requirement in requirements"
21
+ :key="requirement.id"
22
+ :class="{
23
+ 'bk-is-success': requirement.supported === true,
24
+ 'bk-is-error': requirement.supported === false,
25
+ 'bk-is-warning': requirement.supported === null,
26
+ }"
27
+ >
28
+ <div>
29
+ <h3>
30
+ <span>{{ requirement.title }}</span>
31
+ <div class="bk-system-requirements-icon">
32
+ <Icon :name="requirement.supported ? 'check' : 'close'" />
33
+ </div>
34
+ </h3>
35
+ <p>{{ requirement.description }}</p>
36
+ </div>
37
+ </li>
38
+ </ul>
39
+
40
+ <p>
41
+ {{
42
+ $t(
43
+ 'systemRequirementsDialogText',
44
+ 'blökkli has been tested and optimized for the latest versions of Chrome, Firefox, Edge, and Safari. Features like WebGL are well supported, but they may sometimes be disabled for performance or security reasons.',
45
+ )
46
+ }}
47
+ </p>
48
+ </DialogModal>
49
+ </transition>
50
+ </Teleport>
51
+ </template>
52
+
53
+ <script setup lang="ts">
54
+ import { useBlokkli, computed } from '#imports'
55
+ import { DialogModal, Icon } from '#blokkli/components'
56
+
57
+ const { $t, storage, animation } = useBlokkli()
58
+
59
+ const hasDismissed = storage.use('system_requirements_dismissed', false)
60
+
61
+ type SystemRequirement = {
62
+ id: string
63
+ title: string
64
+ description: string
65
+ supported: boolean | null
66
+ }
67
+
68
+ const requirements = computed<SystemRequirement[]>(() => {
69
+ return [
70
+ {
71
+ id: 'webgl',
72
+ title: 'WebGL',
73
+ description: $t(
74
+ 'systemRequirementsWebglText',
75
+ 'blökkli uses WebGL for fast rendering of UI elements such as selected blocks and drag-and-drop indicators. If WebGL is not supported, Blökkli will resort to fallback rendering, which is slower and lacks full feature support.',
76
+ ),
77
+ supported: animation.webglSupported.value,
78
+ },
79
+ ]
80
+ })
81
+
82
+ const showDialog = computed(
83
+ () =>
84
+ !hasDismissed.value &&
85
+ requirements.value.some((v) => v.supported === false),
86
+ )
87
+
88
+ function dismiss() {
89
+ hasDismissed.value = true
90
+ }
91
+ </script>