@worldware/msg 0.6.2 → 0.6.4

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.
@@ -1,13 +1,13 @@
1
- import {
2
- DEFAULT_ATTRIBUTES
3
- } from "./chunk-OMRO6GAZ.mjs";
4
1
  import {
5
2
  MsgMessage
6
- } from "./chunk-ELDIN22M.mjs";
3
+ } from "./chunk-WUDKNZV2.mjs";
4
+ import {
5
+ DEFAULT_ATTRIBUTES
6
+ } from "./chunk-QWBDIKQK.mjs";
7
7
 
8
8
  // src/classes/MsgResource/MsgResource.ts
9
9
  var MsgResource = class _MsgResource extends Map {
10
- _attributes = DEFAULT_ATTRIBUTES;
10
+ _attributes = {};
11
11
  _notes = [];
12
12
  _title;
13
13
  _project;
@@ -27,7 +27,7 @@ var MsgResource = class _MsgResource extends Map {
27
27
  constructor(title, attributes, project, notes) {
28
28
  super();
29
29
  this._title = title;
30
- this._attributes = { ...this._attributes, ...attributes };
30
+ this._attributes = { ...DEFAULT_ATTRIBUTES, ...attributes };
31
31
  this._project = project;
32
32
  if (notes) {
33
33
  notes.forEach((note) => this.addNote(note));
@@ -124,7 +124,12 @@ var MsgResource = class _MsgResource extends Map {
124
124
  const messages = [];
125
125
  this.forEach((msg) => {
126
126
  if (this.hasMatchingAttributes(msg)) {
127
- messages.push({ key: msg.key, value: msg.value });
127
+ const data = {
128
+ key: msg.key,
129
+ value: msg.value,
130
+ notes: !stripNotes && msg.notes.length > 0 ? msg.notes : void 0
131
+ };
132
+ messages.push(data);
128
133
  } else {
129
134
  messages.push(msg.getData(stripNotes));
130
135
  }
@@ -1,7 +1,7 @@
1
1
  // src/classes/MsgInterface/MsgInterface.ts
2
2
  var DEFAULT_ATTRIBUTES = {
3
- lang: "",
4
- dir: "",
3
+ lang: "und",
4
+ dir: "auto",
5
5
  dnt: false
6
6
  };
7
7
 
@@ -1,10 +1,9 @@
1
+ import {
2
+ DEFAULT_ATTRIBUTES
3
+ } from "./chunk-QWBDIKQK.mjs";
4
+
1
5
  // src/classes/MsgMessage/MsgMessage.ts
2
6
  import { MessageFormat } from "messageformat";
3
- var DEFAULT_ATTRIBUTES = {
4
- lang: "und",
5
- dir: "auto",
6
- dnt: false
7
- };
8
7
  var MsgMessage = class _MsgMessage {
9
8
  _key;
10
9
  _value;
@@ -24,8 +24,8 @@ __export(MsgInterface_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(MsgInterface_exports);
26
26
  var DEFAULT_ATTRIBUTES = {
27
- lang: "",
28
- dir: "",
27
+ lang: "und",
28
+ dir: "auto",
29
29
  dnt: false
30
30
  };
31
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_ATTRIBUTES
3
- } from "../../chunk-OMRO6GAZ.mjs";
3
+ } from "../../chunk-QWBDIKQK.mjs";
4
4
  export {
5
5
  DEFAULT_ATTRIBUTES
6
6
  };
@@ -24,11 +24,15 @@ __export(MsgMessage_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(MsgMessage_exports);
26
26
  var import_messageformat = require("messageformat");
27
+
28
+ // src/classes/MsgInterface/MsgInterface.ts
27
29
  var DEFAULT_ATTRIBUTES = {
28
30
  lang: "und",
29
31
  dir: "auto",
30
32
  dnt: false
31
33
  };
34
+
35
+ // src/classes/MsgMessage/MsgMessage.ts
32
36
  var MsgMessage = class _MsgMessage {
33
37
  _key;
34
38
  _value;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  MsgMessage
3
- } from "../../chunk-ELDIN22M.mjs";
3
+ } from "../../chunk-WUDKNZV2.mjs";
4
+ import "../../chunk-QWBDIKQK.mjs";
4
5
  export {
5
6
  MsgMessage
6
7
  };
@@ -26,11 +26,15 @@ module.exports = __toCommonJS(MsgResource_exports);
26
26
 
27
27
  // src/classes/MsgMessage/MsgMessage.ts
28
28
  var import_messageformat = require("messageformat");
29
+
30
+ // src/classes/MsgInterface/MsgInterface.ts
29
31
  var DEFAULT_ATTRIBUTES = {
30
32
  lang: "und",
31
33
  dir: "auto",
32
34
  dnt: false
33
35
  };
36
+
37
+ // src/classes/MsgMessage/MsgMessage.ts
34
38
  var MsgMessage = class _MsgMessage {
35
39
  _key;
36
40
  _value;
@@ -93,16 +97,9 @@ var MsgMessage = class _MsgMessage {
93
97
  }
94
98
  };
95
99
 
96
- // src/classes/MsgInterface/MsgInterface.ts
97
- var DEFAULT_ATTRIBUTES2 = {
98
- lang: "",
99
- dir: "",
100
- dnt: false
101
- };
102
-
103
100
  // src/classes/MsgResource/MsgResource.ts
104
101
  var MsgResource = class _MsgResource extends Map {
105
- _attributes = DEFAULT_ATTRIBUTES2;
102
+ _attributes = {};
106
103
  _notes = [];
107
104
  _title;
108
105
  _project;
@@ -122,7 +119,7 @@ var MsgResource = class _MsgResource extends Map {
122
119
  constructor(title, attributes, project, notes) {
123
120
  super();
124
121
  this._title = title;
125
- this._attributes = { ...this._attributes, ...attributes };
122
+ this._attributes = { ...DEFAULT_ATTRIBUTES, ...attributes };
126
123
  this._project = project;
127
124
  if (notes) {
128
125
  notes.forEach((note) => this.addNote(note));
@@ -219,7 +216,12 @@ var MsgResource = class _MsgResource extends Map {
219
216
  const messages = [];
220
217
  this.forEach((msg) => {
221
218
  if (this.hasMatchingAttributes(msg)) {
222
- messages.push({ key: msg.key, value: msg.value });
219
+ const data = {
220
+ key: msg.key,
221
+ value: msg.value,
222
+ notes: !stripNotes && msg.notes.length > 0 ? msg.notes : void 0
223
+ };
224
+ messages.push(data);
223
225
  } else {
224
226
  messages.push(msg.getData(stripNotes));
225
227
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MsgResource
3
- } from "../../chunk-ZV7S5BRP.mjs";
4
- import "../../chunk-OMRO6GAZ.mjs";
5
- import "../../chunk-ELDIN22M.mjs";
3
+ } from "../../chunk-AWSZFTAJ.mjs";
4
+ import "../../chunk-WUDKNZV2.mjs";
5
+ import "../../chunk-QWBDIKQK.mjs";
6
6
  export {
7
7
  MsgResource
8
8
  };
@@ -28,11 +28,15 @@ module.exports = __toCommonJS(classes_exports);
28
28
 
29
29
  // src/classes/MsgMessage/MsgMessage.ts
30
30
  var import_messageformat = require("messageformat");
31
+
32
+ // src/classes/MsgInterface/MsgInterface.ts
31
33
  var DEFAULT_ATTRIBUTES = {
32
34
  lang: "und",
33
35
  dir: "auto",
34
36
  dnt: false
35
37
  };
38
+
39
+ // src/classes/MsgMessage/MsgMessage.ts
36
40
  var MsgMessage = class _MsgMessage {
37
41
  _key;
38
42
  _value;
@@ -95,16 +99,9 @@ var MsgMessage = class _MsgMessage {
95
99
  }
96
100
  };
97
101
 
98
- // src/classes/MsgInterface/MsgInterface.ts
99
- var DEFAULT_ATTRIBUTES2 = {
100
- lang: "",
101
- dir: "",
102
- dnt: false
103
- };
104
-
105
102
  // src/classes/MsgResource/MsgResource.ts
106
103
  var MsgResource = class _MsgResource extends Map {
107
- _attributes = DEFAULT_ATTRIBUTES2;
104
+ _attributes = {};
108
105
  _notes = [];
109
106
  _title;
110
107
  _project;
@@ -124,7 +121,7 @@ var MsgResource = class _MsgResource extends Map {
124
121
  constructor(title, attributes, project, notes) {
125
122
  super();
126
123
  this._title = title;
127
- this._attributes = { ...this._attributes, ...attributes };
124
+ this._attributes = { ...DEFAULT_ATTRIBUTES, ...attributes };
128
125
  this._project = project;
129
126
  if (notes) {
130
127
  notes.forEach((note) => this.addNote(note));
@@ -221,7 +218,12 @@ var MsgResource = class _MsgResource extends Map {
221
218
  const messages = [];
222
219
  this.forEach((msg) => {
223
220
  if (this.hasMatchingAttributes(msg)) {
224
- messages.push({ key: msg.key, value: msg.value });
221
+ const data = {
222
+ key: msg.key,
223
+ value: msg.value,
224
+ notes: !stripNotes && msg.notes.length > 0 ? msg.notes : void 0
225
+ };
226
+ messages.push(data);
225
227
  } else {
226
228
  messages.push(msg.getData(stripNotes));
227
229
  }
@@ -4,11 +4,11 @@ import {
4
4
  } from "../chunk-XS43NAP2.mjs";
5
5
  import {
6
6
  MsgResource
7
- } from "../chunk-ZV7S5BRP.mjs";
8
- import "../chunk-OMRO6GAZ.mjs";
7
+ } from "../chunk-AWSZFTAJ.mjs";
9
8
  import {
10
9
  MsgMessage
11
- } from "../chunk-ELDIN22M.mjs";
10
+ } from "../chunk-WUDKNZV2.mjs";
11
+ import "../chunk-QWBDIKQK.mjs";
12
12
  export {
13
13
  MsgMessage,
14
14
  MsgProject,
package/dist/index.cjs CHANGED
@@ -28,11 +28,15 @@ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/classes/MsgMessage/MsgMessage.ts
30
30
  var import_messageformat = require("messageformat");
31
+
32
+ // src/classes/MsgInterface/MsgInterface.ts
31
33
  var DEFAULT_ATTRIBUTES = {
32
34
  lang: "und",
33
35
  dir: "auto",
34
36
  dnt: false
35
37
  };
38
+
39
+ // src/classes/MsgMessage/MsgMessage.ts
36
40
  var MsgMessage = class _MsgMessage {
37
41
  _key;
38
42
  _value;
@@ -95,16 +99,9 @@ var MsgMessage = class _MsgMessage {
95
99
  }
96
100
  };
97
101
 
98
- // src/classes/MsgInterface/MsgInterface.ts
99
- var DEFAULT_ATTRIBUTES2 = {
100
- lang: "",
101
- dir: "",
102
- dnt: false
103
- };
104
-
105
102
  // src/classes/MsgResource/MsgResource.ts
106
103
  var MsgResource = class _MsgResource extends Map {
107
- _attributes = DEFAULT_ATTRIBUTES2;
104
+ _attributes = {};
108
105
  _notes = [];
109
106
  _title;
110
107
  _project;
@@ -124,7 +121,7 @@ var MsgResource = class _MsgResource extends Map {
124
121
  constructor(title, attributes, project, notes) {
125
122
  super();
126
123
  this._title = title;
127
- this._attributes = { ...this._attributes, ...attributes };
124
+ this._attributes = { ...DEFAULT_ATTRIBUTES, ...attributes };
128
125
  this._project = project;
129
126
  if (notes) {
130
127
  notes.forEach((note) => this.addNote(note));
@@ -221,7 +218,12 @@ var MsgResource = class _MsgResource extends Map {
221
218
  const messages = [];
222
219
  this.forEach((msg) => {
223
220
  if (this.hasMatchingAttributes(msg)) {
224
- messages.push({ key: msg.key, value: msg.value });
221
+ const data = {
222
+ key: msg.key,
223
+ value: msg.value,
224
+ notes: !stripNotes && msg.notes.length > 0 ? msg.notes : void 0
225
+ };
226
+ messages.push(data);
225
227
  } else {
226
228
  messages.push(msg.getData(stripNotes));
227
229
  }
package/dist/index.mjs CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-XS43NAP2.mjs";
5
5
  import {
6
6
  MsgResource
7
- } from "./chunk-ZV7S5BRP.mjs";
8
- import "./chunk-OMRO6GAZ.mjs";
7
+ } from "./chunk-AWSZFTAJ.mjs";
9
8
  import {
10
9
  MsgMessage
11
- } from "./chunk-ELDIN22M.mjs";
10
+ } from "./chunk-WUDKNZV2.mjs";
11
+ import "./chunk-QWBDIKQK.mjs";
12
12
  export {
13
13
  MsgMessage,
14
14
  MsgProject,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldware/msg",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Message localization tooling",
5
5
  "license": "MIT",
6
6
  "author": "Joel Sahleen",