@aglyn/aglyn 1.0.0-beta.154 → 1.0.0-beta.156

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/aglyn",
3
- "version": "1.0.0-beta.154",
3
+ "version": "1.0.0-beta.156",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -33,15 +33,15 @@
33
33
  "./package.json": "./package.json"
34
34
  },
35
35
  "dependencies": {
36
- "@aglyn/shared-data-enums": "1.0.0-beta.154",
37
- "@aglyn/shared-data-mdi": "1.0.0-beta.154",
38
- "@aglyn/shared-data-types": "1.0.0-beta.154",
39
- "@aglyn/shared-util-email": "1.0.0-beta.154",
40
- "@aglyn/shared-util-http": "1.0.0-beta.154",
41
- "@aglyn/shared-util-logger": "1.0.0-beta.154",
42
- "@aglyn/shared-util-timestamp": "1.0.0-beta.154",
43
- "@aglyn/shared-util-tools": "1.0.0-beta.154",
44
- "@aglyn/shared-util-vendor": "1.0.0-beta.154",
36
+ "@aglyn/shared-data-enums": "1.0.0-beta.156",
37
+ "@aglyn/shared-data-mdi": "1.0.0-beta.156",
38
+ "@aglyn/shared-data-types": "1.0.0-beta.156",
39
+ "@aglyn/shared-util-email": "1.0.0-beta.156",
40
+ "@aglyn/shared-util-http": "1.0.0-beta.156",
41
+ "@aglyn/shared-util-logger": "1.0.0-beta.156",
42
+ "@aglyn/shared-util-timestamp": "1.0.0-beta.156",
43
+ "@aglyn/shared-util-tools": "1.0.0-beta.156",
44
+ "@aglyn/shared-util-vendor": "1.0.0-beta.156",
45
45
  "@data-driven-forms/react-form-renderer": "^4.2.0",
46
46
  "@msgpack/msgpack": "^3.1.3",
47
47
  "@types/unist": "^3.0.3",
@@ -413,7 +413,9 @@ export declare function resolveEntryCategoryName(entry: Pick<CollectionEntryReco
413
413
  * drift: the same entry has to read the same way whether the author bound the
414
414
  * tokens by hand or let the server fill the block in.
415
415
  */
416
- export declare function collectionEntryMetaValues(entry: CollectionEntryRecord, categories?: readonly CollectionCategory[], dateFormat?: CollectionEntryDateFormat): {
416
+ export declare function collectionEntryMetaValues(entry: CollectionEntryRecord, categories?: readonly CollectionCategory[], dateFormat?: CollectionEntryDateFormat,
417
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
418
+ timeZone?: string): {
417
419
  date: string;
418
420
  author: string;
419
421
  category: string;
@@ -448,7 +450,9 @@ export declare function collectionEntryAuthorValues(entry: CollectionEntryRecord
448
450
  * entries block. `entry.url` resolves to the entry's auto-route so links
449
451
  * (`Read more`, titles) work without hardcoding the collection slug.
450
452
  */
451
- export declare function collectionEntryTokens(entry: CollectionEntryRecord, collectionSlug: string, categories?: CollectionCategory[]): Record<string, string>;
453
+ export declare function collectionEntryTokens(entry: CollectionEntryRecord, collectionSlug: string, categories?: CollectionCategory[],
454
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
455
+ timeZone?: string): Record<string, string>;
452
456
  /**
453
457
  * Category/tag membership check (AGL-582), shared by the Collection entries
454
458
  * filter props and the query-less list surfaces. Matching is trimmed and
@@ -684,7 +688,9 @@ export declare function buildCollectionCategoryLinks(options: {
684
688
  * the date especially): a suggestion for a post is the same post as the card
685
689
  * below it and must not be able to disagree with it about its date.
686
690
  */
687
- export declare function buildCollectionSearchIndex(entries: readonly CollectionEntryRecord[], collectionSlug: string, categories?: readonly CollectionCategory[]): CollectionEntrySearchItem[];
691
+ export declare function buildCollectionSearchIndex(entries: readonly CollectionEntryRecord[], collectionSlug: string, categories?: readonly CollectionCategory[],
692
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
693
+ timeZone?: string): CollectionEntrySearchItem[];
688
694
  /**
689
695
  * Does this tree render the collection `collectionSlug` away from the
690
696
  * collection's own routes?
@@ -728,7 +734,9 @@ export declare function nodesRenderCollection(nodes: Record<NodeId, AglynNodeSch
728
734
  * matching entries renders zero rows — never the unsubstituted template.
729
735
  * - Inputs are never mutated; template nodes stay in the map unreferenced.
730
736
  */
731
- export declare function expandCollectionEntries<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, sourcesBySlug: Record<string, CollectionEntriesSource | undefined>, defaultSlug?: string): Record<NodeId, N>;
737
+ export declare function expandCollectionEntries<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, sourcesBySlug: Record<string, CollectionEntriesSource | undefined>, defaultSlug?: string,
738
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
739
+ timeZone?: string): Record<NodeId, N>;
732
740
  /**
733
741
  * Category Pills blocks (AGL-1321): stamps each `collectionCategories` node
734
742
  * with its collection's pill row as a serializable `items` prop the component
@@ -763,7 +771,9 @@ export declare function expandCollectionCategories<N extends AglynNodeSchema = A
763
771
  * and a collection with no entries leaves its block untouched, so the
764
772
  * component's besigner affordance and its empty site render both stand.
765
773
  */
766
- export declare function expandCollectionSearch<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, sourcesBySlug: Record<string, CollectionEntriesSource | undefined>, defaultSlug?: string): Record<NodeId, N>;
774
+ export declare function expandCollectionSearch<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, sourcesBySlug: Record<string, CollectionEntriesSource | undefined>, defaultSlug?: string,
775
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
776
+ timeZone?: string): Record<NodeId, N>;
767
777
  /**
768
778
  * Entry Meta blocks (AGL-1385): stamps each `collectionEntryMeta` node with
769
779
  * the routed entry's date, category and tags — the same server-stamped shape
@@ -808,7 +818,9 @@ export declare function expandCollectionSearch<N extends AglynNodeSchema = Aglyn
808
818
  *
809
819
  * Inputs are never mutated.
810
820
  */
811
- export declare function expandCollectionEntryMeta<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, entry: CollectionEntryRecord | null | undefined, categories?: readonly CollectionCategory[]): Record<NodeId, N>;
821
+ export declare function expandCollectionEntryMeta<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, entry: CollectionEntryRecord | null | undefined, categories?: readonly CollectionCategory[],
822
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
823
+ timeZone?: string): Record<NodeId, N>;
812
824
  /**
813
825
  * Fill Entry Author cards from the routed entry's author record (AGL-2486),
814
826
  * on the same terms {@link expandCollectionEntryMeta} fills the byline:
@@ -921,5 +933,7 @@ export declare function selectRelatedEntries(entries: CollectionEntryRecord[], c
921
933
  * stay untouched, so the component's sample cards (editing surfaces) or its
922
934
  * empty site render apply. Inputs are never mutated.
923
935
  */
924
- export declare function expandCollectionRelated<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, source: CollectionEntriesSource | undefined, currentEntry: CollectionEntryRecord | null | undefined): Record<NodeId, N>;
936
+ export declare function expandCollectionRelated<N extends AglynNodeSchema = AglynNodeSchema>(nodes: Record<NodeId, N>, source: CollectionEntriesSource | undefined, currentEntry: CollectionEntryRecord | null | undefined,
937
+ /** The site's zone (AGL-3237); UTC when a site has not named one. */
938
+ timeZone?: string): Record<NodeId, N>;
925
939
  export default expandCollectionEntries;
@@ -271,11 +271,11 @@ categories) {
271
271
  * Extracted so the token map and {@link expandCollectionEntryMeta} cannot
272
272
  * drift: the same entry has to read the same way whether the author bound the
273
273
  * tokens by hand or let the server fill the block in.
274
- */ export function collectionEntryMetaValues(entry, categories, dateFormat) {
274
+ */ export function collectionEntryMetaValues(entry, categories, dateFormat, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
275
275
  var _resolveEntryCategoryName, _entry_tags;
276
276
  var _entry_author;
277
277
  return {
278
- date: formatCollectionEntryDate(entry.publishedAt, dateFormat),
278
+ date: formatCollectionEntryDate(entry.publishedAt, dateFormat, undefined, timeZone),
279
279
  // The per-entry byline the editor already collects (AGL-686). It was
280
280
  // reachable in the entry's JSON-LD and nowhere on the page, which is what
281
281
  // made the frame's byline unauthorable (AGL-1459).
@@ -340,9 +340,9 @@ categories) {
340
340
  * globally on entry-template screens and per-clone inside the Collection
341
341
  * entries block. `entry.url` resolves to the entry's auto-route so links
342
342
  * (`Read more`, titles) work without hardcoding the collection slug.
343
- */ export function collectionEntryTokens(entry, collectionSlug, categories) {
343
+ */ export function collectionEntryTokens(entry, collectionSlug, categories, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
344
344
  var _entry_collectionSlug, _entry_title, _entry_excerpt, _entry_body, _entry_coverImage, _entry_coverVideo, _entry_slug, _entry_slug1, _entry_collectionName;
345
- const meta = collectionEntryMetaValues(entry, categories);
345
+ const meta = collectionEntryMetaValues(entry, categories, undefined, timeZone);
346
346
  const author = collectionEntryAuthorValues(entry);
347
347
  // The entry's OWN collection wins over the routed one (AGL-2518) — see
348
348
  // `CollectionEntryRecord.collectionSlug`. Unset on every single-collection
@@ -749,7 +749,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
749
749
  * clones. Through the same three resolvers Related posts uses (AGL-1926 for
750
750
  * the date especially): a suggestion for a post is the same post as the card
751
751
  * below it and must not be able to disagree with it about its date.
752
- */ export function buildCollectionSearchIndex(entries, collectionSlug, categories) {
752
+ */ export function buildCollectionSearchIndex(entries, collectionSlug, categories, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
753
753
  return entries.map((entry)=>{
754
754
  var _entry_title, _entry_excerpt, _entry_collectionSlug;
755
755
  var _entry_publishedAt;
@@ -760,7 +760,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
760
760
  }, entry.slug ? {
761
761
  url: `/${((_entry_collectionSlug = entry.collectionSlug) != null ? _entry_collectionSlug : '').trim() || collectionSlug}/${entry.slug}`
762
762
  } : {}, ((_entry_publishedAt = entry.publishedAt) == null ? void 0 : _entry_publishedAt.seconds) ? {
763
- date: formatCollectionEntryDate(entry.publishedAt)
763
+ date: formatCollectionEntryDate(entry.publishedAt, undefined, undefined, timeZone)
764
764
  } : {}, categoryName ? {
765
765
  category: categoryName
766
766
  } : {});
@@ -838,7 +838,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
838
838
  * collection must never take a screen down). A known collection with no
839
839
  * matching entries renders zero rows — never the unsubstituted template.
840
840
  * - Inputs are never mutated; template nodes stay in the map unreferenced.
841
- */ export function expandCollectionEntries(nodes, sourcesBySlug, defaultSlug) {
841
+ */ export function expandCollectionEntries(nodes, sourcesBySlug, defaultSlug, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
842
842
  const containers = Object.entries(nodes).filter(([, node])=>(node == null ? void 0 : node.componentId) === COLLECTION_ENTRIES_COMPONENT_ID);
843
843
  if (!containers.length) return nodes;
844
844
  const next = _extends({}, nodes);
@@ -955,13 +955,13 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
955
955
  // binding under a chosen format, which is the case this exists for.
956
956
  for (const [cloneId, cloneNode] of Object.entries(cloned)){
957
957
  var _cloneNode_props;
958
- const fill = (cloneNode == null ? void 0 : cloneNode.componentId) === COLLECTION_ENTRY_META_COMPONENT_ID ? entryMetaFill(cloneNode, entry, source.categories) : (cloneNode == null ? void 0 : cloneNode.componentId) === COLLECTION_ENTRY_AUTHOR_COMPONENT_ID ? entryAuthorFill(cloneNode, entry) : undefined;
958
+ const fill = (cloneNode == null ? void 0 : cloneNode.componentId) === COLLECTION_ENTRY_META_COMPONENT_ID ? entryMetaFill(cloneNode, entry, source.categories, timeZone) : (cloneNode == null ? void 0 : cloneNode.componentId) === COLLECTION_ENTRY_AUTHOR_COMPONENT_ID ? entryAuthorFill(cloneNode, entry) : undefined;
959
959
  if (!fill || !Object.keys(fill).length) continue;
960
960
  cloned[cloneId] = _extends({}, cloneNode, {
961
961
  props: _extends({}, (_cloneNode_props = cloneNode.props) != null ? _cloneNode_props : {}, fill)
962
962
  });
963
963
  }
964
- Object.assign(next, resolveNamedTokens(cloned, collectionEntryTokens(entry, source.slug, source.categories)));
964
+ Object.assign(next, resolveNamedTokens(cloned, collectionEntryTokens(entry, source.slug, source.categories, timeZone)));
965
965
  });
966
966
  // Search (AGL-1516): the block's search box filters CLIENT-SIDE over the
967
967
  // entries this expansion just rendered — the ISR-cached page is the whole
@@ -973,7 +973,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
973
973
  const searchEnabled = Boolean((_container_props7 = container.props) == null ? void 0 : _container_props7.search);
974
974
  next[containerId] = searchEnabled ? _extends({}, container, {
975
975
  props: _extends({}, container.props, {
976
- searchIndex: buildCollectionSearchIndex(windowed, source.slug, source.categories),
976
+ searchIndex: buildCollectionSearchIndex(windowed, source.slug, source.categories, timeZone),
977
977
  // How many entries the window above was drawn FROM (AGL-1516).
978
978
  //
979
979
  // The component has to tell the reader whether a miss means "not
@@ -1059,7 +1059,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1059
1059
  * template would otherwise be stamped once per card. Nodes are never mutated,
1060
1060
  * and a collection with no entries leaves its block untouched, so the
1061
1061
  * component's besigner affordance and its empty site render both stand.
1062
- */ export function expandCollectionSearch(nodes, sourcesBySlug, defaultSlug) {
1062
+ */ export function expandCollectionSearch(nodes, sourcesBySlug, defaultSlug, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
1063
1063
  const containers = Object.entries(nodes).filter(([id, node])=>(node == null ? void 0 : node.componentId) === COLLECTION_SEARCH_COMPONENT_ID && !id.startsWith(COLLECTION_ENTRIES_NODE_ID_PREFIX));
1064
1064
  if (!containers.length) return nodes;
1065
1065
  const next = _extends({}, nodes);
@@ -1078,7 +1078,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1078
1078
  if (!source.entries.length) continue;
1079
1079
  next[containerId] = _extends({}, container, {
1080
1080
  props: _extends({}, container.props, {
1081
- searchIndex: buildCollectionSearchIndex(source.entries, source.slug, source.categories),
1081
+ searchIndex: buildCollectionSearchIndex(source.entries, source.slug, source.categories, timeZone),
1082
1082
  searchTotal: source.entries.length
1083
1083
  }, collectionSourceIsBounded(source) ? {
1084
1084
  searchCapped: true
@@ -1130,14 +1130,14 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1130
1130
  * typed still wins, unchanged.
1131
1131
  *
1132
1132
  * Inputs are never mutated.
1133
- */ export function expandCollectionEntryMeta(nodes, entry, categories) {
1133
+ */ export function expandCollectionEntryMeta(nodes, entry, categories, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
1134
1134
  if (!entry) return nodes;
1135
1135
  const containers = Object.entries(nodes).filter(([id, node])=>(node == null ? void 0 : node.componentId) === COLLECTION_ENTRY_META_COMPONENT_ID && !id.startsWith(COLLECTION_ENTRIES_NODE_ID_PREFIX));
1136
1136
  if (!containers.length) return nodes;
1137
1137
  const next = _extends({}, nodes);
1138
1138
  for (const [containerId, container] of containers){
1139
1139
  var _container_props;
1140
- const filled = entryMetaFill(container, entry, categories);
1140
+ const filled = entryMetaFill(container, entry, categories, timeZone);
1141
1141
  if (!Object.keys(filled).length) continue;
1142
1142
  next[containerId] = _extends({}, container, {
1143
1143
  props: _extends({}, (_container_props = container.props) != null ? _container_props : {}, filled)
@@ -1156,7 +1156,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1156
1156
  *
1157
1157
  * Returns only the keys that change; an empty object means "leave this node
1158
1158
  * exactly as authored".
1159
- */ function entryMetaFill(container, entry, categories) {
1159
+ */ function entryMetaFill(container, entry, categories, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
1160
1160
  {
1161
1161
  var _container_props, _ref, _props_author;
1162
1162
  var _entry_author;
@@ -1164,7 +1164,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1164
1164
  // Per node: the format is a prop, so two blocks on one template can read
1165
1165
  // their dates differently.
1166
1166
  const dateFormat = normalizeCollectionEntryDateFormat(props['dateFormat']);
1167
- const values = collectionEntryMetaValues(entry, categories, dateFormat);
1167
+ const values = collectionEntryMetaValues(entry, categories, dateFormat, timeZone);
1168
1168
  const filled = {};
1169
1169
  for (const key of [
1170
1170
  'date',
@@ -1376,7 +1376,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1376
1376
  * markup). Runs only on entry renders; without an entry context the nodes
1377
1377
  * stay untouched, so the component's sample cards (editing surfaces) or its
1378
1378
  * empty site render apply. Inputs are never mutated.
1379
- */ export function expandCollectionRelated(nodes, source, currentEntry) {
1379
+ */ export function expandCollectionRelated(nodes, source, currentEntry, /** The site's zone (AGL-3237); UTC when a site has not named one. */ timeZone) {
1380
1380
  if (!source || !currentEntry) return nodes;
1381
1381
  const containers = Object.entries(nodes).filter(([, node])=>(node == null ? void 0 : node.componentId) === COLLECTION_RELATED_COMPONENT_ID);
1382
1382
  if (!containers.length) return nodes;
@@ -1397,7 +1397,7 @@ const POSITIVE_INTEGER = /^[1-9]\d*$/;
1397
1397
  title: (_entry_title = entry.title) != null ? _entry_title : '',
1398
1398
  url: `/${source.slug}/${(_entry_slug = entry.slug) != null ? _entry_slug : ''}`
1399
1399
  }, ((_entry_publishedAt = entry.publishedAt) == null ? void 0 : _entry_publishedAt.seconds) ? {
1400
- date: formatCollectionEntryDate(entry.publishedAt, dateFormat)
1400
+ date: formatCollectionEntryDate(entry.publishedAt, dateFormat, undefined, timeZone)
1401
1401
  } : {}, entry.excerpt ? {
1402
1402
  excerpt: entry.excerpt
1403
1403
  } : {}, entry.coverImage ? {