@ekanos/sdk 0.25.0 → 0.26.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 +9 -11
- package/api-report.md +27 -6
- package/dist/components/base-activation-dialog.js +2 -2
- package/dist/components/base-activation-dialog.js.map +1 -1
- package/dist/components/base-activation-form.js +1 -1
- package/dist/components/base-activation-form.js.map +1 -1
- package/dist/components/base-marketplace-tile.js +2 -2
- package/dist/components/base-marketplace-tile.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/oauth-activation-form.d.ts +8 -0
- package/dist/components/oauth-activation-form.js +10 -4
- package/dist/components/oauth-activation-form.js.map +1 -1
- package/dist/components/widgets/ai-prompt-chip.js +3 -3
- package/dist/components/widgets/ai-prompt-chip.js.map +1 -1
- package/dist/components/widgets/widget-ask-bar.js +1 -1
- package/dist/components/widgets/widget-ask-bar.js.map +1 -1
- package/dist/components/widgets/widget-ask-presentation.d.ts +35 -0
- package/dist/components/widgets/widget-ask-presentation.js +35 -0
- package/dist/components/widgets/widget-ask-presentation.js.map +1 -0
- package/dist/components/widgets/widget-state-components.d.ts +6 -1
- package/dist/components/widgets/widget-state-components.js +8 -8
- package/dist/components/widgets/widget-state-components.js.map +1 -1
- package/dist/components/widgets/widget.d.ts +2 -2
- package/dist/components/widgets/widget.js +33 -27
- package/dist/components/widgets/widget.js.map +1 -1
- package/dist/context/types.d.ts +1 -1
- package/dist/context/types.js.map +1 -1
- package/dist/contract/derive-contract.js +16 -10
- package/dist/contract/derive-contract.js.map +1 -1
- package/dist/contract/types.d.ts +1 -1
- package/dist/contract/types.js.map +1 -1
- package/dist/experience/client.d.ts +76 -0
- package/dist/experience/client.js +103 -2
- package/dist/experience/client.js.map +1 -1
- package/dist/experience/runtime.d.ts +16 -0
- package/dist/experience/runtime.js.map +1 -1
- package/dist/experience/sdk-instances.d.ts +11 -0
- package/dist/experience/sdk-instances.js +47 -0
- package/dist/experience/sdk-instances.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/partner-oauth.d.ts +15 -2
- package/dist/hooks/partner-oauth.js +3 -0
- package/dist/hooks/partner-oauth.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +4 -2
- package/dist/integration/index.js +4 -1
- package/dist/integration/index.js.map +1 -1
- package/dist/testing/mock-context.d.ts +21 -2
- package/dist/testing/mock-context.js +102 -45
- package/dist/testing/mock-context.js.map +1 -1
- package/dist/types/workspace-target.d.ts +1 -1
- package/dist/types/workspace-target.js.map +1 -1
- package/dist/version.d.ts +7 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/eslint.design-preset.mjs +5 -3
- package/eslint.design-rules.mjs +195 -9
- package/package.json +3 -3
package/eslint.design-preset.mjs
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* submission).
|
|
15
15
|
*
|
|
16
16
|
* ── What it enforces ─────────────────────────────────────────────────────
|
|
17
|
-
*
|
|
17
|
+
* One rule is local to this file: no raw interactive HTML element
|
|
18
18
|
* where `@ekanos/ui` publishes the host's component. A hand-rolled `<button>`
|
|
19
19
|
* is not a styling nit — it misses the kit's focus ring, its disabled and
|
|
20
20
|
* loading states, its size scale, and every per-Source retint that reaches a
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
* inputs, selects, textareas and labels, each of which carries accessibility
|
|
23
23
|
* wiring a bare element does not.
|
|
24
24
|
*
|
|
25
|
-
* The
|
|
25
|
+
* The rest are the host's own `design/*` rules — palette-adjacent
|
|
26
26
|
* white/black utilities, Badge tone variants, overlay widths, rounded row
|
|
27
27
|
* hovers, faded muted text, viewport breakpoints in widgets, tinted chips,
|
|
28
28
|
* toolbar tabs, raw type steps, raw buttons, hand-drawn cards, motion off the
|
|
29
|
-
* tokens, hover that moves
|
|
29
|
+
* tokens, hover that moves, and the brandable-theme rules (ADR 0008: no
|
|
30
|
+
* literal gradient, radius, typeface or colour, so every Source's theme
|
|
31
|
+
* reaches the widget) — imported from `./eslint.design-rules.mjs`, the single
|
|
30
32
|
* implementation the host repo's oxlint plugin also loads (through the
|
|
31
33
|
* two-line re-export the host's lint config keeps). There is
|
|
32
34
|
* exactly one copy of each rule, so a partner is held to what the host holds
|
package/eslint.design-rules.mjs
CHANGED
|
@@ -100,12 +100,13 @@ function stringVisitors(test, message) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* A
|
|
104
|
-
*
|
|
105
|
-
*
|
|
103
|
+
* A Font Awesome icon value (`fa-solid fa-house`). Icons are Phosphor names
|
|
104
|
+
* (`house`), written without a weight so the theme's icon style reaches every
|
|
105
|
+
* one; a Font Awesome value still draws through a translation table, but new
|
|
106
|
+
* code writes the Phosphor name.
|
|
106
107
|
*/
|
|
107
|
-
const
|
|
108
|
-
/(?:^|[\s'"`])
|
|
108
|
+
const FONT_AWESOME_ICON =
|
|
109
|
+
/(?:^|[\s'"`])fa-(?:solid|regular|light|thin|duotone|brands|sharp)\s+fa-[a-z0-9]/;
|
|
109
110
|
|
|
110
111
|
const BADGE_TONES = new Set(['success', 'warning', 'info']);
|
|
111
112
|
|
|
@@ -151,6 +152,35 @@ const OVERLAY_WIDTH =
|
|
|
151
152
|
const OVERLAY_WIDTH_MESSAGE =
|
|
152
153
|
'Never set an overlay’s width in className. Dialog, Sheet and Drawer take size="sm|md|lg|xl|2xl|3xl|full" from @kit/ui/overlay-size; AlertDialog takes size="sm" (design-system overlay rule).';
|
|
153
154
|
|
|
155
|
+
/**
|
|
156
|
+
* The kit's sized controls: each takes its height from `size` (Ekanos design system §
|
|
157
|
+
* Sizes), so a height class at a call site steps it off the one scale and out
|
|
158
|
+
* of line with the controls beside it.
|
|
159
|
+
*/
|
|
160
|
+
const SIZED_CONTROLS = new Set([
|
|
161
|
+
'Button',
|
|
162
|
+
'Input',
|
|
163
|
+
'InputGroup',
|
|
164
|
+
'SelectTrigger',
|
|
165
|
+
'ComboboxInput',
|
|
166
|
+
'SearchField',
|
|
167
|
+
'TabsList',
|
|
168
|
+
'Toggle',
|
|
169
|
+
'ToggleGroup',
|
|
170
|
+
'Badge',
|
|
171
|
+
]);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* `h-8`, `sm:h-7`, `min-h-11`, `size-8`, `h-[30px]`… but not `h-full`,
|
|
175
|
+
* `h-auto`, `h-fit`, `min-h-0`, and never a child selector (`[&_svg]:size-4`,
|
|
176
|
+
* `*:data-[slot=icon]:size-3`), which sizes what is inside the control.
|
|
177
|
+
*/
|
|
178
|
+
const CONTROL_HEIGHT =
|
|
179
|
+
/^(?:(?:[\w-]+|[\w-]*\[[^\]&]*\][\w-]*)+:)*(?:h|min-h|size)-(?!(?:full|auto|fit|min|max|0|px|screen|svh|dvh|lvh)$)\S+$/;
|
|
180
|
+
|
|
181
|
+
const CONTROL_HEIGHT_MESSAGE =
|
|
182
|
+
'A kit control takes its height from size, never a class: Button xs|sm|default|lg (icon-xs|icon-sm|icon|icon-lg), Input/SelectTrigger/InputGroup/ComboboxInput/TabsList/Toggle sm|default|lg (24/32/36/40px), Badge sm|default|lg; a phone hit area is Button touch (design-system sizes rule, Ekanos design system § Sizes).';
|
|
183
|
+
|
|
154
184
|
/**
|
|
155
185
|
* Every string literal in a className value, including inside `cn(...)`.
|
|
156
186
|
*
|
|
@@ -438,6 +468,55 @@ function propertyName(key) {
|
|
|
438
468
|
return null;
|
|
439
469
|
}
|
|
440
470
|
|
|
471
|
+
/*
|
|
472
|
+
* The brandable-theme rules (ADR 0008, owner 2026-11-10). A Source brands
|
|
473
|
+
* its look through tokens, so anything that writes a colour, a corner or a
|
|
474
|
+
* typeface literally stops that Source's choice from reaching the element.
|
|
475
|
+
*/
|
|
476
|
+
|
|
477
|
+
/** A colour written out rather than read from a token: a hex value other
|
|
478
|
+
* than pure black or white, `rgb()`/`hsl()`, or an oklch with chroma
|
|
479
|
+
* (`oklch(0 0 0)` is a mask's black, not a colour). Tailwind writes spaces
|
|
480
|
+
* as `_` inside brackets, so either separator counts. */
|
|
481
|
+
const LITERAL_COLOR =
|
|
482
|
+
/#(?!(?:000|fff|0000|ffff|000000|ffffff|00000000|ffffffff)(?![0-9a-f]))[0-9a-f]{3,8}(?![0-9a-z])|\b(?:rgba?|hsla?)\(|\boklch\(\s*[\d.]+%?[\s_]+(?!0(?:\.0+)?[\s_)/])[\d.]/i;
|
|
483
|
+
|
|
484
|
+
const GRADIENT_FUNCTION = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/;
|
|
485
|
+
|
|
486
|
+
/** @param {string} value */
|
|
487
|
+
function isLiteralGradient(value) {
|
|
488
|
+
return GRADIENT_FUNCTION.test(value) && LITERAL_COLOR.test(value);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/** `rounded-[10px]`, `rounded-tl-[0.5rem]`, `[border-radius:6px]`. A value
|
|
492
|
+
* that reads `--radius` (`rounded-[calc(var(--radius)-5px)]`) follows the
|
|
493
|
+
* shape preset and passes, and so does `rounded-[inherit]`. */
|
|
494
|
+
const ARBITRARY_RADIUS =
|
|
495
|
+
/(?:^|[\s'"`:])!?(?:rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|es|ee))?-\[(?!inherit\])(?![^\]]*--radius)|\[border(?:-[a-z]+)*-radius:(?![^\]]*--radius))/;
|
|
496
|
+
|
|
497
|
+
/** A typeface named in a class: `font-['Inter']`, `font-serif`,
|
|
498
|
+
* `[font-family:…]`. Weights (`font-[550]`) and `font-mono` pass; the
|
|
499
|
+
* heading and body families come from the Source's typeface preset. */
|
|
500
|
+
const FONT_FAMILY_CLASS =
|
|
501
|
+
/(?:^|[\s'"`:])!?(?:font-\[(?![\d.]+\])|font-serif(?=$|[\s'"`])|\[font-family:)/;
|
|
502
|
+
|
|
503
|
+
/** A literal colour in an arbitrary utility: `text-[#242424]`,
|
|
504
|
+
* `bg-[oklch(0.6_0.2_27)]`, `border-[rgb(…)]`, or inside an arbitrary
|
|
505
|
+
* shadow, ring or outline (`shadow-[0_0_0_1px_#3355ff]`). */
|
|
506
|
+
const ARBITRARY_COLOR_UTILITY =
|
|
507
|
+
/(?:^|[\s'"`:])!?(?:[a-z]+-)*[a-z]+-\[(?:color:)?(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|oklch|oklab|lab|lch)\()|(?:^|[\s'"`:])!?(?:shadow|ring|outline|drop-shadow|inset-shadow)-\[[^\]\s'"`]*(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|oklch)\()/i;
|
|
508
|
+
|
|
509
|
+
/** A heading set in a fixed weight: `font-heading … font-bold`. A heading's
|
|
510
|
+
* weight follows the typeface preset (a display face sits lighter than a
|
|
511
|
+
* text face), so it is `font-heading-bold` or `font-heading-semibold`. */
|
|
512
|
+
/** @param {string} value */
|
|
513
|
+
function isFixedHeadingWeight(value) {
|
|
514
|
+
return (
|
|
515
|
+
/(?:^|[\s'"`:])font-heading(?=$|[\s'"`])/.test(value) &&
|
|
516
|
+
/(?:^|[\s'"`:])font-(?:bold|semibold)(?=$|[\s'"`])/.test(value)
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
441
520
|
export default {
|
|
442
521
|
meta: { name: 'design' },
|
|
443
522
|
rules: {
|
|
@@ -602,6 +681,71 @@ export default {
|
|
|
602
681
|
'Opacity on text-muted-foreground fails WCAG AA: even /90 measures 4.18:1 on a dark card. Use plain text-muted-foreground, a smaller size if it must recede, or text-border for a decorative separator (design-system opacity-on-muted rule).',
|
|
603
682
|
),
|
|
604
683
|
},
|
|
684
|
+
'no-literal-gradient': {
|
|
685
|
+
meta: {
|
|
686
|
+
type: 'problem',
|
|
687
|
+
docs: {
|
|
688
|
+
description:
|
|
689
|
+
'Disallow a gradient written with literal colours; the AI accent reads --brand-gradient so each Source paints its own.',
|
|
690
|
+
},
|
|
691
|
+
},
|
|
692
|
+
create: predicateVisitors(
|
|
693
|
+
isLiteralGradient,
|
|
694
|
+
'A gradient with literal colours ignores the Source theme. The AI accent is bg-brand-gradient or linear-gradient(<direction> in oklab, var(--brand-gradient)), which a Source paints as its gradient or one solid colour; a fade is token colours (from-card to-transparent). The gradient means AI: never on buttons, cards, text or charts (Ekanos design system § Brand, ADR 0008).',
|
|
695
|
+
),
|
|
696
|
+
},
|
|
697
|
+
'no-arbitrary-radius': {
|
|
698
|
+
meta: {
|
|
699
|
+
type: 'problem',
|
|
700
|
+
docs: {
|
|
701
|
+
description:
|
|
702
|
+
"Disallow a literal corner radius; corners come from --radius so the Source's shape preset reaches them.",
|
|
703
|
+
},
|
|
704
|
+
},
|
|
705
|
+
create: stringVisitors(
|
|
706
|
+
ARBITRARY_RADIUS,
|
|
707
|
+
"A literal radius ignores the Source's shape preset. Use a radius step (rounded-sm … rounded-4xl, each a multiple of --radius) or a value that reads it, rounded-[calc(var(--radius)-2px)] (Ekanos design system § Shapes, ADR 0008).",
|
|
708
|
+
),
|
|
709
|
+
},
|
|
710
|
+
'no-font-family-class': {
|
|
711
|
+
meta: {
|
|
712
|
+
type: 'problem',
|
|
713
|
+
docs: {
|
|
714
|
+
description:
|
|
715
|
+
"Disallow a typeface named in a class; fonts come from the Source's typeface preset.",
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
create: stringVisitors(
|
|
719
|
+
FONT_FAMILY_CLASS,
|
|
720
|
+
"A typeface named in a class ignores the Source's typeface preset. Headings take font-heading and body text inherits font-sans; code takes font-mono (Ekanos design system § Typography, ADR 0008).",
|
|
721
|
+
),
|
|
722
|
+
},
|
|
723
|
+
'no-arbitrary-color': {
|
|
724
|
+
meta: {
|
|
725
|
+
type: 'problem',
|
|
726
|
+
docs: {
|
|
727
|
+
description:
|
|
728
|
+
'Disallow a literal colour in an arbitrary utility, shadow or ring; colour comes from theme tokens.',
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
create: stringVisitors(
|
|
732
|
+
ARBITRARY_COLOR_UTILITY,
|
|
733
|
+
"A literal colour ignores the Source's theme and dark mode. Use a token class (text-foreground, bg-muted, border-border, ring-ring/50), a token in a value (shadow-[0_0_0_1px_var(--border)]), or a CSS variable a component sets from the theme (ADR 0008).",
|
|
734
|
+
),
|
|
735
|
+
},
|
|
736
|
+
'heading-weight-tokens': {
|
|
737
|
+
meta: {
|
|
738
|
+
type: 'problem',
|
|
739
|
+
docs: {
|
|
740
|
+
description:
|
|
741
|
+
"Disallow a fixed weight on a heading; a heading's weight comes from the typeface preset.",
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
create: predicateVisitors(
|
|
745
|
+
isFixedHeadingWeight,
|
|
746
|
+
"A heading's weight follows the Source's typeface preset: write font-heading-bold or font-heading-semibold beside font-heading, not font-bold or font-semibold (Ekanos design system § Typography).",
|
|
747
|
+
),
|
|
748
|
+
},
|
|
605
749
|
'no-absolute-colors': {
|
|
606
750
|
meta: {
|
|
607
751
|
type: 'problem',
|
|
@@ -615,17 +759,17 @@ export default {
|
|
|
615
759
|
'white/black color utilities ignore the theme, dark mode and Source branding. Use a token: bg-card or bg-background for surfaces, text-foreground / text-primary-foreground for text. A modal scrim may stay black with a disable comment saying so (design-system theming rule).',
|
|
616
760
|
),
|
|
617
761
|
},
|
|
618
|
-
'no-
|
|
762
|
+
'no-font-awesome-icon': {
|
|
619
763
|
meta: {
|
|
620
764
|
type: 'problem',
|
|
621
765
|
docs: {
|
|
622
766
|
description:
|
|
623
|
-
'Disallow a
|
|
767
|
+
'Disallow a Font Awesome icon value; write the Phosphor name so the theme decides the weight.',
|
|
624
768
|
},
|
|
625
769
|
},
|
|
626
770
|
create: stringVisitors(
|
|
627
|
-
|
|
628
|
-
'Write the
|
|
771
|
+
FONT_AWESOME_ICON,
|
|
772
|
+
'Write the Phosphor name (`house`, not `fa-solid fa-house`): icons are Phosphor, every one draws in the theme’s icon style, and a filled state glyph is `star:fill` (phosphoricons.com).',
|
|
629
773
|
),
|
|
630
774
|
},
|
|
631
775
|
'no-overlay-width-class': {
|
|
@@ -668,6 +812,48 @@ export default {
|
|
|
668
812
|
};
|
|
669
813
|
},
|
|
670
814
|
},
|
|
815
|
+
'no-control-height-class': {
|
|
816
|
+
meta: {
|
|
817
|
+
type: 'problem',
|
|
818
|
+
docs: {
|
|
819
|
+
description:
|
|
820
|
+
'Disallow a height class on a sized kit control; it takes size from the control height scale.',
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
/** @param {RuleContext} context */
|
|
824
|
+
create(context) {
|
|
825
|
+
return {
|
|
826
|
+
/** @param {JsxElement} node */
|
|
827
|
+
JSXOpeningElement(node) {
|
|
828
|
+
if (!SIZED_CONTROLS.has(jsxName(node.name) ?? '')) return;
|
|
829
|
+
|
|
830
|
+
for (const attribute of node.attributes ?? []) {
|
|
831
|
+
if (
|
|
832
|
+
attribute.type !== 'JSXAttribute' ||
|
|
833
|
+
attribute.name?.name !== 'className'
|
|
834
|
+
) {
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const flagged = classNameStrings(attribute.value).some(
|
|
839
|
+
(literal) =>
|
|
840
|
+
typeof literal.value === 'string' &&
|
|
841
|
+
literal.value
|
|
842
|
+
.split(/\s+/)
|
|
843
|
+
.some((token) => CONTROL_HEIGHT.test(token)),
|
|
844
|
+
);
|
|
845
|
+
|
|
846
|
+
if (flagged) {
|
|
847
|
+
context.report({
|
|
848
|
+
node: attribute,
|
|
849
|
+
message: CONTROL_HEIGHT_MESSAGE,
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
};
|
|
855
|
+
},
|
|
856
|
+
},
|
|
671
857
|
'no-rounded-row-hover': {
|
|
672
858
|
meta: {
|
|
673
859
|
type: 'problem',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The official SDK for building Ekanos integrations.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/sdk/overview",
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
"access": "public"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@ekanos/integration-schema": "0.
|
|
118
|
-
"@ekanos/ui": "0.
|
|
117
|
+
"@ekanos/integration-schema": "0.26.0",
|
|
118
|
+
"@ekanos/ui": "0.26.0",
|
|
119
119
|
"@supabase/supabase-js": "2.119.0",
|
|
120
120
|
"server-only": "^0.0.1",
|
|
121
121
|
"zod-to-json-schema": "3.25.2"
|