@mosetta/core 0.0.13 → 0.0.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mosetta/core
2
2
 
3
+ ## 0.0.15
4
+
5
+ ## 0.0.14
6
+
7
+ ### Patch Changes
8
+
9
+ - Drafts and looks with draft blocks. A tile palette's build can be a DRAFT — `mosetta push --draft`:
10
+ no version spent, the site unchanged, the palette keeps its last ten. Any page of the site opened
11
+ with `?previewOverride=<brand>.<block>:<draft>` shows that block from the draft, whatever version
12
+ the page names, its server side included — for the site's editors, or anybody with a shared link;
13
+ `<brand>:<draft>` overrides every block of it. The runner lays the blocks asked for over the
14
+ palette for that request only (a tile host may now be merged with an OVERLAY over another), and the
15
+ site leads them to their draft where it aligns every page.
16
+
3
17
  ## 0.0.13
4
18
 
5
19
  ## 0.0.12
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mosetta/core",
3
3
  "description": "mosetta core models: tile references, blueprint node trees, pages, the rule a site's tile hosts merge by, and the application error hierarchy. Framework-agnostic.",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "exports": {
@@ -14,6 +14,9 @@
14
14
  // - a tile of a host other than the primary is taken only with its TILE INTEGRITY: the bytes the
15
15
  // factory and the browser load from there are checked against it. A tile palette descriptor and a
16
16
  // fragment name no artifact of their own and need none.
17
+ // - an OVERLAY (a draft build laid over a tile host for one look, ADR-0076) is taken over the merge:
18
+ // its entities of the brands its host owns replace those under the same id and join the rest —
19
+ // with their integrity, like any host's but the primary's.
17
20
  /** what the merge reads of a tile descriptor — the factory's and the editor's carry more */
18
21
  export interface ITileDescriptorLike {
19
22
  readonly id: string;
@@ -43,6 +46,8 @@ export interface ITileHostDescriptors<T extends ITileDescriptorLike = ITileDescr
43
46
  readonly key: string;
44
47
  readonly public: readonly T[];
45
48
  readonly private: readonly T[];
49
+ /** an overlay: the key of the tile host it is laid over — taken after every other part */
50
+ readonly over?: string;
46
51
  }
47
52
 
48
53
  export interface IMergedDescriptors<T extends ITileDescriptorLike = ITileDescriptorLike> {
@@ -71,7 +76,9 @@ function ownersOf(parts: readonly ITileHostDescriptors<ITileDescriptorLike>[]):
71
76
  return owners;
72
77
  }
73
78
 
74
- export function mergeTileHosts<T extends ITileDescriptorLike>(parts: readonly ITileHostDescriptors<T>[]): IMergedTileHosts<T> {
79
+ export function mergeTileHosts<T extends ITileDescriptorLike>(all: readonly ITileHostDescriptors<T>[]): IMergedTileHosts<T> {
80
+ const parts = all.filter((part) => part.over === undefined);
81
+ const overlays = all.filter((part) => part.over !== undefined);
75
82
  const host = parts[0]?.key;
76
83
  const owners = ownersOf(parts);
77
84
  const warnings: string[] = [];
@@ -106,6 +113,22 @@ export function mergeTileHosts<T extends ITileDescriptorLike>(parts: readonly IT
106
113
  tileHostOf.set(entity.id, part.key);
107
114
  }
108
115
  }
116
+ for (const overlay of overlays) {
117
+ for (const entity of pick(overlay)) {
118
+ if (!entity || typeof entity.id !== 'string') continue;
119
+ const ns = brandOfId(entity.id);
120
+ if (ns !== SHARED_NAMESPACE && (!ns || owners.get(ns) !== overlay.over)) {
121
+ say(`${overlay.key}: ${entity.id} is no tile of ${String(overlay.over)} — not taken`);
122
+ continue;
123
+ }
124
+ if (!vouched(entity)) {
125
+ say(`${overlay.key}: ${entity.id} names no integrity — not taken`);
126
+ continue;
127
+ }
128
+ taken.set(entity.id, { ...entity, provider: overlay.key });
129
+ tileHostOf.set(entity.id, overlay.key);
130
+ }
131
+ }
109
132
  return { entities: [...taken.values()], tileHostOf };
110
133
  };
111
134
  return { public: side((p) => p.public), private: side((p) => p.private), warnings };