@eldrajs/theme-core 0.3.0 → 0.3.2

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
@@ -5,6 +5,15 @@ Release-please writes the generated notes from commit messages and does not repl
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ - **Company facts in `Organization`, alternate names in `WebSite`.** `buildOrganizationLd` takes
9
+ optional `legalName`, `taxID` (the kennitala in Iceland) and `address` (written as a
10
+ `PostalAddress`, left out when every part is empty); `buildWebSiteLd` takes an optional
11
+ `alternateName` list, which Google weighs when it picks a site name.
12
+
13
+ - **`buildToken` client option (WS-403).** `createEldraClient({ buildToken })` sends
14
+ `X-Eldra-Build-Token` on every read; pass a read-only build token (`eldra_bld_…`, Studio →
15
+ Settings → Developers → Build tokens), never the deploy token. Server and build only.
16
+
8
17
  - **`createAnalytics`, `normalizeAnalyticsProps`, `truncateUtf8`.** Framework-free custom-event layer
9
18
  over the Eldra tracker's `window.eldra('event', ...)`: props stringified and cut to the platform's
10
19
  limits, events queued (50) until the script loads, a no-op when disabled, `pageview` rejected.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ColorLiteral, ColorSelection, ContainerOverride, ContainerPreset, CssTo
2
2
  import { a as buildDynamicRoutePath, c as parseDynamicRoutePattern, d as resolvePagePath, i as RouteTemplateLike, l as resolveRoute, n as MAX_DYNAMIC_ROUTE_PATTERN_BYTES, o as catalogRouteTarget, r as ParsedDynamicRoutePattern, s as matchDynamicRoutePattern, t as DynamicRouteResolution, u as PageLike } from "./dynamicRoute-pRTBoYT6.js";
3
3
  import { a as ImageFraming, c as focalBand, d as imageFramingAttrs, f as imageFramingStyle, h as unscaledFrameRect, i as IMAGE_FRAMING_MIN_ZOOM, l as framingDrag, m as parseImageFramingValueAttr, n as FrameRect, o as clampFocal, p as normalizeImageFraming, r as IMAGE_FRAMING_MAX_ZOOM, s as clampImageFraming, t as DEFAULT_IMAGE_FRAMING, u as framingZoom } from "./imageFraming-BUZ-yqho.js";
4
4
  import { StegaMeta, decodeStega, encodeStega, stripStega } from "./stega.js";
5
- import { C as ResolveEntryListBody, S as PageMeta, _ as EldraClientOptions, a as TemplateLayoutDocument, b as EntryList, c as TemplateLayoutRenderNode, d as CatalogDoc, f as CatalogList, g as EldraClientError, h as EldraClient, i as TemplateLayoutContext, l as buildTemplateBlockRenames, m as EldraCatalogReader, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, p as CatalogQuery, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel, v as EldraRetryOptions, x as EntryQuery, y as EntryDoc } from "./templateLayout-MjNs0gbF.js";
5
+ import { C as ResolveEntryListBody, S as PageMeta, _ as EldraClientOptions, a as TemplateLayoutDocument, b as EntryList, c as TemplateLayoutRenderNode, d as CatalogDoc, f as CatalogList, g as EldraClientError, h as EldraClient, i as TemplateLayoutContext, l as buildTemplateBlockRenames, m as EldraCatalogReader, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, p as CatalogQuery, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel, v as EldraRetryOptions, x as EntryQuery, y as EntryDoc } from "./templateLayout-7rT_TH_E.js";
6
6
  import { A as generateLayoutCss, C as Responsive, D as WidthLength, E as Spacing, F as resolveLayoutBreakpoints, I as resolveLayoutDocument, L as validateLayoutDocument, M as layoutNodeClass, N as layoutRenderNodeId, O as activeLayoutBreakpoint, P as normalizeLayoutDocument, S as ResolvedLayoutStyle, T as SlotValidationContext, _ as LayoutValidationError, a as LAYOUT_BREAKPOINTS, b as ResolvedLayoutDocument, c as LayoutBreakpoints, d as LayoutNode, f as LayoutRenderBlockNode, g as LayoutValidationCode, h as LayoutStyle, i as EDIT_MODE_HIDDEN_OPACITY, j as hiddenLayoutBreakpoints, k as createLayoutRenderModel, l as LayoutContainerNode, m as LayoutRenderNode, n as CssLength, o as LayoutBlockNode, p as LayoutRenderModel, r as DEFAULT_LAYOUT_BREAKPOINTS, s as LayoutBreakpoint, t as BlockSlotDefinition, u as LayoutDocument, v as LayoutValidationIssue, w as SizingLength, x as ResolvedLayoutNode, y as NormalizedLayoutResult } from "./layout-CWq_v6ws.js";
7
7
  import { a as RichTextRenderStateChange, c as NegotiatedEditorCapabilities, d as PreviewRouterMessageType, f as createPreviewMessageRouter, i as RichTextFieldIdentity, l as PREVIEW_ROUTER_MESSAGE_TYPES, n as OverlayRuntime, o as classifyBeforeInput, r as OverlayRuntimeOptions, s as createOverlayRuntime, t as BeforeInputClassification, u as PreviewMessageRouter } from "./overlay-Bgi0tIbN.js";
8
8
  import { a as ReusableComponentRevision, i as ReusableComponentResolver, n as ReusableComponentPlacement, o as ReusableRenderIdentity, r as ReusableComponentProjection, s as createProjectionResolver, t as ReusableComponentBinding } from "./reusableExpansion-CXvs_ckx.js";
@@ -790,9 +790,21 @@ export declare function buildItemListLd(items: readonly {
790
790
  url: string;
791
791
  name: string;
792
792
  }[]): JsonLd;
793
+ export interface PostalAddressLdInput {
794
+ streetAddress?: string | null;
795
+ postalCode?: string | null;
796
+ addressLocality?: string | null;
797
+ /** ISO 3166-1 alpha-2, e.g. `IS`. */
798
+ addressCountry?: string | null;
799
+ }
793
800
  export interface OrganizationLdInput {
794
801
  name: string;
795
802
  url: string;
803
+ /** The registered name, e.g. `Eldra Tech ehf.`, when it differs from `name`. */
804
+ legalName?: string | null;
805
+ /** The company's registration or tax number; in Iceland the kennitala. */
806
+ taxID?: string | null;
807
+ address?: PostalAddressLdInput | null;
796
808
  logo?: string | null;
797
809
  sameAs?: readonly string[];
798
810
  contact?: {
@@ -803,6 +815,8 @@ export interface OrganizationLdInput {
803
815
  export declare function buildOrganizationLd(input: OrganizationLdInput): JsonLd;
804
816
  export interface WebSiteLdInput {
805
817
  name: string;
818
+ /** Other names people know the site by, e.g. its domain; Google weighs them when picking a site name. */
819
+ alternateName?: readonly string[];
806
820
  url: string;
807
821
  /** The site's search page path (`/search`), or `null`/absent when there is none. A SearchAction
808
822
  * pointing at a page that does not exist is worse than none. It is queried with `?q=`. */
package/dist/index.js CHANGED
@@ -531,6 +531,7 @@ function createEldraClient(opts) {
531
531
  const headers = new Headers(init?.headers);
532
532
  headers.set("X-Org-Id", opts.orgId);
533
533
  if (previewToken !== null) headers.set("X-Preview-Token", previewToken);
534
+ if (opts.buildToken) headers.set("X-Eldra-Build-Token", opts.buildToken);
534
535
  const merged = {
535
536
  ...init,
536
537
  headers
@@ -1673,9 +1674,16 @@ function buildItemListLd(items) {
1673
1674
  }
1674
1675
  function buildOrganizationLd(input) {
1675
1676
  const contact = input.contact;
1677
+ const address = clean({ ...input.address });
1676
1678
  return node("Organization", {
1677
1679
  name: input.name,
1680
+ legalName: input.legalName,
1678
1681
  url: input.url,
1682
+ taxID: input.taxID,
1683
+ address: address ? {
1684
+ "@type": "PostalAddress",
1685
+ ...address
1686
+ } : void 0,
1679
1687
  logo: input.logo,
1680
1688
  sameAs: input.sameAs,
1681
1689
  contactPoint: contact && (contact.email || contact.telephone) ? {
@@ -1690,6 +1698,7 @@ function buildWebSiteLd(input) {
1690
1698
  const search = (input.searchPath ?? "").trim();
1691
1699
  return node("WebSite", {
1692
1700
  name: input.name,
1701
+ alternateName: input.alternateName,
1693
1702
  url: input.url,
1694
1703
  potentialAction: search === "" ? void 0 : {
1695
1704
  "@type": "SearchAction",
@@ -1,3 +1,3 @@
1
- import { a as TemplateLayoutDocument, c as TemplateLayoutRenderNode, i as TemplateLayoutContext, l as buildTemplateBlockRenames, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel } from "./templateLayout-MjNs0gbF.js";
1
+ import { a as TemplateLayoutDocument, c as TemplateLayoutRenderNode, i as TemplateLayoutContext, l as buildTemplateBlockRenames, n as TemplateBlockFieldDefinition, o as TemplateLayoutNode, r as TemplateBlockNode, s as TemplateLayoutRenderModel, t as TemplateBlockDefinition, u as createTemplateLayoutRenderModel } from "./templateLayout-7rT_TH_E.js";
2
2
  import { n as ReusableComponentPlacement, o as ReusableRenderIdentity, r as ReusableComponentProjection } from "./reusableExpansion-CXvs_ckx.js";
3
3
  export { type ReusableComponentPlacement, type ReusableComponentProjection, type ReusableRenderIdentity, TemplateBlockDefinition, TemplateBlockFieldDefinition, TemplateBlockNode, TemplateLayoutContext, TemplateLayoutDocument, TemplateLayoutNode, TemplateLayoutRenderModel, TemplateLayoutRenderNode, buildTemplateBlockRenames, createTemplateLayoutRenderModel };
@@ -26,6 +26,13 @@ interface EldraClientOptions {
26
26
  stega?: boolean;
27
27
  fetch?: typeof globalThis.fetch;
28
28
  retry?: EldraRetryOptions;
29
+ /**
30
+ * The organisation's read-only build token (`eldra_bld_…`, Studio → Settings → Developers →
31
+ * Build tokens), sent as `X-Eldra-Build-Token` on every request so the gateway counts a
32
+ * theme build's reads against the build's own rate-limit budget. Server and build only: never
33
+ * pass it from browser code or a public config. Omitted or empty sends no header.
34
+ */
35
+ buildToken?: string;
29
36
  /**
30
37
  * The organisation's default content locale (e.g. `"en-US"`). A `link`
31
38
  * field's value is a per-locale record, and this drives a per-field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/theme-core",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Framework-free core of the Eldra theme SDK: the Studio preview bridge, stega encoding, the overlay runtime, layout CSS, rich-text positions, design tokens and image framing.",
5
5
  "keywords": [
6
6
  "cms",