@cntrl-site/sdk-nextjs 1.9.13-4 → 1.9.13-6
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.
|
@@ -106,49 +106,52 @@ class InteractionsRegistry {
|
|
|
106
106
|
return available;
|
|
107
107
|
}
|
|
108
108
|
notifyLoad() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const timestamp = Date.now();
|
|
111
|
+
for (const interaction of this.interactions) {
|
|
112
|
+
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
113
|
+
const matchingTrigger = interaction.triggers.find(trigger => 'position' in trigger && trigger.position === 0 && trigger.from === currentStateId);
|
|
114
|
+
if (!matchingTrigger)
|
|
115
|
+
continue;
|
|
116
|
+
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
117
|
+
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
118
|
+
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
119
|
+
const transitioningItems = (_a = this.stateItemsIdsMap[activeStateId]) !== null && _a !== void 0 ? _a : [];
|
|
120
|
+
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
121
|
+
const actions = (_b = state === null || state === void 0 ? void 0 : state.actions) !== null && _b !== void 0 ? _b : [];
|
|
122
|
+
for (const action of actions) {
|
|
123
|
+
const ctrl = this.ctrls.get(action.itemId);
|
|
124
|
+
if (!ctrl)
|
|
125
|
+
continue;
|
|
126
|
+
ctrl.receiveAction(action.type);
|
|
127
|
+
}
|
|
128
|
+
this.itemsStages = this.itemsStages.map((stage) => {
|
|
129
|
+
if (stage.interactionId !== interaction.id)
|
|
130
|
+
return stage;
|
|
131
|
+
return {
|
|
132
|
+
itemId: stage.itemId,
|
|
133
|
+
interactionId: stage.interactionId,
|
|
134
|
+
type: 'transitioning',
|
|
135
|
+
from: stage.type === 'transitioning' ? stage.to : stage.stateId,
|
|
136
|
+
to: matchingTrigger.to,
|
|
137
|
+
direction: isNewStateActive ? 'in' : 'out',
|
|
138
|
+
updated: timestamp
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
const itemsToNotify = new Set(transitioningItems);
|
|
142
|
+
for (const trigger of interaction.triggers) {
|
|
143
|
+
if (!('itemId' in trigger))
|
|
144
|
+
continue;
|
|
145
|
+
itemsToNotify.add(trigger.itemId);
|
|
146
|
+
}
|
|
147
|
+
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
148
|
+
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
149
|
+
}
|
|
147
150
|
}
|
|
148
151
|
notifyScroll(position) {
|
|
149
152
|
var _a, _b, _c;
|
|
150
153
|
const timestamp = Date.now();
|
|
151
|
-
const item = this.items.find((item) => item.id ===
|
|
154
|
+
const item = this.items.find((item) => item.id === this.items[0].id);
|
|
152
155
|
const testtop = item.area[this.layoutId].top;
|
|
153
156
|
for (const interaction of this.interactions) {
|
|
154
157
|
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
@@ -204,47 +207,50 @@ class InteractionsRegistry {
|
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
209
|
notifyItemTrigger(itemId, triggerType) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
210
|
+
var _a, _b;
|
|
211
|
+
const timestamp = Date.now();
|
|
212
|
+
for (const interaction of this.interactions) {
|
|
213
|
+
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
214
|
+
const matchingTrigger = interaction.triggers.find((trigger) => 'triggerEvent' in trigger
|
|
215
|
+
&& trigger.itemId === itemId
|
|
216
|
+
&& trigger.from === currentStateId
|
|
217
|
+
&& trigger.triggerEvent === triggerType);
|
|
218
|
+
if (!matchingTrigger)
|
|
219
|
+
continue;
|
|
220
|
+
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
221
|
+
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
222
|
+
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
223
|
+
const transitioningItems = (_a = this.stateItemsIdsMap[activeStateId]) !== null && _a !== void 0 ? _a : [];
|
|
224
|
+
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
225
|
+
const actions = (_b = state === null || state === void 0 ? void 0 : state.actions) !== null && _b !== void 0 ? _b : [];
|
|
226
|
+
for (const action of actions) {
|
|
227
|
+
const ctrl = this.ctrls.get(action.itemId);
|
|
228
|
+
if (!ctrl)
|
|
229
|
+
continue;
|
|
230
|
+
ctrl.receiveAction(action.type);
|
|
231
|
+
}
|
|
232
|
+
this.itemsStages = this.itemsStages.map((stage) => {
|
|
233
|
+
if (stage.interactionId !== interaction.id)
|
|
234
|
+
return stage;
|
|
235
|
+
return {
|
|
236
|
+
itemId: stage.itemId,
|
|
237
|
+
interactionId: stage.interactionId,
|
|
238
|
+
type: 'transitioning',
|
|
239
|
+
from: stage.type === 'transitioning' ? stage.to : stage.stateId,
|
|
240
|
+
to: matchingTrigger.to,
|
|
241
|
+
direction: isNewStateActive ? 'in' : 'out',
|
|
242
|
+
updated: timestamp
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
const itemsToNotify = new Set(transitioningItems);
|
|
246
|
+
for (const trigger of interaction.triggers) {
|
|
247
|
+
if (!('itemId' in trigger))
|
|
248
|
+
continue;
|
|
249
|
+
itemsToNotify.add(trigger.itemId);
|
|
250
|
+
}
|
|
251
|
+
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
252
|
+
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
253
|
+
}
|
|
248
254
|
}
|
|
249
255
|
notifyTransitionStartForItems(itemsIds, activeStateId) {
|
|
250
256
|
var _a, _b;
|
package/package.json
CHANGED
|
@@ -115,51 +115,51 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
notifyLoad() {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
118
|
+
const timestamp = Date.now();
|
|
119
|
+
for (const interaction of this.interactions) {
|
|
120
|
+
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
121
|
+
const matchingTrigger = interaction.triggers.find(trigger =>
|
|
122
|
+
'position' in trigger && trigger.position === 0 && trigger.from === currentStateId
|
|
123
|
+
);
|
|
124
|
+
if (!matchingTrigger) continue;
|
|
125
|
+
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
126
|
+
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
127
|
+
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
128
|
+
const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
|
|
129
|
+
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
130
|
+
const actions = state?.actions ?? [];
|
|
131
|
+
for (const action of actions) {
|
|
132
|
+
const ctrl = this.ctrls.get(action.itemId);
|
|
133
|
+
if (!ctrl) continue;
|
|
134
|
+
ctrl.receiveAction(action.type);
|
|
135
|
+
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
this.itemsStages = this.itemsStages.map((stage) => {
|
|
138
|
+
if (stage.interactionId !== interaction.id) return stage;
|
|
139
|
+
return {
|
|
140
|
+
itemId: stage.itemId,
|
|
141
|
+
interactionId: stage.interactionId,
|
|
142
|
+
type: 'transitioning',
|
|
143
|
+
from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
|
|
144
|
+
to: matchingTrigger.to,
|
|
145
|
+
direction: isNewStateActive ? 'in' : 'out',
|
|
146
|
+
updated: timestamp
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
const itemsToNotify = new Set<ItemId>(transitioningItems);
|
|
151
|
+
for (const trigger of interaction.triggers) {
|
|
152
|
+
if (!('itemId' in trigger)) continue;
|
|
153
|
+
itemsToNotify.add(trigger.itemId);
|
|
154
|
+
}
|
|
155
|
+
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
156
|
+
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
157
|
+
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
notifyScroll(position: number) {
|
|
161
161
|
const timestamp = Date.now();
|
|
162
|
-
const item = this.items.find((item) => item.id ===
|
|
162
|
+
const item = this.items.find((item) => item.id === this.items[0].id)!;
|
|
163
163
|
const testtop = item.area[this.layoutId].top;
|
|
164
164
|
for (const interaction of this.interactions) {
|
|
165
165
|
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
@@ -210,47 +210,47 @@ export class InteractionsRegistry implements InteractionsRegistryPort {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
notifyItemTrigger(itemId: string, triggerType: TriggerType): void {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
213
|
+
const timestamp = Date.now();
|
|
214
|
+
for (const interaction of this.interactions) {
|
|
215
|
+
const currentStateId = this.getCurrentStateByInteractionId(interaction.id);
|
|
216
|
+
const matchingTrigger = interaction.triggers.find((trigger) =>
|
|
217
|
+
'triggerEvent' in trigger
|
|
218
|
+
&& trigger.itemId === itemId
|
|
219
|
+
&& trigger.from === currentStateId
|
|
220
|
+
&& trigger.triggerEvent === triggerType
|
|
221
|
+
);
|
|
222
|
+
if (!matchingTrigger) continue;
|
|
223
|
+
const activeStateId = this.getActiveInteractionState(interaction.id);
|
|
224
|
+
const isNewStateActive = matchingTrigger.to === activeStateId;
|
|
225
|
+
this.setCurrentStateForInteraction(interaction.id, matchingTrigger.to);
|
|
226
|
+
const transitioningItems = this.stateItemsIdsMap[activeStateId] ?? [];
|
|
227
|
+
const state = interaction.states.find((state) => state.id === matchingTrigger.to);
|
|
228
|
+
const actions = state?.actions ?? [];
|
|
229
|
+
for (const action of actions) {
|
|
230
|
+
const ctrl = this.ctrls.get(action.itemId);
|
|
231
|
+
if (!ctrl) continue;
|
|
232
|
+
ctrl.receiveAction(action.type);
|
|
233
|
+
}
|
|
234
|
+
this.itemsStages = this.itemsStages.map((stage) => {
|
|
235
|
+
if (stage.interactionId !== interaction.id) return stage;
|
|
236
|
+
return {
|
|
237
|
+
itemId: stage.itemId,
|
|
238
|
+
interactionId: stage.interactionId,
|
|
239
|
+
type: 'transitioning',
|
|
240
|
+
from: stage.type === 'transitioning' ? stage.to : stage.stateId!,
|
|
241
|
+
to: matchingTrigger.to,
|
|
242
|
+
direction: isNewStateActive ? 'in' : 'out',
|
|
243
|
+
updated: timestamp
|
|
244
|
+
};
|
|
245
|
+
});
|
|
246
|
+
const itemsToNotify = new Set<ItemId>(transitioningItems);
|
|
247
|
+
for (const trigger of interaction.triggers) {
|
|
248
|
+
if (!('itemId' in trigger)) continue;
|
|
249
|
+
itemsToNotify.add(trigger.itemId);
|
|
250
|
+
}
|
|
251
|
+
this.notifyItemCtrlsChange(Array.from(itemsToNotify));
|
|
252
|
+
this.notifyTransitionStartForItems(transitioningItems, activeStateId);
|
|
253
|
+
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
notifyTransitionStartForItems(itemsIds: string[], activeStateId: string) {
|