@kya-os/consent 0.3.0 → 0.4.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/README.md +6 -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-capabilities-screen.js +39 -3
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +75 -24
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/consent-headline.js +50 -1
- package/dist/cjs/components/consent-headline.js.map +1 -1
- package/dist/cjs/components/index.js +2 -1
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/constants/capabilities.js +11 -2
- package/dist/cjs/constants/capabilities.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/components/consent-capabilities-screen.d.ts +14 -3
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +37 -2
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts +19 -2
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +74 -23
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/consent-headline.d.ts +25 -0
- package/dist/components/consent-headline.d.ts.map +1 -1
- package/dist/components/consent-headline.js +52 -3
- package/dist/components/consent-headline.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/consent.js +121 -25
- package/dist/consent.min.js +114 -94
- package/dist/constants/capabilities.d.ts +5 -2
- package/dist/constants/capabilities.d.ts.map +1 -1
- package/dist/constants/capabilities.js +11 -2
- package/dist/constants/capabilities.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/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,oEAAoE;AACpE,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,sBAAsB;AACtB,OAAO,EACL,kBAAkB,GAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,kBAAkB,GAEnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,0CAA0C;AAC1C,OAAO,EACL,UAAU,GAIX,MAAM,kBAAkB,CAAC;AAE1B,qEAAqE;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":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2EAA2E;AAC3E,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,4EAA4E;AAC5E,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,UAAU,GAEX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5E,oDAAoD;AACpD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC"}
|
package/dist/consent.js
CHANGED
|
@@ -3443,6 +3443,18 @@ var ConsentHeadline = class extends i4 {
|
|
|
3443
3443
|
this.verb = "";
|
|
3444
3444
|
this.description = "";
|
|
3445
3445
|
this.eyebrow = "";
|
|
3446
|
+
this.hostHeadline = false;
|
|
3447
|
+
/**
|
|
3448
|
+
* Reads the slot itself, not the event's target: when a screen forwards its
|
|
3449
|
+
* own slot here, the event comes from that slot, and a host that fills the
|
|
3450
|
+
* screen's slot later is seen only through the flattened list.
|
|
3451
|
+
*/
|
|
3452
|
+
this.readHeadlineSlot = () => {
|
|
3453
|
+
const slot = this.renderRoot.querySelector(
|
|
3454
|
+
'slot[name="headline"]'
|
|
3455
|
+
);
|
|
3456
|
+
this.hostHeadline = (slot?.assignedElements({ flatten: true }).length ?? 0) > 0;
|
|
3457
|
+
};
|
|
3446
3458
|
}
|
|
3447
3459
|
render() {
|
|
3448
3460
|
const tokens = CONSENT_COPY_TOKENS;
|
|
@@ -3453,10 +3465,33 @@ var ConsentHeadline = class extends i4 {
|
|
|
3453
3465
|
<span class="eyebrow" part="eyebrow"
|
|
3454
3466
|
>${this.eyebrow.trim() || tokens.eyebrow.permissionRequest}</span
|
|
3455
3467
|
>
|
|
3456
|
-
<h1 class="headline" part="headline"
|
|
3468
|
+
<h1 class="headline" part="headline">
|
|
3469
|
+
<slot name="headline" @slotchange=${this.readHeadlineSlot}></slot>${this.hostHeadline ? A : this.headlinePieces()}
|
|
3470
|
+
</h1>
|
|
3457
3471
|
<p class="subhead" part="subhead">${subhead}</p>
|
|
3458
3472
|
`;
|
|
3459
3473
|
}
|
|
3474
|
+
/**
|
|
3475
|
+
* Before the first render, reads what the slot will hold from the light DOM,
|
|
3476
|
+
* so the first render is already the right one. A change made here does not
|
|
3477
|
+
* schedule another update, where one made after the first update would.
|
|
3478
|
+
*/
|
|
3479
|
+
willUpdate() {
|
|
3480
|
+
if (!this.hasUpdated) this.hostHeadline = this.lightHeadlineFilled();
|
|
3481
|
+
}
|
|
3482
|
+
/**
|
|
3483
|
+
* The children the `headline` slot will be given, flattened: a screen's
|
|
3484
|
+
* forwarded slot counts only when something is assigned to it.
|
|
3485
|
+
*/
|
|
3486
|
+
lightHeadlineFilled() {
|
|
3487
|
+
return [...this.children].some((child) => {
|
|
3488
|
+
if (child.getAttribute("slot") !== "headline") return false;
|
|
3489
|
+
if (child instanceof HTMLSlotElement) {
|
|
3490
|
+
return child.assignedElements({ flatten: true }).length > 0;
|
|
3491
|
+
}
|
|
3492
|
+
return true;
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3460
3495
|
/** The headline, with each name as text in its own `em`. */
|
|
3461
3496
|
headlinePieces() {
|
|
3462
3497
|
const tokens = CONSENT_COPY_TOKENS;
|
|
@@ -3524,6 +3559,9 @@ __decorateClass([
|
|
|
3524
3559
|
__decorateClass([
|
|
3525
3560
|
n4({ type: String })
|
|
3526
3561
|
], ConsentHeadline.prototype, "eyebrow", 2);
|
|
3562
|
+
__decorateClass([
|
|
3563
|
+
r5()
|
|
3564
|
+
], ConsentHeadline.prototype, "hostHeadline", 2);
|
|
3527
3565
|
ConsentHeadline = __decorateClass([
|
|
3528
3566
|
t3("consent-headline")
|
|
3529
3567
|
], ConsentHeadline);
|
|
@@ -3579,6 +3617,21 @@ function extractConditions(cedar) {
|
|
|
3579
3617
|
}
|
|
3580
3618
|
|
|
3581
3619
|
// src/components/consent-capability-card.ts
|
|
3620
|
+
var CAPABILITY_ROW_PARTS = [
|
|
3621
|
+
"row",
|
|
3622
|
+
"checkbox",
|
|
3623
|
+
"check",
|
|
3624
|
+
"icon",
|
|
3625
|
+
"body",
|
|
3626
|
+
"label-row",
|
|
3627
|
+
"label-text",
|
|
3628
|
+
"label",
|
|
3629
|
+
"description",
|
|
3630
|
+
"risk",
|
|
3631
|
+
"scopes",
|
|
3632
|
+
"scope",
|
|
3633
|
+
"policy"
|
|
3634
|
+
];
|
|
3582
3635
|
var ConsentCapabilityCard = class extends i4 {
|
|
3583
3636
|
constructor() {
|
|
3584
3637
|
super(...arguments);
|
|
@@ -3612,17 +3665,19 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3612
3665
|
* Row-level click handler. Makes the entire row a click target for
|
|
3613
3666
|
* toggling the checkbox — a UX nicety that matches Plaid/Apple-style
|
|
3614
3667
|
* consent rows. Skips when the user clicks the per-row "View policy"
|
|
3615
|
-
* button, the policy disclosure,
|
|
3616
|
-
* those
|
|
3668
|
+
* button, the policy disclosure, any link inside the description, or
|
|
3669
|
+
* anything the host put in the `extra` slot, so those children retain their
|
|
3670
|
+
* own behavior.
|
|
3617
3671
|
*/
|
|
3618
3672
|
onRowClick(event) {
|
|
3619
3673
|
const target = event.target;
|
|
3620
3674
|
if (!target) return;
|
|
3675
|
+
const extra = this.renderRoot.querySelector('slot[name="extra"]');
|
|
3621
3676
|
const path = event.composedPath?.() || [];
|
|
3622
3677
|
for (const node of path) {
|
|
3623
3678
|
if (!(node instanceof HTMLElement)) continue;
|
|
3624
3679
|
if (node === this) break;
|
|
3625
|
-
if (node.classList?.contains("policy-toggle") || node.classList?.contains("policy-disclosure") || node.tagName === "A" || node.tagName === "BUTTON") {
|
|
3680
|
+
if (node === extra || node.classList?.contains("policy-toggle") || node.classList?.contains("policy-disclosure") || node.tagName === "A" || node.tagName === "BUTTON") {
|
|
3626
3681
|
return;
|
|
3627
3682
|
}
|
|
3628
3683
|
}
|
|
@@ -3664,6 +3719,8 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3664
3719
|
class="row"
|
|
3665
3720
|
part="row"
|
|
3666
3721
|
role="button"
|
|
3722
|
+
aria-labelledby=${this.isHigherRisk() ? "label risk" : "label"}
|
|
3723
|
+
aria-describedby="description"
|
|
3667
3724
|
tabindex=${this.disabled ? "-1" : "0"}
|
|
3668
3725
|
aria-disabled=${String(this.disabled)}
|
|
3669
3726
|
@click=${this.onRowClick}
|
|
@@ -3688,29 +3745,38 @@ var ConsentCapabilityCard = class extends i4 {
|
|
|
3688
3745
|
type="button"
|
|
3689
3746
|
tabindex="-1"
|
|
3690
3747
|
>
|
|
3691
|
-
${this.checked ? b2`<span class="check-mark">✓</span>` : A}
|
|
3748
|
+
${this.checked ? b2`<span class="check-mark" part="check">✓</span>` : A}
|
|
3692
3749
|
</button>
|
|
3693
|
-
<div class="icon-tile" aria-hidden="true"
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3750
|
+
<div class="icon-tile" part="icon" aria-hidden="true">
|
|
3751
|
+
${this.renderIcon()}
|
|
3752
|
+
</div>
|
|
3753
|
+
<div class="body" part="body">
|
|
3754
|
+
<div class="row-label" part="label-row">
|
|
3755
|
+
<span part="label-text"
|
|
3756
|
+
><strong id="label" part="label">${this.label}</strong>
|
|
3757
|
+
<span id="description" class="description" part="description"
|
|
3758
|
+
>${this.description}</span
|
|
3759
|
+
></span
|
|
3699
3760
|
>
|
|
3700
|
-
${this.isHigherRisk() ? b2`<span class="risk-chip"
|
|
3761
|
+
${this.isHigherRisk() ? b2`<span id="risk" class="risk-chip" part="risk"
|
|
3762
|
+
>${tokens.higherRiskChip}</span
|
|
3763
|
+
>` : A}
|
|
3701
3764
|
</div>
|
|
3702
|
-
${this.scopes.length > 0 ? b2`<ul class="scopes" aria-label="Scopes"
|
|
3765
|
+
${this.scopes.length > 0 ? b2`<ul class="scopes" part="scopes" aria-label="Scopes">
|
|
3766
|
+
${this.scopes.map(
|
|
3703
3767
|
(scope) => b2`<li><code part="scope">${scope}</code></li>`
|
|
3704
|
-
)}
|
|
3768
|
+
)}
|
|
3769
|
+
</ul>` : A}
|
|
3705
3770
|
${this.compiledCedar.trim() ? b2`<button
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3771
|
+
class="policy-toggle"
|
|
3772
|
+
type="button"
|
|
3773
|
+
@click=${this.togglePolicy}
|
|
3774
|
+
aria-expanded="${String(this.policyOpen)}"
|
|
3775
|
+
>
|
|
3776
|
+
${tokens.viewPolicyLink}
|
|
3777
|
+
</button>` : A}
|
|
3713
3778
|
${this.renderPolicy()}
|
|
3779
|
+
<slot name="extra"></slot>
|
|
3714
3780
|
</div>
|
|
3715
3781
|
</div>
|
|
3716
3782
|
`;
|
|
@@ -3744,7 +3810,8 @@ ConsentCapabilityCard.styles = i`
|
|
|
3744
3810
|
background: var(--cs-row-hover-bg, rgba(15, 23, 42, 0.025));
|
|
3745
3811
|
}
|
|
3746
3812
|
|
|
3747
|
-
.row[aria-disabled="true"],
|
|
3813
|
+
.row[aria-disabled="true"],
|
|
3814
|
+
.checkbox:disabled {
|
|
3748
3815
|
cursor: not-allowed;
|
|
3749
3816
|
}
|
|
3750
3817
|
|
|
@@ -5105,9 +5172,18 @@ function capabilitySeedKey(capabilities, allSelected) {
|
|
|
5105
5172
|
|
|
5106
5173
|
// src/constants/capabilities.ts
|
|
5107
5174
|
var CONSENT_CAPABILITIES_FEATURES = Object.freeze({
|
|
5108
|
-
|
|
5175
|
+
/** 2 adds the `headline` slot, a slot per row and the row parts. */
|
|
5176
|
+
version: 2,
|
|
5109
5177
|
scopesOnly: true,
|
|
5110
|
-
slots: Object.freeze([
|
|
5178
|
+
slots: Object.freeze([
|
|
5179
|
+
"identity",
|
|
5180
|
+
"details",
|
|
5181
|
+
"notice",
|
|
5182
|
+
"footer",
|
|
5183
|
+
"headline"
|
|
5184
|
+
]),
|
|
5185
|
+
/** A row's slot is this prefix and the capability's id. */
|
|
5186
|
+
capabilitySlotPrefix: "capability-"
|
|
5111
5187
|
});
|
|
5112
5188
|
|
|
5113
5189
|
// src/grant/terms.ts
|
|
@@ -5786,6 +5862,19 @@ ConsentGrantTerms = __decorateClass([
|
|
|
5786
5862
|
], ConsentGrantTerms);
|
|
5787
5863
|
|
|
5788
5864
|
// src/components/consent-capabilities-screen.ts
|
|
5865
|
+
var CAPABILITY_ROW_EXPORT_PARTS = CAPABILITY_ROW_PARTS.map(
|
|
5866
|
+
(part) => `${part}: capability-${part}`
|
|
5867
|
+
).join(", ");
|
|
5868
|
+
function capabilitySlotName(capabilityId) {
|
|
5869
|
+
return `${CONSENT_CAPABILITIES_FEATURES.capabilitySlotPrefix}${capabilityId}`;
|
|
5870
|
+
}
|
|
5871
|
+
function cameThroughARowSlot(event) {
|
|
5872
|
+
const path = event.composedPath();
|
|
5873
|
+
const listener = event.currentTarget ? path.indexOf(event.currentTarget) : -1;
|
|
5874
|
+
return path.slice(0, listener === -1 ? path.length : listener).some(
|
|
5875
|
+
(node) => node instanceof HTMLSlotElement && node.name.startsWith(CONSENT_CAPABILITIES_FEATURES.capabilitySlotPrefix)
|
|
5876
|
+
);
|
|
5877
|
+
}
|
|
5789
5878
|
var ConsentCapabilitiesScreen = class extends i4 {
|
|
5790
5879
|
constructor() {
|
|
5791
5880
|
super();
|
|
@@ -5818,6 +5907,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5818
5907
|
this.onCapabilityToggle = (event) => {
|
|
5819
5908
|
if (this.loading || this.disabled || !(event instanceof CustomEvent))
|
|
5820
5909
|
return;
|
|
5910
|
+
if (cameThroughARowSlot(event)) return;
|
|
5821
5911
|
const detail = event.detail;
|
|
5822
5912
|
if (!detail || typeof detail !== "object" || !("id" in detail) || typeof detail.id !== "string" || !("checked" in detail) || typeof detail.checked !== "boolean" || !this.capabilities.some((capability) => capability.id === detail.id))
|
|
5823
5913
|
return;
|
|
@@ -5953,6 +6043,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5953
6043
|
org-name="${this.orgName}"
|
|
5954
6044
|
verb="${this.headlineVerb}"
|
|
5955
6045
|
description="${this.description}"
|
|
6046
|
+
><slot name="headline" slot="headline"></slot
|
|
5956
6047
|
></consent-headline>
|
|
5957
6048
|
<slot name="recovery"></slot>
|
|
5958
6049
|
<slot name="identity"></slot>
|
|
@@ -5968,7 +6059,7 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5968
6059
|
></consent-agent-header>` : A}
|
|
5969
6060
|
<slot name="agent-key"></slot>
|
|
5970
6061
|
<div part="permissions">
|
|
5971
|
-
<div class="section-header">
|
|
6062
|
+
<div class="section-header" part="section-header">
|
|
5972
6063
|
<span>${sectionHeader}</span>
|
|
5973
6064
|
<span class="hint">${tokens.section.tapToToggle}</span>
|
|
5974
6065
|
</div>
|
|
@@ -5985,6 +6076,11 @@ var ConsentCapabilitiesScreen = class extends i4 {
|
|
|
5985
6076
|
?disabled=${this.loading || this.disabled}
|
|
5986
6077
|
.scopes=${capability.scopes}
|
|
5987
6078
|
compiled-cedar="${this.compileCapabilityCedar(capability)}"
|
|
6079
|
+
exportparts=${CAPABILITY_ROW_EXPORT_PARTS}
|
|
6080
|
+
><slot
|
|
6081
|
+
name=${capabilitySlotName(capability.id)}
|
|
6082
|
+
slot="extra"
|
|
6083
|
+
></slot
|
|
5988
6084
|
></consent-capability-card>
|
|
5989
6085
|
`
|
|
5990
6086
|
)}
|