@nanahoshi/mona-ui 0.1.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 (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,386 @@
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform, Signal } from '@angular/core';
3
+ import { Predicate, ImmutableDictionary } from '@mirei/ts-collections';
4
+
5
+ type SelectionMode = "single" | "multiple";
6
+
7
+ type ScrollDirection = "left" | "right";
8
+
9
+ type ColorMode = "hsv" | "rgb";
10
+ type ColorOutputFormat = "hex" | "rgb" | "hsl";
11
+
12
+ type DataType = "string" | "number" | "date" | "boolean";
13
+
14
+ declare class PreventableEvent<E extends Event = Event> {
15
+ #private;
16
+ constructor(type?: string, event?: E);
17
+ isDefaultPrevented(): boolean;
18
+ preventDefault(): void;
19
+ get originalEvent(): E | undefined;
20
+ get type(): string | undefined;
21
+ }
22
+
23
+ declare class FilterChangeEvent extends PreventableEvent {
24
+ #private;
25
+ constructor(filterText: string);
26
+ get filter(): string;
27
+ }
28
+
29
+ type FilterOperator = "contains" | "endsWith" | "startsWith" | ((value: string, filter: string) => boolean);
30
+ interface FilterableOptions {
31
+ caseSensitive: boolean;
32
+ debounce: number;
33
+ enabled: boolean;
34
+ operator: FilterOperator;
35
+ }
36
+
37
+ type Orientation = "horizontal" | "vertical";
38
+
39
+ type PaletteType = "flat" | "material" | "websafe";
40
+
41
+ type Position = "top" | "right" | "bottom" | "left";
42
+
43
+ interface VirtualScrollOptions {
44
+ enabled: boolean;
45
+ height?: number;
46
+ }
47
+
48
+ declare class AnyPipe implements PipeTransform {
49
+ transform<T>(sequence: Iterable<T> | null | undefined, predicate?: Predicate<T>): boolean;
50
+ static ɵfac: i0.ɵɵFactoryDeclaration<AnyPipe, never>;
51
+ static ɵpipe: i0.ɵɵPipeDeclaration<AnyPipe, "monaAny", true>;
52
+ }
53
+
54
+ declare class ContainsPipe implements PipeTransform {
55
+ transform<T>(sequence: Iterable<T> | null | undefined, value: T | Iterable<T>): boolean;
56
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContainsPipe, never>;
57
+ static ɵpipe: i0.ɵɵPipeDeclaration<ContainsPipe, "monaContains", true>;
58
+ }
59
+
60
+ declare class SlicePipe implements PipeTransform {
61
+ transform<T>(value: Iterable<T>, start: number, end: number): T[];
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<SlicePipe, never>;
63
+ static ɵpipe: i0.ɵɵPipeDeclaration<SlicePipe, "monaSlice", true>;
64
+ }
65
+
66
+ declare class TakeFirstPipe implements PipeTransform {
67
+ transform<T>(value: Iterable<T> | null | undefined): T | null;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<TakeFirstPipe, never>;
69
+ static ɵpipe: i0.ɵɵPipeDeclaration<TakeFirstPipe, "monaTakeFirst", true>;
70
+ }
71
+
72
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
73
+ type BuiltIn = Primitive | Date | RegExp | Function | Map<unknown, unknown> | Set<unknown>;
74
+ type DeepPartial<T> = T extends BuiltIn ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : {
75
+ [P in keyof T]?: DeepPartial<T[P]>;
76
+ };
77
+ type Path<T> = T extends object ? {
78
+ [K in keyof T]-?: [
79
+ K
80
+ ] | (Path<T[K]> extends infer P ? (P extends ReadonlyArray<PropertyKey> ? [K, ...P] : never) : never);
81
+ }[keyof T] : never;
82
+ type PathValue<T, P> = P extends readonly [infer K, ...infer R] ? K extends keyof T ? R["length"] extends 0 ? T[K] : PathValue<T[K], Extract<R, ReadonlyArray<PropertyKey>>> : never : never;
83
+ type ArrayStrategy = {
84
+ kind: "replace";
85
+ } | {
86
+ kind: "concat";
87
+ } | {
88
+ kind: "unionBy";
89
+ key: string | string[];
90
+ };
91
+ interface DeepMergeOptions {
92
+ arrayStrategy?: ArrayStrategy | ((key: PropertyKey, path: ReadonlyArray<PropertyKey>) => ArrayStrategy);
93
+ }
94
+ declare const isEmptyObject: (obj: Record<PropertyKey, unknown>) => boolean;
95
+ declare const isPlainObject: (v: unknown) => v is Record<PropertyKey, unknown>;
96
+ declare function deepMerge<T>(base: T, patch: DeepPartial<T>, options?: DeepMergeOptions, path?: ReadonlyArray<PropertyKey>): T;
97
+ declare function deepMerge<T>(base: DeepPartial<T>, patch: DeepPartial<T>, options?: DeepMergeOptions, path?: ReadonlyArray<PropertyKey>): DeepPartial<T>;
98
+ declare function mergeInto<T>(base: T, patch: DeepPartial<T>, options?: DeepMergeOptions): T;
99
+ declare function mergePatchInto<T>(base: DeepPartial<T>, patch: DeepPartial<T>, options?: DeepMergeOptions): DeepPartial<T>;
100
+ declare function buildNested(keys: ReadonlyArray<PropertyKey>, leaf: unknown): Record<PropertyKey, unknown>;
101
+ declare function patchAt<T, P extends Path<T>>(path: P, value: PathValue<T, P>): DeepPartial<T>;
102
+ declare function setAt<T, P extends Path<T>>(obj: T, path: P, value: PathValue<T, P>, options?: DeepMergeOptions): T;
103
+ declare function prunePatch<T>(base: T, patch: DeepPartial<T>): DeepPartial<T> | undefined;
104
+ declare function prunePatch<T>(base: DeepPartial<T>, patch: DeepPartial<T>): DeepPartial<T> | undefined;
105
+ declare function deepEquals<T>(o1: T, o2: T): boolean;
106
+
107
+ /**
108
+ * Determines how the store responds when the base signal emits a new value
109
+ * while uncommitted drafts exist.
110
+ *
111
+ * - `'wipe'` — Discard all drafts (default). Safe and predictable; the
112
+ * caller is responsible for committing before the base updates.
113
+ * - `'preserve'` — Keep drafts entirely untouched. Useful when you control
114
+ * base updates and know they are unrelated to in-progress edits.
115
+ * - `'rebase'` — Prune the existing draft against the new base, retaining
116
+ * only the fields that still differ from it. Useful for
117
+ * polling scenarios where the server may have accepted some
118
+ * changes but not others.
119
+ */
120
+ type BaseChangeStrategy = "wipe" | "preserve" | "rebase";
121
+ interface ObjectPatchStoreOptions<T> {
122
+ /**
123
+ * Controls what happens to uncommitted drafts when the base signal emits
124
+ * a new value. Defaults to `'wipe'`.
125
+ */
126
+ baseChangeStrategy?: BaseChangeStrategy;
127
+ /**
128
+ * Optional initial draft/committed state to hydrate the store with
129
+ * (e.g. when restoring persisted form state).
130
+ */
131
+ initial?: () => DeepPartial<T>;
132
+ /** Default merge options applied to all patch operations unless overridden per-call. */
133
+ mergeOptions?: DeepMergeOptions;
134
+ /** Factory that returns the authoritative base signal for this store. */
135
+ source: () => Signal<T>;
136
+ }
137
+ interface IObjectPatchStore<T> {
138
+ /**
139
+ * Emits the current draft patch, or `undefined` when there are no
140
+ * pending changes (i.e. the draft is an empty object).
141
+ */
142
+ readonly changes: Signal<DeepPartial<T> | undefined>;
143
+ /**
144
+ * `true` when the current draft is structurally equal to the last
145
+ * committed snapshot, i.e. no unsaved changes exist relative to the
146
+ * last commit point.
147
+ */
148
+ readonly pristine: Signal<boolean>;
149
+ /**
150
+ * The live merged view of base + draft. Prefer `select()` over reading
151
+ * this directly in computed signals when you only care about a specific
152
+ * slice of the object, to avoid unnecessary downstream invalidations.
153
+ */
154
+ readonly view: Signal<T>;
155
+ /**
156
+ * Discard the current draft without affecting the committed snapshot.
157
+ * The view reverts to the base value.
158
+ */
159
+ clear(): void;
160
+ /**
161
+ * Promote the current draft to the committed snapshot.
162
+ * `pristine` will become `true` immediately after calling this.
163
+ */
164
+ commit(): void;
165
+ /** Returns the last committed draft snapshot. */
166
+ getCommitted(): DeepPartial<T>;
167
+ /**
168
+ * Returns `true` if there is a non-empty draft currently in progress.
169
+ */
170
+ hasDraft(): boolean;
171
+ /**
172
+ * Deep-merge `patch` into the current draft. Only the fields present in
173
+ * `patch` are affected; all other fields retain their current draft or
174
+ * base values. Automatically prunes fields that match the base value so
175
+ * the draft stays minimal.
176
+ */
177
+ patch(patch: DeepPartial<T>, options?: DeepMergeOptions): void;
178
+ /**
179
+ * Convenience wrapper over `patch` that builds the patch object from a
180
+ * type-safe path + value pair.
181
+ *
182
+ * @example
183
+ * store.patchPath(['address', 'city'], 'London');
184
+ */
185
+ patchPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
186
+ /**
187
+ * Discard both the draft and the committed snapshot, fully resetting
188
+ * the store to a pristine, empty state.
189
+ */
190
+ reset(): void;
191
+ /**
192
+ * Directly replace the draft with the given patch object, bypassing the
193
+ * merge logic. Use with care — this does not prune against the base.
194
+ * Prefer `patch()` for most use cases.
195
+ */
196
+ setDraft(patch: DeepPartial<T>): void;
197
+ /**
198
+ * Convenience wrapper over `patch` that sets a single path to a value.
199
+ * Unlike the old implementation, this merges rather than replaces the
200
+ * draft, so unrelated draft fields are preserved.
201
+ *
202
+ * @example
203
+ * store.setPath(['address', 'city'], 'London');
204
+ */
205
+ setPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
206
+ /**
207
+ * Returns a `Signal` that emits only the slice of `view` selected by
208
+ * `projector`. Uses `deepEquals` as the equality function, so downstream
209
+ * computeds are only invalidated when the projected value structurally
210
+ * changes — not on every `view` emission.
211
+ *
212
+ * Prefer this over `computed(() => store.view().someField)` when the
213
+ * downstream work (e.g. a component re-render) is expensive relative to
214
+ * a `deepEquals` check on the projected slice.
215
+ *
216
+ * An optional custom `equal` function can be supplied when `deepEquals`
217
+ * is too broad or too expensive for the projected type.
218
+ *
219
+ * @example
220
+ * readonly city = store.select(v => v.address.city);
221
+ */
222
+ select<R>(projector: (view: T) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
223
+ }
224
+ declare class ObjectPatchStore<T> implements IObjectPatchStore<T> {
225
+ #private;
226
+ readonly changes: Signal<DeepPartial<T> | undefined>;
227
+ readonly pristine: Signal<boolean>;
228
+ readonly view: Signal<T>;
229
+ constructor(options: ObjectPatchStoreOptions<T>);
230
+ clear(): void;
231
+ commit(): void;
232
+ getCommitted(): DeepPartial<T>;
233
+ hasDraft(): boolean;
234
+ patch(patch: DeepPartial<T>, options?: DeepMergeOptions): void;
235
+ patchPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
236
+ reset(): void;
237
+ setDraft(patch: DeepPartial<T>): void;
238
+ setPath<P extends Path<T>>(path: P, value: PathValue<T, P>, options?: DeepMergeOptions): void;
239
+ select<R>(projector: (view: T) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
240
+ }
241
+ interface IterablePatchStoreOptions<TItem, TId> {
242
+ /** Extracts the stable identity key from an item. */
243
+ idOf: (item: TItem) => TId;
244
+ /**
245
+ * Optional initial draft/committed state (e.g. for restoring persisted
246
+ * per-row edits). Accepts either a `Map` or an `ImmutableDictionary`.
247
+ */
248
+ initial?: () => Map<TId, DeepPartial<TItem>> | ImmutableDictionary<TId, DeepPartial<TItem>>;
249
+ /** Factory that returns the authoritative base signal for this store. */
250
+ source: () => Signal<Iterable<TItem>>;
251
+ /**
252
+ * Controls what happens to uncommitted drafts when the base signal emits
253
+ * a new value. Defaults to `'wipe'`.
254
+ */
255
+ baseChangeStrategy?: BaseChangeStrategy;
256
+ }
257
+ interface IIterablePatchStore<TItem, TId> {
258
+ /**
259
+ * Emits the subset of items that have a non-empty draft, each merged
260
+ * with its current draft. Items without a draft are excluded.
261
+ */
262
+ readonly changes: Signal<TItem[]>;
263
+ /**
264
+ * `true` when every item's current draft is structurally equal to its
265
+ * last committed snapshot.
266
+ */
267
+ readonly pristine: Signal<boolean>;
268
+ /**
269
+ * The live merged view of all base items with their drafts applied.
270
+ * Items without a draft are returned as-is (same reference).
271
+ * Prefer `select()` over reading this directly in computed signals when
272
+ * you only care about a specific slice.
273
+ */
274
+ readonly view: Signal<TItem[]>;
275
+ /**
276
+ * Discard the draft for the item identified by `id`.
277
+ * Has no effect if the item has no draft.
278
+ */
279
+ clear(id: TId): void;
280
+ /** Discard all drafts for all items. */
281
+ clearAll(): void;
282
+ /**
283
+ * Promote all current drafts to the committed snapshot.
284
+ * `pristine` will become `true` immediately after calling this.
285
+ */
286
+ commit(): void;
287
+ /** Returns the number of items that currently have a non-empty draft. */
288
+ dirtyCount(): number;
289
+ /** Returns the last committed drafts dictionary. */
290
+ getCommitted(): ImmutableDictionary<TId, DeepPartial<TItem>>;
291
+ /**
292
+ * Returns `true` if the item identified by `id` has a non-empty draft.
293
+ */
294
+ hasDraft(id: TId): boolean;
295
+ /**
296
+ * Deep-merge `patch` into the draft for the item identified by `id`.
297
+ * Automatically prunes fields that now match the base item so the draft
298
+ * stays minimal. Removes the draft entry entirely if it becomes empty.
299
+ */
300
+ patch(id: TId, patch: DeepPartial<TItem>, options?: DeepMergeOptions): void;
301
+ /**
302
+ * Apply multiple patches in a single atomic update. Each tuple is
303
+ * `[id, patch]`. More efficient than calling `patch()` in a loop.
304
+ * Also prunes each resulting draft against the base item.
305
+ */
306
+ patchMany(patchTuple: Iterable<[TId, DeepPartial<TItem>]>, options?: DeepMergeOptions): void;
307
+ /**
308
+ * Convenience wrapper over `patch` that builds the patch object from a
309
+ * type-safe path + value pair for a specific item.
310
+ *
311
+ * @example
312
+ * store.patchPath(itemId, ['address', 'city'], 'London');
313
+ */
314
+ patchPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
315
+ /**
316
+ * Discard all drafts and committed snapshots, fully resetting the store
317
+ * to a pristine, empty state.
318
+ */
319
+ reset(): void;
320
+ /**
321
+ * Directly replace the draft for `id` with the given patch object,
322
+ * bypassing the merge logic. Use with care — this does not prune against
323
+ * the base item. Prefer `patch()` for most use cases.
324
+ */
325
+ setDraft(id: TId, patch: DeepPartial<TItem>): void;
326
+ /**
327
+ * Convenience wrapper over `patch` that sets a single path to a value
328
+ * for a specific item. Merges into the existing draft rather than
329
+ * replacing it, so unrelated draft fields are preserved.
330
+ *
331
+ * @example
332
+ * store.setPath(itemId, ['address', 'city'], 'London');
333
+ */
334
+ setPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
335
+ /**
336
+ * Returns a `Signal` that emits only the slice of `view` selected by
337
+ * `projector`. Uses `deepEquals` as the equality function by default,
338
+ * so downstream computeds are only invalidated when the projected value
339
+ * structurally changes — not on every `view` emission.
340
+ *
341
+ * An optional custom `equal` function can be supplied when `deepEquals`
342
+ * is too broad or too expensive for the projected type.
343
+ *
344
+ * @example
345
+ * readonly cities = store.select(items => items.map(i => i.address.city));
346
+ */
347
+ select<R>(projector: (view: TItem[]) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
348
+ }
349
+ declare class IterablePatchStore<TItem, TId> implements IIterablePatchStore<TItem, TId> {
350
+ #private;
351
+ readonly changes: Signal<TItem[]>;
352
+ readonly pristine: Signal<boolean>;
353
+ readonly view: Signal<TItem[]>;
354
+ constructor(options: IterablePatchStoreOptions<TItem, TId>);
355
+ clear(id: TId): void;
356
+ clearAll(): void;
357
+ commit(): void;
358
+ dirtyCount(): number;
359
+ getCommitted(): ImmutableDictionary<TId, DeepPartial<TItem>>;
360
+ hasDraft(id: TId): boolean;
361
+ patch(id: TId, patch: DeepPartial<TItem>, options?: DeepMergeOptions): void;
362
+ patchMany(patchTuple: Iterable<[TId, DeepPartial<TItem>]>, options?: DeepMergeOptions): void;
363
+ patchPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
364
+ reset(): void;
365
+ setDraft(id: TId, patch: DeepPartial<TItem>): void;
366
+ setPath<P extends Path<TItem>>(id: TId, path: P, value: PathValue<TItem, P>, options?: DeepMergeOptions): void;
367
+ select<R>(projector: (view: TItem[]) => R, equal?: (a: R, b: R) => boolean): Signal<R>;
368
+ }
369
+ declare const createIterablePatchStore: <TItem, TId>(options: IterablePatchStoreOptions<TItem, TId>) => IIterablePatchStore<TItem, TId>;
370
+ declare const createObjectPatchStore: <T>(options: ObjectPatchStoreOptions<T>) => IObjectPatchStore<T>;
371
+
372
+ /**
373
+ * Calculates the percentage of a value within a given range, rounded to the specified precision.
374
+ * @param value The current value.
375
+ * @param min The minimum value.
376
+ * @param max The maximum value.
377
+ * @param precision The number of decimal places to round the percentage to.
378
+ * @default 2
379
+ * @returns The percentage of the value within the range, rounded to the specified precision.
380
+ */
381
+ declare const getPercentage: (value: number, min: number, max: number, precision?: number) => number;
382
+
383
+ declare function moveIndices<T>(array: T[], indices: number[], offset: number): T[];
384
+
385
+ export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
386
+ export type { ArrayStrategy, BaseChangeStrategy, ColorMode, ColorOutputFormat, DataType, DeepMergeOptions, DeepPartial, FilterOperator, FilterableOptions, IIterablePatchStore, IObjectPatchStore, IterablePatchStoreOptions, ObjectPatchStoreOptions, Orientation, PaletteType, Path, PathValue, Position, ScrollDirection, SelectionMode, VirtualScrollOptions };
@@ -0,0 +1,129 @@
1
+ import * as i0 from '@angular/core';
2
+ import { TemplateRef, ElementRef } from '@angular/core';
3
+ import { PopupMenuVariantInput, PopupMenuItem, PopupMenuComponent, PopupMenuItemClickEvent, PopupMenuGroupComponent, PopupMenuOrigin, PopupMenuCheckboxItemComponent, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuSeparatorComponent, PopupMenuGroupTemplateDirective, PopupMenuTemplateOrigin, PopupMenuIconTemplateDirective, PopupMenuShortcutTemplateDirective, PopupMenuTextTemplateDirective } from '@nanahoshi/mona-ui/popup-menu';
4
+
5
+ type ContextMenuVariantInput = PopupMenuVariantInput;
6
+
7
+ declare class ContextMenuComponent implements ContextMenuVariantInput {
8
+ #private;
9
+ private readonly menuItemComponents;
10
+ protected readonly groupTemplate: i0.Signal<TemplateRef<any> | undefined>;
11
+ protected readonly iconTemplate: i0.Signal<TemplateRef<any> | undefined>;
12
+ protected readonly menuId: string;
13
+ protected readonly menuItems: i0.Signal<Iterable<PopupMenuItem>>;
14
+ protected readonly popupMenuRef: i0.Signal<PopupMenuComponent | undefined>;
15
+ protected readonly shortcutTemplate: i0.Signal<TemplateRef<any> | undefined>;
16
+ protected readonly textTemplate: i0.Signal<TemplateRef<any> | undefined>;
17
+ /**
18
+ * @description Reserved for an ARIA label on the context menu.
19
+ * Not currently applied to the target element or the rendered menu.
20
+ */
21
+ readonly ariaLabel: i0.InputSignal<string>;
22
+ /**
23
+ * @description The menu items to render. When provided, these take precedence over
24
+ * content-projected `mona-contextmenu-item` (and related) components.
25
+ */
26
+ readonly items: i0.InputSignal<Iterable<PopupMenuItem>>;
27
+ /**
28
+ * @description Emits when a menu item is clicked.
29
+ */
30
+ readonly menuClick: i0.OutputEmitterRef<PopupMenuItemClickEvent>;
31
+ /**
32
+ * @description Sets the minimum width of the context menu.
33
+ * This will be applied to the root menu and all submenus.
34
+ */
35
+ readonly minWidth: i0.InputSignal<string | number | undefined>;
36
+ /**
37
+ * @description Sets the rounded state of the context menu.
38
+ */
39
+ readonly rounded: i0.InputSignal<"small" | "medium" | "large" | "none" | null | undefined>;
40
+ /**
41
+ * @description Sets the size of the context menu.
42
+ */
43
+ readonly size: i0.InputSignal<"small" | "medium" | "large" | null | undefined>;
44
+ /**
45
+ * @description The target element that will be used to trigger the context menu.
46
+ */
47
+ readonly target: i0.InputSignal<HTMLElement | ElementRef<HTMLElement>>;
48
+ /**
49
+ * @description Sets the width of the context menu.
50
+ * This will be applied to the root menu and all submenus.
51
+ */
52
+ readonly width: i0.InputSignal<string | number | undefined>;
53
+ constructor();
54
+ protected onMenuClose(): void;
55
+ protected onMenuOpen(): void;
56
+ private openMenuViaKeyboard;
57
+ private setKeyboardEvents;
58
+ private setTargetAriaAttributes;
59
+ private updateTargetAriaAttributes;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuComponent, never>;
61
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuComponent, "mona-contextmenu", never, { "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "target": { "alias": "target"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; }, { "menuClick": "menuClick"; }, ["menuItemComponents", "groupTemplate", "iconTemplate", "shortcutTemplate", "textTemplate"], never, true, never>;
62
+ }
63
+
64
+ declare class ContextMenuGroupComponent extends PopupMenuGroupComponent {
65
+ readonly origin = PopupMenuOrigin.ContextMenu;
66
+ constructor();
67
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuGroupComponent, never>;
68
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuGroupComponent, "mona-contextmenu-group", never, {}, {}, never, never, true, never>;
69
+ }
70
+
71
+ declare class ContextMenuCheckboxItemComponent extends PopupMenuCheckboxItemComponent {
72
+ readonly origin = PopupMenuOrigin.ContextMenu;
73
+ constructor();
74
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuCheckboxItemComponent, never>;
75
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuCheckboxItemComponent, "mona-contextmenu-checkbox-item", never, {}, {}, never, never, true, never>;
76
+ }
77
+
78
+ declare class ContextMenuItemComponent extends PopupMenuItemComponent {
79
+ readonly origin = PopupMenuOrigin.ContextMenu;
80
+ constructor();
81
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuItemComponent, never>;
82
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuItemComponent, "mona-contextmenu-item", never, {}, {}, never, never, true, never>;
83
+ }
84
+
85
+ declare class ContextMenuRadioGroupComponent extends PopupMenuRadioGroupComponent {
86
+ readonly origin = PopupMenuOrigin.ContextMenu;
87
+ constructor();
88
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuRadioGroupComponent, never>;
89
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuRadioGroupComponent, "mona-contextmenu-radio-group", never, {}, {}, never, never, true, never>;
90
+ }
91
+
92
+ declare class ContextMenuRadioItemComponent extends PopupMenuRadioItemComponent {
93
+ readonly origin = PopupMenuOrigin.ContextMenu;
94
+ constructor();
95
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuRadioItemComponent, never>;
96
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuRadioItemComponent, "mona-contextmenu-radio-item", never, {}, {}, never, never, true, never>;
97
+ }
98
+
99
+ declare class ContextMenuSeparatorComponent extends PopupMenuSeparatorComponent {
100
+ readonly origin = PopupMenuOrigin.ContextMenu;
101
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuSeparatorComponent, never>;
102
+ static ɵcmp: i0.ɵɵComponentDeclaration<ContextMenuSeparatorComponent, "mona-contextmenu-separator", never, {}, {}, never, never, true, never>;
103
+ }
104
+
105
+ declare class ContextMenuGroupTemplateDirective extends PopupMenuGroupTemplateDirective {
106
+ readonly origin = PopupMenuTemplateOrigin.ContextMenu;
107
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuGroupTemplateDirective, never>;
108
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuGroupTemplateDirective, "ng-template[monaContextMenuGroupTemplate]", never, {}, {}, never, never, true, never>;
109
+ }
110
+
111
+ declare class ContextMenuIconTemplateDirective extends PopupMenuIconTemplateDirective {
112
+ readonly origin = PopupMenuTemplateOrigin.ContextMenu;
113
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuIconTemplateDirective, never>;
114
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuIconTemplateDirective, "ng-template[monaContextMenuIconTemplate]", never, {}, {}, never, never, true, never>;
115
+ }
116
+
117
+ declare class ContextMenuShortcutTemplateDirective extends PopupMenuShortcutTemplateDirective {
118
+ readonly origin = PopupMenuTemplateOrigin.ContextMenu;
119
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuShortcutTemplateDirective, never>;
120
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuShortcutTemplateDirective, "ng-template[monaContextMenuShortcutTemplate]", never, {}, {}, never, never, true, never>;
121
+ }
122
+
123
+ declare class ContextMenuTextTemplateDirective extends PopupMenuTextTemplateDirective {
124
+ readonly origin = PopupMenuTemplateOrigin.ContextMenu;
125
+ static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuTextTemplateDirective, never>;
126
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ContextMenuTextTemplateDirective, "ng-template[monaContextMenuTextTemplate]", never, {}, {}, never, never, true, never>;
127
+ }
128
+
129
+ export { ContextMenuCheckboxItemComponent, ContextMenuComponent, ContextMenuGroupComponent, ContextMenuGroupTemplateDirective, ContextMenuIconTemplateDirective, ContextMenuItemComponent, ContextMenuRadioGroupComponent, ContextMenuRadioItemComponent, ContextMenuSeparatorComponent, ContextMenuShortcutTemplateDirective, ContextMenuTextTemplateDirective };
@@ -0,0 +1,60 @@
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { Predicate, ImmutableSet } from '@mirei/ts-collections';
4
+ import { DateTime } from 'luxon';
5
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
+ import { VariantInputs } from '@nanahoshi/mona-ui/internal';
7
+ import { ThemeStyle } from '@nanahoshi/mona-ui/theme';
8
+ import { VariantProps } from 'class-variance-authority';
9
+ import { Subject } from 'rxjs';
10
+ import { PreventableEvent } from '@nanahoshi/mona-ui/common';
11
+
12
+ declare class DateInputPrefixTemplateDirective {
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateInputPrefixTemplateDirective, never>;
14
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DateInputPrefixTemplateDirective, "ng-template[monaDateInputPrefixTemplate]", never, {}, {}, never, never, true, never>;
15
+ }
16
+
17
+ type CalendarView = "decade" | "month" | "year";
18
+
19
+ type DateDisabledType = Iterable<Date> | Predicate<Date> | null | undefined;
20
+
21
+ type HourFormat = "12" | "24";
22
+
23
+ type Meridiem = "AM" | "PM";
24
+
25
+ interface TimeUnit {
26
+ value: number;
27
+ viewValue: number;
28
+ }
29
+
30
+ declare class TimeLimiterPipe implements PipeTransform {
31
+ transform(timeValues: Iterable<TimeUnit>, type: "h" | "m" | "s", currentDate: DateTime, min?: DateTime | null, max?: DateTime | null): ImmutableSet<TimeUnit>;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<TimeLimiterPipe, never>;
33
+ static ɵpipe: i0.ɵɵPipeDeclaration<TimeLimiterPipe, "timeLimiter", true>;
34
+ }
35
+
36
+ declare const datePopupThemeVariants: (theme: ThemeStyle) => (props?: ({
37
+ rounded?: "none" | "small" | "medium" | "large" | "full" | null | undefined;
38
+ size?: "small" | "medium" | "large" | null | undefined;
39
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
40
+ type DatePopupVariantProps = VariantProps<ReturnType<typeof datePopupThemeVariants>>;
41
+ type DatePopupVariantInput = VariantInputs<DatePopupVariantProps>;
42
+
43
+ declare class CalendarService {
44
+ readonly keydown$: Subject<PreventableEvent<KeyboardEvent>>;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<CalendarService, never>;
46
+ static ɵprov: i0.ɵɵInjectableDeclaration<CalendarService>;
47
+ }
48
+
49
+ declare class TimeSelectorService {
50
+ readonly keydown$: Subject<PreventableEvent<KeyboardEvent>>;
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<TimeSelectorService, never>;
52
+ static ɵprov: i0.ɵɵInjectableDeclaration<TimeSelectorService>;
53
+ }
54
+
55
+ declare const generateHourSet: (hourFormat: HourFormat, meridiem: Meridiem, step?: number) => ImmutableSet<TimeUnit>;
56
+ declare const generateMinuteSet: (step?: number) => ImmutableSet<TimeUnit>;
57
+ declare const generateSecondSet: (step?: number) => ImmutableSet<TimeUnit>;
58
+
59
+ export { CalendarService, DateInputPrefixTemplateDirective, TimeLimiterPipe, TimeSelectorService, datePopupThemeVariants, generateHourSet, generateMinuteSet, generateSecondSet };
60
+ export type { CalendarView, DateDisabledType, DatePopupVariantInput, DatePopupVariantProps, HourFormat, Meridiem, TimeUnit };