@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,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AspectRatio = void 0;
|
|
4
|
+
// class
|
|
5
|
+
const errors_1 = require("../../errors");
|
|
6
|
+
class AspectRatio {
|
|
7
|
+
constructor(value) {
|
|
8
|
+
// normalize value
|
|
9
|
+
const { width, height } = AspectRatio.Data.parse(value);
|
|
10
|
+
// initialize instance variables
|
|
11
|
+
this.width = width;
|
|
12
|
+
this.height = height;
|
|
13
|
+
}
|
|
14
|
+
get ratio() {
|
|
15
|
+
const { width, height } = this;
|
|
16
|
+
return width / height;
|
|
17
|
+
}
|
|
18
|
+
isSimilarTo(that) {
|
|
19
|
+
const threshold = 0.005;
|
|
20
|
+
return Math.abs(this.ratio - that.ratio) < threshold;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
const { width, height } = this;
|
|
24
|
+
return `${width.toFixed()}:${height.toFixed()}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AspectRatio = AspectRatio;
|
|
28
|
+
// extension
|
|
29
|
+
(function (AspectRatio) {
|
|
30
|
+
let Data;
|
|
31
|
+
(function (Data) {
|
|
32
|
+
// helpers
|
|
33
|
+
function parse(value) {
|
|
34
|
+
// handle tuple form
|
|
35
|
+
if (Array.isArray(value)) {
|
|
36
|
+
return Tuple.parse(value);
|
|
37
|
+
}
|
|
38
|
+
// or handle data form
|
|
39
|
+
else if (typeof value === 'object') {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
// otherwise try to parse string
|
|
43
|
+
else if (String.filter(value)) {
|
|
44
|
+
return String.parse(value);
|
|
45
|
+
}
|
|
46
|
+
// or throw
|
|
47
|
+
else {
|
|
48
|
+
throw new errors_1.ArgumentError(`Invalid AspectRatio "${value}"`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
Data.parse = parse;
|
|
52
|
+
})(Data = AspectRatio.Data || (AspectRatio.Data = {}));
|
|
53
|
+
let String;
|
|
54
|
+
(function (String) {
|
|
55
|
+
// helper
|
|
56
|
+
function filter(value) {
|
|
57
|
+
return /^[1-9]\d?:[1-9]\d?$/.test(value);
|
|
58
|
+
}
|
|
59
|
+
String.filter = filter;
|
|
60
|
+
function parse(value) {
|
|
61
|
+
const [widthValue, heightValue] = value.split(':');
|
|
62
|
+
return {
|
|
63
|
+
width: Number.parseInt(widthValue),
|
|
64
|
+
height: Number.parseInt(heightValue)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
String.parse = parse;
|
|
68
|
+
})(String = AspectRatio.String || (AspectRatio.String = {}));
|
|
69
|
+
let Tuple;
|
|
70
|
+
(function (Tuple) {
|
|
71
|
+
// helper
|
|
72
|
+
function parse([width, height]) {
|
|
73
|
+
return { width, height };
|
|
74
|
+
}
|
|
75
|
+
Tuple.parse = parse;
|
|
76
|
+
})(Tuple = AspectRatio.Tuple || (AspectRatio.Tuple = {}));
|
|
77
|
+
})(AspectRatio || (exports.AspectRatio = AspectRatio = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bounds = void 0;
|
|
4
|
+
const Rect_1 = require("./Rect");
|
|
5
|
+
// class
|
|
6
|
+
class Bounds extends Rect_1.Rect {
|
|
7
|
+
constructor(width, height) {
|
|
8
|
+
super(0, 0, width, height);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.Bounds = Bounds;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Insets = {
|
|
2
|
+
top: number;
|
|
3
|
+
right: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
left: number;
|
|
6
|
+
};
|
|
7
|
+
export declare namespace Insets {
|
|
8
|
+
const none: Readonly<Insets>;
|
|
9
|
+
type AsText = `${AsText.Format}` | `${AsText.Format} ${AsText.Format}` | `${AsText.Format} ${AsText.Format} ${AsText.Format} ${AsText.Format}`;
|
|
10
|
+
namespace AsText {
|
|
11
|
+
type Format = `${number}${'px' | '%'}`;
|
|
12
|
+
}
|
|
13
|
+
function asText({ top, right, bottom, left }: Insets): AsText;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Insets = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Insets;
|
|
6
|
+
(function (Insets) {
|
|
7
|
+
// constants
|
|
8
|
+
Insets.none = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
9
|
+
// helpers
|
|
10
|
+
function asText({ top, right, bottom, left }) {
|
|
11
|
+
return `${top}px ${right}px ${bottom}px ${left}px`;
|
|
12
|
+
}
|
|
13
|
+
Insets.asText = asText;
|
|
14
|
+
})(Insets || (exports.Insets = Insets = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PixelSize = `${number}px`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Point = void 0;
|
|
4
|
+
// class
|
|
5
|
+
class Point {
|
|
6
|
+
constructor(x, y) {
|
|
7
|
+
this.x = x;
|
|
8
|
+
this.y = y;
|
|
9
|
+
}
|
|
10
|
+
distanceTo(point) {
|
|
11
|
+
return Math.hypot(this.x - point.x, this.y - point.y);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Point = Point;
|
|
15
|
+
Point.origin = new Point(0, 0);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Insets } from './Insets';
|
|
2
|
+
import { Point } from './Point';
|
|
3
|
+
export declare class Rect {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly width: number;
|
|
7
|
+
readonly height: number;
|
|
8
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
9
|
+
get top(): number;
|
|
10
|
+
get bottom(): number;
|
|
11
|
+
get left(): number;
|
|
12
|
+
get right(): number;
|
|
13
|
+
get center(): Point;
|
|
14
|
+
contains(that: Rect): boolean;
|
|
15
|
+
overlaps(that: Rect): boolean;
|
|
16
|
+
touches(that: Rect): boolean;
|
|
17
|
+
static fromInsets(insets: Insets): Rect;
|
|
18
|
+
static fromRect({ x, y, width, height }: Pick<Rect, 'x' | 'y' | 'width' | 'height'>): Rect;
|
|
19
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const Point_1 = require("./Point");
|
|
5
|
+
class Rect {
|
|
6
|
+
constructor(x, y, width, height) {
|
|
7
|
+
this.x = x;
|
|
8
|
+
this.y = y;
|
|
9
|
+
this.width = width;
|
|
10
|
+
this.height = height;
|
|
11
|
+
}
|
|
12
|
+
get top() {
|
|
13
|
+
return this.y;
|
|
14
|
+
}
|
|
15
|
+
get bottom() {
|
|
16
|
+
return this.y + this.height;
|
|
17
|
+
}
|
|
18
|
+
get left() {
|
|
19
|
+
return this.x;
|
|
20
|
+
}
|
|
21
|
+
get right() {
|
|
22
|
+
return this.x + this.width;
|
|
23
|
+
}
|
|
24
|
+
get center() {
|
|
25
|
+
return new Point_1.Point(this.x + this.width / 2, this.y + this.height / 2);
|
|
26
|
+
}
|
|
27
|
+
contains(that) {
|
|
28
|
+
return !(that.x < this.x ||
|
|
29
|
+
that.y < this.y ||
|
|
30
|
+
(that.x + that.width) > (this.x + this.width) ||
|
|
31
|
+
(that.y + that.height) > (this.y + this.height));
|
|
32
|
+
}
|
|
33
|
+
overlaps(that) {
|
|
34
|
+
// no horizontal overlap
|
|
35
|
+
if (this.x >= (that.x + that.width) || that.x >= (this.x + this.width)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
// no vertical overlap
|
|
39
|
+
else if (this.y >= (that.y + that.height) || that.y >= (this.y + this.height)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
// otherwise they must overlap
|
|
43
|
+
else {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
touches(that) {
|
|
48
|
+
// has horizontal gap
|
|
49
|
+
if (this.x > (that.x + that.width) || that.x > (this.x + this.width)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
// has vertical gap
|
|
53
|
+
else if (this.y > (that.y + that.height) || that.y > (this.y + this.height)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// otherwise there's no gap
|
|
57
|
+
else {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static fromInsets(insets) {
|
|
62
|
+
return new Rect(insets.left, insets.top, insets.right - insets.left, insets.bottom - insets.top);
|
|
63
|
+
}
|
|
64
|
+
static fromRect({ x, y, width, height }) {
|
|
65
|
+
return new Rect(x, y, width, height);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.Rect = Rect;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ScreenSize = 'mobile' | 'desktop';
|
|
@@ -0,0 +1,25 @@
|
|
|
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("./AspectRatio"), exports);
|
|
18
|
+
__exportStar(require("./Bounds"), exports);
|
|
19
|
+
__exportStar(require("./Frame"), exports);
|
|
20
|
+
__exportStar(require("./Insets"), exports);
|
|
21
|
+
__exportStar(require("./PixelSize"), exports);
|
|
22
|
+
__exportStar(require("./Point"), exports);
|
|
23
|
+
__exportStar(require("./Rect"), exports);
|
|
24
|
+
__exportStar(require("./ScreenSize"), exports);
|
|
25
|
+
__exportStar(require("./Size"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './block-layout';
|
|
2
|
+
export * from './browser/index';
|
|
3
|
+
export * from './fields';
|
|
4
|
+
export * from './geometry';
|
|
5
|
+
export * from './responsive';
|
|
6
|
+
export * from './richtext';
|
|
7
|
+
export * from './Accessible';
|
|
8
|
+
export * from './BlockThemes';
|
|
9
|
+
export * from './ColorMode';
|
|
10
|
+
export * from './ImageSource';
|
|
11
|
+
export * from './File';
|
|
12
|
+
export * from './FileType';
|
|
13
|
+
export * from './MimeType';
|
|
14
|
+
export * from './Placement';
|
|
15
|
+
export * from './Position';
|
|
16
|
+
export * from './Selector';
|
|
17
|
+
export * from './SemanticColor';
|
|
18
|
+
export * from './Visual';
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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("./block-layout"), exports);
|
|
18
|
+
__exportStar(require("./browser/index"), exports);
|
|
19
|
+
__exportStar(require("./fields"), exports);
|
|
20
|
+
__exportStar(require("./geometry"), exports);
|
|
21
|
+
__exportStar(require("./responsive"), exports);
|
|
22
|
+
__exportStar(require("./richtext"), exports);
|
|
23
|
+
__exportStar(require("./Accessible"), exports);
|
|
24
|
+
__exportStar(require("./BlockThemes"), exports);
|
|
25
|
+
__exportStar(require("./ColorMode"), exports);
|
|
26
|
+
__exportStar(require("./ImageSource"), exports);
|
|
27
|
+
__exportStar(require("./File"), exports);
|
|
28
|
+
__exportStar(require("./FileType"), exports);
|
|
29
|
+
__exportStar(require("./MimeType"), exports);
|
|
30
|
+
__exportStar(require("./Placement"), exports);
|
|
31
|
+
__exportStar(require("./Position"), exports);
|
|
32
|
+
__exportStar(require("./Selector"), exports);
|
|
33
|
+
__exportStar(require("./SemanticColor"), exports);
|
|
34
|
+
__exportStar(require("./Visual"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2
|
+
export type BreakpointStates = Record<Breakpoint, boolean>;
|
|
3
|
+
export declare namespace Breakpoint {
|
|
4
|
+
const values: ReadonlyArray<Breakpoint>;
|
|
5
|
+
const last: Breakpoint;
|
|
6
|
+
function test(value: string): value is Breakpoint;
|
|
7
|
+
function compare(lhs: Breakpoint, rhs: Breakpoint): number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Breakpoint = void 0;
|
|
4
|
+
// extensions
|
|
5
|
+
var Breakpoint;
|
|
6
|
+
(function (Breakpoint) {
|
|
7
|
+
// constants
|
|
8
|
+
Breakpoint.values = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
9
|
+
Breakpoint.last = Breakpoint.values[Breakpoint.values.length - 1];
|
|
10
|
+
// helpers
|
|
11
|
+
function test(value) {
|
|
12
|
+
return Breakpoint.values.includes(value);
|
|
13
|
+
}
|
|
14
|
+
Breakpoint.test = test;
|
|
15
|
+
function compare(lhs, rhs) {
|
|
16
|
+
// skip if same
|
|
17
|
+
if (lhs === rhs) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
// otherwise return based on index
|
|
21
|
+
return Breakpoint.values.indexOf(lhs) < Breakpoint.values.indexOf(rhs) ? -1 : 1;
|
|
22
|
+
}
|
|
23
|
+
Breakpoint.compare = compare;
|
|
24
|
+
})(Breakpoint || (exports.Breakpoint = Breakpoint = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Breakpoint } from './Breakpoint';
|
|
3
|
+
import { Breakpoints } from './Breakpoints';
|
|
4
|
+
export declare class BreakpointObserver {
|
|
5
|
+
private _configurations;
|
|
6
|
+
private _current;
|
|
7
|
+
private _current$;
|
|
8
|
+
private _disposed;
|
|
9
|
+
constructor(breakpoints: Breakpoints);
|
|
10
|
+
get current(): Breakpoint | undefined;
|
|
11
|
+
get current$(): Observable<Breakpoint>;
|
|
12
|
+
get disposed(): boolean;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
private setCurrent;
|
|
15
|
+
private bindBreakpoint;
|
|
16
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BreakpointObserver = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const Browser_1 = require("../browser/Browser");
|
|
7
|
+
const Breakpoint_1 = require("./Breakpoint");
|
|
8
|
+
// class
|
|
9
|
+
class BreakpointObserver {
|
|
10
|
+
constructor(breakpoints) {
|
|
11
|
+
// create configurations
|
|
12
|
+
const breakpointEntries = Object.entries(breakpoints)
|
|
13
|
+
.sort(([lhs], [rhs]) => Breakpoint_1.Breakpoint.compare(lhs, rhs));
|
|
14
|
+
const lastBreakpointIndex = breakpointEntries.length - 1;
|
|
15
|
+
this._configurations = breakpointEntries
|
|
16
|
+
.map(([breakpoint, start], index) => ({
|
|
17
|
+
breakpoint,
|
|
18
|
+
start,
|
|
19
|
+
end: index < lastBreakpointIndex
|
|
20
|
+
? breakpointEntries[index + 1][1] - 1
|
|
21
|
+
: undefined
|
|
22
|
+
}));
|
|
23
|
+
// initialize instance variables
|
|
24
|
+
this._current = undefined;
|
|
25
|
+
this._current$ = new rxjs_1.BehaviorSubject(undefined);
|
|
26
|
+
this._disposed = false;
|
|
27
|
+
// bind breakpoints
|
|
28
|
+
this._configurations.forEach(configuration => {
|
|
29
|
+
// initialize media query callback
|
|
30
|
+
const breakpoint = configuration.breakpoint;
|
|
31
|
+
configuration.mediaQueryCallback = (e) => {
|
|
32
|
+
// update if matches and not current
|
|
33
|
+
if (e.matches) {
|
|
34
|
+
this.setCurrent(breakpoint);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// bind breakpoint (indirectly updates to matching breakpoint)
|
|
38
|
+
this.bindBreakpoint(configuration);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
get current() {
|
|
42
|
+
return this._current;
|
|
43
|
+
}
|
|
44
|
+
get current$() {
|
|
45
|
+
return this._current$
|
|
46
|
+
.pipe((0, rxjs_1.filter)(utils_1.isDefinedStrict));
|
|
47
|
+
}
|
|
48
|
+
get disposed() {
|
|
49
|
+
return this._disposed;
|
|
50
|
+
}
|
|
51
|
+
dispose() {
|
|
52
|
+
// mark disposed
|
|
53
|
+
this._disposed = true;
|
|
54
|
+
// clear all configurations
|
|
55
|
+
this._configurations.forEach(configuration => {
|
|
56
|
+
// remove listener (if any)
|
|
57
|
+
if (configuration.mediaQuery !== undefined) {
|
|
58
|
+
configuration.mediaQuery.removeEventListener('change', configuration.mediaQueryCallback);
|
|
59
|
+
}
|
|
60
|
+
// reset
|
|
61
|
+
delete configuration.mediaQuery;
|
|
62
|
+
delete configuration.mediaQueryCallback;
|
|
63
|
+
});
|
|
64
|
+
// clear configurations
|
|
65
|
+
this._configurations = [];
|
|
66
|
+
}
|
|
67
|
+
setCurrent(breakpoint) {
|
|
68
|
+
if (this._current !== breakpoint) {
|
|
69
|
+
this._current = breakpoint;
|
|
70
|
+
this._current$.next(breakpoint);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
bindBreakpoint(configuration) {
|
|
74
|
+
// skip if in the backend
|
|
75
|
+
if (!Browser_1.Browser.available) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// unbind previous media query (if any)
|
|
79
|
+
if (configuration.mediaQuery !== undefined) {
|
|
80
|
+
configuration.mediaQuery.removeEventListener('change', configuration.mediaQueryCallback);
|
|
81
|
+
}
|
|
82
|
+
// create last breakpoint query
|
|
83
|
+
let mediaQuery;
|
|
84
|
+
if (configuration.end === undefined) {
|
|
85
|
+
mediaQuery = `(min-width: ${configuration.start}px)`;
|
|
86
|
+
}
|
|
87
|
+
// or create first breakpoint query
|
|
88
|
+
else if (configuration.start === 0) {
|
|
89
|
+
mediaQuery = `(max-width: ${configuration.end}px)`;
|
|
90
|
+
}
|
|
91
|
+
// or create bounded breakpoint query
|
|
92
|
+
else {
|
|
93
|
+
mediaQuery = `(min-width: ${configuration.start}px) and (max-width: ${configuration.end}px)`;
|
|
94
|
+
}
|
|
95
|
+
// bind new media query
|
|
96
|
+
configuration.mediaQuery = window.matchMedia(mediaQuery);
|
|
97
|
+
configuration.mediaQuery.addEventListener('change', configuration.mediaQueryCallback);
|
|
98
|
+
// update breakpoint if matching
|
|
99
|
+
if (configuration.mediaQuery.matches) {
|
|
100
|
+
this.setCurrent(configuration.breakpoint);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.BreakpointObserver = BreakpointObserver;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Breakpoints = void 0;
|
|
4
|
+
// extension
|
|
5
|
+
var Breakpoints;
|
|
6
|
+
(function (Breakpoints) {
|
|
7
|
+
// constants
|
|
8
|
+
Breakpoints.defaults = {
|
|
9
|
+
xs: 0,
|
|
10
|
+
sm: 600,
|
|
11
|
+
md: 900,
|
|
12
|
+
lg: 1280,
|
|
13
|
+
xl: 1520
|
|
14
|
+
};
|
|
15
|
+
})(Breakpoints || (exports.Breakpoints = Breakpoints = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Breakpoint } from './Breakpoint';
|
|
2
|
+
export type ResponsiveValue<T> = Partial<Record<Breakpoint, T>>;
|
|
3
|
+
export type MixedResponsiveValue<T> = T | ResponsiveValue<T>;
|
|
4
|
+
export declare namespace ResponsiveValue {
|
|
5
|
+
function isResponsive<T>(value: any): value is Partial<Record<Breakpoint, T>>;
|
|
6
|
+
function resolve<T>(responsiveValue: Partial<ResponsiveValue<T>>, breakpoint: Breakpoint): T | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponsiveValue = void 0;
|
|
4
|
+
const Breakpoint_1 = require("./Breakpoint");
|
|
5
|
+
// extensions
|
|
6
|
+
var ResponsiveValue;
|
|
7
|
+
(function (ResponsiveValue) {
|
|
8
|
+
// guard
|
|
9
|
+
function isResponsive(value) {
|
|
10
|
+
return !!value
|
|
11
|
+
&& typeof value === 'object'
|
|
12
|
+
&& Object.keys(value).some(key => Breakpoint_1.Breakpoint.values.includes(key));
|
|
13
|
+
}
|
|
14
|
+
ResponsiveValue.isResponsive = isResponsive;
|
|
15
|
+
// helpers
|
|
16
|
+
function resolve(responsiveValue, breakpoint) {
|
|
17
|
+
// lookup the closest value
|
|
18
|
+
if (isResponsive(responsiveValue)) {
|
|
19
|
+
const closestBreakpoint = Breakpoint_1.Breakpoint.values.slice()
|
|
20
|
+
.reverse()
|
|
21
|
+
.find(b => Breakpoint_1.Breakpoint.compare(b, breakpoint) <= 0 && responsiveValue[b] !== undefined);
|
|
22
|
+
return closestBreakpoint && responsiveValue[closestBreakpoint];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
ResponsiveValue.resolve = resolve;
|
|
26
|
+
})(ResponsiveValue || (exports.ResponsiveValue = ResponsiveValue = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./Breakpoint"), exports);
|
|
18
|
+
__exportStar(require("./BreakpointObserver"), exports);
|
|
19
|
+
__exportStar(require("./Breakpoints"), exports);
|
|
20
|
+
__exportStar(require("./ResponsiveValue"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SerializedLinkNode } from '@lexical/link';
|
|
2
|
+
import { SerializedListItemNode, SerializedListNode } from '@lexical/list';
|
|
3
|
+
import { SerializedHeadingNode } from '@lexical/rich-text';
|
|
4
|
+
import { BaseSelection, ElementNode, type Klass, LexicalEditor, LexicalNode, SerializedElementNode, SerializedLexicalNode, SerializedParagraphNode, SerializedRootNode, SerializedTextNode, TextNode } from 'lexical';
|
|
5
|
+
import { Transform } from '../../types';
|
|
6
|
+
import { Rect } from '../geometry';
|
|
7
|
+
export declare namespace LexicalUtils {
|
|
8
|
+
function isSerializedTextNode(node: SerializedLexicalNode): node is SerializedTextNode;
|
|
9
|
+
function isSerializedParagraphNode(node: SerializedLexicalNode): node is SerializedParagraphNode;
|
|
10
|
+
function isSerializedHeadingNode(node: SerializedLexicalNode): node is SerializedHeadingNode;
|
|
11
|
+
function isSerializedQuoteNode(node: SerializedLexicalNode): boolean;
|
|
12
|
+
function isSerializedListNode(node: SerializedLexicalNode): node is SerializedListNode;
|
|
13
|
+
function isSerializedHrNode(node: SerializedLexicalNode): boolean;
|
|
14
|
+
function isSerializedListItemNode(node: SerializedLexicalNode): node is SerializedListItemNode;
|
|
15
|
+
function isSerializedLinkNode(node: SerializedLexicalNode): node is SerializedLinkNode;
|
|
16
|
+
function isSerializedElementNode(node: SerializedLexicalNode): node is SerializedElementNode;
|
|
17
|
+
function rootToString(root?: SerializedRootNode): string;
|
|
18
|
+
type ReplaceTextNodesArgs = {
|
|
19
|
+
selection?: BaseSelection | null;
|
|
20
|
+
onReplaceNode: Transform<TextNode, LexicalNode>;
|
|
21
|
+
};
|
|
22
|
+
function replaceTextNodes({ selection: selectionRaw, onReplaceNode }: ReplaceTextNodesArgs): boolean;
|
|
23
|
+
function findContainer<T extends ReadonlyArray<Klass<ElementNode>>>(node: LexicalNode | null | undefined, types: T): InstanceType<T[number]> | undefined;
|
|
24
|
+
type GetSelectionRectArgs = {
|
|
25
|
+
editor: LexicalEditor;
|
|
26
|
+
selection?: BaseSelection | null | undefined;
|
|
27
|
+
coerce?: boolean | ReadonlyArray<Klass<ElementNode>>;
|
|
28
|
+
allowEmpty?: boolean;
|
|
29
|
+
};
|
|
30
|
+
function getSelectionRect({ editor, selection: selectionRaw, coerce, allowEmpty }: GetSelectionRectArgs): Rect | undefined;
|
|
31
|
+
}
|