@nascentdigital/funnel-core 4.5.7 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schema/Collection.d.ts +41 -10
- package/dist/schema/Collection.js +13 -0
- package/dist/schema/CollectionModel.d.ts +3 -3
- package/dist/schema/CollectionSnapshot.d.ts +1 -1
- package/dist/schema/LinkedCollectionModel.d.ts +1 -1
- package/dist/schema/LinkedData.d.ts +33 -14
- package/dist/schema/LinkedData.js +130 -76
- package/dist/schema/LinkedPage.d.ts +37 -0
- package/dist/schema/LinkedPage.js +103 -0
- package/dist/schema/Page.d.ts +55 -17
- package/dist/schema/Page.js +9 -0
- package/dist/schema/PageModel.d.ts +1 -1
- package/dist/schema/PageModel.js +1 -1
- package/dist/schema/PageSnapshot.d.ts +1 -1
- package/dist/schema/field/base/CollectionField.d.ts +1 -1
- package/dist/schema/field/base/DynamicPagesField.d.ts +7 -5
- package/dist/schema/field/base/DynamicPagesField.js +18 -2
- package/dist/schema/field/base/PageField.d.ts +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.js +1 -1
- package/dist/types/TrackedValue.d.ts +8 -0
- package/dist/types/TrackedValue.js +18 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/ui/Placement.d.ts +5 -2
- package/dist/ui/Placement.js +103 -91
- package/dist/utils/ObjectUtils.js +0 -1
- package/package.json +2 -2
- package/dist/schema/LinkedPageModel.d.ts +0 -11
- package/dist/schema/LinkedPageModel.js +0 -26
|
@@ -0,0 +1,103 @@
|
|
|
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.LinkedPage = void 0;
|
|
15
|
+
const LinkedData_1 = require("./LinkedData");
|
|
16
|
+
// class
|
|
17
|
+
class LinkedPage {
|
|
18
|
+
constructor(args) {
|
|
19
|
+
// set instance variables
|
|
20
|
+
this._data = args.data;
|
|
21
|
+
this._linkedStore = args.linkedStore;
|
|
22
|
+
this._nav = this.get('_nd-nav');
|
|
23
|
+
// dynamically add getters for each content item
|
|
24
|
+
this._content = {};
|
|
25
|
+
Object.keys(this._data.content).forEach(key => {
|
|
26
|
+
Object.defineProperty(this._content, key, {
|
|
27
|
+
get: () => this.get(key)
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
get url() {
|
|
32
|
+
return this._data.url;
|
|
33
|
+
}
|
|
34
|
+
get seo() {
|
|
35
|
+
var _a;
|
|
36
|
+
return (_a = this._data.discover) === null || _a === void 0 ? void 0 : _a.seo;
|
|
37
|
+
}
|
|
38
|
+
get header() {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
// get header fields
|
|
41
|
+
const { headerTheme, header } = (_b = (_a = this._nav) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : {};
|
|
42
|
+
// return header fields and config
|
|
43
|
+
return {
|
|
44
|
+
fields: (_c = header === null || header === void 0 ? void 0 : header.value) === null || _c === void 0 ? void 0 : _c.fields,
|
|
45
|
+
config: { theme: headerTheme }
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
get footer() {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
// get footer fields
|
|
51
|
+
const { footer, footerTheme } = (_b = (_a = this._nav) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : {};
|
|
52
|
+
// return footer fields and config
|
|
53
|
+
return {
|
|
54
|
+
fields: (_c = footer === null || footer === void 0 ? void 0 : footer.value) === null || _c === void 0 ? void 0 : _c.fields,
|
|
55
|
+
config: { theme: footerTheme }
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
get data() {
|
|
59
|
+
return this._data;
|
|
60
|
+
}
|
|
61
|
+
get content() {
|
|
62
|
+
return this._content;
|
|
63
|
+
}
|
|
64
|
+
get(key) {
|
|
65
|
+
// get content by key
|
|
66
|
+
const unlinkedData = this._data.content[key];
|
|
67
|
+
// throw if data not found
|
|
68
|
+
if (!unlinkedData) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
// link data
|
|
72
|
+
return LinkedData_1.LinkedData.resolveStatic({
|
|
73
|
+
unlinkedData,
|
|
74
|
+
stores: this._linkedStore,
|
|
75
|
+
skipEntitiesScan: true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
static async create(args) {
|
|
79
|
+
// find and resolve all dynamic references
|
|
80
|
+
const dynamicRefs = LinkedData_1.LinkedData.findDynamicRefs(args.data);
|
|
81
|
+
const dynamic = await LinkedData_1.LinkedData.resolveDynamicRefs({ dynamicRefs, resolvers: args.resolvers });
|
|
82
|
+
// resolve references in entities
|
|
83
|
+
const _a = args.data, { data } = _a, entities = __rest(_a, ["data"]);
|
|
84
|
+
const result = LinkedData_1.LinkedData.resolveStatic({
|
|
85
|
+
unlinkedData: entities,
|
|
86
|
+
stores: { dynamic }
|
|
87
|
+
});
|
|
88
|
+
// create linked store
|
|
89
|
+
const { pages, collections, files } = result;
|
|
90
|
+
const linkedStore = {
|
|
91
|
+
pages: Object.values(pages),
|
|
92
|
+
collections: Object.values(collections),
|
|
93
|
+
assets: Object.values(files),
|
|
94
|
+
dynamic
|
|
95
|
+
};
|
|
96
|
+
// return new linked page
|
|
97
|
+
return new LinkedPage({
|
|
98
|
+
data,
|
|
99
|
+
linkedStore
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.LinkedPage = LinkedPage;
|
package/dist/schema/Page.d.ts
CHANGED
|
@@ -50,10 +50,10 @@ export declare namespace Page {
|
|
|
50
50
|
namespace Update {
|
|
51
51
|
type Page = Page.Name | Page.Tags | Page.Slug | Page.Url | Page.Preview | Page.Errors | Page.Publication;
|
|
52
52
|
namespace Page {
|
|
53
|
-
type Factory<TProp extends keyof
|
|
53
|
+
type Factory<TProp extends keyof LegacyData> = {
|
|
54
54
|
type: 'page';
|
|
55
55
|
property: TProp;
|
|
56
|
-
value: UndefinedToNull<
|
|
56
|
+
value: UndefinedToNull<LegacyData[TProp]>;
|
|
57
57
|
};
|
|
58
58
|
export type Name = Factory<'name'>;
|
|
59
59
|
export type Tags = Factory<'tags'>;
|
|
@@ -128,6 +128,31 @@ export declare namespace Page {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
type Data<TPage extends Page = Page, TRegion extends string = string> = {
|
|
131
|
+
__root: 'page';
|
|
132
|
+
id: Id;
|
|
133
|
+
groupId: GroupId;
|
|
134
|
+
brand: string;
|
|
135
|
+
type: Type;
|
|
136
|
+
tags: TagGroup.Data;
|
|
137
|
+
slug?: string;
|
|
138
|
+
url: string;
|
|
139
|
+
region: TRegion;
|
|
140
|
+
language: Language;
|
|
141
|
+
name: string;
|
|
142
|
+
discover: Data.Discover;
|
|
143
|
+
preview?: Data.Preview<TPage>;
|
|
144
|
+
content: Data.Content<TPage>;
|
|
145
|
+
state: State;
|
|
146
|
+
errors: boolean;
|
|
147
|
+
changeSetId?: ChangeSet.Id;
|
|
148
|
+
snapshotId?: PageSnapshot.Id;
|
|
149
|
+
snapshot?: PageSnapshot;
|
|
150
|
+
createdOn: number;
|
|
151
|
+
updatedOn: number;
|
|
152
|
+
publishedOn?: number;
|
|
153
|
+
publication?: number;
|
|
154
|
+
};
|
|
155
|
+
type LegacyData<TPage extends Page = Page, TRegion extends string = string> = {
|
|
131
156
|
__root: 'page';
|
|
132
157
|
id: Id;
|
|
133
158
|
groupId: GroupId;
|
|
@@ -144,7 +169,7 @@ export declare namespace Page {
|
|
|
144
169
|
content: Data.Content<TPage>;
|
|
145
170
|
files: Asset.Linked[];
|
|
146
171
|
pages: Data.AsPreview[];
|
|
147
|
-
collections: Collection.
|
|
172
|
+
collections: Collection.LegacyData[];
|
|
148
173
|
state: State;
|
|
149
174
|
errors: boolean;
|
|
150
175
|
changeSetId?: ChangeSet.Id;
|
|
@@ -167,42 +192,47 @@ export declare namespace Page {
|
|
|
167
192
|
const audit: ReadonlyArray<Audit>;
|
|
168
193
|
type Backup = Extract<All, 'snapshot'>;
|
|
169
194
|
const backup: ReadonlyArray<Backup>;
|
|
170
|
-
type All = keyof
|
|
195
|
+
type All = keyof LegacyData;
|
|
171
196
|
const all: ReadonlyArray<All>;
|
|
172
197
|
}
|
|
173
|
-
type AsDraft<TPage extends Page = Page, TRegion extends string = string> = PartialBy<Pick<
|
|
198
|
+
type AsDraft<TPage extends Page = Page, TRegion extends string = string> = PartialBy<Pick<LegacyData<TPage, TRegion>, AsDraft.Prop | 'discover'>, 'discover'>;
|
|
174
199
|
namespace AsDraft {
|
|
175
200
|
type Prop = Exclude<Props.Id, 'id'> | Extract<Props.Audit, 'changeSetId'>;
|
|
176
201
|
const props: ReadonlyArray<Prop>;
|
|
177
202
|
}
|
|
178
|
-
type AsNew<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
203
|
+
type AsNew<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsNew.Prop>;
|
|
179
204
|
namespace AsNew {
|
|
180
205
|
type Prop = Exclude<Props.Id, 'id' | 'groupId' | 'url'> | Extract<Props.Audit, 'changeSetId'>;
|
|
181
206
|
const props: ReadonlyArray<Prop>;
|
|
182
207
|
}
|
|
183
|
-
type AsNewLanguage<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
208
|
+
type AsNewLanguage<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsNewLanguage.Prop>;
|
|
184
209
|
namespace AsNewLanguage {
|
|
185
210
|
type Prop = Extract<Props.Id, 'brand' | 'groupId' | 'slug' | 'language'>;
|
|
186
211
|
const props: ReadonlyArray<Prop>;
|
|
187
212
|
function filter<TPage extends Page = Page, TRegion extends string = string>(page: AsNew<TPage, TRegion> | AsNewLanguage<TPage, TRegion>): page is AsNewLanguage<TPage, TRegion>;
|
|
188
213
|
}
|
|
189
|
-
type AsRef<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
214
|
+
type AsRef<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsRef.Prop>;
|
|
190
215
|
namespace AsRef {
|
|
191
216
|
type Prop = Extract<Props.Id, 'id' | 'url'>;
|
|
192
217
|
const props: ReadonlyArray<Prop>;
|
|
193
218
|
}
|
|
194
|
-
type AsLink<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
219
|
+
type AsLink<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsLink.Prop>;
|
|
195
220
|
namespace AsLink {
|
|
196
221
|
type Prop = Props.Id | Props.Audit;
|
|
197
222
|
const props: ReadonlyArray<Prop>;
|
|
198
|
-
function from(data:
|
|
223
|
+
function from(data: LegacyData): AsLink;
|
|
199
224
|
}
|
|
200
|
-
type AsPreview<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
225
|
+
type AsPreview<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsPreview.Prop>;
|
|
201
226
|
namespace AsPreview {
|
|
202
227
|
type Prop = Props.Id | Extract<Props.Content, 'preview'> | Props.Links | Props.Audit;
|
|
203
228
|
const props: ReadonlyArray<Prop>;
|
|
204
|
-
function from(data:
|
|
205
|
-
function filter(data:
|
|
229
|
+
function from(data: LegacyData): AsPreview;
|
|
230
|
+
function filter(data: LegacyData | AsPreview): data is Preview;
|
|
231
|
+
}
|
|
232
|
+
type AsContent<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, AsContent.Prop>;
|
|
233
|
+
namespace AsContent {
|
|
234
|
+
type Prop = Exclude<Props.All, Props.Backup>;
|
|
235
|
+
const props: ReadonlyArray<Prop>;
|
|
206
236
|
}
|
|
207
237
|
type AsGroup<TPage extends Page = Page, TRegion extends string = string> = {
|
|
208
238
|
group: {
|
|
@@ -214,10 +244,10 @@ export declare namespace Page {
|
|
|
214
244
|
preset?: string;
|
|
215
245
|
instances: AsGroup.Instance[];
|
|
216
246
|
};
|
|
217
|
-
page?:
|
|
247
|
+
page?: FlattenedData<TPage, TRegion>;
|
|
218
248
|
};
|
|
219
249
|
namespace AsGroup {
|
|
220
|
-
type Instance<TPage extends Page = Page, TRegion extends string = string> = Pick<
|
|
250
|
+
type Instance<TPage extends Page = Page, TRegion extends string = string> = Pick<LegacyData<TPage, TRegion>, Instance.Prop>;
|
|
221
251
|
namespace Instance {
|
|
222
252
|
type Prop = Extract<Props.Id, 'id' | 'name' | 'language' | 'url' | 'slug' | 'tags'> | Exclude<Props.Audit, 'publication'>;
|
|
223
253
|
const props: ReadonlyArray<Prop>;
|
|
@@ -230,9 +260,17 @@ export declare namespace Page {
|
|
|
230
260
|
type Content<TPage extends Page = Page<any>> = {
|
|
231
261
|
[key in keyof TPage['content']]: TPage['content'][key] extends Section ? Section.Data<TPage['content'][key]> : TPage['content'][key] extends Optional.Maybe<Block> ? Block.Data.ForOptional<TPage['content'][key]> : never;
|
|
232
262
|
};
|
|
233
|
-
function filter(value: any): value is
|
|
263
|
+
function filter(value: any): value is LegacyData;
|
|
234
264
|
}
|
|
235
|
-
type
|
|
265
|
+
type References = {
|
|
266
|
+
files: Record<Asset.Id, Asset.Linked>;
|
|
267
|
+
pages: Record<Page.Id, Data>;
|
|
268
|
+
collections: Record<Collection.Id, Collection.Data.AsLink>;
|
|
269
|
+
};
|
|
270
|
+
type FlattenedData<TPage extends Page = Page, TRegion extends string = string> = References & {
|
|
271
|
+
data: Data<TPage, TRegion>;
|
|
272
|
+
};
|
|
273
|
+
type LinkedData<TPage extends Page = Page> = Omit<LegacyData<TPage>, 'discover' | 'preview' | 'content' | 'snapshots'> & {
|
|
236
274
|
discover: LinkedData.Discover;
|
|
237
275
|
preview?: LinkedData.Preview<TPage>;
|
|
238
276
|
content: LinkedData.Content<TPage>;
|
package/dist/schema/Page.js
CHANGED
|
@@ -147,6 +147,15 @@ exports.Page = Page;
|
|
|
147
147
|
}
|
|
148
148
|
AsPreview.filter = filter;
|
|
149
149
|
})(AsPreview = Data.AsPreview || (Data.AsPreview = {}));
|
|
150
|
+
let AsContent;
|
|
151
|
+
(function (AsContent) {
|
|
152
|
+
AsContent.props = [
|
|
153
|
+
...Props.id,
|
|
154
|
+
...Props.content,
|
|
155
|
+
...Props.links,
|
|
156
|
+
...Props.audit
|
|
157
|
+
];
|
|
158
|
+
})(AsContent = Data.AsContent || (Data.AsContent = {}));
|
|
150
159
|
let AsGroup;
|
|
151
160
|
(function (AsGroup) {
|
|
152
161
|
let Instance;
|
|
@@ -44,7 +44,7 @@ export declare namespace PageModel {
|
|
|
44
44
|
type SyncArgs = {
|
|
45
45
|
route: PageRoute;
|
|
46
46
|
};
|
|
47
|
-
type TargetArea = Extract<keyof Page.
|
|
47
|
+
type TargetArea = Extract<keyof Page.LegacyData, 'discover' | 'preview' | 'content'>;
|
|
48
48
|
namespace TargetArea {
|
|
49
49
|
type Root = Page.Data.Content<any>;
|
|
50
50
|
type Extraction = {
|
package/dist/schema/PageModel.js
CHANGED
|
@@ -841,7 +841,7 @@ class PageModel {
|
|
|
841
841
|
keywords: field_1.Field.Data.newValue('list')
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
|
-
}, preview: {}, content: {},
|
|
844
|
+
}, preview: {}, content: {}, errors: true, state: 'draft', createdOn: now, updatedOn: now }));
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
exports.PageModel = PageModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tagged } from 'type-fest';
|
|
2
2
|
import { RequiredBy } from '../types';
|
|
3
3
|
import type { Page } from './Page';
|
|
4
|
-
export type PageSnapshot = RequiredBy<Pick<Page.
|
|
4
|
+
export type PageSnapshot = RequiredBy<Pick<Page.LegacyData<any>, Exclude<Page.Data.Props.Id, 'id'> | Page.Data.Props.Content | 'createdOn' | 'updatedOn' | 'changeSetId' | 'publication'>, 'changeSetId'> & {
|
|
5
5
|
id: PageSnapshot.Id;
|
|
6
6
|
};
|
|
7
7
|
export declare namespace PageSnapshot {
|
|
@@ -11,7 +11,7 @@ export declare class CollectionField<TCollection extends Collection = Collection
|
|
|
11
11
|
export declare namespace CollectionField {
|
|
12
12
|
type Value<TCollection extends Collection = Collection> = Value.ForRef<TCollection> | Value.ForInline<TCollection>;
|
|
13
13
|
namespace Value {
|
|
14
|
-
type ForRef<TCollection extends Collection = Collection> = Pick<Collection.
|
|
14
|
+
type ForRef<TCollection extends Collection = Collection> = Pick<Collection.LegacyData<TCollection>, 'id' | 'type'>;
|
|
15
15
|
namespace ForRef {
|
|
16
16
|
function filter<TCollection extends Collection = Collection>(value: any): value is ForRef<TCollection>;
|
|
17
17
|
function toData(value: ForRef): Field.Data.Collection.Ref;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Tagged } from 'type-fest';
|
|
1
2
|
import type { Page } from '../../Page';
|
|
2
3
|
import type { PageQuery } from '../../PageQuery';
|
|
3
4
|
import { Field } from '../index';
|
|
@@ -6,26 +7,27 @@ export declare class DynamicPagesField extends Field<DynamicPagesField> {
|
|
|
6
7
|
readonly types: Page.Type[] | 'all';
|
|
7
8
|
readonly size: number;
|
|
8
9
|
constructor(args: DynamicPagesField.ConstructorArgs);
|
|
9
|
-
get
|
|
10
|
+
get meta(): DynamicPagesField.Schema;
|
|
10
11
|
modify(args: DynamicPagesField.ModifyArgs): DynamicPagesField;
|
|
11
12
|
}
|
|
12
13
|
export declare namespace DynamicPagesField {
|
|
14
|
+
type Hash = Tagged<string, 'funnel.DynamicPages.hash'>;
|
|
13
15
|
type Query = Pick<PageQuery.Data, 'types' | 'sort' | 'excludeIds' | 'limit'>;
|
|
14
16
|
type SavedQuery = Pick<Query, 'types' | 'sort'>;
|
|
15
17
|
type Value = SavedQuery & {
|
|
16
|
-
|
|
18
|
+
schema: Schema;
|
|
19
|
+
staticPages?: Field.Data.Page[];
|
|
17
20
|
};
|
|
18
21
|
namespace Value {
|
|
19
22
|
function fromData(data: Field.Data<DynamicPagesField> | undefined): Value | undefined;
|
|
20
23
|
function toData(value: Value): Field.Data<DynamicPagesField>;
|
|
21
24
|
function coerceData(value: Value | undefined): Field.Data<DynamicPagesField> | undefined;
|
|
25
|
+
function hash({ value }: Field.Data<DynamicPagesField>): Hash;
|
|
22
26
|
}
|
|
23
27
|
type LinkedValue = {
|
|
24
|
-
|
|
25
|
-
pages: Array<Page.LinkedData.AsPreview>;
|
|
28
|
+
pages: Page.LinkedData.AsPreview[];
|
|
26
29
|
};
|
|
27
30
|
type Schema = {
|
|
28
|
-
types: Page.Type[] | 'all';
|
|
29
31
|
size: number;
|
|
30
32
|
};
|
|
31
33
|
type ConstructorArgs = Field.ConstructorArgs & {
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.DynamicPagesField = void 0;
|
|
4
15
|
const index_1 = require("../index");
|
|
@@ -13,9 +24,8 @@ class DynamicPagesField extends index_1.Field {
|
|
|
13
24
|
this.types = (_a = args.types) !== null && _a !== void 0 ? _a : 'all';
|
|
14
25
|
this.size = args.size;
|
|
15
26
|
}
|
|
16
|
-
get
|
|
27
|
+
get meta() {
|
|
17
28
|
return {
|
|
18
|
-
types: this.types,
|
|
19
29
|
size: this.size
|
|
20
30
|
};
|
|
21
31
|
}
|
|
@@ -46,5 +56,11 @@ exports.DynamicPagesField = DynamicPagesField;
|
|
|
46
56
|
: toData(value);
|
|
47
57
|
}
|
|
48
58
|
Value.coerceData = coerceData;
|
|
59
|
+
function hash({ value }) {
|
|
60
|
+
const { staticPages } = value, query = __rest(value, ["staticPages"]);
|
|
61
|
+
const staticPageIds = staticPages === null || staticPages === void 0 ? void 0 : staticPages.map(page => page.value.id);
|
|
62
|
+
return JSON.stringify(Object.assign(Object.assign({}, query), { staticPageIds }));
|
|
63
|
+
}
|
|
64
|
+
Value.hash = hash;
|
|
49
65
|
})(Value = DynamicPagesField.Value || (DynamicPagesField.Value = {}));
|
|
50
66
|
})(DynamicPagesField || (exports.DynamicPagesField = DynamicPagesField = {}));
|
|
@@ -13,7 +13,7 @@ export declare namespace PageField {
|
|
|
13
13
|
type Link = PageField<'link'>;
|
|
14
14
|
type Preview = PageField<'preview'>;
|
|
15
15
|
type Full = PageField<'full'>;
|
|
16
|
-
type Value<TScope extends Scope = Scope> = Pick<Page.
|
|
16
|
+
type Value<TScope extends Scope = Scope> = Pick<Page.LegacyData, 'id' | 'type'> & {
|
|
17
17
|
scope: TScope;
|
|
18
18
|
};
|
|
19
19
|
namespace Value {
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './Fields';
|
|
|
10
10
|
export * from './Form';
|
|
11
11
|
export * from './LinkedCollectionModel';
|
|
12
12
|
export * from './LinkedData';
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './LinkedPage';
|
|
14
14
|
export * from './Optional';
|
|
15
15
|
export * from './Page';
|
|
16
16
|
export * from './PageModel';
|
package/dist/schema/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __exportStar(require("./Fields"), exports);
|
|
|
26
26
|
__exportStar(require("./Form"), exports);
|
|
27
27
|
__exportStar(require("./LinkedCollectionModel"), exports);
|
|
28
28
|
__exportStar(require("./LinkedData"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./LinkedPage"), exports);
|
|
30
30
|
__exportStar(require("./Optional"), exports);
|
|
31
31
|
__exportStar(require("./Page"), exports);
|
|
32
32
|
__exportStar(require("./PageModel"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrackedValue = void 0;
|
|
4
|
+
// extensions
|
|
5
|
+
var TrackedValue;
|
|
6
|
+
(function (TrackedValue) {
|
|
7
|
+
// constants
|
|
8
|
+
const keys = new Set(['changed', 'previous', 'current']);
|
|
9
|
+
// filters
|
|
10
|
+
function filter(value) {
|
|
11
|
+
return !!value && typeof value === 'object' && !Array.isArray(value)
|
|
12
|
+
&& Object.keys(value).every(key => keys.has(key))
|
|
13
|
+
&& 'changed' in value && typeof value.changed === 'boolean'
|
|
14
|
+
&& 'previous' in value
|
|
15
|
+
&& 'current' in value;
|
|
16
|
+
}
|
|
17
|
+
TrackedValue.filter = filter;
|
|
18
|
+
})(TrackedValue || (exports.TrackedValue = TrackedValue = {}));
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -27,5 +27,6 @@ __exportStar(require("./Provider"), exports);
|
|
|
27
27
|
__exportStar(require("./RequiredBy"), exports);
|
|
28
28
|
__exportStar(require("./Result"), exports);
|
|
29
29
|
__exportStar(require("./Timestamp"), exports);
|
|
30
|
+
__exportStar(require("./TrackedValue"), exports);
|
|
30
31
|
__exportStar(require("./Transform"), exports);
|
|
31
32
|
__exportStar(require("./UndefinedToNull"), exports);
|
package/dist/ui/Placement.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Frame, Insets, Rect, Size } from './geometry';
|
|
2
|
+
import { TrackedValue } from '../types/TrackedValue';
|
|
2
3
|
export type Placement = Placement.Side | `${Placement.Side}-${Placement.Anchor}`;
|
|
3
4
|
export declare namespace Placement {
|
|
4
5
|
type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -15,7 +16,9 @@ export declare namespace Placement {
|
|
|
15
16
|
anchorRect: Rect;
|
|
16
17
|
anchorOffset?: number;
|
|
17
18
|
placement: Placement;
|
|
18
|
-
contentSize: Readonly<Size
|
|
19
|
+
contentSize: Readonly<Size> | Readonly<TrackedValue<Size>>;
|
|
20
|
+
viewportSize: Readonly<Size> | Readonly<TrackedValue<Size>>;
|
|
21
|
+
previousFrame?: Partial<Frame>;
|
|
19
22
|
};
|
|
20
|
-
function forContent({ containerRect, containerPadding, anchorRect, anchorOffset, placement, contentSize }: ForContentArgs): Partial<Frame>;
|
|
23
|
+
function forContent({ containerRect, containerPadding, anchorRect, anchorOffset, placement, contentSize: trackedContentSize, viewportSize: trackedViewportSize, previousFrame }: ForContentArgs): Partial<Frame>;
|
|
21
24
|
}
|