@nascentdigital/funnel-core 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/dist/app/AppConfig.d.ts +41 -0
  2. package/dist/app/AppConfig.js +93 -0
  3. package/dist/app/BrandConfig.d.ts +13 -0
  4. package/dist/app/BrandConfig.js +2 -0
  5. package/dist/app/FeaturesConfig.d.ts +6 -0
  6. package/dist/app/FeaturesConfig.js +2 -0
  7. package/dist/app/RegionsConfig.d.ts +43 -0
  8. package/dist/app/RegionsConfig.js +113 -0
  9. package/dist/app/UIConfig.d.ts +4 -0
  10. package/dist/app/UIConfig.js +2 -0
  11. package/dist/app/index.d.ts +5 -0
  12. package/dist/app/index.js +21 -0
  13. package/dist/consent/ConsentCategory.d.ts +12 -0
  14. package/dist/consent/ConsentCategory.js +28 -0
  15. package/dist/consent/ConsentService.d.ts +15 -0
  16. package/dist/consent/ConsentService.js +37 -0
  17. package/dist/consent/index.d.ts +2 -0
  18. package/dist/consent/index.js +18 -0
  19. package/dist/errors/IsometricError.d.ts +19 -0
  20. package/dist/errors/IsometricError.js +30 -0
  21. package/dist/errors/IsometricErrorModule.d.ts +11 -0
  22. package/dist/errors/IsometricErrorModule.js +2 -0
  23. package/dist/errors/IsometricErrorUtils.d.ts +9 -0
  24. package/dist/errors/IsometricErrorUtils.js +85 -0
  25. package/dist/errors/SerializedIsometricError.d.ts +10 -0
  26. package/dist/errors/SerializedIsometricError.js +15 -0
  27. package/dist/errors/api/ApiError.d.ts +15 -0
  28. package/dist/errors/api/ApiError.js +23 -0
  29. package/dist/errors/api/ApiErrors.d.ts +7 -0
  30. package/dist/errors/api/ApiErrors.js +67 -0
  31. package/dist/errors/api/ArgumentError.d.ts +7 -0
  32. package/dist/errors/api/ArgumentError.js +18 -0
  33. package/dist/errors/api/ConcurrencyError.d.ts +4 -0
  34. package/dist/errors/api/ConcurrencyError.js +11 -0
  35. package/dist/errors/api/ConflictError.d.ts +4 -0
  36. package/dist/errors/api/ConflictError.js +11 -0
  37. package/dist/errors/api/DependencyError.d.ts +4 -0
  38. package/dist/errors/api/DependencyError.js +11 -0
  39. package/dist/errors/api/IllegalStateError.d.ts +4 -0
  40. package/dist/errors/api/IllegalStateError.js +11 -0
  41. package/dist/errors/api/InvalidOperationError.d.ts +4 -0
  42. package/dist/errors/api/InvalidOperationError.js +11 -0
  43. package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
  44. package/dist/errors/api/NotAuthenticatedError.js +11 -0
  45. package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
  46. package/dist/errors/api/NotAuthorizedError.js +11 -0
  47. package/dist/errors/api/NotAvailableError.d.ts +4 -0
  48. package/dist/errors/api/NotAvailableError.js +11 -0
  49. package/dist/errors/api/NotFoundError.d.ts +4 -0
  50. package/dist/errors/api/NotFoundError.js +11 -0
  51. package/dist/errors/api/NotImplementedError.d.ts +4 -0
  52. package/dist/errors/api/NotImplementedError.js +11 -0
  53. package/dist/errors/api/OfflineError.d.ts +4 -0
  54. package/dist/errors/api/OfflineError.js +11 -0
  55. package/dist/errors/api/RangeError.d.ts +4 -0
  56. package/dist/errors/api/RangeError.js +11 -0
  57. package/dist/errors/api/ServerError.d.ts +4 -0
  58. package/dist/errors/api/ServerError.js +11 -0
  59. package/dist/errors/api/TimeoutError.d.ts +4 -0
  60. package/dist/errors/api/TimeoutError.js +11 -0
  61. package/dist/errors/api/index.d.ts +16 -0
  62. package/dist/errors/api/index.js +32 -0
  63. package/dist/errors/index.d.ts +5 -0
  64. package/dist/errors/index.js +26 -0
  65. package/dist/forms/FormModel.d.ts +47 -0
  66. package/dist/forms/FormModel.js +149 -0
  67. package/dist/forms/Forms.d.ts +15 -0
  68. package/dist/forms/Forms.js +35 -0
  69. package/dist/forms/IFormService.d.ts +6 -0
  70. package/dist/forms/IFormService.js +2 -0
  71. package/dist/forms/TranslateSchema.d.ts +8 -0
  72. package/dist/forms/TranslateSchema.js +2 -0
  73. package/dist/forms/index.d.ts +4 -0
  74. package/dist/forms/index.js +20 -0
  75. package/dist/index.d.ts +10 -0
  76. package/dist/index.js +49 -0
  77. package/dist/regionalization/Country.d.ts +266 -0
  78. package/dist/regionalization/Country.js +338 -0
  79. package/dist/regionalization/Language.d.ts +199 -0
  80. package/dist/regionalization/Language.js +237 -0
  81. package/dist/regionalization/Locale.d.ts +28 -0
  82. package/dist/regionalization/Locale.js +49 -0
  83. package/dist/regionalization/Localized.d.ts +10 -0
  84. package/dist/regionalization/Localized.js +36 -0
  85. package/dist/regionalization/LocalizedCopy.d.ts +9 -0
  86. package/dist/regionalization/LocalizedCopy.js +26 -0
  87. package/dist/regionalization/Regionalization.d.ts +50 -0
  88. package/dist/regionalization/Regionalization.js +260 -0
  89. package/dist/regionalization/Regions.d.ts +2 -0
  90. package/dist/regionalization/Regions.js +2 -0
  91. package/dist/regionalization/index.d.ts +7 -0
  92. package/dist/regionalization/index.js +23 -0
  93. package/dist/schema/Asset.d.ts +23 -0
  94. package/dist/schema/Asset.js +36 -0
  95. package/dist/schema/AssetScope.d.ts +75 -0
  96. package/dist/schema/AssetScope.js +146 -0
  97. package/dist/schema/Block.d.ts +105 -0
  98. package/dist/schema/Block.js +122 -0
  99. package/dist/schema/ChangeSet.d.ts +108 -0
  100. package/dist/schema/ChangeSet.js +187 -0
  101. package/dist/schema/Collection.d.ts +197 -0
  102. package/dist/schema/Collection.js +165 -0
  103. package/dist/schema/CollectionModel.d.ts +30 -0
  104. package/dist/schema/CollectionModel.js +383 -0
  105. package/dist/schema/CollectionSnapshot.d.ts +11 -0
  106. package/dist/schema/CollectionSnapshot.js +12 -0
  107. package/dist/schema/Fields.d.ts +31 -0
  108. package/dist/schema/Fields.js +21 -0
  109. package/dist/schema/Form.d.ts +31 -0
  110. package/dist/schema/Form.js +23 -0
  111. package/dist/schema/LinkedCollectionModel.d.ts +9 -0
  112. package/dist/schema/LinkedCollectionModel.js +19 -0
  113. package/dist/schema/LinkedData.d.ts +44 -0
  114. package/dist/schema/LinkedData.js +288 -0
  115. package/dist/schema/LinkedPageModel.d.ts +11 -0
  116. package/dist/schema/LinkedPageModel.js +26 -0
  117. package/dist/schema/Optional.d.ts +23 -0
  118. package/dist/schema/Optional.js +34 -0
  119. package/dist/schema/Page.d.ts +299 -0
  120. package/dist/schema/Page.js +244 -0
  121. package/dist/schema/PageModel.d.ts +58 -0
  122. package/dist/schema/PageModel.js +881 -0
  123. package/dist/schema/PageQuery.d.ts +60 -0
  124. package/dist/schema/PageQuery.js +116 -0
  125. package/dist/schema/PageRoute.d.ts +7 -0
  126. package/dist/schema/PageRoute.js +48 -0
  127. package/dist/schema/PageSnapshot.d.ts +11 -0
  128. package/dist/schema/PageSnapshot.js +12 -0
  129. package/dist/schema/Section.d.ts +71 -0
  130. package/dist/schema/Section.js +35 -0
  131. package/dist/schema/Seo.d.ts +13 -0
  132. package/dist/schema/Seo.js +25 -0
  133. package/dist/schema/Site.d.ts +40 -0
  134. package/dist/schema/Site.js +87 -0
  135. package/dist/schema/SiteModel.d.ts +5 -0
  136. package/dist/schema/SiteModel.js +10 -0
  137. package/dist/schema/Tag.d.ts +28 -0
  138. package/dist/schema/Tag.js +59 -0
  139. package/dist/schema/TagGroup.d.ts +26 -0
  140. package/dist/schema/TagGroup.js +64 -0
  141. package/dist/schema/field/Field.d.ts +179 -0
  142. package/dist/schema/field/Field.js +309 -0
  143. package/dist/schema/field/base/AssetField.d.ts +148 -0
  144. package/dist/schema/field/base/AssetField.js +206 -0
  145. package/dist/schema/field/base/BooleanField.d.ts +21 -0
  146. package/dist/schema/field/base/BooleanField.js +38 -0
  147. package/dist/schema/field/base/CollectionField.d.ts +34 -0
  148. package/dist/schema/field/base/CollectionField.js +85 -0
  149. package/dist/schema/field/base/DateField.d.ts +21 -0
  150. package/dist/schema/field/base/DateField.js +37 -0
  151. package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
  152. package/dist/schema/field/base/DynamicPagesField.js +50 -0
  153. package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
  154. package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
  155. package/dist/schema/field/base/EnumField.d.ts +40 -0
  156. package/dist/schema/field/base/EnumField.js +131 -0
  157. package/dist/schema/field/base/FormField.d.ts +25 -0
  158. package/dist/schema/field/base/FormField.js +48 -0
  159. package/dist/schema/field/base/LinkField.d.ts +103 -0
  160. package/dist/schema/field/base/LinkField.js +201 -0
  161. package/dist/schema/field/base/PageField.d.ts +46 -0
  162. package/dist/schema/field/base/PageField.js +83 -0
  163. package/dist/schema/field/base/RichTextField.d.ts +71 -0
  164. package/dist/schema/field/base/RichTextField.js +196 -0
  165. package/dist/schema/field/base/TextField.d.ts +33 -0
  166. package/dist/schema/field/base/TextField.js +86 -0
  167. package/dist/schema/field/base/TimestampField.d.ts +25 -0
  168. package/dist/schema/field/base/TimestampField.js +41 -0
  169. package/dist/schema/field/base/index.d.ts +13 -0
  170. package/dist/schema/field/base/index.js +29 -0
  171. package/dist/schema/field/composite/ListField.d.ts +47 -0
  172. package/dist/schema/field/composite/ListField.js +107 -0
  173. package/dist/schema/field/composite/ObjectField.d.ts +56 -0
  174. package/dist/schema/field/composite/ObjectField.js +19 -0
  175. package/dist/schema/field/composite/index.d.ts +2 -0
  176. package/dist/schema/field/composite/index.js +18 -0
  177. package/dist/schema/field/index.d.ts +3 -0
  178. package/dist/schema/field/index.js +19 -0
  179. package/dist/schema/index.d.ts +25 -0
  180. package/dist/schema/index.js +41 -0
  181. package/dist/services/EventBus.d.ts +17 -0
  182. package/dist/services/EventBus.js +37 -0
  183. package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
  184. package/dist/services/humanVerification/IHumanVerification.js +2 -0
  185. package/dist/services/humanVerification/index.d.ts +1 -0
  186. package/dist/services/humanVerification/index.js +17 -0
  187. package/dist/services/index.d.ts +3 -0
  188. package/dist/services/index.js +19 -0
  189. package/dist/services/leadGen/Contact.d.ts +40 -0
  190. package/dist/services/leadGen/Contact.js +38 -0
  191. package/dist/services/leadGen/ILeadGen.d.ts +16 -0
  192. package/dist/services/leadGen/ILeadGen.js +2 -0
  193. package/dist/services/leadGen/index.d.ts +2 -0
  194. package/dist/services/leadGen/index.js +18 -0
  195. package/dist/types/BoxedValue.d.ts +3 -0
  196. package/dist/types/BoxedValue.js +2 -0
  197. package/dist/types/Callback.d.ts +9 -0
  198. package/dist/types/Callback.js +2 -0
  199. package/dist/types/DateString.d.ts +35 -0
  200. package/dist/types/DateString.js +172 -0
  201. package/dist/types/FilterConditionally.d.ts +3 -0
  202. package/dist/types/FilterConditionally.js +2 -0
  203. package/dist/types/MaybeConditionalValue.d.ts +8 -0
  204. package/dist/types/MaybeConditionalValue.js +12 -0
  205. package/dist/types/Ordinal.d.ts +17 -0
  206. package/dist/types/Ordinal.js +38 -0
  207. package/dist/types/OverridableStringUnion.d.ts +2 -0
  208. package/dist/types/OverridableStringUnion.js +2 -0
  209. package/dist/types/PartialBy.d.ts +1 -0
  210. package/dist/types/PartialBy.js +2 -0
  211. package/dist/types/PickData.d.ts +6 -0
  212. package/dist/types/PickData.js +2 -0
  213. package/dist/types/Provider.d.ts +4 -0
  214. package/dist/types/Provider.js +2 -0
  215. package/dist/types/RequiredBy.d.ts +1 -0
  216. package/dist/types/RequiredBy.js +2 -0
  217. package/dist/types/Result.d.ts +16 -0
  218. package/dist/types/Result.js +2 -0
  219. package/dist/types/Timestamp.d.ts +17 -0
  220. package/dist/types/Timestamp.js +57 -0
  221. package/dist/types/Transform.d.ts +4 -0
  222. package/dist/types/Transform.js +2 -0
  223. package/dist/types/index.d.ts +14 -0
  224. package/dist/types/index.js +30 -0
  225. package/dist/ui/Accessible.d.ts +5 -0
  226. package/dist/ui/Accessible.js +15 -0
  227. package/dist/ui/BlockThemes.d.ts +19 -0
  228. package/dist/ui/BlockThemes.js +29 -0
  229. package/dist/ui/ColorMode.d.ts +12 -0
  230. package/dist/ui/ColorMode.js +49 -0
  231. package/dist/ui/File.d.ts +43 -0
  232. package/dist/ui/File.js +55 -0
  233. package/dist/ui/FileType.d.ts +8 -0
  234. package/dist/ui/FileType.js +48 -0
  235. package/dist/ui/ImageSource.d.ts +12 -0
  236. package/dist/ui/ImageSource.js +48 -0
  237. package/dist/ui/MimeType.d.ts +28 -0
  238. package/dist/ui/MimeType.js +110 -0
  239. package/dist/ui/Placement.d.ts +21 -0
  240. package/dist/ui/Placement.js +135 -0
  241. package/dist/ui/Position.d.ts +6 -0
  242. package/dist/ui/Position.js +42 -0
  243. package/dist/ui/Selector.d.ts +6 -0
  244. package/dist/ui/Selector.js +23 -0
  245. package/dist/ui/SemanticColor.d.ts +8 -0
  246. package/dist/ui/SemanticColor.js +237 -0
  247. package/dist/ui/Visual.d.ts +24 -0
  248. package/dist/ui/Visual.js +66 -0
  249. package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
  250. package/dist/ui/block-layout/BlockLayout.js +286 -0
  251. package/dist/ui/block-layout/index.d.ts +1 -0
  252. package/dist/ui/block-layout/index.js +17 -0
  253. package/dist/ui/browser/BlurHasher.d.ts +13 -0
  254. package/dist/ui/browser/BlurHasher.js +76 -0
  255. package/dist/ui/browser/Browser.d.ts +107 -0
  256. package/dist/ui/browser/Browser.js +313 -0
  257. package/dist/ui/browser/ImageProxy.d.ts +30 -0
  258. package/dist/ui/browser/ImageProxy.js +132 -0
  259. package/dist/ui/browser/InputEvent.d.ts +13 -0
  260. package/dist/ui/browser/InputEvent.js +2 -0
  261. package/dist/ui/browser/SVGProxy.d.ts +9 -0
  262. package/dist/ui/browser/SVGProxy.js +59 -0
  263. package/dist/ui/browser/VideoProxy.d.ts +42 -0
  264. package/dist/ui/browser/VideoProxy.js +235 -0
  265. package/dist/ui/browser/index.d.ts +6 -0
  266. package/dist/ui/browser/index.js +22 -0
  267. package/dist/ui/fields/Field.d.ts +80 -0
  268. package/dist/ui/fields/Field.js +298 -0
  269. package/dist/ui/fields/FieldList.d.ts +80 -0
  270. package/dist/ui/fields/FieldList.js +421 -0
  271. package/dist/ui/fields/FieldListValidator.d.ts +9 -0
  272. package/dist/ui/fields/FieldListValidator.js +37 -0
  273. package/dist/ui/fields/FieldModel.d.ts +15 -0
  274. package/dist/ui/fields/FieldModel.js +28 -0
  275. package/dist/ui/fields/FieldSerializer.d.ts +13 -0
  276. package/dist/ui/fields/FieldSerializer.js +71 -0
  277. package/dist/ui/fields/FieldValidator.d.ts +19 -0
  278. package/dist/ui/fields/FieldValidator.js +98 -0
  279. package/dist/ui/fields/ObjectField.d.ts +75 -0
  280. package/dist/ui/fields/ObjectField.js +288 -0
  281. package/dist/ui/fields/errors.json +44 -0
  282. package/dist/ui/fields/index.d.ts +7 -0
  283. package/dist/ui/fields/index.js +23 -0
  284. package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
  285. package/dist/ui/fields/validators/AssetValidator.js +25 -0
  286. package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
  287. package/dist/ui/fields/validators/DateValidator.js +41 -0
  288. package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
  289. package/dist/ui/fields/validators/EnumValidator.js +77 -0
  290. package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
  291. package/dist/ui/fields/validators/GenericValidator.js +22 -0
  292. package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
  293. package/dist/ui/fields/validators/LinkValidator.js +146 -0
  294. package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
  295. package/dist/ui/fields/validators/RichTextValidator.js +35 -0
  296. package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
  297. package/dist/ui/fields/validators/TextValidator.js +138 -0
  298. package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
  299. package/dist/ui/fields/validators/TimestampValidator.js +41 -0
  300. package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
  301. package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
  302. package/dist/ui/fields/validators/index.d.ts +8 -0
  303. package/dist/ui/fields/validators/index.js +24 -0
  304. package/dist/ui/geometry/AspectRatio.d.ts +27 -0
  305. package/dist/ui/geometry/AspectRatio.js +77 -0
  306. package/dist/ui/geometry/Bounds.d.ts +4 -0
  307. package/dist/ui/geometry/Bounds.js +11 -0
  308. package/dist/ui/geometry/Frame.d.ts +3 -0
  309. package/dist/ui/geometry/Frame.js +2 -0
  310. package/dist/ui/geometry/Insets.d.ts +14 -0
  311. package/dist/ui/geometry/Insets.js +14 -0
  312. package/dist/ui/geometry/PixelSize.d.ts +1 -0
  313. package/dist/ui/geometry/PixelSize.js +2 -0
  314. package/dist/ui/geometry/Point.d.ts +7 -0
  315. package/dist/ui/geometry/Point.js +15 -0
  316. package/dist/ui/geometry/Rect.d.ts +19 -0
  317. package/dist/ui/geometry/Rect.js +68 -0
  318. package/dist/ui/geometry/ScreenSize.d.ts +1 -0
  319. package/dist/ui/geometry/ScreenSize.js +2 -0
  320. package/dist/ui/geometry/Size.d.ts +7 -0
  321. package/dist/ui/geometry/Size.js +9 -0
  322. package/dist/ui/geometry/index.d.ts +9 -0
  323. package/dist/ui/geometry/index.js +25 -0
  324. package/dist/ui/index.d.ts +18 -0
  325. package/dist/ui/index.js +34 -0
  326. package/dist/ui/responsive/Breakpoint.d.ts +8 -0
  327. package/dist/ui/responsive/Breakpoint.js +24 -0
  328. package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
  329. package/dist/ui/responsive/BreakpointObserver.js +104 -0
  330. package/dist/ui/responsive/Breakpoints.d.ts +5 -0
  331. package/dist/ui/responsive/Breakpoints.js +15 -0
  332. package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
  333. package/dist/ui/responsive/ResponsiveValue.js +26 -0
  334. package/dist/ui/responsive/index.d.ts +4 -0
  335. package/dist/ui/responsive/index.js +20 -0
  336. package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
  337. package/dist/ui/richtext/LexicalUtils.js +314 -0
  338. package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
  339. package/dist/ui/richtext/StyledTextNode.js +101 -0
  340. package/dist/ui/richtext/index.d.ts +2 -0
  341. package/dist/ui/richtext/index.js +18 -0
  342. package/dist/utils/ArrayUtils.d.ts +17 -0
  343. package/dist/utils/ArrayUtils.js +66 -0
  344. package/dist/utils/ByteSize.d.ts +19 -0
  345. package/dist/utils/ByteSize.js +33 -0
  346. package/dist/utils/DateUtils.d.ts +15 -0
  347. package/dist/utils/DateUtils.js +100 -0
  348. package/dist/utils/Deferral.d.ts +28 -0
  349. package/dist/utils/Deferral.js +107 -0
  350. package/dist/utils/Duration.d.ts +7 -0
  351. package/dist/utils/Duration.js +35 -0
  352. package/dist/utils/Fn.d.ts +14 -0
  353. package/dist/utils/Fn.js +52 -0
  354. package/dist/utils/ObjectUtils.d.ts +89 -0
  355. package/dist/utils/ObjectUtils.js +159 -0
  356. package/dist/utils/Random.d.ts +15 -0
  357. package/dist/utils/Random.js +72 -0
  358. package/dist/utils/StringUtils.d.ts +10 -0
  359. package/dist/utils/StringUtils.js +51 -0
  360. package/dist/utils/UrlUtils.d.ts +22 -0
  361. package/dist/utils/UrlUtils.js +119 -0
  362. package/dist/utils/Value.d.ts +23 -0
  363. package/dist/utils/Value.js +122 -0
  364. package/dist/utils/index.d.ts +12 -0
  365. package/dist/utils/index.js +28 -0
  366. package/dist/utils/isDefined.d.ts +1 -0
  367. package/dist/utils/isDefined.js +6 -0
  368. package/package.json +64 -0
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Browser = void 0;
7
+ const css_escape_1 = __importDefault(require("css.escape"));
8
+ const geometry_1 = require("../geometry");
9
+ /**
10
+ * A collection of helper methods for manipulating client-side DOM and web browser APIs.
11
+ */
12
+ var Browser;
13
+ (function (Browser) {
14
+ /**
15
+ * Returns `true` if running within the actual browser and have access to HTML DOM and window object.
16
+ */
17
+ Browser.available = typeof global.window !== 'undefined';
18
+ /**
19
+ * Returns `window` object if browser is available, or `undefined` otherwise.
20
+ */
21
+ Browser.window = Browser.available ? global.window : undefined;
22
+ function getHtml() {
23
+ return Browser.window === null || Browser.window === void 0 ? void 0 : Browser.window.document.documentElement;
24
+ }
25
+ Browser.getHtml = getHtml;
26
+ function escapeCss(css) {
27
+ return (0, css_escape_1.default)(css);
28
+ }
29
+ Browser.escapeCss = escapeCss;
30
+ /**
31
+ * Provides preset HTML element selectors for various purposes.
32
+ */
33
+ let Element;
34
+ (function (Element) {
35
+ // constants
36
+ Element.tabbable = [
37
+ 'a[href]:not([tabindex^="-"])',
38
+ 'area[href]:not([tabindex^="-"])',
39
+ 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
40
+ 'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
41
+ 'select:not([disabled]):not([tabindex^="-"])',
42
+ 'textarea:not([disabled]):not([tabindex^="-"])',
43
+ 'button:not([disabled]):not([tabindex^="-"])',
44
+ 'iframe:not([tabindex^="-"])',
45
+ 'audio[controls]:not([tabindex^="-"])',
46
+ 'video[controls]:not([tabindex^="-"])',
47
+ '[contenteditable]:not([tabindex^="-"])',
48
+ '[tabindex]:not([tabindex^="-"])'
49
+ ];
50
+ })(Element = Browser.Element || (Browser.Element = {}));
51
+ /**
52
+ * Scrolls to top of windows.
53
+ */
54
+ function scrollToTop() {
55
+ Browser.window === null || Browser.window === void 0 ? void 0 : Browser.window.scrollTo({ top: 0, behavior: 'smooth' });
56
+ }
57
+ Browser.scrollToTop = scrollToTop;
58
+ /**
59
+ * Locks top-level browser window scrolling.
60
+ *
61
+ * @param enabled disables scrolling if `true`, restores it otherwise
62
+ */
63
+ function setScrollEnabled(enabled) {
64
+ // skip if in SSR
65
+ if (!Browser.available || !Browser.window) {
66
+ return;
67
+ }
68
+ // FIXME: we should store the previous overflow-y style in a data-tag and restore it afterwards
69
+ // helpers
70
+ const updateScrollBehavior = (element) => {
71
+ if (enabled) {
72
+ element.style.removeProperty('overflow-y');
73
+ }
74
+ else {
75
+ element.style.setProperty('overflow-y', 'hidden');
76
+ }
77
+ };
78
+ // update overflow behavior on roots
79
+ const { documentElement, body } = Browser.window.document;
80
+ updateScrollBehavior(documentElement);
81
+ updateScrollBehavior(body);
82
+ // TODO: disable touch
83
+ }
84
+ Browser.setScrollEnabled = setScrollEnabled;
85
+ /**
86
+ * Resolves the actual HTML elements for the given selectors (pass-thru if inputs are already resolved)
87
+ *
88
+ * @param targets the selector or selectors to use - if actual `Element` instances are passed in they are returned as is
89
+ * @param container the root element where the search should be anchored, otherwise the `window.document` is used
90
+ */
91
+ function getElements(targets, container) {
92
+ // skip if not in browser
93
+ const root = container !== null && container !== void 0 ? container : Browser.window === null || Browser.window === void 0 ? void 0 : Browser.window.document;
94
+ if (!root) {
95
+ return [];
96
+ }
97
+ // handle array of selectors/elements
98
+ else if (Array.isArray(targets)) {
99
+ // skip if there are no targets
100
+ if (targets.length === 0) {
101
+ return [];
102
+ }
103
+ // or handle selector strings
104
+ else if (typeof targets[0] === 'string') {
105
+ return targets
106
+ .flatMap(target => Array.from(root.querySelectorAll(target).values()));
107
+ }
108
+ // otherwise, return as-is (they're already elements)
109
+ else {
110
+ return targets;
111
+ }
112
+ }
113
+ // otherwise handle single element
114
+ else {
115
+ const element = getElement(targets, root);
116
+ return element ? [element] : [];
117
+ }
118
+ }
119
+ Browser.getElements = getElements;
120
+ /**
121
+ * Resolves an actual HTML element for a given selector (pass-thru if input is already resolved)
122
+ *
123
+ * @param target the selector to use - if an actual `Element` instance is passed, it is returned directly
124
+ * @param container the root element where the search should be anchored, otherwise the `window.document` is used
125
+ */
126
+ function getElement(target, container) {
127
+ var _a;
128
+ // skip if not in browser
129
+ const root = container !== null && container !== void 0 ? container : Browser.window === null || Browser.window === void 0 ? void 0 : Browser.window.document;
130
+ if (!root) {
131
+ return undefined;
132
+ }
133
+ // handle selector
134
+ else if (typeof target === 'string') {
135
+ return (_a = root.querySelector(target)) !== null && _a !== void 0 ? _a : undefined;
136
+ }
137
+ // or return element
138
+ else {
139
+ return target;
140
+ }
141
+ }
142
+ Browser.getElement = getElement;
143
+ function getElementRect(element, { absolute = false } = {}) {
144
+ // skip if there's no element or if we're SSR
145
+ if (!element || !Browser.available) {
146
+ return undefined;
147
+ }
148
+ // or skip if we already have a rect
149
+ else if (element instanceof geometry_1.Rect) {
150
+ return element;
151
+ }
152
+ // try to coerce element into an element (or fail)
153
+ const anchorElement = (typeof element === 'string'
154
+ ? document.querySelector(element)
155
+ : element);
156
+ // skip if there's no element
157
+ if (!anchorElement) {
158
+ return undefined;
159
+ }
160
+ // bypass any transforms (so we don't get invalid positioning)
161
+ const width = anchorElement.offsetWidth;
162
+ const height = anchorElement.offsetHeight;
163
+ let x = 0, y = 0;
164
+ let parentElement = anchorElement;
165
+ while (parentElement) {
166
+ x += parentElement.offsetLeft;
167
+ y += parentElement.offsetTop;
168
+ parentElement = parentElement.offsetParent;
169
+ }
170
+ // adjust based on viewport (if required)
171
+ if (!absolute && Browser.window) {
172
+ // determine scroll offsets
173
+ let scrollX = Browser.window.scrollX || Browser.window.pageXOffset;
174
+ let scrollY = Browser.window.scrollY || Browser.window.pageYOffset;
175
+ parentElement = anchorElement;
176
+ while (parentElement) {
177
+ scrollX += parentElement.scrollLeft;
178
+ scrollY += parentElement.scrollTop;
179
+ parentElement = parentElement.parentElement;
180
+ }
181
+ // adjust based on scrolling
182
+ x -= scrollX;
183
+ y -= scrollY;
184
+ }
185
+ // return rect
186
+ return new geometry_1.Rect(x, y, width, height);
187
+ }
188
+ Browser.getElementRect = getElementRect;
189
+ /**
190
+ * A helper method used to select a set of HTML DOM elements and make temporary modifications that can be later
191
+ * rolled back via the returned `restore()` method.
192
+ *
193
+ * @param container an optional container used to scope the target selectors, otherwise the `window.document` is used
194
+ * @param targets a set of elements or selectors that are the scope of modification
195
+ * @param restoreKey a key that if provided will persist the restore snapshot into the DOM element via a `dataset` tag
196
+ * @param onModify the callback where modification should be made
197
+ */
198
+ function modifyElements({ container, targets, restoreKey, onModify }) {
199
+ // get elements to modify
200
+ const elements = getElements(targets, container);
201
+ // create modifiers
202
+ const modifiers = elements.map(element => new ElementModifier(element, restoreKey));
203
+ // pass modifiers to callback
204
+ onModify(modifiers);
205
+ // snapshot all changes
206
+ modifiers.forEach(modifier => modifier.snapshot());
207
+ // return restore callback
208
+ return () => modifiers.forEach(modifier => modifier.restore());
209
+ }
210
+ Browser.modifyElements = modifyElements;
211
+ /**
212
+ * Locks all interactive browser elements from tab focus that are outside of the `target` scope (if provided).
213
+ * @param target The target (and its children) that should not be locked.
214
+ * @return An `unlock` callback that restores tab focus for the previously locked elements.
215
+ */
216
+ function lockFocus(target) {
217
+ // capture elements that can be focused (skip if
218
+ const focusableElement = getElement(target);
219
+ // lock all other focusable elements
220
+ return modifyElements({
221
+ targets: Element.tabbable,
222
+ onModify: elements => elements.forEach(modifier => {
223
+ // lock if it's not part of the focusable set
224
+ const { element } = modifier;
225
+ if (!focusableElement || (focusableElement !== element && !focusableElement.contains(element))) {
226
+ modifier.setAttribute('tabindex', '-1');
227
+ }
228
+ }),
229
+ restoreKey: 'focusDisabled'
230
+ });
231
+ }
232
+ Browser.lockFocus = lockFocus;
233
+ /**
234
+ * A proxy used to manipulate an HTML DOM element. This class provides a way to rollback changes and even
235
+ * persist the rollback snapshot directly in the DOM itself (via the `restoreKey`).
236
+ */
237
+ class ElementModifier {
238
+ constructor(element, _restoreKey) {
239
+ this.element = element;
240
+ this._restoreKey = _restoreKey;
241
+ // determine original values
242
+ let snapshot = undefined;
243
+ if (_restoreKey && element.dataset[_restoreKey]) {
244
+ snapshot = new Map(JSON.parse(element.dataset[_restoreKey]));
245
+ }
246
+ // initialize instance variables
247
+ this._originalAttributes = snapshot !== null && snapshot !== void 0 ? snapshot : new Map();
248
+ }
249
+ /**
250
+ * Sets an attribute on the underlying HTMLElement.
251
+ * @param name the name of the attribute being set
252
+ * @param value the attribute value
253
+ */
254
+ setAttribute(name, value) {
255
+ // save original (if we haven't captured the original value)
256
+ const { element, _originalAttributes } = this;
257
+ if (!_originalAttributes.has(name)) {
258
+ _originalAttributes.set(name, element.hasAttribute(name) ? element.getAttribute(name) : null);
259
+ }
260
+ // change attribute
261
+ this.element.setAttribute(name, value);
262
+ }
263
+ /**
264
+ * Removes an attribute from the underlying HTMLElement.
265
+ * @param name the name of the attribute being removed
266
+ */
267
+ deleteAttribute(name) {
268
+ // save original (if we haven't captured the original value)
269
+ const { element, _originalAttributes } = this;
270
+ if (!_originalAttributes.has(name)) {
271
+ _originalAttributes.set(name, element.hasAttribute(name) ? element.getAttribute(name) : null);
272
+ }
273
+ // delete value
274
+ element.removeAttribute(name);
275
+ }
276
+ /**
277
+ * Saves a snapshot of the pre-modified instance to the `Element`, but *only if* the `restoreKey` was specified.
278
+ */
279
+ snapshot() {
280
+ // skip if there's no restore key provided OR if there are no changes
281
+ const { element, _originalAttributes, _restoreKey } = this;
282
+ if (!_restoreKey || _originalAttributes.size === 0) {
283
+ return;
284
+ }
285
+ // serialize changes
286
+ element.dataset[_restoreKey] = JSON.stringify(Array.from(_originalAttributes.entries()));
287
+ }
288
+ /**
289
+ * Restores the underlying element to its pre-modification state, clearing any snapshot data.
290
+ */
291
+ restore() {
292
+ // undo each change
293
+ const { element, _originalAttributes, _restoreKey } = this;
294
+ for (const [attributeName, attributeValue] of _originalAttributes.entries()) {
295
+ // delete if there's no value
296
+ if (attributeValue === null) {
297
+ element.removeAttribute(attributeName);
298
+ }
299
+ // or reset it
300
+ else {
301
+ element.setAttribute(attributeName, attributeValue);
302
+ }
303
+ }
304
+ // clear attributes
305
+ _originalAttributes.clear();
306
+ // clear snapshot (if any)
307
+ if (_restoreKey && element.dataset[_restoreKey]) {
308
+ delete element.dataset[_restoreKey];
309
+ }
310
+ }
311
+ }
312
+ Browser.ElementModifier = ElementModifier;
313
+ })(Browser || (exports.Browser = Browser = {}));
@@ -0,0 +1,30 @@
1
+ import { Size } from '../geometry';
2
+ export declare abstract class ImageProxy {
3
+ readonly image: HTMLImageElement;
4
+ private readonly _state$;
5
+ private _blurHash?;
6
+ protected constructor(image: HTMLImageElement);
7
+ get state$(): import("rxjs").Observable<ImageProxy.State>;
8
+ get state(): ImageProxy.State;
9
+ private set state(value);
10
+ get loaded(): boolean;
11
+ get intrinsicSize(): Size;
12
+ waitUntil(...states: ImageProxy.State[]): Promise<ImageProxy.State>;
13
+ waitUntilReady(): Promise<void>;
14
+ getBlurHash(): Promise<string | undefined>;
15
+ dispose(): void;
16
+ private onLoad;
17
+ private onError;
18
+ }
19
+ export declare namespace ImageProxy {
20
+ type State = 'uninitialized' | 'loading' | 'ready' | 'error' | 'disposed';
21
+ }
22
+ export declare class ElementImageProxy extends ImageProxy {
23
+ constructor(image: HTMLImageElement);
24
+ }
25
+ export declare class BlobImageProxy extends ImageProxy {
26
+ readonly blob: Blob;
27
+ private readonly _src;
28
+ constructor(blob: Blob);
29
+ dispose(): void;
30
+ }
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlobImageProxy = exports.ElementImageProxy = exports.ImageProxy = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const errors_1 = require("../../errors");
6
+ const BlurHasher_1 = require("./BlurHasher");
7
+ // base
8
+ class ImageProxy {
9
+ constructor(image) {
10
+ this.image = image;
11
+ // initialize instance variables
12
+ this._state$ = new rxjs_1.BehaviorSubject('uninitialized');
13
+ // bind methods (helps with callbacks
14
+ this.onLoad = this.onLoad.bind(this);
15
+ this.onError = this.onError.bind(this);
16
+ // add listeners
17
+ image.addEventListener('load', this.onLoad);
18
+ image.addEventListener('error', this.onError);
19
+ // set initial state
20
+ this.state = image.complete
21
+ ? image.naturalWidth === 0
22
+ ? 'error'
23
+ : 'ready'
24
+ : 'loading';
25
+ }
26
+ get state$() {
27
+ return this._state$.asObservable();
28
+ }
29
+ get state() {
30
+ return this._state$.getValue();
31
+ }
32
+ set state(state) {
33
+ // ignore if disposed
34
+ const { _state$ } = this;
35
+ if (_state$.getValue() === 'disposed') {
36
+ return;
37
+ }
38
+ // update
39
+ _state$.next(state);
40
+ }
41
+ get loaded() {
42
+ return this.state === 'ready';
43
+ }
44
+ get intrinsicSize() {
45
+ // throw if not ready
46
+ const { image, loaded } = this;
47
+ if (!loaded) {
48
+ throw new errors_1.InvalidOperationError('Cannot access size of unloaded image');
49
+ }
50
+ // return image size
51
+ return {
52
+ width: image.naturalWidth,
53
+ height: image.naturalHeight
54
+ };
55
+ }
56
+ waitUntil(...states) {
57
+ return (0, rxjs_1.firstValueFrom)(this._state$.pipe((0, rxjs_1.filter)(state => states.includes(state))));
58
+ }
59
+ async waitUntilReady() {
60
+ // wait for ready/error
61
+ const state = await this.waitUntil('ready', 'error', 'disposed');
62
+ // throw if error
63
+ if (state === 'error') {
64
+ throw new errors_1.NotAvailableError('Image could not be loaded');
65
+ }
66
+ }
67
+ async getBlurHash() {
68
+ // return hash if already computed
69
+ const { image, _blurHash } = this;
70
+ if (_blurHash) {
71
+ return _blurHash;
72
+ }
73
+ // ensure initialization is done
74
+ if (!this.loaded) {
75
+ await this.waitUntilReady();
76
+ }
77
+ // create hash
78
+ this._blurHash = BlurHasher_1.BlurHasher.createHash(image);
79
+ // return has
80
+ return this._blurHash;
81
+ }
82
+ dispose() {
83
+ // mark disposed
84
+ this._state$.next('disposed');
85
+ // remove listeners
86
+ const { image } = this;
87
+ image.removeEventListener('load', this.onLoad);
88
+ image.removeEventListener('error', this.onError);
89
+ }
90
+ onLoad() {
91
+ this.state = 'ready';
92
+ }
93
+ onError() {
94
+ this.state = 'error';
95
+ }
96
+ }
97
+ exports.ImageProxy = ImageProxy;
98
+ // element
99
+ class ElementImageProxy extends ImageProxy {
100
+ constructor(image) {
101
+ super(image);
102
+ }
103
+ }
104
+ exports.ElementImageProxy = ElementImageProxy;
105
+ // blob
106
+ class BlobImageProxy extends ImageProxy {
107
+ constructor(blob) {
108
+ // create offscreen image
109
+ const image = document.createElement('img');
110
+ const src = URL.createObjectURL(blob);
111
+ image.src = src;
112
+ const style = image.style;
113
+ style.position = 'absolute';
114
+ style.pointerEvents = 'none';
115
+ style.opacity = '0';
116
+ // construct base
117
+ super(image);
118
+ this.blob = blob;
119
+ // initialize instance variables
120
+ this._src = src;
121
+ }
122
+ dispose() {
123
+ // call base
124
+ super.dispose();
125
+ // revoke src
126
+ const { image, _src } = this;
127
+ URL.revokeObjectURL(_src);
128
+ // clean up dom
129
+ image.remove();
130
+ }
131
+ }
132
+ exports.BlobImageProxy = BlobImageProxy;
@@ -0,0 +1,13 @@
1
+ export interface InputEvent {
2
+ bubbles: boolean;
3
+ cancelable: boolean;
4
+ defaultPrevented: boolean;
5
+ eventPhase: number;
6
+ isTrusted: boolean;
7
+ preventDefault(): void;
8
+ isDefaultPrevented(): boolean;
9
+ stopPropagation(): void;
10
+ isPropagationStopped(): boolean;
11
+ persist(): void;
12
+ timeStamp: number;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ import { Size } from '../geometry';
2
+ export declare class SVGProxy {
3
+ readonly data: string;
4
+ private readonly svg;
5
+ private constructor();
6
+ get intrinsicSize(): Size | undefined;
7
+ static forBlob(blob: Blob): Promise<SVGProxy>;
8
+ static forData(data: string): SVGProxy;
9
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SVGProxy = void 0;
4
+ const errors_1 = require("../../errors");
5
+ const Browser_1 = require("./Browser");
6
+ // class
7
+ class SVGProxy {
8
+ constructor(data) {
9
+ this.data = data;
10
+ // throw if not in browser
11
+ if (!Browser_1.Browser.available) {
12
+ throw new errors_1.InvalidOperationError('Cannot access SVGProxy outside of Browser');
13
+ }
14
+ // parse svg (throw if not an svg)
15
+ const parser = new DOMParser();
16
+ const document = parser.parseFromString(data, 'image/svg+xml');
17
+ const element = document.documentElement;
18
+ if (!isSvgElement(element)) {
19
+ console.error('[SVGProxy] invalid SVG data:', data);
20
+ throw new errors_1.ArgumentError('Specified data is not an SVG');
21
+ }
22
+ // initialize instance variables
23
+ this.svg = element;
24
+ }
25
+ get intrinsicSize() {
26
+ // helper
27
+ const { svg } = this;
28
+ const resolveSize = (attribute) => {
29
+ const sizeRaw = svg.getAttribute(attribute) || undefined;
30
+ const size = sizeRaw ? Number.parseInt(sizeRaw) : undefined;
31
+ return Number.isInteger(size) ? size : undefined;
32
+ };
33
+ // return size OR undefined if we're missing size
34
+ const width = resolveSize('width');
35
+ const height = resolveSize('height');
36
+ console.error('[SVGProxy] extracted suze:', { svg, width, height, data: this.data });
37
+ return width && height
38
+ ? { width, height }
39
+ : undefined;
40
+ }
41
+ static async forBlob(blob) {
42
+ // throw if not an svg
43
+ const mimeType = blob.type.toLowerCase();
44
+ if (mimeType !== 'image/svg+xml') {
45
+ throw new errors_1.ArgumentError(`Expected SVG blob, found "${mimeType}"`);
46
+ }
47
+ // create svg proxy
48
+ return new SVGProxy(await blob.text());
49
+ }
50
+ static forData(data) {
51
+ return new SVGProxy(data);
52
+ }
53
+ }
54
+ exports.SVGProxy = SVGProxy;
55
+ // guard
56
+ function isSvgElement(element) {
57
+ var _a;
58
+ return ((_a = element === null || element === void 0 ? void 0 : element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'svg';
59
+ }
@@ -0,0 +1,42 @@
1
+ import { Size } from '../geometry';
2
+ export declare abstract class VideoProxy {
3
+ readonly video: HTMLVideoElement;
4
+ private readonly _state$;
5
+ private _blurHash?;
6
+ protected constructor(video: HTMLVideoElement);
7
+ get state$(): import("rxjs").Observable<VideoProxy.State>;
8
+ get state(): VideoProxy.State;
9
+ private set state(value);
10
+ get loaded(): boolean;
11
+ get intrinsicSize(): Size;
12
+ get duration(): number;
13
+ waitUntil(...states: VideoProxy.State[]): Promise<VideoProxy.State>;
14
+ waitUntilReady(): Promise<void>;
15
+ seek(positionInSeconds: number): Promise<void>;
16
+ play({ playbackRate, loop }?: VideoProxy.PlayOptions): Promise<void>;
17
+ pause(): Promise<void>;
18
+ getBlurHash(): Promise<string | undefined>;
19
+ dispose(): void;
20
+ private onLoadData;
21
+ private onError;
22
+ private onPlay;
23
+ private onSeeking;
24
+ private onSeeked;
25
+ private onPause;
26
+ }
27
+ export declare namespace VideoProxy {
28
+ type State = 'uninitialized' | 'loading' | 'ready' | 'playing' | 'seeking' | 'error' | 'disposed';
29
+ type PlayOptions = {
30
+ playbackRate?: number;
31
+ loop?: boolean;
32
+ };
33
+ }
34
+ export declare class ElementVideoProxy extends VideoProxy {
35
+ constructor(video: HTMLVideoElement);
36
+ }
37
+ export declare class BlobVideoProxy extends VideoProxy {
38
+ readonly blob: Blob;
39
+ private readonly _src;
40
+ constructor(blob: Blob);
41
+ dispose(): void;
42
+ }