@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,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Placement = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Placement;
|
|
6
|
+
(function (Placement) {
|
|
7
|
+
function getComponents(placement) {
|
|
8
|
+
var _a;
|
|
9
|
+
// parse
|
|
10
|
+
const [side, anchor] = placement.split('-');
|
|
11
|
+
// convert/return
|
|
12
|
+
return {
|
|
13
|
+
side: side,
|
|
14
|
+
anchor: (_a = anchor) !== null && _a !== void 0 ? _a : undefined
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
Placement.getComponents = getComponents;
|
|
18
|
+
function forContent({ containerRect, containerPadding = 0, anchorRect, anchorOffset = 0, placement, contentSize }) {
|
|
19
|
+
const containerInsets = typeof containerPadding === 'number'
|
|
20
|
+
? { left: containerPadding, right: containerPadding, top: containerPadding, bottom: containerPadding }
|
|
21
|
+
: containerPadding;
|
|
22
|
+
// horizontal layout if left/right
|
|
23
|
+
const { width: contentWidth, height: contentHeight } = contentSize;
|
|
24
|
+
const { side: anchorSide, anchor: anchorPlacement } = getComponents(placement);
|
|
25
|
+
const popupFrame = {};
|
|
26
|
+
if (anchorSide === 'left' || anchorSide === 'right') {
|
|
27
|
+
// determine space to left/right
|
|
28
|
+
const spaceLeft = Math.max(0, anchorRect.left - containerRect.left - anchorOffset - containerInsets.left);
|
|
29
|
+
const spaceRight = Math.max(0, containerRect.right - anchorRect.right - anchorOffset - containerInsets.right);
|
|
30
|
+
// place left if it fits or if it fits better than on the right
|
|
31
|
+
if ((anchorSide === 'left' && (spaceLeft >= contentWidth || spaceLeft > spaceRight))
|
|
32
|
+
|| (anchorSide === 'right' && spaceRight < contentWidth && spaceRight < spaceLeft)) {
|
|
33
|
+
// force over anchor if there's no room
|
|
34
|
+
if (spaceLeft < contentWidth) {
|
|
35
|
+
popupFrame.left = containerRect.left + containerInsets.left;
|
|
36
|
+
popupFrame.right = Math.min(popupFrame.left + contentWidth, containerRect.right - containerInsets.right);
|
|
37
|
+
}
|
|
38
|
+
// or squeeze left
|
|
39
|
+
else {
|
|
40
|
+
popupFrame.right = containerRect.right - anchorRect.left + anchorOffset;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// or place right
|
|
44
|
+
else {
|
|
45
|
+
// force over anchor if there's no room
|
|
46
|
+
if (spaceRight < contentWidth) {
|
|
47
|
+
popupFrame.right = containerRect.right - containerInsets.right;
|
|
48
|
+
popupFrame.left = Math.max(popupFrame.right - contentWidth, containerRect.left + containerInsets.left);
|
|
49
|
+
}
|
|
50
|
+
// or squeeze right
|
|
51
|
+
else {
|
|
52
|
+
popupFrame.left = anchorRect.right + anchorOffset;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// top-align on start
|
|
56
|
+
if (anchorPlacement === 'start') {
|
|
57
|
+
popupFrame.top = anchorRect.top + containerInsets.top;
|
|
58
|
+
}
|
|
59
|
+
// bottom-align on end
|
|
60
|
+
else if (anchorPlacement === 'end') {
|
|
61
|
+
popupFrame.bottom = containerRect.bottom - containerInsets.bottom;
|
|
62
|
+
}
|
|
63
|
+
// match height
|
|
64
|
+
else if (anchorPlacement === 'match') {
|
|
65
|
+
popupFrame.top = anchorRect.top + containerInsets.top;
|
|
66
|
+
popupFrame.height = anchorRect.height;
|
|
67
|
+
}
|
|
68
|
+
// or center against anchor
|
|
69
|
+
else {
|
|
70
|
+
// set top bounds so it's centered
|
|
71
|
+
popupFrame.top = Math.max(anchorRect.top + (anchorRect.height - contentHeight) / 2, containerRect.top + containerInsets.top);
|
|
72
|
+
// offset if the bottom is bleeding over
|
|
73
|
+
if (popupFrame.top + contentHeight > containerRect.bottom + containerInsets.bottom) {
|
|
74
|
+
popupFrame.top -= popupFrame.top + contentHeight - containerRect.bottom - containerInsets.bottom;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// or standard vertical layout
|
|
79
|
+
else {
|
|
80
|
+
// determine space to top/bottom
|
|
81
|
+
const spaceTop = Math.max(0, anchorRect.top - containerRect.top - anchorOffset - containerInsets.top);
|
|
82
|
+
const spaceBottom = Math.max(0, containerRect.bottom - anchorRect.bottom - anchorOffset - containerInsets.bottom);
|
|
83
|
+
// place above if it fits or if it fits better than on the right
|
|
84
|
+
if ((anchorSide === 'top' && (spaceTop >= contentHeight || spaceBottom < spaceTop))
|
|
85
|
+
|| (anchorSide === 'bottom' && spaceBottom < contentHeight && spaceBottom < spaceTop)) {
|
|
86
|
+
// force over anchor if there's no room
|
|
87
|
+
if (spaceTop < contentHeight) {
|
|
88
|
+
popupFrame.top = containerRect.top + containerInsets.top;
|
|
89
|
+
popupFrame.bottom = Math.min(popupFrame.top + contentHeight, containerRect.bottom - containerInsets.bottom);
|
|
90
|
+
}
|
|
91
|
+
// or squeeze above
|
|
92
|
+
else {
|
|
93
|
+
popupFrame.bottom = containerRect.bottom - anchorRect.top + anchorOffset;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// or place below
|
|
97
|
+
else {
|
|
98
|
+
// force over anchor if there's no room
|
|
99
|
+
if (spaceBottom < contentHeight) {
|
|
100
|
+
popupFrame.bottom = containerRect.bottom - containerInsets.bottom;
|
|
101
|
+
popupFrame.top = Math.max(popupFrame.bottom - contentHeight, containerRect.top + containerInsets.top);
|
|
102
|
+
}
|
|
103
|
+
// or squeeze right
|
|
104
|
+
else {
|
|
105
|
+
popupFrame.top = anchorRect.bottom + anchorOffset;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// left-align on start
|
|
109
|
+
if (anchorPlacement === 'start') {
|
|
110
|
+
popupFrame.left = anchorRect.left;
|
|
111
|
+
}
|
|
112
|
+
// right-align on end
|
|
113
|
+
else if (anchorPlacement === 'end') {
|
|
114
|
+
popupFrame.right = containerRect.right - anchorRect.right;
|
|
115
|
+
}
|
|
116
|
+
// match width
|
|
117
|
+
else if (anchorPlacement === 'match') {
|
|
118
|
+
popupFrame.left = anchorRect.left;
|
|
119
|
+
popupFrame.width = anchorRect.width;
|
|
120
|
+
}
|
|
121
|
+
// or center against anchor
|
|
122
|
+
else {
|
|
123
|
+
// set left bounds so it's centered
|
|
124
|
+
popupFrame.left = Math.max(anchorRect.left + (anchorRect.width - contentWidth) / 2, containerRect.left);
|
|
125
|
+
// offset if the right is bleeding over
|
|
126
|
+
if (popupFrame.left + contentWidth > containerRect.right) {
|
|
127
|
+
popupFrame.left -= popupFrame.left + contentWidth - containerRect.right;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// return position insets
|
|
132
|
+
return popupFrame;
|
|
133
|
+
}
|
|
134
|
+
Placement.forContent = forContent;
|
|
135
|
+
})(Placement || (exports.Placement = Placement = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Position = 'center' | 'top-left' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left';
|
|
2
|
+
export declare namespace Position {
|
|
3
|
+
const values: ReadonlyArray<Position>;
|
|
4
|
+
function getName(position: Position): string;
|
|
5
|
+
function getClassName(position?: Position): string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Position = void 0;
|
|
4
|
+
const StringUtils_1 = require("../utils/StringUtils");
|
|
5
|
+
// extension
|
|
6
|
+
var Position;
|
|
7
|
+
(function (Position) {
|
|
8
|
+
// constants
|
|
9
|
+
Position.values = [
|
|
10
|
+
'center', 'top-left', 'top', 'top-right', 'right', 'bottom-right', 'bottom', 'bottom-left', 'left'
|
|
11
|
+
];
|
|
12
|
+
// helpers
|
|
13
|
+
function getName(position) {
|
|
14
|
+
return StringUtils_1.StringUtils.capitalize(position);
|
|
15
|
+
}
|
|
16
|
+
Position.getName = getName;
|
|
17
|
+
function getClassName(position) {
|
|
18
|
+
switch (position) {
|
|
19
|
+
case 'top-left':
|
|
20
|
+
return 'object-left-top';
|
|
21
|
+
case 'top':
|
|
22
|
+
return 'object-top';
|
|
23
|
+
case 'top-right':
|
|
24
|
+
return 'object-right-top';
|
|
25
|
+
case 'right':
|
|
26
|
+
return 'object-right';
|
|
27
|
+
case 'bottom-right':
|
|
28
|
+
return 'object-right-bottom';
|
|
29
|
+
case 'bottom':
|
|
30
|
+
return 'object-bottom';
|
|
31
|
+
case 'bottom-left':
|
|
32
|
+
return 'object-left-bottom';
|
|
33
|
+
case 'left':
|
|
34
|
+
return 'object-left';
|
|
35
|
+
case 'center':
|
|
36
|
+
return 'object-center';
|
|
37
|
+
default:
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
Position.getClassName = getClassName;
|
|
42
|
+
})(Position || (exports.Position = Position = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Selector = void 0;
|
|
4
|
+
var Selector;
|
|
5
|
+
(function (Selector) {
|
|
6
|
+
/**
|
|
7
|
+
* Matches all tabbable elements whose `tabIndex` is still in play.
|
|
8
|
+
*/
|
|
9
|
+
Selector.tabbable = [
|
|
10
|
+
'a[href]:not([tabindex^="-"])',
|
|
11
|
+
'area[href]:not([tabindex^="-"])',
|
|
12
|
+
'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])',
|
|
13
|
+
'input[type="radio"]:not([disabled]):not([tabindex^="-"])',
|
|
14
|
+
'select:not([disabled]):not([tabindex^="-"])',
|
|
15
|
+
'textarea:not([disabled]):not([tabindex^="-"])',
|
|
16
|
+
'button:not([disabled]):not([tabindex^="-"])',
|
|
17
|
+
'iframe:not([tabindex^="-"])',
|
|
18
|
+
'audio[controls]:not([tabindex^="-"])',
|
|
19
|
+
'video[controls]:not([tabindex^="-"])',
|
|
20
|
+
'[contenteditable]:not([tabindex^="-"])',
|
|
21
|
+
'[tabindex]:not([tabindex^="-"])'
|
|
22
|
+
];
|
|
23
|
+
})(Selector || (exports.Selector = Selector = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type SemanticColor = 'background' | 'onBackground' | 'onBackgroundVariant' | 'surface' | 'surfaceVariant' | 'surface1' | 'surface2' | 'surface3' | 'surface4' | 'onSurface' | 'onSurfaceVariant' | 'outline' | 'outlineVariant' | 'error' | 'errorOverlay' | 'onError' | 'errorContainer' | 'onErrorContainer' | 'success' | 'onSuccess' | 'successContainer' | 'onSuccessContainer';
|
|
2
|
+
export declare namespace SemanticColor {
|
|
3
|
+
const values: ReadonlyArray<SemanticColor>;
|
|
4
|
+
function forText(color?: SemanticColor): "text-background" | "text-onBackground" | "text-onBackgroundVariant" | "text-surface" | "text-surfaceVariant" | "text-surface1" | "text-surface2" | "text-surface3" | "text-surface4" | "text-onSurface" | "text-onSurfaceVariant" | "text-outline" | "text-outlineVariant" | "text-error" | "text-errorOverlay" | "text-onError" | "text-errorContainer" | "text-onErrorContainer" | "text-success" | "text-onSuccess" | "text-successContainer" | "text-onSuccessContainer" | "text-inherit";
|
|
5
|
+
function forBg(color?: SemanticColor): "bg-background" | "bg-onBackground" | "bg-onBackgroundVariant" | "bg-surface" | "bg-surfaceVariant" | "bg-surface1" | "bg-surface2" | "bg-surface3" | "bg-surface4" | "bg-onSurface" | "bg-onSurfaceVariant" | "bg-outline" | "bg-outlineVariant" | "bg-error" | "bg-errorOverlay" | "bg-onError" | "bg-errorContainer" | "bg-onErrorContainer" | "bg-success" | "bg-onSuccess" | "bg-successContainer" | "bg-onSuccessContainer" | "bg-inherit";
|
|
6
|
+
function forStroke(color?: SemanticColor): "stroke-background" | "stroke-onBackground" | "stroke-onBackgroundVariant" | "stroke-surface" | "stroke-surfaceVariant" | "stroke-surface1" | "stroke-surface2" | "stroke-surface3" | "stroke-surface4" | "stroke-onSurface" | "stroke-onSurfaceVariant" | "stroke-outline" | "stroke-outlineVariant" | "stroke-error" | "stroke-errorOverlay" | "stroke-onError" | "stroke-errorContainer" | "stroke-onErrorContainer" | "stroke-success" | "stroke-onSuccess" | "stroke-successContainer" | "stroke-onSuccessContainer" | "stroke-inherit";
|
|
7
|
+
function forFill(color?: SemanticColor): "fill-background" | "fill-onBackground" | "fill-onBackgroundVariant" | "fill-surface" | "fill-surfaceVariant" | "fill-surface1" | "fill-surface2" | "fill-surface3" | "fill-surface4" | "fill-onSurface" | "fill-onSurfaceVariant" | "fill-outline" | "fill-outlineVariant" | "fill-error" | "fill-errorOverlay" | "fill-onError" | "fill-errorContainer" | "fill-onErrorContainer" | "fill-success" | "fill-onSuccess" | "fill-successContainer" | "fill-onSuccessContainer" | "fill-inherit";
|
|
8
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SemanticColor = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var SemanticColor;
|
|
6
|
+
(function (SemanticColor) {
|
|
7
|
+
// constants
|
|
8
|
+
SemanticColor.values = [
|
|
9
|
+
'background',
|
|
10
|
+
'onBackground',
|
|
11
|
+
'onBackgroundVariant',
|
|
12
|
+
'surface',
|
|
13
|
+
'surfaceVariant',
|
|
14
|
+
'surface1',
|
|
15
|
+
'surface2',
|
|
16
|
+
'surface3',
|
|
17
|
+
'surface4',
|
|
18
|
+
'onSurface',
|
|
19
|
+
'onSurfaceVariant',
|
|
20
|
+
'outline',
|
|
21
|
+
'outlineVariant',
|
|
22
|
+
'error',
|
|
23
|
+
'errorOverlay',
|
|
24
|
+
'onError',
|
|
25
|
+
'errorContainer',
|
|
26
|
+
'onErrorContainer',
|
|
27
|
+
'success',
|
|
28
|
+
'onSuccess',
|
|
29
|
+
'successContainer',
|
|
30
|
+
'onSuccessContainer'
|
|
31
|
+
];
|
|
32
|
+
// helpers
|
|
33
|
+
function forText(color) {
|
|
34
|
+
switch (color) {
|
|
35
|
+
case 'background':
|
|
36
|
+
return 'text-background';
|
|
37
|
+
case 'onBackground':
|
|
38
|
+
return 'text-onBackground';
|
|
39
|
+
case 'onBackgroundVariant':
|
|
40
|
+
return 'text-onBackgroundVariant';
|
|
41
|
+
case 'surface':
|
|
42
|
+
return 'text-surface';
|
|
43
|
+
case 'surfaceVariant':
|
|
44
|
+
return 'text-surfaceVariant';
|
|
45
|
+
case 'surface1':
|
|
46
|
+
return 'text-surface1';
|
|
47
|
+
case 'surface2':
|
|
48
|
+
return 'text-surface2';
|
|
49
|
+
case 'surface3':
|
|
50
|
+
return 'text-surface3';
|
|
51
|
+
case 'surface4':
|
|
52
|
+
return 'text-surface4';
|
|
53
|
+
case 'onSurface':
|
|
54
|
+
return 'text-onSurface';
|
|
55
|
+
case 'onSurfaceVariant':
|
|
56
|
+
return 'text-onSurfaceVariant';
|
|
57
|
+
case 'outline':
|
|
58
|
+
return 'text-outline';
|
|
59
|
+
case 'outlineVariant':
|
|
60
|
+
return 'text-outlineVariant';
|
|
61
|
+
case 'error':
|
|
62
|
+
return 'text-error';
|
|
63
|
+
case 'errorOverlay':
|
|
64
|
+
return 'text-errorOverlay';
|
|
65
|
+
case 'onError':
|
|
66
|
+
return 'text-onError';
|
|
67
|
+
case 'errorContainer':
|
|
68
|
+
return 'text-errorContainer';
|
|
69
|
+
case 'onErrorContainer':
|
|
70
|
+
return 'text-onErrorContainer';
|
|
71
|
+
case 'success':
|
|
72
|
+
return 'text-success';
|
|
73
|
+
case 'onSuccess':
|
|
74
|
+
return 'text-onSuccess';
|
|
75
|
+
case 'successContainer':
|
|
76
|
+
return 'text-successContainer';
|
|
77
|
+
case 'onSuccessContainer':
|
|
78
|
+
return 'text-onSuccessContainer';
|
|
79
|
+
default:
|
|
80
|
+
return 'text-inherit';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
SemanticColor.forText = forText;
|
|
84
|
+
function forBg(color) {
|
|
85
|
+
switch (color) {
|
|
86
|
+
case 'background':
|
|
87
|
+
return 'bg-background';
|
|
88
|
+
case 'onBackground':
|
|
89
|
+
return 'bg-onBackground';
|
|
90
|
+
case 'onBackgroundVariant':
|
|
91
|
+
return 'bg-onBackgroundVariant';
|
|
92
|
+
case 'surface':
|
|
93
|
+
return 'bg-surface';
|
|
94
|
+
case 'surfaceVariant':
|
|
95
|
+
return 'bg-surfaceVariant';
|
|
96
|
+
case 'surface1':
|
|
97
|
+
return 'bg-surface1';
|
|
98
|
+
case 'surface2':
|
|
99
|
+
return 'bg-surface2';
|
|
100
|
+
case 'surface3':
|
|
101
|
+
return 'bg-surface3';
|
|
102
|
+
case 'surface4':
|
|
103
|
+
return 'bg-surface4';
|
|
104
|
+
case 'onSurface':
|
|
105
|
+
return 'bg-onSurface';
|
|
106
|
+
case 'onSurfaceVariant':
|
|
107
|
+
return 'bg-onSurfaceVariant';
|
|
108
|
+
case 'outline':
|
|
109
|
+
return 'bg-outline';
|
|
110
|
+
case 'outlineVariant':
|
|
111
|
+
return 'bg-outlineVariant';
|
|
112
|
+
case 'error':
|
|
113
|
+
return 'bg-error';
|
|
114
|
+
case 'errorOverlay':
|
|
115
|
+
return 'bg-errorOverlay';
|
|
116
|
+
case 'onError':
|
|
117
|
+
return 'bg-onError';
|
|
118
|
+
case 'errorContainer':
|
|
119
|
+
return 'bg-errorContainer';
|
|
120
|
+
case 'onErrorContainer':
|
|
121
|
+
return 'bg-onErrorContainer';
|
|
122
|
+
case 'success':
|
|
123
|
+
return 'bg-success';
|
|
124
|
+
case 'onSuccess':
|
|
125
|
+
return 'bg-onSuccess';
|
|
126
|
+
case 'successContainer':
|
|
127
|
+
return 'bg-successContainer';
|
|
128
|
+
case 'onSuccessContainer':
|
|
129
|
+
return 'bg-onSuccessContainer';
|
|
130
|
+
default:
|
|
131
|
+
return 'bg-inherit';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
SemanticColor.forBg = forBg;
|
|
135
|
+
function forStroke(color) {
|
|
136
|
+
switch (color) {
|
|
137
|
+
case 'background':
|
|
138
|
+
return 'stroke-background';
|
|
139
|
+
case 'onBackground':
|
|
140
|
+
return 'stroke-onBackground';
|
|
141
|
+
case 'onBackgroundVariant':
|
|
142
|
+
return 'stroke-onBackgroundVariant';
|
|
143
|
+
case 'surface':
|
|
144
|
+
return 'stroke-surface';
|
|
145
|
+
case 'surfaceVariant':
|
|
146
|
+
return 'stroke-surfaceVariant';
|
|
147
|
+
case 'surface1':
|
|
148
|
+
return 'stroke-surface1';
|
|
149
|
+
case 'surface2':
|
|
150
|
+
return 'stroke-surface2';
|
|
151
|
+
case 'surface3':
|
|
152
|
+
return 'stroke-surface3';
|
|
153
|
+
case 'surface4':
|
|
154
|
+
return 'stroke-surface4';
|
|
155
|
+
case 'onSurface':
|
|
156
|
+
return 'stroke-onSurface';
|
|
157
|
+
case 'onSurfaceVariant':
|
|
158
|
+
return 'stroke-onSurfaceVariant';
|
|
159
|
+
case 'outline':
|
|
160
|
+
return 'stroke-outline';
|
|
161
|
+
case 'outlineVariant':
|
|
162
|
+
return 'stroke-outlineVariant';
|
|
163
|
+
case 'error':
|
|
164
|
+
return 'stroke-error';
|
|
165
|
+
case 'errorOverlay':
|
|
166
|
+
return 'stroke-errorOverlay';
|
|
167
|
+
case 'onError':
|
|
168
|
+
return 'stroke-onError';
|
|
169
|
+
case 'errorContainer':
|
|
170
|
+
return 'stroke-errorContainer';
|
|
171
|
+
case 'onErrorContainer':
|
|
172
|
+
return 'stroke-onErrorContainer';
|
|
173
|
+
case 'success':
|
|
174
|
+
return 'stroke-success';
|
|
175
|
+
case 'onSuccess':
|
|
176
|
+
return 'stroke-onSuccess';
|
|
177
|
+
case 'successContainer':
|
|
178
|
+
return 'stroke-successContainer';
|
|
179
|
+
case 'onSuccessContainer':
|
|
180
|
+
return 'stroke-onSuccessContainer';
|
|
181
|
+
default:
|
|
182
|
+
return 'stroke-inherit';
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
SemanticColor.forStroke = forStroke;
|
|
186
|
+
function forFill(color) {
|
|
187
|
+
switch (color) {
|
|
188
|
+
case 'background':
|
|
189
|
+
return 'fill-background';
|
|
190
|
+
case 'onBackground':
|
|
191
|
+
return 'fill-onBackground';
|
|
192
|
+
case 'onBackgroundVariant':
|
|
193
|
+
return 'fill-onBackgroundVariant';
|
|
194
|
+
case 'surface':
|
|
195
|
+
return 'fill-surface';
|
|
196
|
+
case 'surfaceVariant':
|
|
197
|
+
return 'fill-surfaceVariant';
|
|
198
|
+
case 'surface1':
|
|
199
|
+
return 'fill-surface1';
|
|
200
|
+
case 'surface2':
|
|
201
|
+
return 'fill-surface2';
|
|
202
|
+
case 'surface3':
|
|
203
|
+
return 'fill-surface3';
|
|
204
|
+
case 'surface4':
|
|
205
|
+
return 'fill-surface4';
|
|
206
|
+
case 'onSurface':
|
|
207
|
+
return 'fill-onSurface';
|
|
208
|
+
case 'onSurfaceVariant':
|
|
209
|
+
return 'fill-onSurfaceVariant';
|
|
210
|
+
case 'outline':
|
|
211
|
+
return 'fill-outline';
|
|
212
|
+
case 'outlineVariant':
|
|
213
|
+
return 'fill-outlineVariant';
|
|
214
|
+
case 'error':
|
|
215
|
+
return 'fill-error';
|
|
216
|
+
case 'errorOverlay':
|
|
217
|
+
return 'fill-errorOverlay';
|
|
218
|
+
case 'onError':
|
|
219
|
+
return 'fill-onError';
|
|
220
|
+
case 'errorContainer':
|
|
221
|
+
return 'fill-errorContainer';
|
|
222
|
+
case 'onErrorContainer':
|
|
223
|
+
return 'fill-onErrorContainer';
|
|
224
|
+
case 'success':
|
|
225
|
+
return 'fill-success';
|
|
226
|
+
case 'onSuccess':
|
|
227
|
+
return 'fill-onSuccess';
|
|
228
|
+
case 'successContainer':
|
|
229
|
+
return 'fill-successContainer';
|
|
230
|
+
case 'onSuccessContainer':
|
|
231
|
+
return 'fill-onSuccessContainer';
|
|
232
|
+
default:
|
|
233
|
+
return 'fill-inherit';
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
SemanticColor.forFill = forFill;
|
|
237
|
+
})(SemanticColor || (exports.SemanticColor = SemanticColor = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AssetField } from '../schema';
|
|
2
|
+
import { ImageSource } from './ImageSource';
|
|
3
|
+
import { Position } from './Position';
|
|
4
|
+
export type Visual = Visual.Image | Visual.Video;
|
|
5
|
+
export declare namespace Visual {
|
|
6
|
+
type Image = {
|
|
7
|
+
image: ImageSource;
|
|
8
|
+
alt: string;
|
|
9
|
+
position?: Position;
|
|
10
|
+
blurHash?: string;
|
|
11
|
+
};
|
|
12
|
+
namespace Image {
|
|
13
|
+
function filter(value: any): value is Image;
|
|
14
|
+
}
|
|
15
|
+
type Video = {
|
|
16
|
+
video: string;
|
|
17
|
+
position?: Position;
|
|
18
|
+
accessible: boolean;
|
|
19
|
+
};
|
|
20
|
+
namespace Video {
|
|
21
|
+
function filter(value: any): value is Video;
|
|
22
|
+
}
|
|
23
|
+
function coerce(value: Image | Visual | AssetField.VisualData | AssetField.LinkedValue.Visual): Visual;
|
|
24
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Visual = void 0;
|
|
4
|
+
const schema_1 = require("../schema");
|
|
5
|
+
// extension
|
|
6
|
+
var Visual;
|
|
7
|
+
(function (Visual) {
|
|
8
|
+
let Image;
|
|
9
|
+
(function (Image) {
|
|
10
|
+
// helpers
|
|
11
|
+
function filter(value) {
|
|
12
|
+
return value
|
|
13
|
+
&& typeof value === 'object'
|
|
14
|
+
&& 'image' in value
|
|
15
|
+
&& (typeof value.image === 'string' || typeof value.image === 'object');
|
|
16
|
+
}
|
|
17
|
+
Image.filter = filter;
|
|
18
|
+
})(Image = Visual.Image || (Visual.Image = {}));
|
|
19
|
+
let Video;
|
|
20
|
+
(function (Video) {
|
|
21
|
+
// helpers
|
|
22
|
+
function filter(value) {
|
|
23
|
+
return value
|
|
24
|
+
&& typeof value === 'object'
|
|
25
|
+
&& 'video' in value
|
|
26
|
+
&& typeof value.video === 'string';
|
|
27
|
+
}
|
|
28
|
+
Video.filter = filter;
|
|
29
|
+
})(Video = Visual.Video || (Visual.Video = {}));
|
|
30
|
+
// methods
|
|
31
|
+
function coerce(value) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
// handle legacy/direct visual
|
|
34
|
+
if (Image.filter(value) || Video.filter(value)) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
// handle visual image
|
|
38
|
+
const visual = schema_1.AssetField.LinkedValue.Visual.filter(value)
|
|
39
|
+
? value
|
|
40
|
+
: value.value;
|
|
41
|
+
if (schema_1.AssetField.LinkedValue.Image.filter(visual)) {
|
|
42
|
+
const { url, description, metadata } = visual;
|
|
43
|
+
return {
|
|
44
|
+
image: {
|
|
45
|
+
src: url,
|
|
46
|
+
width: (_a = metadata.dimensions) === null || _a === void 0 ? void 0 : _a.width,
|
|
47
|
+
height: (_b = metadata.dimensions) === null || _b === void 0 ? void 0 : _b.height
|
|
48
|
+
},
|
|
49
|
+
position: metadata.crop,
|
|
50
|
+
alt: description !== null && description !== void 0 ? description : ''
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// or handle visual video
|
|
54
|
+
else {
|
|
55
|
+
const { url, metadata } = visual;
|
|
56
|
+
return {
|
|
57
|
+
video: url,
|
|
58
|
+
position: metadata.crop,
|
|
59
|
+
accessible: metadata.accessible === 'system'
|
|
60
|
+
? true
|
|
61
|
+
: metadata.accessible
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
Visual.coerce = coerce;
|
|
66
|
+
})(Visual || (exports.Visual = Visual = {}));
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export type BlockLayout = {
|
|
2
|
+
name: string;
|
|
3
|
+
root: BlockLayout.Root;
|
|
4
|
+
fullbleed: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare namespace BlockLayout {
|
|
7
|
+
type Root = Row | Column | Stack;
|
|
8
|
+
type Container = Row | Row.Nested | Column | Column.Nested | Stack | Stack.Nested;
|
|
9
|
+
type Row = {
|
|
10
|
+
type: 'row';
|
|
11
|
+
items: ReadonlyArray<Column.Nested | Stack.Nested | Panel>;
|
|
12
|
+
alignX?: Alignment;
|
|
13
|
+
alignY?: Alignment;
|
|
14
|
+
};
|
|
15
|
+
namespace Row {
|
|
16
|
+
type Nested = Omit<Row, 'items'> & {
|
|
17
|
+
items: ReadonlyArray<Panel>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
type Column = {
|
|
21
|
+
type: 'column';
|
|
22
|
+
items: ReadonlyArray<Row.Nested | Stack.Nested | Panel>;
|
|
23
|
+
alignX?: Alignment;
|
|
24
|
+
alignY?: Alignment;
|
|
25
|
+
};
|
|
26
|
+
namespace Column {
|
|
27
|
+
type Nested = Omit<Column, 'items'> & {
|
|
28
|
+
items: ReadonlyArray<Panel>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
type Stack = {
|
|
32
|
+
type: 'stack';
|
|
33
|
+
items: ReadonlyArray<Row.Nested | Column.Nested | Panel>;
|
|
34
|
+
alignX?: Alignment;
|
|
35
|
+
alignY?: Alignment;
|
|
36
|
+
};
|
|
37
|
+
namespace Stack {
|
|
38
|
+
type Nested = Omit<Stack, 'items'> & {
|
|
39
|
+
items: ReadonlyArray<Panel>;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
type NestedItem = Row.Nested | Column.Nested | Stack.Nested | Panel;
|
|
43
|
+
type Panel = Message | Visual | List;
|
|
44
|
+
namespace Panel {
|
|
45
|
+
type Key = Panel['type'] | string;
|
|
46
|
+
type Base = {
|
|
47
|
+
key: Key;
|
|
48
|
+
mobileOrder?: MobileOrder;
|
|
49
|
+
alignX: Alignment;
|
|
50
|
+
alignY: Alignment;
|
|
51
|
+
size: Size;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
type Message = Panel.Base & {
|
|
55
|
+
type: 'message';
|
|
56
|
+
textAlign: TextAlignment;
|
|
57
|
+
};
|
|
58
|
+
type Visual = Panel.Base & {
|
|
59
|
+
type: 'visual';
|
|
60
|
+
aspectRatio: AspectRatio;
|
|
61
|
+
};
|
|
62
|
+
type List = Panel.Base & {
|
|
63
|
+
type: 'list';
|
|
64
|
+
itemType: List.ItemType;
|
|
65
|
+
};
|
|
66
|
+
namespace List {
|
|
67
|
+
type ItemType = 'message' | 'message+visual';
|
|
68
|
+
namespace ItemType {
|
|
69
|
+
const values: ReadonlyArray<ItemType>;
|
|
70
|
+
function parse(value: string, fallback?: ItemType): ItemType;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
type MobileOrder = 'first' | 'last';
|
|
74
|
+
namespace MobileOrder {
|
|
75
|
+
const values: ReadonlyArray<MobileOrder>;
|
|
76
|
+
function parse(value: string, fallback?: MobileOrder): MobileOrder | undefined;
|
|
77
|
+
}
|
|
78
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'full';
|
|
79
|
+
namespace Size {
|
|
80
|
+
const values: ReadonlyArray<Size>;
|
|
81
|
+
function parse(value: string, fallback?: Size): Size;
|
|
82
|
+
}
|
|
83
|
+
type Alignment = 'start' | 'center' | 'end';
|
|
84
|
+
namespace Alignment {
|
|
85
|
+
const values: ReadonlyArray<Alignment>;
|
|
86
|
+
function parse(value: string, fallback?: Alignment): Alignment;
|
|
87
|
+
}
|
|
88
|
+
type TextAlignment = 'left' | 'center' | 'right';
|
|
89
|
+
namespace TextAlignment {
|
|
90
|
+
const values: ReadonlyArray<TextAlignment>;
|
|
91
|
+
function parse(value: string, fallback?: TextAlignment): TextAlignment;
|
|
92
|
+
}
|
|
93
|
+
type AspectRatio = 'auto' | 'square' | 'phone' | 'tv' | 'widescreen' | 'cinema';
|
|
94
|
+
namespace AspectRatio {
|
|
95
|
+
const values: ReadonlyArray<AspectRatio>;
|
|
96
|
+
function parse(value: string, fallback?: AspectRatio): AspectRatio;
|
|
97
|
+
}
|
|
98
|
+
function parse(xml: string): BlockLayout;
|
|
99
|
+
}
|