@g9tm/lynxcontrols 1.4.11 → 1.6.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 (146) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/anchor/context.d.ts +15 -0
  3. package/dist/anchor/context.d.ts.map +1 -0
  4. package/dist/anchor/context.jsx +10 -0
  5. package/dist/anchor/context.jsx.map +1 -0
  6. package/dist/anchor/hooks.d.ts +72 -0
  7. package/dist/anchor/hooks.d.ts.map +1 -0
  8. package/dist/anchor/hooks.jsx +147 -0
  9. package/dist/anchor/hooks.jsx.map +1 -0
  10. package/dist/anchor/index.d.ts +6 -0
  11. package/dist/anchor/index.d.ts.map +1 -0
  12. package/dist/anchor/index.jsx +5 -0
  13. package/dist/anchor/measure.d.ts +22 -0
  14. package/dist/anchor/measure.d.ts.map +1 -0
  15. package/dist/anchor/measure.jsx +110 -0
  16. package/dist/anchor/measure.jsx.map +1 -0
  17. package/dist/anchor/registry.d.ts +108 -0
  18. package/dist/anchor/registry.d.ts.map +1 -0
  19. package/dist/anchor/registry.jsx +142 -0
  20. package/dist/anchor/registry.jsx.map +1 -0
  21. package/dist/anchor/scroll.d.ts +34 -0
  22. package/dist/anchor/scroll.d.ts.map +1 -0
  23. package/dist/anchor/scroll.jsx +255 -0
  24. package/dist/anchor/scroll.jsx.map +1 -0
  25. package/dist/base/control.d.ts +10 -3
  26. package/dist/base/control.d.ts.map +1 -1
  27. package/dist/base/control.jsx +17 -2
  28. package/dist/base/control.jsx.map +1 -1
  29. package/dist/base/pressable.d.ts.map +1 -1
  30. package/dist/base/pressable.jsx +7 -1
  31. package/dist/base/pressable.jsx.map +1 -1
  32. package/dist/button/button.d.ts.map +1 -1
  33. package/dist/button/button.jsx +11 -1
  34. package/dist/button/button.jsx.map +1 -1
  35. package/dist/button/header-action-button.d.ts.map +1 -1
  36. package/dist/button/header-action-button.jsx +10 -1
  37. package/dist/button/header-action-button.jsx.map +1 -1
  38. package/dist/button/icon-button.d.ts.map +1 -1
  39. package/dist/button/icon-button.jsx +11 -1
  40. package/dist/button/icon-button.jsx.map +1 -1
  41. package/dist/button/nav-card.d.ts.map +1 -1
  42. package/dist/button/nav-card.jsx +10 -1
  43. package/dist/button/nav-card.jsx.map +1 -1
  44. package/dist/button/vertical-icon-text-button.d.ts.map +1 -1
  45. package/dist/button/vertical-icon-text-button.jsx +10 -1
  46. package/dist/button/vertical-icon-text-button.jsx.map +1 -1
  47. package/dist/expander/expander.d.ts.map +1 -1
  48. package/dist/expander/expander.jsx +14 -1
  49. package/dist/expander/expander.jsx.map +1 -1
  50. package/dist/fields/editor.d.ts.map +1 -1
  51. package/dist/fields/editor.jsx +17 -1
  52. package/dist/fields/editor.jsx.map +1 -1
  53. package/dist/fields/outlined-field.d.ts +6 -0
  54. package/dist/fields/outlined-field.d.ts.map +1 -1
  55. package/dist/fields/outlined-field.jsx +14 -3
  56. package/dist/fields/outlined-field.jsx.map +1 -1
  57. package/dist/fields/text-entry.d.ts.map +1 -1
  58. package/dist/fields/text-entry.jsx +17 -1
  59. package/dist/fields/text-entry.jsx.map +1 -1
  60. package/dist/fields/use-text-input.d.ts +1 -1
  61. package/dist/guide/confirm-sheet.d.ts +26 -0
  62. package/dist/guide/confirm-sheet.d.ts.map +1 -0
  63. package/dist/guide/confirm-sheet.jsx +146 -0
  64. package/dist/guide/confirm-sheet.jsx.map +1 -0
  65. package/dist/guide/guide.css +428 -0
  66. package/dist/guide/guide.css.map +1 -0
  67. package/dist/guide/index.d.ts +5 -0
  68. package/dist/guide/index.d.ts.map +1 -0
  69. package/dist/guide/index.jsx +4 -0
  70. package/dist/guide/journey.d.ts +46 -0
  71. package/dist/guide/journey.d.ts.map +1 -0
  72. package/dist/guide/journey.jsx +462 -0
  73. package/dist/guide/journey.jsx.map +1 -0
  74. package/dist/guide/placement.d.ts +44 -0
  75. package/dist/guide/placement.d.ts.map +1 -0
  76. package/dist/guide/placement.jsx +119 -0
  77. package/dist/guide/placement.jsx.map +1 -0
  78. package/dist/guide/service.d.ts +95 -0
  79. package/dist/guide/service.d.ts.map +1 -0
  80. package/dist/guide/service.jsx +566 -0
  81. package/dist/guide/service.jsx.map +1 -0
  82. package/dist/guide/settings.d.ts +68 -0
  83. package/dist/guide/settings.d.ts.map +1 -0
  84. package/dist/guide/settings.jsx +66 -0
  85. package/dist/guide/settings.jsx.map +1 -0
  86. package/dist/host/host.d.ts +5 -1
  87. package/dist/host/host.d.ts.map +1 -1
  88. package/dist/host/host.jsx +12 -0
  89. package/dist/host/host.jsx.map +1 -1
  90. package/dist/host/layers.d.ts +3 -1
  91. package/dist/host/layers.d.ts.map +1 -1
  92. package/dist/host/layers.jsx +4 -2
  93. package/dist/host/layers.jsx.map +1 -1
  94. package/dist/host/registry.d.ts +3 -0
  95. package/dist/host/registry.d.ts.map +1 -1
  96. package/dist/host/registry.jsx.map +1 -1
  97. package/dist/index.d.ts +3 -0
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/provider/contexts.d.ts +3 -0
  100. package/dist/provider/contexts.d.ts.map +1 -1
  101. package/dist/provider/contexts.jsx.map +1 -1
  102. package/dist/provider/provider.d.ts.map +1 -1
  103. package/dist/provider/provider.jsx +24 -17
  104. package/dist/provider/provider.jsx.map +1 -1
  105. package/dist/provider/settings.d.ts +4 -0
  106. package/dist/provider/settings.d.ts.map +1 -1
  107. package/dist/provider/settings.jsx +3 -2
  108. package/dist/provider/settings.jsx.map +1 -1
  109. package/dist/route/hooks.d.ts +34 -0
  110. package/dist/route/hooks.d.ts.map +1 -0
  111. package/dist/route/hooks.jsx +147 -0
  112. package/dist/route/hooks.jsx.map +1 -0
  113. package/dist/route/index.d.ts +3 -0
  114. package/dist/route/index.d.ts.map +1 -0
  115. package/dist/route/index.jsx +2 -0
  116. package/dist/route/router.d.ts +201 -0
  117. package/dist/route/router.d.ts.map +1 -0
  118. package/dist/route/router.jsx +810 -0
  119. package/dist/route/router.jsx.map +1 -0
  120. package/dist/sheet/frame.d.ts +3 -1
  121. package/dist/sheet/frame.d.ts.map +1 -1
  122. package/dist/sheet/frame.jsx +67 -25
  123. package/dist/sheet/frame.jsx.map +1 -1
  124. package/dist/sheet/options.d.ts +10 -0
  125. package/dist/sheet/options.d.ts.map +1 -1
  126. package/dist/sheet/options.jsx.map +1 -1
  127. package/dist/sheet/service.d.ts +5 -0
  128. package/dist/sheet/service.d.ts.map +1 -1
  129. package/dist/sheet/service.jsx +14 -2
  130. package/dist/sheet/service.jsx.map +1 -1
  131. package/dist/sheet/sheet.css +9 -0
  132. package/dist/sheet/sheet.css.map +1 -1
  133. package/dist/tabs/tab-view.d.ts +14 -0
  134. package/dist/tabs/tab-view.d.ts.map +1 -1
  135. package/dist/tabs/tab-view.jsx +59 -3
  136. package/dist/tabs/tab-view.jsx.map +1 -1
  137. package/dist/toggle/checkbox.d.ts.map +1 -1
  138. package/dist/toggle/checkbox.jsx +15 -1
  139. package/dist/toggle/checkbox.jsx.map +1 -1
  140. package/dist/toggle/chip-group.d.ts.map +1 -1
  141. package/dist/toggle/chip-group.jsx +12 -1
  142. package/dist/toggle/chip-group.jsx.map +1 -1
  143. package/dist/toggle/switch.d.ts.map +1 -1
  144. package/dist/toggle/switch.jsx +15 -1
  145. package/dist/toggle/switch.jsx.map +1 -1
  146. package/package.json +17 -2
@@ -0,0 +1,119 @@
1
+ const clamp = (v, lo, hi)=>hi < lo ? lo : v < lo ? lo : v > hi ? hi : v;
2
+ function placeBubble(r) {
3
+ var _r_gap, _r_margin, _r_radius, _order_find;
4
+ const gap = null != (_r_gap = r.gap) ? _r_gap : 12;
5
+ const m = null != (_r_margin = r.margin) ? _r_margin : 12;
6
+ const radius = null != (_r_radius = r.radius) ? _r_radius : 14;
7
+ const { target: t, bubble: b, view: v } = r;
8
+ const left = v.x + m;
9
+ const top = v.y + m;
10
+ const right = v.x + v.width - m;
11
+ const bottom = v.y + v.height - m;
12
+ const cx = t.x + t.width / 2;
13
+ const cy = t.y + t.height / 2;
14
+ const endIsRight = !r.rtl;
15
+ const room = {
16
+ below: bottom - (t.y + t.height + gap),
17
+ above: t.y - gap - top,
18
+ right: right - (t.x + t.width + gap),
19
+ left: t.x - gap - left
20
+ };
21
+ const fits = (side)=>{
22
+ switch(side){
23
+ case 'below':
24
+ return room.below >= b.height;
25
+ case 'above':
26
+ return room.above >= b.height;
27
+ case 'end':
28
+ return (endIsRight ? room.right : room.left) >= b.width;
29
+ case 'start':
30
+ return (endIsRight ? room.left : room.right) >= b.width;
31
+ default:
32
+ return true;
33
+ }
34
+ };
35
+ const order = [
36
+ 'below',
37
+ 'above',
38
+ 'end',
39
+ 'start'
40
+ ];
41
+ const prefer = r.prefer && 'auto' !== r.prefer ? r.prefer : null;
42
+ if (prefer) {
43
+ order.splice(order.indexOf(prefer), 1);
44
+ order.unshift(prefer);
45
+ }
46
+ const side = null != (_order_find = order.find(fits)) ? _order_find : 'over';
47
+ if ('below' === side || 'above' === side || 'over' === side) {
48
+ const x = clamp(cx - b.width / 2, left, right - b.width);
49
+ let y;
50
+ y = 'below' === side ? t.y + t.height + gap : 'above' === side ? t.y - gap - b.height : clamp(room.below >= room.above ? bottom - b.height : top, top, bottom - b.height);
51
+ const arrow = clamp(cx - x, radius, b.width - radius);
52
+ return {
53
+ x,
54
+ y,
55
+ side,
56
+ arrow
57
+ };
58
+ }
59
+ const onRight = 'end' === side === endIsRight;
60
+ const x = onRight ? t.x + t.width + gap : t.x - gap - b.width;
61
+ const y = clamp(cy - b.height / 2, top, bottom - b.height);
62
+ const arrow = clamp(cy - y, radius, b.height - radius);
63
+ return {
64
+ x,
65
+ y,
66
+ side,
67
+ arrow
68
+ };
69
+ }
70
+ function placePointer(target, size = 44) {
71
+ const unit = size / 24;
72
+ return {
73
+ x: target.x + target.width / 2 - 11.5 * unit,
74
+ y: target.y + target.height / 2 - 6 * unit
75
+ };
76
+ }
77
+ function scrimBands(hole, view) {
78
+ const hx = clamp(hole.x, view.x, view.x + view.width);
79
+ const hy = clamp(hole.y, view.y, view.y + view.height);
80
+ const hr = clamp(hole.x + hole.width, hx, view.x + view.width);
81
+ const hb = clamp(hole.y + hole.height, hy, view.y + view.height);
82
+ return [
83
+ {
84
+ x: view.x,
85
+ y: view.y,
86
+ width: view.width,
87
+ height: hy - view.y
88
+ },
89
+ {
90
+ x: view.x,
91
+ y: hb,
92
+ width: view.width,
93
+ height: view.y + view.height - hb
94
+ },
95
+ {
96
+ x: view.x,
97
+ y: hy,
98
+ width: hx - view.x,
99
+ height: hb - hy
100
+ },
101
+ {
102
+ x: hr,
103
+ y: hy,
104
+ width: view.x + view.width - hr,
105
+ height: hb - hy
106
+ }
107
+ ];
108
+ }
109
+ function inflate(r, pad) {
110
+ return {
111
+ x: r.x - pad,
112
+ y: r.y - pad,
113
+ width: r.width + 2 * pad,
114
+ height: r.height + 2 * pad
115
+ };
116
+ }
117
+ export { inflate, placeBubble, placePointer, scrimBands };
118
+
119
+ //# sourceMappingURL=placement.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guide/placement.jsx","sources":["../../src/guide/placement.ts"],"sourcesContent":["import type { G9AnchorRect } from '../anchor/registry';\n\n// Where a guide's bubble goes (pure): the first side that fits, in the reading-aware order below, then above, then the\n// end and the start side; flipped and clamped into the free area (the window minus the safe insets, the keyboard and\n// the tab bar the caller passes), never over the target when there is room elsewhere. The arrow points at the\n// target's centre, kept inside the bubble's rounded corners.\n\n/** Which side of the target a bubble sits on (`over` when none fits). */\nexport type G9BubbleSide = 'below' | 'above' | 'end' | 'start' | 'over';\n\n/** Where a guide bubble goes and where its arrow points. */\nexport interface G9BubblePlacement {\n readonly x: number;\n readonly y: number;\n readonly side: G9BubbleSide;\n /** The arrow's offset along the bubble edge that faces the target (px from the bubble's left or top). */\n readonly arrow: number;\n}\n\n/** The target, the bubble size and the free area a bubble is placed in. */\nexport interface G9BubbleRequest {\n readonly target: G9AnchorRect;\n readonly bubble: { readonly width: number; readonly height: number };\n /** The free area. */\n readonly view: G9AnchorRect;\n /** Gap between target and bubble. Default 12. */\n readonly gap?: number;\n /** Margin from the free area's edges. Default 12. */\n readonly margin?: number;\n readonly prefer?: 'auto' | 'above' | 'below' | 'start' | 'end';\n readonly rtl?: boolean;\n /** Corner radius the arrow stays clear of. Default 14. */\n readonly radius?: number;\n}\n\nconst clamp = (v: number, lo: number, hi: number) => (hi < lo ? lo : v < lo ? lo : v > hi ? hi : v);\n\n/** The bubble's place. */\nexport function placeBubble(r: G9BubbleRequest): G9BubblePlacement {\n const gap = r.gap ?? 12;\n const m = r.margin ?? 12;\n const radius = r.radius ?? 14;\n const { target: t, bubble: b, view: v } = r;\n const left = v.x + m;\n const top = v.y + m;\n const right = v.x + v.width - m;\n const bottom = v.y + v.height - m;\n const cx = t.x + t.width / 2;\n const cy = t.y + t.height / 2;\n const endIsRight = !r.rtl;\n\n const room = {\n below: bottom - (t.y + t.height + gap),\n above: t.y - gap - top,\n right: right - (t.x + t.width + gap),\n left: t.x - gap - left,\n };\n const fits = (side: G9BubbleSide): boolean => {\n switch (side) {\n case 'below':\n return room.below >= b.height;\n case 'above':\n return room.above >= b.height;\n case 'end':\n return (endIsRight ? room.right : room.left) >= b.width;\n case 'start':\n return (endIsRight ? room.left : room.right) >= b.width;\n default:\n return true;\n }\n };\n const order: G9BubbleSide[] = ['below', 'above', 'end', 'start'];\n const prefer = r.prefer && r.prefer !== 'auto' ? r.prefer : null;\n if (prefer) {\n order.splice(order.indexOf(prefer), 1);\n order.unshift(prefer);\n }\n const side = order.find(fits) ?? 'over';\n\n if (side === 'below' || side === 'above' || side === 'over') {\n const x = clamp(cx - b.width / 2, left, right - b.width);\n let y: number;\n if (side === 'below') y = t.y + t.height + gap;\n else if (side === 'above') y = t.y - gap - b.height;\n else y = clamp(room.below >= room.above ? bottom - b.height : top, top, bottom - b.height);\n const arrow = clamp(cx - x, radius, b.width - radius);\n return { x, y, side, arrow };\n }\n const onRight = (side === 'end') === endIsRight;\n const x = onRight ? t.x + t.width + gap : t.x - gap - b.width;\n const y = clamp(cy - b.height / 2, top, bottom - b.height);\n const arrow = clamp(cy - y, radius, b.height - radius);\n return { x, y, side, arrow };\n}\n\n/**\n * Where the pointing finger goes: the fingertip of the glyph (at 11.5 / 6 of its 24-unit box) on the target's centre,\n * the hand hanging below it — so it never hides the label of a button above it.\n */\nexport function placePointer(target: G9AnchorRect, size = 44): { readonly x: number; readonly y: number } {\n const unit = size / 24;\n return { x: target.x + target.width / 2 - 11.5 * unit, y: target.y + target.height / 2 - 6 * unit };\n}\n\n/** The four rects of a scrim around a hole (top, bottom, start, end bands), none negative. */\nexport function scrimBands(hole: G9AnchorRect, view: G9AnchorRect): readonly G9AnchorRect[] {\n const hx = clamp(hole.x, view.x, view.x + view.width);\n const hy = clamp(hole.y, view.y, view.y + view.height);\n const hr = clamp(hole.x + hole.width, hx, view.x + view.width);\n const hb = clamp(hole.y + hole.height, hy, view.y + view.height);\n return [\n { x: view.x, y: view.y, width: view.width, height: hy - view.y },\n { x: view.x, y: hb, width: view.width, height: view.y + view.height - hb },\n { x: view.x, y: hy, width: hx - view.x, height: hb - hy },\n { x: hr, y: hy, width: view.x + view.width - hr, height: hb - hy },\n ];\n}\n\n/** A rect grown by `pad` on every side. */\nexport function inflate(r: G9AnchorRect, pad: number): G9AnchorRect {\n return { x: r.x - pad, y: r.y - pad, width: r.width + 2 * pad, height: r.height + 2 * pad };\n}\n"],"names":["clamp","v","lo","hi","placeBubble","r","_r_gap","_r_margin","_r_radius","_order_find","gap","m","radius","t","b","left","top","right","bottom","cx","cy","endIsRight","room","fits","side","order","prefer","x","y","arrow","onRight","placePointer","target","size","unit","scrimBands","hole","view","hx","hy","hr","hb","inflate","pad"],"mappings":"AAmCA,MAAMA,QAAQ,CAACC,GAAWC,IAAYC,KAAgBA,KAAKD,KAAKA,KAAKD,IAAIC,KAAKA,KAAKD,IAAIE,KAAKA,KAAKF;AAG1F,SAASG,YAAYC,CAAkB;QAChCC,QACFC,WACKC,WAoCFC;IAtCb,MAAMC,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G;KAClE;AACH;AAGO,SAASG,QAAQrC,CAAe,EAAEsC,GAAW;IAClD,OAAO;QAAE,GAAGtC,EAAE,CAAC,GAAGsC;QAAK,GAAGtC,EAAE,CAAC,GAAGsC;QAAK,OAAOtC,EAAE,KAAK,GAAG,IAAIsC;QAAK,QAAQtC,EAAE,MAAM,GAAG,IAAIsC;IAAI;AAC5F"}
@@ -0,0 +1,95 @@
1
+ import { type G9ChangeLine, type G9GuideEffectSpec, type G9JourneySource } from '@g9tm/lynxcontrols-foundation';
2
+ import type { G9AnchorRect, G9AnchorRegistry } from '../anchor/registry.js';
3
+ import type { G9HostHandle } from '../host/registry.js';
4
+ import type { G9WalkPresenter } from '../route/router.js';
5
+ import { type G9ResolvedGuideSettings } from './settings.js';
6
+ import './guide.css';
7
+ /** What a mark points at: an anchor id (followed as it moves), a fixed rect, or a point. */
8
+ export type G9GuideTarget = string | G9AnchorRect | {
9
+ readonly x: number;
10
+ readonly y: number;
11
+ };
12
+ /** One mark: its target, its effects and how it ends. */
13
+ export interface G9GuideSpec {
14
+ readonly key?: string;
15
+ readonly target: G9GuideTarget;
16
+ readonly effects: readonly G9GuideEffectSpec[];
17
+ /** Bring an anchor into view first (scrolling, mounting a list row). Default true. */
18
+ readonly reveal?: boolean;
19
+ /** Ends by itself after this long. */
20
+ readonly timeoutMs?: number;
21
+ /** What a touch on the guide's own surfaces does. Default `never` (only buttons end it). */
22
+ readonly dismissOn?: 'tap-anywhere' | 'never';
23
+ /** Buttons of the bubble. */
24
+ readonly buttons?: ReadonlyArray<'next' | 'skip' | 'done'>;
25
+ readonly language?: 'fa' | 'en';
26
+ }
27
+ /** How a mark ended (exactly once). */
28
+ export type G9GuideOutcome = 'hidden' | 'tapped' | 'next' | 'skip' | 'done' | 'timeout' | 'target-lost' | 'replaced' | 'unmount';
29
+ /** One shown mark: hide it, or await how it ended. */
30
+ export interface G9GuideHandle {
31
+ readonly key: string;
32
+ hide(): void;
33
+ readonly result: Promise<G9GuideOutcome>;
34
+ }
35
+ /** A shown mark, as the layer draws it. */
36
+ export interface G9GuideMarkState {
37
+ readonly key: string;
38
+ readonly spec: G9GuideSpec;
39
+ /** The target in LynxView coordinates, null while measuring. */
40
+ readonly rect: G9AnchorRect | null;
41
+ }
42
+ /** A guided-save confirmation. */
43
+ export interface G9ConfirmRequest {
44
+ readonly title: string;
45
+ readonly source: G9JourneySource;
46
+ readonly changes: readonly G9ChangeLine[];
47
+ readonly seconds: number;
48
+ readonly destructive: boolean;
49
+ /** Where this press stands in a journey that presses more than one control (shown when `total` > 1). */
50
+ readonly progress?: {
51
+ readonly index: number;
52
+ readonly total: number;
53
+ };
54
+ }
55
+ /** The guide of one host: marks, ready-made combinations, the walk presenter and the countdown confirmation. */
56
+ export interface G9GuideService {
57
+ show(spec: G9GuideSpec): G9GuideHandle;
58
+ hideAll(): void;
59
+ readonly marks: {
60
+ get(): readonly G9GuideMarkState[];
61
+ subscribe(l: () => void): () => void;
62
+ };
63
+ /** A finger and a bubble on a control (the default step of a walk). */
64
+ pointAt(target: G9GuideTarget, text: string, options?: {
65
+ readonly modal?: boolean;
66
+ readonly gesture?: 'tap' | 'longPress';
67
+ readonly buttons?: G9GuideSpec['buttons'];
68
+ }): G9GuideHandle;
69
+ /** A modal spotlight with a bubble and «done». */
70
+ coach(target: G9GuideTarget, text: string): G9GuideHandle;
71
+ /** A small pulsing dot on the control's corner. */
72
+ hint(target: G9GuideTarget): G9GuideHandle;
73
+ /** The presenter a router walk draws its steps with. */
74
+ presenter(): G9WalkPresenter;
75
+ /**
76
+ * Asks the person to confirm a write in a sheet: the changes, the source, a countdown on the confirm button. Resolves
77
+ * once the sheet has gone: true only for the unlocked confirm. A newer request declines the open one.
78
+ */
79
+ confirm(request: G9ConfirmRequest): Promise<boolean>;
80
+ /** Declines the open confirmation, if any (a journey that is cancelled). */
81
+ dismissConfirmation(): void;
82
+ readonly confirmation: {
83
+ get(): G9ConfirmRequest | null;
84
+ subscribe(l: () => void): () => void;
85
+ };
86
+ readonly settings: G9ResolvedGuideSettings;
87
+ readonly anchors: G9AnchorRegistry;
88
+ }
89
+ /** The guide of a host, created on first use. */
90
+ export declare function guideServiceOf(host: G9HostHandle, settings?: G9ResolvedGuideSettings): G9GuideService;
91
+ /** The guide of the nearest host. */
92
+ export declare function useG9Guide(): G9GuideService;
93
+ /** The guide of the active host, for code outside components. Throws without a host. */
94
+ export declare function g9Guide(): G9GuideService;
95
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/guide/service.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGvD,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,YAAY,CAAC;AAChF,OAAO,aAAa,CAAC;AAQrB,4FAA4F;AAC5F,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/F,yDAAyD;AACzD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAC/C,sFAAsF;IACtF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,sCAAsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CA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