@gntik-ai/templates 0.10.0 → 0.12.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 (76) hide show
  1. package/dist/index.d.ts +58 -18
  2. package/dist/index.js +471 -391
  3. package/dist/index.js.map +1 -1
  4. package/package.json +8 -8
  5. package/src/assistant-chat/Page.test.tsx +37 -7
  6. package/src/assistant-chat/Page.tsx +98 -137
  7. package/src/assistant-chat/data.ts +69 -1
  8. package/src/assistant-chat/examples/AdapterChat.tsx +9 -0
  9. package/src/assistant-chat/template.meta.ts +1 -1
  10. package/src/board/Lane.tsx +1 -1
  11. package/src/code-editor/Page.test.tsx +12 -0
  12. package/src/code-editor/Page.tsx +2 -1
  13. package/src/code-editor/examples/PaletteTypography.tsx +130 -0
  14. package/src/code-editor/template.meta.ts +1 -1
  15. package/src/contact/Page.test.tsx +106 -0
  16. package/src/contact/Page.tsx +21 -3
  17. package/src/contact/PublicFrame.tsx +2 -17
  18. package/src/contact/examples/CustomFailure.tsx +24 -0
  19. package/src/contact/examples/FailedSend.tsx +19 -0
  20. package/src/contact/template.meta.ts +2 -2
  21. package/src/docs-article/Page.tsx +1 -1
  22. package/src/help-home/Page.test.tsx +10 -0
  23. package/src/help-home/Page.tsx +2 -4
  24. package/src/incident-console/Page.tsx +1 -1
  25. package/src/keyboard-shortcuts/Page.test.tsx +23 -1
  26. package/src/keyboard-shortcuts/Page.tsx +13 -3
  27. package/src/keyboard-shortcuts/ShortcutSheet.tsx +4 -5
  28. package/src/landing/Page.tsx +3 -17
  29. package/src/landing/template.meta.ts +1 -1
  30. package/src/messaging/Page.test.tsx +20 -3
  31. package/src/messaging/Page.tsx +15 -43
  32. package/src/messaging/template.meta.ts +1 -1
  33. package/src/notification-inbox/Page.tsx +1 -1
  34. package/src/pending-activation/Page.test.tsx +1 -1
  35. package/src/pricing/PublicFrame.tsx +2 -17
  36. package/src/pricing/template.meta.ts +1 -1
  37. package/src/resource-detail/CustomTabs.tsx +41 -0
  38. package/src/resource-detail/Page.default.test.tsx +29 -0
  39. package/src/resource-detail/Page.shell-less.test.tsx +36 -0
  40. package/src/resource-detail/Page.tabs.test.tsx +116 -0
  41. package/src/resource-detail/Page.tsx +62 -27
  42. package/src/resource-detail/__snapshots__/Page.default.test.tsx.snap +5 -0
  43. package/src/resource-detail/examples/embedded-custom-tabs.tsx +44 -0
  44. package/src/resource-detail/template.meta.ts +1 -1
  45. package/src/resource-index/Page.test.tsx +178 -1
  46. package/src/resource-index/Page.tsx +59 -3
  47. package/src/resource-index/examples/UrlSynced.tsx +10 -0
  48. package/src/resource-index/template.meta.ts +1 -1
  49. package/src/resource-tree/Page.tsx +1 -1
  50. package/src/run-trace/Page.tsx +2 -2
  51. package/src/scorecard/Page.test.tsx +54 -0
  52. package/src/scorecard/Page.tsx +2 -0
  53. package/src/scorecard/data.ts +1 -1
  54. package/src/search-results/Page.tsx +3 -6
  55. package/src/settings-appearance/Page.test.tsx +36 -1
  56. package/src/settings-appearance/Page.tsx +15 -2
  57. package/src/settings-appearance/template.meta.ts +2 -1
  58. package/src/settings-profile/__tests__/dom.ts +4 -2
  59. package/src/settings-profile/fixtures/editable.snap +1 -1
  60. package/src/shared/ConsoleShell.context.test.tsx +125 -0
  61. package/src/shared/ConsoleShell.navigation.test.tsx +100 -0
  62. package/src/shared/ConsoleShell.tsx +38 -9
  63. package/src/shell-sidebar/Examples.test.tsx +73 -0
  64. package/src/shell-sidebar/examples/Brand.tsx +16 -0
  65. package/src/shell-sidebar/examples/ContextRegion.tsx +26 -0
  66. package/src/shell-sidebar/examples/PlatformWide.tsx +11 -0
  67. package/src/shell-sidebar/examples/Tenants.tsx +42 -0
  68. package/src/shell-sidebar/examples/UserMenuChildren.tsx +23 -0
  69. package/src/shell-sidebar/template.meta.ts +1 -1
  70. package/src/sign-in/BrandPanel.tsx +2 -2
  71. package/src/sign-in/Page.test.tsx +5 -0
  72. package/src/sso-login/Page.test.tsx +6 -0
  73. package/src/sso-login/Page.tsx +1 -0
  74. package/src/test/public-footer.test.tsx +44 -0
  75. package/src/test/without-forced-colors.test.ts +44 -0
  76. package/src/test/without-forced-colors.ts +14 -0
@@ -0,0 +1,44 @@
1
+ import { withoutForcedColors } from './without-forced-colors';
2
+
3
+ describe('withoutForcedColors', () => {
4
+ it('drops an all-forced class attribute but preserves empty and ordinary attributes exactly', () => {
5
+ const element = document.createElement('div');
6
+ element.innerHTML =
7
+ '<i class="forced-colors:block\tforced-colors:bg-[Canvas]"></i><b class=""></b><span class=" \t "></span><em></em>';
8
+
9
+ expect(withoutForcedColors(element).innerHTML).toBe('<i></i><b class=""></b><span class=" \t "></span><em></em>');
10
+ });
11
+
12
+ it('clones the whole DOM and removes only forced-colors class tokens', () => {
13
+ const element = document.createElement('section');
14
+ element.setAttribute('class', 'alpha\tforced-colors:bg-[Canvas]\n beta');
15
+ element.setAttribute('data-state', 'checked');
16
+ element.innerHTML =
17
+ 'Before<!--keep--><span class="first forced-colors:text-[HighlightText] hover:forced-colors:bg-[Canvas] last" aria-label="Choice">Text <b class="bold unchanged">inside</b></span>After<svg class="icon forced-colors:fill-[CanvasText]"><path d="M0 0"></path></svg>';
18
+ const original = element.outerHTML;
19
+
20
+ const filtered = withoutForcedColors(element);
21
+
22
+ expect(filtered.outerHTML).toBe(
23
+ '<section class="alpha beta" data-state="checked">Before<!--keep--><span class="first hover:forced-colors:bg-[Canvas] last" aria-label="Choice">Text <b class="bold unchanged">inside</b></span>After<svg class="icon"><path d="M0 0"></path></svg></section>',
24
+ );
25
+ expect(filtered).not.toBe(element);
26
+ expect(filtered.firstElementChild).not.toBe(element.firstElementChild);
27
+ expect(element.outerHTML).toBe(original);
28
+ });
29
+
30
+ it.each(['class', 'aria-label'])('retains a %s regression in a fixture copy', (attribute) => {
31
+ const element = document.createElement('div');
32
+ element.innerHTML = '<button class="ordinary forced-colors:bg-[Highlight]" aria-label="Save">Save</button>';
33
+ const baseline = '<button class="ordinary" aria-label="Save">Save</button>';
34
+ expect(withoutForcedColors(element).innerHTML).toBe(baseline);
35
+
36
+ const changed = element.cloneNode(true) as HTMLElement;
37
+ changed.firstElementChild!.setAttribute(attribute, 'changed');
38
+
39
+ expect(withoutForcedColors(changed).innerHTML).not.toBe(baseline);
40
+ expect(element.innerHTML).toBe(
41
+ '<button class="ordinary forced-colors:bg-[Highlight]" aria-label="Save">Save</button>',
42
+ );
43
+ });
44
+ });
@@ -0,0 +1,14 @@
1
+ /** Compare pinned ordinary-colour DOM without media-scoped forced-colour classes. */
2
+ export function withoutForcedColors(element: HTMLElement): HTMLElement {
3
+ const clone = element.cloneNode(true) as HTMLElement;
4
+ for (const node of [clone, ...clone.querySelectorAll('[class]')]) {
5
+ const classes = node.getAttribute('class');
6
+ if (classes === null) continue;
7
+ const tokens = classes.split(/\s+/).filter(Boolean);
8
+ const ordinary = tokens.filter((token) => !token.startsWith('forced-colors:'));
9
+ if (ordinary.length === tokens.length) continue;
10
+ if (ordinary.length === 0) node.removeAttribute('class');
11
+ else node.setAttribute('class', ordinary.join(' '));
12
+ }
13
+ return clone;
14
+ }