@contentstack/studio-registry 1.8.0 → 1.9.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.
- package/dist/cjs/index.cjs +998 -201
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/common/global-store.js +2 -0
- package/dist/esm/common/global-store.js.map +1 -1
- package/dist/esm/component-registry/registry-options-processor.js +1 -0
- package/dist/esm/component-registry/registry-options-processor.js.map +1 -1
- package/dist/esm/component-registry/registry.constant.js +0 -3
- package/dist/esm/component-registry/registry.constant.js.map +1 -1
- package/dist/esm/component-registry/registry.js +1 -27
- package/dist/esm/component-registry/registry.js.map +1 -1
- package/dist/esm/data-binder/cslp.js +8 -1
- package/dist/esm/data-binder/cslp.js.map +1 -1
- package/dist/esm/data-binder/retrieve-data.js +11 -32
- package/dist/esm/data-binder/retrieve-data.js.map +1 -1
- package/dist/esm/data-binder/retrieve-data.util.js +7 -4
- package/dist/esm/data-binder/retrieve-data.util.js.map +1 -1
- package/dist/esm/data-binder/state-binding.util.js +158 -0
- package/dist/esm/data-binder/state-binding.util.js.map +1 -0
- package/dist/esm/design-registry/design-token.js +5 -2
- package/dist/esm/design-registry/design-token.js.map +1 -1
- package/dist/esm/index.d.ts +468 -26
- package/dist/esm/index.js +6 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/state-store/action-props.util.js +42 -0
- package/dist/esm/state-store/action-props.util.js.map +1 -0
- package/dist/esm/state-store/function-registry.js +128 -0
- package/dist/esm/state-store/function-registry.js.map +1 -0
- package/dist/esm/state-store/public-api.js +109 -0
- package/dist/esm/state-store/public-api.js.map +1 -0
- package/dist/esm/state-store/singleton.js +27 -0
- package/dist/esm/state-store/singleton.js.map +1 -0
- package/dist/esm/state-store/state-store.js +384 -0
- package/dist/esm/state-store/state-store.js.map +1 -0
- package/package.json +6 -6
- package/dist/esm/utils/symbols.js +0 -12
- package/dist/esm/utils/symbols.js.map +0 -1
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
const isServer = () => typeof window === "undefined";
|
|
2
|
+
const isDev = () => typeof process !== "undefined" && process.env.NODE_ENV === "development";
|
|
3
|
+
const DEFAULT_STORAGE_KEY = "cs-studio:state";
|
|
4
|
+
/**
|
|
5
|
+
* Built-in web-storage backend for `storage: "local" | "session"` — an
|
|
6
|
+
* in-memory object hydrated from the chosen Storage with write-through on
|
|
7
|
+
* every set, plus per-key listeners. SSR-safe: with no `window` it serves
|
|
8
|
+
* memory only (the store's `set` is a server no-op anyway).
|
|
9
|
+
*/
|
|
10
|
+
function createWebStorageBackend(kind, storageKey) {
|
|
11
|
+
const storageArea = () => {
|
|
12
|
+
if (isServer())
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
return kind === "local" ? window.localStorage : window.sessionStorage;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null; // storage blocked (privacy mode / embedded context)
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const values = (() => {
|
|
22
|
+
const area = storageArea();
|
|
23
|
+
if (!area)
|
|
24
|
+
return {};
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(area.getItem(storageKey) ?? "{}");
|
|
27
|
+
// Only a plain object is a valid value map. A stored bare primitive or
|
|
28
|
+
// array (e.g. a colliding storageKey, or an older write) must NOT become
|
|
29
|
+
// `values`, or the first `values[key] = ...` throws in strict mode.
|
|
30
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
31
|
+
? parsed
|
|
32
|
+
: {};
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
})();
|
|
38
|
+
const persist = () => {
|
|
39
|
+
const area = storageArea();
|
|
40
|
+
if (!area)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
area.setItem(storageKey, JSON.stringify(values));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// quota exceeded / storage blocked — state stays in-memory only
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// No `subscribe` bridge: every mutation goes through the SDK's own set()
|
|
50
|
+
// (nothing else holds a reference to this backend), and the store already
|
|
51
|
+
// notifies its per-key listeners after each delegated set.
|
|
52
|
+
return {
|
|
53
|
+
getState: (key) => values[key],
|
|
54
|
+
setState: (key, value) => {
|
|
55
|
+
values[key] = value;
|
|
56
|
+
persist();
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Page-global shared state store — the "Bring Your Own State" (BYOS) core.
|
|
62
|
+
*
|
|
63
|
+
* Delegates reads/writes to the user's `getState`/`setState` when configured
|
|
64
|
+
* (Redux, Zustand, plain object, anything), otherwise falls back to an
|
|
65
|
+
* internal Map. Reactivity is per-key: `set("cart")` notifies ONLY listeners
|
|
66
|
+
* subscribed to `"cart"`, so unrelated components never re-render.
|
|
67
|
+
*
|
|
68
|
+
* One instance per JS runtime via the globalThis registry slot (see
|
|
69
|
+
* `singleton.ts`) — every surface (components, sections, templates, custom
|
|
70
|
+
* code) reads and writes the same store.
|
|
71
|
+
*
|
|
72
|
+
* SSR: `set` is a no-op with a dev warning (a mutable process-wide store
|
|
73
|
+
* would leak state across requests); `get` still delegates so a
|
|
74
|
+
* server-appropriate `getState` (e.g. request-scoped values) works, falling
|
|
75
|
+
* back to declared defaults.
|
|
76
|
+
*/
|
|
77
|
+
class StudioStateStore {
|
|
78
|
+
userConfig = null;
|
|
79
|
+
internal = new Map();
|
|
80
|
+
listeners = new Map();
|
|
81
|
+
variables = new Map();
|
|
82
|
+
/** Priority tier each declaration came from (see StateVariableTier). */
|
|
83
|
+
variableTiers = new Map();
|
|
84
|
+
/** Fired when the DECLARED variable set changes (declare/configure/reset). */
|
|
85
|
+
variableListeners = new Set();
|
|
86
|
+
/** One bridge subscription per key into the user's own store. */
|
|
87
|
+
externalUnsubs = new Map();
|
|
88
|
+
warnedServerSet = false;
|
|
89
|
+
/**
|
|
90
|
+
* Wire the state backend + init-declared variables. Called once from SDK
|
|
91
|
+
* init; calling again replaces the config (HMR-safe — variables merge,
|
|
92
|
+
* they don't reset).
|
|
93
|
+
*
|
|
94
|
+
* Storage resolution (see StudioStateStorage):
|
|
95
|
+
* - `storage: "custom"` → user's getState/setState (required).
|
|
96
|
+
* - `storage: "local"` → built-in localStorage store.
|
|
97
|
+
* - `storage: "session"` → built-in sessionStorage store.
|
|
98
|
+
* - omitted → custom when getState+setState are provided,
|
|
99
|
+
* otherwise the built-in SESSION store.
|
|
100
|
+
*/
|
|
101
|
+
configure(config) {
|
|
102
|
+
const hasCustomFns = typeof config.getState === "function" &&
|
|
103
|
+
typeof config.setState === "function";
|
|
104
|
+
const storage = config.storage ?? (hasCustomFns ? "custom" : "session");
|
|
105
|
+
// Reconfigure (HMR / second init): tear down bridges bound to the PREVIOUS
|
|
106
|
+
// backend before switching, so ensureExternalBridge below rebuilds them
|
|
107
|
+
// against the new store instead of leaving them pointing at the old one.
|
|
108
|
+
for (const unsub of this.externalUnsubs.values())
|
|
109
|
+
unsub();
|
|
110
|
+
this.externalUnsubs.clear();
|
|
111
|
+
if (storage === "custom") {
|
|
112
|
+
if (!hasCustomFns) {
|
|
113
|
+
throw new Error('[Composable Studio SDK] state storage "custom" requires getState and setState functions');
|
|
114
|
+
}
|
|
115
|
+
this.userConfig = {
|
|
116
|
+
getState: config.getState,
|
|
117
|
+
setState: config.setState,
|
|
118
|
+
subscribe: config.subscribe,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
if (hasCustomFns && isDev()) {
|
|
123
|
+
console.warn(`[Composable Studio SDK] state storage "${storage}" uses the built-in store — the provided getState/setState are ignored (use storage: "custom" to keep them)`);
|
|
124
|
+
}
|
|
125
|
+
this.userConfig = createWebStorageBackend(storage, config.storageKey ?? DEFAULT_STORAGE_KEY);
|
|
126
|
+
}
|
|
127
|
+
// Migrate writes made BEFORE configure ran (they landed in the internal Map
|
|
128
|
+
// because userConfig was null) into the now-resolved backend, so a
|
|
129
|
+
// pre-init `set("cart:count", 3)` isn't silently dropped when init lands.
|
|
130
|
+
// Don't clobber a value the new backend already holds (e.g. hydrated Redux
|
|
131
|
+
// / persisted web storage) — pre-init writes only fill the gaps.
|
|
132
|
+
for (const [key, value] of this.internal) {
|
|
133
|
+
try {
|
|
134
|
+
if (this.userConfig.getState(key) === undefined) {
|
|
135
|
+
this.userConfig.setState(key, value);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// backend rejected the migrated write — leave it; not fatal
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
this.internal.clear();
|
|
143
|
+
for (const [key, def] of Object.entries(config.variables ?? {})) {
|
|
144
|
+
this.declareVariable(key, def, "init");
|
|
145
|
+
}
|
|
146
|
+
// Components may have subscribed BEFORE configure ran (e.g. the SDK init
|
|
147
|
+
// module evaluates after React mounted a state-bound component). The new
|
|
148
|
+
// backing store can hold different values (persisted state, hydrated
|
|
149
|
+
// Redux…), so (re)build the external bridge for every already-subscribed
|
|
150
|
+
// key and wake every existing subscriber to re-read.
|
|
151
|
+
for (const key of [...this.listeners.keys()]) {
|
|
152
|
+
this.ensureExternalBridge(key);
|
|
153
|
+
this.notify(key);
|
|
154
|
+
}
|
|
155
|
+
this.notifyVariablesChanged();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Open a single bridge subscription from the user's own store into this
|
|
159
|
+
* store's per-key listeners, so mutations made OUTSIDE Studio propagate in.
|
|
160
|
+
* Idempotent and safe to call from both `subscribe` (first listener) and
|
|
161
|
+
* `configure` (backend arrived/changed after listeners already existed).
|
|
162
|
+
*/
|
|
163
|
+
ensureExternalBridge(key) {
|
|
164
|
+
if (!this.userConfig?.subscribe)
|
|
165
|
+
return;
|
|
166
|
+
if (this.externalUnsubs.has(key))
|
|
167
|
+
return;
|
|
168
|
+
if (!this.listeners.has(key))
|
|
169
|
+
return; // only bridge keys someone listens to
|
|
170
|
+
try {
|
|
171
|
+
const unsub = this.userConfig.subscribe(key, () => this.notify(key));
|
|
172
|
+
this.externalUnsubs.set(key, typeof unsub === "function" ? unsub : () => { });
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
console.error(`[Composable Studio SDK] state subscribe("${key}") threw:`, err);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
isConfigured() {
|
|
179
|
+
return this.userConfig !== null;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Register an author-bindable variable.
|
|
183
|
+
*
|
|
184
|
+
* Priority: a `component`-tier declaration (registerComponentStateVariable at component
|
|
185
|
+
* module scope) OVERRIDES an `init`-tier one (SDK init `state.variables`)
|
|
186
|
+
* for the same key — deterministically, whichever loads first. An init
|
|
187
|
+
* declaration never overrides a component one; it only fills keys no
|
|
188
|
+
* component declared. Same-tier re-declarations (module reload, repeated
|
|
189
|
+
* imports) keep the first definition and dev-warn only when the type
|
|
190
|
+
* conflicts. Runtime `set` values always beat declared defaults.
|
|
191
|
+
*/
|
|
192
|
+
declareVariable(key, def, tier = "component") {
|
|
193
|
+
const existing = this.variables.get(key);
|
|
194
|
+
if (existing) {
|
|
195
|
+
const existingTier = this.variableTiers.get(key) ?? "component";
|
|
196
|
+
if (tier === "component" && existingTier === "init") {
|
|
197
|
+
this.variables.set(key, def);
|
|
198
|
+
this.variableTiers.set(key, tier);
|
|
199
|
+
// The effective default may have changed — wake this key's subscribers
|
|
200
|
+
// (e.g. a mounted useStudioState reading the old default) plus the
|
|
201
|
+
// declared-set listeners.
|
|
202
|
+
this.notify(key);
|
|
203
|
+
this.notifyVariablesChanged();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (existing.type !== def.type && isDev()) {
|
|
207
|
+
console.warn(`[Composable Studio SDK] state variable "${key}" already declared as "${existing.type}"; ignoring re-declaration as "${def.type}"`);
|
|
208
|
+
}
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this.variables.set(key, def);
|
|
212
|
+
this.variableTiers.set(key, tier);
|
|
213
|
+
// A brand-new declaration makes a default available where `get(key)` used
|
|
214
|
+
// to return undefined. Wake any component that already subscribed to this
|
|
215
|
+
// key BEFORE the (lazily-imported) declaration landed, so it re-reads the
|
|
216
|
+
// default instead of staying stuck on undefined.
|
|
217
|
+
this.notify(key);
|
|
218
|
+
this.notifyVariablesChanged();
|
|
219
|
+
}
|
|
220
|
+
/** All declared (author-bindable) variables. */
|
|
221
|
+
getVariables() {
|
|
222
|
+
return Object.fromEntries(this.variables);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Subscribe to declared-variable-set changes. The SDK's Studio bridge uses
|
|
226
|
+
* this to push the fresh values snapshot to the Data Picker — apps declare
|
|
227
|
+
* variables from lazily-imported init code, typically AFTER the component
|
|
228
|
+
* registry synced, so a one-shot pull at sync time reads an empty set.
|
|
229
|
+
*/
|
|
230
|
+
subscribeVariablesChanged(listener) {
|
|
231
|
+
this.variableListeners.add(listener);
|
|
232
|
+
return () => this.variableListeners.delete(listener);
|
|
233
|
+
}
|
|
234
|
+
notifyVariablesChanged() {
|
|
235
|
+
for (const listener of [...this.variableListeners]) {
|
|
236
|
+
try {
|
|
237
|
+
listener();
|
|
238
|
+
}
|
|
239
|
+
catch (err) {
|
|
240
|
+
console.error("[Composable Studio SDK] state variables-changed listener threw:", err);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
isDeclared(key) {
|
|
245
|
+
return this.variables.has(key);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The declared default for a key, ignoring any live backend value. This is
|
|
249
|
+
* the server / hydration baseline: SSR and the client's hydration render
|
|
250
|
+
* must agree, so state-bound content renders the default on both and only
|
|
251
|
+
* switches to a persisted/live value AFTER hydration.
|
|
252
|
+
*/
|
|
253
|
+
getDeclaredDefault(key) {
|
|
254
|
+
return this.variables.get(key)?.defaultValue;
|
|
255
|
+
}
|
|
256
|
+
/** Raw backing value with NO declared-default fallback (undefined if unset). */
|
|
257
|
+
readRaw(key) {
|
|
258
|
+
if (this.userConfig) {
|
|
259
|
+
try {
|
|
260
|
+
return this.userConfig.getState(key);
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
console.error(`[Composable Studio SDK] getState("${key}") threw:`, err);
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return (this.internal.has(key) ? this.internal.get(key) : undefined);
|
|
268
|
+
}
|
|
269
|
+
get(key) {
|
|
270
|
+
let value = this.readRaw(key);
|
|
271
|
+
if (value === undefined) {
|
|
272
|
+
value = this.variables.get(key)?.defaultValue;
|
|
273
|
+
}
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
set(key, next) {
|
|
277
|
+
if (isServer()) {
|
|
278
|
+
if (!this.warnedServerSet && isDev()) {
|
|
279
|
+
this.warnedServerSet = true;
|
|
280
|
+
console.warn("[Composable Studio SDK] setState is a no-op during server rendering — state writes are client-only");
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
// The functional updater sees the effective value (default-aware)...
|
|
285
|
+
const effectivePrev = this.get(key);
|
|
286
|
+
const value = typeof next === "function"
|
|
287
|
+
? next(effectivePrev)
|
|
288
|
+
: next;
|
|
289
|
+
// ...but dedup against the RAW backing value, not get(). Comparing against
|
|
290
|
+
// get() (which folds in the declared default) would swallow the first write
|
|
291
|
+
// of a value that equals the default — e.g. set("cart:count", 0) when the
|
|
292
|
+
// default is 0 — so the backend/custom store never receives it.
|
|
293
|
+
const rawPrev = this.readRaw(key);
|
|
294
|
+
if (Object.is(rawPrev, value))
|
|
295
|
+
return;
|
|
296
|
+
if (this.userConfig) {
|
|
297
|
+
this.userConfig.setState(key, value);
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
this.internal.set(key, value);
|
|
301
|
+
}
|
|
302
|
+
this.notify(key);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Per-key subscription. Returns an unsubscribe. When the user supplied
|
|
306
|
+
* their own `subscribe`, a single bridge per key is also registered so
|
|
307
|
+
* store mutations made OUTSIDE Studio propagate into Studio listeners.
|
|
308
|
+
*/
|
|
309
|
+
subscribe(key, listener) {
|
|
310
|
+
if (isServer())
|
|
311
|
+
return () => { };
|
|
312
|
+
let set = this.listeners.get(key);
|
|
313
|
+
if (!set) {
|
|
314
|
+
set = new Set();
|
|
315
|
+
this.listeners.set(key, set);
|
|
316
|
+
}
|
|
317
|
+
set.add(listener);
|
|
318
|
+
this.ensureExternalBridge(key);
|
|
319
|
+
return () => {
|
|
320
|
+
const listeners = this.listeners.get(key);
|
|
321
|
+
listeners?.delete(listener);
|
|
322
|
+
if (listeners && listeners.size === 0) {
|
|
323
|
+
this.listeners.delete(key);
|
|
324
|
+
const unsubExternal = this.externalUnsubs.get(key);
|
|
325
|
+
if (unsubExternal) {
|
|
326
|
+
this.externalUnsubs.delete(key);
|
|
327
|
+
unsubExternal();
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
notify(key) {
|
|
333
|
+
const listeners = this.listeners.get(key);
|
|
334
|
+
if (!listeners)
|
|
335
|
+
return;
|
|
336
|
+
for (const listener of [...listeners]) {
|
|
337
|
+
try {
|
|
338
|
+
listener();
|
|
339
|
+
}
|
|
340
|
+
catch (err) {
|
|
341
|
+
console.error(`[Composable Studio SDK] state listener for "${key}" threw:`, err);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Soft reset for hosts that want per-page state on a client-side route
|
|
347
|
+
* change (this is what the public `studioState.reset()` calls). Clears the
|
|
348
|
+
* SDK-owned internal values and wakes every subscriber to re-read — but
|
|
349
|
+
* deliberately KEEPS the wired backend, the declared variables, and all live
|
|
350
|
+
* subscriptions. Tearing those down here (the previous behavior) disconnected
|
|
351
|
+
* a configured custom store, wiped every declaration, and froze every still-
|
|
352
|
+
* mounted `useStudioState`. For a full teardown (tests / HMR) use `resetAll`.
|
|
353
|
+
*
|
|
354
|
+
* A configured custom or web-storage backend owns its own values and is left
|
|
355
|
+
* intact — the host resets its own store if it wants those cleared too.
|
|
356
|
+
*/
|
|
357
|
+
reset() {
|
|
358
|
+
this.internal.clear();
|
|
359
|
+
for (const key of [...this.listeners.keys()]) {
|
|
360
|
+
this.notify(key);
|
|
361
|
+
}
|
|
362
|
+
this.notifyVariablesChanged();
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Full teardown — internal values, declarations, config, listeners, and
|
|
366
|
+
* external bridges. For tests and HMR (the singleton drop), NOT for
|
|
367
|
+
* route-change resets (see `reset`).
|
|
368
|
+
*/
|
|
369
|
+
resetAll() {
|
|
370
|
+
for (const unsub of this.externalUnsubs.values())
|
|
371
|
+
unsub();
|
|
372
|
+
this.externalUnsubs.clear();
|
|
373
|
+
this.internal.clear();
|
|
374
|
+
this.listeners.clear();
|
|
375
|
+
this.variables.clear();
|
|
376
|
+
this.variableTiers.clear();
|
|
377
|
+
this.userConfig = null;
|
|
378
|
+
this.warnedServerSet = false;
|
|
379
|
+
this.notifyVariablesChanged();
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export { StudioStateStore };
|
|
384
|
+
//# sourceMappingURL=state-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.js","sources":["../../../src/state-store/state-store.ts"],"sourcesContent":[null],"names":[],"mappings":"AAQA,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW;AAEpD,MAAM,KAAK,GAAG,MACZ,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;AAS1E,MAAM,mBAAmB,GAAG,iBAAiB;AAE7C;;;;;AAKG;AACH,SAAS,uBAAuB,CAC9B,IAAyB,EACzB,UAAkB,EAAA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AA,CAAU,EAC5D,GAAG,CACJ;YACH;QACF;IACF;AAEA;;;;;;;;;;;AAWG;IACH,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;AACrB,QAAA,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE;AAC5C,YAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAClB;QACA,IAAI,CAAC,sBAAsB,EAAE;IAC/B;AAEA;;;;AAIG;IACH,QAAQ,GAAA;QACN,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;AAAE,YAAA,KAAK,EAAE;AACzD,QAAA,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE;AAC3B,QAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;AACrB,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AACtB,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AACtB,QAAA,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;AAC1B,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,QAAA,IAAI,CAAC,eAAe,GAAG,KAAK;QAC5B,IAAI,CAAC,sBAAsB,EAAE;IAC/B;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/studio-registry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "This package houses all the registry related to the visual builder",
|
|
5
5
|
"main": "dist/cjs/index.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@contentstack/common-config": "^1.2.
|
|
19
|
-
"@contentstack/studio-internal": "^1.
|
|
18
|
+
"@contentstack/common-config": "^1.2.3",
|
|
19
|
+
"@contentstack/studio-internal": "^1.6.0",
|
|
20
20
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
21
21
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
22
22
|
"@rollup/plugin-terser": "^1.0.0",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@contentstack/json-rte-serializer": "^3.1.0",
|
|
56
|
-
"@contentstack/studio-message-types": "^1.5.
|
|
57
|
-
"@contentstack/studio-messenger": "^3.
|
|
56
|
+
"@contentstack/studio-message-types": "^1.5.1",
|
|
57
|
+
"@contentstack/studio-messenger": "^3.1.0",
|
|
58
58
|
"csstype": "^3.1.3",
|
|
59
59
|
"lodash-es": "^4.18.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "1e35733997b7c0e030296d3ebcf053aee69151a3"
|
|
62
62
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { INTERNAL_COMPONENTS_NAMES } from '../component-registry/registry.constant.js';
|
|
2
|
-
|
|
3
|
-
const getSymbolUIDFromNode = (symbol) => {
|
|
4
|
-
const symbolUID = symbol.metadata?.symbolUID;
|
|
5
|
-
return `${INTERNAL_COMPONENTS_NAMES.SYMBOL}-${symbolUID}`;
|
|
6
|
-
};
|
|
7
|
-
const getSymbolUIDFromUID = (uid) => {
|
|
8
|
-
return `${INTERNAL_COMPONENTS_NAMES.SYMBOL}-${uid}`;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { getSymbolUIDFromNode, getSymbolUIDFromUID };
|
|
12
|
-
//# sourceMappingURL=symbols.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.js","sources":["../../../src/utils/symbols.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,GAAG,CAAC,MAAY,KAAI;AACnD,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS;AAC5C,IAAA,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAA,CAAA,EAAI,SAAS,EAAE;AAC3D;AAEO,MAAM,mBAAmB,GAAG,CAAC,GAAW,KAAI;AACjD,IAAA,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAA,CAAA,EAAI,GAAG,EAAE;AACrD;;;;"}
|