@noldova/code.editor.merge.angular 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class MergeOpening {
9
+ merge;
10
+ failure;
11
+ constructor(merge, failure) {
12
+ this.merge = merge;
13
+ this.failure = failure;
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@noldova/code.editor.merge.angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "description": "The code editor's merge view in Angular: ours, theirs and the result side by side, with each conflict's choices, styled only with the kit's tokens.",
5
+ "type": "module",
6
+ "main": "api/index.js",
7
+ "types": "api/index.d.ts",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/noldova-com/code-editor.git",
12
+ "directory": "src/noldova.code.editor.merge.angular"
13
+ },
14
+ "homepage": "https://github.com/noldova-com/code-editor#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/noldova-com/code-editor/issues"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "scripts": {
23
+ "test": "ngc -p tsconfig.json && playwright install --only-shell chromium && ng test"
24
+ },
25
+ "dependencies": {
26
+ "@noldova/code.editor": "0.0.2",
27
+ "@noldova/code.editor.angular": "0.0.2",
28
+ "@noldova/code.editor.merge": "0.0.2",
29
+ "tslib": "2.8.1"
30
+ },
31
+ "peerDependencies": {
32
+ "@angular/common": ">=22.3.0 <23.0.0",
33
+ "@angular/core": ">=22.3.0 <23.0.0",
34
+ "@noldova/context.collections": ">=0.0.17 <0.1.0",
35
+ "@noldova/context.core": ">=0.0.17 <0.1.0",
36
+ "@noldova/context.exceptions": ">=0.0.17 <0.1.0",
37
+ "@noldova/ui.components.angular": ">=0.0.35 <0.1.0",
38
+ "rxjs": ">=7.8.2 <8.0.0"
39
+ },
40
+ "gitHead": "3d402fbe7f27ad6c31227bc0e9372fa06484a79f"
41
+ }
package/resources.d.ts ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import type { ConflictState } from "@noldova/code.editor.merge";
9
+ export declare class Resources {
10
+ static readonly empty: string;
11
+ static readonly lineFeed: string;
12
+ static readonly keyDown: "keydown";
13
+ static readonly mergeEditorClass: string;
14
+ static readonly panelsClass: string;
15
+ static readonly panelsClassBinding: string;
16
+ static readonly conflictSign: string;
17
+ static readonly warningColor: string;
18
+ static readonly textColor: string;
19
+ static readonly oursBackground: string;
20
+ static readonly theirsBackground: string;
21
+ static readonly mixedBackground: string;
22
+ static readonly clearBackground: string;
23
+ static readonly openBarBackground: string;
24
+ static readonly takeAction: string;
25
+ static readonly oursAction: string;
26
+ static readonly theirsAction: string;
27
+ static readonly bothAction: string;
28
+ static readonly suggestedAction: string;
29
+ static readonly keyArrowDown: string;
30
+ static readonly keyArrowUp: string;
31
+ static readonly resultLabel: string;
32
+ static readonly baseLabel: string;
33
+ static readonly noConflicts: string;
34
+ static readonly noMoreConflicts: string;
35
+ static readonly acceptOursLabel: string;
36
+ static readonly acceptTheirsLabel: string;
37
+ static readonly acceptBothOursFirstLabel: string;
38
+ static readonly acceptBothTheirsFirstLabel: string;
39
+ static readonly resetLabel: string;
40
+ static readonly takeLabel: string;
41
+ static readonly takeIcon: string;
42
+ static readonly suggestedIcon: string;
43
+ static readonly warningIcon: string;
44
+ static readonly oursChoiceLabel: string;
45
+ static readonly theirsChoiceLabel: string;
46
+ static readonly bothChoiceLabel: string;
47
+ static readonly suggestedChoiceLabel: string;
48
+ static readonly previousConflictLabel: string;
49
+ static readonly nextConflictLabel: string;
50
+ static readonly wordSeparator: string;
51
+ static readonly partSeparator: string;
52
+ static readonly chunkSeparator: string;
53
+ static readonly labelSeparator: string;
54
+ static readonly conflictWord: string;
55
+ static readonly ofWord: string;
56
+ static readonly unresolvedWord: string;
57
+ static readonly oneConflict: string;
58
+ static readonly manyConflicts: string;
59
+ static readonly isOpen: string;
60
+ static readonly openHint: string;
61
+ static readonly sideDeleted: string;
62
+ static readonly stateNames: Readonly<Record<ConflictState, string>>;
63
+ static formatConflict(position: number, count: number, state: ConflictState, unresolved: number): string;
64
+ static formatChunk(position: number, state: ConflictState): string;
65
+ static formatOpen(position: number): string;
66
+ static formatUnresolved(unresolved: number, count: number): string;
67
+ static formatDeleted(side: string): string;
68
+ private static words;
69
+ }
package/resources.js ADDED
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) Noldova.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export class Resources {
9
+ static empty = "";
10
+ static lineFeed = "\n";
11
+ static keyDown = "keydown";
12
+ static mergeEditorClass = "nol-merge-editor";
13
+ static panelsClass = "nol-merge-editor-panels";
14
+ static panelsClassBinding = `[class.${Resources.panelsClass}]`;
15
+ static conflictSign = "!";
16
+ static warningColor = "var(--nol-warning)";
17
+ static textColor = "var(--nol-text)";
18
+ static oursBackground = "color-mix(in srgb, var(--nol-author-3) 16%, transparent)";
19
+ static theirsBackground = "color-mix(in srgb, var(--nol-author-5) 16%, transparent)";
20
+ static mixedBackground = `linear-gradient(90deg, ${Resources.oursBackground}, ${Resources.theirsBackground})`;
21
+ static clearBackground = "transparent";
22
+ static openBarBackground = "color-mix(in srgb, var(--nol-warning) 18%, transparent)";
23
+ static takeAction = "take";
24
+ static oursAction = "ours";
25
+ static theirsAction = "theirs";
26
+ static bothAction = "both";
27
+ static suggestedAction = "suggested";
28
+ static keyArrowDown = "ArrowDown";
29
+ static keyArrowUp = "ArrowUp";
30
+ static resultLabel = "Result";
31
+ static baseLabel = "Base";
32
+ static noConflicts = "No conflicts";
33
+ static noMoreConflicts = "No more conflicts";
34
+ static acceptOursLabel = "Accept ours";
35
+ static acceptTheirsLabel = "Accept theirs";
36
+ static acceptBothOursFirstLabel = "Both, ours first";
37
+ static acceptBothTheirsFirstLabel = "Both, theirs first";
38
+ static resetLabel = "Reset";
39
+ static takeLabel = "Take";
40
+ static takeIcon = "add";
41
+ static suggestedIcon = "auto_awesome";
42
+ static warningIcon = "warning";
43
+ static oursChoiceLabel = "Ours";
44
+ static theirsChoiceLabel = "Theirs";
45
+ static bothChoiceLabel = "Both";
46
+ static suggestedChoiceLabel = "Suggested";
47
+ static previousConflictLabel = "Previous conflict";
48
+ static nextConflictLabel = "Next conflict";
49
+ static wordSeparator = " ";
50
+ static partSeparator = ", ";
51
+ static chunkSeparator = " · ";
52
+ static labelSeparator = ": ";
53
+ static conflictWord = "Conflict";
54
+ static ofWord = "of";
55
+ static unresolvedWord = "unresolved";
56
+ static oneConflict = "conflict";
57
+ static manyConflicts = "conflicts";
58
+ static isOpen = "is open.";
59
+ static openHint = "Take ours, theirs or both, or type the result here.";
60
+ static sideDeleted = "this side deleted the file.";
61
+ static stateNames = {
62
+ Unresolved: "unresolved",
63
+ Ours: "ours accepted",
64
+ Theirs: "theirs accepted",
65
+ BothOursFirst: "both accepted, ours first",
66
+ BothTheirsFirst: "both accepted, theirs first",
67
+ Suggested: "suggested",
68
+ Edited: "edited"
69
+ };
70
+ static formatConflict(position, count, state, unresolved) {
71
+ return [Resources.words(Resources.conflictWord, String(position), Resources.ofWord, String(count)), Resources.stateNames[state],
72
+ Resources.words(String(unresolved), Resources.unresolvedWord)].join(Resources.partSeparator);
73
+ }
74
+ static formatChunk(position, state) {
75
+ return `${Resources.words(Resources.conflictWord, String(position))}${Resources.chunkSeparator}${Resources.stateNames[state]}`;
76
+ }
77
+ static formatOpen(position) {
78
+ return Resources.words(Resources.conflictWord, String(position), Resources.isOpen, Resources.openHint);
79
+ }
80
+ static formatUnresolved(unresolved, count) {
81
+ return Resources.words(String(unresolved), Resources.ofWord, String(count), count === 1 ? Resources.oneConflict : Resources.manyConflicts, Resources.unresolvedWord);
82
+ }
83
+ static formatDeleted(side) {
84
+ return `${side}${Resources.labelSeparator}${Resources.sideDeleted}`;
85
+ }
86
+ static words(...parts) {
87
+ return parts.join(Resources.wordSeparator);
88
+ }
89
+ }