@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.
- package/dist/app/AppConfig.d.ts +41 -0
- package/dist/app/AppConfig.js +93 -0
- package/dist/app/BrandConfig.d.ts +13 -0
- package/dist/app/BrandConfig.js +2 -0
- package/dist/app/FeaturesConfig.d.ts +6 -0
- package/dist/app/FeaturesConfig.js +2 -0
- package/dist/app/RegionsConfig.d.ts +43 -0
- package/dist/app/RegionsConfig.js +113 -0
- package/dist/app/UIConfig.d.ts +4 -0
- package/dist/app/UIConfig.js +2 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.js +21 -0
- package/dist/consent/ConsentCategory.d.ts +12 -0
- package/dist/consent/ConsentCategory.js +28 -0
- package/dist/consent/ConsentService.d.ts +15 -0
- package/dist/consent/ConsentService.js +37 -0
- package/dist/consent/index.d.ts +2 -0
- package/dist/consent/index.js +18 -0
- package/dist/errors/IsometricError.d.ts +19 -0
- package/dist/errors/IsometricError.js +30 -0
- package/dist/errors/IsometricErrorModule.d.ts +11 -0
- package/dist/errors/IsometricErrorModule.js +2 -0
- package/dist/errors/IsometricErrorUtils.d.ts +9 -0
- package/dist/errors/IsometricErrorUtils.js +85 -0
- package/dist/errors/SerializedIsometricError.d.ts +10 -0
- package/dist/errors/SerializedIsometricError.js +15 -0
- package/dist/errors/api/ApiError.d.ts +15 -0
- package/dist/errors/api/ApiError.js +23 -0
- package/dist/errors/api/ApiErrors.d.ts +7 -0
- package/dist/errors/api/ApiErrors.js +67 -0
- package/dist/errors/api/ArgumentError.d.ts +7 -0
- package/dist/errors/api/ArgumentError.js +18 -0
- package/dist/errors/api/ConcurrencyError.d.ts +4 -0
- package/dist/errors/api/ConcurrencyError.js +11 -0
- package/dist/errors/api/ConflictError.d.ts +4 -0
- package/dist/errors/api/ConflictError.js +11 -0
- package/dist/errors/api/DependencyError.d.ts +4 -0
- package/dist/errors/api/DependencyError.js +11 -0
- package/dist/errors/api/IllegalStateError.d.ts +4 -0
- package/dist/errors/api/IllegalStateError.js +11 -0
- package/dist/errors/api/InvalidOperationError.d.ts +4 -0
- package/dist/errors/api/InvalidOperationError.js +11 -0
- package/dist/errors/api/NotAuthenticatedError.d.ts +4 -0
- package/dist/errors/api/NotAuthenticatedError.js +11 -0
- package/dist/errors/api/NotAuthorizedError.d.ts +4 -0
- package/dist/errors/api/NotAuthorizedError.js +11 -0
- package/dist/errors/api/NotAvailableError.d.ts +4 -0
- package/dist/errors/api/NotAvailableError.js +11 -0
- package/dist/errors/api/NotFoundError.d.ts +4 -0
- package/dist/errors/api/NotFoundError.js +11 -0
- package/dist/errors/api/NotImplementedError.d.ts +4 -0
- package/dist/errors/api/NotImplementedError.js +11 -0
- package/dist/errors/api/OfflineError.d.ts +4 -0
- package/dist/errors/api/OfflineError.js +11 -0
- package/dist/errors/api/RangeError.d.ts +4 -0
- package/dist/errors/api/RangeError.js +11 -0
- package/dist/errors/api/ServerError.d.ts +4 -0
- package/dist/errors/api/ServerError.js +11 -0
- package/dist/errors/api/TimeoutError.d.ts +4 -0
- package/dist/errors/api/TimeoutError.js +11 -0
- package/dist/errors/api/index.d.ts +16 -0
- package/dist/errors/api/index.js +32 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +26 -0
- package/dist/forms/FormModel.d.ts +47 -0
- package/dist/forms/FormModel.js +149 -0
- package/dist/forms/Forms.d.ts +15 -0
- package/dist/forms/Forms.js +35 -0
- package/dist/forms/IFormService.d.ts +6 -0
- package/dist/forms/IFormService.js +2 -0
- package/dist/forms/TranslateSchema.d.ts +8 -0
- package/dist/forms/TranslateSchema.js +2 -0
- package/dist/forms/index.d.ts +4 -0
- package/dist/forms/index.js +20 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +49 -0
- package/dist/regionalization/Country.d.ts +266 -0
- package/dist/regionalization/Country.js +338 -0
- package/dist/regionalization/Language.d.ts +199 -0
- package/dist/regionalization/Language.js +237 -0
- package/dist/regionalization/Locale.d.ts +28 -0
- package/dist/regionalization/Locale.js +49 -0
- package/dist/regionalization/Localized.d.ts +10 -0
- package/dist/regionalization/Localized.js +36 -0
- package/dist/regionalization/LocalizedCopy.d.ts +9 -0
- package/dist/regionalization/LocalizedCopy.js +26 -0
- package/dist/regionalization/Regionalization.d.ts +50 -0
- package/dist/regionalization/Regionalization.js +260 -0
- package/dist/regionalization/Regions.d.ts +2 -0
- package/dist/regionalization/Regions.js +2 -0
- package/dist/regionalization/index.d.ts +7 -0
- package/dist/regionalization/index.js +23 -0
- package/dist/schema/Asset.d.ts +23 -0
- package/dist/schema/Asset.js +36 -0
- package/dist/schema/AssetScope.d.ts +75 -0
- package/dist/schema/AssetScope.js +146 -0
- package/dist/schema/Block.d.ts +105 -0
- package/dist/schema/Block.js +122 -0
- package/dist/schema/ChangeSet.d.ts +108 -0
- package/dist/schema/ChangeSet.js +187 -0
- package/dist/schema/Collection.d.ts +197 -0
- package/dist/schema/Collection.js +165 -0
- package/dist/schema/CollectionModel.d.ts +30 -0
- package/dist/schema/CollectionModel.js +383 -0
- package/dist/schema/CollectionSnapshot.d.ts +11 -0
- package/dist/schema/CollectionSnapshot.js +12 -0
- package/dist/schema/Fields.d.ts +31 -0
- package/dist/schema/Fields.js +21 -0
- package/dist/schema/Form.d.ts +31 -0
- package/dist/schema/Form.js +23 -0
- package/dist/schema/LinkedCollectionModel.d.ts +9 -0
- package/dist/schema/LinkedCollectionModel.js +19 -0
- package/dist/schema/LinkedData.d.ts +44 -0
- package/dist/schema/LinkedData.js +288 -0
- package/dist/schema/LinkedPageModel.d.ts +11 -0
- package/dist/schema/LinkedPageModel.js +26 -0
- package/dist/schema/Optional.d.ts +23 -0
- package/dist/schema/Optional.js +34 -0
- package/dist/schema/Page.d.ts +299 -0
- package/dist/schema/Page.js +244 -0
- package/dist/schema/PageModel.d.ts +58 -0
- package/dist/schema/PageModel.js +881 -0
- package/dist/schema/PageQuery.d.ts +60 -0
- package/dist/schema/PageQuery.js +116 -0
- package/dist/schema/PageRoute.d.ts +7 -0
- package/dist/schema/PageRoute.js +48 -0
- package/dist/schema/PageSnapshot.d.ts +11 -0
- package/dist/schema/PageSnapshot.js +12 -0
- package/dist/schema/Section.d.ts +71 -0
- package/dist/schema/Section.js +35 -0
- package/dist/schema/Seo.d.ts +13 -0
- package/dist/schema/Seo.js +25 -0
- package/dist/schema/Site.d.ts +40 -0
- package/dist/schema/Site.js +87 -0
- package/dist/schema/SiteModel.d.ts +5 -0
- package/dist/schema/SiteModel.js +10 -0
- package/dist/schema/Tag.d.ts +28 -0
- package/dist/schema/Tag.js +59 -0
- package/dist/schema/TagGroup.d.ts +26 -0
- package/dist/schema/TagGroup.js +64 -0
- package/dist/schema/field/Field.d.ts +179 -0
- package/dist/schema/field/Field.js +309 -0
- package/dist/schema/field/base/AssetField.d.ts +148 -0
- package/dist/schema/field/base/AssetField.js +206 -0
- package/dist/schema/field/base/BooleanField.d.ts +21 -0
- package/dist/schema/field/base/BooleanField.js +38 -0
- package/dist/schema/field/base/CollectionField.d.ts +34 -0
- package/dist/schema/field/base/CollectionField.js +85 -0
- package/dist/schema/field/base/DateField.d.ts +21 -0
- package/dist/schema/field/base/DateField.js +37 -0
- package/dist/schema/field/base/DynamicPagesField.d.ts +36 -0
- package/dist/schema/field/base/DynamicPagesField.js +50 -0
- package/dist/schema/field/base/EmbeddedVideoField.d.ts +45 -0
- package/dist/schema/field/base/EmbeddedVideoField.js +176 -0
- package/dist/schema/field/base/EnumField.d.ts +40 -0
- package/dist/schema/field/base/EnumField.js +131 -0
- package/dist/schema/field/base/FormField.d.ts +25 -0
- package/dist/schema/field/base/FormField.js +48 -0
- package/dist/schema/field/base/LinkField.d.ts +103 -0
- package/dist/schema/field/base/LinkField.js +201 -0
- package/dist/schema/field/base/PageField.d.ts +46 -0
- package/dist/schema/field/base/PageField.js +83 -0
- package/dist/schema/field/base/RichTextField.d.ts +71 -0
- package/dist/schema/field/base/RichTextField.js +196 -0
- package/dist/schema/field/base/TextField.d.ts +33 -0
- package/dist/schema/field/base/TextField.js +86 -0
- package/dist/schema/field/base/TimestampField.d.ts +25 -0
- package/dist/schema/field/base/TimestampField.js +41 -0
- package/dist/schema/field/base/index.d.ts +13 -0
- package/dist/schema/field/base/index.js +29 -0
- package/dist/schema/field/composite/ListField.d.ts +47 -0
- package/dist/schema/field/composite/ListField.js +107 -0
- package/dist/schema/field/composite/ObjectField.d.ts +56 -0
- package/dist/schema/field/composite/ObjectField.js +19 -0
- package/dist/schema/field/composite/index.d.ts +2 -0
- package/dist/schema/field/composite/index.js +18 -0
- package/dist/schema/field/index.d.ts +3 -0
- package/dist/schema/field/index.js +19 -0
- package/dist/schema/index.d.ts +25 -0
- package/dist/schema/index.js +41 -0
- package/dist/services/EventBus.d.ts +17 -0
- package/dist/services/EventBus.js +37 -0
- package/dist/services/humanVerification/IHumanVerification.d.ts +8 -0
- package/dist/services/humanVerification/IHumanVerification.js +2 -0
- package/dist/services/humanVerification/index.d.ts +1 -0
- package/dist/services/humanVerification/index.js +17 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +19 -0
- package/dist/services/leadGen/Contact.d.ts +40 -0
- package/dist/services/leadGen/Contact.js +38 -0
- package/dist/services/leadGen/ILeadGen.d.ts +16 -0
- package/dist/services/leadGen/ILeadGen.js +2 -0
- package/dist/services/leadGen/index.d.ts +2 -0
- package/dist/services/leadGen/index.js +18 -0
- package/dist/types/BoxedValue.d.ts +3 -0
- package/dist/types/BoxedValue.js +2 -0
- package/dist/types/Callback.d.ts +9 -0
- package/dist/types/Callback.js +2 -0
- package/dist/types/DateString.d.ts +35 -0
- package/dist/types/DateString.js +172 -0
- package/dist/types/FilterConditionally.d.ts +3 -0
- package/dist/types/FilterConditionally.js +2 -0
- package/dist/types/MaybeConditionalValue.d.ts +8 -0
- package/dist/types/MaybeConditionalValue.js +12 -0
- package/dist/types/Ordinal.d.ts +17 -0
- package/dist/types/Ordinal.js +38 -0
- package/dist/types/OverridableStringUnion.d.ts +2 -0
- package/dist/types/OverridableStringUnion.js +2 -0
- package/dist/types/PartialBy.d.ts +1 -0
- package/dist/types/PartialBy.js +2 -0
- package/dist/types/PickData.d.ts +6 -0
- package/dist/types/PickData.js +2 -0
- package/dist/types/Provider.d.ts +4 -0
- package/dist/types/Provider.js +2 -0
- package/dist/types/RequiredBy.d.ts +1 -0
- package/dist/types/RequiredBy.js +2 -0
- package/dist/types/Result.d.ts +16 -0
- package/dist/types/Result.js +2 -0
- package/dist/types/Timestamp.d.ts +17 -0
- package/dist/types/Timestamp.js +57 -0
- package/dist/types/Transform.d.ts +4 -0
- package/dist/types/Transform.js +2 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +30 -0
- package/dist/ui/Accessible.d.ts +5 -0
- package/dist/ui/Accessible.js +15 -0
- package/dist/ui/BlockThemes.d.ts +19 -0
- package/dist/ui/BlockThemes.js +29 -0
- package/dist/ui/ColorMode.d.ts +12 -0
- package/dist/ui/ColorMode.js +49 -0
- package/dist/ui/File.d.ts +43 -0
- package/dist/ui/File.js +55 -0
- package/dist/ui/FileType.d.ts +8 -0
- package/dist/ui/FileType.js +48 -0
- package/dist/ui/ImageSource.d.ts +12 -0
- package/dist/ui/ImageSource.js +48 -0
- package/dist/ui/MimeType.d.ts +28 -0
- package/dist/ui/MimeType.js +110 -0
- package/dist/ui/Placement.d.ts +21 -0
- package/dist/ui/Placement.js +135 -0
- package/dist/ui/Position.d.ts +6 -0
- package/dist/ui/Position.js +42 -0
- package/dist/ui/Selector.d.ts +6 -0
- package/dist/ui/Selector.js +23 -0
- package/dist/ui/SemanticColor.d.ts +8 -0
- package/dist/ui/SemanticColor.js +237 -0
- package/dist/ui/Visual.d.ts +24 -0
- package/dist/ui/Visual.js +66 -0
- package/dist/ui/block-layout/BlockLayout.d.ts +99 -0
- package/dist/ui/block-layout/BlockLayout.js +286 -0
- package/dist/ui/block-layout/index.d.ts +1 -0
- package/dist/ui/block-layout/index.js +17 -0
- package/dist/ui/browser/BlurHasher.d.ts +13 -0
- package/dist/ui/browser/BlurHasher.js +76 -0
- package/dist/ui/browser/Browser.d.ts +107 -0
- package/dist/ui/browser/Browser.js +313 -0
- package/dist/ui/browser/ImageProxy.d.ts +30 -0
- package/dist/ui/browser/ImageProxy.js +132 -0
- package/dist/ui/browser/InputEvent.d.ts +13 -0
- package/dist/ui/browser/InputEvent.js +2 -0
- package/dist/ui/browser/SVGProxy.d.ts +9 -0
- package/dist/ui/browser/SVGProxy.js +59 -0
- package/dist/ui/browser/VideoProxy.d.ts +42 -0
- package/dist/ui/browser/VideoProxy.js +235 -0
- package/dist/ui/browser/index.d.ts +6 -0
- package/dist/ui/browser/index.js +22 -0
- package/dist/ui/fields/Field.d.ts +80 -0
- package/dist/ui/fields/Field.js +298 -0
- package/dist/ui/fields/FieldList.d.ts +80 -0
- package/dist/ui/fields/FieldList.js +421 -0
- package/dist/ui/fields/FieldListValidator.d.ts +9 -0
- package/dist/ui/fields/FieldListValidator.js +37 -0
- package/dist/ui/fields/FieldModel.d.ts +15 -0
- package/dist/ui/fields/FieldModel.js +28 -0
- package/dist/ui/fields/FieldSerializer.d.ts +13 -0
- package/dist/ui/fields/FieldSerializer.js +71 -0
- package/dist/ui/fields/FieldValidator.d.ts +19 -0
- package/dist/ui/fields/FieldValidator.js +98 -0
- package/dist/ui/fields/ObjectField.d.ts +75 -0
- package/dist/ui/fields/ObjectField.js +288 -0
- package/dist/ui/fields/errors.json +44 -0
- package/dist/ui/fields/index.d.ts +7 -0
- package/dist/ui/fields/index.js +23 -0
- package/dist/ui/fields/validators/AssetValidator.d.ts +9 -0
- package/dist/ui/fields/validators/AssetValidator.js +25 -0
- package/dist/ui/fields/validators/DateValidator.d.ts +9 -0
- package/dist/ui/fields/validators/DateValidator.js +41 -0
- package/dist/ui/fields/validators/EnumValidator.d.ts +10 -0
- package/dist/ui/fields/validators/EnumValidator.js +77 -0
- package/dist/ui/fields/validators/GenericValidator.d.ts +6 -0
- package/dist/ui/fields/validators/GenericValidator.js +22 -0
- package/dist/ui/fields/validators/LinkValidator.d.ts +9 -0
- package/dist/ui/fields/validators/LinkValidator.js +146 -0
- package/dist/ui/fields/validators/RichTextValidator.d.ts +6 -0
- package/dist/ui/fields/validators/RichTextValidator.js +35 -0
- package/dist/ui/fields/validators/TextValidator.d.ts +10 -0
- package/dist/ui/fields/validators/TextValidator.js +138 -0
- package/dist/ui/fields/validators/TimestampValidator.d.ts +9 -0
- package/dist/ui/fields/validators/TimestampValidator.js +41 -0
- package/dist/ui/fields/validators/ValidatorHelper.d.ts +23 -0
- package/dist/ui/fields/validators/ValidatorHelper.js +55 -0
- package/dist/ui/fields/validators/index.d.ts +8 -0
- package/dist/ui/fields/validators/index.js +24 -0
- package/dist/ui/geometry/AspectRatio.d.ts +27 -0
- package/dist/ui/geometry/AspectRatio.js +77 -0
- package/dist/ui/geometry/Bounds.d.ts +4 -0
- package/dist/ui/geometry/Bounds.js +11 -0
- package/dist/ui/geometry/Frame.d.ts +3 -0
- package/dist/ui/geometry/Frame.js +2 -0
- package/dist/ui/geometry/Insets.d.ts +14 -0
- package/dist/ui/geometry/Insets.js +14 -0
- package/dist/ui/geometry/PixelSize.d.ts +1 -0
- package/dist/ui/geometry/PixelSize.js +2 -0
- package/dist/ui/geometry/Point.d.ts +7 -0
- package/dist/ui/geometry/Point.js +15 -0
- package/dist/ui/geometry/Rect.d.ts +19 -0
- package/dist/ui/geometry/Rect.js +68 -0
- package/dist/ui/geometry/ScreenSize.d.ts +1 -0
- package/dist/ui/geometry/ScreenSize.js +2 -0
- package/dist/ui/geometry/Size.d.ts +7 -0
- package/dist/ui/geometry/Size.js +9 -0
- package/dist/ui/geometry/index.d.ts +9 -0
- package/dist/ui/geometry/index.js +25 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.js +34 -0
- package/dist/ui/responsive/Breakpoint.d.ts +8 -0
- package/dist/ui/responsive/Breakpoint.js +24 -0
- package/dist/ui/responsive/BreakpointObserver.d.ts +16 -0
- package/dist/ui/responsive/BreakpointObserver.js +104 -0
- package/dist/ui/responsive/Breakpoints.d.ts +5 -0
- package/dist/ui/responsive/Breakpoints.js +15 -0
- package/dist/ui/responsive/ResponsiveValue.d.ts +7 -0
- package/dist/ui/responsive/ResponsiveValue.js +26 -0
- package/dist/ui/responsive/index.d.ts +4 -0
- package/dist/ui/responsive/index.js +20 -0
- package/dist/ui/richtext/LexicalUtils.d.ts +31 -0
- package/dist/ui/richtext/LexicalUtils.js +314 -0
- package/dist/ui/richtext/StyledTextNode.d.ts +33 -0
- package/dist/ui/richtext/StyledTextNode.js +101 -0
- package/dist/ui/richtext/index.d.ts +2 -0
- package/dist/ui/richtext/index.js +18 -0
- package/dist/utils/ArrayUtils.d.ts +17 -0
- package/dist/utils/ArrayUtils.js +66 -0
- package/dist/utils/ByteSize.d.ts +19 -0
- package/dist/utils/ByteSize.js +33 -0
- package/dist/utils/DateUtils.d.ts +15 -0
- package/dist/utils/DateUtils.js +100 -0
- package/dist/utils/Deferral.d.ts +28 -0
- package/dist/utils/Deferral.js +107 -0
- package/dist/utils/Duration.d.ts +7 -0
- package/dist/utils/Duration.js +35 -0
- package/dist/utils/Fn.d.ts +14 -0
- package/dist/utils/Fn.js +52 -0
- package/dist/utils/ObjectUtils.d.ts +89 -0
- package/dist/utils/ObjectUtils.js +159 -0
- package/dist/utils/Random.d.ts +15 -0
- package/dist/utils/Random.js +72 -0
- package/dist/utils/StringUtils.d.ts +10 -0
- package/dist/utils/StringUtils.js +51 -0
- package/dist/utils/UrlUtils.d.ts +22 -0
- package/dist/utils/UrlUtils.js +119 -0
- package/dist/utils/Value.d.ts +23 -0
- package/dist/utils/Value.js +122 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/isDefined.d.ts +1 -0
- package/dist/utils/isDefined.js +6 -0
- package/package.json +64 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.BlockLayout = void 0;
|
|
15
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
16
|
+
const errors_1 = require("../../errors");
|
|
17
|
+
// extension
|
|
18
|
+
var BlockLayout;
|
|
19
|
+
(function (BlockLayout) {
|
|
20
|
+
let List;
|
|
21
|
+
(function (List) {
|
|
22
|
+
let ItemType;
|
|
23
|
+
(function (ItemType) {
|
|
24
|
+
// values
|
|
25
|
+
ItemType.values = ['message', 'message+visual'];
|
|
26
|
+
// helper
|
|
27
|
+
function parse(value, fallback) {
|
|
28
|
+
// return if it's a match
|
|
29
|
+
if (ItemType.values.includes(value)) {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
// or fallback if we have one
|
|
33
|
+
else if (fallback) {
|
|
34
|
+
return fallback;
|
|
35
|
+
}
|
|
36
|
+
// or throw
|
|
37
|
+
else {
|
|
38
|
+
throw new errors_1.ArgumentError(`Invalid BlockLayout.List.ItemType "${value}"`, 'value');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
ItemType.parse = parse;
|
|
42
|
+
})(ItemType = List.ItemType || (List.ItemType = {}));
|
|
43
|
+
})(List = BlockLayout.List || (BlockLayout.List = {}));
|
|
44
|
+
let MobileOrder;
|
|
45
|
+
(function (MobileOrder) {
|
|
46
|
+
// values
|
|
47
|
+
MobileOrder.values = ['first', 'last'];
|
|
48
|
+
// helper
|
|
49
|
+
function parse(value, fallback) {
|
|
50
|
+
// return if it's a match
|
|
51
|
+
if (MobileOrder.values.includes(value)) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
// or fallback if we have one
|
|
55
|
+
else {
|
|
56
|
+
return fallback;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
MobileOrder.parse = parse;
|
|
60
|
+
})(MobileOrder = BlockLayout.MobileOrder || (BlockLayout.MobileOrder = {}));
|
|
61
|
+
let Size;
|
|
62
|
+
(function (Size) {
|
|
63
|
+
// values
|
|
64
|
+
Size.values = ['xs', 'sm', 'md', 'lg', 'full'];
|
|
65
|
+
// helper
|
|
66
|
+
function parse(value, fallback) {
|
|
67
|
+
// return if it's a match
|
|
68
|
+
if (Size.values.includes(value)) {
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
// or fallback if we have one
|
|
72
|
+
else if (fallback) {
|
|
73
|
+
return fallback;
|
|
74
|
+
}
|
|
75
|
+
// or throw
|
|
76
|
+
else {
|
|
77
|
+
throw new errors_1.ArgumentError(`Invalid BlockLayout.Size "${value}"`, 'value');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
Size.parse = parse;
|
|
81
|
+
})(Size = BlockLayout.Size || (BlockLayout.Size = {}));
|
|
82
|
+
let Alignment;
|
|
83
|
+
(function (Alignment) {
|
|
84
|
+
// values
|
|
85
|
+
Alignment.values = ['start', 'center', 'end'];
|
|
86
|
+
// helper
|
|
87
|
+
function parse(value, fallback) {
|
|
88
|
+
// return if it's a match
|
|
89
|
+
if (Alignment.values.includes(value)) {
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
// or fallback if we have one
|
|
93
|
+
else if (fallback) {
|
|
94
|
+
return fallback;
|
|
95
|
+
}
|
|
96
|
+
// or throw
|
|
97
|
+
else {
|
|
98
|
+
throw new errors_1.ArgumentError(`Invalid BlockLayout.Alignment "${value}"`, 'value');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
Alignment.parse = parse;
|
|
102
|
+
})(Alignment = BlockLayout.Alignment || (BlockLayout.Alignment = {}));
|
|
103
|
+
let TextAlignment;
|
|
104
|
+
(function (TextAlignment) {
|
|
105
|
+
// values
|
|
106
|
+
TextAlignment.values = ['left', 'center', 'right'];
|
|
107
|
+
// helper
|
|
108
|
+
function parse(value, fallback) {
|
|
109
|
+
// return if it's a match
|
|
110
|
+
if (TextAlignment.values.includes(value)) {
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
// or fallback if we have one
|
|
114
|
+
else if (fallback) {
|
|
115
|
+
return fallback;
|
|
116
|
+
}
|
|
117
|
+
// or throw
|
|
118
|
+
else {
|
|
119
|
+
throw new errors_1.ArgumentError(`Invalid BlockLayout.TextAlignment "${value}"`, 'value');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
TextAlignment.parse = parse;
|
|
123
|
+
})(TextAlignment = BlockLayout.TextAlignment || (BlockLayout.TextAlignment = {}));
|
|
124
|
+
let AspectRatio;
|
|
125
|
+
(function (AspectRatio) {
|
|
126
|
+
// values
|
|
127
|
+
AspectRatio.values = ['auto', 'square', 'phone', 'tv', 'widescreen', 'cinema'];
|
|
128
|
+
// helper
|
|
129
|
+
function parse(value, fallback) {
|
|
130
|
+
// return if it's a match
|
|
131
|
+
if (AspectRatio.values.includes(value)) {
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
// or fallback if we have one
|
|
135
|
+
else if (fallback) {
|
|
136
|
+
return fallback;
|
|
137
|
+
}
|
|
138
|
+
// or throw
|
|
139
|
+
else {
|
|
140
|
+
throw new errors_1.ArgumentError(`Invalid BlockLayout.AspectRatio "${value}"`, 'value');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
AspectRatio.parse = parse;
|
|
144
|
+
})(AspectRatio = BlockLayout.AspectRatio || (BlockLayout.AspectRatio = {}));
|
|
145
|
+
// parser
|
|
146
|
+
const xmlParser = new fast_xml_parser_1.XMLParser({
|
|
147
|
+
ignoreDeclaration: true,
|
|
148
|
+
ignoreAttributes: false,
|
|
149
|
+
attributeNamePrefix: '',
|
|
150
|
+
preserveOrder: true
|
|
151
|
+
});
|
|
152
|
+
function parse(xml) {
|
|
153
|
+
// parse xml (not sure if this throws on error)
|
|
154
|
+
const blockJson = xmlParser.parse(xml);
|
|
155
|
+
// walk json to create block data
|
|
156
|
+
return parseeBlock(blockJson[0]);
|
|
157
|
+
}
|
|
158
|
+
BlockLayout.parse = parse;
|
|
159
|
+
})(BlockLayout || (exports.BlockLayout = BlockLayout = {}));
|
|
160
|
+
// helpers
|
|
161
|
+
function parseeBlock(json) {
|
|
162
|
+
// parse block
|
|
163
|
+
const block = ParsedElement.parse({ data: json, expectedTags: ['block'], expectedChildren: 1 });
|
|
164
|
+
// return block
|
|
165
|
+
return {
|
|
166
|
+
name: block.attributes['name'],
|
|
167
|
+
root: parseRoot(ParsedElement.parse({ data: block.children[0], expectedTags: ['row', 'col', 'stack'] })),
|
|
168
|
+
fullbleed: block.attributes['fullbleed'] === 'true'
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function parseRoot({ tag, attributes, children }) {
|
|
172
|
+
// parse attributes
|
|
173
|
+
const itemAttributes = parseItemAttributes(attributes);
|
|
174
|
+
// create root
|
|
175
|
+
switch (tag) {
|
|
176
|
+
case 'row':
|
|
177
|
+
return Object.assign(Object.assign({ type: 'row' }, itemAttributes), { items: children.map(data => parseNestedItem(ParsedElement.parse({
|
|
178
|
+
data,
|
|
179
|
+
expectedTags: ParsedElement.tags.filter(t => t !== tag)
|
|
180
|
+
}))) });
|
|
181
|
+
case 'col':
|
|
182
|
+
return Object.assign(Object.assign({ type: 'column' }, itemAttributes), { items: children.map(data => parseNestedItem(ParsedElement.parse({
|
|
183
|
+
data,
|
|
184
|
+
expectedTags: ParsedElement.tags.filter(t => t !== tag)
|
|
185
|
+
}))) });
|
|
186
|
+
case 'stack':
|
|
187
|
+
return Object.assign(Object.assign({ type: 'stack' }, itemAttributes), { items: children.map(data => parseNestedItem(ParsedElement.parse({
|
|
188
|
+
data,
|
|
189
|
+
expectedTags: ParsedElement.tags.filter(t => t !== tag)
|
|
190
|
+
}))) });
|
|
191
|
+
default:
|
|
192
|
+
throw new errors_1.ArgumentError(`Invalid XML BlockLayout root encountered "${tag}" where instead of "row" or "col"`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function parseNestedItem({ tag, attributes, children }) {
|
|
196
|
+
// parse attributes
|
|
197
|
+
const _a = parseItemAttributes(attributes), { size } = _a, itemAttributes = __rest(_a, ["size"]);
|
|
198
|
+
// create container
|
|
199
|
+
switch (tag) {
|
|
200
|
+
case 'row':
|
|
201
|
+
case 'col':
|
|
202
|
+
case 'stack':
|
|
203
|
+
return Object.assign(Object.assign({ type: tag === 'col' ? 'column' : tag }, itemAttributes), { items: children.map(data => parsePanel(Object.assign({}, ParsedElement.parse({
|
|
204
|
+
data,
|
|
205
|
+
expectedTags: ParsedElement.tags.filter(t => t !== 'row' && t !== 'col')
|
|
206
|
+
})))) });
|
|
207
|
+
default:
|
|
208
|
+
return parsePanel({ tag, attributes, children });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function parsePanel({ tag, attributes }) {
|
|
212
|
+
var _a;
|
|
213
|
+
const key = (_a = attributes['key']) !== null && _a !== void 0 ? _a : tag;
|
|
214
|
+
const itemAttributes = parseItemAttributes(attributes);
|
|
215
|
+
switch (tag) {
|
|
216
|
+
case 'message':
|
|
217
|
+
return Object.assign(Object.assign({ type: 'message', key }, itemAttributes), { textAlign: BlockLayout.TextAlignment.parse(attributes['textAlign'], 'left') });
|
|
218
|
+
case 'visual':
|
|
219
|
+
return Object.assign(Object.assign({ type: 'visual', key }, itemAttributes), { aspectRatio: BlockLayout.AspectRatio.parse(attributes['aspect'], 'auto') });
|
|
220
|
+
case 'list':
|
|
221
|
+
return Object.assign(Object.assign({ type: 'list', key }, itemAttributes), { itemType: BlockLayout.List.ItemType.parse(attributes['itemType'], 'message+visual') });
|
|
222
|
+
default:
|
|
223
|
+
throw new errors_1.ArgumentError(`Invalid XML BlockLayout - encountered "${tag}" where instead of BlockLayout.Panel`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function parseItemAttributes(attributes) {
|
|
227
|
+
return {
|
|
228
|
+
mobileOrder: BlockLayout.MobileOrder.parse(attributes['mobileOrder']),
|
|
229
|
+
size: BlockLayout.Size.parse(attributes['size'], 'full'),
|
|
230
|
+
alignX: BlockLayout.Alignment.parse(attributes['alignX'], 'start'),
|
|
231
|
+
alignY: BlockLayout.Alignment.parse(attributes['alignY'], 'start')
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
var ParsedElement;
|
|
235
|
+
(function (ParsedElement) {
|
|
236
|
+
// tags
|
|
237
|
+
ParsedElement.tags = [
|
|
238
|
+
'block', 'row', 'col', 'stack',
|
|
239
|
+
'message', 'visual', 'list'
|
|
240
|
+
];
|
|
241
|
+
function parse({ data, expectedTags: expectedTagsRaw, expectedChildren }) {
|
|
242
|
+
var _a;
|
|
243
|
+
// normalize tags (or use all)
|
|
244
|
+
const expectedTags = expectedTagsRaw && expectedTagsRaw.length > 0
|
|
245
|
+
? expectedTagsRaw
|
|
246
|
+
: ParsedElement.tags;
|
|
247
|
+
// look for a specific tag
|
|
248
|
+
let tag = undefined;
|
|
249
|
+
let children = undefined;
|
|
250
|
+
for (const expectedTag of expectedTags) {
|
|
251
|
+
// stop if tag matches
|
|
252
|
+
if (expectedTag in data) {
|
|
253
|
+
// capture tag / children
|
|
254
|
+
tag = expectedTag;
|
|
255
|
+
children = data[tag];
|
|
256
|
+
// stop processing
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// throw if there's no tag/children
|
|
261
|
+
if (!tag || !children || !Array.isArray(children)) {
|
|
262
|
+
throw new errors_1.ArgumentError(`Block XML missing expected elements: [${expectedTags.join(', ')}]`);
|
|
263
|
+
}
|
|
264
|
+
// or throw if there are children when there shouldn't be
|
|
265
|
+
else if (expectedChildren === false && children.length !== 0) {
|
|
266
|
+
throw new errors_1.ArgumentError(`Block XML found children at "${tag}" but expected none`);
|
|
267
|
+
}
|
|
268
|
+
// or throw if count doesn't match
|
|
269
|
+
else if (expectedChildren && children.length !== expectedChildren) {
|
|
270
|
+
throw new errors_1.ArgumentError(`Block XML expected ${expectedChildren} children at "${tag}" but found ${children.length}`);
|
|
271
|
+
}
|
|
272
|
+
// return parsed block
|
|
273
|
+
return {
|
|
274
|
+
tag,
|
|
275
|
+
attributes: Object.entries((_a = data[':@']) !== null && _a !== void 0 ? _a : {})
|
|
276
|
+
.reduce((attributes, [key, value]) => {
|
|
277
|
+
// map
|
|
278
|
+
attributes[key] = value;
|
|
279
|
+
// keep reducing
|
|
280
|
+
return attributes;
|
|
281
|
+
}, {}),
|
|
282
|
+
children
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
ParsedElement.parse = parse;
|
|
286
|
+
})(ParsedElement || (ParsedElement = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BlockLayout';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BlockLayout"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare namespace BlurHasher {
|
|
2
|
+
type CreateHashOptions = {
|
|
3
|
+
sourceSize?: number;
|
|
4
|
+
blurSize?: number;
|
|
5
|
+
};
|
|
6
|
+
function createHash(target: HTMLImageElement | HTMLVideoElement, { sourceSize, blurSize }?: CreateHashOptions): string | undefined;
|
|
7
|
+
type RenderArgs = {
|
|
8
|
+
canvas: HTMLCanvasElement;
|
|
9
|
+
blurHash: string;
|
|
10
|
+
blurSize?: number;
|
|
11
|
+
};
|
|
12
|
+
function render({ canvas, blurHash, blurSize }: RenderArgs): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.BlurHasher = void 0;
|
|
37
|
+
const BlurHash = __importStar(require("blurhash"));
|
|
38
|
+
var BlurHasher;
|
|
39
|
+
(function (BlurHasher) {
|
|
40
|
+
function createHash(target, { sourceSize = 64, blurSize = 4 } = {}) {
|
|
41
|
+
// determine scaled sizing
|
|
42
|
+
const targetSize = target instanceof Image
|
|
43
|
+
? { width: target.naturalWidth, height: target.naturalHeight }
|
|
44
|
+
: { width: target.videoWidth, height: target.videoHeight };
|
|
45
|
+
const ratio = Math.min(sourceSize / targetSize.width, sourceSize / targetSize.height);
|
|
46
|
+
const scaledWidth = Math.round(targetSize.width * ratio);
|
|
47
|
+
const scaledHeight = Math.round(targetSize.height * ratio);
|
|
48
|
+
// create/configure canvas
|
|
49
|
+
const canvas = new OffscreenCanvas(scaledWidth, scaledHeight);
|
|
50
|
+
// draw on canvas (and clear it)
|
|
51
|
+
const canvasContext = canvas.getContext('2d');
|
|
52
|
+
canvasContext === null || canvasContext === void 0 ? void 0 : canvasContext.drawImage(target, 0, 0, scaledWidth, scaledHeight);
|
|
53
|
+
const imageData = canvasContext === null || canvasContext === void 0 ? void 0 : canvasContext.getImageData(0, 0, scaledWidth, scaledHeight);
|
|
54
|
+
// skip if there's no image data
|
|
55
|
+
if (!imageData) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
// create hash
|
|
59
|
+
return BlurHash.encode(imageData.data, scaledWidth, scaledHeight, blurSize, blurSize);
|
|
60
|
+
}
|
|
61
|
+
BlurHasher.createHash = createHash;
|
|
62
|
+
function render({ canvas, blurHash, blurSize = 32 }) {
|
|
63
|
+
// extract pixels
|
|
64
|
+
const pixels = BlurHash.decode(blurHash, blurSize, blurSize);
|
|
65
|
+
// create context (or fail)
|
|
66
|
+
const canvasContext = canvas.getContext('2d');
|
|
67
|
+
if (!canvasContext) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// render to canvas
|
|
71
|
+
const imageData = canvasContext === null || canvasContext === void 0 ? void 0 : canvasContext.createImageData(canvas.width, canvas.height);
|
|
72
|
+
imageData.data.set(pixels);
|
|
73
|
+
canvasContext.putImageData(imageData, 0, 0);
|
|
74
|
+
}
|
|
75
|
+
BlurHasher.render = render;
|
|
76
|
+
})(BlurHasher || (exports.BlurHasher = BlurHasher = {}));
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Callback } from '../../types';
|
|
2
|
+
import { Rect } from '../geometry';
|
|
3
|
+
/**
|
|
4
|
+
* A collection of helper methods for manipulating client-side DOM and web browser APIs.
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace Browser {
|
|
7
|
+
/**
|
|
8
|
+
* Returns `true` if running within the actual browser and have access to HTML DOM and window object.
|
|
9
|
+
*/
|
|
10
|
+
const available: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Returns `window` object if browser is available, or `undefined` otherwise.
|
|
13
|
+
*/
|
|
14
|
+
const window: (Window & typeof globalThis) | undefined;
|
|
15
|
+
function getHtml(): HTMLElement | undefined;
|
|
16
|
+
function escapeCss(css: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Provides preset HTML element selectors for various purposes.
|
|
19
|
+
*/
|
|
20
|
+
namespace Element {
|
|
21
|
+
const tabbable: readonly ["a[href]:not([tabindex^=\"-\"])", "area[href]:not([tabindex^=\"-\"])", "input:not([type=\"hidden\"]):not([type=\"radio\"]):not([disabled]):not([tabindex^=\"-\"])", "input[type=\"radio\"]:not([disabled]):not([tabindex^=\"-\"])", "select:not([disabled]):not([tabindex^=\"-\"])", "textarea:not([disabled]):not([tabindex^=\"-\"])", "button:not([disabled]):not([tabindex^=\"-\"])", "iframe:not([tabindex^=\"-\"])", "audio[controls]:not([tabindex^=\"-\"])", "video[controls]:not([tabindex^=\"-\"])", "[contenteditable]:not([tabindex^=\"-\"])", "[tabindex]:not([tabindex^=\"-\"])"];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Scrolls to top of windows.
|
|
25
|
+
*/
|
|
26
|
+
function scrollToTop(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Locks top-level browser window scrolling.
|
|
29
|
+
*
|
|
30
|
+
* @param enabled disables scrolling if `true`, restores it otherwise
|
|
31
|
+
*/
|
|
32
|
+
function setScrollEnabled(enabled: boolean): void;
|
|
33
|
+
type ElementTarget = HTMLElement | string;
|
|
34
|
+
type ElementsTarget = ElementTarget | ReadonlyArray<HTMLElement> | ReadonlyArray<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the actual HTML elements for the given selectors (pass-thru if inputs are already resolved)
|
|
37
|
+
*
|
|
38
|
+
* @param targets the selector or selectors to use - if actual `Element` instances are passed in they are returned as is
|
|
39
|
+
* @param container the root element where the search should be anchored, otherwise the `window.document` is used
|
|
40
|
+
*/
|
|
41
|
+
function getElements(targets: ElementsTarget, container?: Document | HTMLElement): HTMLElement[];
|
|
42
|
+
/**
|
|
43
|
+
* Resolves an actual HTML element for a given selector (pass-thru if input is already resolved)
|
|
44
|
+
*
|
|
45
|
+
* @param target the selector to use - if an actual `Element` instance is passed, it is returned directly
|
|
46
|
+
* @param container the root element where the search should be anchored, otherwise the `window.document` is used
|
|
47
|
+
*/
|
|
48
|
+
function getElement(target: ElementTarget | undefined, container?: Document | HTMLElement): HTMLElement | undefined;
|
|
49
|
+
type GetElementRectOptions = {
|
|
50
|
+
absolute?: boolean;
|
|
51
|
+
};
|
|
52
|
+
function getElementRect(element: Rect | Element | string | null | undefined, { absolute }?: GetElementRectOptions): Rect | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* A helper method used to select a set of HTML DOM elements and make temporary modifications that can be later
|
|
55
|
+
* rolled back via the returned `restore()` method.
|
|
56
|
+
*
|
|
57
|
+
* @param container an optional container used to scope the target selectors, otherwise the `window.document` is used
|
|
58
|
+
* @param targets a set of elements or selectors that are the scope of modification
|
|
59
|
+
* @param restoreKey a key that if provided will persist the restore snapshot into the DOM element via a `dataset` tag
|
|
60
|
+
* @param onModify the callback where modification should be made
|
|
61
|
+
*/
|
|
62
|
+
function modifyElements({ container, targets, restoreKey, onModify }: modifyElements.Args): modifyElements.Restore;
|
|
63
|
+
namespace modifyElements {
|
|
64
|
+
type Args = {
|
|
65
|
+
container?: HTMLElement;
|
|
66
|
+
targets: ElementsTarget;
|
|
67
|
+
restoreKey?: string;
|
|
68
|
+
onModify: Callback<ElementModifier[]>;
|
|
69
|
+
};
|
|
70
|
+
type Restore = Callback.Void;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Locks all interactive browser elements from tab focus that are outside of the `target` scope (if provided).
|
|
74
|
+
* @param target The target (and its children) that should not be locked.
|
|
75
|
+
* @return An `unlock` callback that restores tab focus for the previously locked elements.
|
|
76
|
+
*/
|
|
77
|
+
function lockFocus(target?: ElementTarget): Callback.Void;
|
|
78
|
+
/**
|
|
79
|
+
* A proxy used to manipulate an HTML DOM element. This class provides a way to rollback changes and even
|
|
80
|
+
* persist the rollback snapshot directly in the DOM itself (via the `restoreKey`).
|
|
81
|
+
*/
|
|
82
|
+
class ElementModifier {
|
|
83
|
+
readonly element: HTMLElement;
|
|
84
|
+
private readonly _restoreKey?;
|
|
85
|
+
private readonly _originalAttributes;
|
|
86
|
+
constructor(element: HTMLElement, _restoreKey?: string | undefined);
|
|
87
|
+
/**
|
|
88
|
+
* Sets an attribute on the underlying HTMLElement.
|
|
89
|
+
* @param name the name of the attribute being set
|
|
90
|
+
* @param value the attribute value
|
|
91
|
+
*/
|
|
92
|
+
setAttribute(name: string, value: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Removes an attribute from the underlying HTMLElement.
|
|
95
|
+
* @param name the name of the attribute being removed
|
|
96
|
+
*/
|
|
97
|
+
deleteAttribute(name: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* Saves a snapshot of the pre-modified instance to the `Element`, but *only if* the `restoreKey` was specified.
|
|
100
|
+
*/
|
|
101
|
+
snapshot(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Restores the underlying element to its pre-modification state, clearing any snapshot data.
|
|
104
|
+
*/
|
|
105
|
+
restore(): void;
|
|
106
|
+
}
|
|
107
|
+
}
|