@cmssy/core 12.7.0 → 12.8.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.
@@ -142,7 +142,13 @@ interface DragEndMessage {
142
142
  type: "cmssy:drag-end";
143
143
  protocolVersion: number;
144
144
  }
145
- type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
145
+ interface ViewportMessage {
146
+ type: "cmssy:viewport";
147
+ protocolVersion: number;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage | ViewportMessage;
146
152
  declare function isProtocolCompatible(version: number): boolean;
147
153
 
148
154
  interface PostTarget {
@@ -167,4 +173,4 @@ declare function toCspOrigin(origin: string): string;
167
173
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
168
174
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
169
175
 
170
- export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
176
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type ViewportMessage as V, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
@@ -142,7 +142,13 @@ interface DragEndMessage {
142
142
  type: "cmssy:drag-end";
143
143
  protocolVersion: number;
144
144
  }
145
- type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage;
145
+ interface ViewportMessage {
146
+ type: "cmssy:viewport";
147
+ protocolVersion: number;
148
+ width: number;
149
+ height: number;
150
+ }
151
+ type EditorToAppMessage = SelectMessage | PatchMessage | ParentReadyMessage | InsertMessage | ReorderMessage | RemoveMessage | DragOverMessage | DragEndMessage | ViewportMessage;
146
152
  declare function isProtocolCompatible(version: number): boolean;
147
153
 
148
154
  interface PostTarget {
@@ -167,4 +173,4 @@ declare function toCspOrigin(origin: string): string;
167
173
  declare function cmssyCspHeaders(options: CmssyCspOptions): Record<string, string>;
168
174
  declare function applyCmssyCsp<T extends MutableHeaders>(response: T, options: CmssyCspOptions): T;
169
175
 
170
- export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
176
+ export { type AppToEditorMessage as A, type BoundsMessage as B, type ClickMessage as C, DEFAULT_CMSSY_EDITOR_ORIGINS as D, type EditorToAppMessage as E, type InvisibleBlock as I, PROTOCOL_VERSION as P, type QueryScopedOptions as Q, type ReadyMessage as R, SHORTCUT_ACTIONS as S, type ViewportMessage as V, type CmssyClient as a, type CmssyConfig as b, type CmssyCspOptions as c, type CmssyEnvConfig as d, type CmssyTypedDocument as e, type InvisibleBlocksMessage as f, type ParentReadyMessage as g, type PatchMessage as h, type PostTarget as i, type SelectMessage as j, type ShortcutAction as k, type ShortcutMessage as l, applyCmssyCsp as m, createCmssyClient as n, defineCmssyConfig as o, isProtocolCompatible as p, normalizeOrigin as q, parseEditorMessage as r, postToEditor as s, resolveEditorOrigin as t, cmssyCspHeaders as u, isDevelopment as v, resolveInitialTarget as w, toCspOrigin as x };
package/dist/index.cjs CHANGED
@@ -639,6 +639,9 @@ function isOriginAllowed(origin, allowed) {
639
639
  return expected === "*" || expected === actual;
640
640
  });
641
641
  }
642
+ function isSize(value) {
643
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
644
+ }
642
645
  function isObject(value) {
643
646
  return typeof value === "object" && value !== null && !Array.isArray(value);
644
647
  }
@@ -695,6 +698,13 @@ function parseEditorMessage(data, origin, expectedOrigin) {
695
698
  } : null;
696
699
  case "cmssy:drag-end":
697
700
  return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:drag-end", protocolVersion: PROTOCOL_VERSION } : null;
701
+ case "cmssy:viewport":
702
+ return isSize(data.width) && isSize(data.height) && data.protocolVersion === PROTOCOL_VERSION ? {
703
+ type: "cmssy:viewport",
704
+ protocolVersion: PROTOCOL_VERSION,
705
+ width: data.width,
706
+ height: data.height
707
+ } : null;
698
708
  default:
699
709
  return null;
700
710
  }
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-BsHNLfJ1.cjs';
1
+ export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, V as ViewportMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-DXxz0OdB.cjs';
2
2
  export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-BS61R-fF.cjs';
3
3
  export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-BPpRfq0h.cjs';
4
4
  import * as _cmssy_types from '@cmssy/types';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-DrkfGO99.js';
1
+ export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyTypedDocument, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, f as InvisibleBlocksMessage, P as PROTOCOL_VERSION, g as ParentReadyMessage, h as PatchMessage, i as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, j as SelectMessage, k as ShortcutAction, l as ShortcutMessage, V as ViewportMessage, m as applyCmssyCsp, n as createCmssyClient, o as defineCmssyConfig, p as isProtocolCompatible, q as normalizeOrigin, r as parseEditorMessage, s as postToEditor, t as resolveEditorOrigin } from './csp-DvzJKrwc.js';
2
2
  export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale } from './locale-DQZ80cew.js';
3
3
  export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-BPpRfq0h.js';
4
4
  import * as _cmssy_types from '@cmssy/types';
package/dist/index.js CHANGED
@@ -637,6 +637,9 @@ function isOriginAllowed(origin, allowed) {
637
637
  return expected === "*" || expected === actual;
638
638
  });
639
639
  }
640
+ function isSize(value) {
641
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
642
+ }
640
643
  function isObject(value) {
641
644
  return typeof value === "object" && value !== null && !Array.isArray(value);
642
645
  }
@@ -693,6 +696,13 @@ function parseEditorMessage(data, origin, expectedOrigin) {
693
696
  } : null;
694
697
  case "cmssy:drag-end":
695
698
  return data.protocolVersion === PROTOCOL_VERSION ? { type: "cmssy:drag-end", protocolVersion: PROTOCOL_VERSION } : null;
699
+ case "cmssy:viewport":
700
+ return isSize(data.width) && isSize(data.height) && data.protocolVersion === PROTOCOL_VERSION ? {
701
+ type: "cmssy:viewport",
702
+ protocolVersion: PROTOCOL_VERSION,
703
+ width: data.width,
704
+ height: data.height
705
+ } : null;
696
706
  default:
697
707
  return null;
698
708
  }
@@ -3,8 +3,8 @@ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyCl
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
4
  import { G as GraphqlRequestOptions } from './locale-BS61R-fF.cjs';
5
5
  export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-BS61R-fF.cjs';
6
- import { Q as QueryScopedOptions } from './csp-BsHNLfJ1.cjs';
7
- export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-BsHNLfJ1.cjs';
6
+ import { Q as QueryScopedOptions } from './csp-DXxz0OdB.cjs';
7
+ export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-DXxz0OdB.cjs';
8
8
  export { localizedPath } from './internal/locale.cjs';
9
9
 
10
10
  declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
@@ -3,8 +3,8 @@ import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssyCl
3
3
  export { CmssySiteLocales } from '@cmssy/types';
4
4
  import { G as GraphqlRequestOptions } from './locale-DQZ80cew.js';
5
5
  export { C as CMSSY_LOCALE_HEADER, a as localeForPath, b as localeForPathname, l as localizeHref, c as resolveSiteLocales, s as splitCmssyLocale, d as splitLocaleFromPath } from './locale-DQZ80cew.js';
6
- import { Q as QueryScopedOptions } from './csp-DrkfGO99.js';
7
- export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-DrkfGO99.js';
6
+ import { Q as QueryScopedOptions } from './csp-DvzJKrwc.js';
7
+ export { u as cmssyCspHeaders, v as isDevelopment, w as resolveInitialTarget, x as toCspOrigin } from './csp-DvzJKrwc.js';
8
8
  export { localizedPath } from './internal/locale.js';
9
9
 
10
10
  declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n logoDarkUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/core",
3
- "version": "12.7.0",
3
+ "version": "12.8.0",
4
4
  "description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
5
5
  "keywords": [
6
6
  "cmssy",