@wippy-fe/types-global-proxy 0.0.30 → 0.0.32
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/index.d.ts +70 -0
- 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;
|
|
@@ -532,6 +533,46 @@ interface AppConfigOverrides {
|
|
|
532
533
|
apiRoutes?: ApiRoutesOverride;
|
|
533
534
|
}
|
|
534
535
|
|
|
536
|
+
/**
|
|
537
|
+
* Wippy package metadata types.
|
|
538
|
+
*
|
|
539
|
+
* **Layer boundary**: package.json is the **FE-author's view**. It is
|
|
540
|
+
* source-relative and BE/router/FS agnostic. It describes the build
|
|
541
|
+
* artifact (e.g. `browser: "dist/index.js"`, `wippy.path: "dist/app.html"`)
|
|
542
|
+
* without knowing where the operator will serve it.
|
|
543
|
+
*
|
|
544
|
+
* The YAML registry entry (`wippy/views`) is the **operator's view**. It
|
|
545
|
+
* is deployment-aware and owns paths that depend on the served layout.
|
|
546
|
+
* YAML's `meta.entry_point` overrides the bundled wippy.path / browser
|
|
547
|
+
* when the operator's serving pipeline reshapes the URL space (e.g.
|
|
548
|
+
* `vite --outDir <static-dir>` flattens away the `dist/` prefix).
|
|
549
|
+
*
|
|
550
|
+
* YAML wins on every field. Bundled meta is the fallback. See
|
|
551
|
+
* `wippy-framework/src/views/README.md` for the per-field mapping table.
|
|
552
|
+
*
|
|
553
|
+
* The consumer's `package.json` `wippy` block is the canonical FE-source
|
|
554
|
+
* declaration. At build time the `@wippy-fe/vite-plugin` plugins resolve
|
|
555
|
+
* any `file://<relative-path>` references inside the wippy block (file
|
|
556
|
+
* contents replace the URI string) and emit `dist/wippy-meta.json` with
|
|
557
|
+
* the resolved package.json.
|
|
558
|
+
*
|
|
559
|
+
* `wippy-meta.json` is the MANDATORY contract between consumers and
|
|
560
|
+
* `wippy/views` ≥ 0.5.0. Without it, `views` falls back to its legacy
|
|
561
|
+
* YAML-synthesis path (deprecated; exists only for migration). See
|
|
562
|
+
* `web_components.spec.md` § "Package metadata: source of truth".
|
|
563
|
+
*
|
|
564
|
+
* Convention for `file://`-referenced files: name them
|
|
565
|
+
* `<field-name-kebab>.do-not-link.<ext>` — the basename IS the kebab-case
|
|
566
|
+
* spelling of the wippy block field the file populates. Examples:
|
|
567
|
+
* - `wippy.configOverrides.customization.customCSS` → `custom-css.do-not-link.css`
|
|
568
|
+
* - `wippy.description` → `description.do-not-link.md`
|
|
569
|
+
* - `wippy.<future-field>` → `<future-field-kebab>.do-not-link.<ext>`
|
|
570
|
+
* The `.do-not-link.` infix is an imperative directive that consistently
|
|
571
|
+
* prevents AI agents from `<link>`/`<script>`-ing the file directly in
|
|
572
|
+
* app.html — empirically verified via blind tests. The proxy injects the
|
|
573
|
+
* file's content at runtime from the resolved package metadata.
|
|
574
|
+
*/
|
|
575
|
+
|
|
535
576
|
interface ProxyConfig {
|
|
536
577
|
enabled: boolean;
|
|
537
578
|
injections: {
|
|
@@ -553,6 +594,11 @@ interface ProxyConfig {
|
|
|
553
594
|
};
|
|
554
595
|
}
|
|
555
596
|
|
|
597
|
+
interface SanitizeOptions {
|
|
598
|
+
/** Tags + attrs allowed on top of defaults + the runtime allowlist. */
|
|
599
|
+
extraTags?: Record<string, string[]>;
|
|
600
|
+
}
|
|
601
|
+
|
|
556
602
|
declare namespace UploadApi {
|
|
557
603
|
interface Meta {
|
|
558
604
|
filename: string;
|
|
@@ -1297,6 +1343,28 @@ interface ProxyApiInstance {
|
|
|
1297
1343
|
state: StateApi;
|
|
1298
1344
|
ws: ProxyWsApi;
|
|
1299
1345
|
loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Resolve a registered `view.component`'s custom-element tag name to its
|
|
1348
|
+
* module URL via the views API and define it on `customElements`. Use this
|
|
1349
|
+
* instead of hardcoding peer-module URLs from a consumer WC. Idempotent.
|
|
1350
|
+
*
|
|
1351
|
+
* `options.timeoutMs` overrides the default 30s deadline for waiting on
|
|
1352
|
+
* `customElements.define` after the script is appended — useful when a
|
|
1353
|
+
* caller wants a faster failure (e.g. probing whether a component exists).
|
|
1354
|
+
*/
|
|
1355
|
+
loadByTagName: (tag: string, options?: {
|
|
1356
|
+
timeoutMs?: number;
|
|
1357
|
+
}) => Promise<void>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Default-allowlisted HTML sanitizer scoped to this runtime. Combines
|
|
1360
|
+
* `defaultAllowedTags` / `defaultAllowedAttributes` with the set of
|
|
1361
|
+
* web-component tags currently registered in this proxy context — so
|
|
1362
|
+
* a child app calling `loadByTagName('w-foo')` and then
|
|
1363
|
+
* `$W.sanitize('<w-foo>...</w-foo>')` gets the tag preserved without
|
|
1364
|
+
* having to re-declare the allowlist. See `SanitizeOptions` for
|
|
1365
|
+
* per-call overrides.
|
|
1366
|
+
*/
|
|
1367
|
+
sanitize: (html: string, opts?: SanitizeOptions) => string;
|
|
1300
1368
|
}
|
|
1301
1369
|
|
|
1302
1370
|
declare global {
|
|
@@ -1360,6 +1428,8 @@ declare global {
|
|
|
1360
1428
|
state: () => Promise<ProxyApiInstance['state']>;
|
|
1361
1429
|
ws: () => Promise<ProxyApiInstance['ws']>;
|
|
1362
1430
|
loadWebComponent: () => Promise<ProxyApiInstance['loadWebComponent']>;
|
|
1431
|
+
loadByTagName: () => Promise<ProxyApiInstance['loadByTagName']>;
|
|
1432
|
+
sanitize: () => Promise<ProxyApiInstance['sanitize']>;
|
|
1363
1433
|
};
|
|
1364
1434
|
tailwind?: {
|
|
1365
1435
|
config: Partial<typeof _default>;
|
package/package.json
CHANGED