@darajs/core 1.6.3 → 1.7.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/api/http.d.ts +6 -1
- package/dist/api/http.d.ts.map +1 -1
- package/dist/api/http.js +13 -2
- package/dist/api/http.js.map +1 -1
- package/dist/api/websocket.d.ts +10 -1
- package/dist/api/websocket.d.ts.map +1 -1
- package/dist/api/websocket.js +10 -4
- package/dist/api/websocket.js.map +1 -1
- package/dist/{dara_core-1.6.3-py3-none-any.whl → dara_core-1.7.0-py3-none-any.whl} +0 -0
- package/dist/shared/interactivity/persistence.d.ts +42 -0
- package/dist/shared/interactivity/persistence.d.ts.map +1 -0
- package/dist/shared/interactivity/persistence.js +223 -0
- package/dist/shared/interactivity/persistence.js.map +1 -0
- package/dist/shared/interactivity/plain-variable.d.ts +0 -7
- package/dist/shared/interactivity/plain-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/plain-variable.js +61 -85
- package/dist/shared/interactivity/plain-variable.js.map +1 -1
- package/dist/shared/template-root/template-root.d.ts.map +1 -1
- package/dist/shared/template-root/template-root.js +2 -1
- package/dist/shared/template-root/template-root.js.map +1 -1
- package/dist/types/core.d.ts +9 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js.map +1 -1
- package/dist/umd/dara.core.umd.js +297 -149
- package/package.json +10 -10
|
@@ -12003,6 +12003,8 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
12003
12003
|
RecoilURLSyncTransit: RecoilURLSyncTransit$1,
|
|
12004
12004
|
urlSyncEffect: urlSyncEffect$1
|
|
12005
12005
|
};
|
|
12006
|
+
var RecoilSync_index_1 = RecoilSync_index.RecoilSync;
|
|
12007
|
+
var RecoilSync_index_2 = RecoilSync_index.syncEffect;
|
|
12006
12008
|
var RecoilSync_index_3 = RecoilSync_index.RecoilURLSync;
|
|
12007
12009
|
var RecoilSync_index_6 = RecoilSync_index.urlSyncEffect;
|
|
12008
12010
|
const theme = {
|
|
@@ -54082,7 +54084,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54082
54084
|
__publicField(this, "extras");
|
|
54083
54085
|
this.extras = extras;
|
|
54084
54086
|
}
|
|
54085
|
-
|
|
54087
|
+
toSerializable() {
|
|
54086
54088
|
var _a;
|
|
54087
54089
|
if (!this.extras) {
|
|
54088
54090
|
return null;
|
|
@@ -54095,6 +54097,13 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
54095
54097
|
const headers = new Headers(serializable.options.headers);
|
|
54096
54098
|
serializable.options.headers = Object.fromEntries(headers.entries());
|
|
54097
54099
|
}
|
|
54100
|
+
return serializable;
|
|
54101
|
+
}
|
|
54102
|
+
toJSON() {
|
|
54103
|
+
const serializable = this.toSerializable();
|
|
54104
|
+
if (!serializable) {
|
|
54105
|
+
return null;
|
|
54106
|
+
}
|
|
54098
54107
|
return JSON.stringify(serializable);
|
|
54099
54108
|
}
|
|
54100
54109
|
}
|
|
@@ -55436,6 +55445,9 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55436
55445
|
function isActionMessage(message) {
|
|
55437
55446
|
return message.type === "message" && "action" in message.message;
|
|
55438
55447
|
}
|
|
55448
|
+
function isBackendStoreMessage(message) {
|
|
55449
|
+
return message.type === "message" && "store_uid" in message.message;
|
|
55450
|
+
}
|
|
55439
55451
|
function isCustomMessage(message) {
|
|
55440
55452
|
return message.type === "custom";
|
|
55441
55453
|
}
|
|
@@ -55541,6 +55553,12 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55541
55553
|
getChannel() {
|
|
55542
55554
|
return this.channel;
|
|
55543
55555
|
}
|
|
55556
|
+
backendStoreMessages$() {
|
|
55557
|
+
return this.messages$.pipe(
|
|
55558
|
+
filter(isBackendStoreMessage),
|
|
55559
|
+
map$2((msg) => msg.message)
|
|
55560
|
+
);
|
|
55561
|
+
}
|
|
55544
55562
|
channel$() {
|
|
55545
55563
|
return this.messages$.pipe(
|
|
55546
55564
|
filter((msg) => isInitMessage(msg)),
|
|
@@ -55562,17 +55580,18 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55562
55580
|
}
|
|
55563
55581
|
serverTriggers$(dataId) {
|
|
55564
55582
|
return this.messages$.pipe(
|
|
55583
|
+
filter(isServerTriggerMessage),
|
|
55565
55584
|
filter((msg) => {
|
|
55566
55585
|
var _a;
|
|
55567
|
-
return
|
|
55586
|
+
return ((_a = msg.message) == null ? void 0 : _a.data_id) === dataId;
|
|
55568
55587
|
})
|
|
55569
55588
|
);
|
|
55570
55589
|
}
|
|
55571
55590
|
serverErrors$() {
|
|
55572
|
-
return this.messages$.pipe(filter(
|
|
55591
|
+
return this.messages$.pipe(filter(isServerErrorMessage));
|
|
55573
55592
|
}
|
|
55574
55593
|
variableRequests$() {
|
|
55575
|
-
return this.messages$.pipe(filter(
|
|
55594
|
+
return this.messages$.pipe(filter(isVariableRequestMessage));
|
|
55576
55595
|
}
|
|
55577
55596
|
actionMessages$(executionId) {
|
|
55578
55597
|
return this.messages$.pipe(
|
|
@@ -55581,7 +55600,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55581
55600
|
);
|
|
55582
55601
|
}
|
|
55583
55602
|
customMessages$() {
|
|
55584
|
-
return this.messages$.pipe(filter(
|
|
55603
|
+
return this.messages$.pipe(filter(isCustomMessage));
|
|
55585
55604
|
}
|
|
55586
55605
|
waitForTask(task_id) {
|
|
55587
55606
|
return this.messages$.pipe(
|
|
@@ -55643,149 +55662,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
55643
55662
|
setupHeartbeat();
|
|
55644
55663
|
return new WebSocketClient(socket, sessionToken, liveReload);
|
|
55645
55664
|
}
|
|
55646
|
-
function getSessionKey(extras, uid2) {
|
|
55647
|
-
const sessionToken = typeof extras === "string" ? extras : extras.sessionToken;
|
|
55648
|
-
if (isEmbedded()) {
|
|
55649
|
-
return `dara-session-${window.frameElement.dataset.daraPageId}-var-${uid2}`;
|
|
55650
|
-
}
|
|
55651
|
-
return `dara-session-${sessionToken}-var-${uid2}`;
|
|
55652
|
-
}
|
|
55653
|
-
const _StateSynchronizer = class {
|
|
55654
|
-
constructor() {
|
|
55655
|
-
__privateAdd(this, _listenersMap, /* @__PURE__ */ new Map());
|
|
55656
|
-
}
|
|
55657
|
-
static getInstance() {
|
|
55658
|
-
if (!__privateGet(_StateSynchronizer, _instance)) {
|
|
55659
|
-
__privateSet(_StateSynchronizer, _instance, new _StateSynchronizer());
|
|
55660
|
-
}
|
|
55661
|
-
return __privateGet(_StateSynchronizer, _instance);
|
|
55662
|
-
}
|
|
55663
|
-
subscribe(key, listener2) {
|
|
55664
|
-
if (!__privateGet(this, _listenersMap).has(key)) {
|
|
55665
|
-
__privateGet(this, _listenersMap).set(key, /* @__PURE__ */ new Set());
|
|
55666
|
-
}
|
|
55667
|
-
__privateGet(this, _listenersMap).get(key).add(listener2);
|
|
55668
|
-
return () => {
|
|
55669
|
-
__privateGet(this, _listenersMap).get(key).delete(listener2);
|
|
55670
|
-
};
|
|
55671
|
-
}
|
|
55672
|
-
notify(key, ...args) {
|
|
55673
|
-
var _a;
|
|
55674
|
-
(_a = __privateGet(this, _listenersMap).get(key)) == null ? void 0 : _a.forEach((listener2) => listener2(...args));
|
|
55675
|
-
}
|
|
55676
|
-
};
|
|
55677
|
-
let StateSynchronizer = _StateSynchronizer;
|
|
55678
|
-
_instance = new WeakMap();
|
|
55679
|
-
_listenersMap = new WeakMap();
|
|
55680
|
-
__privateAdd(StateSynchronizer, _instance, void 0);
|
|
55681
|
-
function getOrRegisterPlainVariable(variable, wsClient, taskContext, extras) {
|
|
55682
|
-
const isNested = variable.nested && variable.nested.length > 0;
|
|
55683
|
-
const isDefaultDerived = isDerivedVariable(variable.default);
|
|
55684
|
-
let atomInstance;
|
|
55685
|
-
let family = null;
|
|
55686
|
-
if (isDefaultDerived) {
|
|
55687
|
-
if (!atomFamilyRegistry.has(variable.uid)) {
|
|
55688
|
-
atomFamilyRegistry.set(
|
|
55689
|
-
variable.uid,
|
|
55690
|
-
Recoil_index_10({
|
|
55691
|
-
default: (extrasSerializable2) => getOrRegisterDerivedVariableValue(
|
|
55692
|
-
variable.default,
|
|
55693
|
-
wsClient,
|
|
55694
|
-
taskContext,
|
|
55695
|
-
extrasSerializable2.extras
|
|
55696
|
-
),
|
|
55697
|
-
effects: [
|
|
55698
|
-
({ onSet, setSelf, resetSelf }) => {
|
|
55699
|
-
const unsub = StateSynchronizer.getInstance().subscribe(
|
|
55700
|
-
variable.uid,
|
|
55701
|
-
(newValue, oldValue, isReset) => {
|
|
55702
|
-
if (isReset) {
|
|
55703
|
-
resetSelf();
|
|
55704
|
-
} else {
|
|
55705
|
-
setSelf(newValue);
|
|
55706
|
-
}
|
|
55707
|
-
}
|
|
55708
|
-
);
|
|
55709
|
-
onSet((newValue, oldValue, isReset) => {
|
|
55710
|
-
StateSynchronizer.getInstance().notify(variable.uid, newValue, oldValue, isReset);
|
|
55711
|
-
});
|
|
55712
|
-
return () => unsub();
|
|
55713
|
-
}
|
|
55714
|
-
],
|
|
55715
|
-
key: variable.uid
|
|
55716
|
-
})
|
|
55717
|
-
);
|
|
55718
|
-
}
|
|
55719
|
-
family = atomFamilyRegistry.get(variable.uid);
|
|
55720
|
-
const extrasSerializable = new RequestExtrasSerializable(extras);
|
|
55721
|
-
atomInstance = family(extrasSerializable);
|
|
55722
|
-
if (!atomFamilyMembersRegistry.has(family)) {
|
|
55723
|
-
atomFamilyMembersRegistry.set(family, /* @__PURE__ */ new Map());
|
|
55724
|
-
}
|
|
55725
|
-
atomFamilyMembersRegistry.get(family).set(extrasSerializable.toJSON(), atomInstance);
|
|
55726
|
-
} else {
|
|
55727
|
-
if (!atomRegistry.has(variable.uid)) {
|
|
55728
|
-
let defaultValue = variable.default;
|
|
55729
|
-
const persistValue = variable.persist_value || isEmbedded();
|
|
55730
|
-
if (persistValue) {
|
|
55731
|
-
const persistedValue = localStorage.getItem(getSessionKey(extras, variable.uid));
|
|
55732
|
-
if (persistedValue) {
|
|
55733
|
-
defaultValue = JSON.parse(persistedValue);
|
|
55734
|
-
}
|
|
55735
|
-
}
|
|
55736
|
-
atomRegistry.set(
|
|
55737
|
-
variable.uid,
|
|
55738
|
-
Recoil_index_8({
|
|
55739
|
-
default: defaultValue,
|
|
55740
|
-
effects: persistValue ? [
|
|
55741
|
-
({ onSet }) => {
|
|
55742
|
-
onSet((newValue) => {
|
|
55743
|
-
localStorage.setItem(
|
|
55744
|
-
getSessionKey(extras, variable.uid),
|
|
55745
|
-
JSON.stringify(newValue)
|
|
55746
|
-
);
|
|
55747
|
-
});
|
|
55748
|
-
}
|
|
55749
|
-
] : [],
|
|
55750
|
-
key: variable.uid
|
|
55751
|
-
})
|
|
55752
|
-
);
|
|
55753
|
-
}
|
|
55754
|
-
atomInstance = atomRegistry.get(variable.uid);
|
|
55755
|
-
}
|
|
55756
|
-
if (isNested) {
|
|
55757
|
-
const key = getRegistryKey(variable, "selector");
|
|
55758
|
-
if (!selectorFamilyRegistry.has(key)) {
|
|
55759
|
-
selectorFamilyRegistry.set(
|
|
55760
|
-
key,
|
|
55761
|
-
Recoil_index_11({
|
|
55762
|
-
get: (extrasSerializable2) => ({ get: get2 }) => {
|
|
55763
|
-
const variableValue = get2(family ? family(extrasSerializable2) : atomInstance);
|
|
55764
|
-
return resolveNested(
|
|
55765
|
-
variableValue,
|
|
55766
|
-
variable.nested.map((n2) => String(n2))
|
|
55767
|
-
);
|
|
55768
|
-
},
|
|
55769
|
-
key,
|
|
55770
|
-
set: (extrasSerializable2) => ({ set: set2 }, newValue) => {
|
|
55771
|
-
set2(
|
|
55772
|
-
family ? family(extrasSerializable2) : atomInstance,
|
|
55773
|
-
(v2) => setNested(
|
|
55774
|
-
v2,
|
|
55775
|
-
variable.nested.map((n2) => String(n2)),
|
|
55776
|
-
newValue
|
|
55777
|
-
)
|
|
55778
|
-
);
|
|
55779
|
-
}
|
|
55780
|
-
})
|
|
55781
|
-
);
|
|
55782
|
-
}
|
|
55783
|
-
const selectorFamilyInstance = selectorFamilyRegistry.get(key);
|
|
55784
|
-
const extrasSerializable = new RequestExtrasSerializable(extras);
|
|
55785
|
-
return selectorFamilyInstance(extrasSerializable);
|
|
55786
|
-
}
|
|
55787
|
-
return atomInstance;
|
|
55788
|
-
}
|
|
55789
55665
|
function err(message) {
|
|
55790
55666
|
const error = new Error(message);
|
|
55791
55667
|
if (error.stack === void 0) {
|
|
@@ -56447,6 +56323,278 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
|
|
|
56447
56323
|
writableObject: writableObject$1
|
|
56448
56324
|
};
|
|
56449
56325
|
var Refine_index_6 = Refine_index.mixed;
|
|
56326
|
+
function BackendStoreSync({ children }) {
|
|
56327
|
+
const { client } = React__namespace.useContext(websocketCtx);
|
|
56328
|
+
const extras = useRequestExtras();
|
|
56329
|
+
const getStoreValue = React__namespace.useCallback(
|
|
56330
|
+
async (itemKey) => {
|
|
56331
|
+
const response = await request(`/api/core/store/${itemKey}`, {}, extras);
|
|
56332
|
+
await handleAuthErrors(response, true);
|
|
56333
|
+
await validateResponse(response, `Failed to fetch the store value for key: ${itemKey}`);
|
|
56334
|
+
const val = await response.json();
|
|
56335
|
+
return val;
|
|
56336
|
+
},
|
|
56337
|
+
[extras]
|
|
56338
|
+
);
|
|
56339
|
+
const syncStoreValues = React__namespace.useCallback(async ({ diff }) => {
|
|
56340
|
+
const extrasMap = /* @__PURE__ */ new Map();
|
|
56341
|
+
for (const [encodedKey, value] of diff.entries()) {
|
|
56342
|
+
const { serializedExtras, store_uid } = JSON.parse(encodedKey);
|
|
56343
|
+
if (!extrasMap.has(serializedExtras)) {
|
|
56344
|
+
extrasMap.set(serializedExtras, {});
|
|
56345
|
+
}
|
|
56346
|
+
extrasMap.get(serializedExtras)[store_uid] = value;
|
|
56347
|
+
}
|
|
56348
|
+
async function sendRequest(serializedExtras, storeDiff) {
|
|
56349
|
+
const response = await request(
|
|
56350
|
+
`/api/core/store`,
|
|
56351
|
+
{ body: JSON.stringify(storeDiff), method: "POST" },
|
|
56352
|
+
JSON.parse(serializedExtras)
|
|
56353
|
+
);
|
|
56354
|
+
await handleAuthErrors(response, true);
|
|
56355
|
+
await validateResponse(response, `Failed to sync the store values`);
|
|
56356
|
+
}
|
|
56357
|
+
await Promise.allSettled(
|
|
56358
|
+
Array.from(extrasMap.entries()).map(
|
|
56359
|
+
([serializedExtras, storeDiff]) => sendRequest(serializedExtras, storeDiff)
|
|
56360
|
+
)
|
|
56361
|
+
);
|
|
56362
|
+
}, []);
|
|
56363
|
+
const listenToStoreChanges = React__namespace.useCallback(
|
|
56364
|
+
({ updateItem }) => {
|
|
56365
|
+
if (!client) {
|
|
56366
|
+
return;
|
|
56367
|
+
}
|
|
56368
|
+
const sub = client.backendStoreMessages$().subscribe((message) => {
|
|
56369
|
+
updateItem(message.store_uid, message.value);
|
|
56370
|
+
});
|
|
56371
|
+
return () => sub.unsubscribe();
|
|
56372
|
+
},
|
|
56373
|
+
[client]
|
|
56374
|
+
);
|
|
56375
|
+
return /* @__PURE__ */ React__namespace.createElement(RecoilSync_index_1, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "BackendStore", write: syncStoreValues }, children);
|
|
56376
|
+
}
|
|
56377
|
+
function backendStoreEffect(variable, requestExtras) {
|
|
56378
|
+
return RecoilSync_index_2({
|
|
56379
|
+
itemKey: variable.store.uid,
|
|
56380
|
+
refine: Refine_index_6(),
|
|
56381
|
+
storeKey: "BackendStore",
|
|
56382
|
+
write: ({ write: write2 }, newValue) => {
|
|
56383
|
+
write2(
|
|
56384
|
+
JSON.stringify({
|
|
56385
|
+
serializedExtras: requestExtras.toJSON(),
|
|
56386
|
+
store_uid: variable.store.uid
|
|
56387
|
+
}),
|
|
56388
|
+
newValue
|
|
56389
|
+
);
|
|
56390
|
+
}
|
|
56391
|
+
});
|
|
56392
|
+
}
|
|
56393
|
+
function getSessionKey(extras, uid2) {
|
|
56394
|
+
const sessionToken = typeof extras === "string" ? extras : extras.sessionToken;
|
|
56395
|
+
if (isEmbedded()) {
|
|
56396
|
+
return `dara-session-${window.frameElement.dataset.daraPageId}-var-${uid2}`;
|
|
56397
|
+
}
|
|
56398
|
+
return `dara-session-${sessionToken}-var-${uid2}`;
|
|
56399
|
+
}
|
|
56400
|
+
function BrowserStoreSync({ children }) {
|
|
56401
|
+
const extras = useRequestExtras();
|
|
56402
|
+
const getStoreValue = React__namespace.useCallback(
|
|
56403
|
+
(itemKey) => {
|
|
56404
|
+
var _a;
|
|
56405
|
+
const key = getSessionKey(extras, itemKey);
|
|
56406
|
+
return JSON.parse((_a = localStorage.getItem(key)) != null ? _a : "null");
|
|
56407
|
+
},
|
|
56408
|
+
[extras]
|
|
56409
|
+
);
|
|
56410
|
+
const syncStoreValues = React__namespace.useCallback(
|
|
56411
|
+
({ diff }) => {
|
|
56412
|
+
for (const [itemKey, value] of diff.entries()) {
|
|
56413
|
+
const key = getSessionKey(extras, itemKey);
|
|
56414
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
56415
|
+
}
|
|
56416
|
+
},
|
|
56417
|
+
[extras]
|
|
56418
|
+
);
|
|
56419
|
+
const listenToStoreChanges = React__namespace.useCallback(
|
|
56420
|
+
({ updateItem }) => {
|
|
56421
|
+
const listener2 = (e3) => {
|
|
56422
|
+
var _a;
|
|
56423
|
+
if (e3.storageArea === localStorage) {
|
|
56424
|
+
if (e3.key) {
|
|
56425
|
+
const match2 = e3.key.match(/^dara-session-(.*)-var-(.*)$/);
|
|
56426
|
+
if (match2) {
|
|
56427
|
+
const [, sessionToken, uid2] = match2;
|
|
56428
|
+
if (typeof extras === "string" && sessionToken === extras || typeof extras === "object" && extras.sessionToken === sessionToken) {
|
|
56429
|
+
updateItem(uid2, JSON.parse((_a = e3.newValue) != null ? _a : "null"));
|
|
56430
|
+
}
|
|
56431
|
+
}
|
|
56432
|
+
}
|
|
56433
|
+
}
|
|
56434
|
+
};
|
|
56435
|
+
window.addEventListener("storage", listener2);
|
|
56436
|
+
return () => {
|
|
56437
|
+
window.removeEventListener("storage", listener2);
|
|
56438
|
+
};
|
|
56439
|
+
},
|
|
56440
|
+
[extras]
|
|
56441
|
+
);
|
|
56442
|
+
return /* @__PURE__ */ React__namespace.createElement(RecoilSync_index_1, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "BrowserStore", write: syncStoreValues }, children);
|
|
56443
|
+
}
|
|
56444
|
+
function localStorageEffect(variable) {
|
|
56445
|
+
let firstRun = false;
|
|
56446
|
+
return RecoilSync_index_2({
|
|
56447
|
+
itemKey: variable.uid,
|
|
56448
|
+
read: ({ read: read2 }) => {
|
|
56449
|
+
const readValue = read2(variable.uid);
|
|
56450
|
+
if (!firstRun) {
|
|
56451
|
+
firstRun = true;
|
|
56452
|
+
if (!readValue) {
|
|
56453
|
+
return variable.default;
|
|
56454
|
+
}
|
|
56455
|
+
}
|
|
56456
|
+
return readValue;
|
|
56457
|
+
},
|
|
56458
|
+
refine: Refine_index_6(),
|
|
56459
|
+
storeKey: "BrowserStore"
|
|
56460
|
+
});
|
|
56461
|
+
}
|
|
56462
|
+
const STORES = {
|
|
56463
|
+
BackendStore: {
|
|
56464
|
+
effect: backendStoreEffect,
|
|
56465
|
+
sync: BackendStoreSync
|
|
56466
|
+
},
|
|
56467
|
+
BrowserStore: {
|
|
56468
|
+
effect: localStorageEffect,
|
|
56469
|
+
sync: BrowserStoreSync
|
|
56470
|
+
}
|
|
56471
|
+
};
|
|
56472
|
+
function getEffect(variable) {
|
|
56473
|
+
var _a, _b;
|
|
56474
|
+
const storeName = (_a = variable.store) == null ? void 0 : _a.__typename;
|
|
56475
|
+
if (!storeName) {
|
|
56476
|
+
return null;
|
|
56477
|
+
}
|
|
56478
|
+
return (_b = STORES[storeName].effect) != null ? _b : null;
|
|
56479
|
+
}
|
|
56480
|
+
function StoreProviders({ children }) {
|
|
56481
|
+
return /* @__PURE__ */ React__namespace.createElement(BackendStoreSync, null, /* @__PURE__ */ React__namespace.createElement(BrowserStoreSync, null, children));
|
|
56482
|
+
}
|
|
56483
|
+
const _StateSynchronizer = class {
|
|
56484
|
+
constructor() {
|
|
56485
|
+
__privateAdd(this, _listenersMap, /* @__PURE__ */ new Map());
|
|
56486
|
+
}
|
|
56487
|
+
static getInstance() {
|
|
56488
|
+
if (!__privateGet(_StateSynchronizer, _instance)) {
|
|
56489
|
+
__privateSet(_StateSynchronizer, _instance, new _StateSynchronizer());
|
|
56490
|
+
}
|
|
56491
|
+
return __privateGet(_StateSynchronizer, _instance);
|
|
56492
|
+
}
|
|
56493
|
+
subscribe(key, listener2) {
|
|
56494
|
+
if (!__privateGet(this, _listenersMap).has(key)) {
|
|
56495
|
+
__privateGet(this, _listenersMap).set(key, /* @__PURE__ */ new Set());
|
|
56496
|
+
}
|
|
56497
|
+
__privateGet(this, _listenersMap).get(key).add(listener2);
|
|
56498
|
+
return () => {
|
|
56499
|
+
__privateGet(this, _listenersMap).get(key).delete(listener2);
|
|
56500
|
+
};
|
|
56501
|
+
}
|
|
56502
|
+
notify(key, ...args) {
|
|
56503
|
+
var _a;
|
|
56504
|
+
(_a = __privateGet(this, _listenersMap).get(key)) == null ? void 0 : _a.forEach((listener2) => listener2(...args));
|
|
56505
|
+
}
|
|
56506
|
+
};
|
|
56507
|
+
let StateSynchronizer = _StateSynchronizer;
|
|
56508
|
+
_instance = new WeakMap();
|
|
56509
|
+
_listenersMap = new WeakMap();
|
|
56510
|
+
__privateAdd(StateSynchronizer, _instance, void 0);
|
|
56511
|
+
function getOrRegisterPlainVariable(variable, wsClient, taskContext, extras) {
|
|
56512
|
+
const isNested = variable.nested && variable.nested.length > 0;
|
|
56513
|
+
const isDefaultDerived = isDerivedVariable(variable.default);
|
|
56514
|
+
if (!atomFamilyRegistry.has(variable.uid)) {
|
|
56515
|
+
atomFamilyRegistry.set(
|
|
56516
|
+
variable.uid,
|
|
56517
|
+
Recoil_index_10({
|
|
56518
|
+
default: isDefaultDerived ? (extrasSerializable2) => getOrRegisterDerivedVariableValue(
|
|
56519
|
+
variable.default,
|
|
56520
|
+
wsClient,
|
|
56521
|
+
taskContext,
|
|
56522
|
+
extrasSerializable2.extras
|
|
56523
|
+
) : variable.default,
|
|
56524
|
+
effects: (extrasSerializable2) => {
|
|
56525
|
+
const familySync = ({ onSet, setSelf, resetSelf, node }) => {
|
|
56526
|
+
const unsub = StateSynchronizer.getInstance().subscribe(
|
|
56527
|
+
variable.uid,
|
|
56528
|
+
(nodeKey, newValue, oldValue, isReset) => {
|
|
56529
|
+
if (nodeKey === node.key) {
|
|
56530
|
+
return;
|
|
56531
|
+
}
|
|
56532
|
+
if (isReset) {
|
|
56533
|
+
resetSelf();
|
|
56534
|
+
} else {
|
|
56535
|
+
setSelf(newValue);
|
|
56536
|
+
}
|
|
56537
|
+
}
|
|
56538
|
+
);
|
|
56539
|
+
onSet((newValue, oldValue, isReset) => {
|
|
56540
|
+
StateSynchronizer.getInstance().notify(variable.uid, node.key, newValue, oldValue, isReset);
|
|
56541
|
+
});
|
|
56542
|
+
return () => unsub();
|
|
56543
|
+
};
|
|
56544
|
+
const effects = [familySync];
|
|
56545
|
+
const storeEffect = getEffect(variable);
|
|
56546
|
+
if (storeEffect) {
|
|
56547
|
+
effects.push(storeEffect(variable, extrasSerializable2));
|
|
56548
|
+
} else {
|
|
56549
|
+
if (variable.persist_value || isEmbedded()) {
|
|
56550
|
+
effects.push(STORES.BrowserStore.effect(variable, extrasSerializable2));
|
|
56551
|
+
}
|
|
56552
|
+
}
|
|
56553
|
+
return effects;
|
|
56554
|
+
},
|
|
56555
|
+
key: variable.uid
|
|
56556
|
+
})
|
|
56557
|
+
);
|
|
56558
|
+
}
|
|
56559
|
+
const family = atomFamilyRegistry.get(variable.uid);
|
|
56560
|
+
const extrasSerializable = new RequestExtrasSerializable(extras);
|
|
56561
|
+
const atomInstance = family(extrasSerializable);
|
|
56562
|
+
if (!atomFamilyMembersRegistry.has(family)) {
|
|
56563
|
+
atomFamilyMembersRegistry.set(family, /* @__PURE__ */ new Map());
|
|
56564
|
+
}
|
|
56565
|
+
atomFamilyMembersRegistry.get(family).set(extrasSerializable.toJSON(), atomInstance);
|
|
56566
|
+
if (isNested) {
|
|
56567
|
+
const key = getRegistryKey(variable, "selector");
|
|
56568
|
+
if (!selectorFamilyRegistry.has(key)) {
|
|
56569
|
+
selectorFamilyRegistry.set(
|
|
56570
|
+
key,
|
|
56571
|
+
Recoil_index_11({
|
|
56572
|
+
get: (currentExtras) => ({ get: get2 }) => {
|
|
56573
|
+
const variableValue = get2(family ? family(currentExtras) : atomInstance);
|
|
56574
|
+
return resolveNested(
|
|
56575
|
+
variableValue,
|
|
56576
|
+
variable.nested.map((n2) => String(n2))
|
|
56577
|
+
);
|
|
56578
|
+
},
|
|
56579
|
+
key,
|
|
56580
|
+
set: (currentExtras) => ({ set: set2 }, newValue) => {
|
|
56581
|
+
set2(
|
|
56582
|
+
family ? family(currentExtras) : atomInstance,
|
|
56583
|
+
(v2) => setNested(
|
|
56584
|
+
v2,
|
|
56585
|
+
variable.nested.map((n2) => String(n2)),
|
|
56586
|
+
newValue
|
|
56587
|
+
)
|
|
56588
|
+
);
|
|
56589
|
+
}
|
|
56590
|
+
})
|
|
56591
|
+
);
|
|
56592
|
+
}
|
|
56593
|
+
const selectorFamilyInstance = selectorFamilyRegistry.get(key);
|
|
56594
|
+
return selectorFamilyInstance(extrasSerializable);
|
|
56595
|
+
}
|
|
56596
|
+
return atomInstance;
|
|
56597
|
+
}
|
|
56450
56598
|
function getOrRegisterUrlVariable(variable) {
|
|
56451
56599
|
if (!atomRegistry.has(variable.uid)) {
|
|
56452
56600
|
atomRegistry.set(
|
|
@@ -59123,7 +59271,7 @@ Inferred class string: "${iconClasses}."`
|
|
|
59123
59271
|
{
|
|
59124
59272
|
value: { actionRegistry: actions, componentRegistry: components, refetchComponents }
|
|
59125
59273
|
},
|
|
59126
|
-
/* @__PURE__ */ React__default.default.createElement(GlobalTaskProvider, null, /* @__PURE__ */ React__default.default.createElement(DynamicContext, { contextComponents: (_c = config2 == null ? void 0 : config2.context_components) != null ? _c : [] }, /* @__PURE__ */ React__default.default.createElement(RootWrapper, null, /* @__PURE__ */ React__default.default.createElement(DynamicComponent, { component: template == null ? void 0 : template.layout }), /* @__PURE__ */ React__default.default.createElement(VariableStateProvider, { wsClient }), (config2 == null ? void 0 : config2.enable_devtools) && /* @__PURE__ */ React__default.default.createElement(DevTools, null))))
|
|
59274
|
+
/* @__PURE__ */ React__default.default.createElement(GlobalTaskProvider, null, /* @__PURE__ */ React__default.default.createElement(DynamicContext, { contextComponents: (_c = config2 == null ? void 0 : config2.context_components) != null ? _c : [] }, /* @__PURE__ */ React__default.default.createElement(StoreProviders, null, /* @__PURE__ */ React__default.default.createElement(RootWrapper, null, /* @__PURE__ */ React__default.default.createElement(DynamicComponent, { component: template == null ? void 0 : template.layout }), /* @__PURE__ */ React__default.default.createElement(VariableStateProvider, { wsClient }), (config2 == null ? void 0 : config2.enable_devtools) && /* @__PURE__ */ React__default.default.createElement(DevTools, null)))))
|
|
59127
59275
|
)));
|
|
59128
59276
|
}
|
|
59129
59277
|
const Wrapper$1 = styled__default.default.div`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darajs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Dara Framework core",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"@babel/preset-env": "^7.23.0",
|
|
36
36
|
"@babel/preset-react": "^7.22.15",
|
|
37
37
|
"@babel/preset-typescript": "^7.23.0",
|
|
38
|
-
"@darajs/eslint-config": "~1.
|
|
39
|
-
"@darajs/prettier-config": "~1.
|
|
40
|
-
"@darajs/stylelint-config": "~1.
|
|
38
|
+
"@darajs/eslint-config": "~1.6.0",
|
|
39
|
+
"@darajs/prettier-config": "~1.6.0",
|
|
40
|
+
"@darajs/stylelint-config": "~1.6.0",
|
|
41
41
|
"@rollup/plugin-inject": "^4.0.4",
|
|
42
42
|
"@testing-library/dom": "^9.3.0",
|
|
43
43
|
"@testing-library/jest-dom": "^5.16.5",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"jest-css-modules": "^2.1.0",
|
|
65
65
|
"jest-environment-jsdom": "^29.5.0",
|
|
66
66
|
"msw": "1.0.1",
|
|
67
|
-
"postcss": "^8.4.
|
|
67
|
+
"postcss": "^8.4.35",
|
|
68
68
|
"react-test-renderer": "^17.0.2",
|
|
69
69
|
"rimraf": "^3.0.2",
|
|
70
70
|
"start-server-and-test": "^1.14.0",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"whatwg-fetch": "^3.6.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@darajs/styled-components": "~1.
|
|
78
|
-
"@darajs/ui-components": "~1.
|
|
79
|
-
"@darajs/ui-notifications": "~1.
|
|
80
|
-
"@darajs/ui-utils": "~1.
|
|
77
|
+
"@darajs/styled-components": "~1.6.0",
|
|
78
|
+
"@darajs/ui-components": "~1.6.0",
|
|
79
|
+
"@darajs/ui-notifications": "~1.6.0",
|
|
80
|
+
"@darajs/ui-utils": "~1.6.0",
|
|
81
81
|
"@fortawesome/fontawesome-free": "~6.4.0",
|
|
82
82
|
"@recoiljs/refine": "^0.1.1",
|
|
83
83
|
"@tanstack/query-core": "^4.0.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "7d1a18c0819739d83ba315a0882f244df84648ec"
|
|
117
117
|
}
|