@plitzi/sdk-shared 0.38.10 → 0.38.12

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +279 -0
  2. package/dist/actions/validateDocument.mjs +2 -1
  3. package/dist/authoring/declare.d.ts +152 -2
  4. package/dist/authoring/declare.mjs +95 -2
  5. package/dist/authoring/index.mjs +5 -5
  6. package/dist/dataSource/getBindingsDetails.mjs +20 -20
  7. package/dist/dataSource/hooks/useRegisterSource.mjs +31 -18
  8. package/dist/helpers/generateFacade.mjs +16 -12
  9. package/dist/helpers/index.mjs +2 -2
  10. package/dist/helpers/utils.d.ts +1 -1
  11. package/dist/helpers/utils.mjs +1 -1
  12. package/dist/hooks/index.d.ts +3 -3
  13. package/dist/hooks/index.mjs +2 -2
  14. package/dist/hooks/usePlitzi.d.ts +32 -0
  15. package/dist/hooks/{usePlitziServiceContext.mjs → usePlitzi.mjs} +3 -3
  16. package/dist/index.mjs +3 -3
  17. package/dist/plugins/PluginsContext.d.ts +3 -0
  18. package/dist/plugins/PluginsContext.mjs +4 -0
  19. package/dist/project/paths.d.ts +1 -1
  20. package/dist/realtime/client.d.ts +6 -3
  21. package/dist/realtime/client.mjs +19 -17
  22. package/dist/realtime/index.d.ts +1 -1
  23. package/dist/realtime/index.mjs +4 -4
  24. package/dist/realtime/presence.mjs +1 -1
  25. package/dist/realtime/topics.d.ts +6 -0
  26. package/dist/realtime/topics.mjs +2 -2
  27. package/dist/store/index.d.ts +33 -33
  28. package/dist/style/styleTarget.mjs +28 -27
  29. package/dist/style/useElementSize.d.ts +16 -0
  30. package/dist/style/useElementSize.mjs +20 -0
  31. package/dist/types/ActionTypes.d.ts +19 -3
  32. package/dist/types/DataSourceTypes.d.ts +7 -2
  33. package/dist/types/EventBridgeTypes.d.ts +2 -1
  34. package/dist/types/InteractionTypes.d.ts +42 -4
  35. package/dist/types/RealtimeTypes.d.ts +14 -1
  36. package/dist/types/ServerTypes.d.ts +6 -1
  37. package/dist/websockets/RTCodec.d.ts +6 -1
  38. package/package.json +13 -5
  39. package/dist/hooks/usePlitziServiceContext.d.ts +0 -38
@@ -1,27 +1,40 @@
1
1
  import { makeId as e } from "../../helpers/utils.mjs";
2
- import { useEffect as t, useMemo as n } from "react";
3
- import { createStoreHook as r } from "@plitzi/nexus/react";
2
+ import { useEffect as t, useEffectEvent as n, useMemo as r } from "react";
3
+ import { createStoreHook as i } from "@plitzi/nexus/react";
4
4
  //#region src/dataSource/hooks/useRegisterSource.ts
5
- var i = ({ id: i = "", source: a, name: o, fields: s = [] }) => {
6
- let { useStoreSetter: c } = r(), l = c(), u = n(() => `${i}_${e(8)}`, [i]);
7
- t(() => {
8
- if (a) return l(`sources.${u}`, {
9
- id: u,
5
+ var a = ({ id: a = "", source: o, name: s, fields: c = [] }) => {
6
+ let { useStoreSetter: l } = i(), u = l(), d = r(() => `${a}_${e(8)}`, [a]), f = n(() => {
7
+ u(`sources.${d}`, {
8
+ id: d,
10
9
  meta: {
11
- id: i,
12
- source: a,
13
- name: o,
14
- fields: s
10
+ id: a,
11
+ source: o,
12
+ name: s,
13
+ fields: c
15
14
  }
16
- }), () => l(`sources.${u}`, void 0, { unmount: !0 });
17
- }, [u, a]), t(() => {
18
- a && l(`sources.${u}.meta.fields`, s, { raw: !0 });
15
+ });
16
+ });
17
+ t(() => {
18
+ if (o) return f(), () => u(`sources.${d}`, void 0, { unmount: !0 });
19
+ }, [
20
+ d,
21
+ o,
22
+ u
23
+ ]), t(() => {
24
+ o && u(`sources.${d}.meta.name`, s);
19
25
  }, [
20
26
  s,
21
- a,
22
- u,
23
- l
27
+ o,
28
+ d,
29
+ u
30
+ ]), t(() => {
31
+ o && u(`sources.${d}.meta.fields`, c, { raw: !0 });
32
+ }, [
33
+ c,
34
+ o,
35
+ d,
36
+ u
24
37
  ]);
25
38
  };
26
39
  //#endregion
27
- export { i as default };
40
+ export { a as default };
@@ -1,9 +1,13 @@
1
- import { omit as e } from "@plitzi/plitzi-ui/helpers";
1
+ import { isRecord as e } from "./isRecord.mjs";
2
+ import { omit as t } from "@plitzi/plitzi-ui/helpers";
2
3
  //#region src/helpers/generateFacade.tsx
3
- var t = (e) => e.replace(/^@/, "").replace(/[-/]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).replace(/\s+/g, ""), n = (e, t = "PlitziFacade") => {
4
- let n = typeof window < "u" ? Object.keys(window[t]?.[e] ?? {}) : [];
4
+ var n = (e) => e.replace(/^@/, "").replace(/[-/]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()).replace(/\s+/g, ""), r = (t, n) => {
5
+ let r = Reflect.get(window, t), i = e(r) ? r[n] : void 0;
6
+ return e(i) ? i : {};
7
+ }, i = (e, t = "PlitziFacade") => {
8
+ let n = typeof window < "u" ? Object.keys(r(t, e)) : [];
5
9
  return n.length === 0 ? "" : `export default window.${t}.${e};${n.filter((e) => e !== "default").map((n) => `export const ${n} = window.${t}.${e}.${n};`).join("")}`;
6
- }, r = (e) => URL.createObjectURL(new Blob([e], { type: "application/javascript" })), i = () => {
10
+ }, a = (e) => URL.createObjectURL(new Blob([e], { type: "application/javascript" })), o = () => {
7
11
  let e = {};
8
12
  return typeof document > "u" || document.querySelectorAll("script[type=\"importmap\"]").forEach((t) => {
9
13
  if (t.textContent) try {
@@ -15,21 +19,21 @@ var t = (e) => e.replace(/^@/, "").replace(/[-/]/g, " ").replace(/\b\w/g, (e) =>
15
19
  console.error("Invalid importmap JSON", e);
16
20
  }
17
21
  }), e;
18
- }, a = (e, i = "PlitziFacade") => JSON.stringify({ imports: Object.keys(e).map((e) => ({
22
+ }, s = (e, t = "PlitziFacade") => JSON.stringify({ imports: Object.keys(e).map((e) => ({
19
23
  key: e,
20
- bob: r(n(t(e), i))
24
+ bob: a(i(n(e), t))
21
25
  })).reduce((e, t) => ({
22
26
  ...e,
23
27
  [t.key]: t.bob
24
- }), {}) }), o = (n, r = "PlitziFacade") => {
28
+ }), {}) }), c = (e, r = "PlitziFacade") => {
25
29
  if (typeof document > "u" || typeof window > "u") return;
26
- let o = i(), s = e(n, Object.keys(o));
27
- if (Object.keys(s).length === 0) return;
28
- window[r] = Object.fromEntries(Object.entries(s).map(([e, n]) => [t(e), n]));
29
- let c = a(s, r);
30
+ let i = o(), a = t(e, Object.keys(i));
31
+ if (Object.keys(a).length === 0) return;
32
+ Reflect.set(window, r, Object.fromEntries(Object.entries(a).map(([e, t]) => [n(e), t])));
33
+ let c = s(a, r);
30
34
  if (!c) return;
31
35
  let l = document.createElement("script");
32
36
  l.type = "importmap", l.textContent = c, document.head.appendChild(l);
33
37
  };
34
38
  //#endregion
35
- export { o as default };
39
+ export { c as default };
@@ -16,6 +16,6 @@ import { INTERVAL_TRIGGER as k, MIN_INTERVAL_MS as A, intervalOf as j } from "./
16
16
  import { isDate as M } from "./isDate.mjs";
17
17
  import { isUserEdit as N } from "./reducerOrigin.mjs";
18
18
  import { evaluateRuleGroup as P } from "./ruleEvaluator.mjs";
19
- import { ParamsFromURL as F, delay as I, emptyObject as L, getDisplayName as R, getKeyDecoded as z, getPathsFromObeject as B, hexToRGB as V, isInViewport as H, makeId as U } from "./utils.mjs";
19
+ import { ParamsFromURL as F, delay as I, emptyObject as L, getDisplayName as R, getKeyDecoded as z, getPathsFromObject as B, hexToRGB as V, isInViewport as H, makeId as U } from "./utils.mjs";
20
20
  import { disableReactDevTools as W } from "./security.mjs";
21
- export { k as INTERVAL_TRIGGER, s as MAX_PARAM_PASSES, A as MIN_INTERVAL_MS, F as ParamsFromURL, h as cookieFromHeader, I as delay, W as disableReactDevTools, g as documentCookies, _ as elementOf, L as emptyObject, P as evaluateRuleGroup, f as fetchManifest, t as filters, x as formatDate, S as formatDateUTC, C as formatFromNow, w as formatUTCToLocal, p as generateFacade, R as getDisplayName, T as getDurationMs, z as getKeyDecoded, B as getPathsFromObeject, a as hasTemplateSyntax, o as hasValidToken, V as hexToRGB, l as inspectTemplate, j as intervalOf, M as isDate, v as isElementTarget, H as isInViewport, y as isNodeTarget, e as isRecord, N as isUserEdit, E as isValidFormat, U as makeId, b as nodeOf, D as parseDate, n as processTwig, r as processTwigParam, i as processTwigValue, c as resolveStepParam, m as syntaxHighlight, u as templatePaths, d as templateRootNames, O as toUnixSeconds };
21
+ export { k as INTERVAL_TRIGGER, s as MAX_PARAM_PASSES, A as MIN_INTERVAL_MS, F as ParamsFromURL, h as cookieFromHeader, I as delay, W as disableReactDevTools, g as documentCookies, _ as elementOf, L as emptyObject, P as evaluateRuleGroup, f as fetchManifest, t as filters, x as formatDate, S as formatDateUTC, C as formatFromNow, w as formatUTCToLocal, p as generateFacade, R as getDisplayName, T as getDurationMs, z as getKeyDecoded, B as getPathsFromObject, a as hasTemplateSyntax, o as hasValidToken, V as hexToRGB, l as inspectTemplate, j as intervalOf, M as isDate, v as isElementTarget, H as isInViewport, y as isNodeTarget, e as isRecord, N as isUserEdit, E as isValidFormat, U as makeId, b as nodeOf, D as parseDate, n as processTwig, r as processTwigParam, i as processTwigValue, c as resolveStepParam, m as syntaxHighlight, u as templatePaths, d as templateRootNames, O as toUnixSeconds };
@@ -2,7 +2,7 @@ import { FC } from 'react';
2
2
  export declare function getDisplayName<T = unknown>(WrappedComponent?: FC<T>): string;
3
3
  declare const emptyObject: {};
4
4
  export { emptyObject };
5
- export declare const getPathsFromObeject: (object?: {
5
+ export declare const getPathsFromObject: (object?: {
6
6
  [key: string]: unknown;
7
7
  }, basePath?: string, glue?: string, skipArray?: boolean) => string[];
8
8
  export declare const makeId: (length: number, includeMayus?: boolean, includeNumbers?: boolean) => string;
@@ -58,4 +58,4 @@ var s = (e) => new Promise((t) => {
58
58
  return t ? `rgba(${n},${r},${i},${t})` : `rgb(${n},${r},${i})`;
59
59
  };
60
60
  //#endregion
61
- export { o as ParamsFromURL, s as delay, n as emptyObject, t as getDisplayName, a as getKeyDecoded, r as getPathsFromObeject, l as hexToRGB, c as isInViewport, i as makeId };
61
+ export { o as ParamsFromURL, s as delay, n as emptyObject, t as getDisplayName, a as getKeyDecoded, r as getPathsFromObject, l as hexToRGB, c as isInViewport, i as makeId };
@@ -1,7 +1,7 @@
1
1
  import { default as useFontHead } from './useFontHead';
2
2
  import { default as useNetwork } from './useNetwork';
3
- import { default as usePlitziServiceContext } from './usePlitziServiceContext';
3
+ import { default as usePlitzi } from './usePlitzi';
4
4
  import { default as useStableValue } from './useStableValue';
5
5
  export * from './useNetwork';
6
- export * from './usePlitziServiceContext';
7
- export { useFontHead, useNetwork, usePlitziServiceContext, useStableValue };
6
+ export * from './usePlitzi';
7
+ export { useFontHead, useNetwork, usePlitzi, useStableValue };
@@ -1,5 +1,5 @@
1
1
  import e from "./useStableValue.mjs";
2
2
  import t from "./useFontHead.mjs";
3
3
  import n from "./useNetwork.mjs";
4
- import r, { PlitziServiceContext as i, PlitziServiceProvider as a } from "./usePlitziServiceContext.mjs";
5
- export { i as PlitziServiceContext, a as PlitziServiceProvider, t as useFontHead, n as useNetwork, r as usePlitziServiceContext, e as useStableValue };
4
+ import r, { PlitziContext as i, PlitziProvider as a } from "./usePlitzi.mjs";
5
+ export { i as PlitziContext, a as PlitziProvider, t as useFontHead, n as useNetwork, r as usePlitzi, e as useStableValue };
@@ -0,0 +1,32 @@
1
+ import { ColorScheme } from '../types';
2
+ import { ReactNode, RefObject } from 'react';
3
+ /**
4
+ * What the host rendering a space — the builder, the SDK, a shadow-rooted widget — tells every element: whether it is
5
+ * being edited or looked at, its scheme, whether it is still hydrating, the window it paints in and the root it hangs
6
+ * from. Only what the host alone knows: a context of another package is imported from that package, never carried here.
7
+ */
8
+ export type PlitziContextValue = {
9
+ settings: {
10
+ isHydrating?: boolean;
11
+ previewMode?: boolean;
12
+ environment?: string;
13
+ [key: string]: unknown;
14
+ /** Already resolved: an element paints in one of two schemes and has no use for the word `system`. */
15
+ theme: ColorScheme;
16
+ };
17
+ root: {
18
+ baseElementId: string;
19
+ };
20
+ utils: {
21
+ getWindow: () => Window | null;
22
+ rootRef: RefObject<HTMLElement | null>;
23
+ };
24
+ };
25
+ declare const PlitziContext: import('react').Context<PlitziContextValue>;
26
+ declare const usePlitzi: () => PlitziContextValue;
27
+ declare const PlitziProvider: (props: {
28
+ children?: ReactNode;
29
+ value: PlitziContextValue;
30
+ }) => import('react').JSX.Element;
31
+ export { PlitziProvider, PlitziContext };
32
+ export default usePlitzi;
@@ -1,9 +1,9 @@
1
1
  import { sharedContext as e } from "../helpers/sharedContext.mjs";
2
2
  import { use as t } from "react";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
- var r = e("PlitziServiceContext", {}), i = () => {
4
+ var r = e("PlitziContext", {}), i = () => {
5
5
  let e = t(r);
6
- if (e === void 0) throw Error("ServiceContext value is undefined. Make sure you use the PlitziServiceProvider before using the hook.");
6
+ if (e === void 0) throw Error("The Plitzi context is undefined. Render the element inside a PlitziProvider.");
7
7
  return e;
8
8
  }, a = (e) => {
9
9
  let { children: t, value: i } = e;
@@ -13,4 +13,4 @@ var r = e("PlitziServiceContext", {}), i = () => {
13
13
  });
14
14
  };
15
15
  //#endregion
16
- export { r as PlitziServiceContext, a as PlitziServiceProvider, i as default };
16
+ export { r as PlitziContext, a as PlitziProvider, i as default };
package/dist/index.mjs CHANGED
@@ -26,7 +26,7 @@ import { INTERVAL_TRIGGER as ee, MIN_INTERVAL_MS as te, intervalOf as ne } from
26
26
  import { isDate as re } from "./helpers/isDate.mjs";
27
27
  import { isUserEdit as ie } from "./helpers/reducerOrigin.mjs";
28
28
  import { evaluateRuleGroup as ae } from "./helpers/ruleEvaluator.mjs";
29
- import { ParamsFromURL as oe, delay as se, emptyObject as ce, getDisplayName as le, getKeyDecoded as ue, getPathsFromObeject as de, hexToRGB as fe, isInViewport as pe, makeId as me } from "./helpers/utils.mjs";
29
+ import { ParamsFromURL as oe, delay as se, emptyObject as ce, getDisplayName as le, getKeyDecoded as ue, getPathsFromObject as de, hexToRGB as fe, isInViewport as pe, makeId as me } from "./helpers/utils.mjs";
30
30
  import { disableReactDevTools as he } from "./helpers/security.mjs";
31
31
  import ge, { utilityOptions as _e } from "./dataSource/utility/index.mjs";
32
32
  import ve from "./dataSource/getBindingsDetails.mjs";
@@ -48,7 +48,7 @@ import { describeChange as Xe, fieldChanges as Ze, uniqueLines as Qe } from "./h
48
48
  import { diffSchema as $e, diffStyle as et, jsonCopy as tt, sameValue as nt } from "./history/diff.mjs";
49
49
  import rt from "./hooks/useFontHead.mjs";
50
50
  import it from "./hooks/useNetwork.mjs";
51
- import at, { PlitziServiceContext as ot, PlitziServiceProvider as st } from "./hooks/usePlitziServiceContext.mjs";
51
+ import at, { PlitziContext as ot, PlitziProvider as st } from "./hooks/usePlitzi.mjs";
52
52
  import { WHILE_RUNNING_MODES as ct } from "./types/SchemaTypes.mjs";
53
53
  import { StyleVariableCategory as lt, isStyleVariableCategory as ut } from "./types/StyleTypes.mjs";
54
54
  import dt, { EMPTY_STYLE_SCHEMA as ft, StyleBindingsAllowed as pt, baseDefaultValue as mt, inheritableAttributesBase as ht } from "./style/styleConstants.mjs";
@@ -93,4 +93,4 @@ import Hr from "./server/rsc/useRscRefresh.mjs";
93
93
  import Ur from "./server/rsc/useRscSync.mjs";
94
94
  import { PAINTED_STATE_BUDGET as Wr, clearPaintedEntry as Gr, paintedEntryFromCookies as Kr, paintedKeys as qr, paintedStateCookieName as Jr, paintedStateFor as Yr, pickPainted as Xr, readPaintedEntry as Zr, writePaintedEntry as Qr } from "./state/paintedState.mjs";
95
95
  import { runtimeStatePersist as $r, stateOwner as ei } from "./state/runtimeStatePersist.mjs";
96
- export { Mn as ANCHOR_PATTERN, x as BODYLESS_METHODS, y as BuilderContext, nr as BuilderMutations, rr as BuilderQueries, In as COMPONENT_PROPS_SOURCE, N as COMPUTED_GLOBALS, S as CONNECTOR_HTTP_METHODS, an as CONTENT_PSEUDOS, mn as CURRENT_SELECTOR, Me as ComponentContext, C as DEFAULT_READ_ENDPOINT, Te as DEV_TOOLS_ATTRIBUTE, St as DISPLAY_MODES, gt as DISPLAY_MODE_MIN_WIDTH, we as DevToolsContext, w as EMPTY_RESPONSE_METHODS, Ln as EMPTY_SCHEMA, ft as EMPTY_STYLE_SCHEMA, hn as EXPANDED_SELECTOR, Ne as FLAG_GATE_PATTERN, Ue as FLAG_LAYERS, Pe as FLAG_NAME_PATTERN, Ft as FontValidationError, on as GENERATED_PSEUDOS, P as GLOBAL_SOURCES, gn as HIDDEN_CLASS, Ee as HIDE_DEV_TOOLS_CSS, ee as INTERVAL_TRIGGER, zt as LAYOUT_GRIDS, m as MAX_PARAM_PASSES, te as MIN_INTERVAL_MS, Yt as MOTION_CONDITIONS, Jn as NetworkContext, Yn as NetworkInternalContext, Wr as PAINTED_STATE_BUDGET, _n as PARENT_ANCESTOR, yt as PLUGIN_CSS_LAYER, sn as PSEUDO_PROPERTIES, oe as ParamsFromURL, ke as PlitziConsole, ot as PlitziServiceContext, st as PlitziServiceProvider, T as READ_ENDPOINT_NAMES, sr as RTCodec, cr as RTEvent, lr as RTEventCloseCode, bt as RUNTIME_CSS_LAYER, Ht as RUNTIME_STYLE_ID, Fr as SPACE_THEME_AREA, Xt as STYLE_CONDITION_LABELS, Zt as STYLE_MOTION_CONDITIONS, cn as STYLE_PSEUDOS, ln as STYLE_PSEUDO_LABELS, vn as STYLE_STATES, yn as STYLE_STATE_LABELS, Tt as SYSTEM_FONTS, jn as SchemaContext, ar as SdkMutations, or as SdkQueries, ir as SpaceEventSubscription, $n as SpaceEvents, pt as StyleBindingsAllowed, lt as StyleVariableCategory, mr as THEME_CLASSES, hr as THEME_COOKIE_NAME, Nr as ThemeProvider, Ar as ThemeStartContext, Rn as VARIABLE_REGEX, a as VISITOR_NAME, ct as WHILE_RUNNING_MODES, E as WRITE_ENDPOINT_NAMES, Nn as anchorOf, gr as applyThemeClass, t as authFailureFromResponse, Et as availableFonts, mt as baseDefaultValue, Rr as cancelRsc, Qt as canonicalCondition, o as checkVisitorRoles, Gr as clearPaintedEntry, Vn as collectServerElements, $t as conditionAtRule, en as conditionLabel, tn as conditionOfAtRule, k as connectorPresets, D as connectorTokens, b as contexts, B as cookieFromHeader, Ae as createStoreDevToolsLogger, Sr as createThemeState, Cr as createThemeStore, zr as currentRscLocation, De as debugCookieName, se as delay, Xe as describeChange, $e as diffSchema, et as diffStyle, he as disableReactDevTools, _t as displayModeAt, vt as displayModeWidthRem, V as documentCookies, Xn as elementFromWire, H as elementOf, A as emptyManifest, ce as emptyObject, F as evaluateComputed, ae as evaluateRuleGroup, Lt as fallbackForFamily, Dt as familiesInCss, L as fetchManifest, Ze as fieldChanges, c as filters, zn as findLayoutCycle, We as flagUserFromSSR, Ge as flagValues, Le as flagsCookieName, Ot as fontFamilyStack, wt as fontLinkAssets, kt as fontUrlResolver, Rt as fontsFromCss, At as fontsToHead, Re as forcedFlagsFromCookies, K as formatDate, q as formatDateUTC, J as formatFromNow, Y as formatUTCToLocal, R as generateFacade, ve as getBindingsDetails, O as getConnectorTokens, le as getDisplayName, X as getDurationMs, ur as getInstance, ue as getKeyDecoded, de as getPathsFromObeject, ye as getSourceName, jt as googleCss2Url, Mt as googleTextSubsetUrl, Ke as hasConditions, Hn as hasServerElements, f as hasTemplateSyntax, p as hasValidToken, fe as hexToRGB, bn as inCascadeOrder, xt as inPluginLayer, ht as inheritableAttributesBase, g as inspectTemplate, ne as intervalOf, Pn as isAnchor, j as isConnectorManifestDraft, un as isContentValue, re as isDate, Ct as isDisplayMode, U as isElementTarget, Fe as isFlagName, pe as isInViewport, Oe as isInteractionFlow, xn as isKnownState, W as isNodeTarget, Sn as isParentAncestor, dr as isRTEvent, fr as isRTEventCloseCode, e as isRecord, Nt as isSafeFontUrl, Ie as isSchemaFlag, qn as isSnippet, Cn as isStartingState, nn as isStyleCondition, dn as isStylePseudo, Tn as isStyleRules, ut as isStyleVariableCategory, _r as isTheme, ie as isUserEdit, Z as isValidFormat, tt as jsonCopy, Bt as layoutGridCss, Vt as layoutGridLook, I as liveSources, me as makeId, Ut as markStyleCache, Kt as mergeSnippetStyle, G as nodeOf, Un as notFoundProvider, n as onAuthFailure, je as pConsole, Wn as pageNotFound, Gn as pageSeoText, Kn as pageServerContext, Kr as paintedEntryFromCookies, qr as paintedKeys, Jr as paintedStateCookieName, Yr as paintedStateFor, rn as parseContainerCondition, Q as parseDate, ze as parseFlagList, It as parseSpaceFont, qe as passesFlagGate, Xr as pickPainted, Pt as primaryFamily, l as processTwig, u as processTwigParam, d as processTwigValue, fn as pseudoHonours, pn as pseudoSuffix, Zr as readPaintedEntry, vr as readThemeCookie, Lr as refreshRsc, Br as releaseRscRequests, r as reportAuthFailure, Je as resolveFlags, Bn as resolveLayoutChain, wr as resolveScheme, h as resolveStepParam, Se as resolveVariables, Vr as rscDataPath, $r as runtimeStatePersist, i as sameRegistrableDomain, qt as sameSelector, nt as sameValue, Zn as schemaFromWire, Qn as schemaToWire, Jt as selectorsOf, Be as serializeFlagList, Tr as setAreaTheme, En as setAtKeys, pr as setInstance, Er as setMachineScheme, Dr as setThemeMode, er as spaceEventSchemas, Or as startingThemeState, ei as stateOwner, wn as stateSuffix, Wt as styleCacheFromDocument, Gt as styleCacheTravelsInDocument, dt as styleConstants, Dn as styleTargetKeys, On as styleTargetProblem, kn as styleTargetRules, z as syntaxHighlight, _ as templatePaths, v as templateRootNames, kr as themeFor, yr as themeFromCookies, xr as themeStore, $ as toUnixSeconds, Ye as undeclaredFlagOverrides, Fn as uniqueAnchor, Qe as uniqueLines, Ir as useActionsSync, rt as useFontHead, it as useNetwork, at as usePlitziServiceContext, be as useRegisterSource, Ce as useResolvedVariables, Hr as useRscRefresh, Ur as useRscSync, xe as useStableValue, Pr as useTheme, jr as useThemeState, Mr as useThemeStore, ge as utility, _e as utilityOptions, M as validateConnectorManifest, tr as validateSpaceEvent, An as valueAtKeys, s as visitorAccess, Ve as withForcedFlag, He as writeForcedFlags, Qr as writePaintedEntry, br as writeThemeCookie };
96
+ export { Mn as ANCHOR_PATTERN, x as BODYLESS_METHODS, y as BuilderContext, nr as BuilderMutations, rr as BuilderQueries, In as COMPONENT_PROPS_SOURCE, N as COMPUTED_GLOBALS, S as CONNECTOR_HTTP_METHODS, an as CONTENT_PSEUDOS, mn as CURRENT_SELECTOR, Me as ComponentContext, C as DEFAULT_READ_ENDPOINT, Te as DEV_TOOLS_ATTRIBUTE, St as DISPLAY_MODES, gt as DISPLAY_MODE_MIN_WIDTH, we as DevToolsContext, w as EMPTY_RESPONSE_METHODS, Ln as EMPTY_SCHEMA, ft as EMPTY_STYLE_SCHEMA, hn as EXPANDED_SELECTOR, Ne as FLAG_GATE_PATTERN, Ue as FLAG_LAYERS, Pe as FLAG_NAME_PATTERN, Ft as FontValidationError, on as GENERATED_PSEUDOS, P as GLOBAL_SOURCES, gn as HIDDEN_CLASS, Ee as HIDE_DEV_TOOLS_CSS, ee as INTERVAL_TRIGGER, zt as LAYOUT_GRIDS, m as MAX_PARAM_PASSES, te as MIN_INTERVAL_MS, Yt as MOTION_CONDITIONS, Jn as NetworkContext, Yn as NetworkInternalContext, Wr as PAINTED_STATE_BUDGET, _n as PARENT_ANCESTOR, yt as PLUGIN_CSS_LAYER, sn as PSEUDO_PROPERTIES, oe as ParamsFromURL, ke as PlitziConsole, ot as PlitziContext, st as PlitziProvider, T as READ_ENDPOINT_NAMES, sr as RTCodec, cr as RTEvent, lr as RTEventCloseCode, bt as RUNTIME_CSS_LAYER, Ht as RUNTIME_STYLE_ID, Fr as SPACE_THEME_AREA, Xt as STYLE_CONDITION_LABELS, Zt as STYLE_MOTION_CONDITIONS, cn as STYLE_PSEUDOS, ln as STYLE_PSEUDO_LABELS, vn as STYLE_STATES, yn as STYLE_STATE_LABELS, Tt as SYSTEM_FONTS, jn as SchemaContext, ar as SdkMutations, or as SdkQueries, ir as SpaceEventSubscription, $n as SpaceEvents, pt as StyleBindingsAllowed, lt as StyleVariableCategory, mr as THEME_CLASSES, hr as THEME_COOKIE_NAME, Nr as ThemeProvider, Ar as ThemeStartContext, Rn as VARIABLE_REGEX, a as VISITOR_NAME, ct as WHILE_RUNNING_MODES, E as WRITE_ENDPOINT_NAMES, Nn as anchorOf, gr as applyThemeClass, t as authFailureFromResponse, Et as availableFonts, mt as baseDefaultValue, Rr as cancelRsc, Qt as canonicalCondition, o as checkVisitorRoles, Gr as clearPaintedEntry, Vn as collectServerElements, $t as conditionAtRule, en as conditionLabel, tn as conditionOfAtRule, k as connectorPresets, D as connectorTokens, b as contexts, B as cookieFromHeader, Ae as createStoreDevToolsLogger, Sr as createThemeState, Cr as createThemeStore, zr as currentRscLocation, De as debugCookieName, se as delay, Xe as describeChange, $e as diffSchema, et as diffStyle, he as disableReactDevTools, _t as displayModeAt, vt as displayModeWidthRem, V as documentCookies, Xn as elementFromWire, H as elementOf, A as emptyManifest, ce as emptyObject, F as evaluateComputed, ae as evaluateRuleGroup, Lt as fallbackForFamily, Dt as familiesInCss, L as fetchManifest, Ze as fieldChanges, c as filters, zn as findLayoutCycle, We as flagUserFromSSR, Ge as flagValues, Le as flagsCookieName, Ot as fontFamilyStack, wt as fontLinkAssets, kt as fontUrlResolver, Rt as fontsFromCss, At as fontsToHead, Re as forcedFlagsFromCookies, K as formatDate, q as formatDateUTC, J as formatFromNow, Y as formatUTCToLocal, R as generateFacade, ve as getBindingsDetails, O as getConnectorTokens, le as getDisplayName, X as getDurationMs, ur as getInstance, ue as getKeyDecoded, de as getPathsFromObject, ye as getSourceName, jt as googleCss2Url, Mt as googleTextSubsetUrl, Ke as hasConditions, Hn as hasServerElements, f as hasTemplateSyntax, p as hasValidToken, fe as hexToRGB, bn as inCascadeOrder, xt as inPluginLayer, ht as inheritableAttributesBase, g as inspectTemplate, ne as intervalOf, Pn as isAnchor, j as isConnectorManifestDraft, un as isContentValue, re as isDate, Ct as isDisplayMode, U as isElementTarget, Fe as isFlagName, pe as isInViewport, Oe as isInteractionFlow, xn as isKnownState, W as isNodeTarget, Sn as isParentAncestor, dr as isRTEvent, fr as isRTEventCloseCode, e as isRecord, Nt as isSafeFontUrl, Ie as isSchemaFlag, qn as isSnippet, Cn as isStartingState, nn as isStyleCondition, dn as isStylePseudo, Tn as isStyleRules, ut as isStyleVariableCategory, _r as isTheme, ie as isUserEdit, Z as isValidFormat, tt as jsonCopy, Bt as layoutGridCss, Vt as layoutGridLook, I as liveSources, me as makeId, Ut as markStyleCache, Kt as mergeSnippetStyle, G as nodeOf, Un as notFoundProvider, n as onAuthFailure, je as pConsole, Wn as pageNotFound, Gn as pageSeoText, Kn as pageServerContext, Kr as paintedEntryFromCookies, qr as paintedKeys, Jr as paintedStateCookieName, Yr as paintedStateFor, rn as parseContainerCondition, Q as parseDate, ze as parseFlagList, It as parseSpaceFont, qe as passesFlagGate, Xr as pickPainted, Pt as primaryFamily, l as processTwig, u as processTwigParam, d as processTwigValue, fn as pseudoHonours, pn as pseudoSuffix, Zr as readPaintedEntry, vr as readThemeCookie, Lr as refreshRsc, Br as releaseRscRequests, r as reportAuthFailure, Je as resolveFlags, Bn as resolveLayoutChain, wr as resolveScheme, h as resolveStepParam, Se as resolveVariables, Vr as rscDataPath, $r as runtimeStatePersist, i as sameRegistrableDomain, qt as sameSelector, nt as sameValue, Zn as schemaFromWire, Qn as schemaToWire, Jt as selectorsOf, Be as serializeFlagList, Tr as setAreaTheme, En as setAtKeys, pr as setInstance, Er as setMachineScheme, Dr as setThemeMode, er as spaceEventSchemas, Or as startingThemeState, ei as stateOwner, wn as stateSuffix, Wt as styleCacheFromDocument, Gt as styleCacheTravelsInDocument, dt as styleConstants, Dn as styleTargetKeys, On as styleTargetProblem, kn as styleTargetRules, z as syntaxHighlight, _ as templatePaths, v as templateRootNames, kr as themeFor, yr as themeFromCookies, xr as themeStore, $ as toUnixSeconds, Ye as undeclaredFlagOverrides, Fn as uniqueAnchor, Qe as uniqueLines, Ir as useActionsSync, rt as useFontHead, it as useNetwork, at as usePlitzi, be as useRegisterSource, Ce as useResolvedVariables, Hr as useRscRefresh, Ur as useRscSync, xe as useStableValue, Pr as useTheme, jr as useThemeState, Mr as useThemeStore, ge as utility, _e as utilityOptions, M as validateConnectorManifest, tr as validateSpaceEvent, An as valueAtKeys, s as visitorAccess, Ve as withForcedFlag, He as writeForcedFlags, Qr as writePaintedEntry, br as writeThemeCookie };
@@ -0,0 +1,3 @@
1
+ import { PluginsContextValue } from '../types';
2
+ declare const PluginsContext: import('react').Context<PluginsContextValue>;
3
+ export default PluginsContext;
@@ -0,0 +1,4 @@
1
+ import { sharedContext as e } from "../helpers/sharedContext.mjs";
2
+ var t = e("PluginsContext", { assets: {} });
3
+ //#endregion
4
+ export { t as default };
@@ -30,7 +30,7 @@ export declare const SPACE_DIR = "src/space";
30
30
  export declare const SPACE_ENTRY = "src/space/index.ts";
31
31
  /**
32
32
  * The project's own components: every folder is one, registered under its name in camelCase — `src/plugins/StatCard`
33
- * renders a space's `custom({ renderType: 'statCard' })` — built from its entry (`PLUGIN_ENTRIES`) and declared by its
33
+ * renders a space's `statCard` element, placed from its declaration — built from its entry (`PLUGIN_ENTRIES`) and declared by its
34
34
  * `declaration.ts`.
35
35
  */
36
36
  export declare const PLUGINS_DIR = "src/plugins";
@@ -1,4 +1,4 @@
1
- import { RealtimeMessage, RealtimeTransport } from '../types/RealtimeTypes';
1
+ import { RealtimeMessage, RealtimePublishOptions, RealtimeTransport } from '../types/RealtimeTypes';
2
2
  export type RealtimeStatus = 'idle' | 'connecting' | 'open' | 'closed';
3
3
  type MessageListener = (message: RealtimeMessage) => void;
4
4
  type StatusListener = (status: RealtimeStatus) => void;
@@ -11,8 +11,11 @@ export type RealtimeClient = {
11
11
  * reopens nothing the server already let in. `undefined` forgets it.
12
12
  */
13
13
  grant: (topic: string, grant: string | undefined) => void;
14
- /** Sends on a topic this page listens to. `false` when the server refused it or there is no connection. */
15
- publish: (topic: string, type: string, data: unknown) => Promise<boolean>;
14
+ /**
15
+ * Sends on a topic this page listens to — heard by every other page on it, and by this one too with `echo`. `false`
16
+ * when the server refused it or there is no connection.
17
+ */
18
+ publish: (topic: string, type: string, data: unknown, options?: RealtimePublishOptions) => Promise<boolean>;
16
19
  onStatus: (listener: StatusListener) => () => void;
17
20
  readonly status: RealtimeStatus;
18
21
  /** This page's name on its channels — the `from` of what it sends — once connected. */
@@ -67,9 +67,9 @@ var t = 30, n = [
67
67
  topics: t,
68
68
  transport: "sse",
69
69
  close: () => r.abort(),
70
- publish: async (t, n, r) => {
70
+ publish: async (t, n, r, { echo: i }) => {
71
71
  if (!o) return !1;
72
- let i = await f(e, {
72
+ let a = await f(e, {
73
73
  method: "POST",
74
74
  headers: { "content-type": "application/json" },
75
75
  credentials: "same-origin",
@@ -77,10 +77,11 @@ var t = 30, n = [
77
77
  token: o,
78
78
  topic: t,
79
79
  type: n,
80
- data: r
80
+ data: r,
81
+ ...i ? { echo: i } : {}
81
82
  })
82
83
  }).catch(() => void 0);
83
- return i?.status === 401 && v === c && N(), i?.ok ?? !1;
84
+ return a?.status === 401 && v === c && N(), a?.ok ?? !1;
84
85
  }
85
86
  }, l = async (e) => {
86
87
  let t = e.body?.getReader();
@@ -119,22 +120,23 @@ var t = 30, n = [
119
120
  close: () => {
120
121
  m = !0, h(), s.close();
121
122
  },
122
- publish: (e, t, n) => new Promise((i) => {
123
+ publish: (e, t, n, { echo: i }) => new Promise((a) => {
123
124
  if (s.readyState !== s.OPEN) {
124
- i(!1);
125
+ a(!1);
125
126
  return;
126
127
  }
127
128
  d += 1;
128
- let a = d, o = setTimeout(() => {
129
- u.delete(a), i(!1);
129
+ let o = d, c = setTimeout(() => {
130
+ u.delete(o), a(!1);
130
131
  }, r);
131
- u.set(a, (e) => {
132
- clearTimeout(o), i(e);
132
+ u.set(o, (e) => {
133
+ clearTimeout(c), a(e);
133
134
  }), s.send(JSON.stringify({
134
- id: a,
135
+ id: o,
135
136
  topic: e,
136
137
  type: t,
137
- data: n
138
+ data: n,
139
+ ...i ? { echo: i } : {}
138
140
  }));
139
141
  })
140
142
  };
@@ -185,15 +187,15 @@ var t = 30, n = [
185
187
  let n = F(e) && !y.has(e);
186
188
  t && m.has(e) && !n && P(!0);
187
189
  },
188
- publish: async (e, t, n) => {
189
- let r = await I(e) && v ? await v.publish(e, t, n) : !1;
190
- return d(r ? "info" : "danger", `${e} → ${t}${r ? "" : " (not delivered)"}`, {
190
+ publish: async (e, t, n, r = {}) => {
191
+ let i = await I(e) && v ? await v.publish(e, t, n, r) : !1;
192
+ return d(i ? "info" : "danger", `${e} → ${t}${i ? "" : " (not delivered)"}`, {
191
193
  event: "published",
192
194
  topic: e,
193
195
  type: t,
194
196
  data: n,
195
- delivered: r
196
- }), r;
197
+ delivered: i
198
+ }), i;
197
199
  },
198
200
  onStatus: (e) => (g.add(e), () => g.delete(e)),
199
201
  get status() {
@@ -1,6 +1,6 @@
1
1
  export { createRealtimeClient, realtimeClientFor } from './client';
2
2
  export { trackPresence } from './presence';
3
- export { JOIN_TYPE, LEAVE_TYPE, PRESENCE_TYPE, REVOKED_TYPE, channelLimits, channelProblems, isValidTopic, matchChannel } from './topics';
3
+ export { JOIN_TYPE, LEAVE_TYPE, OBSERVER_COOKIE_NAME, PRESENCE_TYPE, REVOKED_TYPE, channelLimits, channelProblems, isValidTopic, matchChannel } from './topics';
4
4
  export type { RealtimeClient, RealtimeClientOptions, RealtimeStatus } from './client';
5
5
  export type { PresenceListeners, PresenceTracker, RealtimeMember } from './presence';
6
6
  export type { ChannelMatch } from './topics';
@@ -1,4 +1,4 @@
1
- import { JOIN_TYPE as e, LEAVE_TYPE as t, PRESENCE_TYPE as n, REVOKED_TYPE as r, channelLimits as i, channelProblems as a, isValidTopic as o, matchChannel as s } from "./topics.mjs";
2
- import { createRealtimeClient as c, realtimeClientFor as l } from "./client.mjs";
3
- import { trackPresence as u } from "./presence.mjs";
4
- export { e as JOIN_TYPE, t as LEAVE_TYPE, n as PRESENCE_TYPE, r as REVOKED_TYPE, i as channelLimits, a as channelProblems, c as createRealtimeClient, o as isValidTopic, s as matchChannel, l as realtimeClientFor, u as trackPresence };
1
+ import { JOIN_TYPE as e, LEAVE_TYPE as t, OBSERVER_COOKIE_NAME as n, PRESENCE_TYPE as r, REVOKED_TYPE as i, channelLimits as a, channelProblems as o, isValidTopic as s, matchChannel as c } from "./topics.mjs";
2
+ import { createRealtimeClient as l, realtimeClientFor as u } from "./client.mjs";
3
+ import { trackPresence as d } from "./presence.mjs";
4
+ export { e as JOIN_TYPE, t as LEAVE_TYPE, n as OBSERVER_COOKIE_NAME, r as PRESENCE_TYPE, i as REVOKED_TYPE, a as channelLimits, o as channelProblems, l as createRealtimeClient, s as isValidTopic, c as matchChannel, u as realtimeClientFor, d as trackPresence };
@@ -20,7 +20,7 @@ var t = 2e4, n = 65e3, r = /* @__PURE__ */ new WeakMap(), i = (r, i, a) => {
20
20
  }, m = () => {
21
21
  u && r.publish(i, e, l);
22
22
  }, h = r.subscribe(i, (e) => {
23
- if (e.from !== r.me) {
23
+ if (e.from !== r.me || e.echo === !0) {
24
24
  if (e.type === "$presence") {
25
25
  let t = {
26
26
  from: e.from,
@@ -34,3 +34,9 @@ export declare const JOIN_TYPE = "$join";
34
34
  * topic, and hears nothing more on it until a new grant opens it again.
35
35
  */
36
36
  export declare const REVOKED_TYPE = "$revoked";
37
+ /**
38
+ * A page that watches its channels without taking part: what `plitzi page check` and `page shot` load pages with. It
39
+ * hears every topic it may open, and says nothing on any — no arrival, no presence, nothing it publishes — so a check
40
+ * of a live site is never a visitor walking into somebody's room. Anyone may set it; it silences only that page.
41
+ */
42
+ export declare const OBSERVER_COOKIE_NAME = "plitzi-observer";
@@ -21,6 +21,6 @@ var t = /^[A-Za-z0-9:_.-]{1,128}$/, n = "[A-Za-z0-9_.-]{1,64}", r = (e) => t.tes
21
21
  }, l = (e) => ({
22
22
  maxMessageBytes: e.maxMessageBytes ?? 4096,
23
23
  messagesPerSecond: e.messagesPerSecond ?? 30
24
- }), u = "$presence", d = "$leave", f = "$join", p = "$revoked";
24
+ }), u = "$presence", d = "$leave", f = "$join", p = "$revoked", m = "plitzi-observer";
25
25
  //#endregion
26
- export { f as JOIN_TYPE, d as LEAVE_TYPE, u as PRESENCE_TYPE, p as REVOKED_TYPE, l as channelLimits, c as channelProblems, r as isValidTopic, a as matchChannel };
26
+ export { f as JOIN_TYPE, d as LEAVE_TYPE, m as OBSERVER_COOKIE_NAME, u as PRESENCE_TYPE, p as REVOKED_TYPE, l as channelLimits, c as channelProblems, r as isValidTopic, a as matchChannel };