@tappify/extension-sdk 2.0.0 → 2.1.0-beta.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 +208 -0
- package/dist/chunk-2CY5HVY7.mjs +59 -0
- package/dist/chunk-2CY5HVY7.mjs.map +1 -0
- package/dist/{chunk-2DBSVKAU.cjs → chunk-6HETNZJY.cjs} +1 -1
- package/dist/chunk-6HETNZJY.cjs.map +1 -0
- package/dist/{chunk-PYJMJF44.cjs → chunk-7YKH4LZN.cjs} +9 -2
- package/dist/chunk-7YKH4LZN.cjs.map +1 -0
- package/dist/{chunk-RMUWRESK.cjs → chunk-A74HCO6T.cjs} +31 -18
- package/dist/chunk-A74HCO6T.cjs.map +1 -0
- package/dist/chunk-BPCGXXMD.cjs +781 -0
- package/dist/chunk-BPCGXXMD.cjs.map +1 -0
- package/dist/chunk-EB5XWQAU.cjs +132 -0
- package/dist/chunk-EB5XWQAU.cjs.map +1 -0
- package/dist/{chunk-5AAPD5WV.cjs → chunk-GAUZYBXE.cjs} +11 -11
- package/dist/chunk-GAUZYBXE.cjs.map +1 -0
- package/dist/chunk-J5LGTIGS.mjs +10 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/{chunk-ZT35X7KL.mjs → chunk-KZ5NGFUP.mjs} +22 -9
- package/dist/chunk-KZ5NGFUP.mjs.map +1 -0
- package/dist/chunk-NN263PGQ.cjs +70 -0
- package/dist/chunk-NN263PGQ.cjs.map +1 -0
- package/dist/{chunk-3YWVYA42.cjs → chunk-O357OJXL.cjs} +14 -18
- package/dist/chunk-O357OJXL.cjs.map +1 -0
- package/dist/chunk-ONJMPO3P.cjs +59 -0
- package/dist/chunk-ONJMPO3P.cjs.map +1 -0
- package/dist/{chunk-OPPYEA7F.cjs → chunk-PRCZMOLD.cjs} +3 -3
- package/dist/chunk-PRCZMOLD.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +10 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-QHM7XNRK.mjs → chunk-QA5AL3VZ.mjs} +2 -2
- package/dist/{chunk-QHM7XNRK.mjs.map → chunk-QA5AL3VZ.mjs.map} +1 -1
- package/dist/chunk-QJMZRV7A.mjs +132 -0
- package/dist/chunk-QJMZRV7A.mjs.map +1 -0
- package/dist/{chunk-CSTYBKZC.mjs → chunk-QXD7WVKK.mjs} +1 -1
- package/dist/chunk-QXD7WVKK.mjs.map +1 -0
- package/dist/{chunk-4C5Z3CIK.mjs → chunk-RBIQT75L.mjs} +2 -2
- package/dist/chunk-RBIQT75L.mjs.map +1 -0
- package/dist/{chunk-MNDVYPEP.mjs → chunk-SGCYEEXD.mjs} +9 -2
- package/dist/chunk-SGCYEEXD.mjs.map +1 -0
- package/dist/{chunk-BDCX6LRQ.mjs → chunk-SGEYDV3K.mjs} +3 -3
- package/dist/chunk-SGEYDV3K.mjs.map +1 -0
- package/dist/{chunk-IGK2AP6J.mjs → chunk-SLGOHIBL.mjs} +13 -17
- package/dist/chunk-SLGOHIBL.mjs.map +1 -0
- package/dist/chunk-SWG7CNTZ.mjs +781 -0
- package/dist/chunk-SWG7CNTZ.mjs.map +1 -0
- package/dist/{chunk-7KIKOH5H.cjs → chunk-VV7ELNRW.cjs} +3 -3
- package/dist/chunk-VV7ELNRW.cjs.map +1 -0
- package/dist/chunk-Z43DPNZ6.mjs +70 -0
- package/dist/chunk-Z43DPNZ6.mjs.map +1 -0
- package/dist/client-BO3kavn0.d.ts +25 -0
- package/dist/client-DE-vMgdO.d.cts +25 -0
- package/dist/codegen.cjs.map +1 -1
- package/dist/codegen.d.cts +43 -7
- package/dist/codegen.d.ts +43 -7
- package/dist/codegen.mjs.map +1 -1
- package/dist/{constants-DJ_KgZpN.d.cts → constants-Bh759FUI.d.cts} +44 -8
- package/dist/{constants-DJ_KgZpN.d.ts → constants-Bh759FUI.d.ts} +44 -8
- package/dist/{context-Dt6xh_5t.d.cts → context-DI0EJCRD.d.cts} +5 -4
- package/dist/{context-Ml7k_V14.d.ts → context-mr8R5CNt.d.ts} +5 -4
- package/dist/{errors-COsBh7kd.d.cts → errors-Cqh0wrqt.d.cts} +3 -2
- package/dist/{errors-COsBh7kd.d.ts → errors-Cqh0wrqt.d.ts} +3 -2
- package/dist/host.cjs +5 -4
- package/dist/host.cjs.map +1 -1
- package/dist/host.d.cts +5 -5
- package/dist/host.d.ts +5 -5
- package/dist/host.mjs +4 -3
- package/dist/host.mjs.map +1 -1
- package/dist/index.cjs +9 -656
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -627
- package/dist/index.d.ts +69 -627
- package/dist/index.mjs +5 -652
- package/dist/index.mjs.map +1 -1
- package/dist/manifest.cjs +142 -86
- package/dist/manifest.cjs.map +1 -1
- package/dist/manifest.d.cts +97 -12
- package/dist/manifest.d.ts +97 -12
- package/dist/manifest.mjs +129 -73
- package/dist/manifest.mjs.map +1 -1
- package/dist/server.cjs +15 -66
- 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 +10 -61
- package/dist/server.mjs.map +1 -1
- package/dist/testing/index.cjs +73 -750
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +30 -11
- package/dist/testing/index.d.ts +30 -11
- package/dist/testing/index.mjs +89 -766
- package/dist/testing/index.mjs.map +1 -1
- package/dist/testing/jest.cjs +6 -5
- package/dist/testing/jest.cjs.map +1 -1
- package/dist/testing/jest.mjs +3 -2
- package/dist/testing/jest.mjs.map +1 -1
- package/dist/testing/vitest.cjs +6 -5
- package/dist/testing/vitest.cjs.map +1 -1
- package/dist/testing/vitest.d.cts +10 -0
- package/dist/testing/vitest.d.ts +10 -0
- package/dist/testing/vitest.mjs +3 -2
- package/dist/testing/vitest.mjs.map +1 -1
- package/dist/{types-DDAGLpov.d.ts → types-BdDaLnqs.d.cts} +4 -3
- package/dist/{types-DrpQSv_2.d.cts → types-uGHrRaOj.d.ts} +4 -3
- package/dist/ui/styles.css +740 -0
- package/dist/ui.cjs +1018 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +231 -0
- package/dist/ui.d.ts +231 -0
- package/dist/ui.mjs +1018 -0
- package/dist/ui.mjs.map +1 -0
- package/dist/vite-preview-bootstrap.cjs +66 -0
- package/dist/vite-preview-bootstrap.cjs.map +1 -0
- package/dist/vite-preview-bootstrap.d.cts +15 -0
- package/dist/vite-preview-bootstrap.d.ts +15 -0
- package/dist/vite-preview-bootstrap.mjs +66 -0
- package/dist/vite-preview-bootstrap.mjs.map +1 -0
- package/dist/vite-preview.cjs +876 -0
- package/dist/vite-preview.cjs.map +1 -0
- package/dist/vite-preview.d.cts +9 -0
- package/dist/vite-preview.d.ts +9 -0
- package/dist/vite-preview.mjs +876 -0
- package/dist/vite-preview.mjs.map +1 -0
- package/dist/vite.cjs +320 -60
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +54 -8
- package/dist/vite.d.ts +54 -8
- package/dist/vite.mjs +312 -54
- package/dist/vite.mjs.map +1 -1
- package/dist/work-events-BlOVpK0k.d.ts +547 -0
- package/dist/work-events-D97EoqvS.d.cts +547 -0
- package/package.json +19 -2
- package/schema/extension-v2.json +440 -121
- package/dist/chunk-2DBSVKAU.cjs.map +0 -1
- package/dist/chunk-3YWVYA42.cjs.map +0 -1
- package/dist/chunk-4C5Z3CIK.mjs.map +0 -1
- package/dist/chunk-5AAPD5WV.cjs.map +0 -1
- package/dist/chunk-7KIKOH5H.cjs.map +0 -1
- package/dist/chunk-BDCX6LRQ.mjs.map +0 -1
- package/dist/chunk-CSTYBKZC.mjs.map +0 -1
- package/dist/chunk-IGK2AP6J.mjs.map +0 -1
- package/dist/chunk-MNDVYPEP.mjs.map +0 -1
- package/dist/chunk-OPPYEA7F.cjs.map +0 -1
- package/dist/chunk-PYJMJF44.cjs.map +0 -1
- package/dist/chunk-RMUWRESK.cjs.map +0 -1
- package/dist/chunk-ZT35X7KL.mjs.map +0 -1
- package/dist/handler-CZIlZ5vu.d.ts +0 -227
- package/dist/handler-kU9Jf36K.d.cts +0 -227
- package/dist/styles.css +0 -367
|
@@ -0,0 +1,876 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkONJMPO3Pcjs = require('./chunk-ONJMPO3P.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkNN263PGQcjs = require('./chunk-NN263PGQ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkBPCGXXMDcjs = require('./chunk-BPCGXXMD.cjs');
|
|
13
|
+
require('./chunk-GAUZYBXE.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkVV7ELNRWcjs = require('./chunk-VV7ELNRW.cjs');
|
|
18
|
+
require('./chunk-PRCZMOLD.cjs');
|
|
19
|
+
require('./chunk-A74HCO6T.cjs');
|
|
20
|
+
require('./chunk-7YKH4LZN.cjs');
|
|
21
|
+
require('./chunk-6HETNZJY.cjs');
|
|
22
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
23
|
+
|
|
24
|
+
// src/vite-preview.tsx
|
|
25
|
+
var _client = require('react-dom/client');
|
|
26
|
+
|
|
27
|
+
// src/vite/preview/client.tsx
|
|
28
|
+
var _reactquery = require('@tanstack/react-query'); var TanstackQuery = _interopRequireWildcard(_reactquery);
|
|
29
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react);
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _reactdom = require('react-dom'); var ReactDom = _interopRequireWildcard(_reactdom);
|
|
37
|
+
var _jsxruntime = require('react/jsx-runtime'); var JsxRuntime = _interopRequireWildcard(_jsxruntime);
|
|
38
|
+
|
|
39
|
+
// package.json
|
|
40
|
+
var package_default = {
|
|
41
|
+
name: "@tappify/extension-sdk",
|
|
42
|
+
version: "2.1.0-beta.2",
|
|
43
|
+
description: "Build extensions that run inside Tappify",
|
|
44
|
+
author: "Tappify Team",
|
|
45
|
+
license: "MIT",
|
|
46
|
+
type: "module",
|
|
47
|
+
exports: {
|
|
48
|
+
".": {
|
|
49
|
+
types: "./dist/index.d.ts",
|
|
50
|
+
import: "./dist/index.mjs",
|
|
51
|
+
require: "./dist/index.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./manifest": {
|
|
54
|
+
types: "./dist/manifest.d.ts",
|
|
55
|
+
import: "./dist/manifest.mjs",
|
|
56
|
+
require: "./dist/manifest.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./server": {
|
|
59
|
+
types: "./dist/server.d.ts",
|
|
60
|
+
import: "./dist/server.mjs",
|
|
61
|
+
require: "./dist/server.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./host": {
|
|
64
|
+
types: "./dist/host.d.ts",
|
|
65
|
+
import: "./dist/host.mjs",
|
|
66
|
+
require: "./dist/host.cjs"
|
|
67
|
+
},
|
|
68
|
+
"./ui": {
|
|
69
|
+
types: "./dist/ui.d.ts",
|
|
70
|
+
import: "./dist/ui.mjs",
|
|
71
|
+
require: "./dist/ui.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./vite": {
|
|
74
|
+
types: "./dist/vite.d.ts",
|
|
75
|
+
import: "./dist/vite.mjs",
|
|
76
|
+
require: "./dist/vite.cjs"
|
|
77
|
+
},
|
|
78
|
+
"./vite/preview": {
|
|
79
|
+
types: "./dist/vite-preview.d.ts",
|
|
80
|
+
import: "./dist/vite-preview.mjs",
|
|
81
|
+
require: "./dist/vite-preview.cjs"
|
|
82
|
+
},
|
|
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
|
+
"./testing": {
|
|
89
|
+
types: "./dist/testing/index.d.ts",
|
|
90
|
+
import: "./dist/testing/index.mjs",
|
|
91
|
+
require: "./dist/testing/index.cjs"
|
|
92
|
+
},
|
|
93
|
+
"./testing/vitest": {
|
|
94
|
+
types: "./dist/testing/vitest.d.ts",
|
|
95
|
+
import: "./dist/testing/vitest.mjs",
|
|
96
|
+
require: "./dist/testing/vitest.cjs"
|
|
97
|
+
},
|
|
98
|
+
"./testing/jest": {
|
|
99
|
+
types: "./dist/testing/jest.d.ts",
|
|
100
|
+
import: "./dist/testing/jest.mjs",
|
|
101
|
+
require: "./dist/testing/jest.cjs"
|
|
102
|
+
},
|
|
103
|
+
"./codegen": {
|
|
104
|
+
types: "./dist/codegen.d.ts",
|
|
105
|
+
import: "./dist/codegen.mjs",
|
|
106
|
+
require: "./dist/codegen.cjs"
|
|
107
|
+
},
|
|
108
|
+
"./ui/styles.css": "./dist/ui/styles.css",
|
|
109
|
+
"./schema/extension-v2.json": "./schema/extension-v2.json",
|
|
110
|
+
"./package.json": "./package.json"
|
|
111
|
+
},
|
|
112
|
+
engines: {
|
|
113
|
+
node: ">=20"
|
|
114
|
+
},
|
|
115
|
+
main: "./dist/index.cjs",
|
|
116
|
+
module: "./dist/index.mjs",
|
|
117
|
+
types: "./dist/index.d.ts",
|
|
118
|
+
sideEffects: [
|
|
119
|
+
"*.css",
|
|
120
|
+
"./dist/testing/vitest.*",
|
|
121
|
+
"./dist/testing/jest.*"
|
|
122
|
+
],
|
|
123
|
+
files: [
|
|
124
|
+
"dist",
|
|
125
|
+
"schema"
|
|
126
|
+
],
|
|
127
|
+
repository: {
|
|
128
|
+
type: "git",
|
|
129
|
+
url: "https://github.com/tappify-dev/extension-sdk.git"
|
|
130
|
+
},
|
|
131
|
+
bugs: {
|
|
132
|
+
url: "https://github.com/tappify-dev/extension-sdk/issues"
|
|
133
|
+
},
|
|
134
|
+
homepage: "https://docs.tappify.ai/extensions",
|
|
135
|
+
keywords: [
|
|
136
|
+
"tappify",
|
|
137
|
+
"extension",
|
|
138
|
+
"extension-sdk",
|
|
139
|
+
"react",
|
|
140
|
+
"module-federation"
|
|
141
|
+
],
|
|
142
|
+
scripts: {
|
|
143
|
+
build: "rm -rf dist && tsup && node scripts/copy-styles.mjs",
|
|
144
|
+
"build:schema": "tsx scripts/build-json-schema.ts",
|
|
145
|
+
"build:manifest-reference": "tsx scripts/build-manifest-reference.ts",
|
|
146
|
+
"build:api-reference": "tsx scripts/build-api-reference.ts",
|
|
147
|
+
"check:hosted-schema": "node scripts/check-hosted-schema.mjs",
|
|
148
|
+
"docs:examples": "tsx scripts/check-tsdoc-examples.ts && tsc -p tsconfig.examples.json",
|
|
149
|
+
"docs:validate": "typedoc --options typedoc.frontend.json --emit none && typedoc --options typedoc.server.json --emit none && typedoc --options typedoc.testing.json --emit none",
|
|
150
|
+
"docs:reference": "pnpm docs:examples && pnpm docs:validate && pnpm build:schema && pnpm build:manifest-reference && pnpm build:api-reference",
|
|
151
|
+
dev: "tsup --watch",
|
|
152
|
+
"type-check": "tsc --noEmit",
|
|
153
|
+
format: 'prettier --write "src/**/*.{ts,tsx}" "test/**/*.{ts,tsx}" "*.{json,md,mjs,cjs}"',
|
|
154
|
+
"format:check": 'prettier --check "src/**/*.{ts,tsx}" "test/**/*.{ts,tsx}" "*.{json,md,mjs,cjs}"',
|
|
155
|
+
lint: 'eslint "{src,test}/**/*.{ts,tsx}" --fix',
|
|
156
|
+
test: "vitest run --passWithNoTests --coverage",
|
|
157
|
+
"test:watch": "vitest --watch",
|
|
158
|
+
prepare: "husky",
|
|
159
|
+
commit: "cz",
|
|
160
|
+
prepublishOnly: "npm run build && npm test",
|
|
161
|
+
spellcheck: 'cspell "src/**/*.{ts,tsx}" "test/**/*.{ts,tsx}" "*.{json,md,yml,mjs,cjs}" ".github/**/*.yml"',
|
|
162
|
+
"semantic-release": "semantic-release"
|
|
163
|
+
},
|
|
164
|
+
peerDependencies: {
|
|
165
|
+
"@module-federation/vite": ">=1.16.0",
|
|
166
|
+
"@tanstack/react-query": "^5.100.0",
|
|
167
|
+
"@testing-library/react": ">=16.0.0",
|
|
168
|
+
react: "^19.0.0",
|
|
169
|
+
"react-dom": "^19.0.0",
|
|
170
|
+
vite: ">=8.0.0",
|
|
171
|
+
vitest: ">=3.0.0"
|
|
172
|
+
},
|
|
173
|
+
peerDependenciesMeta: {
|
|
174
|
+
"@module-federation/vite": {
|
|
175
|
+
optional: true
|
|
176
|
+
},
|
|
177
|
+
"@tanstack/react-query": {
|
|
178
|
+
optional: true
|
|
179
|
+
},
|
|
180
|
+
"@testing-library/react": {
|
|
181
|
+
optional: true
|
|
182
|
+
},
|
|
183
|
+
react: {
|
|
184
|
+
optional: true
|
|
185
|
+
},
|
|
186
|
+
"react-dom": {
|
|
187
|
+
optional: true
|
|
188
|
+
},
|
|
189
|
+
vite: {
|
|
190
|
+
optional: true
|
|
191
|
+
},
|
|
192
|
+
vitest: {
|
|
193
|
+
optional: true
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
dependencies: {
|
|
197
|
+
"@module-federation/runtime": "~2.5.1",
|
|
198
|
+
clsx: "^2.1.1",
|
|
199
|
+
jose: "^6.2.12",
|
|
200
|
+
"json-schema-to-typescript": "^16.0.0",
|
|
201
|
+
zod: "^4.3.6"
|
|
202
|
+
},
|
|
203
|
+
devDependencies: {
|
|
204
|
+
"@commitlint/cli": "^20.4.3",
|
|
205
|
+
"@commitlint/config-conventional": "^20.4.3",
|
|
206
|
+
"@eslint/js": "^10.0.1",
|
|
207
|
+
"@module-federation/vite": "~1.16.0",
|
|
208
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
209
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
210
|
+
"@semantic-release/git": "^10.0.1",
|
|
211
|
+
"@semantic-release/github": "^12.0.6",
|
|
212
|
+
"@semantic-release/npm": "^13.1.5",
|
|
213
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
214
|
+
"@tanstack/react-query": "^5.100.14",
|
|
215
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
216
|
+
"@testing-library/react": "^16.1.0",
|
|
217
|
+
"@testing-library/user-event": "^14.5.2",
|
|
218
|
+
"@types/json-schema": "^7.0.15",
|
|
219
|
+
"@types/node": "^22.13.0",
|
|
220
|
+
"@types/react": "^19.0.0",
|
|
221
|
+
"@types/react-dom": "^19.2.7",
|
|
222
|
+
"@vitest/coverage-v8": "^3.0.0",
|
|
223
|
+
commitizen: "^4.3.1",
|
|
224
|
+
"conventional-changelog-conventionalcommits": "^9.3.0",
|
|
225
|
+
cspell: "^9.7.0",
|
|
226
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
227
|
+
eslint: "^10.0.2",
|
|
228
|
+
"eslint-config-prettier": "^10.1.8",
|
|
229
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
230
|
+
"eslint-plugin-react": "^7.37.0",
|
|
231
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
232
|
+
globals: "^17.4.0",
|
|
233
|
+
"happy-dom": "^17.0.0",
|
|
234
|
+
husky: "^9.1.7",
|
|
235
|
+
"lint-staged": "^16.3.2",
|
|
236
|
+
prettier: "^3.8.1",
|
|
237
|
+
"prettier-plugin-organize-imports": "^4.3.0",
|
|
238
|
+
react: "^19.0.0",
|
|
239
|
+
"react-dom": "^19.0.0",
|
|
240
|
+
"semantic-release": "^25.0.3",
|
|
241
|
+
tsup: "^8.3.0",
|
|
242
|
+
tsx: "^4.20.0",
|
|
243
|
+
typedoc: "^0.28.20",
|
|
244
|
+
"typedoc-plugin-markdown": "^4.13.0",
|
|
245
|
+
typescript: "^5.7.0",
|
|
246
|
+
"typescript-eslint": "^8.56.1",
|
|
247
|
+
vite: "^8.0.14",
|
|
248
|
+
vitest: "^3.0.0"
|
|
249
|
+
},
|
|
250
|
+
config: {
|
|
251
|
+
commitizen: {
|
|
252
|
+
path: "cz-conventional-changelog",
|
|
253
|
+
types: {
|
|
254
|
+
feat: {
|
|
255
|
+
description: "New feature",
|
|
256
|
+
title: "Features"
|
|
257
|
+
},
|
|
258
|
+
fix: {
|
|
259
|
+
description: "Bug fix",
|
|
260
|
+
title: "Fixes"
|
|
261
|
+
},
|
|
262
|
+
docs: {
|
|
263
|
+
description: "Documentation changes",
|
|
264
|
+
title: "Documentation"
|
|
265
|
+
},
|
|
266
|
+
style: {
|
|
267
|
+
description: "Code style changes (formatting, etc.)",
|
|
268
|
+
title: "Styles"
|
|
269
|
+
},
|
|
270
|
+
refactor: {
|
|
271
|
+
description: "Code refactoring",
|
|
272
|
+
title: "Refactoring"
|
|
273
|
+
},
|
|
274
|
+
perf: {
|
|
275
|
+
description: "Performance improvements",
|
|
276
|
+
title: "Performance"
|
|
277
|
+
},
|
|
278
|
+
test: {
|
|
279
|
+
description: "Adding or updating tests",
|
|
280
|
+
title: "Tests"
|
|
281
|
+
},
|
|
282
|
+
build: {
|
|
283
|
+
description: "Build system or dependencies",
|
|
284
|
+
title: "Build"
|
|
285
|
+
},
|
|
286
|
+
ci: {
|
|
287
|
+
description: "CI/CD changes",
|
|
288
|
+
title: "CI/CD"
|
|
289
|
+
},
|
|
290
|
+
chore: {
|
|
291
|
+
description: "Chore",
|
|
292
|
+
title: "Chores"
|
|
293
|
+
},
|
|
294
|
+
revert: {
|
|
295
|
+
description: "Revert previous commit",
|
|
296
|
+
title: "Reverts"
|
|
297
|
+
},
|
|
298
|
+
wip: {
|
|
299
|
+
description: "Work in progress / continuing a feature",
|
|
300
|
+
title: "Work in Progress"
|
|
301
|
+
},
|
|
302
|
+
cont: {
|
|
303
|
+
description: "Continue/complete a feature",
|
|
304
|
+
title: "Continue Feature"
|
|
305
|
+
},
|
|
306
|
+
improve: {
|
|
307
|
+
description: "Small improvements or enhancements",
|
|
308
|
+
title: "Improvements"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"lint-staged": {
|
|
314
|
+
"*.{ts,tsx}": [
|
|
315
|
+
"eslint --fix",
|
|
316
|
+
"prettier --write",
|
|
317
|
+
"cspell --no-must-find-files"
|
|
318
|
+
],
|
|
319
|
+
"*.{json,md}": [
|
|
320
|
+
"prettier --write",
|
|
321
|
+
"cspell --no-must-find-files"
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// src/vite/preview/error-boundary.tsx
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
var PreviewErrorBoundary = class extends _react.Component {
|
|
330
|
+
constructor() {
|
|
331
|
+
super(...arguments);
|
|
332
|
+
this.state = { error: null };
|
|
333
|
+
}
|
|
334
|
+
static getDerivedStateFromError(error) {
|
|
335
|
+
return { error };
|
|
336
|
+
}
|
|
337
|
+
componentDidCatch(_error, _info) {
|
|
338
|
+
}
|
|
339
|
+
render() {
|
|
340
|
+
if (this.state.error !== null) {
|
|
341
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tap-preview-message", role: "alert", children: [
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "The contribution could not render." }),
|
|
343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: this.state.error.message })
|
|
344
|
+
] });
|
|
345
|
+
}
|
|
346
|
+
return this.props.children;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/vite/preview/model.ts
|
|
351
|
+
var kindLabel = {
|
|
352
|
+
page: "page",
|
|
353
|
+
tab: "tab",
|
|
354
|
+
widget: "widget",
|
|
355
|
+
rowAction: "row action",
|
|
356
|
+
settings: "settings"
|
|
357
|
+
};
|
|
358
|
+
function titleByExpose(manifest) {
|
|
359
|
+
const titles = /* @__PURE__ */ new Map();
|
|
360
|
+
const contributes = manifest.contributes;
|
|
361
|
+
for (const page of _nullishCoalesce(contributes.pages, () => ( []))) {
|
|
362
|
+
titles.set(`./pages/${page.id}`, page.title);
|
|
363
|
+
}
|
|
364
|
+
for (const tab of _nullishCoalesce(contributes.tabs, () => ( []))) {
|
|
365
|
+
titles.set(`./tabs/${tab.id}`, tab.title);
|
|
366
|
+
}
|
|
367
|
+
for (const widget of _nullishCoalesce(contributes.widgets, () => ( []))) {
|
|
368
|
+
titles.set(`./widgets/${widget.id}`, widget.title);
|
|
369
|
+
}
|
|
370
|
+
for (const action of _nullishCoalesce(contributes.rowActions, () => ( []))) {
|
|
371
|
+
titles.set(`./rowActions/${action.id}`, action.title);
|
|
372
|
+
}
|
|
373
|
+
if (contributes.settings) titles.set("./settings", "Settings");
|
|
374
|
+
return titles;
|
|
375
|
+
}
|
|
376
|
+
function previewSelections(manifest) {
|
|
377
|
+
const titles = titleByExpose(manifest);
|
|
378
|
+
return _chunkNN263PGQcjs.uiContributions.call(void 0, manifest).map((contribution) => {
|
|
379
|
+
const title = _nullishCoalesce(titles.get(contribution.expose), () => ( contribution.id));
|
|
380
|
+
return {
|
|
381
|
+
contribution,
|
|
382
|
+
label: contribution.kind === "settings" ? title : `${title} (${kindLabel[contribution.kind]})`
|
|
383
|
+
};
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function previewProps(contribution, state) {
|
|
387
|
+
switch (contribution.kind) {
|
|
388
|
+
case "page":
|
|
389
|
+
return { params: { pageId: contribution.id, path: "/" } };
|
|
390
|
+
case "tab":
|
|
391
|
+
return {};
|
|
392
|
+
case "widget":
|
|
393
|
+
return { config: {} };
|
|
394
|
+
case "rowAction":
|
|
395
|
+
return { row: { ..._chunkBPCGXXMDcjs.fixtureKeywords[0] } };
|
|
396
|
+
case "settings":
|
|
397
|
+
return {
|
|
398
|
+
values: state.settings,
|
|
399
|
+
onChange: (values) => state.onSettingsChange(values)
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/vite/preview/styles.ts
|
|
405
|
+
var previewStyles = `
|
|
406
|
+
:root {
|
|
407
|
+
color-scheme: light;
|
|
408
|
+
font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
409
|
+
background: #f2f3ee;
|
|
410
|
+
color: #121212;
|
|
411
|
+
font-synthesis: none;
|
|
412
|
+
text-rendering: optimizeLegibility;
|
|
413
|
+
}
|
|
414
|
+
* { box-sizing: border-box; }
|
|
415
|
+
body { margin: 0; min-width: 320px; background: #f2f3ee; }
|
|
416
|
+
button, select { font: inherit; }
|
|
417
|
+
.tap-preview {
|
|
418
|
+
--preview-canvas: #f2f3ee;
|
|
419
|
+
--preview-paper: #fdfdfd;
|
|
420
|
+
--preview-ink: #121212;
|
|
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; }
|
|
452
|
+
.tap-preview-brand strong, .tap-preview-brand span { display: block; }
|
|
453
|
+
.tap-preview-brand strong { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
|
|
454
|
+
.tap-preview-brand span { margin-top: 2px; color: var(--preview-muted); font-size: 11px; }
|
|
455
|
+
.tap-preview-brand i { width: 6px; height: 6px; display: inline-block; margin-right: 6px; border-radius: 50%; background: #64a75f; box-shadow: 0 0 0 2px rgb(100 167 95 / 14%); }
|
|
456
|
+
.tap-preview-controls { display: flex; align-items: end; gap: 8px; }
|
|
457
|
+
.tap-preview-field { min-width: 104px; display: grid; gap: 4px; color: var(--preview-muted); font-size: 10px; font-weight: 600; letter-spacing: 0.045em; text-transform: uppercase; }
|
|
458
|
+
.tap-preview-field--contribution { min-width: 190px; }
|
|
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
|
+
}
|
|
489
|
+
.tap-preview-canvas[data-viewport="tablet"] { max-width: 768px; }
|
|
490
|
+
.tap-preview-canvas[data-viewport="mobile"] { max-width: 390px; }
|
|
491
|
+
.tap-preview-canvas[data-size="slot"] { width: min(100%, 680px); height: 380px; }
|
|
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; }
|
|
495
|
+
.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: var(--preview-muted); }
|
|
497
|
+
@media (max-width: 640px) {
|
|
498
|
+
.tap-preview-stage { padding: 12px; }
|
|
499
|
+
.tap-preview-bar { align-items: flex-start; padding: 12px; }
|
|
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%; }
|
|
508
|
+
}
|
|
509
|
+
`;
|
|
510
|
+
|
|
511
|
+
// src/vite/preview/client.tsx
|
|
512
|
+
|
|
513
|
+
var SINGLETON = { singleton: true, requiredVersion: false };
|
|
514
|
+
var federationInstances = /* @__PURE__ */ new Map();
|
|
515
|
+
var federationSequence = 0;
|
|
516
|
+
async function federationFor(extensionId, remote) {
|
|
517
|
+
const key = `${extensionId}|${remote}`;
|
|
518
|
+
const existing = federationInstances.get(key);
|
|
519
|
+
if (existing !== void 0) return existing;
|
|
520
|
+
federationSequence += 1;
|
|
521
|
+
const name = _chunkNN263PGQcjs.remoteName.call(void 0, extensionId);
|
|
522
|
+
const created = Promise.resolve().then(() => _interopRequireWildcard(require("@module-federation/runtime"))).then(
|
|
523
|
+
({ createInstance }) => createInstance({
|
|
524
|
+
name: `tappify_local_preview_${String(federationSequence)}`,
|
|
525
|
+
remotes: [{ name, alias: name, entry: remote, type: "module" }],
|
|
526
|
+
shared: {
|
|
527
|
+
react: {
|
|
528
|
+
version: React.version,
|
|
529
|
+
lib: () => React,
|
|
530
|
+
shareConfig: SINGLETON
|
|
531
|
+
},
|
|
532
|
+
"react-dom": {
|
|
533
|
+
version: ReactDom.version,
|
|
534
|
+
lib: () => ReactDom,
|
|
535
|
+
shareConfig: SINGLETON
|
|
536
|
+
},
|
|
537
|
+
"react/jsx-runtime": {
|
|
538
|
+
version: React.version,
|
|
539
|
+
lib: () => JsxRuntime,
|
|
540
|
+
shareConfig: SINGLETON
|
|
541
|
+
},
|
|
542
|
+
"@tanstack/react-query": {
|
|
543
|
+
version: package_default.peerDependencies["@tanstack/react-query"].replace(/^[^\d]*/, ""),
|
|
544
|
+
lib: () => TanstackQuery,
|
|
545
|
+
shareConfig: SINGLETON
|
|
546
|
+
},
|
|
547
|
+
"@tappify/extension-sdk": {
|
|
548
|
+
version: package_default.version,
|
|
549
|
+
lib: () => _chunkONJMPO3Pcjs.src_exports,
|
|
550
|
+
shareConfig: SINGLETON
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
})
|
|
554
|
+
);
|
|
555
|
+
federationInstances.set(key, created);
|
|
556
|
+
return created;
|
|
557
|
+
}
|
|
558
|
+
function componentFromModule(module, expose) {
|
|
559
|
+
const candidate = typeof module === "object" && module !== null && "default" in module ? module.default : module;
|
|
560
|
+
if (typeof candidate !== "function") {
|
|
561
|
+
throw new Error(
|
|
562
|
+
`${expose} did not default-export a React component. Export the contribution component as default.`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
return candidate;
|
|
566
|
+
}
|
|
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
|
+
async function loadContribution({
|
|
576
|
+
extensionId,
|
|
577
|
+
remote,
|
|
578
|
+
expose
|
|
579
|
+
}) {
|
|
580
|
+
const federation = await federationFor(extensionId, remote);
|
|
581
|
+
return federation.loadRemote(
|
|
582
|
+
`${_chunkNN263PGQcjs.remoteName.call(void 0, extensionId)}/${expose.replace(/^\.\//, "")}`
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
function isExternalRemote(remote) {
|
|
586
|
+
try {
|
|
587
|
+
const host = new URL(remote).hostname;
|
|
588
|
+
return host !== "localhost" && host !== "127.0.0.1" && host !== "[::1]";
|
|
589
|
+
} catch (e) {
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function localProcedureStubs(manifest) {
|
|
594
|
+
return Object.fromEntries(
|
|
595
|
+
Object.keys(_nullishCoalesce(_optionalChain([manifest, 'access', _ => _.server, 'optionalAccess', _2 => _2.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
|
+
function Message({
|
|
606
|
+
title,
|
|
607
|
+
children
|
|
608
|
+
}) {
|
|
609
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tap-preview-message", role: "status", children: [
|
|
610
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { children: title }),
|
|
611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children })
|
|
612
|
+
] });
|
|
613
|
+
}
|
|
614
|
+
function PreviewSurface({
|
|
615
|
+
portal,
|
|
616
|
+
styles,
|
|
617
|
+
children
|
|
618
|
+
}) {
|
|
619
|
+
const [nodes, setNodes] = _react.useState.call(void 0, null);
|
|
620
|
+
const attachHost = _react.useCallback.call(void 0, (host) => {
|
|
621
|
+
if (host === null) return;
|
|
622
|
+
const root = _nullishCoalesce(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
|
+
_react.useEffect.call(void 0, () => {
|
|
633
|
+
if (nodes === null) return;
|
|
634
|
+
nodes.root.appendChild(portal);
|
|
635
|
+
return () => portal.remove();
|
|
636
|
+
}, [nodes, portal]);
|
|
637
|
+
_react.useEffect.call(void 0, () => {
|
|
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__ */ _jsxruntime.jsx.call(void 0,
|
|
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
|
+
function LocalPreview({
|
|
667
|
+
manifest,
|
|
668
|
+
remote,
|
|
669
|
+
loader = loadContribution
|
|
670
|
+
}) {
|
|
671
|
+
const selections = _react.useMemo.call(void 0, () => previewSelections(manifest), [manifest]);
|
|
672
|
+
const [expose, setExpose] = _react.useState.call(void 0,
|
|
673
|
+
_nullishCoalesce(_optionalChain([selections, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.contribution, 'access', _5 => _5.expose]), () => ( ""))
|
|
674
|
+
);
|
|
675
|
+
const [theme, setTheme] = _react.useState.call(void 0, "light");
|
|
676
|
+
const [viewport, setViewport] = _react.useState.call(void 0, "desktop");
|
|
677
|
+
const [size, setSize] = _react.useState.call(void 0, "slot");
|
|
678
|
+
const [generation, setGeneration] = _react.useState.call(void 0, 0);
|
|
679
|
+
const [settings, setSettings] = _react.useState.call(void 0, {});
|
|
680
|
+
const [loaded, setLoaded] = _react.useState.call(void 0, {
|
|
681
|
+
key: "",
|
|
682
|
+
status: "loading"
|
|
683
|
+
});
|
|
684
|
+
const selection = _nullishCoalesce(selections.find((item) => item.contribution.expose === expose), () => ( selections[0]));
|
|
685
|
+
const contribution = _optionalChain([selection, 'optionalAccess', _6 => _6.contribution]);
|
|
686
|
+
const loadKey = `${remote}|${_nullishCoalesce(_optionalChain([contribution, 'optionalAccess', _7 => _7.expose]), () => ( ""))}`;
|
|
687
|
+
_react.useEffect.call(void 0, () => {
|
|
688
|
+
if (contribution === void 0) return;
|
|
689
|
+
let cancelled = false;
|
|
690
|
+
setLoaded({ key: loadKey, status: "loading" });
|
|
691
|
+
void loader({
|
|
692
|
+
extensionId: manifest.id,
|
|
693
|
+
remote,
|
|
694
|
+
expose: contribution.expose
|
|
695
|
+
}).then((module) => {
|
|
696
|
+
if (cancelled) return;
|
|
697
|
+
setLoaded({
|
|
698
|
+
key: loadKey,
|
|
699
|
+
status: "ready",
|
|
700
|
+
Component: componentFromModule(module, contribution.expose),
|
|
701
|
+
styles: stylesFromModule(module)
|
|
702
|
+
});
|
|
703
|
+
}).catch((error) => {
|
|
704
|
+
if (cancelled) return;
|
|
705
|
+
setLoaded({
|
|
706
|
+
key: loadKey,
|
|
707
|
+
status: "failed",
|
|
708
|
+
message: error instanceof Error ? error.message : "The remote entry could not be loaded."
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
return () => {
|
|
712
|
+
cancelled = true;
|
|
713
|
+
};
|
|
714
|
+
}, [contribution, loadKey, loader, manifest.id, remote]);
|
|
715
|
+
const host = _react.useMemo.call(void 0, () => {
|
|
716
|
+
void generation;
|
|
717
|
+
return _chunkBPCGXXMDcjs.createTapMock.call(void 0, {
|
|
718
|
+
extensionId: manifest.id,
|
|
719
|
+
extensionName: manifest.name,
|
|
720
|
+
project: _chunkBPCGXXMDcjs.fixtures.project.project,
|
|
721
|
+
theme,
|
|
722
|
+
size,
|
|
723
|
+
server: localProcedureStubs(manifest)
|
|
724
|
+
});
|
|
725
|
+
}, [generation, manifest, size, theme]);
|
|
726
|
+
const queryClient = _react.useMemo.call(void 0, () => {
|
|
727
|
+
void generation;
|
|
728
|
+
return _chunkVV7ELNRWcjs.createHostQueryClient.call(void 0, );
|
|
729
|
+
}, [generation]);
|
|
730
|
+
const current = loaded.key === loadKey ? loaded : { key: loadKey, status: "loading" };
|
|
731
|
+
let content;
|
|
732
|
+
if (contribution === void 0) {
|
|
733
|
+
content = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Message, { title: "No UI contributions", children: "Run `tappify extension add` and choose a page, tab, widget, row action, or settings panel." });
|
|
734
|
+
} else if (current.status === "failed") {
|
|
735
|
+
content = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tap-preview-message", role: "alert", children: [
|
|
736
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "The remote entry could not load." }),
|
|
737
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: current.message })
|
|
738
|
+
] });
|
|
739
|
+
} else if (current.status === "ready") {
|
|
740
|
+
const Component2 = current.Component;
|
|
741
|
+
const props = previewProps(contribution, {
|
|
742
|
+
settings,
|
|
743
|
+
onSettingsChange: setSettings
|
|
744
|
+
});
|
|
745
|
+
content = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVV7ELNRWcjs.TapHostProvider, { tap: host.tap, queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PreviewSurface, { portal: host.portal, styles: current.styles, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PreviewErrorBoundary, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Component2, { ...props }) }, `${loadKey}|${String(generation)}`) }) });
|
|
746
|
+
} else {
|
|
747
|
+
content = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Message, { title: "Loading contribution", children: [
|
|
748
|
+
"Loading ",
|
|
749
|
+
selection.label,
|
|
750
|
+
"."
|
|
751
|
+
] });
|
|
752
|
+
}
|
|
753
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "main", { className: "tap-preview", "data-theme": theme, children: [
|
|
754
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: previewStyles }),
|
|
755
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { className: "tap-preview-bar", children: [
|
|
756
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tap-preview-brand", children: [
|
|
757
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: `/${manifest.icon.replace(/^\.\//, "")}`, alt: "" }),
|
|
758
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
759
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: manifest.name }),
|
|
760
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "i", { "aria-hidden": "true" }),
|
|
762
|
+
isExternalRemote(remote) ? "External remote" : "Local preview",
|
|
763
|
+
" \xB7 Fixture data"
|
|
764
|
+
] })
|
|
765
|
+
] })
|
|
766
|
+
] }),
|
|
767
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "tap-preview-controls", children: [
|
|
768
|
+
selections.length > 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "tap-preview-field tap-preview-field--contribution", children: [
|
|
769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Contribution" }),
|
|
770
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
771
|
+
"select",
|
|
772
|
+
{
|
|
773
|
+
value: _nullishCoalesce(_optionalChain([contribution, 'optionalAccess', _8 => _8.expose]), () => ( "")),
|
|
774
|
+
onChange: (event) => setExpose(event.target.value),
|
|
775
|
+
children: selections.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
776
|
+
"option",
|
|
777
|
+
{
|
|
778
|
+
value: item.contribution.expose,
|
|
779
|
+
children: item.label
|
|
780
|
+
},
|
|
781
|
+
item.contribution.expose
|
|
782
|
+
))
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
] }) : null,
|
|
786
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "tap-preview-field", children: [
|
|
787
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Theme" }),
|
|
788
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
789
|
+
"select",
|
|
790
|
+
{
|
|
791
|
+
value: theme,
|
|
792
|
+
onChange: (event) => setTheme(event.target.value),
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "light", children: "Light" }),
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "dark", children: "Dark" })
|
|
796
|
+
]
|
|
797
|
+
}
|
|
798
|
+
)
|
|
799
|
+
] }),
|
|
800
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "tap-preview-field", children: [
|
|
801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Viewport" }),
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
803
|
+
"select",
|
|
804
|
+
{
|
|
805
|
+
value: viewport,
|
|
806
|
+
onChange: (event) => setViewport(event.target.value),
|
|
807
|
+
children: [
|
|
808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "desktop", children: "Desktop" }),
|
|
809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "tablet", children: "Tablet" }),
|
|
810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "mobile", children: "Mobile" })
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
)
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "tap-preview-field", children: [
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Surface" }),
|
|
817
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
818
|
+
"select",
|
|
819
|
+
{
|
|
820
|
+
value: size,
|
|
821
|
+
"aria-label": "Surface size",
|
|
822
|
+
onChange: (event) => setSize(event.target.value),
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "slot", children: "Slot" }),
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "panel", children: "Panel" }),
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "page", children: "Page" })
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
] }),
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
+
"button",
|
|
833
|
+
{
|
|
834
|
+
className: "tap-preview-reset",
|
|
835
|
+
type: "button",
|
|
836
|
+
"aria-label": "Reset fixtures",
|
|
837
|
+
onClick: () => {
|
|
838
|
+
setSettings({});
|
|
839
|
+
setGeneration((value) => value + 1);
|
|
840
|
+
},
|
|
841
|
+
children: "Reset"
|
|
842
|
+
}
|
|
843
|
+
)
|
|
844
|
+
] })
|
|
845
|
+
] }),
|
|
846
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "section", { className: "tap-preview-stage", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
847
|
+
"div",
|
|
848
|
+
{
|
|
849
|
+
className: "tap-preview-canvas",
|
|
850
|
+
"data-viewport": viewport,
|
|
851
|
+
"data-size": size,
|
|
852
|
+
"aria-label": "Preview canvas",
|
|
853
|
+
children: content
|
|
854
|
+
}
|
|
855
|
+
) })
|
|
856
|
+
] });
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// src/vite-preview.tsx
|
|
860
|
+
|
|
861
|
+
function mountLocalPreview({
|
|
862
|
+
manifest,
|
|
863
|
+
remote,
|
|
864
|
+
mount
|
|
865
|
+
}) {
|
|
866
|
+
const root = _client.createRoot.call(void 0, mount);
|
|
867
|
+
root.render(/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LocalPreview, { manifest, remote }));
|
|
868
|
+
return () => root.unmount();
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
exports.LocalPreview = LocalPreview; exports.componentFromModule = componentFromModule; exports.loadContribution = loadContribution; exports.mountLocalPreview = mountLocalPreview;
|
|
876
|
+
//# sourceMappingURL=vite-preview.cjs.map
|