@aiao/rxdb-angular 0.0.7 → 0.0.8

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 (42) hide show
  1. package/LICENSE +21 -0
  2. package/fesm2022/aiao-rxdb-angular.mjs +423 -0
  3. package/fesm2022/aiao-rxdb-angular.mjs.map +1 -0
  4. package/package.json +26 -13
  5. package/types/aiao-rxdb-angular.d.ts +222 -0
  6. package/eslint.config.mjs +0 -58
  7. package/ng-package.json +0 -7
  8. package/project.json +0 -48
  9. package/src/InfiniteScrollingList.ts +0 -123
  10. package/src/devtools/devtools.html +0 -99
  11. package/src/devtools/devtools.interface.ts +0 -3
  12. package/src/devtools/devtools.scss +0 -49
  13. package/src/devtools/devtools.spec.ts +0 -30
  14. package/src/devtools/devtools.ts +0 -207
  15. package/src/devtools/entity-table-item.ts +0 -47
  16. package/src/devtools/entity-table-tools.html +0 -56
  17. package/src/devtools/entity-table-tools.scss +0 -8
  18. package/src/devtools/entity-table-tools.ts +0 -153
  19. package/src/devtools/event-tools.html +0 -15
  20. package/src/devtools/event-tools.scss +0 -18
  21. package/src/devtools/event-tools.ts +0 -45
  22. package/src/devtools/scroll-advanced-calc.service.ts +0 -41
  23. package/src/devtools/settings.html +0 -46
  24. package/src/devtools/settings.scss +0 -19
  25. package/src/devtools/settings.ts +0 -122
  26. package/src/hooks.ts +0 -307
  27. package/src/index.ts +0 -7
  28. package/src/rxdb-change-detector.directive.spec.ts +0 -94
  29. package/src/rxdb-change-detector.directive.ts +0 -35
  30. package/src/rxdb.provider.ts +0 -13
  31. package/src/rxdb.service.spec.ts +0 -31
  32. package/src/rxdb.service.ts +0 -35
  33. package/src/test-setup.ts +0 -14
  34. package/src/use-action.spec.ts +0 -88
  35. package/src/use-action.ts +0 -20
  36. package/src/use-state.spec.ts +0 -105
  37. package/src/use-state.ts +0 -28
  38. package/tsconfig.json +0 -33
  39. package/tsconfig.lib.json +0 -42
  40. package/tsconfig.lib.prod.json +0 -10
  41. package/tsconfig.spec.json +0 -23
  42. package/vite.config.mts +0 -55
@@ -0,0 +1,222 @@
1
+ import { EntityType, EntityStaticType, TreeEntityType, RxDB, FindByCursorOptions } from '@aiao/rxdb';
2
+ import { GraphEntityType } from '@aiao/rxdb-plugin-graph';
3
+ import * as _angular_core from '@angular/core';
4
+ import { Signal, CreateSignalOptions, WritableSignal } from '@angular/core';
5
+
6
+ type UseOptions<T> = T | (() => T);
7
+ interface RxDBResource<T> {
8
+ /**
9
+ * 资源的值
10
+ */
11
+ readonly value: Signal<T>;
12
+ /**
13
+ * 资源的错误
14
+ */
15
+ readonly error: Signal<Error | undefined>;
16
+ /**
17
+ * 资源的加载状态
18
+ */
19
+ readonly isLoading: Signal<boolean>;
20
+ /**
21
+ * 资源是否为空
22
+ */
23
+ readonly isEmpty: Signal<boolean | undefined>;
24
+ /**
25
+ * 资源是否有值
26
+ */
27
+ readonly hasValue: Signal<boolean>;
28
+ }
29
+ declare const useRepositoryQuery: <T extends EntityType, RT>(EntityType: T, method: string, defaultValue: any, options: UseOptions<any>) => RxDBResource<RT>;
30
+ /**
31
+ * 通过 ID 获取单个实体
32
+ *
33
+ * @param EntityType 实体类
34
+ * @param options 实体 ID 或查询参数对象
35
+ * @returns 返回包含实体的资源 signal
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const user = useGet(User, 'user-1');
40
+ * ```
41
+ */
42
+ declare const useGet: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "getOptions">>) => RxDBResource<InstanceType<T>>;
43
+ /**
44
+ * 查找第一个匹配条件的实体
45
+ *
46
+ * @param EntityType 实体类
47
+ * @param options 查询参数(where、排序等)
48
+ * @returns 返回包含实体的资源 signal
49
+ */
50
+ declare const useFindOne: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findOneOptions">>) => RxDBResource<InstanceType<T> | undefined>;
51
+ /**
52
+ * 查找匹配的实体,未找到则抛出错误
53
+ *
54
+ * @param EntityType 实体类
55
+ * @param options 查询参数
56
+ * @returns 返回包含实体的资源 signal
57
+ */
58
+ declare const useFindOneOrFail: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findOneOrFailOptions">>) => RxDBResource<InstanceType<T>>;
59
+ /**
60
+ * 查找符合条件的多个实体
61
+ *
62
+ * @param EntityType 实体类
63
+ * @param options 查询参数
64
+ * @returns 返回包含实体数组的资源 signal
65
+ */
66
+ declare const useFind: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findOptions">>) => RxDBResource<InstanceType<T>[]>;
67
+ /**
68
+ * 使用游标分页查找实体
69
+ *
70
+ * @param EntityType 实体类
71
+ * @param options 游标参数
72
+ * @returns 返回包含实体数组的资源 signal
73
+ */
74
+ declare const useFindByCursor: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findByCursorOptions">>) => RxDBResource<InstanceType<T>[]>;
75
+ /**
76
+ * 查找全部实体
77
+ *
78
+ * @param EntityType 实体类
79
+ * @param options 查询参数
80
+ * @returns 返回包含全部实体的资源 signal
81
+ */
82
+ declare const useFindAll: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findAllOptions">>) => RxDBResource<InstanceType<T>[]>;
83
+ /**
84
+ * 统计满足条件的实体数量
85
+ *
86
+ * @param EntityType 实体类
87
+ * @param options 查询参数
88
+ * @returns 返回包含数量的资源 signal
89
+ */
90
+ declare const useCount: <T extends EntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "countOptions">>) => RxDBResource<number>;
91
+ /**
92
+ * 查找树结构中的所有子孙实体
93
+ *
94
+ * @param EntityType 实体类
95
+ * @param options 树查询参数(entityId、深度等)
96
+ * @returns 返回包含子孙实体的资源 signal
97
+ */
98
+ declare const useFindDescendants: <T extends TreeEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findTreeOptions">>) => RxDBResource<InstanceType<T>[]>;
99
+ /**
100
+ * 统计树结构中的子孙数量
101
+ *
102
+ * @param EntityType 实体类
103
+ * @param options 树查询参数
104
+ * @returns 返回包含数量的资源 signal
105
+ */
106
+ declare const useCountDescendants: <T extends TreeEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findTreeOptions">>) => RxDBResource<number>;
107
+ /**
108
+ * 查找树结构中的所有祖先实体
109
+ *
110
+ * @param EntityType 实体类
111
+ * @param options 树查询参数
112
+ * @returns 返回包含祖先实体的资源 signal
113
+ */
114
+ declare const useFindAncestors: <T extends TreeEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findTreeOptions">>) => RxDBResource<InstanceType<T>[]>;
115
+ /**
116
+ * 统计树结构中的祖先数量
117
+ *
118
+ * @param EntityType 实体类
119
+ * @param options 树查询参数
120
+ * @returns 返回包含数量的资源 signal
121
+ */
122
+ declare const useCountAncestors: <T extends TreeEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findTreeOptions">>) => RxDBResource<number>;
123
+ /**
124
+ * 查找图结构中的邻接实体
125
+ *
126
+ * @param EntityType 实体类
127
+ * @param options 图查询参数(entityId、方向、层级等)
128
+ * @returns 返回包含邻居实体的资源 signal
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * const friends = useGraphNeighbors(User, {
133
+ * entityId: 'user-1',
134
+ * direction: 'out',
135
+ * level: 1
136
+ * });
137
+ * ```
138
+ */
139
+ declare const useGraphNeighbors: <T extends GraphEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findNeighborsOptions">>) => RxDBResource<InstanceType<T>[]>;
140
+ /**
141
+ * 统计图结构中的邻接数量
142
+ *
143
+ * @param EntityType 实体类
144
+ * @param options 图查询参数
145
+ * @returns 返回包含数量的资源 signal
146
+ */
147
+ declare const useCountNeighbors: <T extends GraphEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findNeighborsOptions">>) => RxDBResource<number>;
148
+ /**
149
+ * 查找图结构中两个实体之间的路径
150
+ *
151
+ * @param EntityType 实体类
152
+ * @param options 路径查询参数(fromId、toId、最大深度等)
153
+ * @returns 返回包含路径的资源 signal
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * const paths = useGraphPaths(User, {
158
+ * fromId: 'user-1',
159
+ * toId: 'user-2',
160
+ * maxDepth: 5
161
+ * });
162
+ * ```
163
+ */
164
+ declare const useGraphPaths: <T extends GraphEntityType>(EntityType: T, options: UseOptions<EntityStaticType<T, "findPathsOptions">>) => RxDBResource<any[]>;
165
+
166
+ type OptionsInput<T extends EntityType> = FindByCursorOptions<T> | Signal<FindByCursorOptions<T>>;
167
+ /**
168
+ * 无限滚动的列表
169
+ */
170
+ declare class InfiniteScrollingList<T extends EntityType> {
171
+ #private;
172
+ private readonly rxdb;
173
+ private readonly EntityType;
174
+ private readonly options;
175
+ readonly error: _angular_core.WritableSignal<Error | undefined>;
176
+ readonly isLoading: _angular_core.WritableSignal<boolean>;
177
+ readonly hasMore: _angular_core.WritableSignal<boolean>;
178
+ readonly value: Signal<InstanceType<T>[]>;
179
+ readonly hasValue: Signal<boolean>;
180
+ readonly isEmpty: Signal<boolean>;
181
+ constructor(rxdb: RxDB, EntityType: T, options: OptionsInput<T>);
182
+ loadMore(): void;
183
+ /**
184
+ * 刷新列表数据
185
+ */
186
+ refresh(): void;
187
+ }
188
+
189
+ /**
190
+ * RxDB 实体变化指令
191
+ * 如果你使用了 `changeDetection: ChangeDetectionStrategy.OnPush`
192
+ * 那么正在输入的变化不会触发 angular 渲染机制,使用这个指令可以实现实时渲染
193
+ *
194
+ * @example
195
+ * 当修改实体时,需要在多个地方预览修改变化时,可以使用这个指令
196
+ */
197
+ declare class RxDBEntityChangeDirective {
198
+ #private;
199
+ readonly rxdbChangeDetector: _angular_core.InputSignal<any>;
200
+ readonly debounceTime: _angular_core.InputSignal<number>;
201
+ readonly auditTime: _angular_core.InputSignal<number>;
202
+ constructor();
203
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RxDBEntityChangeDirective, never>;
204
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RxDBEntityChangeDirective, "[rxdbChangeDetector]", never, { "rxdbChangeDetector": { "alias": "rxdbChangeDetector"; "required": false; "isSignal": true; }; "debounceTime": { "alias": "debounceTime"; "required": false; "isSignal": true; }; "auditTime": { "alias": "auditTime"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
205
+ }
206
+
207
+ /**
208
+ * RxDB 配置
209
+ */
210
+ declare const provideRxDB: (useFactory?: () => RxDB) => _angular_core.EnvironmentProviders;
211
+
212
+ declare const useAction: <Options = any, RT = any>(promiseFn: (options?: Options) => Promise<RT>) => {
213
+ isPending: _angular_core.WritableSignal<boolean>;
214
+ execute: (options?: Options | undefined) => Promise<RT>;
215
+ };
216
+
217
+ declare const useState: (namespace: string) => (name: string) => {
218
+ signal: <T>(initialValue: T, options?: CreateSignalOptions<T>) => WritableSignal<T>;
219
+ };
220
+
221
+ export { InfiniteScrollingList, RxDBEntityChangeDirective, provideRxDB, useAction, useCount, useCountAncestors, useCountDescendants, useCountNeighbors, useFind, useFindAll, useFindAncestors, useFindByCursor, useFindDescendants, useFindOne, useFindOneOrFail, useGet, useGraphNeighbors, useGraphPaths, useRepositoryQuery, useState };
222
+ export type { RxDBResource };
package/eslint.config.mjs DELETED
@@ -1,58 +0,0 @@
1
- import nx from '@nx/eslint-plugin';
2
- import jsoncParser from 'jsonc-eslint-parser';
3
- import baseConfig from '../../eslint.config.mjs';
4
-
5
- export default [
6
- ...baseConfig,
7
- {
8
- files: ['**/*.json'],
9
- rules: {
10
- '@nx/dependency-checks': [
11
- 'error',
12
- {
13
- ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
14
- ignoredDependencies: [
15
- '@analogjs/vite-plugin-angular',
16
- '@codecov/vite-plugin',
17
- '@angular/common',
18
- '@angular/core',
19
- '@angular/forms',
20
- '@nx/vite',
21
- 'vite'
22
- ]
23
- }
24
- ]
25
- },
26
- languageOptions: {
27
- parser: jsoncParser
28
- }
29
- },
30
- ...nx.configs['flat/angular'],
31
- ...nx.configs['flat/angular-template'],
32
- {
33
- files: ['**/*.ts'],
34
- rules: {
35
- '@angular-eslint/directive-selector': [
36
- 'error',
37
- {
38
- type: 'attribute',
39
- prefix: 'rxdb',
40
- style: 'camelCase'
41
- }
42
- ],
43
- '@angular-eslint/component-selector': [
44
- 'error',
45
- {
46
- type: 'element',
47
- prefix: 'rxdb',
48
- style: 'kebab-case'
49
- }
50
- ]
51
- }
52
- },
53
- {
54
- files: ['**/*.html'],
55
- // Override or add rules here
56
- rules: {}
57
- }
58
- ];
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/packages/rxdb-angular",
4
- "lib": {
5
- "entryFile": "src/index.ts"
6
- }
7
- }
package/project.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
3
- "implicitDependencies": ["code-editor-angular"],
4
- "name": "rxdb-angular",
5
- "prefix": "rxdb",
6
- "projectType": "library",
7
- "release": {
8
- "version": {
9
- "manifestRootsToUpdate": ["dist/{projectRoot}"],
10
- "currentVersionResolver": "git-tag",
11
- "fallbackCurrentVersionResolver": "disk"
12
- }
13
- },
14
- "sourceRoot": "packages/rxdb-angular/src",
15
- "tags": ["angular-lib"],
16
- "targets": {
17
- "build": {
18
- "executor": "@nx/angular:package",
19
- "outputs": ["{workspaceRoot}/dist/{projectRoot}"],
20
- "options": {
21
- "project": "packages/rxdb-angular/ng-package.json",
22
- "tsConfig": "packages/rxdb-angular/tsconfig.lib.json"
23
- },
24
- "configurations": {
25
- "production": {
26
- "tsConfig": "packages/rxdb-angular/tsconfig.lib.prod.json"
27
- },
28
- "development": {}
29
- },
30
- "defaultConfiguration": "production"
31
- },
32
- "nx-release-publish": {
33
- "options": {
34
- "packageRoot": "dist/{projectRoot}"
35
- }
36
- },
37
- "lint": {
38
- "executor": "@nx/eslint:lint"
39
- },
40
- "test": {
41
- "executor": "@nx/vitest:test",
42
- "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
43
- "options": {
44
- "config": "packages/rxdb-angular/vite.config.mts"
45
- }
46
- }
47
- }
48
- }
@@ -1,123 +0,0 @@
1
- import { EntityType, FindByCursorOptions, RxDB } from '@aiao/rxdb';
2
- import { isFunction, nextMicroTask } from '@aiao/utils';
3
- import { computed, DestroyRef, effect, EffectRef, inject, Signal, signal, untracked } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
-
6
- type OptionsInput<T extends EntityType> = FindByCursorOptions<T> | Signal<FindByCursorOptions<T>>;
7
-
8
- /**
9
- * 无限滚动的列表
10
- */
11
- export class InfiniteScrollingList<T extends EntityType> {
12
- readonly #values = signal<InstanceType<T>[][]>([]);
13
- readonly #destroy_ref = inject(DestroyRef);
14
- readonly #options_eff: EffectRef;
15
-
16
- #is_initialized = false;
17
-
18
- readonly error = signal<Error | undefined>(undefined);
19
- readonly isLoading = signal<boolean>(false);
20
- readonly hasMore = signal<boolean>(true);
21
- readonly value = computed<InstanceType<T>[]>(() => this.#values().flat());
22
- readonly hasValue = computed<boolean>(() => this.value().length > 0);
23
- readonly isEmpty = computed<boolean>(() => !this.isLoading() && !this.hasValue() && this.#is_initialized);
24
-
25
- constructor(
26
- private readonly rxdb: RxDB,
27
- private readonly EntityType: T,
28
- private readonly options: OptionsInput<T>
29
- ) {
30
- this.#options_eff = effect(() => {
31
- if (isFunction(this.options)) {
32
- this.options();
33
- }
34
- if (!this.#is_initialized) {
35
- this.#is_initialized = true;
36
- nextMicroTask(() => this.loadMore());
37
- return;
38
- }
39
- untracked(() => this.#reset());
40
- });
41
-
42
- this.#destroy_ref.onDestroy(() => {
43
- this.#options_eff.destroy();
44
- });
45
- }
46
-
47
- loadMore(): void {
48
- if (this.isLoading() || !this.hasMore()) {
49
- return;
50
- }
51
-
52
- this.isLoading.set(true);
53
- this.error.set(undefined);
54
-
55
- const last_entity = this.#get_last_entity();
56
- const opt = isFunction(this.options) ? this.options() : this.options;
57
- const options = structuredClone(opt);
58
-
59
- if (last_entity) {
60
- options.after = last_entity;
61
- }
62
-
63
- const current_index = this.#values().length;
64
-
65
- this.rxdb.entityManager
66
- .getRepository(this.EntityType)
67
- .findByCursor(options)
68
- .pipe(takeUntilDestroyed(this.#destroy_ref))
69
- .subscribe({
70
- next: result => {
71
- this.isLoading.set(false);
72
- this.#values.update(values => {
73
- const updated = [...values];
74
- updated[current_index] = result;
75
- return updated;
76
- });
77
-
78
- if (result.length < (options.limit || 100)) {
79
- this.hasMore.set(false);
80
- }
81
- },
82
- error: error => {
83
- this.isLoading.set(false);
84
- this.error.set(error);
85
- },
86
- complete: () => {
87
- this.hasMore.set(false);
88
- this.isLoading.set(false);
89
- }
90
- });
91
- }
92
-
93
- /**
94
- * 刷新列表数据
95
- */
96
- refresh(): void {
97
- // 强制重置状态,即使正在加载中
98
- this.#values.set([]);
99
- this.error.set(undefined);
100
- this.isLoading.set(false); // 强制设置为 false,允许新的 loadMore
101
- this.hasMore.set(true);
102
-
103
- // 立即开始加载
104
- this.loadMore();
105
- }
106
- #reset(): void {
107
- this.#values.set([]);
108
- this.error.set(undefined);
109
- this.isLoading.set(false);
110
- this.hasMore.set(true);
111
- nextMicroTask(() => this.loadMore());
112
- }
113
-
114
- #get_last_entity(): InstanceType<T> | undefined {
115
- const values = this.#values();
116
- if (values.length === 0) return undefined;
117
-
118
- const last_page = values[values.length - 1];
119
- if (last_page.length === 0) return undefined;
120
-
121
- return last_page[last_page.length - 1];
122
- }
123
- }
@@ -1,99 +0,0 @@
1
- @let tabs = $tabs();
2
- @let current_tab = $current_tab();
3
-
4
- <div class="touch" (mousedown)="mousedown($event)"></div>
5
-
6
- <!-- header -->
7
- <div class="bg-base-300 z-1 flex min-h-0 flex-row p-0 shadow-sm">
8
- <div class="flex-1">
9
- <div class="tabs tabs-border tabs-xs" role="tablist">
10
- @for (tab of tabs; track $index) {
11
- <a
12
- class="tab"
13
- [class.tab-active]="current_tab === tab.id"
14
- (click)="$current_tab.set(tab.id)"
15
- aria-hidden="true"
16
- role="tab"
17
- >
18
- {{ tab.name }}
19
- </a>
20
- }
21
- </div>
22
- </div>
23
- <div>
24
- <button class="btn btn-xs btn-ghost" (click)="toggle_settings()" aria-hidden="true">
25
- <lucide-icon [img]="Settings" size="16"></lucide-icon>
26
- </button>
27
- <button class="btn btn-xs btn-ghost" (click)="close_rxdb_devtools()" aria-hidden="true">
28
- <lucide-icon [img]="X" size="16"></lucide-icon>
29
- </button>
30
- </div>
31
- </div>
32
-
33
- <!-- Pages -->
34
- <div class="bg-base-100 flex h-full flex-1 flex-row overflow-hidden">
35
- @switch (current_tab) {
36
- @case ('tables') {
37
- @defer (on viewport) {
38
- <rxdb-entity-table-tools [theme]="theme()"></rxdb-entity-table-tools>
39
- } @placeholder {
40
- <div>entity table loading...</div>
41
- }
42
- }
43
-
44
- @case ('events') {
45
- @defer (on viewport) {
46
- <rxdb-event-tools></rxdb-event-tools>
47
- } @placeholder {
48
- <div>entity table loading...</div>
49
- }
50
- }
51
-
52
- @case ('settings') {
53
- @defer (on viewport) {
54
- <rxdb-settings (sideChange)="$side.set($event)"></rxdb-settings>
55
- } @placeholder {
56
- <div>entity table loading...</div>
57
- }
58
- }
59
- }
60
- </div>
61
- <!-- footer -->
62
- @let branchName = $branchName();
63
- @let switch_branching = $switch_branching();
64
-
65
- <div class="bg-base-300 relative z-1 flex min-h-0 flex-row p-0 shadow-sm">
66
- <div class="relative flex w-30 items-center justify-center">
67
- @if (switch_branching) {
68
- <span class="loading loading-spinner loading-xs absolute"></span>
69
- }
70
- <select
71
- class="select select-ghost select-xs outline-none"
72
- [disabled]="switch_branching"
73
- (change)="switch_branch($event)"
74
- name="branch"
75
- >
76
- @for (branch of branches.value(); track $index) {
77
- <option [selected]="branch.activated" [value]="branch.id">
78
- {{ branch.id }}
79
- </option>
80
- }
81
- </select>
82
- </div>
83
- <input
84
- class="input input-xs w-24 outline-none"
85
- [(ngModel)]="$branchName"
86
- [disabled]="switch_branching"
87
- (keyup.enter)="create_branch(branchName)"
88
- placeholder="branch name"
89
- type="text"
90
- />
91
- <button
92
- class="btn btn-xs btn-ghost"
93
- [class.btn-disabled]="!branchName"
94
- [disabled]="switch_branching"
95
- (click)="create_branch(branchName)"
96
- >
97
- Create Branch
98
- </button>
99
- </div>
@@ -1,3 +0,0 @@
1
- export interface RxDBDevToolsOptions {
2
- theme?: 'light' | 'dark';
3
- }
@@ -1,49 +0,0 @@
1
- :host {
2
- position: fixed;
3
- display: flex;
4
- flex-direction: column;
5
- z-index: 100;
6
- border: 1px solid #ccc;
7
- }
8
-
9
- .touch {
10
- position: absolute;
11
- height: 100%;
12
- width: 4px;
13
- z-index: 1000;
14
- cursor: ew-resize;
15
- transition: background 0.1s 0.3s;
16
- &:hover {
17
- background-color: rgba($color: blue, $alpha: 0.2);
18
- }
19
- }
20
-
21
- :host(.right) {
22
- top: 0;
23
- right: 0;
24
- .touch {
25
- left: 0;
26
- transform: translateX(-2px);
27
- }
28
- }
29
-
30
- :host(.left) {
31
- top: 0;
32
- left: 0;
33
- .touch {
34
- right: 0;
35
- transform: translateX(2px);
36
- }
37
- }
38
-
39
- :host(.bottom) {
40
- bottom: 0;
41
- left: 0;
42
- .touch {
43
- top: 0;
44
- width: 100%;
45
- height: 4px;
46
- transform: translateY(-2px);
47
- cursor: ns-resize;
48
- }
49
- }
@@ -1,30 +0,0 @@
1
- import { provideZonelessChangeDetection } from '@angular/core';
2
- import { ComponentFixture, TestBed } from '@angular/core/testing';
3
- import { BrowserModule } from '@angular/platform-browser';
4
- import { beforeEach, describe, expect, it } from 'vitest';
5
- import { provideRxDB } from '../rxdb.provider';
6
- import { RxDBDevtools } from './devtools';
7
-
8
- const setup_rxdb = () => {
9
- return null as any;
10
- };
11
-
12
- describe('RxDBDevtools', () => {
13
- let component: RxDBDevtools;
14
- let fixture: ComponentFixture<RxDBDevtools>;
15
-
16
- beforeEach(async () => {
17
- await TestBed.configureTestingModule({
18
- imports: [RxDBDevtools, BrowserModule],
19
- providers: [provideZonelessChangeDetection(), provideRxDB(setup_rxdb)]
20
- }).compileComponents();
21
-
22
- fixture = TestBed.createComponent(RxDBDevtools);
23
- component = fixture.componentInstance;
24
- fixture.detectChanges();
25
- });
26
-
27
- it('should create', () => {
28
- expect(component).toBeTruthy();
29
- });
30
- });