@taggor/component 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +67 -2
- package/assets.d.ts +35 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +14 -0
- package/dist/assets.js.map +1 -0
- package/dist/bounded-json.d.ts +21 -0
- package/dist/bounded-json.d.ts.map +1 -0
- package/dist/bounded-json.js +55 -0
- package/dist/bounded-json.js.map +1 -0
- package/dist/build/check-messages.d.ts +41 -0
- package/dist/build/check-messages.d.ts.map +1 -0
- package/dist/build/check-messages.js +142 -0
- package/dist/build/check-messages.js.map +1 -0
- package/dist/build/extract-manifest.d.ts +48 -0
- package/dist/build/extract-manifest.d.ts.map +1 -0
- package/dist/build/extract-manifest.js +81 -0
- package/dist/build/extract-manifest.js.map +1 -0
- package/dist/build/extract-styles.d.ts +36 -0
- package/dist/build/extract-styles.d.ts.map +1 -0
- package/dist/build/extract-styles.js +48 -0
- package/dist/build/extract-styles.js.map +1 -0
- package/dist/build/find-definition.d.ts +14 -0
- package/dist/build/find-definition.d.ts.map +1 -0
- package/dist/build/find-definition.js +23 -0
- package/dist/build/find-definition.js.map +1 -0
- package/dist/build/index.d.ts +10 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +10 -0
- package/dist/build/index.js.map +1 -0
- package/dist/consent.d.ts +100 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.js +147 -0
- package/dist/consent.js.map +1 -0
- package/dist/data-client.d.ts +34 -0
- package/dist/data-client.d.ts.map +1 -0
- package/dist/data-client.js +78 -0
- package/dist/data-client.js.map +1 -0
- package/dist/data-declaration.d.ts +59 -0
- package/dist/data-declaration.d.ts.map +1 -0
- package/dist/data-declaration.js +2 -0
- package/dist/data-declaration.js.map +1 -0
- package/dist/data-errors.d.ts +33 -0
- package/dist/data-errors.d.ts.map +1 -0
- package/dist/data-errors.js +73 -0
- package/dist/data-errors.js.map +1 -0
- package/dist/data-transport.d.ts +73 -0
- package/dist/data-transport.d.ts.map +1 -0
- package/dist/data-transport.js +2 -0
- package/dist/data-transport.js.map +1 -0
- package/dist/debug.d.ts +14 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +11 -0
- package/dist/debug.js.map +1 -0
- package/dist/define-component.d.ts +162 -0
- package/dist/define-component.d.ts.map +1 -0
- package/dist/define-component.js +79 -0
- package/dist/define-component.js.map +1 -0
- package/dist/define-library.d.ts +24 -0
- package/dist/define-library.d.ts.map +1 -0
- package/dist/define-library.js +24 -0
- package/dist/define-library.js.map +1 -0
- package/dist/edge-transport.d.ts +25 -0
- package/dist/edge-transport.d.ts.map +1 -0
- package/dist/edge-transport.js +94 -0
- package/dist/edge-transport.js.map +1 -0
- package/dist/events.d.ts +50 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +2 -0
- package/dist/events.js.map +1 -0
- package/dist/form-field.d.ts +59 -0
- package/dist/form-field.d.ts.map +1 -0
- package/dist/form-field.js +114 -0
- package/dist/form-field.js.map +1 -0
- package/dist/host.d.ts +45 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +30 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/intl-format.d.ts +37 -0
- package/dist/intl-format.d.ts.map +1 -0
- package/dist/intl-format.js +56 -0
- package/dist/intl-format.js.map +1 -0
- package/dist/issued-proofs.d.ts +19 -0
- package/dist/issued-proofs.d.ts.map +1 -0
- package/dist/issued-proofs.js +19 -0
- package/dist/issued-proofs.js.map +1 -0
- package/dist/locale.d.ts +28 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +62 -0
- package/dist/locale.js.map +1 -0
- package/dist/memory-transport.d.ts +39 -0
- package/dist/memory-transport.d.ts.map +1 -0
- package/dist/memory-transport.js +34 -0
- package/dist/memory-transport.js.map +1 -0
- package/dist/messages.d.ts +34 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +54 -0
- package/dist/messages.js.map +1 -0
- package/dist/none.d.ts +7 -0
- package/dist/none.d.ts.map +1 -0
- package/dist/none.js +6 -0
- package/dist/none.js.map +1 -0
- package/dist/props.d.ts +89 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +25 -0
- package/dist/props.js.map +1 -0
- package/dist/slots.d.ts +26 -0
- package/dist/slots.d.ts.map +1 -0
- package/dist/slots.js +70 -0
- package/dist/slots.js.map +1 -0
- package/dist/submit-result.d.ts +19 -0
- package/dist/submit-result.d.ts.map +1 -0
- package/dist/submit-result.js +58 -0
- package/dist/submit-result.js.map +1 -0
- package/dist/testing/form-internals.d.ts +59 -0
- package/dist/testing/form-internals.d.ts.map +1 -0
- package/dist/testing/form-internals.js +150 -0
- package/dist/testing/form-internals.js.map +1 -0
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mount-component.d.ts +105 -0
- package/dist/testing/mount-component.d.ts.map +1 -0
- package/dist/testing/mount-component.js +270 -0
- package/dist/testing/mount-component.js.map +1 -0
- package/dist/testing/visitor.d.ts +23 -0
- package/dist/testing/visitor.d.ts.map +1 -0
- package/dist/testing/visitor.js +34 -0
- package/dist/testing/visitor.js.map +1 -0
- package/dist/theming.d.ts +42 -0
- package/dist/theming.d.ts.map +1 -0
- package/dist/theming.js +19 -0
- package/dist/theming.js.map +1 -0
- package/dist/turnstile.d.ts +60 -0
- package/dist/turnstile.d.ts.map +1 -0
- package/dist/turnstile.js +179 -0
- package/dist/turnstile.js.map +1 -0
- package/dist/use-font.d.ts +65 -0
- package/dist/use-font.d.ts.map +1 -0
- package/dist/use-font.js +145 -0
- package/dist/use-font.js.map +1 -0
- package/dist/use-locale.d.ts +46 -0
- package/dist/use-locale.d.ts.map +1 -0
- package/dist/use-locale.js +57 -0
- package/dist/use-locale.js.map +1 -0
- package/dist/use-taggor-data.d.ts +72 -0
- package/dist/use-taggor-data.d.ts.map +1 -0
- package/dist/use-taggor-data.js +179 -0
- package/dist/use-taggor-data.js.map +1 -0
- package/dist/use-track.d.ts +17 -0
- package/dist/use-track.d.ts.map +1 -0
- package/dist/use-track.js +64 -0
- package/dist/use-track.js.map +1 -0
- package/dist/value-types.d.ts +69 -0
- package/dist/value-types.d.ts.map +1 -0
- package/dist/value-types.js +15 -0
- package/dist/value-types.js.map +1 -0
- package/dist/visitor-action.d.ts +49 -0
- package/dist/visitor-action.d.ts.map +1 -0
- package/dist/visitor-action.js +77 -0
- package/dist/visitor-action.js.map +1 -0
- package/package.json +71 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineTaggorComponent` (TAG-202): turns an author's declaration into a `ComponentDefinition`, the inert
|
|
3
|
+
* object the builder reads the manifest from (`extractManifest`, `@taggor/component/build`) and the
|
|
4
|
+
* runtime mounts (`createComponentElement`, TAG-302).
|
|
5
|
+
*
|
|
6
|
+
* Nothing happens at import or at definition time (golden rule 2): no `customElements.define`, no
|
|
7
|
+
* global, no DOM access, no validation that could throw on a visitor's page. Registering the tag is
|
|
8
|
+
* the runtime's job (ADR 0018); validating the manifest is the builder's (`extractManifest`).
|
|
9
|
+
* TAG-203: the `data` declaration is typed (`D`), and `render`'s context carries the frozen
|
|
10
|
+
* manifest, which the data hooks read and are typed by. TAG-206: `parts`, `cssVars` and `tag` are
|
|
11
|
+
* typed too (`R`, `C`, `T`): `styles` may be a function of the component's `Theme` (`cssVar`, `part`),
|
|
12
|
+
* `render`'s context carries the same helpers, and the literal tag types the DOM event names
|
|
13
|
+
* (`ComponentEventMap`). TAG-211: `locales` (`{ default, messages }`, typed `M`) declares the message
|
|
14
|
+
* catalogs; it stays in the frozen manifest at no cost to `defineTaggorComponent`, `useLocale` reads it
|
|
15
|
+
* from `render`'s context, and the builder's `extractManifest` turns it into the contract's
|
|
16
|
+
* `{ supported, default }`. TAG-232: `ComponentPropsOf` and `ComponentEventsOf` read the manifest's
|
|
17
|
+
* `props` and `events`, so a component with `locales` keeps its typed props and events.
|
|
18
|
+
*/
|
|
19
|
+
import { h } from "preact";
|
|
20
|
+
import { HostContext } from "./host.js";
|
|
21
|
+
import { createTheme, } from "./theming.js";
|
|
22
|
+
/** Brand of every `ComponentDefinition`; `extractManifest` and the runtime check it. */
|
|
23
|
+
export const COMPONENT_KIND = "taggor.component";
|
|
24
|
+
/**
|
|
25
|
+
* Declares a component.
|
|
26
|
+
*
|
|
27
|
+
* Inputs: the manifest fields (`name`, `tag`, `title`, `description` and the optional `props`,
|
|
28
|
+
* `events`, `slots`, `parts`, `cssVars`, `data`, `size`, `permissions`, `locales`), optional
|
|
29
|
+
* `styles` and
|
|
30
|
+
* `render`. Prop types are inferred from `props` (`prop.number({ default: 1.2 })` gives
|
|
31
|
+
* `rate: number`), `emit` only accepts the names in `events`, and the data hooks given the render
|
|
32
|
+
* context only accept the collections and interactions in `data` (TAG-203); `cssVar` and `part`
|
|
33
|
+
* (in `render`'s context and in a `styles` function) only accept the names in `cssVars` and
|
|
34
|
+
* `parts` (TAG-206); `t` of `useLocale` only accepts keys of the `locales` catalogs, and its
|
|
35
|
+
* `default` must be one of their languages (TAG-211). Output: a frozen
|
|
36
|
+
* `ComponentDefinition`. Errors: none at runtime (the manifest is checked by `extractManifest` at
|
|
37
|
+
* build time). Side effects: none; nothing is registered.
|
|
38
|
+
*/
|
|
39
|
+
export function defineTaggorComponent(options) {
|
|
40
|
+
const { render, styles, ...draft } = options;
|
|
41
|
+
const manifest = Object.freeze(draft);
|
|
42
|
+
const theme = createTheme(draft.cssVars);
|
|
43
|
+
const css = typeof styles === "function" ? styles(theme) : styles;
|
|
44
|
+
const Body = ({ host, props }) => render(props, {
|
|
45
|
+
emit: (name, detail) => {
|
|
46
|
+
host.emit(name, detail);
|
|
47
|
+
// TAG-820: a declared event the component emitted is an `interaction`: the transport (ours,
|
|
48
|
+
// never throws) checks the name against `events`, samples, caps and sends the name only.
|
|
49
|
+
host.transport?.track({ name, manifest: draft, host });
|
|
50
|
+
},
|
|
51
|
+
manifest,
|
|
52
|
+
cssVar: theme.cssVar,
|
|
53
|
+
part: theme.part,
|
|
54
|
+
});
|
|
55
|
+
// The provider sits above `Body` so hooks inside `render` (useHost, useSlot) see the host.
|
|
56
|
+
const component = (componentProps) => h(HostContext.Provider, { value: componentProps.host }, h(Body, componentProps));
|
|
57
|
+
return Object.freeze({
|
|
58
|
+
kind: COMPONENT_KIND,
|
|
59
|
+
manifest,
|
|
60
|
+
styles: Object.freeze(typeof css === "string" ? [css] : [...(css ?? [])]),
|
|
61
|
+
component,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether a value is a `ComponentDefinition` made by `defineTaggorComponent` (or shaped like one).
|
|
66
|
+
*
|
|
67
|
+
* Inputs: any value. Output: true when it is an object with the `kind` brand, a `manifest`
|
|
68
|
+
* object and a `component` function. Errors: none. Side effects: reads three properties.
|
|
69
|
+
*/
|
|
70
|
+
export function isComponentDefinition(value) {
|
|
71
|
+
if (typeof value !== "object" || value === null)
|
|
72
|
+
return false;
|
|
73
|
+
const candidate = value;
|
|
74
|
+
return (candidate.kind === COMPONENT_KIND &&
|
|
75
|
+
typeof candidate.manifest === "object" &&
|
|
76
|
+
candidate.manifest !== null &&
|
|
77
|
+
typeof candidate.component === "function");
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=define-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.js","sourceRoot":"","sources":["../src/define-component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAkD,MAAM,QAAQ,CAAC;AAK3E,OAAO,EAAE,WAAW,EAAsB,MAA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C,MAAM,CAAC;QACnB,IAAI,EAAE,cAAc;QACpB,QAAQ;QACR,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;QACzE,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,KAA4D,CAAC;IAC/E,OAAO,CACL,SAAS,CAAC,IAAI,KAAK,cAAc;QACjC,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,SAAS,CAAC,QAAQ,KAAK,IAAI;QAC3B,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU,CAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Workspace library authoring metadata (TAG-210); this declaration has no browser side effects. */
|
|
2
|
+
import type { LibraryManifest } from "@taggor/contract";
|
|
3
|
+
declare const LIBRARY_KIND: "taggor.library";
|
|
4
|
+
/** Inert definition returned by `defineLibrary`; the builder validates its manifest before use. */
|
|
5
|
+
export interface LibraryDefinition {
|
|
6
|
+
readonly kind: typeof LIBRARY_KIND;
|
|
7
|
+
readonly manifest: LibraryManifest;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Declares immutable metadata for one shared workspace package.
|
|
11
|
+
*
|
|
12
|
+
* Inputs: a manifest with a scoped name, exact version and source exports. Output: frozen metadata
|
|
13
|
+
* for build-time extraction. Errors: none at runtime; `@taggor/contract` validates at build time.
|
|
14
|
+
* Side effects: none.
|
|
15
|
+
*/
|
|
16
|
+
export declare function defineLibrary(manifest: LibraryManifest): LibraryDefinition;
|
|
17
|
+
/**
|
|
18
|
+
* Checks that an imported value has the inert library-definition shape.
|
|
19
|
+
*
|
|
20
|
+
* Inputs: any value. Output: whether it is a library definition. Errors: none. Side effects: none.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isLibraryDefinition(value: unknown): value is LibraryDefinition;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=define-library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-library.d.ts","sourceRoot":"","sources":["../src/define-library.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,QAAA,MAAM,YAAY,EAAG,gBAAyB,CAAC;AAE/C,mGAAmG;AACnG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,YAAY,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,iBAAiB,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAQ9E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const LIBRARY_KIND = "taggor.library";
|
|
2
|
+
/**
|
|
3
|
+
* Declares immutable metadata for one shared workspace package.
|
|
4
|
+
*
|
|
5
|
+
* Inputs: a manifest with a scoped name, exact version and source exports. Output: frozen metadata
|
|
6
|
+
* for build-time extraction. Errors: none at runtime; `@taggor/contract` validates at build time.
|
|
7
|
+
* Side effects: none.
|
|
8
|
+
*/
|
|
9
|
+
export function defineLibrary(manifest) {
|
|
10
|
+
return Object.freeze({ kind: LIBRARY_KIND, manifest: Object.freeze({ ...manifest }) });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Checks that an imported value has the inert library-definition shape.
|
|
14
|
+
*
|
|
15
|
+
* Inputs: any value. Output: whether it is a library definition. Errors: none. Side effects: none.
|
|
16
|
+
*/
|
|
17
|
+
export function isLibraryDefinition(value) {
|
|
18
|
+
return (typeof value === "object" &&
|
|
19
|
+
value !== null &&
|
|
20
|
+
"kind" in value &&
|
|
21
|
+
value.kind === LIBRARY_KIND &&
|
|
22
|
+
"manifest" in value);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=define-library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-library.js","sourceRoot":"","sources":["../src/define-library.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,gBAAyB,CAAC;AAQ/C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,QAAyB;IACrD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,YAAY;QAC3B,UAAU,IAAI,KAAK,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataTransport } from "./data-transport.js";
|
|
2
|
+
/** How `createEdgeTransport` reaches the network; the defaults are the browser's own. */
|
|
3
|
+
export interface EdgeTransportOptions {
|
|
4
|
+
/** Origin (and optional path prefix) of the edge, e.g. `https://cdn.example.com`. */
|
|
5
|
+
readonly baseUrl: string;
|
|
6
|
+
/** The public key of the site the component is on. */
|
|
7
|
+
readonly siteKey: string;
|
|
8
|
+
/** Replaces the global `fetch` (tests, other runtimes). */
|
|
9
|
+
readonly fetch?: typeof fetch | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates the transport that talks to the edge.
|
|
13
|
+
*
|
|
14
|
+
* Inputs: `EdgeTransportOptions`. Output: a `DataTransport`:
|
|
15
|
+
* - `submit` posts the body as JSON and resolves to `{ ok: true }` on any 2xx, to the server's
|
|
16
|
+
* error (`readDataError`) otherwise, to `payload_too_large` without sending when the body is
|
|
17
|
+
* over `submitBodyMaxBytes`, and to `network_error` when the request fails or `signal` aborts
|
|
18
|
+
* it (TAG-317). It never rejects.
|
|
19
|
+
* - `track` posts `<kind> <versionHash> <name>` to `/e/<siteKey>` with `fetch` + `keepalive`,
|
|
20
|
+
* fire-and-forget, sampled and at most `EVENT_BEACON_CAP_PER_PAGE` per kind; it sends nothing
|
|
21
|
+
* without a version hash, and nothing when there is no `fetch`.
|
|
22
|
+
* Errors: none, ever (golden rule 2). Side effects: network requests only, without credentials.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createEdgeTransport(options: EdgeTransportOptions): DataTransport;
|
|
25
|
+
//# sourceMappingURL=edge-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-transport.d.ts","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAA8B,MAAM,qBAAqB,CAAC;AAWrF,yFAAyF;AACzF,MAAM,WAAW,oBAAoB;IACnC,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;CAC3C;AAmBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA8DhF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { DATA_API_LIMITS, EVENT_BEACON_CAP_PER_PAGE, shouldSendEvent, } from "@taggor/contract/zod-free";
|
|
2
|
+
import { readBoundedJson } from "./bounded-json.js";
|
|
3
|
+
import { readDataError } from "./submit-result.js";
|
|
4
|
+
const NETWORK_ERROR = Object.freeze({
|
|
5
|
+
ok: false,
|
|
6
|
+
code: "network_error",
|
|
7
|
+
fields: Object.freeze([]),
|
|
8
|
+
});
|
|
9
|
+
const TOO_LARGE = Object.freeze({
|
|
10
|
+
ok: false,
|
|
11
|
+
code: "payload_too_large",
|
|
12
|
+
fields: Object.freeze([]),
|
|
13
|
+
});
|
|
14
|
+
const ACCEPTED = Object.freeze({ ok: true });
|
|
15
|
+
/** UTF-8 size of a string, the unit the edge limits bodies in. */
|
|
16
|
+
function byteLength(text) {
|
|
17
|
+
return new TextEncoder().encode(text).length;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates the transport that talks to the edge.
|
|
21
|
+
*
|
|
22
|
+
* Inputs: `EdgeTransportOptions`. Output: a `DataTransport`:
|
|
23
|
+
* - `submit` posts the body as JSON and resolves to `{ ok: true }` on any 2xx, to the server's
|
|
24
|
+
* error (`readDataError`) otherwise, to `payload_too_large` without sending when the body is
|
|
25
|
+
* over `submitBodyMaxBytes`, and to `network_error` when the request fails or `signal` aborts
|
|
26
|
+
* it (TAG-317). It never rejects.
|
|
27
|
+
* - `track` posts `<kind> <versionHash> <name>` to `/e/<siteKey>` with `fetch` + `keepalive`,
|
|
28
|
+
* fire-and-forget, sampled and at most `EVENT_BEACON_CAP_PER_PAGE` per kind; it sends nothing
|
|
29
|
+
* without a version hash, and nothing when there is no `fetch`.
|
|
30
|
+
* Errors: none, ever (golden rule 2). Side effects: network requests only, without credentials.
|
|
31
|
+
*/
|
|
32
|
+
export function createEdgeTransport(options) {
|
|
33
|
+
const base = options.baseUrl.replace(/\/+$/, "");
|
|
34
|
+
const site = encodeURIComponent(options.siteKey);
|
|
35
|
+
// Resolved per call, not at creation, so a page that replaces fetch later is still honored.
|
|
36
|
+
const send = (url, init) => (options.fetch ?? fetch)(url, init);
|
|
37
|
+
const sent = { interaction: 0, custom: 0 };
|
|
38
|
+
return {
|
|
39
|
+
submit: async (collection, body, signal) => {
|
|
40
|
+
try {
|
|
41
|
+
const payload = JSON.stringify(body);
|
|
42
|
+
if (byteLength(payload) > DATA_API_LIMITS.submitBodyMaxBytes)
|
|
43
|
+
return TOO_LARGE;
|
|
44
|
+
const response = await send(`${base}/d/${site}/${encodeURIComponent(collection)}`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { "content-type": "application/json" },
|
|
47
|
+
body: payload,
|
|
48
|
+
credentials: "omit",
|
|
49
|
+
referrerPolicy: "no-referrer",
|
|
50
|
+
cache: "no-store",
|
|
51
|
+
signal: signal ?? null,
|
|
52
|
+
});
|
|
53
|
+
if (response.ok)
|
|
54
|
+
return ACCEPTED;
|
|
55
|
+
// Capped (TAG-709): a hostile body must not be buffered whole; over the cap it is network_error.
|
|
56
|
+
return readDataError(await readBoundedJson(response));
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return NETWORK_ERROR;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
track: ({ kind = "interaction", name, manifest, host }) => {
|
|
63
|
+
try {
|
|
64
|
+
// The published version hash: `window.taggor.get(element)`, set by the runtime. Without it
|
|
65
|
+
// (a page that removed the global, a component outside the runtime) nothing is sent.
|
|
66
|
+
const version = globalThis.taggor?.get?.(host?.element)?.version;
|
|
67
|
+
const declared = manifest;
|
|
68
|
+
const rate = declared.eventSampleRate;
|
|
69
|
+
if (version === undefined ||
|
|
70
|
+
// An emitted event counts only when the manifest declares it (the runtime drops the rest).
|
|
71
|
+
(kind === "interaction" && !Object.hasOwn(declared.events ?? {}, name)) ||
|
|
72
|
+
sent[kind] >= EVENT_BEACON_CAP_PER_PAGE ||
|
|
73
|
+
!shouldSendEvent(kind, typeof rate === "number" ? rate : undefined, Math.random())) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// The cap counts what is sent, per kind.
|
|
77
|
+
sent[kind] += 1;
|
|
78
|
+
send(`${base}/e/${site}`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: { "content-type": "text/plain;charset=UTF-8" },
|
|
81
|
+
body: `${kind} ${version} ${name}`,
|
|
82
|
+
keepalive: true,
|
|
83
|
+
credentials: "omit",
|
|
84
|
+
referrerPolicy: "no-referrer",
|
|
85
|
+
}).catch(() => undefined);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// No fetch at all (ReferenceError) or a throwing one (blocked by the page's CSP, say), or a
|
|
89
|
+
// hostile `window.taggor`: tracking is best-effort and must not reach the page.
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=edge-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-transport.js","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"AAqCA,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmBnD,MAAM,aAAa,GAAiB,MAAM,CAAC,MAAM,CAAC;IAChD,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,eAAe;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B,CAAC,CAAC;AACH,MAAM,SAAS,GAAiB,MAAM,CAAC,MAAM,CAAC;IAC5C,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;CAC1B,CAAC,CAAC;AACH,MAAM,QAAQ,GAAiB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;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AAI;oBACf,WAAW,EAAE,MAAM;oBACnB,cAAc,EAAE,aAAa;iBAC9B,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACP,4FAA4F;gBAC5F,gFAAgF;YAClF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed events for authors (TAG-202): the `events` map of a component and the `emit` function
|
|
3
|
+
* `render` receives, which only accepts declared event names and, for each, a `detail` of the
|
|
4
|
+
* type its declared value schema describes (`ValueOf`). The runtime dispatches the `CustomEvent`
|
|
5
|
+
* (`<tag>:<event>`, TAG-305) and validates `detail` again, so a wrong call from untyped code is
|
|
6
|
+
* dropped there, not here. TAG-206 added the host page side: `ManifestEventMap` and
|
|
7
|
+
* `ComponentEventMap` map each declared event to its DOM name (`finance-simulator:submit`) and a
|
|
8
|
+
* `CustomEvent` with the typed `detail`, so a host page in TypeScript (and the generated types of
|
|
9
|
+
* TAG-214) can type its listeners.
|
|
10
|
+
*/
|
|
11
|
+
import type { EventDeclaration } from "@taggor/contract";
|
|
12
|
+
import type { ValueOf } from "./value-types.js";
|
|
13
|
+
/** The `events` map of a component: event name (kebab-case) → declaration. */
|
|
14
|
+
export type EventsDeclaration = Readonly<Record<string, EventDeclaration>>;
|
|
15
|
+
/** The `detail` type of the event `K` of the map `E`. */
|
|
16
|
+
export type EventDetail<E, K extends keyof E> = E[K] extends {
|
|
17
|
+
readonly detail: infer S;
|
|
18
|
+
} ? ValueOf<S> : never;
|
|
19
|
+
/**
|
|
20
|
+
* Emits a declared event. `name` must be a key of the component's `events`; `detail` must match its
|
|
21
|
+
* declared schema. Inputs as typed. Output: none. Errors: none (the runtime drops and logs a
|
|
22
|
+
* payload that fails validation). Side effects: the runtime dispatches a `CustomEvent` on the host
|
|
23
|
+
* element.
|
|
24
|
+
*/
|
|
25
|
+
export type Emit<E> = <K extends keyof E & string>(name: K, detail: EventDetail<E, K>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* The DOM events of a manifest, for host pages: `<tag>:<event>` → `CustomEvent` whose `detail`
|
|
28
|
+
* has the declared type. `M` is any manifest-like type with a literal `tag` and an `events` map
|
|
29
|
+
* (a `ComponentManifest` written `as const`, or the SDK's manifest draft); a plain `string` tag
|
|
30
|
+
* gives `${string}:<event>` keys. Types only; the runtime dispatches the events (TAG-305).
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* declare global {
|
|
34
|
+
* interface HTMLElementEventMap extends ComponentEventMap<typeof financeSimulator> {}
|
|
35
|
+
* }
|
|
36
|
+
* element.addEventListener("finance-simulator:submit", (event) => event.detail.months);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export type ManifestEventMap<M> = M extends {
|
|
40
|
+
readonly tag: infer T extends string;
|
|
41
|
+
} ? M extends {
|
|
42
|
+
readonly events?: infer E;
|
|
43
|
+
} ? {
|
|
44
|
+
readonly [K in keyof NonNullable<E> & string as `${T}:${K}`]: CustomEvent<EventDetail<NonNullable<E>, K>>;
|
|
45
|
+
} : never : never;
|
|
46
|
+
/** `ManifestEventMap` of a component definition made by `defineTaggorComponent` (its `manifest`). */
|
|
47
|
+
export type ComponentEventMap<W> = W extends {
|
|
48
|
+
readonly manifest: infer M;
|
|
49
|
+
} ? ManifestEventMap<M> : never;
|
|
50
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,QAAQ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,0 +1,59 @@
|
|
|
1
|
+
/** What a form field submits and whether it is valid, given on every render. */
|
|
2
|
+
export interface FormFieldOptions {
|
|
3
|
+
/** What the form submits under the element's `name`; `null` submits nothing. */
|
|
4
|
+
readonly value: string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Why the value is invalid, in the visitor's language: the form will not submit, and the
|
|
7
|
+
* browser shows this text. Absent or empty: the field is valid.
|
|
8
|
+
*/
|
|
9
|
+
readonly error?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The component's control (an `<input>` in its shadow root): where the browser shows `error` and
|
|
12
|
+
* puts the focus when the form is checked. Absent: the element itself.
|
|
13
|
+
*/
|
|
14
|
+
readonly anchor?: {
|
|
15
|
+
readonly current: HTMLElement | null;
|
|
16
|
+
} | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** What `useFormField` tells the component. */
|
|
19
|
+
export interface FormFieldState {
|
|
20
|
+
/**
|
|
21
|
+
* Whether the field takes part in a form: `false` without `formAssociated: true` in the
|
|
22
|
+
* manifest, or in a browser without form-associated custom elements (`@taggor/component/testing`
|
|
23
|
+
* gives the field recording internals, TAG-235, so it is `true` there).
|
|
24
|
+
*/
|
|
25
|
+
readonly associated: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the element is disabled (its `disabled` attribute or a disabled `<fieldset>` around
|
|
28
|
+
* it); the form then leaves the value out. Disable the component's controls too.
|
|
29
|
+
*/
|
|
30
|
+
readonly disabled: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The name the page gave the element: the text of its `aria-labelledby` targets, its
|
|
33
|
+
* `aria-label`, or the text of its `<label>`s, in that order; `undefined` when it has none. Put
|
|
34
|
+
* it on the component's control (`aria-label={field.label}`): labels and ARIA references of the
|
|
35
|
+
* page never cross the shadow boundary.
|
|
36
|
+
*/
|
|
37
|
+
readonly label: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Submits the element's form as Enter in an `<input>` does (the form's own validation and
|
|
40
|
+
* `submit` event included; `requestSubmit`): Enter in the component's control never reaches the
|
|
41
|
+
* page's form by itself. Does nothing outside a form or without internals.
|
|
42
|
+
*/
|
|
43
|
+
readonly requestSubmit: () => void;
|
|
44
|
+
/** Browser-restored text on the render triggered by the callback; consumed after this hook's layout effect. */
|
|
45
|
+
readonly restored: string | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Takes part in the host page's form.
|
|
49
|
+
*
|
|
50
|
+
* Inputs: the field's current `value`, `error` and `anchor` (call it in `render` or a component
|
|
51
|
+
* below it, like any hook, with the values of this render). Output: a `FormFieldState`, including
|
|
52
|
+
* the latest string state sent by the browser's `formStateRestoreCallback`. Errors: throws when
|
|
53
|
+
* called outside a component mounted by the runtime, like `useHost`; never because of the values (an
|
|
54
|
+
* `anchor` outside the component's shadow root is dropped). Side effects: after each render,
|
|
55
|
+
* `setFormValue` and `setValidity` on the element's internals when it has them; in debug mode, a
|
|
56
|
+
* warning when it has none.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useFormField(options: FormFieldOptions): FormFieldState;
|
|
59
|
+
//# sourceMappingURL=form-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["../src/form-field.ts"],"names":[],"mappings":"AAsBA,gFAAgF;AAChF,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;KAAE,GAAG,SAAS,CAAC;CACxE;AAED,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;IACnC,+GAA+G;IAC/G,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAwCtE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form field components (TAG-314, TAG-325): `useFormField`, the hook a component whose manifest declares
|
|
3
|
+
* `formAssociated: true` calls to take part in the host page's `<form>`, as an `<input>` would.
|
|
4
|
+
*
|
|
5
|
+
* The runtime makes the element form-associated and hands the component its `ElementInternals`
|
|
6
|
+
* (`host.internals`); this hook sets, after every render, what the form submits under the
|
|
7
|
+
* element's `name` attribute (`setFormValue`) and whether the value is valid (`setValidity`, with
|
|
8
|
+
* the browser's message shown on the component's own control). It also answers what the shadow
|
|
9
|
+
* boundary hides: whether the element is disabled (its `disabled` attribute or a disabled
|
|
10
|
+
* `<fieldset>`), and the accessible name the page gave the element (`aria-labelledby`,
|
|
11
|
+
* `aria-label`, `<label for>` or a wrapping `<label>`), which never reaches a control inside the
|
|
12
|
+
* shadow root on its own; and it submits the form on request, which Enter in the component's own
|
|
13
|
+
* `<input>` never does (that input has no form). The runtime renders again on a disabled change
|
|
14
|
+
* and re-renders on restored state, so the answers stay current.
|
|
15
|
+
*
|
|
16
|
+
* Only components that import it pay for it (`sideEffects: false`; `bundle.test.ts`).
|
|
17
|
+
*/
|
|
18
|
+
import { useContext, useLayoutEffect } from "preact/hooks";
|
|
19
|
+
import { debugWarn } from "./debug.js";
|
|
20
|
+
import { HostContext } from "./host.js";
|
|
21
|
+
/**
|
|
22
|
+
* Takes part in the host page's form.
|
|
23
|
+
*
|
|
24
|
+
* Inputs: the field's current `value`, `error` and `anchor` (call it in `render` or a component
|
|
25
|
+
* below it, like any hook, with the values of this render). Output: a `FormFieldState`, including
|
|
26
|
+
* the latest string state sent by the browser's `formStateRestoreCallback`. Errors: throws when
|
|
27
|
+
* called outside a component mounted by the runtime, like `useHost`; never because of the values (an
|
|
28
|
+
* `anchor` outside the component's shadow root is dropped). Side effects: after each render,
|
|
29
|
+
* `setFormValue` and `setValidity` on the element's internals when it has them; in debug mode, a
|
|
30
|
+
* warning when it has none.
|
|
31
|
+
*/
|
|
32
|
+
export function useFormField(options) {
|
|
33
|
+
const host = useContext(HostContext);
|
|
34
|
+
if (host === undefined) {
|
|
35
|
+
throw new Error("useFormField must be called inside a component mounted by the Taggor runtime");
|
|
36
|
+
}
|
|
37
|
+
const { element, internals } = host;
|
|
38
|
+
const restored = internals?.s;
|
|
39
|
+
const { value, error, anchor } = options;
|
|
40
|
+
// A layout effect, not an effect: the value must be in place before the visitor can submit.
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
if (restored !== undefined && internals !== undefined)
|
|
43
|
+
delete internals.s;
|
|
44
|
+
if (internals === undefined) {
|
|
45
|
+
debugWarn(host, "useFormField: the element is not form-associated (declare formAssociated: true)");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
internals.setFormValue(value);
|
|
49
|
+
if (error === undefined || error === "") {
|
|
50
|
+
internals.setValidity({});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
internals.setValidity({ customError: true }, error, anchor?.current ?? undefined);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// The anchor is not inside the element (a ref to the page, a detached node): no anchor.
|
|
58
|
+
internals.setValidity({ customError: true }, error);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
associated: internals !== undefined,
|
|
63
|
+
disabled: matchesDisabled(element),
|
|
64
|
+
label: pageLabel(element, internals),
|
|
65
|
+
requestSubmit: () => {
|
|
66
|
+
internals?.form?.requestSubmit();
|
|
67
|
+
},
|
|
68
|
+
restored,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function matchesDisabled(element) {
|
|
72
|
+
try {
|
|
73
|
+
return element.matches(":disabled");
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// A DOM without the selector (an old browser): the attribute is the best guess.
|
|
77
|
+
return element.hasAttribute("disabled");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The accessible name the page gave `element`, in the order of the accessible name computation:
|
|
82
|
+
* `aria-labelledby` (ids in the element's own tree), `aria-label`, then its labels (only a
|
|
83
|
+
* form-associated element has them). The text of the element itself (its fallback content inside a
|
|
84
|
+
* wrapping `<label>`) is left out.
|
|
85
|
+
*/
|
|
86
|
+
function pageLabel(element, internals) {
|
|
87
|
+
const tree = element.getRootNode();
|
|
88
|
+
const referenced = (element.getAttribute("aria-labelledby") ?? "")
|
|
89
|
+
.split(/\s+/)
|
|
90
|
+
.map((id) => (id === "" ? null : tree.getElementById(id)));
|
|
91
|
+
const candidates = [
|
|
92
|
+
textOutside(referenced, element),
|
|
93
|
+
element.getAttribute("aria-label")?.trim() ?? "",
|
|
94
|
+
textOutside(internals === undefined ? [] : [...internals.labels], element),
|
|
95
|
+
];
|
|
96
|
+
return candidates.find((text) => text !== "") ?? undefined;
|
|
97
|
+
}
|
|
98
|
+
/** The text of `nodes`, joined by spaces and squeezed, skipping `element` and what is inside it. */
|
|
99
|
+
function textOutside(nodes, element) {
|
|
100
|
+
const parts = [];
|
|
101
|
+
const walk = (node) => {
|
|
102
|
+
if (node === element)
|
|
103
|
+
return;
|
|
104
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
105
|
+
parts.push(node.textContent ?? "");
|
|
106
|
+
for (const child of node.childNodes)
|
|
107
|
+
walk(child);
|
|
108
|
+
};
|
|
109
|
+
for (const node of nodes)
|
|
110
|
+
if (node !== null)
|
|
111
|
+
walk(node);
|
|
112
|
+
return parts.join(" ").replace(/\s+/g, " ").trim();
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=form-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../src/form-field.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAgDxC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,OAAyB;IACpD,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACpC,MAAM,QAAQ,GAAI,SAA6D,EAAE,CAAC,CAAC;IACnF,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACzC,4FAA4F;IAC5F,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS;YACnD,OAAQ,SAA+C,CAAC,CAAC,CAAC;QAC5D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS,CACP,IAAI,EACJ,iFAAiF,CAClF,CAAC;YACF,OAAO;QACT,CAAC;QACD,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YACxC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC1B,OAAO;Q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B,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC;QAChC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;QAChD,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;KAC3E,CAAC;IACF,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,SAAS,CAAC;AAC7D,CAAC;AAED,oGAAoG;AACpG,SAAS,WAAW,CAAC,KAA+B,EAAE,OAAoB;IACxE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,IAAU,EAAE,EAAE;QAC1B,IAAI,IAAI,KAAK,OAAO;YAAE,OAAO;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACzE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,IAAI,IAAI,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC"}
|
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DataTransport } from "./data-transport.js";
|
|
2
|
+
/**
|
|
3
|
+
* What the runtime provides to a mounted component.
|
|
4
|
+
*
|
|
5
|
+
* - `element`: the custom element on the host page (its light DOM holds the slotted content).
|
|
6
|
+
* - `shadowRoot`: the component's own open shadow root, where the component renders.
|
|
7
|
+
* - `emit(name, detail)`: dispatches the declared event `name` as a `CustomEvent` on `element`
|
|
8
|
+
* after validating `detail` against the manifest (TAG-305). Called as a plain function (no
|
|
9
|
+
* `this`); it never throws.
|
|
10
|
+
* - `transport` (TAG-203): where `useTaggorData` and `useTrack` send submissions and tracked
|
|
11
|
+
* interactions (`createEdgeTransport` on a real page, `createMemoryTransport` in tests and in
|
|
12
|
+
* `taggor dev`). Absent: submissions end in the `unavailable` error and tracking is a no-op.
|
|
13
|
+
* - `debug` (TAG-203, set by the debug mode of TAG-315): the data hooks log a `console.warn` for
|
|
14
|
+
* calls they ignore (an undeclared interaction or prop). Absent or false: they stay silent.
|
|
15
|
+
* - `signal` (TAG-317): aborted when the runtime really unmounts the component (removed from the
|
|
16
|
+
* page, not moved); `useTaggorData` passes it to `transport.submit`, so a submission still in
|
|
17
|
+
* flight is cancelled. A new signal per mount. Absent: nothing is cancelled.
|
|
18
|
+
* - `internals` (TAG-314): the element's `ElementInternals`, given only to a component whose manifest
|
|
19
|
+
* declares `formAssociated: true`; `useFormField` sets the form value and validity through it.
|
|
20
|
+
* Absent: no form participation (not declared, a browser without form-associated custom
|
|
21
|
+
* elements, or `@taggor/component/testing` in happy-dom).
|
|
22
|
+
*/
|
|
23
|
+
export interface ComponentHost {
|
|
24
|
+
readonly element: HTMLElement;
|
|
25
|
+
readonly shadowRoot: ShadowRoot;
|
|
26
|
+
readonly emit: (name: string, detail: unknown) => void;
|
|
27
|
+
readonly transport?: DataTransport | undefined;
|
|
28
|
+
readonly debug?: boolean | undefined;
|
|
29
|
+
readonly signal?: AbortSignal | undefined;
|
|
30
|
+
readonly internals?: ElementInternals | undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The part of the host an author reaches through `useHost` (emitting goes through typed `emit`). */
|
|
33
|
+
export type HostAccess = Pick<ComponentHost, "element" | "shadowRoot">;
|
|
34
|
+
/** Holds the current component's host; `undefined` outside a component mounted by the runtime. */
|
|
35
|
+
export declare const HostContext: import("preact").Context<ComponentHost | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Gives the component access to its custom element and shadow root.
|
|
38
|
+
*
|
|
39
|
+
* Inputs: none (call it inside `render` or a component below it, like any hook). Output:
|
|
40
|
+
* `{ element, shadowRoot }`. Errors: throws when called outside a component mounted by the runtime
|
|
41
|
+
* (or by `@taggor/component/testing`); the runtime's error boundary turns that into the fallback.
|
|
42
|
+
* Side effects: none.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useHost(): HostAccess;
|
|
45
|
+
//# sourceMappingURL=host.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACnD;AAED,qGAAqG;AACrG,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;AAEvE,kGAAkG;AAClG,eAAO,MAAM,WAAW,qDAAsE,CAAC;AAE/F;;;;;;;GAOG;AACH,wBAAgB,OAAO,IAAI,UAAU,CAMpC"}
|
package/dist/host.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host of a mounted component (TAG-202): what the runtime (TAG-302) gives the component of a
|
|
3
|
+
* `ComponentDefinition` when it mounts it, and `useHost`, the hook that exposes the element and its
|
|
4
|
+
* shadow root to the author. TAG-203 added the optional data transport and debug flag the data
|
|
5
|
+
* hooks read; TAG-314 the optional `internals` of a form field component.
|
|
6
|
+
*
|
|
7
|
+
* The context lives in the component's own copy of the SDK: the runtime never imports it (it passes
|
|
8
|
+
* the host as a component prop and `defineTaggorComponent`'s component provides it), so two copies of the
|
|
9
|
+
* SDK on one page can never read each other's context.
|
|
10
|
+
*/
|
|
11
|
+
import { createContext } from "preact";
|
|
12
|
+
import { useContext } from "preact/hooks";
|
|
13
|
+
/** Holds the current component's host; `undefined` outside a component mounted by the runtime. */
|
|
14
|
+
export const HostContext = /* @__PURE__ */ createContext(undefined);
|
|
15
|
+
/**
|
|
16
|
+
* Gives the component access to its custom element and shadow root.
|
|
17
|
+
*
|
|
18
|
+
* Inputs: none (call it inside `render` or a component below it, like any hook). Output:
|
|
19
|
+
* `{ element, shadowRoot }`. Errors: throws when called outside a component mounted by the runtime
|
|
20
|
+
* (or by `@taggor/component/testing`); the runtime's error boundary turns that into the fallback.
|
|
21
|
+
* Side effects: none.
|
|
22
|
+
*/
|
|
23
|
+
export function useHost() {
|
|
24
|
+
const host = useContext(HostContext);
|
|
25
|
+
if (host === undefined) {
|
|
26
|
+
throw new Error("useHost must be called inside a component mounted by the Taggor runtime");
|
|
27
|
+
}
|
|
28
|
+
return { element: host.element, shadowRoot: host.shadowRoot };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsC1C,kGAAkG;AAClG,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,aAAa,CAA4B,SAAS,CAAC,CAAC;AAE/F;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO;IACrB,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;AAChE,CAAC"}
|