@tappify/extension-sdk 2.1.0-beta.1 → 2.1.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/README.md +18 -54
- package/dist/{chunk-6HETNZJY.cjs → chunk-2DBSVKAU.cjs} +1 -1
- package/dist/{chunk-6HETNZJY.cjs.map → chunk-2DBSVKAU.cjs.map} +1 -1
- package/dist/{chunk-O357OJXL.cjs → chunk-3YWVYA42.cjs} +18 -14
- package/dist/chunk-3YWVYA42.cjs.map +1 -0
- package/dist/{chunk-GAUZYBXE.cjs → chunk-5AAPD5WV.cjs} +11 -11
- package/dist/chunk-5AAPD5WV.cjs.map +1 -0
- package/dist/{chunk-SGEYDV3K.mjs → chunk-BDCX6LRQ.mjs} +3 -3
- package/dist/chunk-BDCX6LRQ.mjs.map +1 -0
- package/dist/{chunk-KZ5NGFUP.mjs → chunk-C3YNVHBP.mjs} +7 -20
- package/dist/chunk-C3YNVHBP.mjs.map +1 -0
- package/dist/{chunk-QXD7WVKK.mjs → chunk-CSTYBKZC.mjs} +1 -1
- package/dist/chunk-CSTYBKZC.mjs.map +1 -0
- package/dist/{chunk-SWG7CNTZ.mjs → chunk-CTSZ5D7S.mjs} +5 -9
- package/dist/chunk-CTSZ5D7S.mjs.map +1 -0
- package/dist/chunk-EW54H7CR.cjs +722 -0
- package/dist/chunk-EW54H7CR.cjs.map +1 -0
- package/dist/chunk-EX3NFXDK.mjs +722 -0
- package/dist/chunk-EX3NFXDK.mjs.map +1 -0
- package/dist/{chunk-A74HCO6T.cjs → chunk-G7XZSN2Q.cjs} +18 -31
- package/dist/chunk-G7XZSN2Q.cjs.map +1 -0
- package/dist/{chunk-RBIQT75L.mjs → chunk-GG3IX52W.mjs} +2 -2
- package/dist/{chunk-SLGOHIBL.mjs → chunk-IGK2AP6J.mjs} +17 -13
- package/dist/chunk-IGK2AP6J.mjs.map +1 -0
- package/dist/{chunk-VV7ELNRW.cjs → chunk-JMUK3K47.cjs} +3 -3
- package/dist/{chunk-VV7ELNRW.cjs.map → chunk-JMUK3K47.cjs.map} +1 -1
- package/dist/{chunk-SGCYEEXD.mjs → chunk-MNDVYPEP.mjs} +2 -9
- package/dist/chunk-MNDVYPEP.mjs.map +1 -0
- package/dist/{chunk-BPCGXXMD.cjs → chunk-NFUPPCX4.cjs} +18 -22
- package/dist/chunk-NFUPPCX4.cjs.map +1 -0
- package/dist/{chunk-PRCZMOLD.cjs → chunk-OPPYEA7F.cjs} +3 -3
- package/dist/{chunk-PRCZMOLD.cjs.map → chunk-OPPYEA7F.cjs.map} +1 -1
- package/dist/{chunk-7YKH4LZN.cjs → chunk-PYJMJF44.cjs} +2 -9
- package/dist/chunk-PYJMJF44.cjs.map +1 -0
- package/dist/{chunk-QA5AL3VZ.mjs → chunk-QHM7XNRK.mjs} +2 -2
- package/dist/{chunk-QA5AL3VZ.mjs.map → chunk-QHM7XNRK.mjs.map} +1 -1
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +7 -40
- package/dist/codegen.d.ts +7 -40
- package/dist/codegen.mjs.map +1 -1
- package/dist/{constants-BAimnqOK.d.cts → constants-DJ_KgZpN.d.cts} +8 -41
- package/dist/{constants-BAimnqOK.d.ts → constants-DJ_KgZpN.d.ts} +8 -41
- package/dist/{context-Cr93B05o.d.ts → context-Dt6xh_5t.d.cts} +4 -5
- package/dist/{context-DJ3REtdT.d.cts → context-Ml7k_V14.d.ts} +4 -5
- package/dist/{errors-Cqh0wrqt.d.ts → errors-COsBh7kd.d.cts} +2 -3
- package/dist/{errors-Cqh0wrqt.d.cts → errors-COsBh7kd.d.ts} +2 -3
- package/dist/handler-CZIlZ5vu.d.ts +227 -0
- package/dist/handler-kU9Jf36K.d.cts +227 -0
- package/dist/host.cjs +4 -4
- package/dist/host.d.cts +4 -4
- package/dist/host.d.ts +4 -4
- package/dist/host.mjs +3 -3
- package/dist/index.cjs +34 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +627 -69
- package/dist/index.d.ts +627 -69
- package/dist/index.mjs +33 -4
- package/dist/manifest.cjs +23 -132
- package/dist/manifest.cjs.map +1 -1
- package/dist/manifest.d.cts +12 -93
- package/dist/manifest.d.ts +12 -93
- package/dist/manifest.mjs +9 -118
- package/dist/manifest.mjs.map +1 -1
- package/dist/server.cjs +66 -14
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +6 -6
- package/dist/server.d.ts +6 -6
- package/dist/server.mjs +61 -9
- package/dist/server.mjs.map +1 -1
- package/dist/styles.css +367 -0
- package/dist/testing/index.cjs +13 -72
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +10 -29
- package/dist/testing/index.d.ts +10 -29
- package/dist/testing/index.mjs +13 -72
- package/dist/testing/index.mjs.map +1 -1
- package/dist/testing/jest.cjs +5 -5
- package/dist/testing/jest.mjs +2 -2
- package/dist/testing/vitest.cjs +5 -5
- package/dist/testing/vitest.cjs.map +1 -1
- package/dist/testing/vitest.d.cts +0 -10
- package/dist/testing/vitest.d.ts +0 -10
- package/dist/testing/vitest.mjs +2 -2
- package/dist/testing/vitest.mjs.map +1 -1
- package/dist/{types-BYGcp5pZ.d.ts → types-DDAGLpov.d.ts} +3 -4
- package/dist/{types-I1JOZyI_.d.cts → types-DrpQSv_2.d.cts} +3 -4
- package/dist/vite-preview.cjs +125 -294
- package/dist/vite-preview.cjs.map +1 -1
- package/dist/vite-preview.d.cts +24 -6
- package/dist/vite-preview.d.ts +24 -6
- package/dist/vite-preview.mjs +118 -287
- package/dist/vite-preview.mjs.map +1 -1
- package/dist/vite.cjs +23 -133
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +7 -40
- package/dist/vite.d.ts +7 -40
- package/dist/vite.mjs +17 -127
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -12
- package/schema/extension-v2.json +121 -432
- package/dist/chunk-2CY5HVY7.mjs +0 -59
- package/dist/chunk-2CY5HVY7.mjs.map +0 -1
- package/dist/chunk-7YKH4LZN.cjs.map +0 -1
- package/dist/chunk-A74HCO6T.cjs.map +0 -1
- package/dist/chunk-BPCGXXMD.cjs.map +0 -1
- package/dist/chunk-EB5XWQAU.cjs +0 -132
- package/dist/chunk-EB5XWQAU.cjs.map +0 -1
- package/dist/chunk-GAUZYBXE.cjs.map +0 -1
- package/dist/chunk-KZ5NGFUP.mjs.map +0 -1
- package/dist/chunk-O357OJXL.cjs.map +0 -1
- package/dist/chunk-ONJMPO3P.cjs +0 -59
- package/dist/chunk-ONJMPO3P.cjs.map +0 -1
- package/dist/chunk-QJMZRV7A.mjs +0 -132
- package/dist/chunk-QJMZRV7A.mjs.map +0 -1
- package/dist/chunk-QXD7WVKK.mjs.map +0 -1
- package/dist/chunk-SGCYEEXD.mjs.map +0 -1
- package/dist/chunk-SGEYDV3K.mjs.map +0 -1
- package/dist/chunk-SLGOHIBL.mjs.map +0 -1
- package/dist/chunk-SWG7CNTZ.mjs.map +0 -1
- package/dist/client-CV1qzQgx.d.cts +0 -25
- package/dist/client-CnlSHDWE.d.ts +0 -25
- package/dist/ui/styles.css +0 -740
- package/dist/ui.cjs +0 -1018
- package/dist/ui.cjs.map +0 -1
- package/dist/ui.d.cts +0 -231
- package/dist/ui.d.ts +0 -231
- package/dist/ui.mjs +0 -1018
- package/dist/ui.mjs.map +0 -1
- package/dist/vite-preview-bootstrap.cjs +0 -66
- package/dist/vite-preview-bootstrap.cjs.map +0 -1
- package/dist/vite-preview-bootstrap.d.cts +0 -15
- package/dist/vite-preview-bootstrap.d.ts +0 -15
- package/dist/vite-preview-bootstrap.mjs +0 -66
- package/dist/vite-preview-bootstrap.mjs.map +0 -1
- package/dist/work-events-DB3WR468.d.ts +0 -547
- package/dist/work-events-Dxe7Djdy.d.cts +0 -547
- /package/dist/{chunk-RBIQT75L.mjs.map → chunk-GG3IX52W.mjs.map} +0 -0
package/dist/vite-preview.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
src_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EX3NFXDK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
remoteName,
|
|
6
6
|
uiContributions
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
createTapMock,
|
|
10
10
|
fixtureKeywords,
|
|
11
11
|
fixtures
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-CTSZ5D7S.mjs";
|
|
13
|
+
import "./chunk-BDCX6LRQ.mjs";
|
|
14
14
|
import {
|
|
15
15
|
TapHostProvider,
|
|
16
16
|
createHostQueryClient
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-GG3IX52W.mjs";
|
|
18
|
+
import "./chunk-QHM7XNRK.mjs";
|
|
19
|
+
import "./chunk-C3YNVHBP.mjs";
|
|
20
|
+
import "./chunk-MNDVYPEP.mjs";
|
|
21
|
+
import "./chunk-CSTYBKZC.mjs";
|
|
22
22
|
import "./chunk-J5LGTIGS.mjs";
|
|
23
23
|
|
|
24
24
|
// src/vite-preview.tsx
|
|
@@ -27,19 +27,14 @@ import { createRoot } from "react-dom/client";
|
|
|
27
27
|
// src/vite/preview/client.tsx
|
|
28
28
|
import * as TanstackQuery from "@tanstack/react-query";
|
|
29
29
|
import * as React from "react";
|
|
30
|
-
import {
|
|
31
|
-
useCallback,
|
|
32
|
-
useEffect,
|
|
33
|
-
useMemo,
|
|
34
|
-
useState
|
|
35
|
-
} from "react";
|
|
30
|
+
import { useEffect, useMemo, useState } from "react";
|
|
36
31
|
import * as ReactDom from "react-dom";
|
|
37
32
|
import * as JsxRuntime from "react/jsx-runtime";
|
|
38
33
|
|
|
39
34
|
// package.json
|
|
40
35
|
var package_default = {
|
|
41
36
|
name: "@tappify/extension-sdk",
|
|
42
|
-
version: "2.1.0
|
|
37
|
+
version: "2.1.0",
|
|
43
38
|
description: "Build extensions that run inside Tappify",
|
|
44
39
|
author: "Tappify Team",
|
|
45
40
|
license: "MIT",
|
|
@@ -65,11 +60,6 @@ var package_default = {
|
|
|
65
60
|
import: "./dist/host.mjs",
|
|
66
61
|
require: "./dist/host.cjs"
|
|
67
62
|
},
|
|
68
|
-
"./ui": {
|
|
69
|
-
types: "./dist/ui.d.ts",
|
|
70
|
-
import: "./dist/ui.mjs",
|
|
71
|
-
require: "./dist/ui.cjs"
|
|
72
|
-
},
|
|
73
63
|
"./vite": {
|
|
74
64
|
types: "./dist/vite.d.ts",
|
|
75
65
|
import: "./dist/vite.mjs",
|
|
@@ -80,11 +70,6 @@ var package_default = {
|
|
|
80
70
|
import: "./dist/vite-preview.mjs",
|
|
81
71
|
require: "./dist/vite-preview.cjs"
|
|
82
72
|
},
|
|
83
|
-
"./vite/preview/bootstrap": {
|
|
84
|
-
types: "./dist/vite-preview-bootstrap.d.ts",
|
|
85
|
-
import: "./dist/vite-preview-bootstrap.mjs",
|
|
86
|
-
require: "./dist/vite-preview-bootstrap.cjs"
|
|
87
|
-
},
|
|
88
73
|
"./testing": {
|
|
89
74
|
types: "./dist/testing/index.d.ts",
|
|
90
75
|
import: "./dist/testing/index.mjs",
|
|
@@ -105,7 +90,7 @@ var package_default = {
|
|
|
105
90
|
import: "./dist/codegen.mjs",
|
|
106
91
|
require: "./dist/codegen.cjs"
|
|
107
92
|
},
|
|
108
|
-
"./
|
|
93
|
+
"./styles.css": "./dist/styles.css",
|
|
109
94
|
"./schema/extension-v2.json": "./schema/extension-v2.json",
|
|
110
95
|
"./package.json": "./package.json"
|
|
111
96
|
},
|
|
@@ -405,106 +390,32 @@ function previewProps(contribution, state) {
|
|
|
405
390
|
var previewStyles = `
|
|
406
391
|
:root {
|
|
407
392
|
color-scheme: light;
|
|
408
|
-
font-family: Inter, ui-sans-serif, -
|
|
409
|
-
background: #
|
|
410
|
-
color: #
|
|
411
|
-
font-synthesis: none;
|
|
412
|
-
text-rendering: optimizeLegibility;
|
|
393
|
+
font-family: Inter, ui-sans-serif, system-ui, sans-serif;
|
|
394
|
+
background: #f4f5ef;
|
|
395
|
+
color: #142012;
|
|
413
396
|
}
|
|
414
397
|
* { box-sizing: border-box; }
|
|
415
|
-
body { margin: 0; min-width: 320px;
|
|
398
|
+
body { margin: 0; min-width: 320px; }
|
|
416
399
|
button, select { font: inherit; }
|
|
417
|
-
.tap-preview {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
--preview-muted: #686b66;
|
|
422
|
-
--preview-border: #d5d7d1;
|
|
423
|
-
--preview-control: #f7f8f4;
|
|
424
|
-
--preview-green: #235027;
|
|
425
|
-
min-height: 100vh;
|
|
426
|
-
display: grid;
|
|
427
|
-
grid-template-rows: auto 1fr;
|
|
428
|
-
background: var(--preview-canvas);
|
|
429
|
-
color: var(--preview-ink);
|
|
430
|
-
}
|
|
431
|
-
.tap-preview[data-theme="dark"] {
|
|
432
|
-
color-scheme: dark;
|
|
433
|
-
--preview-canvas: #111216;
|
|
434
|
-
--preview-paper: #181920;
|
|
435
|
-
--preview-ink: #f4f5f1;
|
|
436
|
-
--preview-muted: #a7aaa4;
|
|
437
|
-
--preview-border: #303239;
|
|
438
|
-
--preview-control: #202229;
|
|
439
|
-
--preview-green: #b4d773;
|
|
440
|
-
}
|
|
441
|
-
.tap-preview-bar {
|
|
442
|
-
min-height: 68px;
|
|
443
|
-
display: flex;
|
|
444
|
-
gap: 24px;
|
|
445
|
-
align-items: center;
|
|
446
|
-
padding: 12px 20px;
|
|
447
|
-
border-bottom: 1px solid var(--preview-border);
|
|
448
|
-
background: var(--preview-paper);
|
|
449
|
-
}
|
|
450
|
-
.tap-preview-brand { min-width: 210px; margin-right: auto; display: flex; align-items: center; gap: 10px; }
|
|
451
|
-
.tap-preview-brand img { width: 36px; height: 36px; flex: 0 0 auto; object-fit: cover; border: 1px solid var(--preview-border); border-radius: 8px; background: #fff; }
|
|
400
|
+
.tap-preview { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
|
|
401
|
+
.tap-preview[data-theme="dark"] { color-scheme: dark; background: #111710; color: #f2f5ec; }
|
|
402
|
+
.tap-preview-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 16px 20px; border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent); background: color-mix(in srgb, Canvas 94%, transparent); }
|
|
403
|
+
.tap-preview-brand { margin-right: auto; min-width: 190px; }
|
|
452
404
|
.tap-preview-brand strong, .tap-preview-brand span { display: block; }
|
|
453
|
-
.tap-preview-brand
|
|
454
|
-
.tap-preview-
|
|
455
|
-
.tap-preview-
|
|
456
|
-
.tap-preview-
|
|
457
|
-
.tap-preview-
|
|
458
|
-
.tap-preview-
|
|
459
|
-
.tap-preview-field select, .tap-preview-reset {
|
|
460
|
-
height: 32px;
|
|
461
|
-
border: 1px solid var(--preview-border);
|
|
462
|
-
border-radius: 6px;
|
|
463
|
-
outline: none;
|
|
464
|
-
background: var(--preview-control);
|
|
465
|
-
color: var(--preview-ink);
|
|
466
|
-
font-size: 12px;
|
|
467
|
-
font-weight: 500;
|
|
468
|
-
letter-spacing: normal;
|
|
469
|
-
text-transform: none;
|
|
470
|
-
}
|
|
471
|
-
.tap-preview-field select { width: 100%; padding: 0 28px 0 9px; cursor: pointer; }
|
|
472
|
-
.tap-preview-field select:focus, .tap-preview-reset:focus-visible { border-color: var(--preview-green); box-shadow: 0 0 0 2px color-mix(in srgb, var(--preview-green) 18%, transparent); }
|
|
473
|
-
.tap-preview-reset { padding: 0 12px; cursor: pointer; }
|
|
474
|
-
.tap-preview-reset:hover { border-color: color-mix(in srgb, var(--preview-ink) 34%, var(--preview-border)); background: var(--preview-paper); }
|
|
475
|
-
.tap-preview-stage { min-width: 0; padding: 22px 24px 14px; overflow: auto; }
|
|
476
|
-
.tap-preview-canvas {
|
|
477
|
-
width: 100%;
|
|
478
|
-
max-width: 1440px;
|
|
479
|
-
height: max(380px, calc(100vh - 118px));
|
|
480
|
-
margin: 0 auto;
|
|
481
|
-
border: 1px solid var(--preview-border);
|
|
482
|
-
border-radius: 8px;
|
|
483
|
-
overflow: hidden;
|
|
484
|
-
background: var(--preview-paper);
|
|
485
|
-
color: var(--preview-ink);
|
|
486
|
-
box-shadow: 0 2px 8px rgb(20 24 18 / 5%);
|
|
487
|
-
transition: max-width 160ms ease;
|
|
488
|
-
}
|
|
405
|
+
.tap-preview-brand span, .tap-preview-note { color: color-mix(in srgb, currentColor 62%, transparent); font-size: 12px; }
|
|
406
|
+
.tap-preview-field { display: grid; gap: 5px; font-size: 12px; }
|
|
407
|
+
.tap-preview-field select, .tap-preview-reset { min-height: 34px; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 7px; background: Canvas; color: CanvasText; padding: 6px 9px; }
|
|
408
|
+
.tap-preview-reset { cursor: pointer; }
|
|
409
|
+
.tap-preview-stage { padding: 24px; overflow: auto; }
|
|
410
|
+
.tap-preview-canvas { width: 100%; min-height: 520px; margin: 0 auto; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: 12px; background: Canvas; color: CanvasText; box-shadow: 0 12px 36px rgb(20 32 18 / 9%); transition: max-width 160ms ease; }
|
|
489
411
|
.tap-preview-canvas[data-viewport="tablet"] { max-width: 768px; }
|
|
490
412
|
.tap-preview-canvas[data-viewport="mobile"] { max-width: 390px; }
|
|
491
|
-
.tap-preview-
|
|
492
|
-
.tap-preview-canvas[data-size="panel"] { width: min(100%, 960px); height: clamp(420px, calc(100vh - 118px), 620px); }
|
|
493
|
-
.tap-preview-canvas[data-size="page"] { height: max(380px, calc(100vh - 118px)); }
|
|
494
|
-
.tap-preview-surface { display: block; height: 100%; min-height: 0; }
|
|
413
|
+
.tap-preview-surface { min-height: 100%; padding: 24px; }
|
|
495
414
|
.tap-preview-message { min-height: 360px; display: grid; place-content: center; gap: 8px; padding: 32px; text-align: center; }
|
|
496
|
-
.tap-preview-message span { max-width: 62ch; color:
|
|
415
|
+
.tap-preview-message span { max-width: 62ch; color: color-mix(in srgb, currentColor 68%, transparent); }
|
|
497
416
|
@media (max-width: 640px) {
|
|
498
417
|
.tap-preview-stage { padding: 12px; }
|
|
499
|
-
.tap-preview-bar {
|
|
500
|
-
.tap-preview-brand { min-width: 0; }
|
|
501
|
-
.tap-preview-controls { width: 100%; overflow-x: auto; padding-bottom: 2px; }
|
|
502
|
-
.tap-preview-field { min-width: 100px; }
|
|
503
|
-
.tap-preview-field--contribution { min-width: 180px; }
|
|
504
|
-
}
|
|
505
|
-
@media (max-width: 900px) {
|
|
506
|
-
.tap-preview-bar { flex-wrap: wrap; gap: 12px; }
|
|
507
|
-
.tap-preview-controls { flex: 1 1 100%; }
|
|
418
|
+
.tap-preview-bar { padding: 12px; }
|
|
508
419
|
}
|
|
509
420
|
`;
|
|
510
421
|
|
|
@@ -564,14 +475,6 @@ function componentFromModule(module, expose) {
|
|
|
564
475
|
}
|
|
565
476
|
return candidate;
|
|
566
477
|
}
|
|
567
|
-
function stylesFromModule(module) {
|
|
568
|
-
if (typeof module !== "object" || module === null || !("styles" in module) || !Array.isArray(module.styles)) {
|
|
569
|
-
return [];
|
|
570
|
-
}
|
|
571
|
-
return module.styles.filter(
|
|
572
|
-
(style) => typeof style === "string"
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
478
|
async function loadContribution({
|
|
576
479
|
extensionId,
|
|
577
480
|
remote,
|
|
@@ -590,18 +493,6 @@ function isExternalRemote(remote) {
|
|
|
590
493
|
return true;
|
|
591
494
|
}
|
|
592
495
|
}
|
|
593
|
-
function localProcedureStubs(manifest) {
|
|
594
|
-
return Object.fromEntries(
|
|
595
|
-
Object.keys(manifest.server?.procedures ?? {}).map((name) => [
|
|
596
|
-
name,
|
|
597
|
-
() => {
|
|
598
|
-
throw new Error(
|
|
599
|
-
"This view needs live server data. Run tappify extension dev --live to connect it."
|
|
600
|
-
);
|
|
601
|
-
}
|
|
602
|
-
])
|
|
603
|
-
);
|
|
604
|
-
}
|
|
605
496
|
function Message({
|
|
606
497
|
title,
|
|
607
498
|
children
|
|
@@ -611,58 +502,6 @@ function Message({
|
|
|
611
502
|
/* @__PURE__ */ jsx2("span", { children })
|
|
612
503
|
] });
|
|
613
504
|
}
|
|
614
|
-
function PreviewSurface({
|
|
615
|
-
portal,
|
|
616
|
-
styles,
|
|
617
|
-
children
|
|
618
|
-
}) {
|
|
619
|
-
const [nodes, setNodes] = useState(null);
|
|
620
|
-
const attachHost = useCallback((host) => {
|
|
621
|
-
if (host === null) return;
|
|
622
|
-
const root = host.shadowRoot ?? host.attachShadow({ mode: "open" });
|
|
623
|
-
let content = root.querySelector("[data-tap-content]");
|
|
624
|
-
if (content === null) {
|
|
625
|
-
content = document.createElement("div");
|
|
626
|
-
content.className = "tap-root";
|
|
627
|
-
content.setAttribute("data-tap-content", "");
|
|
628
|
-
root.appendChild(content);
|
|
629
|
-
}
|
|
630
|
-
setNodes({ root, content });
|
|
631
|
-
}, []);
|
|
632
|
-
useEffect(() => {
|
|
633
|
-
if (nodes === null) return;
|
|
634
|
-
nodes.root.appendChild(portal);
|
|
635
|
-
return () => portal.remove();
|
|
636
|
-
}, [nodes, portal]);
|
|
637
|
-
useEffect(() => {
|
|
638
|
-
if (nodes === null) return;
|
|
639
|
-
const injected = [];
|
|
640
|
-
const inject = (kind, css) => {
|
|
641
|
-
const element = document.createElement("style");
|
|
642
|
-
element.setAttribute("data-tap-style", kind);
|
|
643
|
-
element.textContent = css;
|
|
644
|
-
nodes.root.insertBefore(element, nodes.content);
|
|
645
|
-
injected.push(element);
|
|
646
|
-
};
|
|
647
|
-
inject(
|
|
648
|
-
"preview",
|
|
649
|
-
":host { display: block; height: 100%; min-height: 0; overflow: auto; } .tap-root { box-sizing: border-box; height: 100%; min-height: 100%; padding: 24px; }"
|
|
650
|
-
);
|
|
651
|
-
for (const css of styles) inject("remote", css);
|
|
652
|
-
return () => {
|
|
653
|
-
for (const element of injected) element.remove();
|
|
654
|
-
};
|
|
655
|
-
}, [nodes, styles]);
|
|
656
|
-
return /* @__PURE__ */ jsx2(
|
|
657
|
-
"div",
|
|
658
|
-
{
|
|
659
|
-
ref: attachHost,
|
|
660
|
-
className: "tap-preview-surface",
|
|
661
|
-
"data-tap-preview-surface": true,
|
|
662
|
-
children: nodes === null ? null : ReactDom.createPortal(children, nodes.content)
|
|
663
|
-
}
|
|
664
|
-
);
|
|
665
|
-
}
|
|
666
505
|
function LocalPreview({
|
|
667
506
|
manifest,
|
|
668
507
|
remote,
|
|
@@ -697,8 +536,7 @@ function LocalPreview({
|
|
|
697
536
|
setLoaded({
|
|
698
537
|
key: loadKey,
|
|
699
538
|
status: "ready",
|
|
700
|
-
Component: componentFromModule(module, contribution.expose)
|
|
701
|
-
styles: stylesFromModule(module)
|
|
539
|
+
Component: componentFromModule(module, contribution.expose)
|
|
702
540
|
});
|
|
703
541
|
}).catch((error) => {
|
|
704
542
|
if (cancelled) return;
|
|
@@ -719,10 +557,9 @@ function LocalPreview({
|
|
|
719
557
|
extensionName: manifest.name,
|
|
720
558
|
project: fixtures.project.project,
|
|
721
559
|
theme,
|
|
722
|
-
size
|
|
723
|
-
server: localProcedureStubs(manifest)
|
|
560
|
+
size
|
|
724
561
|
});
|
|
725
|
-
}, [generation, manifest, size, theme]);
|
|
562
|
+
}, [generation, manifest.id, manifest.name, size, theme]);
|
|
726
563
|
const queryClient = useMemo(() => {
|
|
727
564
|
void generation;
|
|
728
565
|
return createHostQueryClient();
|
|
@@ -742,7 +579,7 @@ function LocalPreview({
|
|
|
742
579
|
settings,
|
|
743
580
|
onSettingsChange: setSettings
|
|
744
581
|
});
|
|
745
|
-
content = /* @__PURE__ */ jsx2(TapHostProvider, { tap: host.tap, queryClient, children: /* @__PURE__ */ jsx2(
|
|
582
|
+
content = /* @__PURE__ */ jsx2(TapHostProvider, { tap: host.tap, queryClient, children: /* @__PURE__ */ jsx2(PreviewErrorBoundary, { children: /* @__PURE__ */ jsx2("div", { className: "tap-preview-surface", children: /* @__PURE__ */ jsx2(Component2, { ...props }) }) }, `${loadKey}|${String(generation)}`) });
|
|
746
583
|
} else {
|
|
747
584
|
content = /* @__PURE__ */ jsxs2(Message, { title: "Loading contribution", children: [
|
|
748
585
|
"Loading ",
|
|
@@ -754,105 +591,99 @@ function LocalPreview({
|
|
|
754
591
|
/* @__PURE__ */ jsx2("style", { children: previewStyles }),
|
|
755
592
|
/* @__PURE__ */ jsxs2("header", { className: "tap-preview-bar", children: [
|
|
756
593
|
/* @__PURE__ */ jsxs2("div", { className: "tap-preview-brand", children: [
|
|
757
|
-
/* @__PURE__ */ jsx2("
|
|
758
|
-
/* @__PURE__ */ jsxs2("
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
/* @__PURE__ */ jsx2("i", { "aria-hidden": "true" }),
|
|
762
|
-
isExternalRemote(remote) ? "External remote" : "Local preview",
|
|
763
|
-
" \xB7 Fixture data"
|
|
764
|
-
] })
|
|
594
|
+
/* @__PURE__ */ jsx2("strong", { children: manifest.name }),
|
|
595
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
596
|
+
isExternalRemote(remote) ? "External remote" : "Local preview",
|
|
597
|
+
" \xB7 Fixture data"
|
|
765
598
|
] })
|
|
766
599
|
] }),
|
|
767
|
-
/* @__PURE__ */ jsxs2("
|
|
768
|
-
|
|
769
|
-
/* @__PURE__ */ jsx2("span", { children: "Contribution" }),
|
|
770
|
-
/* @__PURE__ */ jsx2(
|
|
771
|
-
"select",
|
|
772
|
-
{
|
|
773
|
-
value: contribution?.expose ?? "",
|
|
774
|
-
onChange: (event) => setExpose(event.target.value),
|
|
775
|
-
children: selections.map((item) => /* @__PURE__ */ jsx2(
|
|
776
|
-
"option",
|
|
777
|
-
{
|
|
778
|
-
value: item.contribution.expose,
|
|
779
|
-
children: item.label
|
|
780
|
-
},
|
|
781
|
-
item.contribution.expose
|
|
782
|
-
))
|
|
783
|
-
}
|
|
784
|
-
)
|
|
785
|
-
] }) : null,
|
|
786
|
-
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
787
|
-
/* @__PURE__ */ jsx2("span", { children: "Theme" }),
|
|
788
|
-
/* @__PURE__ */ jsxs2(
|
|
789
|
-
"select",
|
|
790
|
-
{
|
|
791
|
-
value: theme,
|
|
792
|
-
onChange: (event) => setTheme(event.target.value),
|
|
793
|
-
children: [
|
|
794
|
-
/* @__PURE__ */ jsx2("option", { value: "light", children: "Light" }),
|
|
795
|
-
/* @__PURE__ */ jsx2("option", { value: "dark", children: "Dark" })
|
|
796
|
-
]
|
|
797
|
-
}
|
|
798
|
-
)
|
|
799
|
-
] }),
|
|
800
|
-
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
801
|
-
/* @__PURE__ */ jsx2("span", { children: "Viewport" }),
|
|
802
|
-
/* @__PURE__ */ jsxs2(
|
|
803
|
-
"select",
|
|
804
|
-
{
|
|
805
|
-
value: viewport,
|
|
806
|
-
onChange: (event) => setViewport(event.target.value),
|
|
807
|
-
children: [
|
|
808
|
-
/* @__PURE__ */ jsx2("option", { value: "desktop", children: "Desktop" }),
|
|
809
|
-
/* @__PURE__ */ jsx2("option", { value: "tablet", children: "Tablet" }),
|
|
810
|
-
/* @__PURE__ */ jsx2("option", { value: "mobile", children: "Mobile" })
|
|
811
|
-
]
|
|
812
|
-
}
|
|
813
|
-
)
|
|
814
|
-
] }),
|
|
815
|
-
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
816
|
-
/* @__PURE__ */ jsx2("span", { children: "Surface" }),
|
|
817
|
-
/* @__PURE__ */ jsxs2(
|
|
818
|
-
"select",
|
|
819
|
-
{
|
|
820
|
-
value: size,
|
|
821
|
-
"aria-label": "Surface size",
|
|
822
|
-
onChange: (event) => setSize(event.target.value),
|
|
823
|
-
children: [
|
|
824
|
-
/* @__PURE__ */ jsx2("option", { value: "slot", children: "Slot" }),
|
|
825
|
-
/* @__PURE__ */ jsx2("option", { value: "panel", children: "Panel" }),
|
|
826
|
-
/* @__PURE__ */ jsx2("option", { value: "page", children: "Page" })
|
|
827
|
-
]
|
|
828
|
-
}
|
|
829
|
-
)
|
|
830
|
-
] }),
|
|
600
|
+
selections.length > 0 ? /* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
601
|
+
"Contribution",
|
|
831
602
|
/* @__PURE__ */ jsx2(
|
|
832
|
-
"
|
|
603
|
+
"select",
|
|
833
604
|
{
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
605
|
+
value: contribution?.expose ?? "",
|
|
606
|
+
onChange: (event) => setExpose(event.target.value),
|
|
607
|
+
children: selections.map((item) => /* @__PURE__ */ jsx2(
|
|
608
|
+
"option",
|
|
609
|
+
{
|
|
610
|
+
value: item.contribution.expose,
|
|
611
|
+
children: item.label
|
|
612
|
+
},
|
|
613
|
+
item.contribution.expose
|
|
614
|
+
))
|
|
842
615
|
}
|
|
843
616
|
)
|
|
844
|
-
] })
|
|
617
|
+
] }) : null,
|
|
618
|
+
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
619
|
+
"Theme",
|
|
620
|
+
/* @__PURE__ */ jsxs2(
|
|
621
|
+
"select",
|
|
622
|
+
{
|
|
623
|
+
value: theme,
|
|
624
|
+
onChange: (event) => setTheme(event.target.value),
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ jsx2("option", { value: "light", children: "Light" }),
|
|
627
|
+
/* @__PURE__ */ jsx2("option", { value: "dark", children: "Dark" })
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] }),
|
|
632
|
+
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
633
|
+
"Viewport",
|
|
634
|
+
/* @__PURE__ */ jsxs2(
|
|
635
|
+
"select",
|
|
636
|
+
{
|
|
637
|
+
value: viewport,
|
|
638
|
+
onChange: (event) => setViewport(event.target.value),
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ jsx2("option", { value: "desktop", children: "Desktop" }),
|
|
641
|
+
/* @__PURE__ */ jsx2("option", { value: "tablet", children: "Tablet" }),
|
|
642
|
+
/* @__PURE__ */ jsx2("option", { value: "mobile", children: "Mobile" })
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
)
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ jsxs2("label", { className: "tap-preview-field", children: [
|
|
648
|
+
"Surface size",
|
|
649
|
+
/* @__PURE__ */ jsxs2(
|
|
650
|
+
"select",
|
|
651
|
+
{
|
|
652
|
+
value: size,
|
|
653
|
+
onChange: (event) => setSize(event.target.value),
|
|
654
|
+
children: [
|
|
655
|
+
/* @__PURE__ */ jsx2("option", { value: "slot", children: "Slot" }),
|
|
656
|
+
/* @__PURE__ */ jsx2("option", { value: "panel", children: "Panel" }),
|
|
657
|
+
/* @__PURE__ */ jsx2("option", { value: "page", children: "Page" })
|
|
658
|
+
]
|
|
659
|
+
}
|
|
660
|
+
)
|
|
661
|
+
] }),
|
|
662
|
+
/* @__PURE__ */ jsx2(
|
|
663
|
+
"button",
|
|
664
|
+
{
|
|
665
|
+
className: "tap-preview-reset",
|
|
666
|
+
type: "button",
|
|
667
|
+
onClick: () => {
|
|
668
|
+
setSettings({});
|
|
669
|
+
setGeneration((value) => value + 1);
|
|
670
|
+
},
|
|
671
|
+
children: "Reset fixtures"
|
|
672
|
+
}
|
|
673
|
+
)
|
|
845
674
|
] }),
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
675
|
+
/* @__PURE__ */ jsxs2("section", { className: "tap-preview-stage", children: [
|
|
676
|
+
/* @__PURE__ */ jsx2(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
className: "tap-preview-canvas",
|
|
680
|
+
"data-viewport": viewport,
|
|
681
|
+
"aria-label": "Preview canvas",
|
|
682
|
+
children: content
|
|
683
|
+
}
|
|
684
|
+
),
|
|
685
|
+
/* @__PURE__ */ jsx2("p", { className: "tap-preview-note", children: "Server procedures are unavailable locally. Use `tappify extension dev --live` for real host and server behavior." })
|
|
686
|
+
] })
|
|
856
687
|
] });
|
|
857
688
|
}
|
|
858
689
|
|