@taggor/component 0.4.0 → 0.5.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/assets.d.ts +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/assets.d.ts +2 -2
- package/dist/assets.js +2 -2
- package/dist/bounded-json.d.ts +3 -3
- package/dist/bounded-json.js +3 -3
- package/dist/build/check-messages.js +3 -3
- package/dist/build/check-messages.js.map +1 -1
- package/dist/build/extract-manifest.d.ts +5 -5
- package/dist/build/extract-manifest.d.ts.map +1 -1
- package/dist/build/extract-manifest.js +4 -4
- package/dist/build/extract-styles.js +2 -2
- package/dist/build/find-definition.d.ts +2 -2
- package/dist/build/find-definition.js +2 -2
- package/dist/build/index.d.ts +3 -3
- package/dist/build/index.js +3 -3
- package/dist/consent.d.ts +8 -9
- package/dist/consent.d.ts.map +1 -1
- package/dist/consent.js +6 -7
- package/dist/consent.js.map +1 -1
- package/dist/data-client.d.ts +2 -2
- package/dist/data-client.d.ts.map +1 -1
- package/dist/data-declaration.d.ts +1 -1
- package/dist/data-errors.d.ts +2 -2
- package/dist/data-errors.js +3 -3
- package/dist/data-errors.js.map +1 -1
- package/dist/data-transport.d.ts +5 -5
- package/dist/data-transport.d.ts.map +1 -1
- package/dist/debug.d.ts +2 -2
- package/dist/define-component.d.ts +19 -20
- package/dist/define-component.d.ts.map +1 -1
- package/dist/define-component.js +10 -10
- package/dist/define-component.js.map +1 -1
- package/dist/define-library.d.ts +1 -1
- package/dist/define-library.d.ts.map +1 -1
- package/dist/edge-transport.d.ts +1 -1
- package/dist/edge-transport.d.ts.map +1 -1
- package/dist/edge-transport.js +2 -2
- package/dist/edge-transport.js.map +1 -1
- package/dist/events.d.ts +6 -7
- package/dist/events.d.ts.map +1 -1
- package/dist/form-field.d.ts +1 -1
- package/dist/form-field.js +1 -1
- package/dist/host.d.ts +5 -5
- package/dist/host.js +3 -3
- package/dist/index.d.ts +13 -13
- package/dist/index.js +13 -13
- package/dist/intl-format.d.ts +3 -3
- package/dist/intl-format.js +3 -3
- package/dist/issued-proofs.d.ts +3 -3
- package/dist/issued-proofs.js +3 -3
- package/dist/locale.js +1 -1
- package/dist/memory-transport.d.ts +3 -3
- package/dist/messages.js +1 -1
- package/dist/none.d.ts +1 -1
- package/dist/none.js +1 -1
- package/dist/props.d.ts +6 -6
- package/dist/slots.js +2 -2
- package/dist/submit-result.js +1 -1
- package/dist/testing/form-internals.d.ts +2 -2
- package/dist/testing/form-internals.js +2 -2
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +3 -3
- package/dist/testing/mount-component.d.ts +7 -7
- package/dist/testing/mount-component.d.ts.map +1 -1
- package/dist/testing/mount-component.js +17 -17
- package/dist/testing/mount-component.js.map +1 -1
- package/dist/testing/visitor.d.ts +1 -1
- package/dist/testing/visitor.js +1 -1
- package/dist/theming.d.ts +1 -1
- package/dist/turnstile.d.ts +8 -8
- package/dist/turnstile.js +8 -8
- package/dist/turnstile.js.map +1 -1
- package/dist/use-font.d.ts +1 -1
- package/dist/use-font.d.ts.map +1 -1
- package/dist/use-font.js +4 -5
- package/dist/use-font.js.map +1 -1
- package/dist/use-locale.js +1 -1
- package/dist/use-taggor-data.d.ts +6 -6
- package/dist/use-taggor-data.js +11 -11
- package/dist/use-taggor-data.js.map +1 -1
- package/dist/use-track.d.ts +1 -1
- package/dist/use-track.js +1 -1
- package/dist/value-types.d.ts +5 -5
- package/dist/value-types.js +3 -3
- package/dist/visitor-action.d.ts +5 -5
- package/dist/visitor-action.d.ts.map +1 -1
- package/dist/visitor-action.js +6 -7
- package/dist/visitor-action.js.map +1 -1
- package/package.json +3 -3
package/dist/consent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The visitor's consent
|
|
2
|
+
* The visitor's consent: `useConsent` keeps whether the visitor ticked the consent box
|
|
3
3
|
* of a component that collects personal data (`data.personal` in the manifest) and builds the proof
|
|
4
4
|
* that goes with each submission; `<Consent>` is the accessible checkbox that shows the default
|
|
5
5
|
* text, "Li e aceito a política de privacidade de <site>." or "I have read and accept the privacy
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* stored: no cookie, no storage, no identifier (golden rule 6). Unused, the module stays out of a
|
|
13
13
|
* component's bundle (`sideEffects: false`, `bundle.test.ts`).
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* "only the visitor ticks it" is enforced at run time too. `setGiven(true)` is recorded
|
|
16
16
|
* only synchronously inside a trusted visitor action in the component's shadow root (a click, a key,
|
|
17
17
|
* or the `change`, `input` or `submit` one of them fires; `visitor-action.ts`); anywhere else (an
|
|
18
18
|
* effect, a timer, `el.click()`, `dispatchEvent`) it is refused, with a warning in debug mode.
|
|
@@ -48,10 +48,10 @@ export interface ConsentState {
|
|
|
48
48
|
/**
|
|
49
49
|
* Records the visitor's choice (`<Consent>` calls it; a custom checkbox may too, from its
|
|
50
50
|
* `onChange` or `onClick`). `true` is recorded only when called synchronously inside a trusted
|
|
51
|
-
* visitor action in the component
|
|
51
|
+
* visitor action in the component; anywhere else it changes nothing (debug mode warns).
|
|
52
52
|
*/
|
|
53
53
|
readonly setGiven: (given: boolean) => void;
|
|
54
|
-
/** The language the label is shown in (pt-BR or en: the `locale` attribute, then `lang
|
|
54
|
+
/** The language the label is shown in (pt-BR or en: the `locale` attribute, then `lang`). */
|
|
55
55
|
readonly locale: MessageLocale;
|
|
56
56
|
/** The label to show, in three pieces (the middle one is the link to the policy). */
|
|
57
57
|
readonly label: ConsentLabel;
|
|
@@ -62,7 +62,7 @@ export interface ConsentState {
|
|
|
62
62
|
* hashed and the site has a policy URL (consent to a policy nobody can read is not informed),
|
|
63
63
|
* undefined otherwise (a submission to a personal component then fails with
|
|
64
64
|
* `consent_required` without sending anything). Frozen; only this very object counts: a copy or a
|
|
65
|
-
* proof written by hand is refused by `submit
|
|
65
|
+
* proof written by hand is refused by `submit`.
|
|
66
66
|
*/
|
|
67
67
|
readonly proof: ConsentProof | undefined;
|
|
68
68
|
}
|
|
@@ -72,9 +72,8 @@ export interface ConsentState {
|
|
|
72
72
|
* Inputs: the render context (`render`'s second argument) and the component's props (`render`'s first
|
|
73
73
|
* argument), from which the value of the prop named by `data.privacyPolicyUrl` is read. Output: a
|
|
74
74
|
* `ConsentState`. Errors: none; without a policy URL the label has no link and there is never
|
|
75
|
-
* a proof
|
|
76
|
-
* logged in debug mode only); `setGiven(true)` outside a visitor's action is refused (
|
|
77
|
-
* logged in debug mode). Side effects: hashes the label once per label and URL, after render;
|
|
75
|
+
* a proof, and without `crypto.subtle` there is never a proof (both
|
|
76
|
+
* logged in debug mode only); `setGiven(true)` outside a visitor's action is refused (logged in debug mode). Side effects: hashes the label once per label and URL, after render;
|
|
78
77
|
* at the first render, starts recording the visitor's actions in the host's shadow root until the
|
|
79
78
|
* host's signal aborts (`watchVisitorActions`); records each proof it builds as issued
|
|
80
79
|
* (`issued-proofs.ts`, in memory); writes nothing anywhere.
|
|
@@ -90,7 +89,7 @@ export interface ConsentProps {
|
|
|
90
89
|
* Tab, toggled with Space and named by its text; the policy link opens in a new tab.
|
|
91
90
|
*
|
|
92
91
|
* Inputs: `{ consent }`. Output: the `<label>` element. Errors: none. Side effects: ticking or
|
|
93
|
-
* unticking calls `consent.setGiven`. A tick it refuses (a script's `el.click()
|
|
92
|
+
* unticking calls `consent.setGiven`. A tick it refuses (a script's `el.click()`) leaves
|
|
94
93
|
* the native box ticked until the next render puts back the recorded state; there is no proof
|
|
95
94
|
* meanwhile, so nothing personal is sent (`consent_required`). Undoing it on the spot would cost
|
|
96
95
|
* bytes in every consent component and protect nothing: only the component's own code clicks that way,
|
package/dist/consent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,Q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AC,CAAC;AAWlF;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAG9E;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY7B;AAED,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,gGAAgG;IAChG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;CAC1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CA6CjF;AAED,4BAA4B;AAC5B,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,KAAK,CAmBxD"}
|
package/dist/consent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The visitor's consent
|
|
2
|
+
* The visitor's consent: `useConsent` keeps whether the visitor ticked the consent box
|
|
3
3
|
* of a component that collects personal data (`data.personal` in the manifest) and builds the proof
|
|
4
4
|
* that goes with each submission; `<Consent>` is the accessible checkbox that shows the default
|
|
5
5
|
* text, "Li e aceito a política de privacidade de <site>." or "I have read and accept the privacy
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* stored: no cookie, no storage, no identifier (golden rule 6). Unused, the module stays out of a
|
|
13
13
|
* component's bundle (`sideEffects: false`, `bundle.test.ts`).
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* "only the visitor ticks it" is enforced at run time too. `setGiven(true)` is recorded
|
|
16
16
|
* only synchronously inside a trusted visitor action in the component's shadow root (a click, a key,
|
|
17
17
|
* or the `change`, `input` or `submit` one of them fires; `visitor-action.ts`); anywhere else (an
|
|
18
18
|
* effect, a timer, `el.click()`, `dispatchEvent`) it is refused, with a warning in debug mode.
|
|
@@ -66,9 +66,8 @@ export async function consentTextHash(text, policyUrl) {
|
|
|
66
66
|
* Inputs: the render context (`render`'s second argument) and the component's props (`render`'s first
|
|
67
67
|
* argument), from which the value of the prop named by `data.privacyPolicyUrl` is read. Output: a
|
|
68
68
|
* `ConsentState`. Errors: none; without a policy URL the label has no link and there is never
|
|
69
|
-
* a proof
|
|
70
|
-
* logged in debug mode only); `setGiven(true)` outside a visitor's action is refused (
|
|
71
|
-
* logged in debug mode). Side effects: hashes the label once per label and URL, after render;
|
|
69
|
+
* a proof, and without `crypto.subtle` there is never a proof (both
|
|
70
|
+
* logged in debug mode only); `setGiven(true)` outside a visitor's action is refused (logged in debug mode). Side effects: hashes the label once per label and URL, after render;
|
|
72
71
|
* at the first render, starts recording the visitor's actions in the host's shadow root until the
|
|
73
72
|
* host's signal aborts (`watchVisitorActions`); records each proof it builds as issued
|
|
74
73
|
* (`issued-proofs.ts`, in memory); writes nothing anywhere.
|
|
@@ -106,7 +105,7 @@ export function useConsent(context, props) {
|
|
|
106
105
|
}, [key]);
|
|
107
106
|
// The hash must be of the label shown now: a language or URL change waits for its own hash.
|
|
108
107
|
// No policy URL, no proof: the visitor could not read what they would be accepting.
|
|
109
|
-
// Frozen and recorded as issued: `submit` sends only a proof built here
|
|
108
|
+
// Frozen and recorded as issued: `submit` sends only a proof built here.
|
|
110
109
|
const proof = given && policyUrl !== undefined && hashed?.key === key
|
|
111
110
|
? Object.freeze({ given: true, text_hash: hashed.hash, locale })
|
|
112
111
|
: undefined;
|
|
@@ -125,7 +124,7 @@ export function useConsent(context, props) {
|
|
|
125
124
|
* Tab, toggled with Space and named by its text; the policy link opens in a new tab.
|
|
126
125
|
*
|
|
127
126
|
* Inputs: `{ consent }`. Output: the `<label>` element. Errors: none. Side effects: ticking or
|
|
128
|
-
* unticking calls `consent.setGiven`. A tick it refuses (a script's `el.click()
|
|
127
|
+
* unticking calls `consent.setGiven`. A tick it refuses (a script's `el.click()`) leaves
|
|
129
128
|
* the native box ticked until the next render puts back the recorded state; there is no proof
|
|
130
129
|
* meanwhile, so nothing personal is sent (`consent_required`). Undoing it on the spot would cost
|
|
131
130
|
* bytes in every consent component and protect nothing: only the component's own code clicks that way,
|
package/dist/consent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consent.js","sourceRoot":"","sources":["../src/consent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,CAAC,EAAc,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,aAAa,EAAsB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK1D,2EAA2E;AAC3E,MAAM,MAAM,GAAkD;IAC5D,OAAO,EAAE,CAAC,gBAAgB,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C,SAAS,CAAC,IAAI,EAAE,yCAAyC,CAAC,CAAC;IAClE,CAAC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC9D,CAAC;AAQD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,OAAO,EAAgB;IAC/C,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;IAC5C,OAAO,CAAC,CACN,OAAO,EACP,IAAI,EACJ,CAAC,CAAC,OAAO,EAAE;QACT,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,OAAO,CAAC,KAAK;QACtB,QAAQ,EAAE,CAAC,KAAY,EAAE,EAAE;YACzB,OAAO,CAAC,QAAQ,CAAE,KAAK,CAAC,aAAkC,CAAC,OAAO,CAAC,CAAC;QACtE,CAAC;KACF,CAAC,EACF,MAAM,EACN,OAAO,CAAC,SAAS,KAAK,SAAS;QAC7B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,IAAI,CAAC,EAC3F,KAAK,CACN,CAAC;AACJ,CAAC"}
|
package/dist/data-client.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export interface DataClientOptions {
|
|
|
8
8
|
readonly siteKey: string;
|
|
9
9
|
/** The site's Turnstile public key; without one no token is attached (the edge decides). */
|
|
10
10
|
readonly turnstileSiteKey?: string | undefined;
|
|
11
|
-
/** The page's CSP nonce for the Turnstile script (
|
|
11
|
+
/** The page's CSP nonce for the Turnstile script (see `createTurnstile`). */
|
|
12
12
|
readonly nonce?: string | undefined;
|
|
13
|
-
/** The loader's Trusted Types script URL maker (
|
|
13
|
+
/** The loader's Trusted Types script URL maker (see `createTurnstile`). */
|
|
14
14
|
readonly scriptUrl?: ((url: string, origin: string) => unknown) | undefined;
|
|
15
15
|
/** Replaces the global `fetch` (tests). */
|
|
16
16
|
readonly fetch?: typeof fetch | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../src/data-client.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAWjE,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,
|
|
1
|
+
{"version":3,"file":"data-client.d.ts","sourceRoot":"","sources":["../src/data-client.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAWjE,wCAAwC;AACxC,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5E,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,GAAG,SAAS,CAAC;IAC1C,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC;CACpF;AAeD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CA6C7E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type-level reading of a component's `data` declaration
|
|
2
|
+
* Type-level reading of a component's `data` declaration: which collections it can submit
|
|
3
3
|
* to and with which values, and which interactions it can track and with which props. The data
|
|
4
4
|
* hooks (`useTaggorData`, `useTrack`) are typed with these, so submitting to an undeclared
|
|
5
5
|
* collection, tracking an undeclared interaction or passing an undeclared prop is a compile error.
|
package/dist/data-errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Friendly messages for data API errors
|
|
2
|
+
* Friendly messages for data API errors, in pt-BR and en: the data API answers with a
|
|
3
3
|
* `code` (`packages/contract/SPEC.md` §5, "Erros") and the SDK, not the server, turns it into the
|
|
4
4
|
* text a visitor reads. The tables are typed against the contract's `DataErrorCode`, so a code
|
|
5
5
|
* added there fails the typecheck here until it has a message in both languages.
|
|
@@ -16,7 +16,7 @@ export type MessageLocale = "pt-BR" | "en";
|
|
|
16
16
|
export declare function isSubmitErrorCode(code: unknown): code is SubmitErrorCode;
|
|
17
17
|
/**
|
|
18
18
|
* Picks the message language for a component from the same candidates `useLocale` reads, in the
|
|
19
|
-
* contract's order (`localeCandidates
|
|
19
|
+
* contract's order (`localeCandidates`): the element's `locale` attribute, the nearest
|
|
20
20
|
* `lang`, `<html lang>`, the browser language. The first one in Portuguese gives pt-BR, the first
|
|
21
21
|
* one in English gives en, and one in neither (`fr`) is skipped; none: en.
|
|
22
22
|
*
|
package/dist/data-errors.js
CHANGED
|
@@ -11,7 +11,7 @@ const MESSAGES = {
|
|
|
11
11
|
captcha_failed: "Não conseguimos confirmar que você não é um robô. Tente de novo.",
|
|
12
12
|
payload_too_large: "O conteúdo enviado é grande demais.",
|
|
13
13
|
consent_required: "Aceite a política de privacidade.",
|
|
14
|
-
// Same words as `unavailable` on purpose
|
|
14
|
+
// Same words as `unavailable` on purpose: the visitor cannot act on a cap, and a new
|
|
15
15
|
// sentence would push the data module over its size ceiling.
|
|
16
16
|
daily_cap_reached: "O envio não está disponível agora.",
|
|
17
17
|
consent_unverifiable: "Este formulário não está disponível agora.",
|
|
@@ -47,7 +47,7 @@ export function isSubmitErrorCode(code) {
|
|
|
47
47
|
const SUPPORTED = /^(pt|en)([-_]|$)/i;
|
|
48
48
|
/**
|
|
49
49
|
* Picks the message language for a component from the same candidates `useLocale` reads, in the
|
|
50
|
-
* contract's order (`localeCandidates
|
|
50
|
+
* contract's order (`localeCandidates`): the element's `locale` attribute, the nearest
|
|
51
51
|
* `lang`, `<html lang>`, the browser language. The first one in Portuguese gives pt-BR, the first
|
|
52
52
|
* one in English gives en, and one in neither (`fr`) is skipped; none: en.
|
|
53
53
|
*
|
|
@@ -56,7 +56,7 @@ const SUPPORTED = /^(pt|en)([-_]|$)/i;
|
|
|
56
56
|
*/
|
|
57
57
|
export function messageLocale(element) {
|
|
58
58
|
// A regex for the two fixed tags instead of `resolveLocale`: same answer, and `matchLocale`
|
|
59
|
-
// would add ~50 B gz more to every component that submits (
|
|
59
|
+
// would add ~50 B gz more to every component that submits (measured).
|
|
60
60
|
const tag = (element
|
|
61
61
|
? localeCandidates(element)
|
|
62
62
|
: [typeof navigator === "undefined" ? "" : navigator.language]).find((candidate) => SUPPORTED.test(candidate));
|
package/dist/data-errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-errors.js","sourceRoot":"","sources":["../src/data-errors.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK/C,gDAAgD;AAChD,MAAM,QAAQ,GAA+E;IAC3F,OAAO,EAAE;QACP,iBAAiB,EAAE,+BAA+B;QAClD,oBAAoB,EAAE,sCAAsC;QAC5D,gBAAgB,EAAE,kCAAkC;QACpD,kBAAkB,EAAE,gCAAgC;QACpD,kBAAkB,EAAE,+CAA+C;QACnE,YAAY,EAAE,sDAAsD;QACpE,cAAc,EAAE,kEAAkE;QAClF,iBAAiB,EAAE,qCAAqC;QACxD,gBAAgB,EAAE,mCAAmC;QACrD
|
|
1
|
+
{"version":3,"file":"data-errors.js","sourceRoot":"","sources":["../src/data-errors.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK/C,gDAAgD;AAChD,MAAM,QAAQ,GAA+E;IAC3F,OAAO,EAAE;QACP,iBAAiB,EAAE,+BAA+B;QAClD,oBAAoB,EAAE,sCAAsC;QAC5D,gBAAgB,EAAE,kCAAkC;QACpD,kBAAkB,EAAE,gCAAgC;QACpD,kBAAkB,EAAE,+CAA+C;QACnE,YAAY,EAAE,sDAAsD;QACpE,cAAc,EAAE,kEAAkE;QAClF,iBAAiB,EAAE,qCAAqC;QACxD,gBAAgB,EAAE,mCAAmC;QACrD,qFAAqF;QACrF,6DAA6D;QAC7D,iBAAiB,EAAE,oCAAoC;QACvD,oBAAoB,EAAE,4CAA4C;QAClE,aAAa,EAAE,iEAAiE;QAChF,WAAW,EAAE,oCAAoC;KAClD;IACD,EAAE,EAAE;QACF,iBAAiB,EAAE,sCAAsC;QACzD,oBAAoB,EAAE,6BAA6B;QACnD,gBAAgB,EAAE,2BAA2B;QAC7C,kBAAkB,EA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
1
|
/**
|
|
2
|
-
* The data transport
|
|
2
|
+
* The data transport: the port through which the data hooks reach the data API of the
|
|
3
3
|
* contract (`packages/contract/SPEC.md` §5). The runtime injects one per component in
|
|
4
4
|
* `ComponentHost.transport`: `createEdgeTransport` on a visitor's page, `createMemoryTransport` in
|
|
5
5
|
* tests and in `taggor dev`. The hooks never build URLs or call `fetch` themselves, so they stay
|
|
@@ -12,7 +12,7 @@ import type { DataErrorCode, SubmitRequest, TrackRequest } from "@taggor/contrac
|
|
|
12
12
|
* Why a submission failed: a code of the data API (`validation_failed`, `rate_limited`…) or one
|
|
13
13
|
* the SDK adds — `network_error` (no answer, or an answer that is not the data API's),
|
|
14
14
|
* `unavailable` (the component has no transport, e.g. rendered outside the runtime) and
|
|
15
|
-
* `consent_unverifiable` (
|
|
15
|
+
* `consent_unverifiable` (the server answered `consent_required` for a reason in the site's
|
|
16
16
|
* setup, a `consent.*` field such as the missing privacy policy URL, which the visitor cannot fix).
|
|
17
17
|
*/
|
|
18
18
|
export type SubmitErrorCode = DataErrorCode | "network_error" | "unavailable" | "consent_unverifiable";
|
|
@@ -31,7 +31,7 @@ export type SubmitResult = {
|
|
|
31
31
|
readonly code: SubmitErrorCode;
|
|
32
32
|
readonly fields: readonly FieldProblem[];
|
|
33
33
|
};
|
|
34
|
-
/** What kind of browser event a `track` call reports
|
|
34
|
+
/** What kind of browser event a `track` call reports; `custom` when absent. */
|
|
35
35
|
export type TrackedEventKind = "interaction" | "custom";
|
|
36
36
|
/**
|
|
37
37
|
* What the SDK hands to `DataTransport.track`: the contract's `TrackRequest` (its `component` is
|
|
@@ -56,9 +56,9 @@ export interface TrackedEvent extends Omit<TrackRequest, "component"> {
|
|
|
56
56
|
*
|
|
57
57
|
* - `submit(collection, body, signal?)`: sends one submission (`POST /d/<siteKey>/<collection>`
|
|
58
58
|
* on the edge). Output: a promise of `SubmitResult` that never rejects; every failure is a
|
|
59
|
-
* result. `signal` (
|
|
59
|
+
* result. `signal` (the mount's `ComponentHost.signal`) cancels the request when the
|
|
60
60
|
* component is unmounted; a cancelled submission resolves like a failed request (`network_error`).
|
|
61
|
-
* - `track(body)`: reports one event (an emitted declared event or a `track` call
|
|
61
|
+
* - `track(body)`: reports one event (an emitted declared event or a `track` call) to
|
|
62
62
|
* `POST /e/<siteKey>`, fire-and-forget, at most `EVENT_BEACON_CAP_PER_PAGE` per kind. Output:
|
|
63
63
|
* none. Errors: never throws. Side effects: a `keepalive` request to the edge, without
|
|
64
64
|
* credentials or referrer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-transport.d.ts","sourceRoot":"","sources":["../src/data-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACzB,aAAa,GAAG,eAAe,GAAG,aAAa,GAAG,sBAAsB,CAAC;AAE3E,mFAAmF;AACnF,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qFAAqF;AACrF,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,GACrB;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C,CAAC;AAEN
|
|
1
|
+
{"version":3,"file":"data-transport.d.ts","sourceRoot":"","sources":["../src/data-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEnF;;;;;;G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C"}
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Debug warnings of the data hooks
|
|
2
|
+
* Debug warnings of the data hooks: a call the SDK ignores (an undeclared interaction,
|
|
3
3
|
* prop or collection) is silent on a visitor's page and logged only when the runtime's debug mode
|
|
4
|
-
*
|
|
4
|
+
* marks the host with `debug: true`.
|
|
5
5
|
*/
|
|
6
6
|
import type { ComponentHost } from "./host.js";
|
|
7
7
|
/**
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defineTaggorComponent
|
|
2
|
+
* `defineTaggorComponent`: turns an author's declaration into a `ComponentDefinition`, the inert
|
|
3
3
|
* object the builder reads the manifest from (`extractManifest`, `@taggor/component/build`) and the
|
|
4
|
-
* runtime mounts (`createComponentElement
|
|
4
|
+
* runtime mounts (`createComponentElement`).
|
|
5
5
|
*
|
|
6
6
|
* Nothing happens at import or at definition time (golden rule 2): no `customElements.define`, no
|
|
7
7
|
* global, no DOM access, no validation that could throw on a visitor's page. Registering the tag is
|
|
8
8
|
* the runtime's job; validating the manifest is the builder's (`extractManifest`).
|
|
9
|
-
*
|
|
10
|
-
* manifest, which the data hooks read and are typed by.
|
|
9
|
+
* The `data` declaration is typed (`D`), and `render`'s context carries the frozen
|
|
10
|
+
* manifest, which the data hooks read and are typed by. `parts`, `cssVars` and `tag` are
|
|
11
11
|
* typed too (`R`, `C`, `T`): `styles` may be a function of the component's `Theme` (`cssVar`, `part`),
|
|
12
12
|
* `render`'s context carries the same helpers, and the literal tag types the DOM event names
|
|
13
|
-
* (`ComponentEventMap`).
|
|
13
|
+
* (`ComponentEventMap`). `locales` (`{ default, messages }`, typed `M`) declares the message
|
|
14
14
|
* catalogs; it stays in the frozen manifest at no cost to `defineTaggorComponent`, `useLocale` reads it
|
|
15
15
|
* from `render`'s context, and the builder's `extractManifest` turns it into the contract's
|
|
16
|
-
* `{ supported, default }`.
|
|
16
|
+
* `{ supported, default }`. `ComponentPropsOf` and `ComponentEventsOf` read the manifest's
|
|
17
17
|
* `props` and `events`, so a component with `locales` keeps its typed props and events.
|
|
18
18
|
*/
|
|
19
19
|
import { type ComponentChildren, type FunctionComponent } from "preact";
|
|
@@ -32,15 +32,15 @@ export declare const COMPONENT_KIND = "taggor.component";
|
|
|
32
32
|
export type SlotsDeclaration = NonNullable<ComponentManifest["slots"]>;
|
|
33
33
|
/**
|
|
34
34
|
* What `render` receives besides the props: the typed `emit`, the manifest and the theming
|
|
35
|
-
* helpers (`cssVar`, `part
|
|
35
|
+
* helpers (`cssVar`, `part`) of the component's `cssVars` and `parts`.
|
|
36
36
|
*/
|
|
37
37
|
export interface RenderContext<E, D = DataDeclaration, R = PartsDeclaration, C = CssVarsDeclaration, M = MessagesDeclaration> extends Theme<R, C> {
|
|
38
38
|
/** Emits a declared event; undeclared names and wrong payloads are compile errors. */
|
|
39
39
|
readonly emit: Emit<E>;
|
|
40
40
|
/**
|
|
41
41
|
* The component's own declaration (frozen). Pass the whole context to `useTaggorData` and
|
|
42
|
-
* `useTrack
|
|
43
|
-
* undeclared collection or interaction a compile error. `useLocale`
|
|
42
|
+
* `useTrack`: they read `tag` and `data` from it, and its type `D` is what makes an
|
|
43
|
+
* undeclared collection or interaction a compile error. `useLocale` reads `locales`
|
|
44
44
|
* from it the same way.
|
|
45
45
|
*/
|
|
46
46
|
readonly manifest: ComponentManifestDraft<unknown, E, unknown, D, R, C, string, M>;
|
|
@@ -51,7 +51,7 @@ export interface ComponentManifestDraft<P, E, S, D = DataDeclaration, R = PartsD
|
|
|
51
51
|
readonly tag: T;
|
|
52
52
|
readonly title: string;
|
|
53
53
|
readonly description: string;
|
|
54
|
-
/** Workspace-scoped package ranges
|
|
54
|
+
/** Workspace-scoped package ranges; the builder checks ownership and resolves them. */
|
|
55
55
|
readonly libraries?: ComponentManifest["libraries"];
|
|
56
56
|
readonly props?: P;
|
|
57
57
|
readonly events?: E;
|
|
@@ -62,23 +62,22 @@ export interface ComponentManifestDraft<P, E, S, D = DataDeclaration, R = PartsD
|
|
|
62
62
|
readonly size?: ComponentManifest["size"];
|
|
63
63
|
readonly permissions?: ComponentManifest["permissions"];
|
|
64
64
|
/**
|
|
65
|
-
* The message catalogs by language tag and the default language
|
|
65
|
+
* The message catalogs by language tag and the default language; `useLocale` picks
|
|
66
66
|
* one. Not the contract's shape: `extractManifest` writes `{ supported, default }` from it.
|
|
67
67
|
*/
|
|
68
68
|
readonly locales?: LocalesDraft<M>;
|
|
69
69
|
/**
|
|
70
|
-
* A form field component (
|
|
70
|
+
* A form field component (contract 1.4): the element takes part in the page's `<form>`
|
|
71
71
|
* (`useFormField` sets what it submits under the element's `name`, and its validity).
|
|
72
72
|
*/
|
|
73
73
|
readonly formAssociated?: boolean;
|
|
74
74
|
/**
|
|
75
75
|
* Whether focusing the element (or clicking one of its labels) focuses the component's first
|
|
76
|
-
* focusable element
|
|
76
|
+
* focusable element; defaults to `formAssociated`.
|
|
77
77
|
*/
|
|
78
78
|
readonly delegatesFocus?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
* The share of `interaction` and `custom` events the browser sends, from 0.001 to 1 (
|
|
81
|
-
* contract 1.10); omitted means all. `render` and `error` are never sampled. The
|
|
80
|
+
* The share of `interaction` and `custom` events the browser sends, from 0.001 to 1 (contract 1.10); omitted means all. `render` and `error` are never sampled. The
|
|
82
81
|
* edge weights each stored event by `1 / eventSampleRate`, so totals stay estimates of the real
|
|
83
82
|
* count. A data declaration only: nothing here runs in the browser (the runtime reads it).
|
|
84
83
|
*/
|
|
@@ -119,7 +118,7 @@ export interface ComponentDefinition<P = PropsDeclaration, E = EventsDeclaration
|
|
|
119
118
|
*
|
|
120
119
|
* Read from the manifest's own `props` field, not by matching `D` against `ComponentDefinition` with
|
|
121
120
|
* `unknown` or default parameters: `LocalesDraft<M>` is invariant in `M` (`default` is `keyof M`),
|
|
122
|
-
* so a component with `locales` would not match and this would be `never
|
|
121
|
+
* so a component with `locales` would not match and this would be `never`.
|
|
123
122
|
*/
|
|
124
123
|
export type ComponentPropsOf<D> = D extends {
|
|
125
124
|
readonly manifest: {
|
|
@@ -129,7 +128,7 @@ export type ComponentPropsOf<D> = D extends {
|
|
|
129
128
|
/**
|
|
130
129
|
* The `events` declaration of the definition `D` (`Emit<ComponentEventsOf<D>>` is its `emit`). Read
|
|
131
130
|
* from the manifest's `events` field like `ComponentPropsOf`, so `locales` does not turn it into
|
|
132
|
-
* `never
|
|
131
|
+
* `never`.
|
|
133
132
|
*/
|
|
134
133
|
export type ComponentEventsOf<D> = D extends {
|
|
135
134
|
readonly manifest: {
|
|
@@ -144,10 +143,10 @@ export type ComponentEventsOf<D> = D extends {
|
|
|
144
143
|
* `styles` and
|
|
145
144
|
* `render`. Prop types are inferred from `props` (`prop.number({ default: 1.2 })` gives
|
|
146
145
|
* `rate: number`), `emit` only accepts the names in `events`, and the data hooks given the render
|
|
147
|
-
* context only accept the collections and interactions in `data
|
|
146
|
+
* context only accept the collections and interactions in `data`; `cssVar` and `part`
|
|
148
147
|
* (in `render`'s context and in a `styles` function) only accept the names in `cssVars` and
|
|
149
|
-
* `parts
|
|
150
|
-
* `default` must be one of their languages
|
|
148
|
+
* `parts`; `t` of `useLocale` only accepts keys of the `locales` catalogs, and its
|
|
149
|
+
* `default` must be one of their languages. Output: a frozen
|
|
151
150
|
* `ComponentDefinition`. Errors: none at runtime (the manifest is checked by `extractManifest` at
|
|
152
151
|
* build time). Side effects: none; nothing is registered.
|
|
153
152
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-component.d.ts","sourceRoot":"","sources":["../src/define-component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAK,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,eAAe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,IAAI,EACvC,KAAK,CAAC,CAAC,SAAS,eAAe,GAAG,IAAI,EACtC,KAAK,CAAC,CAAC,SAAS,gBAAgB,GAAG,IAAI,EACvC,KAAK,CAAC,CAAC,SAAS,kBAAkB,GAAG,IAAI,EACzC,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC/B,KAAK,CAAC,CAAC,SAAS,mBAAmB,GAAG,IAAI,EAC1C,OAAO,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA6BhG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CASlF"}
|
package/dist/define-component.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defineTaggorComponent
|
|
2
|
+
* `defineTaggorComponent`: turns an author's declaration into a `ComponentDefinition`, the inert
|
|
3
3
|
* object the builder reads the manifest from (`extractManifest`, `@taggor/component/build`) and the
|
|
4
|
-
* runtime mounts (`createComponentElement
|
|
4
|
+
* runtime mounts (`createComponentElement`).
|
|
5
5
|
*
|
|
6
6
|
* Nothing happens at import or at definition time (golden rule 2): no `customElements.define`, no
|
|
7
7
|
* global, no DOM access, no validation that could throw on a visitor's page. Registering the tag is
|
|
8
8
|
* the runtime's job; validating the manifest is the builder's (`extractManifest`).
|
|
9
|
-
*
|
|
10
|
-
* manifest, which the data hooks read and are typed by.
|
|
9
|
+
* The `data` declaration is typed (`D`), and `render`'s context carries the frozen
|
|
10
|
+
* manifest, which the data hooks read and are typed by. `parts`, `cssVars` and `tag` are
|
|
11
11
|
* typed too (`R`, `C`, `T`): `styles` may be a function of the component's `Theme` (`cssVar`, `part`),
|
|
12
12
|
* `render`'s context carries the same helpers, and the literal tag types the DOM event names
|
|
13
|
-
* (`ComponentEventMap`).
|
|
13
|
+
* (`ComponentEventMap`). `locales` (`{ default, messages }`, typed `M`) declares the message
|
|
14
14
|
* catalogs; it stays in the frozen manifest at no cost to `defineTaggorComponent`, `useLocale` reads it
|
|
15
15
|
* from `render`'s context, and the builder's `extractManifest` turns it into the contract's
|
|
16
|
-
* `{ supported, default }`.
|
|
16
|
+
* `{ supported, default }`. `ComponentPropsOf` and `ComponentEventsOf` read the manifest's
|
|
17
17
|
* `props` and `events`, so a component with `locales` keeps its typed props and events.
|
|
18
18
|
*/
|
|
19
19
|
import { h } from "preact";
|
|
@@ -29,10 +29,10 @@ export const COMPONENT_KIND = "taggor.component";
|
|
|
29
29
|
* `styles` and
|
|
30
30
|
* `render`. Prop types are inferred from `props` (`prop.number({ default: 1.2 })` gives
|
|
31
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
|
|
32
|
+
* context only accept the collections and interactions in `data`; `cssVar` and `part`
|
|
33
33
|
* (in `render`'s context and in a `styles` function) only accept the names in `cssVars` and
|
|
34
|
-
* `parts
|
|
35
|
-
* `default` must be one of their languages
|
|
34
|
+
* `parts`; `t` of `useLocale` only accepts keys of the `locales` catalogs, and its
|
|
35
|
+
* `default` must be one of their languages. Output: a frozen
|
|
36
36
|
* `ComponentDefinition`. Errors: none at runtime (the manifest is checked by `extractManifest` at
|
|
37
37
|
* build time). Side effects: none; nothing is registered.
|
|
38
38
|
*/
|
|
@@ -44,7 +44,7 @@ export function defineTaggorComponent(options) {
|
|
|
44
44
|
const Body = ({ host, props }) => render(props, {
|
|
45
45
|
emit: (name, detail) => {
|
|
46
46
|
host.emit(name, detail);
|
|
47
|
-
//
|
|
47
|
+
// A declared event the component emitted is an `interaction`: the transport (ours,
|
|
48
48
|
// never throws) checks the name against `events`, samples, caps and sends the name only.
|
|
49
49
|
host.transport?.track({ name, manifest: draft, host });
|
|
50
50
|
},
|
|
@@ -1 +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,MAAM,WAAW,CAAC;AAI5D,OAAO,EACL,WAAW,GAIZ,MAAM,cAAc,CAAC;AAGtB,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;
|
|
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,MAAM,WAAW,CAAC;AAI5D,OAAO,EACL,WAAW,GAIZ,MAAM,cAAc,CAAC;AAGtB,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAmJjD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CASnC,OAAiD;IACjD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,WAAW,CAAO,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAElE,MAAM,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAkC,EAAE,EAAE,CAC/D,MAAM,CAAC,KAAK,EAAE;QACZ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
|
package/dist/define-library.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Workspace library authoring metadata
|
|
1
|
+
/** Workspace library authoring metadata; this declaration has no browser side effects. */
|
|
2
2
|
import type { LibraryManifest } from "@taggor/contract";
|
|
3
3
|
declare const LIBRARY_KIND: "taggor.library";
|
|
4
4
|
/** Inert definition returned by `defineLibrary`; the builder validates its manifest before use. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-library.d.ts","sourceRoot":"","sources":["../src/define-library.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"define-library.d.ts","sourceRoot":"","sources":["../src/define-library.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,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"}
|
package/dist/edge-transport.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface EdgeTransportOptions {
|
|
|
15
15
|
* - `submit` posts the body as JSON and resolves to `{ ok: true }` on any 2xx, to the server's
|
|
16
16
|
* error (`readDataError`) otherwise, to `payload_too_large` without sending when the body is
|
|
17
17
|
* over `submitBodyMaxBytes`, and to `network_error` when the request fails or `signal` aborts
|
|
18
|
-
* it
|
|
18
|
+
* it. It never rejects.
|
|
19
19
|
* - `track` posts `<kind> <versionHash> <name>` to `/e/<siteKey>` with `fetch` + `keepalive`,
|
|
20
20
|
* fire-and-forget, sampled and at most `EVENT_BEACON_CAP_PER_PAGE` per kind; it sends nothing
|
|
21
21
|
* without a version hash, and nothing when there is no `fetch`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-transport.d.ts","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edge-transport.d.ts","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"AA0CA,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"}
|
package/dist/edge-transport.js
CHANGED
|
@@ -23,7 +23,7 @@ function byteLength(text) {
|
|
|
23
23
|
* - `submit` posts the body as JSON and resolves to `{ ok: true }` on any 2xx, to the server's
|
|
24
24
|
* error (`readDataError`) otherwise, to `payload_too_large` without sending when the body is
|
|
25
25
|
* over `submitBodyMaxBytes`, and to `network_error` when the request fails or `signal` aborts
|
|
26
|
-
* it
|
|
26
|
+
* it. It never rejects.
|
|
27
27
|
* - `track` posts `<kind> <versionHash> <name>` to `/e/<siteKey>` with `fetch` + `keepalive`,
|
|
28
28
|
* fire-and-forget, sampled and at most `EVENT_BEACON_CAP_PER_PAGE` per kind; it sends nothing
|
|
29
29
|
* without a version hash, and nothing when there is no `fetch`.
|
|
@@ -52,7 +52,7 @@ export function createEdgeTransport(options) {
|
|
|
52
52
|
});
|
|
53
53
|
if (response.ok)
|
|
54
54
|
return ACCEPTED;
|
|
55
|
-
// Capped
|
|
55
|
+
// Capped: a hostile body must not be buffered whole; over the cap it is network_error.
|
|
56
56
|
return readDataError(await readBoundedJson(response));
|
|
57
57
|
}
|
|
58
58
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-transport.js","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edge-transport.js","sourceRoot":"","sources":["../src/edge-transport.ts"],"names":[],"mappings":"AAoCA,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;AAE3D,kEAAkE;AAClE,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;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
/**
|
|
2
|
-
* Typed events for authors
|
|
2
|
+
* Typed events for authors: the `events` map of a component and the `emit` function
|
|
3
3
|
* `render` receives, which only accepts declared event names and, for each, a `detail` of the
|
|
4
4
|
* type its declared value schema describes (`ValueOf`). The runtime dispatches the `CustomEvent`
|
|
5
|
-
* (`<tag>:<event
|
|
6
|
-
* dropped there, not here.
|
|
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
|
|
9
|
-
* TAG-214) can type its listeners.
|
|
5
|
+
* (`<tag>:<event>`) and validates `detail` again, so a wrong call from untyped code is
|
|
6
|
+
* dropped there, not here. `ManifestEventMap` and
|
|
7
|
+
* `ComponentEventMap` are the host page side: they 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) can type its listeners.
|
|
10
9
|
*/
|
|
11
10
|
import type { EventDeclaration } from "@taggor/contract";
|
|
12
11
|
import type { ValueOf } from "./value-types.js";
|
|
@@ -27,7 +26,7 @@ export type Emit<E> = <K extends keyof E & string>(name: K, detail: EventDetail<
|
|
|
27
26
|
* The DOM events of a manifest, for host pages: `<tag>:<event>` → `CustomEvent` whose `detail`
|
|
28
27
|
* has the declared type. `M` is any manifest-like type with a literal `tag` and an `events` map
|
|
29
28
|
* (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
|
|
29
|
+
* gives `${string}:<event>` keys. Types only; the runtime dispatches the events.
|
|
31
30
|
*
|
|
32
31
|
* ```ts
|
|
33
32
|
* declare global {
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot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AQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;CAAE,GACvE,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC"}
|
package/dist/form-field.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface FormFieldState {
|
|
|
20
20
|
/**
|
|
21
21
|
* Whether the field takes part in a form: `false` without `formAssociated: true` in the
|
|
22
22
|
* manifest, or in a browser without form-associated custom elements (`@taggor/component/testing`
|
|
23
|
-
* gives the field recording internals,
|
|
23
|
+
* gives the field recording internals, so it is `true` there).
|
|
24
24
|
*/
|
|
25
25
|
readonly associated: boolean;
|
|
26
26
|
/**
|
package/dist/form-field.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form field components
|
|
2
|
+
* Form field components: `useFormField`, the hook a component whose manifest declares
|
|
3
3
|
* `formAssociated: true` calls to take part in the host page's `<form>`, as an `<input>` would.
|
|
4
4
|
*
|
|
5
5
|
* The runtime makes the element form-associated and hands the component its `ElementInternals`
|