@wippy-fe/types-global-proxy 0.0.30 → 0.0.31

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.
Files changed (2) hide show
  1. package/index.d.ts +30 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -284,6 +284,7 @@ interface ApiRoutes {
284
284
  };
285
285
  components: {
286
286
  list: string;
287
+ byTag: string;
287
288
  };
288
289
  tools: {
289
290
  byName: string;
@@ -553,6 +554,11 @@ interface ProxyConfig {
553
554
  };
554
555
  }
555
556
 
557
+ interface SanitizeOptions {
558
+ /** Tags + attrs allowed on top of defaults + the runtime allowlist. */
559
+ extraTags?: Record<string, string[]>;
560
+ }
561
+
556
562
  declare namespace UploadApi {
557
563
  interface Meta {
558
564
  filename: string;
@@ -1297,6 +1303,28 @@ interface ProxyApiInstance {
1297
1303
  state: StateApi;
1298
1304
  ws: ProxyWsApi;
1299
1305
  loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
1306
+ /**
1307
+ * Resolve a registered `view.component`'s custom-element tag name to its
1308
+ * module URL via the views API and define it on `customElements`. Use this
1309
+ * instead of hardcoding peer-module URLs from a consumer WC. Idempotent.
1310
+ *
1311
+ * `options.timeoutMs` overrides the default 30s deadline for waiting on
1312
+ * `customElements.define` after the script is appended — useful when a
1313
+ * caller wants a faster failure (e.g. probing whether a component exists).
1314
+ */
1315
+ loadByTagName: (tag: string, options?: {
1316
+ timeoutMs?: number;
1317
+ }) => Promise<void>;
1318
+ /**
1319
+ * Default-allowlisted HTML sanitizer scoped to this runtime. Combines
1320
+ * `defaultAllowedTags` / `defaultAllowedAttributes` with the set of
1321
+ * web-component tags currently registered in this proxy context — so
1322
+ * a child app calling `loadByTagName('w-foo')` and then
1323
+ * `$W.sanitize('<w-foo>...</w-foo>')` gets the tag preserved without
1324
+ * having to re-declare the allowlist. See `SanitizeOptions` for
1325
+ * per-call overrides.
1326
+ */
1327
+ sanitize: (html: string, opts?: SanitizeOptions) => string;
1300
1328
  }
1301
1329
 
1302
1330
  declare global {
@@ -1360,6 +1388,8 @@ declare global {
1360
1388
  state: () => Promise<ProxyApiInstance['state']>;
1361
1389
  ws: () => Promise<ProxyApiInstance['ws']>;
1362
1390
  loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
1391
+ loadByTagName: () => Promise<ProxyApiInstance['loadByTagName']>;
1392
+ sanitize: () => Promise<ProxyApiInstance['sanitize']>;
1363
1393
  };
1364
1394
  tailwind?: {
1365
1395
  config: Partial<typeof _default>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wippy-fe/types-global-proxy",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "Global type declarations for Wippy iframe proxy (window.getWippyApi, $W, etc.)",
5
5
  "license": "UNLICENSED",
6
6
  "types": "index.d.ts"