@ekanos/sdk 0.25.0 → 0.27.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.
Files changed (62) hide show
  1. package/README.md +9 -11
  2. package/api-report.md +27 -6
  3. package/dist/components/base-activation-dialog.js +2 -2
  4. package/dist/components/base-activation-dialog.js.map +1 -1
  5. package/dist/components/base-activation-form.js +1 -1
  6. package/dist/components/base-activation-form.js.map +1 -1
  7. package/dist/components/base-marketplace-tile.js +2 -2
  8. package/dist/components/base-marketplace-tile.js.map +1 -1
  9. package/dist/components/index.d.ts +1 -0
  10. package/dist/components/index.js +1 -0
  11. package/dist/components/index.js.map +1 -1
  12. package/dist/components/oauth-activation-form.d.ts +8 -0
  13. package/dist/components/oauth-activation-form.js +10 -4
  14. package/dist/components/oauth-activation-form.js.map +1 -1
  15. package/dist/components/widgets/ai-prompt-chip.js +3 -3
  16. package/dist/components/widgets/ai-prompt-chip.js.map +1 -1
  17. package/dist/components/widgets/widget-ask-bar.js +1 -1
  18. package/dist/components/widgets/widget-ask-bar.js.map +1 -1
  19. package/dist/components/widgets/widget-ask-presentation.d.ts +35 -0
  20. package/dist/components/widgets/widget-ask-presentation.js +35 -0
  21. package/dist/components/widgets/widget-ask-presentation.js.map +1 -0
  22. package/dist/components/widgets/widget-state-components.d.ts +6 -1
  23. package/dist/components/widgets/widget-state-components.js +9 -9
  24. package/dist/components/widgets/widget-state-components.js.map +1 -1
  25. package/dist/components/widgets/widget.d.ts +4 -4
  26. package/dist/components/widgets/widget.js +43 -31
  27. package/dist/components/widgets/widget.js.map +1 -1
  28. package/dist/context/types.d.ts +1 -1
  29. package/dist/context/types.js.map +1 -1
  30. package/dist/contract/derive-contract.js +16 -10
  31. package/dist/contract/derive-contract.js.map +1 -1
  32. package/dist/contract/types.d.ts +1 -1
  33. package/dist/contract/types.js.map +1 -1
  34. package/dist/experience/client.d.ts +76 -0
  35. package/dist/experience/client.js +103 -2
  36. package/dist/experience/client.js.map +1 -1
  37. package/dist/experience/runtime.d.ts +16 -0
  38. package/dist/experience/runtime.js.map +1 -1
  39. package/dist/experience/sdk-instances.d.ts +11 -0
  40. package/dist/experience/sdk-instances.js +47 -0
  41. package/dist/experience/sdk-instances.js.map +1 -0
  42. package/dist/hooks/index.d.ts +1 -1
  43. package/dist/hooks/index.js.map +1 -1
  44. package/dist/hooks/partner-oauth.d.ts +15 -2
  45. package/dist/hooks/partner-oauth.js +3 -0
  46. package/dist/hooks/partner-oauth.js.map +1 -1
  47. package/dist/index.d.ts +1 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/integration/index.d.ts +4 -2
  50. package/dist/integration/index.js +4 -1
  51. package/dist/integration/index.js.map +1 -1
  52. package/dist/testing/mock-context.d.ts +21 -2
  53. package/dist/testing/mock-context.js +102 -45
  54. package/dist/testing/mock-context.js.map +1 -1
  55. package/dist/types/workspace-target.d.ts +1 -1
  56. package/dist/types/workspace-target.js.map +1 -1
  57. package/dist/version.d.ts +7 -0
  58. package/dist/version.js +8 -0
  59. package/dist/version.js.map +1 -0
  60. package/eslint.design-preset.mjs +6 -4
  61. package/eslint.design-rules.mjs +218 -9
  62. package/package.json +3 -3
@@ -14,7 +14,7 @@
14
14
  * submission).
15
15
  *
16
16
  * ── What it enforces ─────────────────────────────────────────────────────
17
- * Ten rules. One is local to this file: no raw interactive HTML element
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 other thirteen are the host's own `design/*` rules — palette-adjacent
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 — imported from `./eslint.design-rules.mjs`, the single
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
@@ -119,7 +121,7 @@ export const FORBIDDEN_ELEMENTS = [
119
121
  '(sorting, paging, empty and loading states); use <Table> from ' +
120
122
  '@ekanos/ui/table only for a simple static table. ' +
121
123
  'For a plain list, prefer edge-to-edge rows: a container with no horizontal ' +
122
- 'padding, each row `px-5 py-3` with a flat `hover:bg-accent/50`, ' +
124
+ 'padding, each row `px-5 py-3` with a flat `hover:bg-muted`, ' +
123
125
  'separated by <Separator> from @ekanos/ui/separator. See ' +
124
126
  "the design system's widget rules.",
125
127
  },
@@ -68,6 +68,16 @@
68
68
 
69
69
  const FADED_MUTED = /(?:^|[\s:'"`])(?:[\w-]+:)*text-muted-foreground\/\d+/;
70
70
 
71
+ /**
72
+ * A grey that is not on the surface ladder: an opacity step on a neutral
73
+ * token (`bg-muted/50`, `dark:bg-input/30`, `text-foreground/60`) or a
74
+ * `color-mix` of neutral tokens. `ring-foreground/10` is the elevation edge
75
+ * and stays legal; a gradient's stops (`from-`/`via-`/`to-`) fade and stay
76
+ * legal too.
77
+ */
78
+ const NEUTRAL_WASH =
79
+ /(?:(?:^|[\s:'"`])(?:[\w-]+:)*(?:bg|text|border|divide|fill|stroke|outline)-(?:foreground|background|muted|accent|secondary|input|border|card|popover|field|sidebar|muted-foreground|card-foreground|popover-foreground|secondary-foreground|accent-foreground)\/(?:\d+|\[[^\]]+\]))|color-mix\(in_\w+,\s*var\(--(?:foreground|background|muted|accent|secondary|input|border|card|popover|field)\)/;
80
+
71
81
  /** `bg-white`, `text-black/50`, `dark:border-white`… — @shadcn/lint's
72
82
  * no-raw-colors covers the palette scales but not these two. */
73
83
  const ABSOLUTE_COLOR =
@@ -100,12 +110,13 @@ function stringVisitors(test, message) {
100
110
  }
101
111
 
102
112
  /**
103
- * A default icon family written before an icon name (plan 251 D44). Icons are
104
- * written family-less (`fa-gear`) so the theme's icon style reaches every one;
105
- * `fa-solid` / `fa-duotone` emphasis and `fa-brands` are deliberate and allowed.
113
+ * A Font Awesome icon value (`fa-solid fa-house`). Icons are Phosphor names
114
+ * (`house`), written without a weight so the theme's icon style reaches every
115
+ * one; a Font Awesome value still draws through a translation table, but new
116
+ * code writes the Phosphor name.
106
117
  */
107
- const DEFAULT_ICON_FAMILY =
108
- /(?:^|[\s'"`])(?:fa-(?:light|regular|thin|duotone)\s+fa-[a-z0-9]|fa-solid\s+fa-(?!(?:circle|star|square|thumbtack)(?![a-z0-9-]))[a-z0-9])/;
118
+ const FONT_AWESOME_ICON =
119
+ /(?:^|[\s'"`])fa-(?:solid|regular|light|thin|duotone|brands|sharp)\s+fa-[a-z0-9]/;
109
120
 
110
121
  const BADGE_TONES = new Set(['success', 'warning', 'info']);
111
122
 
@@ -151,6 +162,35 @@ const OVERLAY_WIDTH =
151
162
  const OVERLAY_WIDTH_MESSAGE =
152
163
  '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
164
 
165
+ /**
166
+ * The kit's sized controls: each takes its height from `size` (Ekanos design system §
167
+ * Sizes), so a height class at a call site steps it off the one scale and out
168
+ * of line with the controls beside it.
169
+ */
170
+ const SIZED_CONTROLS = new Set([
171
+ 'Button',
172
+ 'Input',
173
+ 'InputGroup',
174
+ 'SelectTrigger',
175
+ 'ComboboxInput',
176
+ 'SearchField',
177
+ 'TabsList',
178
+ 'Toggle',
179
+ 'ToggleGroup',
180
+ 'Badge',
181
+ ]);
182
+
183
+ /**
184
+ * `h-8`, `sm:h-7`, `min-h-11`, `size-8`, `h-[30px]`… but not `h-full`,
185
+ * `h-auto`, `h-fit`, `min-h-0`, and never a child selector (`[&_svg]:size-4`,
186
+ * `*:data-[slot=icon]:size-3`), which sizes what is inside the control.
187
+ */
188
+ const CONTROL_HEIGHT =
189
+ /^(?:(?:[\w-]+|[\w-]*\[[^\]&]*\][\w-]*)+:)*(?:h|min-h|size)-(?!(?:full|auto|fit|min|max|0|px|screen|svh|dvh|lvh)$)\S+$/;
190
+
191
+ const CONTROL_HEIGHT_MESSAGE =
192
+ '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).';
193
+
154
194
  /**
155
195
  * Every string literal in a className value, including inside `cn(...)`.
156
196
  *
@@ -438,6 +478,55 @@ function propertyName(key) {
438
478
  return null;
439
479
  }
440
480
 
481
+ /*
482
+ * The brandable-theme rules (ADR 0008, owner 2026-11-10). A Source brands
483
+ * its look through tokens, so anything that writes a colour, a corner or a
484
+ * typeface literally stops that Source's choice from reaching the element.
485
+ */
486
+
487
+ /** A colour written out rather than read from a token: a hex value other
488
+ * than pure black or white, `rgb()`/`hsl()`, or an oklch with chroma
489
+ * (`oklch(0 0 0)` is a mask's black, not a colour). Tailwind writes spaces
490
+ * as `_` inside brackets, so either separator counts. */
491
+ const LITERAL_COLOR =
492
+ /#(?!(?: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;
493
+
494
+ const GRADIENT_FUNCTION = /(?:repeating-)?(?:linear|radial|conic)-gradient\(/;
495
+
496
+ /** @param {string} value */
497
+ function isLiteralGradient(value) {
498
+ return GRADIENT_FUNCTION.test(value) && LITERAL_COLOR.test(value);
499
+ }
500
+
501
+ /** `rounded-[10px]`, `rounded-tl-[0.5rem]`, `[border-radius:6px]`. A value
502
+ * that reads `--radius` (`rounded-[calc(var(--radius)-5px)]`) follows the
503
+ * shape preset and passes, and so does `rounded-[inherit]`. */
504
+ const ARBITRARY_RADIUS =
505
+ /(?:^|[\s'"`:])!?(?:rounded(?:-(?:[trblse]|tl|tr|br|bl|ss|se|es|ee))?-\[(?!inherit\])(?![^\]]*--radius)|\[border(?:-[a-z]+)*-radius:(?![^\]]*--radius))/;
506
+
507
+ /** A typeface named in a class: `font-['Inter']`, `font-serif`,
508
+ * `[font-family:…]`. Weights (`font-[550]`) and `font-mono` pass; the
509
+ * heading and body families come from the Source's typeface preset. */
510
+ const FONT_FAMILY_CLASS =
511
+ /(?:^|[\s'"`:])!?(?:font-\[(?![\d.]+\])|font-serif(?=$|[\s'"`])|\[font-family:)/;
512
+
513
+ /** A literal colour in an arbitrary utility: `text-[#242424]`,
514
+ * `bg-[oklch(0.6_0.2_27)]`, `border-[rgb(…)]`, or inside an arbitrary
515
+ * shadow, ring or outline (`shadow-[0_0_0_1px_#3355ff]`). */
516
+ const ARBITRARY_COLOR_UTILITY =
517
+ /(?:^|[\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;
518
+
519
+ /** A heading set in a fixed weight: `font-heading … font-bold`. A heading's
520
+ * weight follows the typeface preset (a display face sits lighter than a
521
+ * text face), so it is `font-heading-bold` or `font-heading-semibold`. */
522
+ /** @param {string} value */
523
+ function isFixedHeadingWeight(value) {
524
+ return (
525
+ /(?:^|[\s'"`:])font-heading(?=$|[\s'"`])/.test(value) &&
526
+ /(?:^|[\s'"`:])font-(?:bold|semibold)(?=$|[\s'"`])/.test(value)
527
+ );
528
+ }
529
+
441
530
  export default {
442
531
  meta: { name: 'design' },
443
532
  rules: {
@@ -602,6 +691,84 @@ export default {
602
691
  '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
692
  ),
604
693
  },
694
+ 'no-neutral-wash': {
695
+ meta: {
696
+ type: 'problem',
697
+ docs: {
698
+ description:
699
+ 'Disallow an opacity step or color-mix on a neutral token; every grey is a step of the surface ladder.',
700
+ },
701
+ },
702
+ create: stringVisitors(
703
+ NEUTRAL_WASH,
704
+ 'A grey between the ladder steps does not match the theme. Use a ladder token at full strength: bg-secondary for a quiet band, bg-muted for hover, bg-accent for the open or current state, bg-input for a filled control\u2019s hover, bg-field for a field, text-muted-foreground for quiet text. The assistant\u2019s chip is bg-primary-surface.',
705
+ ),
706
+ },
707
+ 'no-literal-gradient': {
708
+ meta: {
709
+ type: 'problem',
710
+ docs: {
711
+ description:
712
+ 'Disallow a gradient written with literal colours; the AI accent reads --brand-gradient so each Source paints its own.',
713
+ },
714
+ },
715
+ create: predicateVisitors(
716
+ isLiteralGradient,
717
+ '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).',
718
+ ),
719
+ },
720
+ 'no-arbitrary-radius': {
721
+ meta: {
722
+ type: 'problem',
723
+ docs: {
724
+ description:
725
+ "Disallow a literal corner radius; corners come from --radius so the Source's shape preset reaches them.",
726
+ },
727
+ },
728
+ create: stringVisitors(
729
+ ARBITRARY_RADIUS,
730
+ "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).",
731
+ ),
732
+ },
733
+ 'no-font-family-class': {
734
+ meta: {
735
+ type: 'problem',
736
+ docs: {
737
+ description:
738
+ "Disallow a typeface named in a class; fonts come from the Source's typeface preset.",
739
+ },
740
+ },
741
+ create: stringVisitors(
742
+ FONT_FAMILY_CLASS,
743
+ "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).",
744
+ ),
745
+ },
746
+ 'no-arbitrary-color': {
747
+ meta: {
748
+ type: 'problem',
749
+ docs: {
750
+ description:
751
+ 'Disallow a literal colour in an arbitrary utility, shadow or ring; colour comes from theme tokens.',
752
+ },
753
+ },
754
+ create: stringVisitors(
755
+ ARBITRARY_COLOR_UTILITY,
756
+ "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).",
757
+ ),
758
+ },
759
+ 'heading-weight-tokens': {
760
+ meta: {
761
+ type: 'problem',
762
+ docs: {
763
+ description:
764
+ "Disallow a fixed weight on a heading; a heading's weight comes from the typeface preset.",
765
+ },
766
+ },
767
+ create: predicateVisitors(
768
+ isFixedHeadingWeight,
769
+ "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).",
770
+ ),
771
+ },
605
772
  'no-absolute-colors': {
606
773
  meta: {
607
774
  type: 'problem',
@@ -615,17 +782,17 @@ export default {
615
782
  '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
783
  ),
617
784
  },
618
- 'no-default-icon-family': {
785
+ 'no-font-awesome-icon': {
619
786
  meta: {
620
787
  type: 'problem',
621
788
  docs: {
622
789
  description:
623
- 'Disallow a family in an icon name; write it family-less so the theme decides.',
790
+ 'Disallow a Font Awesome icon value; write the Phosphor name so the theme decides the weight.',
624
791
  },
625
792
  },
626
793
  create: stringVisitors(
627
- DEFAULT_ICON_FAMILY,
628
- 'Write the icon family-less (`fa-gear`, not `fa-solid fa-gear`): every icon draws in one family, regular by default or a Source’s icon style, and a family written here is ignored. Only `fa-brands` and a filled state glyph (`fa-solid fa-circle`, `fa-star`, `fa-square`, `fa-thumbtack`) keep theirs (plan 251 D44).',
794
+ FONT_AWESOME_ICON,
795
+ '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
796
  ),
630
797
  },
631
798
  'no-overlay-width-class': {
@@ -668,6 +835,48 @@ export default {
668
835
  };
669
836
  },
670
837
  },
838
+ 'no-control-height-class': {
839
+ meta: {
840
+ type: 'problem',
841
+ docs: {
842
+ description:
843
+ 'Disallow a height class on a sized kit control; it takes size from the control height scale.',
844
+ },
845
+ },
846
+ /** @param {RuleContext} context */
847
+ create(context) {
848
+ return {
849
+ /** @param {JsxElement} node */
850
+ JSXOpeningElement(node) {
851
+ if (!SIZED_CONTROLS.has(jsxName(node.name) ?? '')) return;
852
+
853
+ for (const attribute of node.attributes ?? []) {
854
+ if (
855
+ attribute.type !== 'JSXAttribute' ||
856
+ attribute.name?.name !== 'className'
857
+ ) {
858
+ continue;
859
+ }
860
+
861
+ const flagged = classNameStrings(attribute.value).some(
862
+ (literal) =>
863
+ typeof literal.value === 'string' &&
864
+ literal.value
865
+ .split(/\s+/)
866
+ .some((token) => CONTROL_HEIGHT.test(token)),
867
+ );
868
+
869
+ if (flagged) {
870
+ context.report({
871
+ node: attribute,
872
+ message: CONTROL_HEIGHT_MESSAGE,
873
+ });
874
+ }
875
+ }
876
+ },
877
+ };
878
+ },
879
+ },
671
880
  'no-rounded-row-hover': {
672
881
  meta: {
673
882
  type: 'problem',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/sdk",
3
- "version": "0.25.0",
3
+ "version": "0.27.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.25.0",
118
- "@ekanos/ui": "0.25.0",
117
+ "@ekanos/integration-schema": "0.27.0",
118
+ "@ekanos/ui": "0.27.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"