@surdeddd/wmkit 0.1.1 → 0.2.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 (54) hide show
  1. package/README.md +3 -7
  2. package/README.ru.md +3 -7
  3. package/dist/{controller-BfUF1k04.d.cts → binder-BY-saDUB.d.cts} +9 -3
  4. package/dist/{controller-1uedRvQw.d.ts → binder-D9UEE1SM.d.ts} +9 -3
  5. package/dist/{chunk-N5KNWRKU.js → chunk-2TVOEDRG.js} +298 -211
  6. package/dist/chunk-2TVOEDRG.js.map +1 -0
  7. package/dist/{chunk-TXINVEK3.cjs → chunk-KQCVZ2W7.cjs} +298 -211
  8. package/dist/chunk-KQCVZ2W7.cjs.map +1 -0
  9. package/dist/index.cjs +15 -15
  10. package/dist/index.d.cts +7 -4
  11. package/dist/index.d.ts +7 -4
  12. package/dist/index.js +1 -1
  13. package/dist/persist.cjs +1 -1
  14. package/dist/persist.cjs.map +1 -1
  15. package/dist/persist.d.cts +1 -1
  16. package/dist/persist.d.ts +1 -1
  17. package/dist/persist.js +1 -1
  18. package/dist/persist.js.map +1 -1
  19. package/dist/popout.cjs +1 -1
  20. package/dist/popout.cjs.map +1 -1
  21. package/dist/popout.d.cts +1 -1
  22. package/dist/popout.d.ts +1 -1
  23. package/dist/popout.js +1 -1
  24. package/dist/popout.js.map +1 -1
  25. package/dist/react.cjs +3 -3
  26. package/dist/react.cjs.map +1 -1
  27. package/dist/react.d.cts +2 -2
  28. package/dist/react.d.ts +2 -2
  29. package/dist/react.js +1 -1
  30. package/dist/react.js.map +1 -1
  31. package/dist/solid.cjs +3 -3
  32. package/dist/solid.cjs.map +1 -1
  33. package/dist/solid.d.cts +2 -2
  34. package/dist/solid.d.ts +2 -2
  35. package/dist/solid.js +1 -1
  36. package/dist/solid.js.map +1 -1
  37. package/dist/svelte.cjs +4 -4
  38. package/dist/svelte.cjs.map +1 -1
  39. package/dist/svelte.d.cts +2 -2
  40. package/dist/svelte.d.ts +2 -2
  41. package/dist/svelte.js +2 -2
  42. package/dist/svelte.js.map +1 -1
  43. package/dist/themes/glass.css +0 -1
  44. package/dist/{types-BYx7gCuT.d.cts → types-Bkrq2djr.d.cts} +1 -1
  45. package/dist/{types-BYx7gCuT.d.ts → types-Bkrq2djr.d.ts} +1 -1
  46. package/dist/vue.cjs +3 -3
  47. package/dist/vue.cjs.map +1 -1
  48. package/dist/vue.d.cts +2 -2
  49. package/dist/vue.d.ts +2 -2
  50. package/dist/vue.js +1 -1
  51. package/dist/vue.js.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/chunk-N5KNWRKU.js.map +0 -1
  54. package/dist/chunk-TXINVEK3.cjs.map +0 -1
package/README.md CHANGED
@@ -54,13 +54,7 @@ el.innerHTML = `
54
54
  <div data-wm-content>Anything you want.</div>
55
55
  `
56
56
  document.querySelector('#desktop').append(el)
57
- const detach = desktop.attachWindow(win.id, el)
58
-
59
- wm.on('close', ({ window: closed }) => {
60
- if (closed.id !== win.id) return
61
- detach()
62
- el.remove()
63
- })
57
+ desktop.attachWindow(win.id, el, { removeOnClose: true })
64
58
  ```
65
59
 
66
60
  The desktop element becomes the coordinate space. Your markup stays yours — wmkit wires behavior onto `data-wm-*` attributes:
@@ -72,6 +66,8 @@ The desktop element becomes the coordinate space. Your markup stays yours — wm
72
66
  | `data-wm-close` / `data-wm-minimize` / `data-wm-maximize` | control buttons, wired by delegation |
73
67
  | `data-wm-content` | scrollable content area (styled by themes) |
74
68
 
69
+ `removeOnClose` detaches the controller and removes the element when the window closes. Touch devices get larger resize hit areas and snap thresholds automatically (`pointer: coarse`); tune via `attachDesktop(wm, el, { hitAreas: { edge, corner } })`.
70
+
75
71
  The controller adds resize handles (`[data-wm-resize]`), a snap preview (`[data-wm-snap-preview]`) and a visually hidden live region for screen readers.
76
72
 
77
73
  ## React
package/README.ru.md CHANGED
@@ -50,13 +50,7 @@ el.innerHTML = `
50
50
  <div data-wm-content>Что угодно.</div>
51
51
  `
52
52
  document.querySelector('#desktop').append(el)
53
- const detach = desktop.attachWindow(win.id, el)
54
-
55
- wm.on('close', ({ window: closed }) => {
56
- if (closed.id !== win.id) return
57
- detach()
58
- el.remove()
59
- })
53
+ desktop.attachWindow(win.id, el, { removeOnClose: true })
60
54
  ```
61
55
 
62
56
  Элемент рабочего стола становится системой координат. Разметка остаётся вашей — wmkit вешает поведение на `data-wm-*` атрибуты:
@@ -68,6 +62,8 @@ wm.on('close', ({ window: closed }) => {
68
62
  | `data-wm-close` / `data-wm-minimize` / `data-wm-maximize` | кнопки управления, работают через делегирование |
69
63
  | `data-wm-content` | скроллируемая область контента |
70
64
 
65
+ `removeOnClose` сам отвязывает контроллер и удаляет элемент при закрытии окна. На тач-устройствах хит-зоны ресайза и порог снэпа автоматически крупнее (`pointer: coarse`); настраиваются через `attachDesktop(wm, el, { hitAreas: { edge, corner } })`.
66
+
71
67
  Контроллер добавляет ресайз-хендлы (`[data-wm-resize]`), превью снэпа (`[data-wm-snap-preview]`) и скрытый live-регион для скринридеров.
72
68
 
73
69
  ## Адаптеры
@@ -1,4 +1,4 @@
1
- import { B as Bounds, c as Size, d as SnapZone, W as WindowManager, i as WindowState } from './types-BYx7gCuT.cjs';
1
+ import { B as Bounds, f as Size, g as SnapZone, W as WindowManager, b as WindowState } from './types-Bkrq2djr.cjs';
2
2
 
3
3
  declare function clamp(value: number, min: number, max: number): number;
4
4
  declare function clampSize(size: Size, min: Size, max: Size | null): Size;
@@ -36,16 +36,22 @@ interface DesktopKeyboardOptions {
36
36
  moveStep?: number;
37
37
  cycle?: boolean;
38
38
  }
39
+ interface HitAreaOptions {
40
+ edge?: number;
41
+ corner?: number;
42
+ }
39
43
  interface DesktopOptions {
40
44
  snap?: boolean | DesktopSnapOptions;
41
45
  keyboard?: boolean | DesktopKeyboardOptions;
42
46
  announce?: boolean | Partial<AnnouncerMessages>;
43
47
  autoViewport?: boolean;
48
+ hitAreas?: HitAreaOptions;
44
49
  minimizeTarget?: (window: WindowState) => Element | null;
45
50
  }
46
51
  interface WindowAttachOptions {
47
52
  handle?: HTMLElement | string;
48
53
  resizeHandles?: boolean;
54
+ removeOnClose?: boolean;
49
55
  }
50
56
  interface DesktopController {
51
57
  element: HTMLElement;
@@ -53,7 +59,7 @@ interface DesktopController {
53
59
  attachWindow(id: string, element: HTMLElement, options?: WindowAttachOptions): () => void;
54
60
  destroy(): void;
55
61
  }
56
- declare function attachDesktop(wm: WindowManager, element: HTMLElement, options?: DesktopOptions): DesktopController;
62
+
57
63
  interface DesktopBinder {
58
64
  wm: WindowManager;
59
65
  controller(): DesktopController | null;
@@ -62,4 +68,4 @@ interface DesktopBinder {
62
68
  }
63
69
  declare function createDesktopBinder(wm: WindowManager, options?: DesktopOptions): DesktopBinder;
64
70
 
65
- export { type Announcer as A, type DesktopBinder as D, type SnapDetectOptions as S, type WindowAttachOptions as W, type AnnouncerMessages as a, type DesktopController as b, type DesktopKeyboardOptions as c, type DesktopOptions as d, type DesktopSnapOptions as e, attachDesktop as f, boundsEqual as g, clamp as h, clampSize as i, clampToViewport as j, createAnnouncer as k, createDesktopBinder as l, defaultMessages as m, detectSnapZone as n, zoneBounds as z };
71
+ export { type Announcer as A, type DesktopBinder as D, type HitAreaOptions as H, type SnapDetectOptions as S, type WindowAttachOptions as W, type DesktopController as a, type DesktopOptions as b, type AnnouncerMessages as c, type DesktopKeyboardOptions as d, type DesktopSnapOptions as e, boundsEqual as f, clamp as g, clampSize as h, clampToViewport as i, createAnnouncer as j, createDesktopBinder as k, defaultMessages as l, detectSnapZone as m, zoneBounds as z };
@@ -1,4 +1,4 @@
1
- import { B as Bounds, c as Size, d as SnapZone, W as WindowManager, i as WindowState } from './types-BYx7gCuT.js';
1
+ import { B as Bounds, f as Size, g as SnapZone, W as WindowManager, b as WindowState } from './types-Bkrq2djr.js';
2
2
 
3
3
  declare function clamp(value: number, min: number, max: number): number;
4
4
  declare function clampSize(size: Size, min: Size, max: Size | null): Size;
@@ -36,16 +36,22 @@ interface DesktopKeyboardOptions {
36
36
  moveStep?: number;
37
37
  cycle?: boolean;
38
38
  }
39
+ interface HitAreaOptions {
40
+ edge?: number;
41
+ corner?: number;
42
+ }
39
43
  interface DesktopOptions {
40
44
  snap?: boolean | DesktopSnapOptions;
41
45
  keyboard?: boolean | DesktopKeyboardOptions;
42
46
  announce?: boolean | Partial<AnnouncerMessages>;
43
47
  autoViewport?: boolean;
48
+ hitAreas?: HitAreaOptions;
44
49
  minimizeTarget?: (window: WindowState) => Element | null;
45
50
  }
46
51
  interface WindowAttachOptions {
47
52
  handle?: HTMLElement | string;
48
53
  resizeHandles?: boolean;
54
+ removeOnClose?: boolean;
49
55
  }
50
56
  interface DesktopController {
51
57
  element: HTMLElement;
@@ -53,7 +59,7 @@ interface DesktopController {
53
59
  attachWindow(id: string, element: HTMLElement, options?: WindowAttachOptions): () => void;
54
60
  destroy(): void;
55
61
  }
56
- declare function attachDesktop(wm: WindowManager, element: HTMLElement, options?: DesktopOptions): DesktopController;
62
+
57
63
  interface DesktopBinder {
58
64
  wm: WindowManager;
59
65
  controller(): DesktopController | null;
@@ -62,4 +68,4 @@ interface DesktopBinder {
62
68
  }
63
69
  declare function createDesktopBinder(wm: WindowManager, options?: DesktopOptions): DesktopBinder;
64
70
 
65
- export { type Announcer as A, type DesktopBinder as D, type SnapDetectOptions as S, type WindowAttachOptions as W, type AnnouncerMessages as a, type DesktopController as b, type DesktopKeyboardOptions as c, type DesktopOptions as d, type DesktopSnapOptions as e, attachDesktop as f, boundsEqual as g, clamp as h, clampSize as i, clampToViewport as j, createAnnouncer as k, createDesktopBinder as l, defaultMessages as m, detectSnapZone as n, zoneBounds as z };
71
+ export { type Announcer as A, type DesktopBinder as D, type HitAreaOptions as H, type SnapDetectOptions as S, type WindowAttachOptions as W, type DesktopController as a, type DesktopOptions as b, type AnnouncerMessages as c, type DesktopKeyboardOptions as d, type DesktopSnapOptions as e, boundsEqual as f, clamp as g, clampSize as h, clampToViewport as i, createAnnouncer as j, createDesktopBinder as k, defaultMessages as l, detectSnapZone as m, zoneBounds as z };