ebt-vue3 2.50.3 → 2.52.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/package.json +2 -2
- package/src/card-factory.mjs +11 -0
- package/src/components/EbtCards.vue +12 -1
- package/src/components/SuttaView.vue +23 -4
- package/src/ebt-card.mjs +13 -2
- package/src/stores/volatile.mjs +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ebt-vue3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.2",
|
|
4
4
|
"description": "Vue3 Library for SuttaCentral Voice EBT-Sites",
|
|
5
5
|
"author": "Karl Lew",
|
|
6
6
|
"scripts": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"merkle-json": "^2.13.0",
|
|
47
47
|
"pinia": "^2.0.16",
|
|
48
48
|
"roboto-fontface": "*",
|
|
49
|
-
"scv-esm": "^1.132.
|
|
49
|
+
"scv-esm": "^1.132.30",
|
|
50
50
|
"serve-favicon": "^2.5.0",
|
|
51
51
|
"uuid": "^9.0.0",
|
|
52
52
|
"vite-plugin-vuetify": "^2.0.3",
|
package/src/card-factory.mjs
CHANGED
|
@@ -149,10 +149,21 @@ export default class CardFactory {
|
|
|
149
149
|
path='/', cards=settings.cards, addCard, defaultLang, isOpen,
|
|
150
150
|
playlist,
|
|
151
151
|
} = args;
|
|
152
|
+
console.log('[URL-DEBUG] CardFactory.pathToCard called', {
|
|
153
|
+
path,
|
|
154
|
+
cardsCount: cards?.length,
|
|
155
|
+
cardContexts: cards?.map(c => c.context),
|
|
156
|
+
});
|
|
152
157
|
path = path.replace(/^.*\/#/, ''); // ignore non-hash part of path
|
|
153
158
|
let [ ignored, context, ...location ] = path.split('/');
|
|
154
159
|
location = location.map(loc => decodeURIComponent(loc));
|
|
155
160
|
let card = cards.find(card => card.matchPath({path, defaultLang}));
|
|
161
|
+
console.log('[URL-DEBUG] CardFactory.pathToCard find result', {
|
|
162
|
+
foundCard: !!card,
|
|
163
|
+
cardId: card?.id,
|
|
164
|
+
context,
|
|
165
|
+
location,
|
|
166
|
+
});
|
|
156
167
|
dbgv && console.log(msg, '[1]find', {card, path});
|
|
157
168
|
if (card == null) {
|
|
158
169
|
if (addCard === undefined) {
|
|
@@ -196,12 +196,23 @@
|
|
|
196
196
|
$route (to, from) {
|
|
197
197
|
const msg = 'EbtCards.watch.$route';
|
|
198
198
|
const dbg = DBG.ROUTE || DBG_OPEN_CARD;
|
|
199
|
+
console.log('[URL-DEBUG] EbtCards.$route watcher fired', {
|
|
200
|
+
from: from?.fullPath,
|
|
201
|
+
to: to?.fullPath,
|
|
202
|
+
hash: window.location.hash,
|
|
203
|
+
});
|
|
199
204
|
let { cardFactory, volatile, settings, $route } = this;
|
|
200
205
|
let card = cardFactory.pathToCard({
|
|
201
|
-
path: to.fullPath,
|
|
206
|
+
path: to.fullPath,
|
|
202
207
|
addCard: (opts) => cardFactory.addCard(opts),
|
|
203
208
|
defaultLang: settings.langTrans,
|
|
204
209
|
});
|
|
210
|
+
console.log('[URL-DEBUG] EbtCards pathToCard result', {
|
|
211
|
+
cardId: card?.id,
|
|
212
|
+
cardContext: card?.context,
|
|
213
|
+
cardLocation: card?.location,
|
|
214
|
+
cardIsOpen: card?.isOpen,
|
|
215
|
+
});
|
|
205
216
|
let { activeElement } = document;
|
|
206
217
|
|
|
207
218
|
if (card?.isOpen) {
|
|
@@ -91,10 +91,16 @@
|
|
|
91
91
|
const dbg = DBG.MOUNTED;
|
|
92
92
|
let { $route, suttas, settings, volatile, card, config, } = this;
|
|
93
93
|
let { fullPath } = $route;
|
|
94
|
-
let {
|
|
95
|
-
development, langTrans, docLang, docAuthor, refLang, refAuthor
|
|
94
|
+
let {
|
|
95
|
+
development, langTrans, docLang, docAuthor, refLang, refAuthor
|
|
96
96
|
} = settings;
|
|
97
97
|
let { id, location, data } = card;
|
|
98
|
+
console.log('[URL-DEBUG] SuttaView.mounted()', {
|
|
99
|
+
cardId: id,
|
|
100
|
+
location,
|
|
101
|
+
routeFullPath: fullPath,
|
|
102
|
+
hash: window.location.hash,
|
|
103
|
+
});
|
|
98
104
|
let ref = {
|
|
99
105
|
sutta_uid:location[0],
|
|
100
106
|
lang:location[1],
|
|
@@ -125,12 +131,25 @@
|
|
|
125
131
|
const msg = 'SuttaView.watch.card.location()';
|
|
126
132
|
const dbg = DBG.MOUNTED;
|
|
127
133
|
|
|
134
|
+
console.log('[URL-DEBUG] SuttaView watch.card.location fired', {
|
|
135
|
+
newLoc,
|
|
136
|
+
oldLoc,
|
|
137
|
+
hash: window.location.hash,
|
|
138
|
+
});
|
|
139
|
+
|
|
128
140
|
// Skip if no previous location (initial mount handles this)
|
|
129
|
-
if (!oldLoc || !newLoc)
|
|
141
|
+
if (!oldLoc || !newLoc) {
|
|
142
|
+
console.log('[URL-DEBUG] SuttaView watch skipped (no old/new loc)');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
130
145
|
|
|
131
146
|
// Skip if same sutta_uid (just segment change)
|
|
132
|
-
if (newLoc[0] === oldLoc[0])
|
|
147
|
+
if (newLoc[0] === oldLoc[0]) {
|
|
148
|
+
console.log('[URL-DEBUG] SuttaView watch skipped (same sutta_uid)');
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
133
151
|
|
|
152
|
+
console.log('[URL-DEBUG] SuttaView watch proceeding to reload');
|
|
134
153
|
dbg && console.log(msg, '[1]location changed', {newLoc, oldLoc});
|
|
135
154
|
|
|
136
155
|
// Reload sutta data for new location
|
package/src/ebt-card.mjs
CHANGED
|
@@ -444,9 +444,14 @@ export default class EbtCard {
|
|
|
444
444
|
let { path, defaultLang } = opts;
|
|
445
445
|
let loc = location.join('/');
|
|
446
446
|
let cardLoc = cardLocation.join('/');
|
|
447
|
+
console.log('[URL-DEBUG] matchPathSutta', {
|
|
448
|
+
pathLocation: loc,
|
|
449
|
+
cardLocation: cardLoc,
|
|
450
|
+
path,
|
|
451
|
+
});
|
|
447
452
|
if (loc === '') {
|
|
448
453
|
let result = cardLoc === loc;
|
|
449
|
-
dbg && console.log(msg, `[1]true ${path} => ${result}`,
|
|
454
|
+
dbg && console.log(msg, `[1]true ${path} => ${result}`,
|
|
450
455
|
{cardLoc, loc});
|
|
451
456
|
return result;
|
|
452
457
|
}
|
|
@@ -457,12 +462,18 @@ export default class EbtCard {
|
|
|
457
462
|
let msStart = Date.now();
|
|
458
463
|
let pathRef = SuttaRef.create(loc, defaultLang);
|
|
459
464
|
if (pathRef == null) {
|
|
465
|
+
console.log('[URL-DEBUG] matchPathSutta: pathRef is null', {loc});
|
|
460
466
|
dbg && console.log(msg, `[3]false (${path})`, {loc});
|
|
461
467
|
return false;
|
|
462
468
|
}
|
|
463
469
|
let cardRef = SuttaRef.create(cardLoc, defaultLang);
|
|
470
|
+
console.log('[URL-DEBUG] matchPathSutta comparing', {
|
|
471
|
+
pathSuttaUid: pathRef.sutta_uid,
|
|
472
|
+
cardSuttaUid: cardRef.sutta_uid,
|
|
473
|
+
match: pathRef.sutta_uid === cardRef.sutta_uid,
|
|
474
|
+
});
|
|
464
475
|
if (pathRef.sutta_uid !== cardRef.sutta_uid) {
|
|
465
|
-
dbg && console.log(msg, `[4]false (${path})`,
|
|
476
|
+
dbg && console.log(msg, `[4]false (${path})`,
|
|
466
477
|
pathRef.suid, cardRef.suid);
|
|
467
478
|
return false;
|
|
468
479
|
}
|
package/src/stores/volatile.mjs
CHANGED
|
@@ -358,6 +358,11 @@ export const useVolatileStore = defineStore('volatile', {
|
|
|
358
358
|
setRoute(cardOrRoute, keepFocus, caller) {
|
|
359
359
|
const msg = 'volatile.setRoute()';
|
|
360
360
|
const dbg = DBG.SET_ROUTE;
|
|
361
|
+
console.log('[URL-DEBUG] volatile.setRoute() called', {
|
|
362
|
+
caller,
|
|
363
|
+
cardOrRoute: typeof cardOrRoute === 'string' ? cardOrRoute : cardOrRoute?.debugString,
|
|
364
|
+
currentHash: globalThis.window?.location?.hash,
|
|
365
|
+
});
|
|
361
366
|
let { config, } = this;
|
|
362
367
|
let settings = useSettingsStore();
|
|
363
368
|
if (!cardOrRoute) {
|
|
@@ -374,13 +379,19 @@ export const useVolatileStore = defineStore('volatile', {
|
|
|
374
379
|
let route = isCard ? cardOrRoute.routeHash() : cardOrRoute;
|
|
375
380
|
let cardFactory = CardFactory.singleton;
|
|
376
381
|
let addCard = (opts=>cardFactory.addCard(opts));
|
|
377
|
-
let card = isCard
|
|
378
|
-
? cardOrRoute
|
|
382
|
+
let card = isCard
|
|
383
|
+
? cardOrRoute
|
|
379
384
|
: cardFactory.pathToCard({path:route, addCard});
|
|
380
385
|
if (card == null) {
|
|
386
|
+
console.log('[URL-DEBUG] volatile.setRoute() no card found', {route});
|
|
381
387
|
dbg && console.log(msg, '[1]no card', {route});
|
|
382
388
|
return;
|
|
383
389
|
}
|
|
390
|
+
console.log('[URL-DEBUG] volatile.setRoute() card found', {
|
|
391
|
+
cardId: card.id,
|
|
392
|
+
cardLocation: card.location,
|
|
393
|
+
route,
|
|
394
|
+
});
|
|
384
395
|
let { visible } = card;
|
|
385
396
|
|
|
386
397
|
const { window } = globalThis;
|