@kya-os/consent 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/components/consent-action-bar.js +4 -0
- package/dist/cjs/components/consent-action-bar.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-connector-header.js +1 -0
- package/dist/cjs/components/consent-connector-header.js.map +1 -1
- package/dist/cjs/components/consent-flow.js +403 -13
- package/dist/cjs/components/consent-flow.js.map +1 -1
- package/dist/cjs/components/consent-wallet-orb.js +6 -1
- package/dist/cjs/components/consent-wallet-orb.js.map +1 -1
- package/dist/cjs/components/flow-blocks.js +162 -35
- package/dist/cjs/components/flow-blocks.js.map +1 -1
- package/dist/cjs/flow/copy.js +15 -0
- package/dist/cjs/flow/copy.js.map +1 -1
- package/dist/cjs/flow/index.js +5 -2
- package/dist/cjs/flow/index.js.map +1 -1
- package/dist/cjs/flow/model.js +46 -1
- package/dist/cjs/flow/model.js.map +1 -1
- package/dist/cjs/flow/page.js +282 -0
- package/dist/cjs/flow/page.js.map +1 -0
- package/dist/cjs/flow/presets.js +4 -0
- package/dist/cjs/flow/presets.js.map +1 -1
- package/dist/cjs/flow/schema.js +1 -0
- package/dist/cjs/flow/schema.js.map +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/react/index.js +1 -0
- package/dist/cjs/react/index.js.map +1 -1
- package/dist/cjs/styles/brand.js +135 -38
- package/dist/cjs/styles/brand.js.map +1 -1
- package/dist/cjs/styles/theme.js +29 -3
- package/dist/cjs/styles/theme.js.map +1 -1
- package/dist/components/consent-action-bar.d.ts.map +1 -1
- package/dist/components/consent-action-bar.js +4 -0
- package/dist/components/consent-action-bar.js.map +1 -1
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +1 -1
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-connector-header.d.ts.map +1 -1
- package/dist/components/consent-connector-header.js +1 -0
- package/dist/components/consent-connector-header.js.map +1 -1
- package/dist/components/consent-flow.d.ts +61 -3
- package/dist/components/consent-flow.d.ts.map +1 -1
- package/dist/components/consent-flow.js +405 -15
- package/dist/components/consent-flow.js.map +1 -1
- package/dist/components/consent-wallet-orb.d.ts +4 -0
- package/dist/components/consent-wallet-orb.d.ts.map +1 -1
- package/dist/components/consent-wallet-orb.js +6 -1
- package/dist/components/consent-wallet-orb.js.map +1 -1
- package/dist/components/flow-blocks.d.ts +10 -1
- package/dist/components/flow-blocks.d.ts.map +1 -1
- package/dist/components/flow-blocks.js +162 -36
- package/dist/components/flow-blocks.js.map +1 -1
- package/dist/consent.js +856 -272
- package/dist/consent.min.js +634 -397
- package/dist/flow/copy.d.ts +2 -0
- package/dist/flow/copy.d.ts.map +1 -1
- package/dist/flow/copy.js +14 -0
- package/dist/flow/copy.js.map +1 -1
- package/dist/flow/index.d.ts +5 -2
- package/dist/flow/index.d.ts.map +1 -1
- package/dist/flow/index.js +5 -2
- package/dist/flow/index.js.map +1 -1
- package/dist/flow/model.d.ts +53 -2
- package/dist/flow/model.d.ts.map +1 -1
- package/dist/flow/model.js +45 -0
- package/dist/flow/model.js.map +1 -1
- package/dist/flow/page.d.ts +110 -0
- package/dist/flow/page.d.ts.map +1 -0
- package/dist/flow/page.js +276 -0
- package/dist/flow/page.js.map +1 -0
- package/dist/flow/presets.d.ts.map +1 -1
- package/dist/flow/presets.js +4 -0
- package/dist/flow/presets.js.map +1 -1
- package/dist/flow/schema.d.ts +19 -14
- package/dist/flow/schema.d.ts.map +1 -1
- package/dist/flow/schema.js +1 -0
- package/dist/flow/schema.js.map +1 -1
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -0
- package/dist/react/index.js.map +1 -1
- package/dist/styles/brand.d.ts +53 -18
- package/dist/styles/brand.d.ts.map +1 -1
- package/dist/styles/brand.js +136 -39
- package/dist/styles/brand.js.map +1 -1
- package/dist/styles/theme.d.ts +10 -1
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/theme.js +28 -2
- package/dist/styles/theme.js.map +1 -1
- package/package.json +2 -2
package/dist/consent.js
CHANGED
|
@@ -4920,6 +4920,7 @@ var ConsentActionBar = class extends i4 {
|
|
|
4920
4920
|
<button
|
|
4921
4921
|
class="action primary"
|
|
4922
4922
|
part="submit"
|
|
4923
|
+
data-field="approve"
|
|
4923
4924
|
type="button"
|
|
4924
4925
|
?disabled=${this.disabled || this.loading}
|
|
4925
4926
|
@click=${this.emitAllow}
|
|
@@ -4929,6 +4930,7 @@ var ConsentActionBar = class extends i4 {
|
|
|
4929
4930
|
<button
|
|
4930
4931
|
class="action secondary"
|
|
4931
4932
|
part="cancel"
|
|
4933
|
+
data-field="deny"
|
|
4932
4934
|
type="button"
|
|
4933
4935
|
?disabled=${this.loading}
|
|
4934
4936
|
@click=${this.emitDeny}
|
|
@@ -4947,6 +4949,7 @@ var ConsentActionBar = class extends i4 {
|
|
|
4947
4949
|
<div
|
|
4948
4950
|
class="action primary${this.disabled || this.loading ? " disabled" : ""}"
|
|
4949
4951
|
part="submit"
|
|
4952
|
+
data-field="approve"
|
|
4950
4953
|
>
|
|
4951
4954
|
${this.renderSubmitIcon()}${editRegion(
|
|
4952
4955
|
CONSENT_EDIT_KEYS.submitLabel,
|
|
@@ -4958,6 +4961,7 @@ var ConsentActionBar = class extends i4 {
|
|
|
4958
4961
|
<div
|
|
4959
4962
|
class="action secondary${this.loading ? " disabled" : ""}"
|
|
4960
4963
|
part="cancel"
|
|
4964
|
+
data-field="deny"
|
|
4961
4965
|
>
|
|
4962
4966
|
${editRegion(
|
|
4963
4967
|
CONSENT_EDIT_KEYS.cancelLabel,
|
|
@@ -5528,6 +5532,7 @@ var ConsentConnectorHeader = class extends i4 {
|
|
|
5528
5532
|
${this.renderBridge()}
|
|
5529
5533
|
<div
|
|
5530
5534
|
class="tile server ${serverLogo ? "has-logo" : ""}"
|
|
5535
|
+
data-field="merchant"
|
|
5531
5536
|
aria-hidden="true"
|
|
5532
5537
|
>
|
|
5533
5538
|
${serverLogo ? b2`<img
|
|
@@ -5788,6 +5793,11 @@ var FIXED_AGENT_TILE_BORDER = "rgba(15, 23, 42, 0.08)";
|
|
|
5788
5793
|
var FIXED_AGENT_TILE_TEXT = "#0F172A";
|
|
5789
5794
|
var TINT_PERCENT = 4;
|
|
5790
5795
|
var TINT_LINE_PERCENT = 11;
|
|
5796
|
+
var WALLET_SUCCESS = "#10b981";
|
|
5797
|
+
var PAGE_TOKENS = [
|
|
5798
|
+
["textTertiary", "--cs-page-text"],
|
|
5799
|
+
["surfaceAccent", "--cs-page-accent"]
|
|
5800
|
+
];
|
|
5791
5801
|
var lightTheme = {
|
|
5792
5802
|
surfaceBg: "#F4F1EA",
|
|
5793
5803
|
surfaceCard: "#FFFFFF",
|
|
@@ -5838,7 +5848,7 @@ function resolveThemeTokens(tokens) {
|
|
|
5838
5848
|
}
|
|
5839
5849
|
return resolved;
|
|
5840
5850
|
}
|
|
5841
|
-
function themeScopeStyle(tokens, scope) {
|
|
5851
|
+
function themeScopeStyle(tokens, scope, page) {
|
|
5842
5852
|
const resolved = resolveThemeTokens(tokens);
|
|
5843
5853
|
const keys = Object.keys(resolved);
|
|
5844
5854
|
const resolvedName = (key) => `--_${themeTokenProperty(key).slice(2)}`;
|
|
@@ -5850,11 +5860,28 @@ function themeScopeStyle(tokens, scope) {
|
|
|
5850
5860
|
const publish = keys.map(
|
|
5851
5861
|
(key) => ` ${themeTokenProperty(key)}: var(${resolvedName(key)});`
|
|
5852
5862
|
);
|
|
5853
|
-
|
|
5863
|
+
if (!page)
|
|
5864
|
+
return `:host {
|
|
5854
5865
|
${resolve.join("\n")}
|
|
5855
5866
|
}
|
|
5856
5867
|
${scope} {
|
|
5857
5868
|
${publish.join("\n")}
|
|
5869
|
+
}`;
|
|
5870
|
+
const success = ` --_cs-wallet-success: var(--cs-wallet-success, var(--cs-page-success, ${WALLET_SUCCESS}));`;
|
|
5871
|
+
const onPage = [
|
|
5872
|
+
...PAGE_TOKENS.map(
|
|
5873
|
+
([key, pageToken]) => ` ${themeTokenProperty(key)}: var(${pageToken}, var(${resolvedName(key)}));`
|
|
5874
|
+
),
|
|
5875
|
+
" --cs-wallet-success: var(--_cs-wallet-success);"
|
|
5876
|
+
];
|
|
5877
|
+
return `:host {
|
|
5878
|
+
${[...resolve, success].join("\n")}
|
|
5879
|
+
}
|
|
5880
|
+
${scope}, ${page} {
|
|
5881
|
+
${publish.join("\n")}
|
|
5882
|
+
}
|
|
5883
|
+
${page} {
|
|
5884
|
+
${onPage.join("\n")}
|
|
5858
5885
|
}`;
|
|
5859
5886
|
}
|
|
5860
5887
|
var FIXED_TOKENS = {
|
|
@@ -6429,8 +6456,8 @@ function durationOptionsWithin(options, maxSeconds) {
|
|
|
6429
6456
|
if (maxSeconds === void 0 || !Number.isFinite(maxSeconds)) {
|
|
6430
6457
|
return valid;
|
|
6431
6458
|
}
|
|
6432
|
-
const
|
|
6433
|
-
if (
|
|
6459
|
+
const within2 = valid.filter((o9) => o9.seconds <= maxSeconds);
|
|
6460
|
+
if (within2.length > 0) return within2;
|
|
6434
6461
|
const shortest = valid.reduce((a4, b4) => b4.seconds < a4.seconds ? b4 : a4);
|
|
6435
6462
|
return [shortest];
|
|
6436
6463
|
}
|
|
@@ -7216,7 +7243,8 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
7216
7243
|
hostStyle() {
|
|
7217
7244
|
return themeScopeStyle(
|
|
7218
7245
|
getConsentTheme(this.theme),
|
|
7219
|
-
".card,
|
|
7246
|
+
".card",
|
|
7247
|
+
"consent-connector-header, .below"
|
|
7220
7248
|
);
|
|
7221
7249
|
}
|
|
7222
7250
|
/** Grant terms in the `details` slot. None when rendered without a DOM. */
|
|
@@ -8270,7 +8298,7 @@ ConsentWalletOrb.styles = i`
|
|
|
8270
8298
|
|
|
8271
8299
|
.frame {
|
|
8272
8300
|
--_ink: var(--cs-wallet-accent, var(--cs-surface-accent, #0f172a));
|
|
8273
|
-
--_success: var(--cs-wallet-success,
|
|
8301
|
+
--_success: var(--cs-wallet-success, ${r(WALLET_SUCCESS)});
|
|
8274
8302
|
--_muted: var(--cs-wallet-muted, var(--cs-text-tertiary, #5d6c82));
|
|
8275
8303
|
position: relative;
|
|
8276
8304
|
width: 100%;
|
|
@@ -8983,6 +9011,8 @@ var FLOW_COPY = {
|
|
|
8983
9011
|
receipt: { until: "Until {When}" },
|
|
8984
9012
|
goBack: "Go back to {Agent} and tell it to continue. Revoke anytime under Connected agents at {Merchant}.",
|
|
8985
9013
|
retry: "Try again",
|
|
9014
|
+
terms: { agree: "I agree to the {Terms}" },
|
|
9015
|
+
legal: { label: "Legal" },
|
|
8986
9016
|
announce: {
|
|
8987
9017
|
"sign-in": "Sign in to continue.",
|
|
8988
9018
|
consent: "Review what {Agent} is asking for.",
|
|
@@ -9035,6 +9065,15 @@ function initialsOf(name = "", identifier = "") {
|
|
|
9035
9065
|
if (words.length === 1) return first(words[0]).toUpperCase();
|
|
9036
9066
|
return (first(identifier) || "?").toUpperCase();
|
|
9037
9067
|
}
|
|
9068
|
+
function httpsUrl(value) {
|
|
9069
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
9070
|
+
if (!raw) return void 0;
|
|
9071
|
+
try {
|
|
9072
|
+
return new URL(raw).protocol === "https:" ? raw : void 0;
|
|
9073
|
+
} catch {
|
|
9074
|
+
return void 0;
|
|
9075
|
+
}
|
|
9076
|
+
}
|
|
9038
9077
|
|
|
9039
9078
|
// src/flow/model.ts
|
|
9040
9079
|
var FLOW_SCHEMA_VERSION = 1;
|
|
@@ -9047,6 +9086,7 @@ var FLOW_BLOCKS = [
|
|
|
9047
9086
|
"approver",
|
|
9048
9087
|
"capability",
|
|
9049
9088
|
"details",
|
|
9089
|
+
"infoNote",
|
|
9050
9090
|
"countdown",
|
|
9051
9091
|
"actions",
|
|
9052
9092
|
"status",
|
|
@@ -9093,8 +9133,42 @@ var FLOW_EVENTS = [
|
|
|
9093
9133
|
"retry",
|
|
9094
9134
|
"expire",
|
|
9095
9135
|
"motion",
|
|
9096
|
-
"step"
|
|
9136
|
+
"step",
|
|
9137
|
+
"field"
|
|
9138
|
+
];
|
|
9139
|
+
var FLOW_FIELDS = [
|
|
9140
|
+
...FLOW_BLOCKS.filter((block) => block !== "actions"),
|
|
9141
|
+
"capabilitiesHeader",
|
|
9142
|
+
"approve",
|
|
9143
|
+
"deny",
|
|
9144
|
+
"terms",
|
|
9145
|
+
"legal",
|
|
9146
|
+
"merchant",
|
|
9147
|
+
"connector"
|
|
9097
9148
|
];
|
|
9149
|
+
var CONFIG_FIELD_REGIONS = Object.freeze({
|
|
9150
|
+
"branding.companyName": { field: "merchant", step: "consent" },
|
|
9151
|
+
"branding.logoUrl": { field: "merchant", step: "consent" },
|
|
9152
|
+
"branding.primaryColor": { field: "approve", step: "consent" },
|
|
9153
|
+
"ui.title": { field: "eyebrow", step: "consent" },
|
|
9154
|
+
"ui.headline": { field: "headline", step: "consent" },
|
|
9155
|
+
"ui.description": { field: "sub", step: "consent" },
|
|
9156
|
+
"ui.expirationText": { field: "infoNote", step: "consent" },
|
|
9157
|
+
"ui.permissionsHeader": { field: "capabilitiesHeader", step: "consent" },
|
|
9158
|
+
"ui.submitButtonText": { field: "approve", step: "consent" },
|
|
9159
|
+
"ui.cancelButtonText": { field: "deny", step: "consent" },
|
|
9160
|
+
headlineVerb: { field: "headline", step: "consent" },
|
|
9161
|
+
"terms.text": { field: "legal", step: "consent" },
|
|
9162
|
+
"terms.url": { field: "legal", step: "consent" },
|
|
9163
|
+
"terms.privacyUrl": { field: "legal", step: "consent" },
|
|
9164
|
+
"terms.required": { field: "terms", step: "consent" },
|
|
9165
|
+
"success.title": { field: "headline", step: "granted" },
|
|
9166
|
+
"success.description": { field: "sub", step: "granted" },
|
|
9167
|
+
// Both methods have a consent step, where Allow and "Approve with
|
|
9168
|
+
// passkey" differ; a consent flow has no passkey step to show.
|
|
9169
|
+
"flow.approvalMethod": { field: "approve", step: "consent" },
|
|
9170
|
+
"flow.connectorMark": { field: "connector", step: "consent" }
|
|
9171
|
+
});
|
|
9098
9172
|
var FLOW_HOST_ATTRIBUTES = {
|
|
9099
9173
|
version: "data-consent-version",
|
|
9100
9174
|
approvalMethod: "data-approval-method"
|
|
@@ -9107,9 +9181,11 @@ function consentFlowRenders() {
|
|
|
9107
9181
|
var CONSENT_BLOCKS = [
|
|
9108
9182
|
"eyebrow",
|
|
9109
9183
|
"headline",
|
|
9184
|
+
"sub",
|
|
9110
9185
|
"approver",
|
|
9111
9186
|
"capability",
|
|
9112
9187
|
"details",
|
|
9188
|
+
"infoNote",
|
|
9113
9189
|
"countdown",
|
|
9114
9190
|
"actions"
|
|
9115
9191
|
];
|
|
@@ -9160,9 +9236,11 @@ var PASSKEY_STEPS = {
|
|
|
9160
9236
|
blocks: [
|
|
9161
9237
|
"eyebrow",
|
|
9162
9238
|
"headline",
|
|
9239
|
+
"sub",
|
|
9163
9240
|
"approver",
|
|
9164
9241
|
"capability:locked",
|
|
9165
9242
|
"details",
|
|
9243
|
+
"infoNote",
|
|
9166
9244
|
"countdown",
|
|
9167
9245
|
"actions:loading",
|
|
9168
9246
|
"status"
|
|
@@ -9235,6 +9313,265 @@ function flowPreset(approvalMethod, { signIn: signIn2 = false } = {}) {
|
|
|
9235
9313
|
return FLOW_PRESETS[approvalMethod][signIn2 ? "signIn" : "decision"];
|
|
9236
9314
|
}
|
|
9237
9315
|
|
|
9316
|
+
// src/styles/brand.ts
|
|
9317
|
+
var AA_GRAPHIC_CONTRAST = 3;
|
|
9318
|
+
var TEXT_CONTRAST = 4.5;
|
|
9319
|
+
var ICON_TILE_PERCENT = 8;
|
|
9320
|
+
var HOVERED_ROW_PERCENT = 4;
|
|
9321
|
+
var MUTED_TEXT_PERCENT = 64;
|
|
9322
|
+
var PANEL_TINT_PERCENT = 4;
|
|
9323
|
+
var LIGHTNESS_STEP = 5e-3;
|
|
9324
|
+
var LIGHT_DRAWN_COLORS = Object.freeze({
|
|
9325
|
+
surface: lightTheme.surfaceCard,
|
|
9326
|
+
panel: lightTheme.surfaceInset,
|
|
9327
|
+
text: lightTheme.textPrimary,
|
|
9328
|
+
mutedText: lightTheme.textTertiary
|
|
9329
|
+
});
|
|
9330
|
+
var PALETTE_FIELDS = [
|
|
9331
|
+
"surfaceColor",
|
|
9332
|
+
"panelColor",
|
|
9333
|
+
"borderColor",
|
|
9334
|
+
"textColor",
|
|
9335
|
+
"mutedTextColor",
|
|
9336
|
+
"focusColor",
|
|
9337
|
+
"backgroundColor"
|
|
9338
|
+
];
|
|
9339
|
+
function rgbOf(hex) {
|
|
9340
|
+
return [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
|
|
9341
|
+
}
|
|
9342
|
+
function hexOf(channels2) {
|
|
9343
|
+
return `#${channels2.map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`;
|
|
9344
|
+
}
|
|
9345
|
+
function mixOver(top, percent, under) {
|
|
9346
|
+
const share = percent / 100;
|
|
9347
|
+
const below = rgbOf(under);
|
|
9348
|
+
return hexOf(
|
|
9349
|
+
rgbOf(top).map((above, i8) => above * share + below[i8] * (1 - share))
|
|
9350
|
+
);
|
|
9351
|
+
}
|
|
9352
|
+
function hslOf(hex) {
|
|
9353
|
+
const [red, green, blue] = rgbOf(hex).map((value) => value / 255);
|
|
9354
|
+
const high = Math.max(red, green, blue);
|
|
9355
|
+
const low = Math.min(red, green, blue);
|
|
9356
|
+
const spread = high - low;
|
|
9357
|
+
const lightness = (high + low) / 2;
|
|
9358
|
+
if (spread === 0) return { hue: 0, saturation: 0, lightness };
|
|
9359
|
+
const saturation = spread / (1 - Math.abs(2 * lightness - 1));
|
|
9360
|
+
const sector = high === red ? (green - blue) / spread : high === green ? (blue - red) / spread + 2 : (red - green) / spread + 4;
|
|
9361
|
+
return { hue: (sector * 60 + 360) % 360, saturation, lightness };
|
|
9362
|
+
}
|
|
9363
|
+
function hexFromHsl({ hue, saturation, lightness }) {
|
|
9364
|
+
const reach = saturation * Math.min(lightness, 1 - lightness);
|
|
9365
|
+
const channel = (offset) => {
|
|
9366
|
+
const turn = (offset + hue / 30) % 12;
|
|
9367
|
+
return (lightness - reach * Math.max(-1, Math.min(turn - 3, 9 - turn, 1))) * 255;
|
|
9368
|
+
};
|
|
9369
|
+
return hexOf([channel(0), channel(8), channel(4)]);
|
|
9370
|
+
}
|
|
9371
|
+
function iconColorFor(hex, primary, drawn = LIGHT_DRAWN_COLORS) {
|
|
9372
|
+
const hoveredRow = mixOver(primary, HOVERED_ROW_PERCENT, drawn.surface);
|
|
9373
|
+
return showingOn(hex, [
|
|
9374
|
+
drawn.surface,
|
|
9375
|
+
drawn.panel,
|
|
9376
|
+
mixOver(primary, ICON_TILE_PERCENT, drawn.surface),
|
|
9377
|
+
mixOver(primary, ICON_TILE_PERCENT, hoveredRow)
|
|
9378
|
+
]);
|
|
9379
|
+
}
|
|
9380
|
+
function showingOn(hex, surfaces) {
|
|
9381
|
+
const worstRatio = (candidate) => Math.min(...surfaces.map((surface) => contrastRatio(candidate, surface)));
|
|
9382
|
+
if (worstRatio(hex) >= AA_GRAPHIC_CONTRAST) return hex;
|
|
9383
|
+
const start = hslOf(hex);
|
|
9384
|
+
for (let steps = 1; steps * LIGHTNESS_STEP <= 1; steps++) {
|
|
9385
|
+
for (const lightness of [
|
|
9386
|
+
start.lightness - steps * LIGHTNESS_STEP,
|
|
9387
|
+
start.lightness + steps * LIGHTNESS_STEP
|
|
9388
|
+
]) {
|
|
9389
|
+
if (lightness < 0 || lightness > 1) continue;
|
|
9390
|
+
const candidate = hexFromHsl({ ...start, lightness });
|
|
9391
|
+
if (worstRatio(candidate) >= AA_GRAPHIC_CONTRAST) return candidate;
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
return worstRatio("#000000") >= worstRatio("#ffffff") ? "#000000" : "#ffffff";
|
|
9395
|
+
}
|
|
9396
|
+
function focusRingFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
9397
|
+
return contrastRatio(hex, surface) >= AA_GRAPHIC_CONTRAST ? "brand" : "ink";
|
|
9398
|
+
}
|
|
9399
|
+
function readsOnCardAndTint(hex, ratio, surface) {
|
|
9400
|
+
const tint = mixOver(hex, TINT_PERCENT, surface);
|
|
9401
|
+
return contrastRatio(hex, surface) >= ratio && contrastRatio(hex, tint) >= ratio;
|
|
9402
|
+
}
|
|
9403
|
+
function actionColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
9404
|
+
return readsOnCardAndTint(hex, TEXT_CONTRAST, surface) ? "brand" : "ink";
|
|
9405
|
+
}
|
|
9406
|
+
function markColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
9407
|
+
return readsOnCardAndTint(hex, AA_GRAPHIC_CONTRAST, surface) ? "brand" : "ink";
|
|
9408
|
+
}
|
|
9409
|
+
function onPrimaryFor(hex) {
|
|
9410
|
+
const luminance = relativeLuminance(hex);
|
|
9411
|
+
const againstWhite = 1.05 / (luminance + 0.05);
|
|
9412
|
+
const againstBlack = (luminance + 0.05) / 0.05;
|
|
9413
|
+
return againstBlack >= againstWhite ? "black" : "white";
|
|
9414
|
+
}
|
|
9415
|
+
function panelOf(palette, text, drawn) {
|
|
9416
|
+
if (palette.panelColor) return palette.panelColor;
|
|
9417
|
+
if (palette.surfaceColor)
|
|
9418
|
+
return mixOver(text, PANEL_TINT_PERCENT, palette.surfaceColor);
|
|
9419
|
+
return drawn.panel;
|
|
9420
|
+
}
|
|
9421
|
+
function mutedOn(palette, background, drawn) {
|
|
9422
|
+
if (palette.mutedTextColor) return palette.mutedTextColor;
|
|
9423
|
+
if (palette.textColor)
|
|
9424
|
+
return mixOver(palette.textColor, MUTED_TEXT_PERCENT, background);
|
|
9425
|
+
return drawn.mutedText;
|
|
9426
|
+
}
|
|
9427
|
+
function pageTextOn(palette, page, drawn) {
|
|
9428
|
+
const muted = mutedOn(palette, page, drawn);
|
|
9429
|
+
if (contrastRatio(muted, page) >= TEXT_CONTRAST) return muted;
|
|
9430
|
+
const ink = onPrimaryFor(page) === "black" ? "#000000" : "#ffffff";
|
|
9431
|
+
for (let percent = MUTED_TEXT_PERCENT; percent < 100; percent++) {
|
|
9432
|
+
const quieter = mixOver(ink, percent, page);
|
|
9433
|
+
if (contrastRatio(quieter, page) >= TEXT_CONTRAST) return quieter;
|
|
9434
|
+
}
|
|
9435
|
+
return ink;
|
|
9436
|
+
}
|
|
9437
|
+
function floorToHundredths(ratio) {
|
|
9438
|
+
return Math.floor(ratio * 100) / 100;
|
|
9439
|
+
}
|
|
9440
|
+
function paletteFailures(palette, drawn = {}) {
|
|
9441
|
+
const colors = { ...LIGHT_DRAWN_COLORS, ...drawn };
|
|
9442
|
+
const text = palette.textColor ?? colors.text;
|
|
9443
|
+
const backgrounds = [
|
|
9444
|
+
{
|
|
9445
|
+
background: "surfaceColor",
|
|
9446
|
+
color: palette.surfaceColor ?? colors.surface
|
|
9447
|
+
},
|
|
9448
|
+
{ background: "panelColor", color: panelOf(palette, text, colors) }
|
|
9449
|
+
];
|
|
9450
|
+
return backgrounds.flatMap(({ background, color }) => {
|
|
9451
|
+
const pairs = [
|
|
9452
|
+
{ foreground: "textColor", color: text, needs: TEXT_CONTRAST },
|
|
9453
|
+
{
|
|
9454
|
+
foreground: "mutedTextColor",
|
|
9455
|
+
color: mutedOn(palette, color, colors),
|
|
9456
|
+
needs: TEXT_CONTRAST
|
|
9457
|
+
},
|
|
9458
|
+
...palette.focusColor ? [
|
|
9459
|
+
{
|
|
9460
|
+
foreground: "focusColor",
|
|
9461
|
+
color: palette.focusColor,
|
|
9462
|
+
needs: AA_GRAPHIC_CONTRAST
|
|
9463
|
+
}
|
|
9464
|
+
] : []
|
|
9465
|
+
];
|
|
9466
|
+
return pairs.flatMap(({ foreground, color: ink, needs }) => {
|
|
9467
|
+
const ratio = contrastRatio(ink, color);
|
|
9468
|
+
return ratio >= needs ? [] : [{ foreground, background, ratio: floorToHundredths(ratio), needs }];
|
|
9469
|
+
});
|
|
9470
|
+
});
|
|
9471
|
+
}
|
|
9472
|
+
function drawablePalette(chosen, drawn = {}) {
|
|
9473
|
+
const { focusColor, borderColor, backgroundColor, ...surfacesAndText } = chosen;
|
|
9474
|
+
const text = paletteFailures(surfacesAndText, drawn).length === 0 ? surfacesAndText : {};
|
|
9475
|
+
const focusShows = focusColor !== void 0 && paletteFailures({ ...text, focusColor }, drawn).length === 0;
|
|
9476
|
+
return {
|
|
9477
|
+
...text,
|
|
9478
|
+
...backgroundColor ? { backgroundColor } : {},
|
|
9479
|
+
...borderColor ? { borderColor } : {},
|
|
9480
|
+
...focusShows ? { focusColor } : {}
|
|
9481
|
+
};
|
|
9482
|
+
}
|
|
9483
|
+
function brandTokens(brand, theme = "light") {
|
|
9484
|
+
for (const [field, value] of Object.entries(brand)) {
|
|
9485
|
+
if (value !== void 0 && !isHexColor(value)) {
|
|
9486
|
+
throw new RangeError(
|
|
9487
|
+
`${field} must be a #rrggbb color, got ${JSON.stringify(value)}`
|
|
9488
|
+
);
|
|
9489
|
+
}
|
|
9490
|
+
}
|
|
9491
|
+
const { primaryColor: primary, secondaryColor, ...chosen } = brand;
|
|
9492
|
+
const palette = drawablePalette(chosen);
|
|
9493
|
+
const surface = palette.surfaceColor ?? LIGHT_DRAWN_COLORS.surface;
|
|
9494
|
+
const panel = panelOf(
|
|
9495
|
+
palette,
|
|
9496
|
+
palette.textColor ?? LIGHT_DRAWN_COLORS.text,
|
|
9497
|
+
LIGHT_DRAWN_COLORS
|
|
9498
|
+
);
|
|
9499
|
+
const tokens = primary ? primaryTokens(primary, palette, surface, panel, secondaryColor) : {};
|
|
9500
|
+
if (!primary) {
|
|
9501
|
+
if (palette.textColor) {
|
|
9502
|
+
tokens["--cs-surface-accent"] = palette.textColor;
|
|
9503
|
+
tokens["--cs-surface-accent-text"] = onPrimaryFor(palette.textColor);
|
|
9504
|
+
}
|
|
9505
|
+
const ring = palette.focusColor ?? palette.textColor;
|
|
9506
|
+
if (ring) tokens["--cs-focus-ring"] = ring;
|
|
9507
|
+
}
|
|
9508
|
+
if (palette.surfaceColor) tokens["--cs-surface-card"] = palette.surfaceColor;
|
|
9509
|
+
if (palette.surfaceColor || palette.panelColor)
|
|
9510
|
+
tokens["--cs-surface-inset"] = panel;
|
|
9511
|
+
if (palette.borderColor) tokens["--cs-surface-border"] = palette.borderColor;
|
|
9512
|
+
if (palette.textColor) {
|
|
9513
|
+
tokens["--cs-text-primary"] = palette.textColor;
|
|
9514
|
+
tokens["--cs-text-secondary"] = palette.textColor;
|
|
9515
|
+
}
|
|
9516
|
+
if (palette.mutedTextColor) {
|
|
9517
|
+
tokens["--cs-text-tertiary"] = palette.mutedTextColor;
|
|
9518
|
+
} else if (palette.textColor) {
|
|
9519
|
+
tokens["--cs-text-tertiary"] = `color-mix(in srgb, ${palette.textColor} ${MUTED_TEXT_PERCENT}%, transparent)`;
|
|
9520
|
+
}
|
|
9521
|
+
const page = palette.backgroundColor;
|
|
9522
|
+
if (page) {
|
|
9523
|
+
const text = pageTextOn(palette, page, LIGHT_DRAWN_COLORS);
|
|
9524
|
+
const shows = (hex) => contrastRatio(hex, page) >= AA_GRAPHIC_CONTRAST;
|
|
9525
|
+
const accent = primary ?? palette.textColor ?? lightTheme.surfaceAccent;
|
|
9526
|
+
const lockup = lightTheme.lockup;
|
|
9527
|
+
tokens["--cs-surface-bg"] = page;
|
|
9528
|
+
tokens["--cs-page-text"] = text;
|
|
9529
|
+
tokens["--cs-page-accent"] = shows(accent) ? accent : text;
|
|
9530
|
+
tokens["--cs-page-success"] = showingOn(WALLET_SUCCESS, [page]);
|
|
9531
|
+
tokens["--cs-lockup"] = lockup && shows(lockup) ? lockup : text;
|
|
9532
|
+
} else {
|
|
9533
|
+
const stage = getConsentTheme(theme);
|
|
9534
|
+
const accent = primary ?? palette.textColor;
|
|
9535
|
+
if (accent && contrastRatio(accent, stage.surfaceBg) < AA_GRAPHIC_CONTRAST)
|
|
9536
|
+
tokens["--cs-page-accent"] = stage.surfaceAccent;
|
|
9537
|
+
}
|
|
9538
|
+
return tokens;
|
|
9539
|
+
}
|
|
9540
|
+
function primaryTokens(primary, palette, surface, panel, secondaryColor) {
|
|
9541
|
+
const ink = palette.textColor ?? LIGHT_DRAWN_COLORS.text;
|
|
9542
|
+
const onPrimary = onPrimaryFor(primary);
|
|
9543
|
+
const inBrand = (pick) => pick === "brand" ? primary : ink;
|
|
9544
|
+
const tokens = {
|
|
9545
|
+
"--consent-primary": primary,
|
|
9546
|
+
"--consent-on-primary": onPrimary,
|
|
9547
|
+
"--consent-link": inBrand(actionColorFor(primary, surface)),
|
|
9548
|
+
"--cs-surface-accent": primary,
|
|
9549
|
+
"--cs-surface-accent-text": onPrimary,
|
|
9550
|
+
"--cs-tint": mixOver(primary, TINT_PERCENT, surface),
|
|
9551
|
+
"--cs-tint-line": mixOver(primary, TINT_LINE_PERCENT, surface),
|
|
9552
|
+
"--cs-mark": inBrand(markColorFor(primary, surface)),
|
|
9553
|
+
"--cs-action": inBrand(actionColorFor(primary, surface)),
|
|
9554
|
+
"--cs-focus-ring": palette.focusColor ?? inBrand(focusRingFor(primary, surface))
|
|
9555
|
+
};
|
|
9556
|
+
if (secondaryColor) {
|
|
9557
|
+
tokens["--cs-icon"] = iconColorFor(secondaryColor, primary, {
|
|
9558
|
+
surface,
|
|
9559
|
+
panel
|
|
9560
|
+
});
|
|
9561
|
+
}
|
|
9562
|
+
return tokens;
|
|
9563
|
+
}
|
|
9564
|
+
function brandStyle(brand, theme = "light") {
|
|
9565
|
+
const tokens = brandTokens(brand, theme);
|
|
9566
|
+
const page = tokens["--cs-surface-bg"];
|
|
9567
|
+
return [
|
|
9568
|
+
...Object.entries(tokens).map(
|
|
9569
|
+
([property, value]) => `${property}: ${value};`
|
|
9570
|
+
),
|
|
9571
|
+
...page ? [`background-color: ${page};`] : []
|
|
9572
|
+
].join(" ");
|
|
9573
|
+
}
|
|
9574
|
+
|
|
9238
9575
|
// src/components/flow-blocks.ts
|
|
9239
9576
|
var BLOCK_MORPH_FROM = {
|
|
9240
9577
|
approver: "signIn",
|
|
@@ -9251,6 +9588,14 @@ function flowValues(data) {
|
|
|
9251
9588
|
Domain: data.agent.domain
|
|
9252
9589
|
};
|
|
9253
9590
|
}
|
|
9591
|
+
function filled(words, values) {
|
|
9592
|
+
return Object.fromEntries(
|
|
9593
|
+
Object.entries(words).map(([key, value]) => [
|
|
9594
|
+
key,
|
|
9595
|
+
fillTemplate(value, values)
|
|
9596
|
+
])
|
|
9597
|
+
);
|
|
9598
|
+
}
|
|
9254
9599
|
function whenLabel(at) {
|
|
9255
9600
|
const date = new Date(at);
|
|
9256
9601
|
if (Number.isNaN(date.getTime())) return "";
|
|
@@ -9271,6 +9616,9 @@ function richText(template, values) {
|
|
|
9271
9616
|
return value;
|
|
9272
9617
|
});
|
|
9273
9618
|
}
|
|
9619
|
+
function breakable(value) {
|
|
9620
|
+
return value.split(/(?=[@.])/).map((piece, i8) => i8 ? b2`<wbr />${piece}` : piece);
|
|
9621
|
+
}
|
|
9274
9622
|
var hide = (event) => {
|
|
9275
9623
|
event.target.hidden = true;
|
|
9276
9624
|
};
|
|
@@ -9292,16 +9640,16 @@ function agentTile(agent) {
|
|
|
9292
9640
|
>`;
|
|
9293
9641
|
}
|
|
9294
9642
|
var approver = ({ data, copy, step, variant, values }) => {
|
|
9295
|
-
const c6 = group(copy, "approver");
|
|
9643
|
+
const c6 = filled(group(copy, "approver"), values);
|
|
9296
9644
|
const state = variant ?? step;
|
|
9297
9645
|
const granted = state === "granted";
|
|
9298
9646
|
const declined = state === "denied";
|
|
9299
9647
|
const person = data.approver;
|
|
9300
9648
|
const agent = data.agent;
|
|
9301
9649
|
const unverified = agent.verification === "unverified";
|
|
9302
|
-
const status = unverified ? c6.unverified : agent.domain ?
|
|
9650
|
+
const status = unverified ? c6.unverified : agent.domain ? c6.identifiedBy ?? "" : "";
|
|
9303
9651
|
const detail = granted ? c6.confirmed : person.identifier;
|
|
9304
|
-
const markLabel = declined ? c6.declined :
|
|
9652
|
+
const markLabel = declined ? c6.declined : c6.signedInWith ?? "";
|
|
9305
9653
|
return b2`<div class="tinted lockup" part="approver">
|
|
9306
9654
|
<div class="lockup-row">
|
|
9307
9655
|
${face(person.name, person.identifier, person.avatarUrl)}
|
|
@@ -9309,8 +9657,8 @@ var approver = ({ data, copy, step, variant, values }) => {
|
|
|
9309
9657
|
<span class="lockup-label"
|
|
9310
9658
|
>${granted ? c6.labelGranted : declined ? c6.labelDenied : c6.label}</span
|
|
9311
9659
|
>
|
|
9312
|
-
<span class="lockup-name">${person.name}</span>
|
|
9313
|
-
${detail ? b2`<span class="small">${detail}</span>` : A}
|
|
9660
|
+
<span class="lockup-name">${breakable(person.name)}</span>
|
|
9661
|
+
${detail ? b2`<span class="small">${breakable(detail)}</span>` : A}
|
|
9314
9662
|
</div>
|
|
9315
9663
|
<span
|
|
9316
9664
|
class="lockup-mark ${declined ? "declined" : ""}"
|
|
@@ -9326,12 +9674,12 @@ var approver = ({ data, copy, step, variant, values }) => {
|
|
|
9326
9674
|
<span class="small"
|
|
9327
9675
|
>${granted ? c6.partyGranted : declined ? c6.partyDenied : c6.party}</span
|
|
9328
9676
|
>
|
|
9329
|
-
<span class="value">${agent.name}</span>
|
|
9677
|
+
<span class="value">${breakable(agent.name)}</span>
|
|
9330
9678
|
</div>
|
|
9331
9679
|
${status ? b2`<span
|
|
9332
9680
|
class="party-status ${unverified ? "unverified" : ""}"
|
|
9333
9681
|
part="agent-status"
|
|
9334
|
-
>${status}${unverified && c6.unverifiedInfo ? b2`<button
|
|
9682
|
+
>${breakable(status)}${unverified && c6.unverifiedInfo ? b2`<button
|
|
9335
9683
|
type="button"
|
|
9336
9684
|
class="info"
|
|
9337
9685
|
aria-label=${c6.unverified}
|
|
@@ -9354,10 +9702,14 @@ var capability = ({
|
|
|
9354
9702
|
preview
|
|
9355
9703
|
}) => {
|
|
9356
9704
|
const locked = Boolean(variant);
|
|
9357
|
-
return b2`<div
|
|
9705
|
+
return b2`<div
|
|
9706
|
+
class="section-header"
|
|
9707
|
+
part="section-header"
|
|
9708
|
+
data-field="capabilitiesHeader"
|
|
9709
|
+
>
|
|
9358
9710
|
<span>${fillTemplate(token(copy, "capabilitiesHeader"), values)}</span>
|
|
9359
9711
|
<span class="hint" part="section-hint" ?data-hidden=${locked}
|
|
9360
|
-
>${token(copy, "tapToToggle")}</span
|
|
9712
|
+
>${fillTemplate(token(copy, "tapToToggle"), values)}</span
|
|
9361
9713
|
>
|
|
9362
9714
|
</div>
|
|
9363
9715
|
<div class="rows ${variant === "dim" ? "dim" : ""}">
|
|
@@ -9428,6 +9780,23 @@ var receipt = ({ data, copy, selected }) => {
|
|
|
9428
9780
|
)}
|
|
9429
9781
|
</ul>`;
|
|
9430
9782
|
};
|
|
9783
|
+
function termsBox({ copy, termsAccepted }, terms, loading) {
|
|
9784
|
+
const href = httpsUrl(terms.href);
|
|
9785
|
+
const words = splitTemplate(group(copy, "terms").agree ?? "{Terms}").map(
|
|
9786
|
+
(part) => part.name !== "Terms" ? part.text ?? "" : href ? b2`<a href=${href} target="_blank" rel="noopener noreferrer"
|
|
9787
|
+
>${terms.label}</a
|
|
9788
|
+
>` : terms.label
|
|
9789
|
+
);
|
|
9790
|
+
return b2`<label class="terms" part="terms" data-field="terms">
|
|
9791
|
+
<input
|
|
9792
|
+
type="checkbox"
|
|
9793
|
+
data-action="terms"
|
|
9794
|
+
.checked=${termsAccepted}
|
|
9795
|
+
?disabled=${loading}
|
|
9796
|
+
/>
|
|
9797
|
+
<span>${words}</span>
|
|
9798
|
+
</label>`;
|
|
9799
|
+
}
|
|
9431
9800
|
var FINGERPRINT = b2`<svg
|
|
9432
9801
|
viewBox="0 0 24 24"
|
|
9433
9802
|
fill="none"
|
|
@@ -9440,8 +9809,8 @@ var FINGERPRINT = b2`<svg
|
|
|
9440
9809
|
${fingerprintIcon}
|
|
9441
9810
|
</svg>`;
|
|
9442
9811
|
var FLOW_BLOCK_RENDERERS = {
|
|
9443
|
-
eyebrow: ({ copy, step }) => b2`<span class="eyebrow" part="eyebrow"
|
|
9444
|
-
>${token(copy, "eyebrow", step)}</span
|
|
9812
|
+
eyebrow: ({ copy, step, values }) => b2`<span class="eyebrow" part="eyebrow"
|
|
9813
|
+
>${fillTemplate(token(copy, "eyebrow", step), values)}</span
|
|
9445
9814
|
>`,
|
|
9446
9815
|
headline: ({ copy, step, values }) => {
|
|
9447
9816
|
const words = token(copy, "headline", step);
|
|
@@ -9451,7 +9820,7 @@ var FLOW_BLOCK_RENDERERS = {
|
|
|
9451
9820
|
},
|
|
9452
9821
|
sub: ({ copy, step, values }) => {
|
|
9453
9822
|
const words = token(copy, "sub", step);
|
|
9454
|
-
return words ? b2`<p class="sub">${fillTemplate(words, values)}</p>` : A;
|
|
9823
|
+
return words ? b2`<p class="sub" part="sub">${fillTemplate(words, values)}</p>` : A;
|
|
9455
9824
|
},
|
|
9456
9825
|
signIn,
|
|
9457
9826
|
finePrint: ({ copy, values }) => {
|
|
@@ -9464,27 +9833,41 @@ var FLOW_BLOCK_RENDERERS = {
|
|
|
9464
9833
|
details: ({ data }) => data.grantDetails ? grantDetailsSection(
|
|
9465
9834
|
grantDetailRows(data.grantDetails, data.merchant.name)
|
|
9466
9835
|
) : A,
|
|
9836
|
+
/** The project's own note (Checkpoint's "Info note"); nothing without one. */
|
|
9837
|
+
infoNote: ({ copy, values }) => {
|
|
9838
|
+
const words = token(copy, "infoNote");
|
|
9839
|
+
return words ? b2`<p class="line tinted info-note" part="info-note">
|
|
9840
|
+
${decisionIcon("info")}<span>${fillTemplate(words, values)}</span>
|
|
9841
|
+
</p>` : A;
|
|
9842
|
+
},
|
|
9467
9843
|
/** The package's countdown; its expiry is the flow's `expire` event. */
|
|
9468
9844
|
countdown: ({ data }) => data.requestExpiresAt !== void 0 ? b2`<consent-request-expiry
|
|
9469
9845
|
.expiresAt=${data.requestExpiresAt}
|
|
9470
9846
|
></consent-request-expiry>` : A,
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9847
|
+
/** Allow and Deny; with terms, the box to tick over them, and Allow waits for it. */
|
|
9848
|
+
actions: (ctx) => {
|
|
9849
|
+
const { data, copy, variant, method, preview, terms, termsAccepted } = ctx;
|
|
9850
|
+
const a4 = filled(group(copy, "actions"), ctx.values);
|
|
9851
|
+
const loading = variant === "loading";
|
|
9852
|
+
return b2`${terms ? termsBox(ctx, terms, loading) : A}
|
|
9853
|
+
<consent-action-bar
|
|
9854
|
+
.agentName=${data.agent.name}
|
|
9855
|
+
.submitLabel=${a4.approve ?? ""}
|
|
9856
|
+
.cancelLabel=${a4.deny ?? ""}
|
|
9857
|
+
.submitIcon=${method === "passkey" ? "passkey" : ""}
|
|
9858
|
+
.loadingLabel=${a4.confirming ?? ""}
|
|
9859
|
+
.loading=${loading}
|
|
9860
|
+
.disabled=${Boolean(terms) && !termsAccepted}
|
|
9861
|
+
.preview=${preview}
|
|
9862
|
+
></consent-action-bar>`;
|
|
9482
9863
|
},
|
|
9483
|
-
status: ({ copy }) => b2`<p class="line status" part="status" tabindex="-1">
|
|
9484
|
-
${FINGERPRINT}<span>${token(copy, "status")}</span>
|
|
9864
|
+
status: ({ copy, values }) => b2`<p class="line status" part="status" tabindex="-1">
|
|
9865
|
+
${FINGERPRINT}<span>${fillTemplate(token(copy, "status"), values)}</span>
|
|
9485
9866
|
</p>`,
|
|
9486
|
-
notice: ({ copy }) => b2`<p class="line notice" part="notice" tabindex="-1">
|
|
9487
|
-
${decisionIcon("warning")}<span
|
|
9867
|
+
notice: ({ copy, values }) => b2`<p class="line notice" part="notice" tabindex="-1">
|
|
9868
|
+
${decisionIcon("warning")}<span
|
|
9869
|
+
>${fillTemplate(token(copy, "notice"), values)}</span
|
|
9870
|
+
>
|
|
9488
9871
|
</p>`,
|
|
9489
9872
|
expiredNote: ({ copy, values }) => b2`<p class="line tinted expired-note" part="expired-note">
|
|
9490
9873
|
${decisionIcon("duration")}<span
|
|
@@ -9496,8 +9879,8 @@ var FLOW_BLOCK_RENDERERS = {
|
|
|
9496
9879
|
const words = token(copy, "goBack");
|
|
9497
9880
|
return words ? b2`<p class="sub">${fillTemplate(words, values)}</p>` : A;
|
|
9498
9881
|
},
|
|
9499
|
-
retry: ({ copy }) => b2`<button type="button" class="primary" part="retry" data-action="retry">
|
|
9500
|
-
${token(copy, "retry")}
|
|
9882
|
+
retry: ({ copy, values }) => b2`<button type="button" class="primary" part="retry" data-action="retry">
|
|
9883
|
+
${fillTemplate(token(copy, "retry"), values)}
|
|
9501
9884
|
</button>`
|
|
9502
9885
|
};
|
|
9503
9886
|
var flowBlockStyles = i`
|
|
@@ -9592,12 +9975,14 @@ var flowBlockStyles = i`
|
|
|
9592
9975
|
opacity: 0.55;
|
|
9593
9976
|
}
|
|
9594
9977
|
|
|
9595
|
-
/* The approver lockup.
|
|
9978
|
+
/* The approver lockup. Names break only where a word can't fit, and
|
|
9979
|
+
an address at its "@" and dots first (breakable). */
|
|
9596
9980
|
.lockup {
|
|
9597
9981
|
display: flex;
|
|
9598
9982
|
flex-direction: column;
|
|
9599
9983
|
gap: 12px;
|
|
9600
9984
|
padding: 16px 18px;
|
|
9985
|
+
container-type: inline-size;
|
|
9601
9986
|
}
|
|
9602
9987
|
|
|
9603
9988
|
.lockup-row {
|
|
@@ -9632,12 +10017,12 @@ var flowBlockStyles = i`
|
|
|
9632
10017
|
font-size: 20px;
|
|
9633
10018
|
font-weight: 600;
|
|
9634
10019
|
line-height: 1.2;
|
|
9635
|
-
overflow-wrap:
|
|
10020
|
+
overflow-wrap: break-word;
|
|
9636
10021
|
}
|
|
9637
10022
|
|
|
9638
10023
|
.lockup-text .value {
|
|
9639
10024
|
font-weight: 500;
|
|
9640
|
-
overflow-wrap:
|
|
10025
|
+
overflow-wrap: break-word;
|
|
9641
10026
|
}
|
|
9642
10027
|
|
|
9643
10028
|
.lockup-mark {
|
|
@@ -9727,18 +10112,44 @@ var flowBlockStyles = i`
|
|
|
9727
10112
|
color: var(--cs-warning-text, var(--cs-text-primary));
|
|
9728
10113
|
}
|
|
9729
10114
|
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
10115
|
+
/* A phone-width card: smaller faces and padding, and the agent's status
|
|
10116
|
+
under its name, so the names keep their width. */
|
|
10117
|
+
@container (max-width: 300px) {
|
|
10118
|
+
.lockup-row {
|
|
10119
|
+
gap: 10px;
|
|
10120
|
+
}
|
|
10121
|
+
|
|
10122
|
+
.lockup-row.party {
|
|
10123
|
+
flex-wrap: wrap;
|
|
10124
|
+
}
|
|
10125
|
+
|
|
10126
|
+
.face,
|
|
10127
|
+
.tile {
|
|
10128
|
+
width: 36px;
|
|
10129
|
+
height: 36px;
|
|
10130
|
+
}
|
|
10131
|
+
|
|
10132
|
+
.party-status {
|
|
10133
|
+
flex-basis: 100%;
|
|
10134
|
+
flex-shrink: 1;
|
|
10135
|
+
min-width: 0;
|
|
10136
|
+
padding-left: 46px;
|
|
10137
|
+
overflow-wrap: break-word;
|
|
10138
|
+
}
|
|
10139
|
+
}
|
|
10140
|
+
|
|
10141
|
+
.info {
|
|
10142
|
+
display: inline-grid;
|
|
10143
|
+
place-items: center;
|
|
10144
|
+
width: 22px;
|
|
10145
|
+
height: 22px;
|
|
10146
|
+
padding: 0;
|
|
10147
|
+
border: 0;
|
|
10148
|
+
border-radius: 50%;
|
|
10149
|
+
background: none;
|
|
10150
|
+
color: var(--cs-text-tertiary);
|
|
10151
|
+
cursor: help;
|
|
10152
|
+
}
|
|
9742
10153
|
|
|
9743
10154
|
.info svg {
|
|
9744
10155
|
width: 16px;
|
|
@@ -9867,10 +10278,52 @@ var flowBlockStyles = i`
|
|
|
9867
10278
|
color: var(--cs-text-secondary);
|
|
9868
10279
|
}
|
|
9869
10280
|
|
|
9870
|
-
.expired-note
|
|
10281
|
+
.expired-note,
|
|
10282
|
+
.info-note {
|
|
9871
10283
|
padding: 12px 14px;
|
|
9872
10284
|
}
|
|
9873
10285
|
|
|
10286
|
+
.info-note {
|
|
10287
|
+
align-items: flex-start;
|
|
10288
|
+
font-size: 13px;
|
|
10289
|
+
color: var(--cs-text-secondary);
|
|
10290
|
+
}
|
|
10291
|
+
|
|
10292
|
+
.info-note svg {
|
|
10293
|
+
margin-top: 2px;
|
|
10294
|
+
}
|
|
10295
|
+
|
|
10296
|
+
/* The terms to accept, over Allow. */
|
|
10297
|
+
.terms {
|
|
10298
|
+
display: flex;
|
|
10299
|
+
align-items: flex-start;
|
|
10300
|
+
gap: 10px;
|
|
10301
|
+
margin-bottom: 14px;
|
|
10302
|
+
font-size: 13px;
|
|
10303
|
+
line-height: 1.45;
|
|
10304
|
+
color: var(--cs-text-secondary);
|
|
10305
|
+
cursor: pointer;
|
|
10306
|
+
}
|
|
10307
|
+
|
|
10308
|
+
.terms input {
|
|
10309
|
+
flex-shrink: 0;
|
|
10310
|
+
width: 16px;
|
|
10311
|
+
height: 16px;
|
|
10312
|
+
margin: 1px 0 0;
|
|
10313
|
+
accent-color: var(--cs-action, var(--cs-surface-accent));
|
|
10314
|
+
cursor: inherit;
|
|
10315
|
+
}
|
|
10316
|
+
|
|
10317
|
+
.terms input:disabled {
|
|
10318
|
+
cursor: default;
|
|
10319
|
+
}
|
|
10320
|
+
|
|
10321
|
+
.terms a {
|
|
10322
|
+
color: var(--consent-link, var(--cs-action, currentColor));
|
|
10323
|
+
text-decoration: underline;
|
|
10324
|
+
text-underline-offset: 2px;
|
|
10325
|
+
}
|
|
10326
|
+
|
|
9874
10327
|
/* The receipt. */
|
|
9875
10328
|
.receipt {
|
|
9876
10329
|
display: flex;
|
|
@@ -10077,7 +10530,48 @@ function signatureOf(value) {
|
|
|
10077
10530
|
return String(value);
|
|
10078
10531
|
}
|
|
10079
10532
|
var blockName = (key) => key.split("#")[0];
|
|
10080
|
-
var
|
|
10533
|
+
var MOVES = ["flow", "step"];
|
|
10534
|
+
var SPOT_X = 8;
|
|
10535
|
+
var SPOT_Y = 6;
|
|
10536
|
+
var LABEL_ROOM = 10;
|
|
10537
|
+
function within(container, node) {
|
|
10538
|
+
while (node) {
|
|
10539
|
+
if (node === container) return true;
|
|
10540
|
+
node = node.parentNode ?? node.host ?? null;
|
|
10541
|
+
}
|
|
10542
|
+
return false;
|
|
10543
|
+
}
|
|
10544
|
+
function inset(rect, by) {
|
|
10545
|
+
return new DOMRect(
|
|
10546
|
+
rect.left + by,
|
|
10547
|
+
rect.top + by,
|
|
10548
|
+
rect.width - 2 * by,
|
|
10549
|
+
rect.height - 2 * by
|
|
10550
|
+
);
|
|
10551
|
+
}
|
|
10552
|
+
function ringRadius(region) {
|
|
10553
|
+
const box = region.getBoundingClientRect();
|
|
10554
|
+
for (const el of [region, region.firstElementChild]) {
|
|
10555
|
+
if (!el) continue;
|
|
10556
|
+
const r8 = el.getBoundingClientRect();
|
|
10557
|
+
if (Math.abs(r8.width - box.width) > 1 || Math.abs(r8.height - box.height) > 1)
|
|
10558
|
+
continue;
|
|
10559
|
+
const radius = parseFloat(getComputedStyle(el).borderTopLeftRadius) || 0;
|
|
10560
|
+
if (radius > 0) return radius + SPOT_Y;
|
|
10561
|
+
}
|
|
10562
|
+
return 8;
|
|
10563
|
+
}
|
|
10564
|
+
var isField = (name) => FLOW_FIELDS.includes(name ?? "");
|
|
10565
|
+
var termsKey = (terms) => terms ? JSON.stringify([terms.label, terms.href, terms.version]) : "";
|
|
10566
|
+
function brandRule(brand, theme) {
|
|
10567
|
+
if (!brand) return "";
|
|
10568
|
+
try {
|
|
10569
|
+
const declarations = Object.entries(brandTokens(brand, theme)).map(([property, value]) => `${property}: ${value};`).join(" ");
|
|
10570
|
+
return `:host { ${declarations} }`;
|
|
10571
|
+
} catch {
|
|
10572
|
+
return "";
|
|
10573
|
+
}
|
|
10574
|
+
}
|
|
10081
10575
|
var ConsentFlow = class extends i4 {
|
|
10082
10576
|
constructor() {
|
|
10083
10577
|
super();
|
|
@@ -10085,6 +10579,10 @@ var ConsentFlow = class extends i4 {
|
|
|
10085
10579
|
this.copy = {};
|
|
10086
10580
|
this.step = "";
|
|
10087
10581
|
this.theme = "light";
|
|
10582
|
+
this.legal = [];
|
|
10583
|
+
this.highlight = "";
|
|
10584
|
+
this.highlightMode = "select";
|
|
10585
|
+
this.highlightLabel = "";
|
|
10088
10586
|
this.preview = false;
|
|
10089
10587
|
this.selected = /* @__PURE__ */ new Set();
|
|
10090
10588
|
this.resolved = null;
|
|
@@ -10093,12 +10591,18 @@ var ConsentFlow = class extends i4 {
|
|
|
10093
10591
|
this.atRest = null;
|
|
10094
10592
|
this.pointerInside = false;
|
|
10095
10593
|
this.generation = 0;
|
|
10594
|
+
this.motionDone = Promise.resolve();
|
|
10595
|
+
this.termsAccepted = false;
|
|
10596
|
+
this.acceptedTerms = "";
|
|
10597
|
+
this.resizes = null;
|
|
10096
10598
|
this.onDocumentPointer = (event) => {
|
|
10097
10599
|
this.pointerInside = event.composedPath().includes(this);
|
|
10098
10600
|
};
|
|
10099
10601
|
this.onAllow = (event) => {
|
|
10100
10602
|
event.stopPropagation();
|
|
10101
10603
|
if (this.fromLeaving(event)) return;
|
|
10604
|
+
const terms = this.terms;
|
|
10605
|
+
if (terms && !this.termsAccepted) return;
|
|
10102
10606
|
const ticked = (this.data?.capabilities ?? []).filter(
|
|
10103
10607
|
(cap) => this.selected.has(cap.id)
|
|
10104
10608
|
);
|
|
@@ -10108,11 +10612,76 @@ var ConsentFlow = class extends i4 {
|
|
|
10108
10612
|
this.init({
|
|
10109
10613
|
capabilities: ticked.map((cap) => cap.id),
|
|
10110
10614
|
scopes: [...new Set(ticked.flatMap((cap) => cap.scopes))],
|
|
10111
|
-
approvalMethod: this.flow.approvalMethod
|
|
10615
|
+
approvalMethod: this.flow.approvalMethod,
|
|
10616
|
+
// Without terms the fields stay out: a server reads an explicit
|
|
10617
|
+
// false as refused.
|
|
10618
|
+
...terms ? { termsAccepted: true } : {},
|
|
10619
|
+
...terms?.version !== void 0 ? { termsVersion: terms.version } : {}
|
|
10112
10620
|
})
|
|
10113
10621
|
)
|
|
10114
10622
|
);
|
|
10115
10623
|
};
|
|
10624
|
+
/** The terms box: its tick is the person's, in a preview too. */
|
|
10625
|
+
this.onChange = (event) => {
|
|
10626
|
+
const target = event.target;
|
|
10627
|
+
if (target?.dataset?.action !== "terms" || this.fromLeaving(event)) return;
|
|
10628
|
+
this.termsAccepted = target.checked;
|
|
10629
|
+
this.requestUpdate();
|
|
10630
|
+
};
|
|
10631
|
+
/** In a preview, a click names the region it landed in, for the editor's rail. */
|
|
10632
|
+
this.onFieldClick = (event) => {
|
|
10633
|
+
if (!this.preview || this.fromLeaving(event)) return;
|
|
10634
|
+
const field = this.fieldAt(event);
|
|
10635
|
+
if (!field) return;
|
|
10636
|
+
this.dispatchEvent(
|
|
10637
|
+
new CustomEvent(
|
|
10638
|
+
"consent-flow-field",
|
|
10639
|
+
this.init({ field })
|
|
10640
|
+
)
|
|
10641
|
+
);
|
|
10642
|
+
};
|
|
10643
|
+
/** Outlines the highlighted region, in a preview; fades the outline out otherwise. */
|
|
10644
|
+
this.placeSpotlight = () => {
|
|
10645
|
+
const spot = this.renderRoot.querySelector(".spotlight");
|
|
10646
|
+
const flow2 = this.renderRoot.querySelector(".flow");
|
|
10647
|
+
const card = this.card;
|
|
10648
|
+
if (!spot || !flow2 || !card) return;
|
|
10649
|
+
const region = this.preview && this.highlight ? this.regionOf(this.highlight) : null;
|
|
10650
|
+
if (!region) {
|
|
10651
|
+
delete spot.dataset.shown;
|
|
10652
|
+
return;
|
|
10653
|
+
}
|
|
10654
|
+
const outer = flow2.getBoundingClientRect();
|
|
10655
|
+
const scale = flow2.offsetWidth > 0 ? outer.width / flow2.offsetWidth : 1;
|
|
10656
|
+
const box = region.getBoundingClientRect();
|
|
10657
|
+
const clip = within(card, region) ? inset(card.getBoundingClientRect(), card.clientLeft * scale) : outer;
|
|
10658
|
+
const left = Math.max(box.left - SPOT_X * scale, clip.left);
|
|
10659
|
+
const top = Math.max(box.top - SPOT_Y * scale, clip.top);
|
|
10660
|
+
const right = Math.min(box.right + SPOT_X * scale, clip.right);
|
|
10661
|
+
const bottom = Math.min(box.bottom + SPOT_Y * scale, clip.bottom);
|
|
10662
|
+
const x3 = (left - outer.left) / scale;
|
|
10663
|
+
const y4 = (top - outer.top) / scale;
|
|
10664
|
+
const first = spot.dataset.shown === void 0;
|
|
10665
|
+
if (first) spot.classList.add("placing");
|
|
10666
|
+
spot.style.transform = `translate(${x3}px, ${y4}px)`;
|
|
10667
|
+
spot.style.width = `${(right - left) / scale}px`;
|
|
10668
|
+
spot.style.height = `${(bottom - top) / scale}px`;
|
|
10669
|
+
spot.style.borderRadius = `${ringRadius(region)}px`;
|
|
10670
|
+
spot.dataset.mode = this.highlightMode === "hover" ? "hover" : "select";
|
|
10671
|
+
const ghost = Boolean(region.querySelector(":scope > .ghost"));
|
|
10672
|
+
const label = [this.highlightLabel.trim(), ghost ? "Empty" : ""].filter(Boolean).join(" \xB7 ");
|
|
10673
|
+
const tag = spot.querySelector(".spot-label");
|
|
10674
|
+
if (tag) {
|
|
10675
|
+
tag.textContent = label;
|
|
10676
|
+
tag.hidden = !label;
|
|
10677
|
+
tag.dataset.below = String(y4 < LABEL_ROOM);
|
|
10678
|
+
}
|
|
10679
|
+
if (first) {
|
|
10680
|
+
void spot.offsetWidth;
|
|
10681
|
+
spot.classList.remove("placing");
|
|
10682
|
+
}
|
|
10683
|
+
spot.dataset.shown = "";
|
|
10684
|
+
};
|
|
10116
10685
|
this.onDeny = (event) => {
|
|
10117
10686
|
event.stopPropagation();
|
|
10118
10687
|
if (!this.fromLeaving(event))
|
|
@@ -10146,7 +10715,7 @@ var ConsentFlow = class extends i4 {
|
|
|
10146
10715
|
const target = event.target?.closest?.(
|
|
10147
10716
|
"[data-action]"
|
|
10148
10717
|
);
|
|
10149
|
-
if (!target || this.fromLeaving(event)) return;
|
|
10718
|
+
if (!target || this.preview || this.fromLeaving(event)) return;
|
|
10150
10719
|
if (target.dataset.action === "sign-in") {
|
|
10151
10720
|
this.dispatchEvent(
|
|
10152
10721
|
new CustomEvent(
|
|
@@ -10169,6 +10738,26 @@ var ConsentFlow = class extends i4 {
|
|
|
10169
10738
|
get currentStep() {
|
|
10170
10739
|
return this.resolved;
|
|
10171
10740
|
}
|
|
10741
|
+
/**
|
|
10742
|
+
* Where a region is drawn now, in viewport coordinates: the box `highlight`
|
|
10743
|
+
* outlines (Approve and Deny each their own button). Null when this step
|
|
10744
|
+
* draws no such region. A box that is moving between steps reads where it
|
|
10745
|
+
* is drawn this frame, so after a step change read it once `whenSettled()`
|
|
10746
|
+
* resolves.
|
|
10747
|
+
*
|
|
10748
|
+
* @example
|
|
10749
|
+
* flowEl.step = "granted";
|
|
10750
|
+
* await flowEl.whenSettled();
|
|
10751
|
+
* flowEl.fieldRect("headline"); // DOMRect
|
|
10752
|
+
*/
|
|
10753
|
+
fieldRect(field) {
|
|
10754
|
+
return isField(field) ? this.regionOf(field)?.getBoundingClientRect() ?? null : null;
|
|
10755
|
+
}
|
|
10756
|
+
/** Resolves once the last change is drawn and its motion has finished (at once when nothing moves). */
|
|
10757
|
+
async whenSettled() {
|
|
10758
|
+
await this.updateComplete;
|
|
10759
|
+
await this.motionDone;
|
|
10760
|
+
}
|
|
10172
10761
|
connectedCallback() {
|
|
10173
10762
|
super.connectedCallback();
|
|
10174
10763
|
document.addEventListener("pointerdown", this.onDocumentPointer, true);
|
|
@@ -10176,6 +10765,8 @@ var ConsentFlow = class extends i4 {
|
|
|
10176
10765
|
disconnectedCallback() {
|
|
10177
10766
|
super.disconnectedCallback();
|
|
10178
10767
|
document.removeEventListener("pointerdown", this.onDocumentPointer, true);
|
|
10768
|
+
this.resizes?.disconnect();
|
|
10769
|
+
this.resizes = null;
|
|
10179
10770
|
}
|
|
10180
10771
|
get card() {
|
|
10181
10772
|
return this.renderRoot.querySelector(".card");
|
|
@@ -10186,15 +10777,20 @@ var ConsentFlow = class extends i4 {
|
|
|
10186
10777
|
willUpdate(changed) {
|
|
10187
10778
|
if (changed.has("data"))
|
|
10188
10779
|
this.reselect(changed.get("data"));
|
|
10780
|
+
if (changed.has("terms") && termsKey(this.terms) !== this.acceptedTerms) {
|
|
10781
|
+
this.termsAccepted = false;
|
|
10782
|
+
this.acceptedTerms = termsKey(this.terms);
|
|
10783
|
+
}
|
|
10189
10784
|
const steps = this.flow.steps;
|
|
10190
10785
|
const wanted = this.step;
|
|
10191
|
-
const
|
|
10786
|
+
const swapped = this.hasUpdated && changed.has("flow");
|
|
10787
|
+
const resolved = wanted && steps[wanted] ? wanted : swapped && wanted && steps.consent ? "consent" : this.flow.initial;
|
|
10192
10788
|
if (this.step !== resolved) this.step = resolved;
|
|
10193
10789
|
this.resolved = resolved;
|
|
10194
10790
|
this.atRest = null;
|
|
10195
10791
|
const card = this.card;
|
|
10196
10792
|
const fx = this.fx;
|
|
10197
|
-
if (!this.hasUpdated || !card || !fx || !
|
|
10793
|
+
if (!this.hasUpdated || !card || !fx || !MOVES.some((key) => changed.has(key)))
|
|
10198
10794
|
return;
|
|
10199
10795
|
settle(card);
|
|
10200
10796
|
fx.replaceChildren();
|
|
@@ -10245,6 +10841,30 @@ var ConsentFlow = class extends i4 {
|
|
|
10245
10841
|
const fx = this.fx;
|
|
10246
10842
|
return Boolean(fx && event.composedPath().includes(fx));
|
|
10247
10843
|
}
|
|
10844
|
+
/** The innermost region on an event's path, through the package's own shadow roots. */
|
|
10845
|
+
fieldAt(event) {
|
|
10846
|
+
for (const node of event.composedPath()) {
|
|
10847
|
+
if (node === this) return null;
|
|
10848
|
+
if (!(node instanceof HTMLElement)) continue;
|
|
10849
|
+
const name = node.dataset.field ?? node.dataset.block;
|
|
10850
|
+
if (isField(name)) return name;
|
|
10851
|
+
}
|
|
10852
|
+
return null;
|
|
10853
|
+
}
|
|
10854
|
+
/** The element a region is drawn by: the innermost one, inside the package's own parts too. */
|
|
10855
|
+
regionOf(field) {
|
|
10856
|
+
const selector = `[data-field="${field}"]`;
|
|
10857
|
+
const root = this.renderRoot;
|
|
10858
|
+
const own = root.querySelector(selector) ?? root.querySelector(`.card > [data-block="${field}"]`);
|
|
10859
|
+
if (own) return own;
|
|
10860
|
+
for (const host of root.querySelectorAll(
|
|
10861
|
+
"consent-action-bar, consent-connector-header"
|
|
10862
|
+
)) {
|
|
10863
|
+
const inner = host.shadowRoot?.querySelector(selector);
|
|
10864
|
+
if (inner) return inner;
|
|
10865
|
+
}
|
|
10866
|
+
return null;
|
|
10867
|
+
}
|
|
10248
10868
|
specs(data, step, copy) {
|
|
10249
10869
|
const ctx = {
|
|
10250
10870
|
data,
|
|
@@ -10253,7 +10873,9 @@ var ConsentFlow = class extends i4 {
|
|
|
10253
10873
|
selected: this.selected,
|
|
10254
10874
|
method: this.flow.approvalMethod,
|
|
10255
10875
|
preview: this.preview,
|
|
10256
|
-
values: flowValues(data)
|
|
10876
|
+
values: flowValues(data),
|
|
10877
|
+
...this.terms ? { terms: this.terms } : {},
|
|
10878
|
+
termsAccepted: this.termsAccepted
|
|
10257
10879
|
};
|
|
10258
10880
|
const seen = /* @__PURE__ */ new Map();
|
|
10259
10881
|
const specs = [];
|
|
@@ -10261,7 +10883,9 @@ var ConsentFlow = class extends i4 {
|
|
|
10261
10883
|
const [name, variant] = ref.split(":");
|
|
10262
10884
|
const draw = FLOW_BLOCK_RENDERERS[name];
|
|
10263
10885
|
if (!draw) continue;
|
|
10264
|
-
|
|
10886
|
+
let result = draw(variant ? { ...ctx, variant } : ctx);
|
|
10887
|
+
if (result === A && this.preview && this.highlight === name)
|
|
10888
|
+
result = b2`<div class="ghost" part="ghost"></div>`;
|
|
10265
10889
|
if (result === A) continue;
|
|
10266
10890
|
const n6 = (seen.get(name) ?? 0) + 1;
|
|
10267
10891
|
seen.set(name, n6);
|
|
@@ -10282,15 +10906,24 @@ var ConsentFlow = class extends i4 {
|
|
|
10282
10906
|
);
|
|
10283
10907
|
const seal = fillTemplate(group(copy, "seal")[def.connector] ?? "", values);
|
|
10284
10908
|
const announce = fillTemplate(group(copy, "announce")[step] ?? "", values);
|
|
10909
|
+
const legal = this.legal.filter((link) => httpsUrl(link.href));
|
|
10285
10910
|
return b2`<style>
|
|
10286
10911
|
${themeScopeStyle(
|
|
10287
10912
|
getConsentTheme(this.theme),
|
|
10288
|
-
".card,
|
|
10913
|
+
".card",
|
|
10914
|
+
"consent-connector-header, .below"
|
|
10289
10915
|
)}
|
|
10916
|
+
${brandRule(this.brand, this.theme)}
|
|
10290
10917
|
</style>
|
|
10291
|
-
<div
|
|
10918
|
+
<div
|
|
10919
|
+
class="flow"
|
|
10920
|
+
data-step=${step}
|
|
10921
|
+
data-motion=${this.flow.motion}
|
|
10922
|
+
@click=${this.onFieldClick}
|
|
10923
|
+
>
|
|
10292
10924
|
<consent-connector-header
|
|
10293
10925
|
part="connector"
|
|
10926
|
+
data-field="connector"
|
|
10294
10927
|
variant="bridge"
|
|
10295
10928
|
.clientName=${data.agent.name}
|
|
10296
10929
|
.clientLogoUrl=${data.agent.logoUrl ?? ""}
|
|
@@ -10308,6 +10941,7 @@ var ConsentFlow = class extends i4 {
|
|
|
10308
10941
|
class="card"
|
|
10309
10942
|
part="card"
|
|
10310
10943
|
@click=${this.onClick}
|
|
10944
|
+
@change=${this.onChange}
|
|
10311
10945
|
@consent-allow=${this.onAllow}
|
|
10312
10946
|
@consent-deny=${this.onDeny}
|
|
10313
10947
|
@consent-request-expired=${this.onExpired}
|
|
@@ -10328,11 +10962,31 @@ var ConsentFlow = class extends i4 {
|
|
|
10328
10962
|
</div>
|
|
10329
10963
|
<div class="below" part="below">
|
|
10330
10964
|
<consent-secured-by></consent-secured-by>
|
|
10965
|
+
${legal.length > 0 ? b2`<nav
|
|
10966
|
+
class="legal"
|
|
10967
|
+
part="legal"
|
|
10968
|
+
data-field="legal"
|
|
10969
|
+
aria-label=${group(copy, "legal").label ?? "Legal"}
|
|
10970
|
+
>
|
|
10971
|
+
${legal.map(
|
|
10972
|
+
(link) => b2`<a
|
|
10973
|
+
href=${link.href}
|
|
10974
|
+
target="_blank"
|
|
10975
|
+
rel="noopener noreferrer"
|
|
10976
|
+
>${link.label}</a
|
|
10977
|
+
>`
|
|
10978
|
+
)}
|
|
10979
|
+
</nav>` : A}
|
|
10331
10980
|
</div>
|
|
10332
10981
|
<p class="sr" role="status">${announce}</p>
|
|
10982
|
+
<div class="spotlight" aria-hidden="true">
|
|
10983
|
+
<span class="spot-label" hidden></span>
|
|
10984
|
+
</div>
|
|
10333
10985
|
</div>`;
|
|
10334
10986
|
}
|
|
10335
10987
|
updated(changed) {
|
|
10988
|
+
this.watchLayout();
|
|
10989
|
+
this.placeSpotlight();
|
|
10336
10990
|
this.setAttribute(FLOW_HOST_ATTRIBUTES.version, String(this.flow.version));
|
|
10337
10991
|
this.setAttribute(
|
|
10338
10992
|
FLOW_HOST_ATTRIBUTES.approvalMethod,
|
|
@@ -10355,6 +11009,15 @@ var ConsentFlow = class extends i4 {
|
|
|
10355
11009
|
}
|
|
10356
11010
|
if (before) this.animateStep(before);
|
|
10357
11011
|
}
|
|
11012
|
+
/** Moves the outline with the card: a resize, a font loading, a step settling. */
|
|
11013
|
+
watchLayout() {
|
|
11014
|
+
if (this.resizes || typeof ResizeObserver === "undefined") return;
|
|
11015
|
+
const card = this.card;
|
|
11016
|
+
if (!card) return;
|
|
11017
|
+
this.resizes = new ResizeObserver(this.placeSpotlight);
|
|
11018
|
+
this.resizes.observe(card);
|
|
11019
|
+
this.resizes.observe(this);
|
|
11020
|
+
}
|
|
10358
11021
|
/** The step's `focus` block takes focus: its own target (`tabindex="-1"`), else its first control. */
|
|
10359
11022
|
focusStep(step) {
|
|
10360
11023
|
const key = this.flow.steps[step]?.focus;
|
|
@@ -10415,10 +11078,12 @@ var ConsentFlow = class extends i4 {
|
|
|
10415
11078
|
else play2("arrive", name, arrive(el, arrivals++, t8));
|
|
10416
11079
|
}
|
|
10417
11080
|
const generation = ++this.generation;
|
|
10418
|
-
|
|
11081
|
+
this.motionDone = Promise.allSettled(
|
|
10419
11082
|
started.map((animation) => animation.finished)
|
|
10420
11083
|
).then(() => {
|
|
10421
|
-
if (generation
|
|
11084
|
+
if (generation !== this.generation) return;
|
|
11085
|
+
card.classList.remove("moving");
|
|
11086
|
+
this.placeSpotlight();
|
|
10422
11087
|
});
|
|
10423
11088
|
}
|
|
10424
11089
|
};
|
|
@@ -10429,12 +11094,104 @@ ConsentFlow.styles = i`
|
|
|
10429
11094
|
text-wrap: pretty;
|
|
10430
11095
|
}
|
|
10431
11096
|
|
|
11097
|
+
/* A preview shows the brand's page behind the card, which a live page
|
|
11098
|
+
paints on its body; with none, the editor's own shows through. */
|
|
11099
|
+
:host([preview]) {
|
|
11100
|
+
background-color: var(--cs-surface-bg);
|
|
11101
|
+
}
|
|
11102
|
+
|
|
10432
11103
|
.flow {
|
|
11104
|
+
position: relative;
|
|
10433
11105
|
box-sizing: border-box;
|
|
10434
11106
|
max-width: var(--cs-screen-max-width, 576px);
|
|
10435
11107
|
margin: 0 auto;
|
|
10436
11108
|
}
|
|
10437
11109
|
|
|
11110
|
+
/* The editor's focused field, outlined over the flow in a preview. */
|
|
11111
|
+
/* The editor's highlight: a selection over the flow, in an editor
|
|
11112
|
+
accent (not the brand, not ink). It never takes layout. */
|
|
11113
|
+
.spotlight {
|
|
11114
|
+
--_accent: var(--cs-edit-focus-ring, #6d5ae6);
|
|
11115
|
+
position: absolute;
|
|
11116
|
+
top: 0;
|
|
11117
|
+
left: 0;
|
|
11118
|
+
box-sizing: border-box;
|
|
11119
|
+
border: 1.5px solid var(--_accent);
|
|
11120
|
+
border-radius: 8px;
|
|
11121
|
+
background: var(
|
|
11122
|
+
--cs-edit-wash,
|
|
11123
|
+
color-mix(in srgb, var(--_accent) 6%, transparent)
|
|
11124
|
+
);
|
|
11125
|
+
opacity: 0;
|
|
11126
|
+
pointer-events: none;
|
|
11127
|
+
z-index: 6;
|
|
11128
|
+
transition:
|
|
11129
|
+
opacity 120ms ease-out,
|
|
11130
|
+
transform 180ms ease-out,
|
|
11131
|
+
width 180ms ease-out,
|
|
11132
|
+
height 180ms ease-out;
|
|
11133
|
+
}
|
|
11134
|
+
|
|
11135
|
+
.spotlight[data-shown] {
|
|
11136
|
+
opacity: 1;
|
|
11137
|
+
}
|
|
11138
|
+
|
|
11139
|
+
.spotlight[data-mode="hover"] {
|
|
11140
|
+
border: 1px dashed var(--cs-edit-hover-ring, var(--_accent));
|
|
11141
|
+
background: none;
|
|
11142
|
+
}
|
|
11143
|
+
|
|
11144
|
+
/* A first show lands in place; reduced motion and the none preset fade only. */
|
|
11145
|
+
.spotlight.placing,
|
|
11146
|
+
.flow[data-motion="none"] .spotlight {
|
|
11147
|
+
transition: opacity 120ms ease-out;
|
|
11148
|
+
}
|
|
11149
|
+
|
|
11150
|
+
@media (prefers-reduced-motion: reduce) {
|
|
11151
|
+
.spotlight {
|
|
11152
|
+
transition: opacity 120ms ease-out;
|
|
11153
|
+
}
|
|
11154
|
+
}
|
|
11155
|
+
|
|
11156
|
+
/* The field's name, on the ring's top edge like a legend, so it reaches
|
|
11157
|
+
into the gap above rather than over the block before. */
|
|
11158
|
+
.spot-label {
|
|
11159
|
+
position: absolute;
|
|
11160
|
+
top: 0;
|
|
11161
|
+
left: 10px;
|
|
11162
|
+
transform: translateY(-50%);
|
|
11163
|
+
padding: 2px 6px;
|
|
11164
|
+
border-radius: 4px;
|
|
11165
|
+
background: var(--_accent);
|
|
11166
|
+
/* Themable with the accent: text on it stays readable. */
|
|
11167
|
+
color: var(--cs-edit-on-accent, #ffffff);
|
|
11168
|
+
font:
|
|
11169
|
+
600 10px/14px system-ui,
|
|
11170
|
+
-apple-system,
|
|
11171
|
+
"Segoe UI",
|
|
11172
|
+
sans-serif;
|
|
11173
|
+
letter-spacing: 0.06em;
|
|
11174
|
+
text-transform: uppercase;
|
|
11175
|
+
white-space: nowrap;
|
|
11176
|
+
}
|
|
11177
|
+
|
|
11178
|
+
.spot-label[data-below="true"] {
|
|
11179
|
+
top: 100%;
|
|
11180
|
+
}
|
|
11181
|
+
|
|
11182
|
+
.spot-label[hidden] {
|
|
11183
|
+
display: none;
|
|
11184
|
+
}
|
|
11185
|
+
|
|
11186
|
+
/* Where a highlighted field's words will go, before it has any. */
|
|
11187
|
+
.ghost {
|
|
11188
|
+
box-sizing: border-box;
|
|
11189
|
+
height: 28px;
|
|
11190
|
+
border: 1px dashed
|
|
11191
|
+
color-mix(in srgb, var(--cs-edit-focus-ring, #6d5ae6) 55%, transparent);
|
|
11192
|
+
border-radius: 6px;
|
|
11193
|
+
}
|
|
11194
|
+
|
|
10438
11195
|
.card {
|
|
10439
11196
|
position: relative;
|
|
10440
11197
|
display: flex;
|
|
@@ -10475,10 +11232,25 @@ ConsentFlow.styles = i`
|
|
|
10475
11232
|
display: flex;
|
|
10476
11233
|
flex-direction: column;
|
|
10477
11234
|
align-items: center;
|
|
11235
|
+
gap: 10px;
|
|
10478
11236
|
margin-top: 16px;
|
|
10479
11237
|
color: var(--cs-text-tertiary);
|
|
10480
11238
|
}
|
|
10481
11239
|
|
|
11240
|
+
.legal {
|
|
11241
|
+
display: flex;
|
|
11242
|
+
flex-wrap: wrap;
|
|
11243
|
+
justify-content: center;
|
|
11244
|
+
gap: 4px 20px;
|
|
11245
|
+
font-size: 12px;
|
|
11246
|
+
}
|
|
11247
|
+
|
|
11248
|
+
.legal a {
|
|
11249
|
+
color: inherit;
|
|
11250
|
+
text-decoration: underline;
|
|
11251
|
+
text-underline-offset: 2px;
|
|
11252
|
+
}
|
|
11253
|
+
|
|
10482
11254
|
.sr {
|
|
10483
11255
|
position: absolute;
|
|
10484
11256
|
width: 1px;
|
|
@@ -10506,6 +11278,24 @@ __decorateClass([
|
|
|
10506
11278
|
__decorateClass([
|
|
10507
11279
|
n4({ type: String })
|
|
10508
11280
|
], ConsentFlow.prototype, "theme", 2);
|
|
11281
|
+
__decorateClass([
|
|
11282
|
+
n4({ attribute: false })
|
|
11283
|
+
], ConsentFlow.prototype, "brand", 2);
|
|
11284
|
+
__decorateClass([
|
|
11285
|
+
n4({ attribute: false })
|
|
11286
|
+
], ConsentFlow.prototype, "legal", 2);
|
|
11287
|
+
__decorateClass([
|
|
11288
|
+
n4({ attribute: false })
|
|
11289
|
+
], ConsentFlow.prototype, "terms", 2);
|
|
11290
|
+
__decorateClass([
|
|
11291
|
+
n4({ type: String })
|
|
11292
|
+
], ConsentFlow.prototype, "highlight", 2);
|
|
11293
|
+
__decorateClass([
|
|
11294
|
+
n4({ type: String, attribute: "highlight-mode" })
|
|
11295
|
+
], ConsentFlow.prototype, "highlightMode", 2);
|
|
11296
|
+
__decorateClass([
|
|
11297
|
+
n4({ type: String, attribute: "highlight-label" })
|
|
11298
|
+
], ConsentFlow.prototype, "highlightLabel", 2);
|
|
10509
11299
|
__decorateClass([
|
|
10510
11300
|
n4({ type: Boolean, reflect: true })
|
|
10511
11301
|
], ConsentFlow.prototype, "preview", 2);
|
|
@@ -12973,215 +13763,6 @@ McpConsent = __decorateClass([
|
|
|
12973
13763
|
t3("mcp-consent")
|
|
12974
13764
|
], McpConsent);
|
|
12975
13765
|
|
|
12976
|
-
// src/styles/brand.ts
|
|
12977
|
-
var AA_GRAPHIC_CONTRAST = 3;
|
|
12978
|
-
var TEXT_CONTRAST = 4.5;
|
|
12979
|
-
var ICON_TILE_PERCENT = 8;
|
|
12980
|
-
var HOVERED_ROW_PERCENT = 4;
|
|
12981
|
-
var MUTED_TEXT_PERCENT = 64;
|
|
12982
|
-
var PANEL_TINT_PERCENT = 4;
|
|
12983
|
-
var LIGHTNESS_STEP = 5e-3;
|
|
12984
|
-
var LIGHT_DRAWN_COLORS = Object.freeze({
|
|
12985
|
-
surface: lightTheme.surfaceCard,
|
|
12986
|
-
panel: lightTheme.surfaceInset,
|
|
12987
|
-
text: lightTheme.textPrimary,
|
|
12988
|
-
mutedText: lightTheme.textTertiary
|
|
12989
|
-
});
|
|
12990
|
-
var PALETTE_FIELDS = [
|
|
12991
|
-
"surfaceColor",
|
|
12992
|
-
"panelColor",
|
|
12993
|
-
"borderColor",
|
|
12994
|
-
"textColor",
|
|
12995
|
-
"mutedTextColor",
|
|
12996
|
-
"focusColor"
|
|
12997
|
-
];
|
|
12998
|
-
function rgbOf(hex) {
|
|
12999
|
-
return [1, 3, 5].map((at) => Number.parseInt(hex.slice(at, at + 2), 16));
|
|
13000
|
-
}
|
|
13001
|
-
function hexOf(channels2) {
|
|
13002
|
-
return `#${channels2.map((value) => Math.round(value).toString(16).padStart(2, "0")).join("")}`;
|
|
13003
|
-
}
|
|
13004
|
-
function mixOver(top, percent, under) {
|
|
13005
|
-
const share = percent / 100;
|
|
13006
|
-
const below = rgbOf(under);
|
|
13007
|
-
return hexOf(
|
|
13008
|
-
rgbOf(top).map((above, i8) => above * share + below[i8] * (1 - share))
|
|
13009
|
-
);
|
|
13010
|
-
}
|
|
13011
|
-
function hslOf(hex) {
|
|
13012
|
-
const [red, green, blue] = rgbOf(hex).map((value) => value / 255);
|
|
13013
|
-
const high = Math.max(red, green, blue);
|
|
13014
|
-
const low = Math.min(red, green, blue);
|
|
13015
|
-
const spread = high - low;
|
|
13016
|
-
const lightness = (high + low) / 2;
|
|
13017
|
-
if (spread === 0) return { hue: 0, saturation: 0, lightness };
|
|
13018
|
-
const saturation = spread / (1 - Math.abs(2 * lightness - 1));
|
|
13019
|
-
const sector = high === red ? (green - blue) / spread : high === green ? (blue - red) / spread + 2 : (red - green) / spread + 4;
|
|
13020
|
-
return { hue: (sector * 60 + 360) % 360, saturation, lightness };
|
|
13021
|
-
}
|
|
13022
|
-
function hexFromHsl({ hue, saturation, lightness }) {
|
|
13023
|
-
const reach = saturation * Math.min(lightness, 1 - lightness);
|
|
13024
|
-
const channel = (offset) => {
|
|
13025
|
-
const turn = (offset + hue / 30) % 12;
|
|
13026
|
-
return (lightness - reach * Math.max(-1, Math.min(turn - 3, 9 - turn, 1))) * 255;
|
|
13027
|
-
};
|
|
13028
|
-
return hexOf([channel(0), channel(8), channel(4)]);
|
|
13029
|
-
}
|
|
13030
|
-
function iconColorFor(hex, primary, drawn = LIGHT_DRAWN_COLORS) {
|
|
13031
|
-
const hoveredRow = mixOver(primary, HOVERED_ROW_PERCENT, drawn.surface);
|
|
13032
|
-
const surfaces = [
|
|
13033
|
-
drawn.surface,
|
|
13034
|
-
drawn.panel,
|
|
13035
|
-
mixOver(primary, ICON_TILE_PERCENT, drawn.surface),
|
|
13036
|
-
mixOver(primary, ICON_TILE_PERCENT, hoveredRow)
|
|
13037
|
-
];
|
|
13038
|
-
const worstRatio = (candidate) => Math.min(...surfaces.map((surface) => contrastRatio(candidate, surface)));
|
|
13039
|
-
if (worstRatio(hex) >= AA_GRAPHIC_CONTRAST) return hex;
|
|
13040
|
-
const start = hslOf(hex);
|
|
13041
|
-
for (let steps = 1; steps * LIGHTNESS_STEP <= 1; steps++) {
|
|
13042
|
-
for (const lightness of [
|
|
13043
|
-
start.lightness - steps * LIGHTNESS_STEP,
|
|
13044
|
-
start.lightness + steps * LIGHTNESS_STEP
|
|
13045
|
-
]) {
|
|
13046
|
-
if (lightness < 0 || lightness > 1) continue;
|
|
13047
|
-
const candidate = hexFromHsl({ ...start, lightness });
|
|
13048
|
-
if (worstRatio(candidate) >= AA_GRAPHIC_CONTRAST) return candidate;
|
|
13049
|
-
}
|
|
13050
|
-
}
|
|
13051
|
-
return worstRatio("#000000") >= worstRatio("#ffffff") ? "#000000" : "#ffffff";
|
|
13052
|
-
}
|
|
13053
|
-
function focusRingFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
13054
|
-
return contrastRatio(hex, surface) >= AA_GRAPHIC_CONTRAST ? "brand" : "ink";
|
|
13055
|
-
}
|
|
13056
|
-
function readsOnCardAndTint(hex, ratio, surface) {
|
|
13057
|
-
const tint = mixOver(hex, TINT_PERCENT, surface);
|
|
13058
|
-
return contrastRatio(hex, surface) >= ratio && contrastRatio(hex, tint) >= ratio;
|
|
13059
|
-
}
|
|
13060
|
-
function actionColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
13061
|
-
return readsOnCardAndTint(hex, TEXT_CONTRAST, surface) ? "brand" : "ink";
|
|
13062
|
-
}
|
|
13063
|
-
function markColorFor(hex, surface = LIGHT_DRAWN_COLORS.surface) {
|
|
13064
|
-
return readsOnCardAndTint(hex, AA_GRAPHIC_CONTRAST, surface) ? "brand" : "ink";
|
|
13065
|
-
}
|
|
13066
|
-
function onPrimaryFor(hex) {
|
|
13067
|
-
const luminance = relativeLuminance(hex);
|
|
13068
|
-
const againstWhite = 1.05 / (luminance + 0.05);
|
|
13069
|
-
const againstBlack = (luminance + 0.05) / 0.05;
|
|
13070
|
-
return againstBlack >= againstWhite ? "black" : "white";
|
|
13071
|
-
}
|
|
13072
|
-
function panelOf(palette, text, drawn) {
|
|
13073
|
-
if (palette.panelColor) return palette.panelColor;
|
|
13074
|
-
if (palette.surfaceColor)
|
|
13075
|
-
return mixOver(text, PANEL_TINT_PERCENT, palette.surfaceColor);
|
|
13076
|
-
return drawn.panel;
|
|
13077
|
-
}
|
|
13078
|
-
function mutedOn(palette, background, drawn) {
|
|
13079
|
-
if (palette.mutedTextColor) return palette.mutedTextColor;
|
|
13080
|
-
if (palette.textColor)
|
|
13081
|
-
return mixOver(palette.textColor, MUTED_TEXT_PERCENT, background);
|
|
13082
|
-
return drawn.mutedText;
|
|
13083
|
-
}
|
|
13084
|
-
function floorToHundredths(ratio) {
|
|
13085
|
-
return Math.floor(ratio * 100) / 100;
|
|
13086
|
-
}
|
|
13087
|
-
function paletteFailures(palette, drawn = {}) {
|
|
13088
|
-
const colors = { ...LIGHT_DRAWN_COLORS, ...drawn };
|
|
13089
|
-
const text = palette.textColor ?? colors.text;
|
|
13090
|
-
const backgrounds = [
|
|
13091
|
-
{
|
|
13092
|
-
background: "surfaceColor",
|
|
13093
|
-
color: palette.surfaceColor ?? colors.surface
|
|
13094
|
-
},
|
|
13095
|
-
{ background: "panelColor", color: panelOf(palette, text, colors) }
|
|
13096
|
-
];
|
|
13097
|
-
return backgrounds.flatMap(({ background, color }) => {
|
|
13098
|
-
const pairs = [
|
|
13099
|
-
{ foreground: "textColor", color: text, needs: TEXT_CONTRAST },
|
|
13100
|
-
{
|
|
13101
|
-
foreground: "mutedTextColor",
|
|
13102
|
-
color: mutedOn(palette, color, colors),
|
|
13103
|
-
needs: TEXT_CONTRAST
|
|
13104
|
-
},
|
|
13105
|
-
...palette.focusColor ? [
|
|
13106
|
-
{
|
|
13107
|
-
foreground: "focusColor",
|
|
13108
|
-
color: palette.focusColor,
|
|
13109
|
-
needs: AA_GRAPHIC_CONTRAST
|
|
13110
|
-
}
|
|
13111
|
-
] : []
|
|
13112
|
-
];
|
|
13113
|
-
return pairs.flatMap(({ foreground, color: ink, needs }) => {
|
|
13114
|
-
const ratio = contrastRatio(ink, color);
|
|
13115
|
-
return ratio >= needs ? [] : [{ foreground, background, ratio: floorToHundredths(ratio), needs }];
|
|
13116
|
-
});
|
|
13117
|
-
});
|
|
13118
|
-
}
|
|
13119
|
-
function drawablePalette(chosen, drawn = {}) {
|
|
13120
|
-
const { focusColor, borderColor, ...surfacesAndText } = chosen;
|
|
13121
|
-
const kept = paletteFailures(surfacesAndText, drawn).length === 0 ? surfacesAndText : {};
|
|
13122
|
-
const focusShows = focusColor !== void 0 && paletteFailures({ ...kept, focusColor }, drawn).length === 0;
|
|
13123
|
-
return {
|
|
13124
|
-
...kept,
|
|
13125
|
-
...borderColor ? { borderColor } : {},
|
|
13126
|
-
...focusShows ? { focusColor } : {}
|
|
13127
|
-
};
|
|
13128
|
-
}
|
|
13129
|
-
function brandTokens(brand) {
|
|
13130
|
-
for (const [field, value] of Object.entries(brand)) {
|
|
13131
|
-
if (value !== void 0 && !isHexColor(value)) {
|
|
13132
|
-
throw new RangeError(
|
|
13133
|
-
`${field} must be a #rrggbb color, got ${JSON.stringify(value)}`
|
|
13134
|
-
);
|
|
13135
|
-
}
|
|
13136
|
-
}
|
|
13137
|
-
const { primaryColor: primary, secondaryColor, ...chosen } = brand;
|
|
13138
|
-
const palette = drawablePalette(chosen);
|
|
13139
|
-
const surface = palette.surfaceColor ?? LIGHT_DRAWN_COLORS.surface;
|
|
13140
|
-
const panel = panelOf(
|
|
13141
|
-
palette,
|
|
13142
|
-
palette.textColor ?? LIGHT_DRAWN_COLORS.text,
|
|
13143
|
-
LIGHT_DRAWN_COLORS
|
|
13144
|
-
);
|
|
13145
|
-
const ink = palette.textColor ?? LIGHT_DRAWN_COLORS.text;
|
|
13146
|
-
const onPrimary = onPrimaryFor(primary);
|
|
13147
|
-
const inBrand = (pick) => pick === "brand" ? primary : ink;
|
|
13148
|
-
const tokens = {
|
|
13149
|
-
"--consent-primary": primary,
|
|
13150
|
-
"--consent-on-primary": onPrimary,
|
|
13151
|
-
"--consent-link": inBrand(actionColorFor(primary, surface)),
|
|
13152
|
-
"--cs-surface-accent": primary,
|
|
13153
|
-
"--cs-surface-accent-text": onPrimary,
|
|
13154
|
-
"--cs-tint": mixOver(primary, TINT_PERCENT, surface),
|
|
13155
|
-
"--cs-tint-line": mixOver(primary, TINT_LINE_PERCENT, surface),
|
|
13156
|
-
"--cs-mark": inBrand(markColorFor(primary, surface)),
|
|
13157
|
-
"--cs-action": inBrand(actionColorFor(primary, surface)),
|
|
13158
|
-
"--cs-focus-ring": palette.focusColor ?? inBrand(focusRingFor(primary, surface))
|
|
13159
|
-
};
|
|
13160
|
-
if (secondaryColor) {
|
|
13161
|
-
tokens["--cs-icon"] = iconColorFor(secondaryColor, primary, {
|
|
13162
|
-
surface,
|
|
13163
|
-
panel
|
|
13164
|
-
});
|
|
13165
|
-
}
|
|
13166
|
-
if (palette.surfaceColor) tokens["--cs-surface-card"] = palette.surfaceColor;
|
|
13167
|
-
if (palette.surfaceColor || palette.panelColor)
|
|
13168
|
-
tokens["--cs-surface-inset"] = panel;
|
|
13169
|
-
if (palette.borderColor) tokens["--cs-surface-border"] = palette.borderColor;
|
|
13170
|
-
if (palette.textColor) {
|
|
13171
|
-
tokens["--cs-text-primary"] = palette.textColor;
|
|
13172
|
-
tokens["--cs-text-secondary"] = palette.textColor;
|
|
13173
|
-
}
|
|
13174
|
-
if (palette.mutedTextColor) {
|
|
13175
|
-
tokens["--cs-text-tertiary"] = palette.mutedTextColor;
|
|
13176
|
-
} else if (palette.textColor) {
|
|
13177
|
-
tokens["--cs-text-tertiary"] = `color-mix(in srgb, ${palette.textColor} ${MUTED_TEXT_PERCENT}%, transparent)`;
|
|
13178
|
-
}
|
|
13179
|
-
return tokens;
|
|
13180
|
-
}
|
|
13181
|
-
function brandStyle(brand) {
|
|
13182
|
-
return Object.entries(brandTokens(brand)).map(([property, value]) => `${property}: ${value};`).join(" ");
|
|
13183
|
-
}
|
|
13184
|
-
|
|
13185
13766
|
// ../../node_modules/.pnpm/@kya-os+id@0.11.0_@cfworker+json-schema@4.1.1_better-auth@1.7.7_@opentelemetry+api@1.9._1fd211efd4c126c93f6c4adb9fbb1c99/node_modules/@kya-os/id/dist/base64url.js
|
|
13186
13767
|
function bytesToBase64Url(bytes) {
|
|
13187
13768
|
let b642;
|
|
@@ -13799,6 +14380,7 @@ function renderIcon() {
|
|
|
13799
14380
|
}
|
|
13800
14381
|
export {
|
|
13801
14382
|
APPROVAL_METHODS,
|
|
14383
|
+
CONFIG_FIELD_REGIONS,
|
|
13802
14384
|
CONNECTOR_MARKS,
|
|
13803
14385
|
CONSENT_CAPABILITIES_FEATURES,
|
|
13804
14386
|
CONSENT_EDIT_EVENTS,
|
|
@@ -13826,6 +14408,7 @@ export {
|
|
|
13826
14408
|
FLOW_CONNECTOR_STATES,
|
|
13827
14409
|
FLOW_COPY,
|
|
13828
14410
|
FLOW_EVENTS,
|
|
14411
|
+
FLOW_FIELDS,
|
|
13829
14412
|
FLOW_HOST_ATTRIBUTES,
|
|
13830
14413
|
FLOW_PRESETS,
|
|
13831
14414
|
FLOW_SCHEMA_VERSION,
|
|
@@ -13844,6 +14427,7 @@ export {
|
|
|
13844
14427
|
flowCopy,
|
|
13845
14428
|
flowPreset,
|
|
13846
14429
|
group,
|
|
14430
|
+
httpsUrl,
|
|
13847
14431
|
initialsOf,
|
|
13848
14432
|
paletteFailures,
|
|
13849
14433
|
parseConsentEditKey,
|