@nikala-ui/core 0.11.0 → 0.12.1

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 (109) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +97 -20
  3. package/package.json +43 -2
  4. package/registry/api-table.json +21 -0
  5. package/registry/banner.json +1 -1
  6. package/registry/button.json +1 -1
  7. package/registry/callout.json +19 -0
  8. package/registry/checkbox.json +4 -1
  9. package/registry/code-block.json +26 -0
  10. package/registry/code-group.json +20 -0
  11. package/registry/combobox.json +1 -1
  12. package/registry/command.json +3 -2
  13. package/registry/component-viewer.json +25 -0
  14. package/registry/container.json +18 -0
  15. package/registry/context-menu.json +1 -1
  16. package/registry/create-app-updater.json +13 -0
  17. package/registry/create-document-tabs.json +13 -0
  18. package/registry/create-global-shortcut.json +13 -0
  19. package/registry/create-tauri-window.json +13 -0
  20. package/registry/create-tiptap-editor.json +34 -0
  21. package/registry/dialog.json +1 -1
  22. package/registry/dropdown-menu.json +3 -2
  23. package/registry/field.json +1 -1
  24. package/registry/file-tree.json +21 -0
  25. package/registry/footer.json +1 -1
  26. package/registry/form-message.json +3 -2
  27. package/registry/icon-button.json +1 -1
  28. package/registry/index.json +336 -5
  29. package/registry/navbar.json +1 -1
  30. package/registry/navigation-menu.json +1 -1
  31. package/registry/number-input.json +1 -1
  32. package/registry/package-manager-tabs.json +24 -0
  33. package/registry/pager.json +21 -0
  34. package/registry/popover.json +4 -1
  35. package/registry/resizable.json +1 -1
  36. package/registry/rich-text-editor.json +95 -0
  37. package/registry/scroll-area.json +1 -1
  38. package/registry/section-heading.json +21 -0
  39. package/registry/select.json +3 -2
  40. package/registry/sheet.json +1 -1
  41. package/registry/sidebar.json +1 -1
  42. package/registry/status.json +1 -1
  43. package/registry/steps.json +20 -0
  44. package/registry/switch.json +4 -1
  45. package/registry/table-of-contents.json +23 -0
  46. package/registry/tabs.json +4 -1
  47. package/registry/theme-manager.json +6 -5
  48. package/registry/titlebar-tabs.json +24 -0
  49. package/registry/titlebar.json +26 -0
  50. package/registry/toggle-group.json +1 -1
  51. package/registry/updater-modal.json +26 -0
  52. package/src/index.ts +48 -0
  53. package/src/registry/components/ui/api-table.tsx +117 -0
  54. package/src/registry/components/ui/banner.tsx +0 -2
  55. package/src/registry/components/ui/button.tsx +1 -1
  56. package/src/registry/components/ui/callout.tsx +137 -0
  57. package/src/registry/components/ui/checkbox.tsx +1 -1
  58. package/src/registry/components/ui/code-block.tsx +326 -0
  59. package/src/registry/components/ui/code-group.tsx +105 -0
  60. package/src/registry/components/ui/combobox.tsx +83 -18
  61. package/src/registry/components/ui/command.tsx +110 -106
  62. package/src/registry/components/ui/component-viewer.tsx +363 -0
  63. package/src/registry/components/ui/container.tsx +45 -0
  64. package/src/registry/components/ui/context-menu.tsx +67 -22
  65. package/src/registry/components/ui/dialog.tsx +42 -32
  66. package/src/registry/components/ui/dropdown-menu.tsx +69 -31
  67. package/src/registry/components/ui/field.tsx +7 -3
  68. package/src/registry/components/ui/file-tree.tsx +181 -0
  69. package/src/registry/components/ui/footer.tsx +1 -1
  70. package/src/registry/components/ui/form-message.tsx +2 -2
  71. package/src/registry/components/ui/icon-button.tsx +1 -1
  72. package/src/registry/components/ui/navbar.tsx +18 -11
  73. package/src/registry/components/ui/navigation-menu.tsx +2 -2
  74. package/src/registry/components/ui/number-input.tsx +3 -3
  75. package/src/registry/components/ui/package-manager-tabs.tsx +226 -0
  76. package/src/registry/components/ui/pager.tsx +102 -0
  77. package/src/registry/components/ui/popover.tsx +1 -1
  78. package/src/registry/components/ui/resizable.tsx +3 -1
  79. package/src/registry/components/ui/rich-text-editor/bubble-menu.tsx +236 -0
  80. package/src/registry/components/ui/rich-text-editor/editor.tsx +308 -0
  81. package/src/registry/components/ui/rich-text-editor/extensions.ts +116 -0
  82. package/src/registry/components/ui/rich-text-editor/footer.tsx +36 -0
  83. package/src/registry/components/ui/rich-text-editor/image-dialog.tsx +75 -0
  84. package/src/registry/components/ui/rich-text-editor/index.ts +11 -0
  85. package/src/registry/components/ui/rich-text-editor/link-dialog.tsx +48 -0
  86. package/src/registry/components/ui/rich-text-editor/markdown.ts +170 -0
  87. package/src/registry/components/ui/rich-text-editor/slash-command.tsx +301 -0
  88. package/src/registry/components/ui/rich-text-editor/table-controls.tsx +68 -0
  89. package/src/registry/components/ui/rich-text-editor/toolbar.tsx +465 -0
  90. package/src/registry/components/ui/rich-text-editor/use-editor.ts +231 -0
  91. package/src/registry/components/ui/scroll-area.tsx +12 -2
  92. package/src/registry/components/ui/section-heading.tsx +108 -0
  93. package/src/registry/components/ui/select.tsx +16 -19
  94. package/src/registry/components/ui/sheet.tsx +58 -53
  95. package/src/registry/components/ui/sidebar.tsx +4 -4
  96. package/src/registry/components/ui/status.tsx +7 -5
  97. package/src/registry/components/ui/steps.tsx +198 -0
  98. package/src/registry/components/ui/switch.tsx +1 -1
  99. package/src/registry/components/ui/table-of-contents.tsx +131 -0
  100. package/src/registry/components/ui/tabs.tsx +1 -1
  101. package/src/registry/components/ui/theme-toggle.tsx +175 -139
  102. package/src/registry/components/ui/titlebar-tabs.tsx +773 -0
  103. package/src/registry/components/ui/titlebar.tsx +468 -0
  104. package/src/registry/components/ui/toggle-group.tsx +1 -1
  105. package/src/registry/components/ui/updater-modal.tsx +254 -0
  106. package/src/registry/metadata.ts +167 -6
  107. package/src/registry/providers/theme-provider.tsx +16 -8
  108. package/src/registry/providers/theme-script.tsx +29 -9
  109. package/src/registry/providers/theme-transitions.ts +81 -50
@@ -26,8 +26,25 @@ function ensureTransitionStyles() {
26
26
  }
27
27
  }
28
28
 
29
+ /**
30
+ * Checks whether the current environment is Linux WebKitGTK (e.g. Tauri on Linux)
31
+ * where CSS View Transitions pseudo-element animations trigger known WebProcess crashes.
32
+ */
33
+ function isLinuxWebKit(): boolean {
34
+ if (typeof navigator === "undefined") return false;
35
+ const ua = navigator.userAgent || "";
36
+ const isLinux = /linux/i.test(ua);
37
+ const isWebKit = /applewebkit/i.test(ua);
38
+ const isChrome = /chrome|chromium|edg/i.test(ua);
39
+ const isTauri = typeof window !== "undefined" && typeof (window as any).__TAURI_INTERNALS__ !== "undefined";
40
+
41
+ return isLinux && ((isWebKit && !isChrome) || isTauri);
42
+ }
43
+
29
44
  /**
30
45
  * Executes a theme change with the specified transition effect using the Web View Transitions API.
46
+ * Supported on modern browsers, Windows (Tauri WebView2), and macOS (Tauri WKWebView).
47
+ * Automatically falls back to safe instant transitions on Linux WebKitGTK.
31
48
  *
32
49
  * @param effect - Desired transition animation ("none", "circular", "fade")
33
50
  * @param event - Mouse or Pointer event to calculate transition center coordinates
@@ -38,12 +55,14 @@ export function runThemeTransition(
38
55
  event: MouseEvent | undefined,
39
56
  updateThemeCallback: () => void
40
57
  ) {
41
- // Safe fallback if View Transitions API is unsupported or user prefers reduced motion
58
+ // Safe fallback if View Transitions API is unsupported, reduced motion is preferred,
59
+ // or on Linux WebKitGTK where pseudo-element clipping transitions trigger WebProcess faults
42
60
  if (
43
61
  effect === "none" ||
44
62
  typeof document === "undefined" ||
45
63
  !(document as any).startViewTransition ||
46
- window.matchMedia("(prefers-reduced-motion: reduce)").matches
64
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches ||
65
+ isLinuxWebKit()
47
66
  ) {
48
67
  updateThemeCallback();
49
68
  return;
@@ -51,58 +70,70 @@ export function runThemeTransition(
51
70
 
52
71
  ensureTransitionStyles();
53
72
 
54
- // Circular expanding ripple transition originating from click coordinates
55
- if (effect === "circular" && event) {
56
- const x = event.clientX;
57
- const y = event.clientY;
73
+ try {
74
+ // Circular expanding ripple transition originating from click coordinates
75
+ if (effect === "circular" && event) {
76
+ const x = event.clientX;
77
+ const y = event.clientY;
58
78
 
59
- const endRadius = Math.hypot(
60
- Math.max(x, window.innerWidth - x),
61
- Math.max(y, window.innerHeight - y)
62
- );
79
+ const endRadius = Math.hypot(
80
+ Math.max(x, window.innerWidth - x),
81
+ Math.max(y, window.innerHeight - y)
82
+ );
63
83
 
64
- const transition = (document as any).startViewTransition(() => {
65
- updateThemeCallback();
66
- });
84
+ const transition = (document as any).startViewTransition(() => {
85
+ updateThemeCallback();
86
+ });
67
87
 
68
- transition.ready.then(() => {
69
- document.documentElement.animate(
70
- {
71
- clipPath: [
72
- `circle(0px at ${x}px ${y}px)`,
73
- `circle(${endRadius}px at ${x}px ${y}px)`,
74
- ],
75
- },
76
- {
77
- duration: 500,
78
- easing: "ease-in-out",
79
- pseudoElement: "::view-transition-new(root)",
80
- }
81
- );
82
- });
83
- return;
84
- }
88
+ transition.ready
89
+ ?.then(() => {
90
+ document.documentElement.animate(
91
+ {
92
+ clipPath: [
93
+ `circle(0px at ${x}px ${y}px)`,
94
+ `circle(${endRadius}px at ${x}px ${y}px)`,
95
+ ],
96
+ },
97
+ {
98
+ duration: 500,
99
+ easing: "ease-in-out",
100
+ pseudoElement: "::view-transition-new(root)",
101
+ }
102
+ );
103
+ })
104
+ ?.catch(() => {
105
+ // Graceful fallback
106
+ });
107
+ return;
108
+ }
85
109
 
86
- // Smooth opacity fade view transition
87
- if (effect === "fade") {
88
- const transition = (document as any).startViewTransition(() => {
89
- updateThemeCallback();
90
- });
110
+ // Smooth opacity fade view transition
111
+ if (effect === "fade") {
112
+ const transition = (document as any).startViewTransition(() => {
113
+ updateThemeCallback();
114
+ });
91
115
 
92
- transition.ready.then(() => {
93
- document.documentElement.animate(
94
- {
95
- opacity: [0, 1],
96
- },
97
- {
98
- duration: 350,
99
- easing: "ease-in-out",
100
- pseudoElement: "::view-transition-new(root)",
101
- }
102
- );
103
- });
104
- return;
105
- }
116
+ transition.ready
117
+ ?.then(() => {
118
+ document.documentElement.animate(
119
+ {
120
+ opacity: [0, 1],
121
+ },
122
+ {
123
+ duration: 350,
124
+ easing: "ease-in-out",
125
+ pseudoElement: "::view-transition-new(root)",
126
+ }
127
+ );
128
+ })
129
+ ?.catch(() => {
130
+ // Graceful fallback
131
+ });
132
+ return;
133
+ }
106
134
 
107
- updateThemeCallback();
135
+ updateThemeCallback();
136
+ } catch {
137
+ updateThemeCallback();
138
+ }
108
139
  }