@oods/component-contracts 0.7.0 → 0.9.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.
- package/README.md +1 -1
- package/dist/index.cjs +5 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -4
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -29,4 +29,4 @@ Use matching versions of the OODS packages. These packages are separate from the
|
|
|
29
29
|
|
|
30
30
|
## License
|
|
31
31
|
|
|
32
|
-
Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/component-contracts@0.
|
|
32
|
+
Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/component-contracts@0.9.0/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/component-contracts@0.9.0/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
|
package/dist/index.cjs
CHANGED
|
@@ -17795,7 +17795,7 @@ function formatDateTime(value, options = {}) {
|
|
|
17795
17795
|
if (!Number.isFinite(date.getTime())) return "";
|
|
17796
17796
|
return new Intl.DateTimeFormat(options.locale ?? "en-US", {
|
|
17797
17797
|
dateStyle: "medium",
|
|
17798
|
-
timeStyle: "short",
|
|
17798
|
+
...options.dateOnly ? {} : { timeStyle: "short" },
|
|
17799
17799
|
timeZone: options.timeZone ?? "UTC"
|
|
17800
17800
|
}).format(date);
|
|
17801
17801
|
}
|
|
@@ -17818,7 +17818,8 @@ function formatDeclaredNumber(value, format) {
|
|
|
17818
17818
|
}
|
|
17819
17819
|
function formatReadOnlyValue(value, type, code = false, format) {
|
|
17820
17820
|
if (value == null || value === "") return "Not recorded";
|
|
17821
|
-
|
|
17821
|
+
type = type.replace(/\?$/, "");
|
|
17822
|
+
if (type === "date" || type === "datetime") return formatDateTime(value, { dateOnly: type === "date" }) || "Invalid date";
|
|
17822
17823
|
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
17823
17824
|
if (format && !Array.isArray(value)) {
|
|
17824
17825
|
const formatted = formatDeclaredNumber(value, format);
|
|
@@ -17882,8 +17883,8 @@ function ownershipPhrase(ownerLabel, ownerType, role) {
|
|
|
17882
17883
|
const parts = name ? [`Owned by ${name}`, type, text2(role)] : type ? [`${type.charAt(0).toUpperCase()}${type.slice(1)}-owned`, text2(role)] : [];
|
|
17883
17884
|
return parts.filter(Boolean).join(" \xB7 ") || void 0;
|
|
17884
17885
|
}
|
|
17885
|
-
function formatRecordLabel(value) {
|
|
17886
|
-
return typeof value === "string" && UUID_REFERENCE.test(value.trim()) ? "Record name unavailable" : String(value ?? "");
|
|
17886
|
+
function formatRecordLabel(value, readableIdentifier = false) {
|
|
17887
|
+
return typeof value === "string" && UUID_REFERENCE.test(value.trim()) ? readableIdentifier ? `Record \u2026${value.trim().slice(-8)}` : "Record name unavailable" : String(value ?? "");
|
|
17887
17888
|
}
|
|
17888
17889
|
|
|
17889
17890
|
// src/static-svg.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -300,6 +300,7 @@ declare function billingPaymentSummary(values: BillingPaymentValues): string;
|
|
|
300
300
|
declare function formatDateTime(value: string | number | Date | null | undefined, options?: {
|
|
301
301
|
locale?: string;
|
|
302
302
|
timeZone?: string;
|
|
303
|
+
dateOnly?: boolean;
|
|
303
304
|
}): string;
|
|
304
305
|
/** UTC datetime-local controls round-trip the same instant as deterministic displays. */
|
|
305
306
|
declare function dateTimeInputValue(value: unknown): string;
|
|
@@ -347,7 +348,7 @@ declare function formatReferenceLabel(identifier: unknown, label?: unknown, subj
|
|
|
347
348
|
*/
|
|
348
349
|
declare function ownershipPhrase(ownerLabel?: unknown, ownerType?: unknown, role?: unknown): string | undefined;
|
|
349
350
|
/** Keep authored record keys and the Transaction fallback; UUIDs belong in technical inspection. */
|
|
350
|
-
declare function formatRecordLabel(value: unknown): string;
|
|
351
|
+
declare function formatRecordLabel(value: unknown, readableIdentifier?: boolean): string;
|
|
351
352
|
|
|
352
353
|
/** Preserve generated SVG bytes while admitting only passive, local SVG markup. */
|
|
353
354
|
declare function assertStaticSvg(svg: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -300,6 +300,7 @@ declare function billingPaymentSummary(values: BillingPaymentValues): string;
|
|
|
300
300
|
declare function formatDateTime(value: string | number | Date | null | undefined, options?: {
|
|
301
301
|
locale?: string;
|
|
302
302
|
timeZone?: string;
|
|
303
|
+
dateOnly?: boolean;
|
|
303
304
|
}): string;
|
|
304
305
|
/** UTC datetime-local controls round-trip the same instant as deterministic displays. */
|
|
305
306
|
declare function dateTimeInputValue(value: unknown): string;
|
|
@@ -347,7 +348,7 @@ declare function formatReferenceLabel(identifier: unknown, label?: unknown, subj
|
|
|
347
348
|
*/
|
|
348
349
|
declare function ownershipPhrase(ownerLabel?: unknown, ownerType?: unknown, role?: unknown): string | undefined;
|
|
349
350
|
/** Keep authored record keys and the Transaction fallback; UUIDs belong in technical inspection. */
|
|
350
|
-
declare function formatRecordLabel(value: unknown): string;
|
|
351
|
+
declare function formatRecordLabel(value: unknown, readableIdentifier?: boolean): string;
|
|
351
352
|
|
|
352
353
|
/** Preserve generated SVG bytes while admitting only passive, local SVG markup. */
|
|
353
354
|
declare function assertStaticSvg(svg: string): string;
|
package/dist/index.js
CHANGED
|
@@ -17793,7 +17793,7 @@ function formatDateTime(value, options = {}) {
|
|
|
17793
17793
|
if (!Number.isFinite(date.getTime())) return "";
|
|
17794
17794
|
return new Intl.DateTimeFormat(options.locale ?? "en-US", {
|
|
17795
17795
|
dateStyle: "medium",
|
|
17796
|
-
timeStyle: "short",
|
|
17796
|
+
...options.dateOnly ? {} : { timeStyle: "short" },
|
|
17797
17797
|
timeZone: options.timeZone ?? "UTC"
|
|
17798
17798
|
}).format(date);
|
|
17799
17799
|
}
|
|
@@ -17816,7 +17816,8 @@ function formatDeclaredNumber(value, format) {
|
|
|
17816
17816
|
}
|
|
17817
17817
|
function formatReadOnlyValue(value, type, code = false, format) {
|
|
17818
17818
|
if (value == null || value === "") return "Not recorded";
|
|
17819
|
-
|
|
17819
|
+
type = type.replace(/\?$/, "");
|
|
17820
|
+
if (type === "date" || type === "datetime") return formatDateTime(value, { dateOnly: type === "date" }) || "Invalid date";
|
|
17820
17821
|
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
17821
17822
|
if (format && !Array.isArray(value)) {
|
|
17822
17823
|
const formatted = formatDeclaredNumber(value, format);
|
|
@@ -17880,8 +17881,8 @@ function ownershipPhrase(ownerLabel, ownerType, role) {
|
|
|
17880
17881
|
const parts = name ? [`Owned by ${name}`, type, text2(role)] : type ? [`${type.charAt(0).toUpperCase()}${type.slice(1)}-owned`, text2(role)] : [];
|
|
17881
17882
|
return parts.filter(Boolean).join(" \xB7 ") || void 0;
|
|
17882
17883
|
}
|
|
17883
|
-
function formatRecordLabel(value) {
|
|
17884
|
-
return typeof value === "string" && UUID_REFERENCE.test(value.trim()) ? "Record name unavailable" : String(value ?? "");
|
|
17884
|
+
function formatRecordLabel(value, readableIdentifier = false) {
|
|
17885
|
+
return typeof value === "string" && UUID_REFERENCE.test(value.trim()) ? readableIdentifier ? `Record \u2026${value.trim().slice(-8)}` : "Record name unavailable" : String(value ?? "");
|
|
17885
17886
|
}
|
|
17886
17887
|
|
|
17887
17888
|
// src/static-svg.ts
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oods/component-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Component contracts for OODS Foundry: each component's identity, props, events, states, token roles and accessibility obligations, with shared formatting helpers.",
|
|
5
5
|
"homepage": "https://oods-foundry.com/",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"
|
|
7
|
+
"url": "https://github.com/kneelinghorse/OODS-Foundry/issues"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"oods",
|
|
@@ -51,5 +51,10 @@
|
|
|
51
51
|
"packageManager": "pnpm@9.12.2",
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/kneelinghorse/OODS-Foundry.git",
|
|
58
|
+
"directory": "packages/component-contracts"
|
|
54
59
|
}
|
|
55
60
|
}
|