@recursica/adapter-tester 2.0.1 → 2.0.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/README.md +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/devServer.d.ts.map +1 -1
- package/dist/index.html +37 -37
- package/package.json +1 -1
- package/public/index.html +37 -37
package/dist/devServer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devServer.d.ts","sourceRoot":"","sources":["../src/devServer.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"devServer.d.ts","sourceRoot":"","sources":["../src/devServer.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAgGhF,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,cAAc,CAC5B,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,sBAAsB,EAAE,EACpC,OAAO,GAAE,gBAAqB,GAC7B,IAAI,CA6HN"}
|
package/dist/index.html
CHANGED
|
@@ -165,11 +165,11 @@
|
|
|
165
165
|
<body>
|
|
166
166
|
<div class="pane" id="leftPane">
|
|
167
167
|
<div class="header">
|
|
168
|
-
<span id="
|
|
169
|
-
<span class="status connected" id="
|
|
168
|
+
<span id="ownLabel">Target</span>
|
|
169
|
+
<span class="status connected" id="ownStatus">Connected & Syncing</span>
|
|
170
170
|
</div>
|
|
171
|
-
<!-- Load
|
|
172
|
-
<iframe id="
|
|
171
|
+
<!-- Load this project's own Storybook via the SAME ORIGIN proxy -->
|
|
172
|
+
<iframe id="own" src="/?path=/story/ui-kit-slider--default"></iframe>
|
|
173
173
|
</div>
|
|
174
174
|
|
|
175
175
|
<div class="divider" id="vDivider"></div>
|
|
@@ -177,13 +177,13 @@
|
|
|
177
177
|
<div class="pane" id="rightPane">
|
|
178
178
|
<div class="right-top" id="rightTop">
|
|
179
179
|
<div class="header">
|
|
180
|
-
<span id="
|
|
181
|
-
<span class="status connected" id="
|
|
180
|
+
<span id="sourceOfTruthLabel">Source of Truth</span>
|
|
181
|
+
<span class="status connected" id="sourceOfTruthStatus">Ready</span>
|
|
182
182
|
</div>
|
|
183
|
-
<!-- Spacer to align the view with the
|
|
183
|
+
<!-- Spacer to align the view with the own Storybook's header (40px) -->
|
|
184
184
|
<div style="height: 40px; flex: 0 0 40px; background-color: #fff; border-bottom: 1px solid #e6e6e6; box-sizing: border-box;"></div>
|
|
185
|
-
<!-- Load the bare
|
|
186
|
-
<iframe id="
|
|
185
|
+
<!-- Load the bare source-of-truth component preview -->
|
|
186
|
+
<iframe id="sourceOfTruth" src=""></iframe>
|
|
187
187
|
</div>
|
|
188
188
|
|
|
189
189
|
<div class="h-divider" id="hDivider"></div>
|
|
@@ -214,13 +214,13 @@
|
|
|
214
214
|
|
|
215
215
|
<script>
|
|
216
216
|
// Injected by the dev server — see src/devServer.ts.
|
|
217
|
-
const devConfig = window.__ADAPTER_TESTER__ || { sourceOfTruthName: 'Source of Truth',
|
|
217
|
+
const devConfig = window.__ADAPTER_TESTER__ || { ownName: 'Target', sourceOfTruthName: 'Source of Truth', sourceOfTruthPort: 6011 };
|
|
218
|
+
document.getElementById('ownLabel').textContent = devConfig.ownName;
|
|
218
219
|
document.getElementById('sourceOfTruthLabel').textContent = `${devConfig.sourceOfTruthName} (Source of Truth)`;
|
|
219
|
-
document.getElementById('targetLabel').textContent = devConfig.targetName;
|
|
220
220
|
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
const
|
|
221
|
+
const ownIframe = document.getElementById('own');
|
|
222
|
+
const sourceOfTruthIframe = document.getElementById('sourceOfTruth');
|
|
223
|
+
const sourceOfTruthStatus = document.getElementById('sourceOfTruthStatus');
|
|
224
224
|
|
|
225
225
|
// Sync initial iframe sources with outer URL if params exist, else fall
|
|
226
226
|
// back to a sensible default story so both panes load something on open.
|
|
@@ -228,17 +228,17 @@
|
|
|
228
228
|
const initialId = outerParams.get('id') || 'ui-kit-slider--default';
|
|
229
229
|
const initialArgs = outerParams.get('args');
|
|
230
230
|
|
|
231
|
-
let
|
|
231
|
+
let ownSrc = `/?path=/story/${initialId}`;
|
|
232
232
|
if (initialArgs) {
|
|
233
|
-
|
|
233
|
+
ownSrc += `&args=${initialArgs}`;
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
ownIframe.src = ownSrc;
|
|
236
236
|
|
|
237
|
-
let
|
|
237
|
+
let sotSrc = `http://localhost:${devConfig.sourceOfTruthPort}/iframe.html?id=${initialId}&viewMode=story`;
|
|
238
238
|
if (initialArgs) {
|
|
239
|
-
|
|
239
|
+
sotSrc += `&args=${initialArgs}`;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
sourceOfTruthIframe.src = sotSrc;
|
|
242
242
|
|
|
243
243
|
// Resizers
|
|
244
244
|
const vDivider = document.getElementById('vDivider');
|
|
@@ -263,8 +263,8 @@
|
|
|
263
263
|
vDivider.addEventListener('mousedown', (e) => {
|
|
264
264
|
isVResizing = true;
|
|
265
265
|
document.body.style.cursor = 'col-resize';
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
ownIframe.style.pointerEvents = 'none';
|
|
267
|
+
sourceOfTruthIframe.style.pointerEvents = 'none';
|
|
268
268
|
});
|
|
269
269
|
|
|
270
270
|
document.addEventListener('mousemove', (e) => {
|
|
@@ -288,8 +288,8 @@
|
|
|
288
288
|
isVResizing = false;
|
|
289
289
|
isHResizing = false;
|
|
290
290
|
document.body.style.cursor = 'default';
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
ownIframe.style.pointerEvents = 'auto';
|
|
292
|
+
sourceOfTruthIframe.style.pointerEvents = 'auto';
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
@@ -298,8 +298,8 @@
|
|
|
298
298
|
hDivider.addEventListener('mousedown', (e) => {
|
|
299
299
|
isHResizing = true;
|
|
300
300
|
document.body.style.cursor = 'row-resize';
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
ownIframe.style.pointerEvents = 'none';
|
|
302
|
+
sourceOfTruthIframe.style.pointerEvents = 'none';
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
// Auto-save notes logic
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
let lastUrl = '';
|
|
407
407
|
setInterval(() => {
|
|
408
408
|
try {
|
|
409
|
-
const currentUrl =
|
|
409
|
+
const currentUrl = ownIframe.contentWindow.location.href;
|
|
410
410
|
|
|
411
411
|
if (currentUrl && currentUrl !== lastUrl && currentUrl !== 'about:blank') {
|
|
412
412
|
lastUrl = currentUrl;
|
|
@@ -440,19 +440,19 @@
|
|
|
440
440
|
window.history.replaceState({}, '', outerUrl.pathname + outerUrl.search);
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
let
|
|
443
|
+
let sotUrl = `http://localhost:${devConfig.sourceOfTruthPort}/iframe.html?id=${id}&viewMode=story`;
|
|
444
444
|
if (args) {
|
|
445
|
-
|
|
445
|
+
sotUrl += `&args=${args}`;
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
|
|
448
|
+
if (sourceOfTruthIframe.src !== sotUrl) {
|
|
449
|
+
sourceOfTruthStatus.textContent = 'Updating...';
|
|
450
|
+
sourceOfTruthStatus.classList.remove('connected');
|
|
451
|
+
sourceOfTruthIframe.src = sotUrl;
|
|
452
|
+
|
|
453
453
|
setTimeout(() => {
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
sourceOfTruthStatus.textContent = 'Synced';
|
|
455
|
+
sourceOfTruthStatus.classList.add('connected');
|
|
456
456
|
}, 500);
|
|
457
457
|
}
|
|
458
458
|
}
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -165,11 +165,11 @@
|
|
|
165
165
|
<body>
|
|
166
166
|
<div class="pane" id="leftPane">
|
|
167
167
|
<div class="header">
|
|
168
|
-
<span id="
|
|
169
|
-
<span class="status connected" id="
|
|
168
|
+
<span id="ownLabel">Target</span>
|
|
169
|
+
<span class="status connected" id="ownStatus">Connected & Syncing</span>
|
|
170
170
|
</div>
|
|
171
|
-
<!-- Load
|
|
172
|
-
<iframe id="
|
|
171
|
+
<!-- Load this project's own Storybook via the SAME ORIGIN proxy -->
|
|
172
|
+
<iframe id="own" src="/?path=/story/ui-kit-slider--default"></iframe>
|
|
173
173
|
</div>
|
|
174
174
|
|
|
175
175
|
<div class="divider" id="vDivider"></div>
|
|
@@ -177,13 +177,13 @@
|
|
|
177
177
|
<div class="pane" id="rightPane">
|
|
178
178
|
<div class="right-top" id="rightTop">
|
|
179
179
|
<div class="header">
|
|
180
|
-
<span id="
|
|
181
|
-
<span class="status connected" id="
|
|
180
|
+
<span id="sourceOfTruthLabel">Source of Truth</span>
|
|
181
|
+
<span class="status connected" id="sourceOfTruthStatus">Ready</span>
|
|
182
182
|
</div>
|
|
183
|
-
<!-- Spacer to align the view with the
|
|
183
|
+
<!-- Spacer to align the view with the own Storybook's header (40px) -->
|
|
184
184
|
<div style="height: 40px; flex: 0 0 40px; background-color: #fff; border-bottom: 1px solid #e6e6e6; box-sizing: border-box;"></div>
|
|
185
|
-
<!-- Load the bare
|
|
186
|
-
<iframe id="
|
|
185
|
+
<!-- Load the bare source-of-truth component preview -->
|
|
186
|
+
<iframe id="sourceOfTruth" src=""></iframe>
|
|
187
187
|
</div>
|
|
188
188
|
|
|
189
189
|
<div class="h-divider" id="hDivider"></div>
|
|
@@ -214,13 +214,13 @@
|
|
|
214
214
|
|
|
215
215
|
<script>
|
|
216
216
|
// Injected by the dev server — see src/devServer.ts.
|
|
217
|
-
const devConfig = window.__ADAPTER_TESTER__ || { sourceOfTruthName: 'Source of Truth',
|
|
217
|
+
const devConfig = window.__ADAPTER_TESTER__ || { ownName: 'Target', sourceOfTruthName: 'Source of Truth', sourceOfTruthPort: 6011 };
|
|
218
|
+
document.getElementById('ownLabel').textContent = devConfig.ownName;
|
|
218
219
|
document.getElementById('sourceOfTruthLabel').textContent = `${devConfig.sourceOfTruthName} (Source of Truth)`;
|
|
219
|
-
document.getElementById('targetLabel').textContent = devConfig.targetName;
|
|
220
220
|
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
const
|
|
221
|
+
const ownIframe = document.getElementById('own');
|
|
222
|
+
const sourceOfTruthIframe = document.getElementById('sourceOfTruth');
|
|
223
|
+
const sourceOfTruthStatus = document.getElementById('sourceOfTruthStatus');
|
|
224
224
|
|
|
225
225
|
// Sync initial iframe sources with outer URL if params exist, else fall
|
|
226
226
|
// back to a sensible default story so both panes load something on open.
|
|
@@ -228,17 +228,17 @@
|
|
|
228
228
|
const initialId = outerParams.get('id') || 'ui-kit-slider--default';
|
|
229
229
|
const initialArgs = outerParams.get('args');
|
|
230
230
|
|
|
231
|
-
let
|
|
231
|
+
let ownSrc = `/?path=/story/${initialId}`;
|
|
232
232
|
if (initialArgs) {
|
|
233
|
-
|
|
233
|
+
ownSrc += `&args=${initialArgs}`;
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
ownIframe.src = ownSrc;
|
|
236
236
|
|
|
237
|
-
let
|
|
237
|
+
let sotSrc = `http://localhost:${devConfig.sourceOfTruthPort}/iframe.html?id=${initialId}&viewMode=story`;
|
|
238
238
|
if (initialArgs) {
|
|
239
|
-
|
|
239
|
+
sotSrc += `&args=${initialArgs}`;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
sourceOfTruthIframe.src = sotSrc;
|
|
242
242
|
|
|
243
243
|
// Resizers
|
|
244
244
|
const vDivider = document.getElementById('vDivider');
|
|
@@ -263,8 +263,8 @@
|
|
|
263
263
|
vDivider.addEventListener('mousedown', (e) => {
|
|
264
264
|
isVResizing = true;
|
|
265
265
|
document.body.style.cursor = 'col-resize';
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
ownIframe.style.pointerEvents = 'none';
|
|
267
|
+
sourceOfTruthIframe.style.pointerEvents = 'none';
|
|
268
268
|
});
|
|
269
269
|
|
|
270
270
|
document.addEventListener('mousemove', (e) => {
|
|
@@ -288,8 +288,8 @@
|
|
|
288
288
|
isVResizing = false;
|
|
289
289
|
isHResizing = false;
|
|
290
290
|
document.body.style.cursor = 'default';
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
ownIframe.style.pointerEvents = 'auto';
|
|
292
|
+
sourceOfTruthIframe.style.pointerEvents = 'auto';
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
|
|
@@ -298,8 +298,8 @@
|
|
|
298
298
|
hDivider.addEventListener('mousedown', (e) => {
|
|
299
299
|
isHResizing = true;
|
|
300
300
|
document.body.style.cursor = 'row-resize';
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
ownIframe.style.pointerEvents = 'none';
|
|
302
|
+
sourceOfTruthIframe.style.pointerEvents = 'none';
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
// Auto-save notes logic
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
let lastUrl = '';
|
|
407
407
|
setInterval(() => {
|
|
408
408
|
try {
|
|
409
|
-
const currentUrl =
|
|
409
|
+
const currentUrl = ownIframe.contentWindow.location.href;
|
|
410
410
|
|
|
411
411
|
if (currentUrl && currentUrl !== lastUrl && currentUrl !== 'about:blank') {
|
|
412
412
|
lastUrl = currentUrl;
|
|
@@ -440,19 +440,19 @@
|
|
|
440
440
|
window.history.replaceState({}, '', outerUrl.pathname + outerUrl.search);
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
let
|
|
443
|
+
let sotUrl = `http://localhost:${devConfig.sourceOfTruthPort}/iframe.html?id=${id}&viewMode=story`;
|
|
444
444
|
if (args) {
|
|
445
|
-
|
|
445
|
+
sotUrl += `&args=${args}`;
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
|
|
448
|
+
if (sourceOfTruthIframe.src !== sotUrl) {
|
|
449
|
+
sourceOfTruthStatus.textContent = 'Updating...';
|
|
450
|
+
sourceOfTruthStatus.classList.remove('connected');
|
|
451
|
+
sourceOfTruthIframe.src = sotUrl;
|
|
452
|
+
|
|
453
453
|
setTimeout(() => {
|
|
454
|
-
|
|
455
|
-
|
|
454
|
+
sourceOfTruthStatus.textContent = 'Synced';
|
|
455
|
+
sourceOfTruthStatus.classList.add('connected');
|
|
456
456
|
}, 500);
|
|
457
457
|
}
|
|
458
458
|
}
|