@123usmanhaider321/ui 0.1.8 → 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 (545) hide show
  1. package/README.md +416 -31
  2. package/dist/images/icon/1LINK.svg +50 -0
  3. package/dist/images/icon/CreditCard.svg +83 -0
  4. package/dist/images/icon/Easypaisa.png +0 -0
  5. package/dist/images/icon/MobileWallet.png +0 -0
  6. package/dist/images/icon/Raast-Logo.png +0 -0
  7. package/dist/images/icon/VISA.png +0 -0
  8. package/dist/images/icon/add-circle-1.svg +5 -0
  9. package/dist/images/icon/check-circle-broken.svg +3 -0
  10. package/dist/images/icon/close-circle.svg +5 -0
  11. package/dist/images/icon/jazzcash.png +0 -0
  12. package/dist/images/icon/loading_icon.json +3347 -0
  13. package/dist/images/icon/mastercard-logo.webp +0 -0
  14. package/dist/images/icon/paymo.jpeg +0 -0
  15. package/dist/images/icon/preview-svgrepo-com.svg +36 -0
  16. package/dist/images/icon/trash.svg +7 -0
  17. package/dist/images/icon/unionpay-logo.svg +9 -0
  18. package/dist/index-87FQZHOs.js +11119 -0
  19. package/dist/index-87FQZHOs.js.map +1 -0
  20. package/dist/index-Tl9g213f.js +60475 -0
  21. package/dist/index-Tl9g213f.js.map +1 -0
  22. package/dist/index.d.ts +1 -10
  23. package/dist/index.es-CpgTaa1Y.js +16734 -0
  24. package/dist/index.es-CpgTaa1Y.js.map +1 -0
  25. package/dist/index.js +40 -12
  26. package/dist/index.js.map +1 -1
  27. package/dist/loading_icon-n5H5dQBl.js +3375 -0
  28. package/dist/loading_icon-n5H5dQBl.js.map +1 -0
  29. package/dist/src/components/Alert/ErrorAlert.d.ts +6 -0
  30. package/dist/src/components/Alert/SuccessAlert.d.ts +6 -0
  31. package/dist/{components → src/components}/FormBuilder/DiscountInput.d.ts +3 -6
  32. package/dist/{components → src/components}/FormBuilder/FormBuilder.d.ts +2 -11
  33. package/dist/{components → src/components}/FormBuilder/QuestionCard.d.ts +0 -5
  34. package/dist/{components → src/components}/FormBuilder/QuestionEditor.d.ts +0 -5
  35. package/dist/{components → src/components}/FormBuilder/SortableQuestionList.d.ts +0 -5
  36. package/dist/src/components/FormBuilder/questionIcons.d.ts +5 -0
  37. package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventLayout.d.ts +2 -1
  38. package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventStepper.d.ts +2 -2
  39. package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/ConfirmationModal.d.ts +1 -1
  40. package/dist/src/components/NewAddEvent/components/EventSubmissionConfirmationModal.d.ts +14 -0
  41. package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/TicketTierSection.d.ts +1 -1
  42. package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTierForm.d.ts +1 -1
  43. package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useStepperForm.d.ts +22 -22
  44. package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useTicketTierForm.d.ts +63 -15
  45. package/dist/src/components/NewAddEvent/schemas/step1.d.ts +211 -0
  46. package/dist/src/components/NewAddEvent/schemas/step2.d.ts +411 -0
  47. package/dist/{components/EventAddForm → src/components/NewAddEvent}/schemas/utils.d.ts +8 -2
  48. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/IndividualFormStep.d.ts +1 -1
  49. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/SocialProfilesStep.d.ts +1 -1
  50. package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/TeamFormStep.d.ts +1 -1
  51. package/dist/src/components/Spinner/spinner.d.ts +4 -0
  52. package/dist/src/components/TicketlyUIProvider.d.ts +35 -0
  53. package/dist/src/components/common/Loader/index.d.ts +8 -0
  54. package/dist/src/components/common/Modals/ConfirmationModal.d.ts +7 -0
  55. package/dist/{components/FormInput → src/components/ui}/FormInput.d.ts +1 -1
  56. package/dist/src/components/ui/Loader.d.ts +4 -0
  57. package/dist/{components/Button/Button.d.ts → src/components/ui/button.d.ts} +1 -1
  58. package/dist/src/index.d.ts +10 -0
  59. package/dist/{lib → src/lib}/actions.d.ts +0 -126
  60. package/dist/src/lib/dom-utils.d.ts +2 -0
  61. package/dist/src/lib/storage-utils.d.ts +5 -0
  62. package/dist/src/lib/types.d.ts +258 -0
  63. package/dist/src/redux/baseQuery.d.ts +16 -0
  64. package/dist/{services → src/redux/features}/eventApi.d.ts +1053 -1745
  65. package/dist/src/redux/features/globalSlice.d.ts +17 -0
  66. package/dist/{services → src/redux/features/single-event}/single-event-api.d.ts +856 -1190
  67. package/dist/src/redux/types.d.ts +2 -0
  68. package/dist/src/services/library-services.d.ts +15 -0
  69. package/dist/src/services/remote-config.d.ts +27 -0
  70. package/dist/{services → src/services}/utils.d.ts +1 -1
  71. package/dist/src/theme/colors.d.ts +127 -0
  72. package/dist/src/theme/typography.d.ts +13 -0
  73. package/dist/src/types/api.d.ts +18 -0
  74. package/dist/style.css +2984 -0
  75. package/dist/styles.css +3758 -4012
  76. package/package.json +78 -68
  77. package/dist/_virtual/_commonjsHelpers.js +0 -9
  78. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  79. package/dist/_virtual/customParseFormat.js +0 -5
  80. package/dist/_virtual/customParseFormat.js.map +0 -1
  81. package/dist/_virtual/dayjs.min.js +0 -5
  82. package/dist/_virtual/dayjs.min.js.map +0 -1
  83. package/dist/_virtual/duration.js +0 -5
  84. package/dist/_virtual/duration.js.map +0 -1
  85. package/dist/_virtual/index.js +0 -5
  86. package/dist/_virtual/index.js.map +0 -1
  87. package/dist/_virtual/isBetween.js +0 -5
  88. package/dist/_virtual/isBetween.js.map +0 -1
  89. package/dist/_virtual/relativeTime.js +0 -5
  90. package/dist/_virtual/relativeTime.js.map +0 -1
  91. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
  92. package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
  93. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
  94. package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
  95. package/dist/_virtual/with-selector.development.js +0 -5
  96. package/dist/_virtual/with-selector.development.js.map +0 -1
  97. package/dist/_virtual/with-selector.js +0 -5
  98. package/dist/_virtual/with-selector.js.map +0 -1
  99. package/dist/_virtual/with-selector.production.js +0 -5
  100. package/dist/_virtual/with-selector.production.js.map +0 -1
  101. package/dist/components/Alert/Alert.js +0 -51
  102. package/dist/components/Alert/Alert.js.map +0 -1
  103. package/dist/components/Button/Button.js +0 -52
  104. package/dist/components/Button/Button.js.map +0 -1
  105. package/dist/components/Button/Button.test.d.ts +0 -1
  106. package/dist/components/Button/index.d.ts +0 -1
  107. package/dist/components/Checkbox/Checkbox.js +0 -50
  108. package/dist/components/Checkbox/Checkbox.js.map +0 -1
  109. package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
  110. package/dist/components/Checkbox/index.d.ts +0 -1
  111. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +0 -25
  112. package/dist/components/CheckboxGroup/CheckboxGroup.js +0 -99
  113. package/dist/components/CheckboxGroup/CheckboxGroup.js.map +0 -1
  114. package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +0 -15
  115. package/dist/components/ConfirmationModal/ConfirmationModal.js +0 -136
  116. package/dist/components/ConfirmationModal/ConfirmationModal.js.map +0 -1
  117. package/dist/components/ConfirmationModal/index.d.ts +0 -2
  118. package/dist/components/CustomSelect/CustomSelect.js +0 -259
  119. package/dist/components/CustomSelect/CustomSelect.js.map +0 -1
  120. package/dist/components/EventAddForm/AddEventLayout.js +0 -227
  121. package/dist/components/EventAddForm/AddEventLayout.js.map +0 -1
  122. package/dist/components/EventAddForm/AddEventStepper.js +0 -719
  123. package/dist/components/EventAddForm/AddEventStepper.js.map +0 -1
  124. package/dist/components/EventAddForm/common/ConfirmationModal.js +0 -136
  125. package/dist/components/EventAddForm/common/ConfirmationModal.js.map +0 -1
  126. package/dist/components/EventAddForm/common/DescriptionModal.js +0 -70
  127. package/dist/components/EventAddForm/common/DescriptionModal.js.map +0 -1
  128. package/dist/components/EventAddForm/components/AnimatedBackground.d.ts +0 -8
  129. package/dist/components/EventAddForm/components/ApprovalConfirmationModal.d.ts +0 -7
  130. package/dist/components/EventAddForm/components/CheckboxGroup.js +0 -92
  131. package/dist/components/EventAddForm/components/CheckboxGroup.js.map +0 -1
  132. package/dist/components/EventAddForm/components/CustomMeetingForm.js +0 -237
  133. package/dist/components/EventAddForm/components/CustomMeetingForm.js.map +0 -1
  134. package/dist/components/EventAddForm/components/DateTimeField.js +0 -173
  135. package/dist/components/EventAddForm/components/DateTimeField.js.map +0 -1
  136. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.d.ts +0 -33
  137. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js +0 -366
  138. package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js.map +0 -1
  139. package/dist/components/EventAddForm/components/FileUpload.js +0 -412
  140. package/dist/components/EventAddForm/components/FileUpload.js.map +0 -1
  141. package/dist/components/EventAddForm/components/FormBuilderProceedModal.js +0 -197
  142. package/dist/components/EventAddForm/components/FormBuilderProceedModal.js.map +0 -1
  143. package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js +0 -1179
  144. package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js.map +0 -1
  145. package/dist/components/EventAddForm/components/InputField.d.ts +0 -15
  146. package/dist/components/EventAddForm/components/RadioGroupButton.d.ts +0 -14
  147. package/dist/components/EventAddForm/components/SelectField.d.ts +0 -19
  148. package/dist/components/EventAddForm/components/SingleDateTimeInput.js +0 -102
  149. package/dist/components/EventAddForm/components/SingleDateTimeInput.js.map +0 -1
  150. package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js +0 -277
  151. package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js.map +0 -1
  152. package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js +0 -148
  153. package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js.map +0 -1
  154. package/dist/components/EventAddForm/components/TicketTierForm.js +0 -418
  155. package/dist/components/EventAddForm/components/TicketTierForm.js.map +0 -1
  156. package/dist/components/EventAddForm/components/TicketTypeSelection.js +0 -93
  157. package/dist/components/EventAddForm/components/TicketTypeSelection.js.map +0 -1
  158. package/dist/components/EventAddForm/hooks/useStepperForm.js +0 -371
  159. package/dist/components/EventAddForm/hooks/useStepperForm.js.map +0 -1
  160. package/dist/components/EventAddForm/hooks/useTicketTierForm.js +0 -237
  161. package/dist/components/EventAddForm/hooks/useTicketTierForm.js.map +0 -1
  162. package/dist/components/EventAddForm/index.d.ts +0 -3
  163. package/dist/components/EventAddForm/index.js +0 -41
  164. package/dist/components/EventAddForm/index.js.map +0 -1
  165. package/dist/components/EventAddForm/schemas/index.d.ts +0 -2
  166. package/dist/components/EventAddForm/schemas/step1.d.ts +0 -47
  167. package/dist/components/EventAddForm/schemas/step1.js +0 -135
  168. package/dist/components/EventAddForm/schemas/step1.js.map +0 -1
  169. package/dist/components/EventAddForm/schemas/step2.d.ts +0 -138
  170. package/dist/components/EventAddForm/schemas/step2.js +0 -94
  171. package/dist/components/EventAddForm/schemas/step2.js.map +0 -1
  172. package/dist/components/EventAddForm/schemas/utils.js +0 -28
  173. package/dist/components/EventAddForm/schemas/utils.js.map +0 -1
  174. package/dist/components/EventAddForm/steps/IndividualFormStep.js +0 -85
  175. package/dist/components/EventAddForm/steps/IndividualFormStep.js.map +0 -1
  176. package/dist/components/EventAddForm/steps/SocialProfilesStep.js +0 -123
  177. package/dist/components/EventAddForm/steps/SocialProfilesStep.js.map +0 -1
  178. package/dist/components/EventAddForm/steps/StepOne.js +0 -462
  179. package/dist/components/EventAddForm/steps/StepOne.js.map +0 -1
  180. package/dist/components/EventAddForm/steps/StepTwo.js +0 -173
  181. package/dist/components/EventAddForm/steps/StepTwo.js.map +0 -1
  182. package/dist/components/EventAddForm/steps/TeamFormStep.js +0 -13
  183. package/dist/components/EventAddForm/steps/TeamFormStep.js.map +0 -1
  184. package/dist/components/FormBuilder/CategoryList.js +0 -242
  185. package/dist/components/FormBuilder/CategoryList.js.map +0 -1
  186. package/dist/components/FormBuilder/DiscountInput.js +0 -366
  187. package/dist/components/FormBuilder/DiscountInput.js.map +0 -1
  188. package/dist/components/FormBuilder/FormBuilder.js +0 -918
  189. package/dist/components/FormBuilder/FormBuilder.js.map +0 -1
  190. package/dist/components/FormBuilder/OptionList.js +0 -120
  191. package/dist/components/FormBuilder/OptionList.js.map +0 -1
  192. package/dist/components/FormBuilder/PaymentPreview.d.ts +0 -12
  193. package/dist/components/FormBuilder/PaymentPreview.js +0 -70
  194. package/dist/components/FormBuilder/PaymentPreview.js.map +0 -1
  195. package/dist/components/FormBuilder/PreviewInput.d.ts +0 -10
  196. package/dist/components/FormBuilder/PreviewInput.js +0 -143
  197. package/dist/components/FormBuilder/PreviewInput.js.map +0 -1
  198. package/dist/components/FormBuilder/QuestionCard.js +0 -252
  199. package/dist/components/FormBuilder/QuestionCard.js.map +0 -1
  200. package/dist/components/FormBuilder/QuestionEditor.js +0 -166
  201. package/dist/components/FormBuilder/QuestionEditor.js.map +0 -1
  202. package/dist/components/FormBuilder/RequiredToggle.js +0 -43
  203. package/dist/components/FormBuilder/RequiredToggle.js.map +0 -1
  204. package/dist/components/FormBuilder/SortableQuestionList.js +0 -137
  205. package/dist/components/FormBuilder/SortableQuestionList.js.map +0 -1
  206. package/dist/components/FormBuilder/index.d.ts +0 -4
  207. package/dist/components/FormBuilder/utils.js +0 -229
  208. package/dist/components/FormBuilder/utils.js.map +0 -1
  209. package/dist/components/FormInput/FormInput.js +0 -126
  210. package/dist/components/FormInput/FormInput.js.map +0 -1
  211. package/dist/components/FormInput/FormInput.test.d.ts +0 -1
  212. package/dist/components/FormInput/index.d.ts +0 -2
  213. package/dist/components/ImageCropModal/index.js +0 -464
  214. package/dist/components/ImageCropModal/index.js.map +0 -1
  215. package/dist/components/InformationPopover/InformationPopover.d.ts +0 -7
  216. package/dist/components/InformationPopover/InformationPopover.js +0 -19
  217. package/dist/components/InformationPopover/InformationPopover.js.map +0 -1
  218. package/dist/components/InformationPopover.js +0 -19
  219. package/dist/components/InformationPopover.js.map +0 -1
  220. package/dist/components/InputErrorMessage/InputErrorMessage.js +0 -21
  221. package/dist/components/InputErrorMessage/InputErrorMessage.js.map +0 -1
  222. package/dist/components/Modal/Modal.d.ts +0 -15
  223. package/dist/components/Modal/Modal.js +0 -73
  224. package/dist/components/Modal/Modal.js.map +0 -1
  225. package/dist/components/Radio/Radio.js +0 -35
  226. package/dist/components/Radio/Radio.js.map +0 -1
  227. package/dist/components/Spinner/spinner.d.ts +0 -2
  228. package/dist/components/Spinner/spinner.js +0 -22
  229. package/dist/components/Spinner/spinner.js.map +0 -1
  230. package/dist/components/Toggle/Toggle.d.ts +0 -16
  231. package/dist/components/Toggle/index.d.ts +0 -2
  232. package/dist/components/Tooltip/Tooltip.d.ts +0 -12
  233. package/dist/components/Tooltip/Tooltip.js +0 -134
  234. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  235. package/dist/components/common/FallbackImage.js +0 -47
  236. package/dist/components/common/FallbackImage.js.map +0 -1
  237. package/dist/components/ui/Calendar/calendar-utils.js +0 -51
  238. package/dist/components/ui/Calendar/calendar-utils.js.map +0 -1
  239. package/dist/components/ui/Calendar/index.js +0 -142
  240. package/dist/components/ui/Calendar/index.js.map +0 -1
  241. package/dist/components/ui/Checkbox.d.ts +0 -9
  242. package/dist/components/ui/Checkbox.js +0 -50
  243. package/dist/components/ui/Checkbox.js.map +0 -1
  244. package/dist/components/ui/DatePicker/index.js +0 -188
  245. package/dist/components/ui/DatePicker/index.js.map +0 -1
  246. package/dist/components/ui/FormInput.js +0 -129
  247. package/dist/components/ui/FormInput.js.map +0 -1
  248. package/dist/components/ui/InputErrorMessage.d.ts +0 -7
  249. package/dist/components/ui/InputErrorMessage.js +0 -21
  250. package/dist/components/ui/InputErrorMessage.js.map +0 -1
  251. package/dist/components/ui/Modal/index.js +0 -73
  252. package/dist/components/ui/Modal/index.js.map +0 -1
  253. package/dist/components/ui/Radio.d.ts +0 -6
  254. package/dist/components/ui/Radio.js +0 -35
  255. package/dist/components/ui/Radio.js.map +0 -1
  256. package/dist/components/ui/RichTextEditor.js +0 -242
  257. package/dist/components/ui/RichTextEditor.js.map +0 -1
  258. package/dist/components/ui/TimePicker/index.js +0 -215
  259. package/dist/components/ui/TimePicker/index.js.map +0 -1
  260. package/dist/components/ui/TimeSelector/index.js +0 -138
  261. package/dist/components/ui/TimeSelector/index.js.map +0 -1
  262. package/dist/components/ui/Tooltip.d.ts +0 -12
  263. package/dist/components/ui/Tooltip.js +0 -136
  264. package/dist/components/ui/Tooltip.js.map +0 -1
  265. package/dist/hooks/useDropdownPosition.d.ts +0 -11
  266. package/dist/hooks/useFirebaseAuthState.d.ts +0 -6
  267. package/dist/hooks/useFirebaseAuthState.js +0 -23
  268. package/dist/hooks/useFirebaseAuthState.js.map +0 -1
  269. package/dist/hooks/useTicketTierForm.d.ts +0 -61
  270. package/dist/lib/actions.js +0 -32
  271. package/dist/lib/actions.js.map +0 -1
  272. package/dist/lib/cropImage.js +0 -113
  273. package/dist/lib/cropImage.js.map +0 -1
  274. package/dist/lib/imageAnalysis.js +0 -58
  275. package/dist/lib/imageAnalysis.js.map +0 -1
  276. package/dist/lib/utils.js +0 -9
  277. package/dist/lib/utils.js.map +0 -1
  278. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +0 -60
  279. package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +0 -1
  280. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +0 -3458
  281. package/dist/node_modules/@dnd-kit/core/dist/core.esm.js.map +0 -1
  282. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +0 -593
  283. package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +0 -1
  284. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -302
  285. package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +0 -1
  286. package/dist/node_modules/@firebase/app/dist/esm/index.esm.js +0 -768
  287. package/dist/node_modules/@firebase/app/dist/esm/index.esm.js.map +0 -1
  288. package/dist/node_modules/@firebase/component/dist/esm/index.esm.js +0 -340
  289. package/dist/node_modules/@firebase/component/dist/esm/index.esm.js.map +0 -1
  290. package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js +0 -123
  291. package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js.map +0 -1
  292. package/dist/node_modules/@firebase/storage/dist/index.esm.js +0 -2623
  293. package/dist/node_modules/@firebase/storage/dist/index.esm.js.map +0 -1
  294. package/dist/node_modules/@firebase/util/dist/index.esm.js +0 -658
  295. package/dist/node_modules/@firebase/util/dist/index.esm.js.map +0 -1
  296. package/dist/node_modules/@firebase/util/dist/postinstall.js +0 -5
  297. package/dist/node_modules/@firebase/util/dist/postinstall.js.map +0 -1
  298. package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js +0 -3179
  299. package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js.map +0 -1
  300. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js +0 -60
  301. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +0 -1
  302. package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js +0 -400
  303. package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js.map +0 -1
  304. package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js +0 -27
  305. package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js.map +0 -1
  306. package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js +0 -27
  307. package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js.map +0 -1
  308. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js +0 -29
  309. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js.map +0 -1
  310. package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js +0 -29
  311. package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js.map +0 -1
  312. package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js +0 -29
  313. package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js.map +0 -1
  314. package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js +0 -29
  315. package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js.map +0 -1
  316. package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js +0 -29
  317. package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js.map +0 -1
  318. package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js +0 -29
  319. package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js.map +0 -1
  320. package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js +0 -33
  321. package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js.map +0 -1
  322. package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js +0 -29
  323. package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js.map +0 -1
  324. package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js +0 -29
  325. package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js.map +0 -1
  326. package/dist/node_modules/@tiptap/core/dist/index.js +0 -5446
  327. package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
  328. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -21
  329. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  330. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -78
  331. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
  332. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -100
  333. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
  334. package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -70
  335. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
  336. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -317
  337. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
  338. package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -16
  339. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
  340. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -66
  341. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
  342. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -86
  343. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
  344. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -80
  345. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
  346. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -98
  347. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
  348. package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -423
  349. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
  350. package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -1039
  351. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
  352. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -61
  353. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
  354. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -7
  355. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
  356. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -79
  357. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
  358. package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -16
  359. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
  360. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -76
  361. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
  362. package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -376
  363. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
  364. package/dist/node_modules/@tiptap/react/dist/index.js +0 -650
  365. package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
  366. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -97
  367. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
  368. package/dist/node_modules/dayjs/dayjs.min.js +0 -283
  369. package/dist/node_modules/dayjs/dayjs.min.js.map +0 -1
  370. package/dist/node_modules/dayjs/plugin/customParseFormat.js +0 -130
  371. package/dist/node_modules/dayjs/plugin/customParseFormat.js.map +0 -1
  372. package/dist/node_modules/dayjs/plugin/duration.js +0 -137
  373. package/dist/node_modules/dayjs/plugin/duration.js.map +0 -1
  374. package/dist/node_modules/dayjs/plugin/isBetween.js +0 -20
  375. package/dist/node_modules/dayjs/plugin/isBetween.js.map +0 -1
  376. package/dist/node_modules/dayjs/plugin/relativeTime.js +0 -49
  377. package/dist/node_modules/dayjs/plugin/relativeTime.js.map +0 -1
  378. package/dist/node_modules/fast-equals/dist/es/index.js +0 -442
  379. package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
  380. package/dist/node_modules/idb/build/index.js +0 -70
  381. package/dist/node_modules/idb/build/index.js.map +0 -1
  382. package/dist/node_modules/idb/build/wrap-idb-value.js +0 -149
  383. package/dist/node_modules/idb/build/wrap-idb-value.js.map +0 -1
  384. package/dist/node_modules/linkifyjs/dist/linkify.js +0 -1159
  385. package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
  386. package/dist/node_modules/orderedmap/dist/index.js +0 -120
  387. package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
  388. package/dist/node_modules/prosemirror-commands/dist/index.js +0 -527
  389. package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
  390. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -137
  391. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
  392. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -221
  393. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
  394. package/dist/node_modules/prosemirror-history/dist/index.js +0 -357
  395. package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
  396. package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -84
  397. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
  398. package/dist/node_modules/prosemirror-model/dist/index.js +0 -3209
  399. package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
  400. package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -131
  401. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
  402. package/dist/node_modules/prosemirror-state/dist/index.js +0 -936
  403. package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
  404. package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1881
  405. package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
  406. package/dist/node_modules/prosemirror-view/dist/index.js +0 -5232
  407. package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
  408. package/dist/node_modules/rope-sequence/dist/index.js +0 -184
  409. package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
  410. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -82
  411. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
  412. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -78
  413. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
  414. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -78
  415. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
  416. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -63
  417. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
  418. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
  419. package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
  420. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -13
  421. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
  422. package/dist/node_modules/w3c-keyname/index.js +0 -106
  423. package/dist/node_modules/w3c-keyname/index.js.map +0 -1
  424. package/dist/node_modules/zod/v4/classic/coerce.js +0 -10
  425. package/dist/node_modules/zod/v4/classic/coerce.js.map +0 -1
  426. package/dist/node_modules/zod/v4/classic/compat.js +0 -8
  427. package/dist/node_modules/zod/v4/classic/compat.js.map +0 -1
  428. package/dist/node_modules/zod/v4/classic/errors.js +0 -45
  429. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  430. package/dist/node_modules/zod/v4/classic/iso.js +0 -44
  431. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  432. package/dist/node_modules/zod/v4/classic/parse.js +0 -30
  433. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  434. package/dist/node_modules/zod/v4/classic/schemas.js +0 -711
  435. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  436. package/dist/node_modules/zod/v4/core/api.js +0 -588
  437. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  438. package/dist/node_modules/zod/v4/core/checks.js +0 -411
  439. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  440. package/dist/node_modules/zod/v4/core/core.js +0 -75
  441. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  442. package/dist/node_modules/zod/v4/core/doc.js +0 -38
  443. package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
  444. package/dist/node_modules/zod/v4/core/errors.js +0 -73
  445. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  446. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -359
  447. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
  448. package/dist/node_modules/zod/v4/core/parse.js +0 -96
  449. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  450. package/dist/node_modules/zod/v4/core/regexes.js +0 -84
  451. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  452. package/dist/node_modules/zod/v4/core/registries.js +0 -52
  453. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  454. package/dist/node_modules/zod/v4/core/schemas.js +0 -1391
  455. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  456. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -363
  457. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  458. package/dist/node_modules/zod/v4/core/util.js +0 -431
  459. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  460. package/dist/node_modules/zod/v4/core/versions.js +0 -9
  461. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
  462. package/dist/redux/baseQuery.d.ts +0 -1
  463. package/dist/redux/baseQuery.js +0 -24
  464. package/dist/redux/baseQuery.js.map +0 -1
  465. package/dist/services/eventApi.js +0 -411
  466. package/dist/services/eventApi.js.map +0 -1
  467. package/dist/services/helpers.js +0 -115
  468. package/dist/services/helpers.js.map +0 -1
  469. package/dist/services/initialize-firebase.d.ts +0 -2
  470. package/dist/services/initialize-firebase.js +0 -20
  471. package/dist/services/initialize-firebase.js.map +0 -1
  472. package/dist/services/process-image-on-server.js +0 -30
  473. package/dist/services/process-image-on-server.js.map +0 -1
  474. package/dist/services/remote-config.d.ts +0 -5
  475. package/dist/services/remote-config.js +0 -9
  476. package/dist/services/remote-config.js.map +0 -1
  477. package/dist/services/single-event-api.js +0 -301
  478. package/dist/services/single-event-api.js.map +0 -1
  479. package/dist/services/utils.js +0 -107
  480. package/dist/services/utils.js.map +0 -1
  481. package/dist/setupTests.d.ts +0 -1
  482. package/dist/stories/Alert.stories.d.ts +0 -10
  483. package/dist/stories/Button.stories.d.ts +0 -13
  484. package/dist/types/redux-types.d.ts +0 -15
  485. package/dist/types/types.d.ts +0 -60
  486. package/dist/types/types.js +0 -10
  487. package/dist/types/types.js.map +0 -1
  488. package/dist/utils/cn.d.ts +0 -6
  489. package/dist/utils/cn.js +0 -9
  490. package/dist/utils/cn.js.map +0 -1
  491. package/dist/utils/date-range.d.ts +0 -4
  492. package/dist/utils/date-range.js +0 -13
  493. package/dist/utils/date-range.js.map +0 -1
  494. package/dist/utils/single-event-helpers.d.ts +0 -50
  495. package/dist/utils/single-event-helpers.js +0 -18
  496. package/dist/utils/single-event-helpers.js.map +0 -1
  497. package/dist/utils/social-validation.js +0 -42
  498. package/dist/utils/social-validation.js.map +0 -1
  499. package/dist/utils/utils.js +0 -20
  500. package/dist/utils/utils.js.map +0 -1
  501. /package/dist/{components/Alert/Alert.d.ts → src/components/Alert/index.d.ts} +0 -0
  502. /package/dist/{components → src/components}/FormBuilder/CategoryList.d.ts +0 -0
  503. /package/dist/{components → src/components}/FormBuilder/OptionList.d.ts +0 -0
  504. /package/dist/{components → src/components}/FormBuilder/RequiredToggle.d.ts +0 -0
  505. /package/dist/{components → src/components}/FormBuilder/types.d.ts +0 -0
  506. /package/dist/{components → src/components}/FormBuilder/utils.d.ts +0 -0
  507. /package/dist/{components → src/components}/ImageCropModal/index.d.ts +0 -0
  508. /package/dist/{components → src/components}/InformationPopover.d.ts +0 -0
  509. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/DescriptionModal.d.ts +0 -0
  510. /package/dist/{components/ui/FormInput.d.ts → src/components/NewAddEvent/components/AddEventFormInput.d.ts} +0 -0
  511. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CheckboxGroup.d.ts +0 -0
  512. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CustomMeetingForm.d.ts +0 -0
  513. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/DateTimeField.d.ts +0 -0
  514. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FileUpload.d.ts +0 -0
  515. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FormBuilderProceedModal.d.ts +0 -0
  516. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/GoogleMapsAutocompleteInput.d.ts +0 -0
  517. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/SingleDateTimeInput.d.ts +0 -0
  518. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/CustomFormSection.d.ts +0 -0
  519. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTypeSelection.d.ts +0 -0
  520. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepOne.d.ts +0 -0
  521. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepTwo.d.ts +0 -0
  522. /package/dist/{components/EventAddForm → src/components/NewAddEvent}/types.d.ts +0 -0
  523. /package/dist/{components → src/components}/common/FallbackImage.d.ts +0 -0
  524. /package/dist/{components → src/components}/ui/Calendar/calendar-utils.d.ts +0 -0
  525. /package/dist/{components → src/components}/ui/Calendar/index.d.ts +0 -0
  526. /package/dist/{components/Checkbox → src/components/ui}/Checkbox.d.ts +0 -0
  527. /package/dist/{components/CustomSelect → src/components/ui}/CustomSelect.d.ts +0 -0
  528. /package/dist/{components → src/components}/ui/DatePicker/index.d.ts +0 -0
  529. /package/dist/{components/InputErrorMessage → src/components/ui}/InputErrorMessage.d.ts +0 -0
  530. /package/dist/{components → src/components}/ui/Modal/index.d.ts +0 -0
  531. /package/dist/{components/Radio → src/components/ui}/Radio.d.ts +0 -0
  532. /package/dist/{components → src/components}/ui/RichTextEditor.d.ts +0 -0
  533. /package/dist/{components → src/components}/ui/TimePicker/index.d.ts +0 -0
  534. /package/dist/{components → src/components}/ui/TimeSelector/index.d.ts +0 -0
  535. /package/dist/{components → src/components}/ui/Tooltip/index.d.ts +0 -0
  536. /package/dist/{lib → src/lib}/constants.d.ts +0 -0
  537. /package/dist/{lib → src/lib}/cropImage.d.ts +0 -0
  538. /package/dist/{lib → src/lib}/imageAnalysis.d.ts +0 -0
  539. /package/dist/{utils → src/lib}/social-validation.d.ts +0 -0
  540. /package/dist/{lib/utils.d.ts → src/lib/tailwind-merge.d.ts} +0 -0
  541. /package/dist/{utils → src/lib}/utils.d.ts +0 -0
  542. /package/dist/{services → src/redux/features/single-event}/helpers.d.ts +0 -0
  543. /package/dist/{services → src/services}/process-image-on-server.d.ts +0 -0
  544. /package/dist/{types → src/types}/events.d.ts +0 -0
  545. /package/dist/{types → src/types}/question.d.ts +0 -0
@@ -1,936 +0,0 @@
1
- import { Slice, Fragment, Node, Mark } from "../../prosemirror-model/dist/index.js";
2
- import { ReplaceStep, ReplaceAroundStep, Transform } from "../../prosemirror-transform/dist/index.js";
3
- const classesById = /* @__PURE__ */ Object.create(null);
4
- class Selection {
5
- /**
6
- Initialize a selection with the head and anchor and ranges. If no
7
- ranges are given, constructs a single range across `$anchor` and
8
- `$head`.
9
- */
10
- constructor($anchor, $head, ranges) {
11
- this.$anchor = $anchor;
12
- this.$head = $head;
13
- this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
14
- }
15
- /**
16
- The selection's anchor, as an unresolved position.
17
- */
18
- get anchor() {
19
- return this.$anchor.pos;
20
- }
21
- /**
22
- The selection's head.
23
- */
24
- get head() {
25
- return this.$head.pos;
26
- }
27
- /**
28
- The lower bound of the selection's main range.
29
- */
30
- get from() {
31
- return this.$from.pos;
32
- }
33
- /**
34
- The upper bound of the selection's main range.
35
- */
36
- get to() {
37
- return this.$to.pos;
38
- }
39
- /**
40
- The resolved lower bound of the selection's main range.
41
- */
42
- get $from() {
43
- return this.ranges[0].$from;
44
- }
45
- /**
46
- The resolved upper bound of the selection's main range.
47
- */
48
- get $to() {
49
- return this.ranges[0].$to;
50
- }
51
- /**
52
- Indicates whether the selection contains any content.
53
- */
54
- get empty() {
55
- let ranges = this.ranges;
56
- for (let i = 0; i < ranges.length; i++)
57
- if (ranges[i].$from.pos != ranges[i].$to.pos)
58
- return false;
59
- return true;
60
- }
61
- /**
62
- Get the content of this selection as a slice.
63
- */
64
- content() {
65
- return this.$from.doc.slice(this.from, this.to, true);
66
- }
67
- /**
68
- Replace the selection with a slice or, if no slice is given,
69
- delete the selection. Will append to the given transaction.
70
- */
71
- replace(tr, content = Slice.empty) {
72
- let lastNode = content.content.lastChild, lastParent = null;
73
- for (let i = 0; i < content.openEnd; i++) {
74
- lastParent = lastNode;
75
- lastNode = lastNode.lastChild;
76
- }
77
- let mapFrom = tr.steps.length, ranges = this.ranges;
78
- for (let i = 0; i < ranges.length; i++) {
79
- let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
80
- tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
81
- if (i == 0)
82
- selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
83
- }
84
- }
85
- /**
86
- Replace the selection with the given node, appending the changes
87
- to the given transaction.
88
- */
89
- replaceWith(tr, node) {
90
- let mapFrom = tr.steps.length, ranges = this.ranges;
91
- for (let i = 0; i < ranges.length; i++) {
92
- let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
93
- let from = mapping.map($from.pos), to = mapping.map($to.pos);
94
- if (i) {
95
- tr.deleteRange(from, to);
96
- } else {
97
- tr.replaceRangeWith(from, to, node);
98
- selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
99
- }
100
- }
101
- }
102
- /**
103
- Find a valid cursor or leaf node selection starting at the given
104
- position and searching back if `dir` is negative, and forward if
105
- positive. When `textOnly` is true, only consider cursor
106
- selections. Will return null when no valid selection position is
107
- found.
108
- */
109
- static findFrom($pos, dir, textOnly = false) {
110
- let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
111
- if (inner)
112
- return inner;
113
- for (let depth = $pos.depth - 1; depth >= 0; depth--) {
114
- let found = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
115
- if (found)
116
- return found;
117
- }
118
- return null;
119
- }
120
- /**
121
- Find a valid cursor or leaf node selection near the given
122
- position. Searches forward first by default, but if `bias` is
123
- negative, it will search backwards first.
124
- */
125
- static near($pos, bias = 1) {
126
- return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
127
- }
128
- /**
129
- Find the cursor or leaf node selection closest to the start of
130
- the given document. Will return an
131
- [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
132
- exists.
133
- */
134
- static atStart(doc) {
135
- return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
136
- }
137
- /**
138
- Find the cursor or leaf node selection closest to the end of the
139
- given document.
140
- */
141
- static atEnd(doc) {
142
- return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
143
- }
144
- /**
145
- Deserialize the JSON representation of a selection. Must be
146
- implemented for custom classes (as a static class method).
147
- */
148
- static fromJSON(doc, json) {
149
- if (!json || !json.type)
150
- throw new RangeError("Invalid input for Selection.fromJSON");
151
- let cls = classesById[json.type];
152
- if (!cls)
153
- throw new RangeError(`No selection type ${json.type} defined`);
154
- return cls.fromJSON(doc, json);
155
- }
156
- /**
157
- To be able to deserialize selections from JSON, custom selection
158
- classes must register themselves with an ID string, so that they
159
- can be disambiguated. Try to pick something that's unlikely to
160
- clash with classes from other modules.
161
- */
162
- static jsonID(id, selectionClass) {
163
- if (id in classesById)
164
- throw new RangeError("Duplicate use of selection JSON ID " + id);
165
- classesById[id] = selectionClass;
166
- selectionClass.prototype.jsonID = id;
167
- return selectionClass;
168
- }
169
- /**
170
- Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
171
- which is a value that can be mapped without having access to a
172
- current document, and later resolved to a real selection for a
173
- given document again. (This is used mostly by the history to
174
- track and restore old selections.) The default implementation of
175
- this method just converts the selection to a text selection and
176
- returns the bookmark for that.
177
- */
178
- getBookmark() {
179
- return TextSelection.between(this.$anchor, this.$head).getBookmark();
180
- }
181
- }
182
- Selection.prototype.visible = true;
183
- class SelectionRange {
184
- /**
185
- Create a range.
186
- */
187
- constructor($from, $to) {
188
- this.$from = $from;
189
- this.$to = $to;
190
- }
191
- }
192
- let warnedAboutTextSelection = false;
193
- function checkTextSelection($pos) {
194
- if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
195
- warnedAboutTextSelection = true;
196
- console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
197
- }
198
- }
199
- class TextSelection extends Selection {
200
- /**
201
- Construct a text selection between the given points.
202
- */
203
- constructor($anchor, $head = $anchor) {
204
- checkTextSelection($anchor);
205
- checkTextSelection($head);
206
- super($anchor, $head);
207
- }
208
- /**
209
- Returns a resolved position if this is a cursor selection (an
210
- empty text selection), and null otherwise.
211
- */
212
- get $cursor() {
213
- return this.$anchor.pos == this.$head.pos ? this.$head : null;
214
- }
215
- map(doc, mapping) {
216
- let $head = doc.resolve(mapping.map(this.head));
217
- if (!$head.parent.inlineContent)
218
- return Selection.near($head);
219
- let $anchor = doc.resolve(mapping.map(this.anchor));
220
- return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
221
- }
222
- replace(tr, content = Slice.empty) {
223
- super.replace(tr, content);
224
- if (content == Slice.empty) {
225
- let marks = this.$from.marksAcross(this.$to);
226
- if (marks)
227
- tr.ensureMarks(marks);
228
- }
229
- }
230
- eq(other) {
231
- return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;
232
- }
233
- getBookmark() {
234
- return new TextBookmark(this.anchor, this.head);
235
- }
236
- toJSON() {
237
- return { type: "text", anchor: this.anchor, head: this.head };
238
- }
239
- /**
240
- @internal
241
- */
242
- static fromJSON(doc, json) {
243
- if (typeof json.anchor != "number" || typeof json.head != "number")
244
- throw new RangeError("Invalid input for TextSelection.fromJSON");
245
- return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
246
- }
247
- /**
248
- Create a text selection from non-resolved positions.
249
- */
250
- static create(doc, anchor, head = anchor) {
251
- let $anchor = doc.resolve(anchor);
252
- return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
253
- }
254
- /**
255
- Return a text selection that spans the given positions or, if
256
- they aren't text positions, find a text selection near them.
257
- `bias` determines whether the method searches forward (default)
258
- or backwards (negative number) first. Will fall back to calling
259
- [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
260
- doesn't contain a valid text position.
261
- */
262
- static between($anchor, $head, bias) {
263
- let dPos = $anchor.pos - $head.pos;
264
- if (!bias || dPos)
265
- bias = dPos >= 0 ? 1 : -1;
266
- if (!$head.parent.inlineContent) {
267
- let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);
268
- if (found)
269
- $head = found.$head;
270
- else
271
- return Selection.near($head, bias);
272
- }
273
- if (!$anchor.parent.inlineContent) {
274
- if (dPos == 0) {
275
- $anchor = $head;
276
- } else {
277
- $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;
278
- if ($anchor.pos < $head.pos != dPos < 0)
279
- $anchor = $head;
280
- }
281
- }
282
- return new TextSelection($anchor, $head);
283
- }
284
- }
285
- Selection.jsonID("text", TextSelection);
286
- class TextBookmark {
287
- constructor(anchor, head) {
288
- this.anchor = anchor;
289
- this.head = head;
290
- }
291
- map(mapping) {
292
- return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
293
- }
294
- resolve(doc) {
295
- return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
296
- }
297
- }
298
- class NodeSelection extends Selection {
299
- /**
300
- Create a node selection. Does not verify the validity of its
301
- argument.
302
- */
303
- constructor($pos) {
304
- let node = $pos.nodeAfter;
305
- let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
306
- super($pos, $end);
307
- this.node = node;
308
- }
309
- map(doc, mapping) {
310
- let { deleted, pos } = mapping.mapResult(this.anchor);
311
- let $pos = doc.resolve(pos);
312
- if (deleted)
313
- return Selection.near($pos);
314
- return new NodeSelection($pos);
315
- }
316
- content() {
317
- return new Slice(Fragment.from(this.node), 0, 0);
318
- }
319
- eq(other) {
320
- return other instanceof NodeSelection && other.anchor == this.anchor;
321
- }
322
- toJSON() {
323
- return { type: "node", anchor: this.anchor };
324
- }
325
- getBookmark() {
326
- return new NodeBookmark(this.anchor);
327
- }
328
- /**
329
- @internal
330
- */
331
- static fromJSON(doc, json) {
332
- if (typeof json.anchor != "number")
333
- throw new RangeError("Invalid input for NodeSelection.fromJSON");
334
- return new NodeSelection(doc.resolve(json.anchor));
335
- }
336
- /**
337
- Create a node selection from non-resolved positions.
338
- */
339
- static create(doc, from) {
340
- return new NodeSelection(doc.resolve(from));
341
- }
342
- /**
343
- Determines whether the given node may be selected as a node
344
- selection.
345
- */
346
- static isSelectable(node) {
347
- return !node.isText && node.type.spec.selectable !== false;
348
- }
349
- }
350
- NodeSelection.prototype.visible = false;
351
- Selection.jsonID("node", NodeSelection);
352
- class NodeBookmark {
353
- constructor(anchor) {
354
- this.anchor = anchor;
355
- }
356
- map(mapping) {
357
- let { deleted, pos } = mapping.mapResult(this.anchor);
358
- return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);
359
- }
360
- resolve(doc) {
361
- let $pos = doc.resolve(this.anchor), node = $pos.nodeAfter;
362
- if (node && NodeSelection.isSelectable(node))
363
- return new NodeSelection($pos);
364
- return Selection.near($pos);
365
- }
366
- }
367
- class AllSelection extends Selection {
368
- /**
369
- Create an all-selection over the given document.
370
- */
371
- constructor(doc) {
372
- super(doc.resolve(0), doc.resolve(doc.content.size));
373
- }
374
- replace(tr, content = Slice.empty) {
375
- if (content == Slice.empty) {
376
- tr.delete(0, tr.doc.content.size);
377
- let sel = Selection.atStart(tr.doc);
378
- if (!sel.eq(tr.selection))
379
- tr.setSelection(sel);
380
- } else {
381
- super.replace(tr, content);
382
- }
383
- }
384
- toJSON() {
385
- return { type: "all" };
386
- }
387
- /**
388
- @internal
389
- */
390
- static fromJSON(doc) {
391
- return new AllSelection(doc);
392
- }
393
- map(doc) {
394
- return new AllSelection(doc);
395
- }
396
- eq(other) {
397
- return other instanceof AllSelection;
398
- }
399
- getBookmark() {
400
- return AllBookmark;
401
- }
402
- }
403
- Selection.jsonID("all", AllSelection);
404
- const AllBookmark = {
405
- map() {
406
- return this;
407
- },
408
- resolve(doc) {
409
- return new AllSelection(doc);
410
- }
411
- };
412
- function findSelectionIn(doc, node, pos, index, dir, text = false) {
413
- if (node.inlineContent)
414
- return TextSelection.create(doc, pos);
415
- for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
416
- let child = node.child(i);
417
- if (!child.isAtom) {
418
- let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
419
- if (inner)
420
- return inner;
421
- } else if (!text && NodeSelection.isSelectable(child)) {
422
- return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
423
- }
424
- pos += child.nodeSize * dir;
425
- }
426
- return null;
427
- }
428
- function selectionToInsertionEnd(tr, startLen, bias) {
429
- let last = tr.steps.length - 1;
430
- if (last < startLen)
431
- return;
432
- let step = tr.steps[last];
433
- if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
434
- return;
435
- let map = tr.mapping.maps[last], end;
436
- map.forEach((_from, _to, _newFrom, newTo) => {
437
- if (end == null)
438
- end = newTo;
439
- });
440
- tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
441
- }
442
- const UPDATED_SEL = 1, UPDATED_MARKS = 2, UPDATED_SCROLL = 4;
443
- class Transaction extends Transform {
444
- /**
445
- @internal
446
- */
447
- constructor(state) {
448
- super(state.doc);
449
- this.curSelectionFor = 0;
450
- this.updated = 0;
451
- this.meta = /* @__PURE__ */ Object.create(null);
452
- this.time = Date.now();
453
- this.curSelection = state.selection;
454
- this.storedMarks = state.storedMarks;
455
- }
456
- /**
457
- The transaction's current selection. This defaults to the editor
458
- selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the
459
- transaction, but can be overwritten with
460
- [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
461
- */
462
- get selection() {
463
- if (this.curSelectionFor < this.steps.length) {
464
- this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
465
- this.curSelectionFor = this.steps.length;
466
- }
467
- return this.curSelection;
468
- }
469
- /**
470
- Update the transaction's current selection. Will determine the
471
- selection that the editor gets when the transaction is applied.
472
- */
473
- setSelection(selection) {
474
- if (selection.$from.doc != this.doc)
475
- throw new RangeError("Selection passed to setSelection must point at the current document");
476
- this.curSelection = selection;
477
- this.curSelectionFor = this.steps.length;
478
- this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
479
- this.storedMarks = null;
480
- return this;
481
- }
482
- /**
483
- Whether the selection was explicitly updated by this transaction.
484
- */
485
- get selectionSet() {
486
- return (this.updated & UPDATED_SEL) > 0;
487
- }
488
- /**
489
- Set the current stored marks.
490
- */
491
- setStoredMarks(marks) {
492
- this.storedMarks = marks;
493
- this.updated |= UPDATED_MARKS;
494
- return this;
495
- }
496
- /**
497
- Make sure the current stored marks or, if that is null, the marks
498
- at the selection, match the given set of marks. Does nothing if
499
- this is already the case.
500
- */
501
- ensureMarks(marks) {
502
- if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks))
503
- this.setStoredMarks(marks);
504
- return this;
505
- }
506
- /**
507
- Add a mark to the set of stored marks.
508
- */
509
- addStoredMark(mark) {
510
- return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
511
- }
512
- /**
513
- Remove a mark or mark type from the set of stored marks.
514
- */
515
- removeStoredMark(mark) {
516
- return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
517
- }
518
- /**
519
- Whether the stored marks were explicitly set for this transaction.
520
- */
521
- get storedMarksSet() {
522
- return (this.updated & UPDATED_MARKS) > 0;
523
- }
524
- /**
525
- @internal
526
- */
527
- addStep(step, doc) {
528
- super.addStep(step, doc);
529
- this.updated = this.updated & ~UPDATED_MARKS;
530
- this.storedMarks = null;
531
- }
532
- /**
533
- Update the timestamp for the transaction.
534
- */
535
- setTime(time) {
536
- this.time = time;
537
- return this;
538
- }
539
- /**
540
- Replace the current selection with the given slice.
541
- */
542
- replaceSelection(slice) {
543
- this.selection.replace(this, slice);
544
- return this;
545
- }
546
- /**
547
- Replace the selection with the given node. When `inheritMarks` is
548
- true and the content is inline, it inherits the marks from the
549
- place where it is inserted.
550
- */
551
- replaceSelectionWith(node, inheritMarks = true) {
552
- let selection = this.selection;
553
- if (inheritMarks)
554
- node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark.none));
555
- selection.replaceWith(this, node);
556
- return this;
557
- }
558
- /**
559
- Delete the selection.
560
- */
561
- deleteSelection() {
562
- this.selection.replace(this);
563
- return this;
564
- }
565
- /**
566
- Replace the given range, or the selection if no range is given,
567
- with a text node containing the given string.
568
- */
569
- insertText(text, from, to) {
570
- let schema = this.doc.type.schema;
571
- if (from == null) {
572
- if (!text)
573
- return this.deleteSelection();
574
- return this.replaceSelectionWith(schema.text(text), true);
575
- } else {
576
- if (to == null)
577
- to = from;
578
- if (!text)
579
- return this.deleteRange(from, to);
580
- let marks = this.storedMarks;
581
- if (!marks) {
582
- let $from = this.doc.resolve(from);
583
- marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
584
- }
585
- this.replaceRangeWith(from, to, schema.text(text, marks));
586
- if (!this.selection.empty && this.selection.to == from + text.length)
587
- this.setSelection(Selection.near(this.selection.$to));
588
- return this;
589
- }
590
- }
591
- /**
592
- Store a metadata property in this transaction, keyed either by
593
- name or by plugin.
594
- */
595
- setMeta(key, value) {
596
- this.meta[typeof key == "string" ? key : key.key] = value;
597
- return this;
598
- }
599
- /**
600
- Retrieve a metadata property for a given name or plugin.
601
- */
602
- getMeta(key) {
603
- return this.meta[typeof key == "string" ? key : key.key];
604
- }
605
- /**
606
- Returns true if this transaction doesn't contain any metadata,
607
- and can thus safely be extended.
608
- */
609
- get isGeneric() {
610
- for (let _ in this.meta)
611
- return false;
612
- return true;
613
- }
614
- /**
615
- Indicate that the editor should scroll the selection into view
616
- when updated to the state produced by this transaction.
617
- */
618
- scrollIntoView() {
619
- this.updated |= UPDATED_SCROLL;
620
- return this;
621
- }
622
- /**
623
- True when this transaction has had `scrollIntoView` called on it.
624
- */
625
- get scrolledIntoView() {
626
- return (this.updated & UPDATED_SCROLL) > 0;
627
- }
628
- }
629
- function bind(f, self) {
630
- return !self || !f ? f : f.bind(self);
631
- }
632
- class FieldDesc {
633
- constructor(name, desc, self) {
634
- this.name = name;
635
- this.init = bind(desc.init, self);
636
- this.apply = bind(desc.apply, self);
637
- }
638
- }
639
- const baseFields = [
640
- new FieldDesc("doc", {
641
- init(config) {
642
- return config.doc || config.schema.topNodeType.createAndFill();
643
- },
644
- apply(tr) {
645
- return tr.doc;
646
- }
647
- }),
648
- new FieldDesc("selection", {
649
- init(config, instance) {
650
- return config.selection || Selection.atStart(instance.doc);
651
- },
652
- apply(tr) {
653
- return tr.selection;
654
- }
655
- }),
656
- new FieldDesc("storedMarks", {
657
- init(config) {
658
- return config.storedMarks || null;
659
- },
660
- apply(tr, _marks, _old, state) {
661
- return state.selection.$cursor ? tr.storedMarks : null;
662
- }
663
- }),
664
- new FieldDesc("scrollToSelection", {
665
- init() {
666
- return 0;
667
- },
668
- apply(tr, prev) {
669
- return tr.scrolledIntoView ? prev + 1 : prev;
670
- }
671
- })
672
- ];
673
- class Configuration {
674
- constructor(schema, plugins) {
675
- this.schema = schema;
676
- this.plugins = [];
677
- this.pluginsByKey = /* @__PURE__ */ Object.create(null);
678
- this.fields = baseFields.slice();
679
- if (plugins)
680
- plugins.forEach((plugin) => {
681
- if (this.pluginsByKey[plugin.key])
682
- throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
683
- this.plugins.push(plugin);
684
- this.pluginsByKey[plugin.key] = plugin;
685
- if (plugin.spec.state)
686
- this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));
687
- });
688
- }
689
- }
690
- class EditorState {
691
- /**
692
- @internal
693
- */
694
- constructor(config) {
695
- this.config = config;
696
- }
697
- /**
698
- The schema of the state's document.
699
- */
700
- get schema() {
701
- return this.config.schema;
702
- }
703
- /**
704
- The plugins that are active in this state.
705
- */
706
- get plugins() {
707
- return this.config.plugins;
708
- }
709
- /**
710
- Apply the given transaction to produce a new state.
711
- */
712
- apply(tr) {
713
- return this.applyTransaction(tr).state;
714
- }
715
- /**
716
- @internal
717
- */
718
- filterTransaction(tr, ignore = -1) {
719
- for (let i = 0; i < this.config.plugins.length; i++)
720
- if (i != ignore) {
721
- let plugin = this.config.plugins[i];
722
- if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this))
723
- return false;
724
- }
725
- return true;
726
- }
727
- /**
728
- Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
729
- returns the precise transactions that were applied (which might
730
- be influenced by the [transaction
731
- hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
732
- plugins) along with the new state.
733
- */
734
- applyTransaction(rootTr) {
735
- if (!this.filterTransaction(rootTr))
736
- return { state: this, transactions: [] };
737
- let trs = [rootTr], newState = this.applyInner(rootTr), seen = null;
738
- for (; ; ) {
739
- let haveNew = false;
740
- for (let i = 0; i < this.config.plugins.length; i++) {
741
- let plugin = this.config.plugins[i];
742
- if (plugin.spec.appendTransaction) {
743
- let n = seen ? seen[i].n : 0, oldState = seen ? seen[i].state : this;
744
- let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
745
- if (tr && newState.filterTransaction(tr, i)) {
746
- tr.setMeta("appendedTransaction", rootTr);
747
- if (!seen) {
748
- seen = [];
749
- for (let j = 0; j < this.config.plugins.length; j++)
750
- seen.push(j < i ? { state: newState, n: trs.length } : { state: this, n: 0 });
751
- }
752
- trs.push(tr);
753
- newState = newState.applyInner(tr);
754
- haveNew = true;
755
- }
756
- if (seen)
757
- seen[i] = { state: newState, n: trs.length };
758
- }
759
- }
760
- if (!haveNew)
761
- return { state: newState, transactions: trs };
762
- }
763
- }
764
- /**
765
- @internal
766
- */
767
- applyInner(tr) {
768
- if (!tr.before.eq(this.doc))
769
- throw new RangeError("Applying a mismatched transaction");
770
- let newInstance = new EditorState(this.config), fields = this.config.fields;
771
- for (let i = 0; i < fields.length; i++) {
772
- let field = fields[i];
773
- newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
774
- }
775
- return newInstance;
776
- }
777
- /**
778
- Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
779
- */
780
- get tr() {
781
- return new Transaction(this);
782
- }
783
- /**
784
- Create a new state.
785
- */
786
- static create(config) {
787
- let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
788
- let instance = new EditorState($config);
789
- for (let i = 0; i < $config.fields.length; i++)
790
- instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
791
- return instance;
792
- }
793
- /**
794
- Create a new state based on this one, but with an adjusted set
795
- of active plugins. State fields that exist in both sets of
796
- plugins are kept unchanged. Those that no longer exist are
797
- dropped, and those that are new are initialized using their
798
- [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
799
- configuration object..
800
- */
801
- reconfigure(config) {
802
- let $config = new Configuration(this.schema, config.plugins);
803
- let fields = $config.fields, instance = new EditorState($config);
804
- for (let i = 0; i < fields.length; i++) {
805
- let name = fields[i].name;
806
- instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
807
- }
808
- return instance;
809
- }
810
- /**
811
- Serialize this state to JSON. If you want to serialize the state
812
- of plugins, pass an object mapping property names to use in the
813
- resulting JSON object to plugin objects. The argument may also be
814
- a string or number, in which case it is ignored, to support the
815
- way `JSON.stringify` calls `toString` methods.
816
- */
817
- toJSON(pluginFields) {
818
- let result = { doc: this.doc.toJSON(), selection: this.selection.toJSON() };
819
- if (this.storedMarks)
820
- result.storedMarks = this.storedMarks.map((m) => m.toJSON());
821
- if (pluginFields && typeof pluginFields == "object")
822
- for (let prop in pluginFields) {
823
- if (prop == "doc" || prop == "selection")
824
- throw new RangeError("The JSON fields `doc` and `selection` are reserved");
825
- let plugin = pluginFields[prop], state = plugin.spec.state;
826
- if (state && state.toJSON)
827
- result[prop] = state.toJSON.call(plugin, this[plugin.key]);
828
- }
829
- return result;
830
- }
831
- /**
832
- Deserialize a JSON representation of a state. `config` should
833
- have at least a `schema` field, and should contain array of
834
- plugins to initialize the state with. `pluginFields` can be used
835
- to deserialize the state of plugins, by associating plugin
836
- instances with the property names they use in the JSON object.
837
- */
838
- static fromJSON(config, json, pluginFields) {
839
- if (!json)
840
- throw new RangeError("Invalid input for EditorState.fromJSON");
841
- if (!config.schema)
842
- throw new RangeError("Required config field 'schema' missing");
843
- let $config = new Configuration(config.schema, config.plugins);
844
- let instance = new EditorState($config);
845
- $config.fields.forEach((field) => {
846
- if (field.name == "doc") {
847
- instance.doc = Node.fromJSON(config.schema, json.doc);
848
- } else if (field.name == "selection") {
849
- instance.selection = Selection.fromJSON(instance.doc, json.selection);
850
- } else if (field.name == "storedMarks") {
851
- if (json.storedMarks)
852
- instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
853
- } else {
854
- if (pluginFields)
855
- for (let prop in pluginFields) {
856
- let plugin = pluginFields[prop], state = plugin.spec.state;
857
- if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
858
- instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
859
- return;
860
- }
861
- }
862
- instance[field.name] = field.init(config, instance);
863
- }
864
- });
865
- return instance;
866
- }
867
- }
868
- function bindProps(obj, self, target) {
869
- for (let prop in obj) {
870
- let val = obj[prop];
871
- if (val instanceof Function)
872
- val = val.bind(self);
873
- else if (prop == "handleDOMEvents")
874
- val = bindProps(val, self, {});
875
- target[prop] = val;
876
- }
877
- return target;
878
- }
879
- class Plugin {
880
- /**
881
- Create a plugin.
882
- */
883
- constructor(spec) {
884
- this.spec = spec;
885
- this.props = {};
886
- if (spec.props)
887
- bindProps(spec.props, this, this.props);
888
- this.key = spec.key ? spec.key.key : createKey("plugin");
889
- }
890
- /**
891
- Extract the plugin's state field from an editor state.
892
- */
893
- getState(state) {
894
- return state[this.key];
895
- }
896
- }
897
- const keys = /* @__PURE__ */ Object.create(null);
898
- function createKey(name) {
899
- if (name in keys)
900
- return name + "$" + ++keys[name];
901
- keys[name] = 0;
902
- return name + "$";
903
- }
904
- class PluginKey {
905
- /**
906
- Create a plugin key.
907
- */
908
- constructor(name = "key") {
909
- this.key = createKey(name);
910
- }
911
- /**
912
- Get the active plugin with this key, if any, from an editor
913
- state.
914
- */
915
- get(state) {
916
- return state.config.pluginsByKey[this.key];
917
- }
918
- /**
919
- Get the plugin's state from an editor state.
920
- */
921
- getState(state) {
922
- return state[this.key];
923
- }
924
- }
925
- export {
926
- AllSelection,
927
- EditorState,
928
- NodeSelection,
929
- Plugin,
930
- PluginKey,
931
- Selection,
932
- SelectionRange,
933
- TextSelection,
934
- Transaction
935
- };
936
- //# sourceMappingURL=index.js.map