@plitzi/sdk-shared 0.35.1 → 0.35.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
@@ -1,5 +1,27 @@
1
1
  # @plitzi/sdk-shared
2
2
 
3
+ ## 0.35.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 470aaf8: The theme is a data source, and a binding reads every source its template names.
8
+
9
+ - **`theme` global source.** `GlobalSources` publishes `runtime.sources.theme` as `{ mode, resolved }` for the area
10
+ the space paints in. `resolved` is always `light` or `dark`, so `{{ theme.resolved }}` is what a URL or a `when`
11
+ rule wants — a dashboard asking the API for a thumbnail in the visitor's scheme, for one. The comments that promised
12
+ `{{ theme.resolved }}` through the app store's `theme` mirror were wrong: nothing a binding reads lives there.
13
+ - **A binding subscribes to the roots of its `twigTemplate`.** It used to get only the head of its `source`, so a
14
+ binding on `list_spaces.item.id` whose template also said `{{ theme.resolved }}` or `{{ state.scope }}` resolved the
15
+ second name to nothing, silently. The names are read off the parsed template (`templateRootNames`, exported from
16
+ `@plitzi/sdk-shared/helpers/twigWrapper`). A name that is not a source is left out of the map rather than set to
17
+ `undefined`, so `{{ source }}` and the variables lifted to the template's root are never shadowed.
18
+ - **Authoring.** `theme` joins `GLOBAL_SOURCES`: `bind: { src: 'theme.resolved' }` is accepted, and an element can no
19
+ longer be named `theme`.
20
+
21
+ ### Patch Changes
22
+
23
+ - v0.35.2
24
+
3
25
  ## 0.35.1
4
26
 
5
27
  ### Patch Changes
@@ -1,13 +1,14 @@
1
1
  import { filters as e } from "./twigWrapper/filters/filters.mjs";
2
2
  import { processTwig as t } from "./twigWrapper/processTwig/processTwig.mjs";
3
3
  import { hasValidToken as n } from "./twigWrapper/tokens/hasValidToken.mjs";
4
- import r from "./fetchManifest.mjs";
5
- import i from "./generateFacade.mjs";
6
- import a from "./syntaxHighlight.mjs";
7
- import { formatDate as o, formatDateUTC as s, formatFromNow as c, formatUTCToLocal as l, getDurationMs as u, isDate as d, isValidFormat as f, parseDate as p, toUnixSeconds as m } from "./formatDate.mjs";
8
- import { isUserEdit as h } from "./reducerOrigin.mjs";
9
- import { evaluateRuleGroup as g } from "./ruleEvaluator.mjs";
10
- import { ParamsFromURL as _, delay as v, emptyObject as y, getDisplayName as b, getKeyDecoded as x, getPathsFromObeject as S, hexToRGB as C, isInViewport as w, makeId as T } from "./utils.mjs";
11
- import { disableReactDevTools as E } from "./security.mjs";
12
- import { createStripTypenameLink as D, stripTypenameDeep as O } from "./stripTypename.mjs";
13
- export { _ as ParamsFromURL, D as createStripTypenameLink, v as delay, E as disableReactDevTools, y as emptyObject, g as evaluateRuleGroup, r as fetchManifest, e as filters, o as formatDate, s as formatDateUTC, c as formatFromNow, l as formatUTCToLocal, i as generateFacade, b as getDisplayName, u as getDurationMs, x as getKeyDecoded, S as getPathsFromObeject, n as hasValidToken, C as hexToRGB, d as isDate, w as isInViewport, h as isUserEdit, f as isValidFormat, T as makeId, p as parseDate, t as processTwig, O as stripTypenameDeep, a as syntaxHighlight, m as toUnixSeconds };
4
+ import { templateRootNames as r } from "./twigWrapper/templateRoots.mjs";
5
+ import i from "./fetchManifest.mjs";
6
+ import a from "./generateFacade.mjs";
7
+ import o from "./syntaxHighlight.mjs";
8
+ import { formatDate as s, formatDateUTC as c, formatFromNow as l, formatUTCToLocal as u, getDurationMs as d, isDate as f, isValidFormat as p, parseDate as m, toUnixSeconds as h } from "./formatDate.mjs";
9
+ import { isUserEdit as g } from "./reducerOrigin.mjs";
10
+ import { evaluateRuleGroup as _ } from "./ruleEvaluator.mjs";
11
+ import { ParamsFromURL as v, delay as y, emptyObject as b, getDisplayName as x, getKeyDecoded as S, getPathsFromObeject as C, hexToRGB as w, isInViewport as T, makeId as E } from "./utils.mjs";
12
+ import { disableReactDevTools as D } from "./security.mjs";
13
+ import { createStripTypenameLink as O, stripTypenameDeep as k } from "./stripTypename.mjs";
14
+ export { v as ParamsFromURL, O as createStripTypenameLink, y as delay, D as disableReactDevTools, b as emptyObject, _ as evaluateRuleGroup, i as fetchManifest, e as filters, s as formatDate, c as formatDateUTC, l as formatFromNow, u as formatUTCToLocal, a as generateFacade, x as getDisplayName, d as getDurationMs, S as getKeyDecoded, C as getPathsFromObeject, n as hasValidToken, w as hexToRGB, f as isDate, T as isInViewport, g as isUserEdit, p as isValidFormat, E as makeId, m as parseDate, t as processTwig, k as stripTypenameDeep, o as syntaxHighlight, r as templateRootNames, h as toUnixSeconds };
@@ -1,5 +1,6 @@
1
1
  export { processTwig } from './processTwig';
2
2
  export { hasValidToken } from './tokens/hasValidToken';
3
+ export { templateRootNames } from './templateRoots';
3
4
  export { filters } from './filters/filters';
4
5
  export type { ASTNode, Expression } from './AST';
5
6
  export type { TwigFilter } from './filters/filters';
@@ -1,4 +1,5 @@
1
1
  import { filters as e } from "./filters/filters.mjs";
2
2
  import { processTwig as t } from "./processTwig/processTwig.mjs";
3
3
  import { hasValidToken as n } from "./tokens/hasValidToken.mjs";
4
- export { e as filters, n as hasValidToken, t as processTwig };
4
+ import { templateRootNames as r } from "./templateRoots.mjs";
5
+ export { e as filters, n as hasValidToken, t as processTwig, r as templateRootNames };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Every top-level name a template reads: `{{ theme.resolved }}` and `{% if state.open %}` both give their first segment.
3
+ *
4
+ * Read off the parsed template rather than matched with a pattern, so a name inside a filter argument, a ternary or a
5
+ * loop's collection counts, and one inside a string literal does not. Names the template binds itself — a loop
6
+ * variable, a `set` — come back too: they resolve to no source, and asking for a name that is not there costs nothing.
7
+ */
8
+ export declare const templateRootNames: (template: string) => string[];
@@ -0,0 +1,23 @@
1
+ import { resolveTokens as e } from "./TemplateCache/TemplateCache.mjs";
2
+ //#region src/helpers/twigWrapper/templateRoots.ts
3
+ var t = (e, n) => {
4
+ if (Array.isArray(e)) {
5
+ for (let r of e) t(r, n);
6
+ return;
7
+ }
8
+ if (typeof e == "object" && e) {
9
+ if ("type" in e && e.type === "path" && "segments" in e && Array.isArray(e.segments)) {
10
+ let t = e.segments[0];
11
+ typeof t == "string" && n.add(t);
12
+ return;
13
+ }
14
+ for (let r of Object.values(e)) t(r, n);
15
+ }
16
+ }, n = (n) => {
17
+ let r = e(n);
18
+ if (!r) return [];
19
+ let i = /* @__PURE__ */ new Set();
20
+ return t(r.nodes ?? r.nodesWithSource, i), [...i];
21
+ };
22
+ //#endregion
23
+ export { n as templateRootNames };
package/dist/index.mjs CHANGED
@@ -3,61 +3,62 @@ import { createAuthFailureLink as i } from "./auth/authFailureLink.mjs";
3
3
  import { filters as a } from "./helpers/twigWrapper/filters/filters.mjs";
4
4
  import { processTwig as o } from "./helpers/twigWrapper/processTwig/processTwig.mjs";
5
5
  import { hasValidToken as s } from "./helpers/twigWrapper/tokens/hasValidToken.mjs";
6
- import c from "./builder/contexts/BuilderContext.mjs";
7
- import { contexts_exports as l } from "./builder/contexts/index.mjs";
8
- import { BODYLESS_METHODS as u, CONNECTOR_HTTP_METHODS as d, DEFAULT_READ_ENDPOINT as f, EMPTY_RESPONSE_METHODS as p, READ_ENDPOINT_NAMES as m, WRITE_ENDPOINT_NAMES as h } from "./connectors/constants.mjs";
9
- import { connectorTokens as g, getConnectorTokens as _ } from "./connectors/manifestTokens.mjs";
10
- import { connectorPresets as v, emptyManifest as y } from "./connectors/presets.mjs";
11
- import { validateConnectorManifest as b } from "./connectors/validateManifest.mjs";
12
- import x from "./helpers/fetchManifest.mjs";
13
- import S from "./helpers/generateFacade.mjs";
14
- import C from "./helpers/syntaxHighlight.mjs";
15
- import { formatDate as w, formatDateUTC as T, formatFromNow as E, formatUTCToLocal as D, getDurationMs as O, isDate as k, isValidFormat as A, parseDate as j, toUnixSeconds as M } from "./helpers/formatDate.mjs";
16
- import { isUserEdit as N } from "./helpers/reducerOrigin.mjs";
17
- import { evaluateRuleGroup as P } from "./helpers/ruleEvaluator.mjs";
18
- 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 "./helpers/utils.mjs";
19
- import { disableReactDevTools as W } from "./helpers/security.mjs";
20
- import { createStripTypenameLink as G, stripTypenameDeep as K } from "./helpers/stripTypename.mjs";
21
- import q, { utilityOptions as J } from "./dataSource/utility/index.mjs";
22
- import Y from "./dataSource/getBindingsDetails.mjs";
23
- import X from "./dataSource/helpers/getSourceName.mjs";
24
- import Z from "./dataSource/hooks/useRegisterSource.mjs";
25
- import Q from "./dataSource/resolveVariables.mjs";
26
- import $ from "./devTools/DevToolsContext.mjs";
27
- import { debugCookieName as ee } from "./devTools/debugCookie.mjs";
28
- import te from "./devTools/interactionLog.mjs";
29
- import ne, { createStoreDevToolsLogger as re, pConsole as ie } from "./devTools/utils/PlitziConsole.mjs";
30
- import ae from "./elements/ComponentContext.mjs";
31
- import oe from "./hooks/useFontHead.mjs";
32
- import se from "./hooks/useNetwork.mjs";
33
- import ce, { PlitziServiceContext as le, PlitziServiceProvider as ue } from "./hooks/usePlitziServiceContext.mjs";
34
- import { StyleVariableCategory as de } from "./types/StyleTypes.mjs";
35
- import fe, { EMPTY_STYLE_SCHEMA as pe, StyleBindingsAllowed as me, baseDefaultValue as he, inheritableAttributesBase as ge } from "./style/styleConstants.mjs";
36
- import { fontLinkAssets as _e } from "./style/fontAssets.mjs";
37
- import { SYSTEM_FONTS as ve, availableFonts as ye, familiesInCss as be, fontFamilyStack as xe, fontUrlResolver as Se, fontsToHead as Ce, googleCss2Url as we, googleTextSubsetUrl as Te, isSafeFontUrl as Ee, primaryFamily as De } from "./style/fonts.mjs";
38
- import { FontValidationError as Oe, parseSpaceFont as ke } from "./style/fontValidation.mjs";
39
- import { fallbackForFamily as Ae, fontsFromCss as je } from "./style/fontsFromCss.mjs";
40
- import Me from "./schema/SchemaContext.mjs";
41
- import { EMPTY_SCHEMA as Ne, VARIABLE_REGEX as Pe } from "./schema/schemaConstants.mjs";
42
- import { collectServerElements as Fe, hasServerElements as Ie } from "./schema/serverElements.mjs";
43
- import Le from "./network/NetworkContext.mjs";
44
- import Re from "./network/NetworkInternalContext.mjs";
45
- import { SpaceEvents as ze, spaceEventSchemas as Be, validateSpaceEvent as Ve } from "./network/spaceEvents.mjs";
46
- import He from "./network/graphql/builder/Mutations/index.mjs";
47
- import Ue from "./network/graphql/builder/Queries/index.mjs";
48
- import We from "./network/graphql/builder/Subscriptions/index.mjs";
49
- import Ge from "./network/graphql/sdk/Mutations/index.mjs";
50
- import Ke from "./network/graphql/sdk/Queries/index.mjs";
51
- import qe from "./segments/SegmentsContext.mjs";
52
- import Je, { RTEvent as Ye, RTEventCloseCode as Xe, getInstance as Ze, isRTEvent as Qe, setInstance as $e } from "./websockets/RTCodec.mjs";
53
- import { THEME_CLASSES as et, THEME_COOKIE_NAME as tt, applyThemeClass as nt, isTheme as rt, readThemeCookie as it, themeFromCookies as at, writeThemeCookie as ot } from "./theme/themeCookie.mjs";
54
- import st, { createThemeState as ct, createThemeStore as lt, resolveScheme as ut, setAreaTheme as dt, setMachineScheme as ft, setThemeMode as pt, themeFor as mt } from "./theme/themeStore.mjs";
55
- import { useThemeStore as ht } from "./theme/ThemeScope.mjs";
56
- import gt from "./theme/ThemeProvider.mjs";
57
- import _t, { SPACE_THEME_AREA as vt } from "./theme/useTheme.mjs";
58
- import yt from "./server/actions/useActionsSync.mjs";
59
- import bt, { currentRscLocation as xt, rscDataPath as St } from "./server/rsc/refreshRsc.mjs";
60
- import Ct from "./server/rsc/useRscRefresh.mjs";
61
- import wt from "./server/rsc/useRscSync.mjs";
62
- import { runtimeStatePersist as Tt } from "./state/runtimeStatePersist.mjs";
63
- export { u as BODYLESS_METHODS, c as BuilderContext, He as BuilderMutations, Ue as BuilderQueries, d as CONNECTOR_HTTP_METHODS, ae as ComponentContext, f as DEFAULT_READ_ENDPOINT, $ as DevToolsContext, p as EMPTY_RESPONSE_METHODS, Ne as EMPTY_SCHEMA, pe as EMPTY_STYLE_SCHEMA, Oe as FontValidationError, Le as NetworkContext, Re as NetworkInternalContext, F as ParamsFromURL, ne as PlitziConsole, le as PlitziServiceContext, ue as PlitziServiceProvider, m as READ_ENDPOINT_NAMES, Je as RTCodec, Ye as RTEvent, Xe as RTEventCloseCode, vt as SPACE_THEME_AREA, ve as SYSTEM_FONTS, Me as SchemaContext, Ge as SdkMutations, Ke as SdkQueries, qe as SegmentsContext, We as SpaceEventSubscription, ze as SpaceEvents, me as StyleBindingsAllowed, de as StyleVariableCategory, et as THEME_CLASSES, tt as THEME_COOKIE_NAME, gt as ThemeProvider, Pe as VARIABLE_REGEX, h as WRITE_ENDPOINT_NAMES, nt as applyThemeClass, e as authFailureFromResponse, ye as availableFonts, he as baseDefaultValue, Fe as collectServerElements, v as connectorPresets, g as connectorTokens, l as contexts, i as createAuthFailureLink, re as createStoreDevToolsLogger, G as createStripTypenameLink, ct as createThemeState, lt as createThemeStore, xt as currentRscLocation, ee as debugCookieName, I as delay, W as disableReactDevTools, y as emptyManifest, L as emptyObject, P as evaluateRuleGroup, Ae as fallbackForFamily, be as familiesInCss, x as fetchManifest, a as filters, xe as fontFamilyStack, _e as fontLinkAssets, Se as fontUrlResolver, je as fontsFromCss, Ce as fontsToHead, w as formatDate, T as formatDateUTC, E as formatFromNow, D as formatUTCToLocal, S as generateFacade, Y as getBindingsDetails, _ as getConnectorTokens, R as getDisplayName, O as getDurationMs, Ze as getInstance, z as getKeyDecoded, B as getPathsFromObeject, X as getSourceName, we as googleCss2Url, Te as googleTextSubsetUrl, Ie as hasServerElements, s as hasValidToken, V as hexToRGB, ge as inheritableAttributesBase, k as isDate, H as isInViewport, te as isInteractionFlow, Qe as isRTEvent, Ee as isSafeFontUrl, rt as isTheme, N as isUserEdit, A as isValidFormat, U as makeId, t as onAuthFailure, ie as pConsole, j as parseDate, ke as parseSpaceFont, De as primaryFamily, o as processTwig, it as readThemeCookie, bt as refreshRsc, n as reportAuthFailure, ut as resolveScheme, Q as resolveVariables, St as rscDataPath, Tt as runtimeStatePersist, r as sameRegistrableDomain, dt as setAreaTheme, $e as setInstance, ft as setMachineScheme, pt as setThemeMode, Be as spaceEventSchemas, K as stripTypenameDeep, fe as styleConstants, C as syntaxHighlight, mt as themeFor, at as themeFromCookies, st as themeStore, M as toUnixSeconds, yt as useActionsSync, oe as useFontHead, se as useNetwork, ce as usePlitziServiceContext, Z as useRegisterSource, Ct as useRscRefresh, wt as useRscSync, _t as useTheme, ht as useThemeStore, q as utility, J as utilityOptions, b as validateConnectorManifest, Ve as validateSpaceEvent, ot as writeThemeCookie };
6
+ import { templateRootNames as c } from "./helpers/twigWrapper/templateRoots.mjs";
7
+ import l from "./builder/contexts/BuilderContext.mjs";
8
+ import { contexts_exports as u } from "./builder/contexts/index.mjs";
9
+ import { BODYLESS_METHODS as d, CONNECTOR_HTTP_METHODS as f, DEFAULT_READ_ENDPOINT as p, EMPTY_RESPONSE_METHODS as m, READ_ENDPOINT_NAMES as h, WRITE_ENDPOINT_NAMES as g } from "./connectors/constants.mjs";
10
+ import { connectorTokens as _, getConnectorTokens as v } from "./connectors/manifestTokens.mjs";
11
+ import { connectorPresets as y, emptyManifest as b } from "./connectors/presets.mjs";
12
+ import { validateConnectorManifest as x } from "./connectors/validateManifest.mjs";
13
+ import S from "./helpers/fetchManifest.mjs";
14
+ import C from "./helpers/generateFacade.mjs";
15
+ import w from "./helpers/syntaxHighlight.mjs";
16
+ import { formatDate as T, formatDateUTC as E, formatFromNow as D, formatUTCToLocal as O, getDurationMs as k, isDate as A, isValidFormat as j, parseDate as M, toUnixSeconds as N } from "./helpers/formatDate.mjs";
17
+ import { isUserEdit as P } from "./helpers/reducerOrigin.mjs";
18
+ import { evaluateRuleGroup as F } from "./helpers/ruleEvaluator.mjs";
19
+ import { ParamsFromURL as I, delay as L, emptyObject as R, getDisplayName as z, getKeyDecoded as B, getPathsFromObeject as V, hexToRGB as H, isInViewport as U, makeId as W } from "./helpers/utils.mjs";
20
+ import { disableReactDevTools as G } from "./helpers/security.mjs";
21
+ import { createStripTypenameLink as K, stripTypenameDeep as q } from "./helpers/stripTypename.mjs";
22
+ import J, { utilityOptions as Y } from "./dataSource/utility/index.mjs";
23
+ import X from "./dataSource/getBindingsDetails.mjs";
24
+ import Z from "./dataSource/helpers/getSourceName.mjs";
25
+ import Q from "./dataSource/hooks/useRegisterSource.mjs";
26
+ import $ from "./dataSource/resolveVariables.mjs";
27
+ import ee from "./devTools/DevToolsContext.mjs";
28
+ import { debugCookieName as te } from "./devTools/debugCookie.mjs";
29
+ import ne from "./devTools/interactionLog.mjs";
30
+ import re, { createStoreDevToolsLogger as ie, pConsole as ae } from "./devTools/utils/PlitziConsole.mjs";
31
+ import oe from "./elements/ComponentContext.mjs";
32
+ import se from "./hooks/useFontHead.mjs";
33
+ import ce from "./hooks/useNetwork.mjs";
34
+ import le, { PlitziServiceContext as ue, PlitziServiceProvider as de } from "./hooks/usePlitziServiceContext.mjs";
35
+ import { StyleVariableCategory as fe } from "./types/StyleTypes.mjs";
36
+ import pe, { EMPTY_STYLE_SCHEMA as me, StyleBindingsAllowed as he, baseDefaultValue as ge, inheritableAttributesBase as _e } from "./style/styleConstants.mjs";
37
+ import { fontLinkAssets as ve } from "./style/fontAssets.mjs";
38
+ import { SYSTEM_FONTS as ye, availableFonts as be, familiesInCss as xe, fontFamilyStack as Se, fontUrlResolver as Ce, fontsToHead as we, googleCss2Url as Te, googleTextSubsetUrl as Ee, isSafeFontUrl as De, primaryFamily as Oe } from "./style/fonts.mjs";
39
+ import { FontValidationError as ke, parseSpaceFont as Ae } from "./style/fontValidation.mjs";
40
+ import { fallbackForFamily as je, fontsFromCss as Me } from "./style/fontsFromCss.mjs";
41
+ import Ne from "./schema/SchemaContext.mjs";
42
+ import { EMPTY_SCHEMA as Pe, VARIABLE_REGEX as Fe } from "./schema/schemaConstants.mjs";
43
+ import { collectServerElements as Ie, hasServerElements as Le } from "./schema/serverElements.mjs";
44
+ import Re from "./network/NetworkContext.mjs";
45
+ import ze from "./network/NetworkInternalContext.mjs";
46
+ import { SpaceEvents as Be, spaceEventSchemas as Ve, validateSpaceEvent as He } from "./network/spaceEvents.mjs";
47
+ import Ue from "./network/graphql/builder/Mutations/index.mjs";
48
+ import We from "./network/graphql/builder/Queries/index.mjs";
49
+ import Ge from "./network/graphql/builder/Subscriptions/index.mjs";
50
+ import Ke from "./network/graphql/sdk/Mutations/index.mjs";
51
+ import qe from "./network/graphql/sdk/Queries/index.mjs";
52
+ import Je from "./segments/SegmentsContext.mjs";
53
+ import Ye, { RTEvent as Xe, RTEventCloseCode as Ze, getInstance as Qe, isRTEvent as $e, setInstance as et } from "./websockets/RTCodec.mjs";
54
+ import { THEME_CLASSES as tt, THEME_COOKIE_NAME as nt, applyThemeClass as rt, isTheme as it, readThemeCookie as at, themeFromCookies as ot, writeThemeCookie as st } from "./theme/themeCookie.mjs";
55
+ import ct, { createThemeState as lt, createThemeStore as ut, resolveScheme as dt, setAreaTheme as ft, setMachineScheme as pt, setThemeMode as mt, themeFor as ht } from "./theme/themeStore.mjs";
56
+ import { useThemeStore as gt } from "./theme/ThemeScope.mjs";
57
+ import _t from "./theme/ThemeProvider.mjs";
58
+ import vt, { SPACE_THEME_AREA as yt } from "./theme/useTheme.mjs";
59
+ import bt from "./server/actions/useActionsSync.mjs";
60
+ import xt, { currentRscLocation as St, rscDataPath as Ct } from "./server/rsc/refreshRsc.mjs";
61
+ import wt from "./server/rsc/useRscRefresh.mjs";
62
+ import Tt from "./server/rsc/useRscSync.mjs";
63
+ import { runtimeStatePersist as Et } from "./state/runtimeStatePersist.mjs";
64
+ export { d as BODYLESS_METHODS, l as BuilderContext, Ue as BuilderMutations, We as BuilderQueries, f as CONNECTOR_HTTP_METHODS, oe as ComponentContext, p as DEFAULT_READ_ENDPOINT, ee as DevToolsContext, m as EMPTY_RESPONSE_METHODS, Pe as EMPTY_SCHEMA, me as EMPTY_STYLE_SCHEMA, ke as FontValidationError, Re as NetworkContext, ze as NetworkInternalContext, I as ParamsFromURL, re as PlitziConsole, ue as PlitziServiceContext, de as PlitziServiceProvider, h as READ_ENDPOINT_NAMES, Ye as RTCodec, Xe as RTEvent, Ze as RTEventCloseCode, yt as SPACE_THEME_AREA, ye as SYSTEM_FONTS, Ne as SchemaContext, Ke as SdkMutations, qe as SdkQueries, Je as SegmentsContext, Ge as SpaceEventSubscription, Be as SpaceEvents, he as StyleBindingsAllowed, fe as StyleVariableCategory, tt as THEME_CLASSES, nt as THEME_COOKIE_NAME, _t as ThemeProvider, Fe as VARIABLE_REGEX, g as WRITE_ENDPOINT_NAMES, rt as applyThemeClass, e as authFailureFromResponse, be as availableFonts, ge as baseDefaultValue, Ie as collectServerElements, y as connectorPresets, _ as connectorTokens, u as contexts, i as createAuthFailureLink, ie as createStoreDevToolsLogger, K as createStripTypenameLink, lt as createThemeState, ut as createThemeStore, St as currentRscLocation, te as debugCookieName, L as delay, G as disableReactDevTools, b as emptyManifest, R as emptyObject, F as evaluateRuleGroup, je as fallbackForFamily, xe as familiesInCss, S as fetchManifest, a as filters, Se as fontFamilyStack, ve as fontLinkAssets, Ce as fontUrlResolver, Me as fontsFromCss, we as fontsToHead, T as formatDate, E as formatDateUTC, D as formatFromNow, O as formatUTCToLocal, C as generateFacade, X as getBindingsDetails, v as getConnectorTokens, z as getDisplayName, k as getDurationMs, Qe as getInstance, B as getKeyDecoded, V as getPathsFromObeject, Z as getSourceName, Te as googleCss2Url, Ee as googleTextSubsetUrl, Le as hasServerElements, s as hasValidToken, H as hexToRGB, _e as inheritableAttributesBase, A as isDate, U as isInViewport, ne as isInteractionFlow, $e as isRTEvent, De as isSafeFontUrl, it as isTheme, P as isUserEdit, j as isValidFormat, W as makeId, t as onAuthFailure, ae as pConsole, M as parseDate, Ae as parseSpaceFont, Oe as primaryFamily, o as processTwig, at as readThemeCookie, xt as refreshRsc, n as reportAuthFailure, dt as resolveScheme, $ as resolveVariables, Ct as rscDataPath, Et as runtimeStatePersist, r as sameRegistrableDomain, ft as setAreaTheme, et as setInstance, pt as setMachineScheme, mt as setThemeMode, Ve as spaceEventSchemas, q as stripTypenameDeep, pe as styleConstants, w as syntaxHighlight, c as templateRootNames, ht as themeFor, ot as themeFromCookies, ct as themeStore, N as toUnixSeconds, bt as useActionsSync, se as useFontHead, ce as useNetwork, le as usePlitziServiceContext, Q as useRegisterSource, wt as useRscRefresh, Tt as useRscSync, vt as useTheme, gt as useThemeStore, J as utility, Y as utilityOptions, x as validateConnectorManifest, He as validateSpaceEvent, st as writeThemeCookie };
@@ -17,6 +17,10 @@ export type RuntimeSourceValues = {
17
17
  auth?: Record<string, unknown>;
18
18
  state?: Record<string, unknown>;
19
19
  host?: Record<string, unknown>;
20
+ theme?: {
21
+ mode: Theme;
22
+ resolved: ColorScheme;
23
+ };
20
24
  };
21
25
  export type CommonState = {
22
26
  prevSchema?: Schema;
@@ -42,8 +46,10 @@ export type CommonState = {
42
46
  actions?: ActionsState;
43
47
  render?: RenderSettings;
44
48
  /**
45
- * The theme, mirrored from `themeStore` so it reads like everything else: `{{ theme.resolved }}` in a binding, a
46
- * `when` rule that switches on it, and one line in the devtools store viewer that answers "which theme is this".
49
+ * The theme, mirrored from `themeStore` so the devtools store viewer answers "which theme is this" in one line.
50
+ *
51
+ * Bindings and `when` rules do NOT read this copy: like every other global they read `runtime.sources`, where
52
+ * `GlobalSources` publishes the `theme` source for the area the space paints in.
47
53
  *
48
54
  * A MIRROR and never the source. The theme has to be readable by things that are not under any provider — the
49
55
  * dev-tools panel in its shadow root, an editor in a portal — which no app store can serve, so `themeStore` owns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.35.1",
3
+ "version": "0.35.2",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -400,6 +400,10 @@
400
400
  "types": "./dist/helpers/twigWrapper/processTwig/processTwig.d.ts",
401
401
  "import": "./dist/helpers/twigWrapper/processTwig/processTwig.mjs"
402
402
  },
403
+ "./helpers/twigWrapper/templateRoots": {
404
+ "types": "./dist/helpers/twigWrapper/templateRoots.d.ts",
405
+ "import": "./dist/helpers/twigWrapper/templateRoots.mjs"
406
+ },
403
407
  "./helpers/twigWrapper/tokens/hasValidToken": {
404
408
  "types": "./dist/helpers/twigWrapper/tokens/hasValidToken.d.ts",
405
409
  "import": "./dist/helpers/twigWrapper/tokens/hasValidToken.mjs"