@dads-framework/ui 0.1.0 → 0.3.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 (155) hide show
  1. package/README.md +37 -7
  2. package/dist/copy/index.d.ts +17 -0
  3. package/dist/copy/index.d.ts.map +1 -0
  4. package/dist/copy/index.js +17 -0
  5. package/dist/copy/index.js.map +1 -0
  6. package/dist/copy/lib/catalog-parity.d.ts +55 -0
  7. package/dist/copy/lib/catalog-parity.d.ts.map +1 -0
  8. package/dist/copy/lib/catalog-parity.js +134 -0
  9. package/dist/copy/lib/catalog-parity.js.map +1 -0
  10. package/dist/copy/lib/copy-descriptor.d.ts +31 -0
  11. package/dist/copy/lib/copy-descriptor.d.ts.map +1 -0
  12. package/dist/copy/lib/copy-descriptor.js +35 -0
  13. package/dist/copy/lib/copy-descriptor.js.map +1 -0
  14. package/dist/copy/lib/create-copy-hook.d.ts +23 -0
  15. package/dist/copy/lib/create-copy-hook.d.ts.map +1 -0
  16. package/dist/copy/lib/create-copy-hook.js +17 -0
  17. package/dist/copy/lib/create-copy-hook.js.map +1 -0
  18. package/dist/copy/lib/english-chrome-case.d.ts +16 -0
  19. package/dist/copy/lib/english-chrome-case.d.ts.map +1 -0
  20. package/dist/copy/lib/english-chrome-case.js +111 -0
  21. package/dist/copy/lib/english-chrome-case.js.map +1 -0
  22. package/dist/copy/lib/formatted-values.d.ts +16 -0
  23. package/dist/copy/lib/formatted-values.d.ts.map +1 -0
  24. package/dist/copy/lib/formatted-values.js +15 -0
  25. package/dist/copy/lib/formatted-values.js.map +1 -0
  26. package/dist/copy/lib/glossary.d.ts +28 -0
  27. package/dist/copy/lib/glossary.d.ts.map +1 -0
  28. package/dist/copy/lib/glossary.js +22 -0
  29. package/dist/copy/lib/glossary.js.map +1 -0
  30. package/dist/copy/lib/locale-formatting.d.ts +62 -0
  31. package/dist/copy/lib/locale-formatting.d.ts.map +1 -0
  32. package/dist/copy/lib/locale-formatting.js +172 -0
  33. package/dist/copy/lib/locale-formatting.js.map +1 -0
  34. package/dist/copy/lib/locale-metadata.d.ts +15 -0
  35. package/dist/copy/lib/locale-metadata.d.ts.map +1 -0
  36. package/dist/copy/lib/locale-metadata.js +9 -0
  37. package/dist/copy/lib/locale-metadata.js.map +1 -0
  38. package/dist/copy/lib/locale-provider.d.ts +36 -0
  39. package/dist/copy/lib/locale-provider.d.ts.map +1 -0
  40. package/dist/copy/lib/locale-provider.js +41 -0
  41. package/dist/copy/lib/locale-provider.js.map +1 -0
  42. package/dist/copy/lib/localized-text.d.ts +41 -0
  43. package/dist/copy/lib/localized-text.d.ts.map +1 -0
  44. package/dist/copy/lib/localized-text.js +42 -0
  45. package/dist/copy/lib/localized-text.js.map +1 -0
  46. package/dist/copy/lib/logic/calendar-date-boundaries.d.ts +5 -0
  47. package/dist/copy/lib/logic/calendar-date-boundaries.d.ts.map +1 -0
  48. package/dist/copy/lib/logic/calendar-date-boundaries.js +69 -0
  49. package/dist/copy/lib/logic/calendar-date-boundaries.js.map +1 -0
  50. package/dist/copy/lib/logic/locale-provider-state.d.ts +12 -0
  51. package/dist/copy/lib/logic/locale-provider-state.d.ts.map +1 -0
  52. package/dist/copy/lib/logic/locale-provider-state.js +17 -0
  53. package/dist/copy/lib/logic/locale-provider-state.js.map +1 -0
  54. package/dist/copy/lib/merge-copy.d.ts +43 -0
  55. package/dist/copy/lib/merge-copy.d.ts.map +1 -0
  56. package/dist/copy/lib/merge-copy.js +26 -0
  57. package/dist/copy/lib/merge-copy.js.map +1 -0
  58. package/dist/copy/lib/placeholder-syntax.d.ts +12 -0
  59. package/dist/copy/lib/placeholder-syntax.d.ts.map +1 -0
  60. package/dist/copy/lib/placeholder-syntax.js +36 -0
  61. package/dist/copy/lib/placeholder-syntax.js.map +1 -0
  62. package/dist/copy/lib/product-vocabulary.d.ts +42 -0
  63. package/dist/copy/lib/product-vocabulary.d.ts.map +1 -0
  64. package/dist/copy/lib/product-vocabulary.js +126 -0
  65. package/dist/copy/lib/product-vocabulary.js.map +1 -0
  66. package/dist/copy/lib/resolve-initial-locale.d.ts +37 -0
  67. package/dist/copy/lib/resolve-initial-locale.d.ts.map +1 -0
  68. package/dist/copy/lib/resolve-initial-locale.js +55 -0
  69. package/dist/copy/lib/resolve-initial-locale.js.map +1 -0
  70. package/dist/copy/lib/translate.d.ts +18 -0
  71. package/dist/copy/lib/translate.d.ts.map +1 -0
  72. package/dist/copy/lib/translate.js +90 -0
  73. package/dist/copy/lib/translate.js.map +1 -0
  74. package/dist/copy/lib/use-locale-formatting.d.ts +18 -0
  75. package/dist/copy/lib/use-locale-formatting.d.ts.map +1 -0
  76. package/dist/copy/lib/use-locale-formatting.js +21 -0
  77. package/dist/copy/lib/use-locale-formatting.js.map +1 -0
  78. package/dist/data-table/components/data-table/data-table-date-filter.js +1 -1
  79. package/dist/data-table/components/data-table/data-table-date-filter.js.map +1 -1
  80. package/dist/data-table/components/data-table/data-table-faceted-filter.js +1 -1
  81. package/dist/data-table/components/data-table/data-table-faceted-filter.js.map +1 -1
  82. package/dist/data-table/components/data-table/data-table-filter-date-input.js +1 -1
  83. package/dist/data-table/components/data-table/data-table-filter-date-input.js.map +1 -1
  84. package/dist/data-table/components/data-table/data-table-filter-input-shared.d.ts +1 -1
  85. package/dist/data-table/components/data-table/data-table-filter-input-shared.d.ts.map +1 -1
  86. package/dist/data-table/components/data-table/data-table-filter-list-input.js +1 -1
  87. package/dist/data-table/components/data-table/data-table-filter-list-input.js.map +1 -1
  88. package/dist/data-table/components/data-table/data-table-filter-list-item.js +1 -1
  89. package/dist/data-table/components/data-table/data-table-filter-list-item.js.map +1 -1
  90. package/dist/data-table/components/data-table/data-table-filter-list.js +1 -1
  91. package/dist/data-table/components/data-table/data-table-filter-list.js.map +1 -1
  92. package/dist/data-table/components/data-table/data-table-filter-menu-item.js +1 -1
  93. package/dist/data-table/components/data-table/data-table-filter-menu-item.js.map +1 -1
  94. package/dist/data-table/components/data-table/data-table-filter-menu-value-selector.js +1 -1
  95. package/dist/data-table/components/data-table/data-table-filter-menu-value-selector.js.map +1 -1
  96. package/dist/data-table/components/data-table/data-table-pagination.js +1 -1
  97. package/dist/data-table/components/data-table/data-table-pagination.js.map +1 -1
  98. package/dist/data-table/components/data-table/data-table-slider-filter.js +1 -1
  99. package/dist/data-table/components/data-table/data-table-slider-filter.js.map +1 -1
  100. package/dist/data-table/components/data-table/data-table-sort-list.js +1 -1
  101. package/dist/data-table/components/data-table/data-table-sort-list.js.map +1 -1
  102. package/dist/data-table/components/data-table/data-table-toolbar.js +1 -1
  103. package/dist/data-table/components/data-table/data-table-toolbar.js.map +1 -1
  104. package/dist/data-table/components/data-table/filter-pill.js +1 -1
  105. package/dist/data-table/components/data-table/filter-pill.js.map +1 -1
  106. package/dist/data-table/copy/data-table-copy.d.ts +1 -1
  107. package/dist/data-table/copy/data-table-copy.d.ts.map +1 -1
  108. package/dist/data-table/copy/data-table-copy.js +1 -1
  109. package/dist/data-table/copy/data-table-copy.js.map +1 -1
  110. package/dist/data-table/lib/format.d.ts +1 -1
  111. package/dist/data-table/lib/format.d.ts.map +1 -1
  112. package/dist/display/components/ui/permission-decision-table.d.ts +17 -0
  113. package/dist/display/components/ui/permission-decision-table.d.ts.map +1 -0
  114. package/dist/display/components/ui/permission-decision-table.js +8 -0
  115. package/dist/display/components/ui/permission-decision-table.js.map +1 -0
  116. package/dist/display/index.d.ts +1 -0
  117. package/dist/display/index.d.ts.map +1 -1
  118. package/dist/display/index.js +1 -0
  119. package/dist/display/index.js.map +1 -1
  120. package/dist/elements/copy/elements-copy.d.ts +1 -1
  121. package/dist/elements/copy/elements-copy.d.ts.map +1 -1
  122. package/dist/elements/copy/elements-copy.js +1 -1
  123. package/dist/elements/copy/elements-copy.js.map +1 -1
  124. package/dist/overlays/components/attachment-viewer/attachment-viewer.js +1 -1
  125. package/dist/overlays/components/attachment-viewer/attachment-viewer.js.map +1 -1
  126. package/dist/overlays/components/attachment-viewer/image-stage.js +1 -1
  127. package/dist/overlays/components/attachment-viewer/image-stage.js.map +1 -1
  128. package/dist/overlays/components/attachment-viewer/pdf-document-view.js +1 -1
  129. package/dist/overlays/components/attachment-viewer/pdf-document-view.js.map +1 -1
  130. package/dist/overlays/copy/overlays-copy.d.ts +1 -1
  131. package/dist/overlays/copy/overlays-copy.d.ts.map +1 -1
  132. package/dist/overlays/copy/overlays-copy.js +1 -1
  133. package/dist/overlays/copy/overlays-copy.js.map +1 -1
  134. package/dist/page/components/attachment-list.js +1 -1
  135. package/dist/page/components/attachment-list.js.map +1 -1
  136. package/dist/page/components/list-view-tabs.js +1 -1
  137. package/dist/page/components/list-view-tabs.js.map +1 -1
  138. package/dist/page/copy/page-copy.d.ts +1 -1
  139. package/dist/page/copy/page-copy.d.ts.map +1 -1
  140. package/dist/page/copy/page-copy.js +1 -1
  141. package/dist/page/copy/page-copy.js.map +1 -1
  142. package/dist/shell/copy/shell-copy.d.ts +1 -1
  143. package/dist/shell/copy/shell-copy.d.ts.map +1 -1
  144. package/dist/shell/copy/shell-copy.js +1 -1
  145. package/dist/shell/copy/shell-copy.js.map +1 -1
  146. package/package.json +46 -4
  147. package/styles/base.css +63 -0
  148. package/styles/fonts.css +8 -0
  149. package/styles/index.css +14 -0
  150. package/styles/theme.css +140 -0
  151. package/styles/tokens.dark.css +95 -0
  152. package/styles/tokens.palette.css +90 -0
  153. package/styles/tokens.semantic.css +119 -0
  154. package/styles/utilities.css +12 -0
  155. package/tokens/default.tokens.json +1162 -0
package/README.md CHANGED
@@ -4,30 +4,57 @@ React controls, data tables, and application layouts with a neutral default them
4
4
 
5
5
  ## Try it
6
6
 
7
- Install `@dads-framework/ui` and `@dads-framework/styles` in your React 19 app.
8
- In the application's Tailwind CSS entry point, scan the installed UI package.
9
- Adjust the source path relative to that stylesheet.
7
+ Install the components and default theme in a React 19 TypeScript app with
8
+ Tailwind CSS 4 configured.
9
+
10
+ ```sh
11
+ npm install @dads-framework/ui @dads-framework/ui react@^19 react-dom@^19
12
+ ```
13
+
14
+ Set your Tailwind CSS entry point to the following. This example assumes the
15
+ stylesheet lives in `src/`. Resolve the source path from your stylesheet to
16
+ the location of the installed UI package.
10
17
 
11
18
  ```css
12
- @import "@dads-framework/styles/index.css";
19
+ @import "@dads-framework/ui/styles/index.css";
13
20
  @source "../node_modules/@dads-framework/ui/dist";
14
21
  ```
15
22
 
23
+ Render `<StockCounter />` on a page that loads that stylesheet.
24
+
25
+ <!-- dads:check-example -->
26
+
16
27
  ```tsx
28
+ import { useState } from "react";
17
29
  import { Button } from "@dads-framework/ui/elements";
18
30
 
19
- export function RefreshButton({ onRefresh }: { onRefresh: () => void }) {
20
- return <Button onClick={onRefresh}>Refresh</Button>;
31
+ export function StockCounter() {
32
+ const [units, setUnits] = useState(0);
33
+
34
+ return (
35
+ <>
36
+ <Button type="button" onClick={() => setUnits((count) => count + 1)}>
37
+ Add unit
38
+ </Button>
39
+ <p role="status">Units in stock: {units}</p>
40
+ </>
41
+ );
21
42
  }
22
43
  ```
23
44
 
45
+ The page shows a themed **Add unit** button and a count of zero. Press Tab
46
+ to focus the button, then Enter to increment the count.
47
+
48
+ The [starter's note forms](../../../apps/kit-workbench/apps/web/note-forms.tsx)
49
+ use the shared `Button` and disable form submission while a request is pending.
50
+
24
51
  ## Use it
25
52
 
26
53
  | Import path | Includes |
27
54
  | --------------------------------------- | --------------------------------------------------------- |
28
55
  | `@dads-framework/ui/elements` | Buttons, badges, calendar, and class name utilities |
29
56
  | `@dads-framework/ui/forms` | Inputs, fields, switches, checkbox, and combobox |
30
- | `@dads-framework/ui/display` | Alert, empty state, scroll area, and table primitives |
57
+ | `@dads-framework/ui/display` | Alerts, empty states, tables, and permission decisions |
31
58
  | `@dads-framework/ui/overlays` | Dialogs, menus, sheets, tooltips, and attachment previews |
32
59
  | `@dads-framework/ui/data-table` | Responsive data table, toolbar, filters, and sorting |
33
60
  | `@dads-framework/ui/data-table/routing` | Table search schemas and helpers for route files |
@@ -46,6 +73,9 @@ property types.
46
73
  destination as `href` and the list search values separately as `search`.
47
74
  - Pass a stable `tableId` to `useDataTable` to remember visible columns on the
48
75
  device. Without an ID, column preferences last for the current visit.
76
+ - `PermissionDecisionTable` renders permission labels and decisions supplied by
77
+ the host. Provide a stable ID for each decision and localized column and
78
+ status labels. The host obtains decisions through its authorized API.
49
79
  - `AttachmentViewer` accepts a URL or Blob from the caller's `loadSource`.
50
80
  For PDFs, serve the PDF.js WASM decoders at `/pdfjs/wasm/`. The caller owns
51
81
  the download handler.
@@ -0,0 +1,17 @@
1
+ export { SUPPORTED_LOCALES, defineCopy, isSupportedLocale, resolveLocalizedText, type CopyCatalog, type Locale, type LocalizedText, } from "./lib/localized-text.js";
2
+ export { mergeCopy, type CopySource, type MergedCopy, type MergedCopyEntry, } from "./lib/merge-copy.js";
3
+ export { defineGlossary, glossaryCatalog, type Glossary, type GlossaryEntry, } from "./lib/glossary.js";
4
+ export { copy, isCopyDescriptor, type CopyDescriptor, type CopyVars, } from "./lib/copy-descriptor.js";
5
+ export { translate, type CopyKey, type PluralBaseKey, type PluralCategory, } from "./lib/translate.js";
6
+ export { createCopyHook, type CopyTranslator } from "./lib/create-copy-hook.js";
7
+ export { LocaleProvider, useLocale, useLocaleSelection, type LocaleProviderProps, type LocaleSelection, } from "./lib/locale-provider.js";
8
+ export { DEFAULT_LOCALE, matchSupportedLocale, resolveInitialLocale, resolveLocaleFromSignals, type LocaleSignals, } from "./lib/resolve-initial-locale.js";
9
+ export { LOCALE_METADATA, textDirectionForLocale, type LocaleMetadata, type TextDirection, } from "./lib/locale-metadata.js";
10
+ export { compareHumanLabels, compareStableCodes, formatCalendarDateKey, formatCurrency, formatDateTime, formatExactDecimal, formatInteger, formatList, formatNumber, formatRelativeTime, formatTimeZoneName, humanTextIncludes, resolveReaderTimeZone, selectOrdinalCategory, type ExplicitCurrencyFormatOptions, type ExplicitDateTimeFormatOptions, type ListFormatOptions, type RelativeTimeFormatUnit, } from "./lib/locale-formatting.js";
11
+ export { startOfCalendarDate, endOfCalendarDate, } from "./lib/logic/calendar-date-boundaries.js";
12
+ export { useLocaleFormatting, type LocaleFormatting, } from "./lib/use-locale-formatting.js";
13
+ export { FormattedDateTime, FormattedExactDecimal, FormattedInteger, type FormattedDateTimeProps, } from "./lib/formatted-values.js";
14
+ export { assertCatalogParity, checkCatalogParity, placeholdersOf, type CatalogParityReport, type MalformedPlaceholder, type MissingTranslation, type PlaceholderMismatch, type PluralFallbackGap, } from "./lib/catalog-parity.js";
15
+ export { checkEnglishChromeCase, type EnglishChromeCaseViolation, } from "./lib/english-chrome-case.js";
16
+ export { checkProductVocabulary, defineProductVocabulary, type ProductVocabulary, type ProductVocabularyViolation, type RefusedWord, } from "./lib/product-vocabulary.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/copy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,aAAa,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,SAAS,EACT,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,QAAQ,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,EACT,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EACL,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,KAAK,mB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opy, isSupportedLocale, resolveLocalizedText, } from "./lib/localized-text.js";
2
+ export { mergeCopy, } from "./lib/merge-copy.js";
3
+ export { defineGlossary, glossaryCatalog, } from "./lib/glossary.js";
4
+ export { copy, isCopyDescriptor, } from "./lib/copy-descriptor.js";
5
+ export { translate, } from "./lib/translate.js";
6
+ export { createCopyHook } from "./lib/create-copy-hook.js";
7
+ export { LocaleProvider, useLocale, useLocaleSelection, } from "./lib/locale-provider.js";
8
+ export { DEFAULT_LOCALE, matchSupportedLocale, resolveInitialLocale, resolveLocaleFromSignals, } from "./lib/resolve-initial-locale.js";
9
+ export { LOCALE_METADATA, textDirectionForLocale, } from "./lib/locale-metadata.js";
10
+ export { compareHumanLabels, compareStableCodes, formatCalendarDateKey, formatCurrency, formatDateTime, formatExactDecimal, formatInteger, formatList, formatNumber, formatRelativeTime, formatTimeZoneName, humanTextIncludes, resolveReaderTimeZone, selectOrdinalCategory, } from "./lib/locale-formatting.js";
11
+ export { startOfCalendarDate, endOfCalendarDate, } from "./lib/logic/calendar-date-boundaries.js";
12
+ export { useLocaleFormatting, } from "./lib/use-locale-formatting.js";
13
+ export { FormattedDateTime, FormattedExactDecimal, FormattedInteger, } from "./lib/formatted-values.js";
14
+ export { assertCatalogParity, checkCatalogParity, placeholdersOf, } from "./lib/catalog-parity.js";
15
+ export { checkEnglishChromeCase, } from "./lib/english-chrome-case.js";
16
+ export { checkProductVocabulary, defineProductVocabulary, } from "./lib/product-vocabulary.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/copy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,oBAAoB,GAIrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,SAAS,GAIV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,eAAe,GAGhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,IAAI,EACJ,gBAAgB,GAGjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,SAAS,GAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAuB,MAAM,2BAA2B,CAAC;AAChF,OAAO,EACL,cAAc,EACd,SAAS,EACT,kBAAkB,GAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GAEzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,eAAe,EACf,sBAAsB,GAGvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,GAKtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GAMf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,GAEvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAIxB,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { MergedCopy } from "./merge-copy.js";
2
+ /**
3
+ * The worklist a second language starts from.
4
+ *
5
+ * With one locale this is trivially true, which is exactly why it lands now:
6
+ * the day `SUPPORTED_LOCALES` grows a second entry, this check names every key
7
+ * that still needs a phrase — key AND file — instead of leaving a translator to
8
+ * read a diff. The placeholder half catches the subtler failure, where a
9
+ * translated sentence quietly drops `{count}` and the number never renders.
10
+ */
11
+ /** A key that has no phrase in one of the locales this product speaks. */
12
+ export type MissingTranslation = {
13
+ readonly key: string;
14
+ readonly file: string;
15
+ readonly locale: string;
16
+ };
17
+ /** A translated phrase whose `{placeholders}` disagree with the reference. */
18
+ export type PlaceholderMismatch = {
19
+ readonly key: string;
20
+ readonly file: string;
21
+ readonly locale: string;
22
+ readonly missing: readonly string[];
23
+ readonly unexpected: readonly string[];
24
+ };
25
+ /** A phrase containing brace text that is not a valid `{placeholderName}`. */
26
+ export type MalformedPlaceholder = {
27
+ readonly key: string;
28
+ readonly file: string;
29
+ readonly locale: string;
30
+ readonly token: string;
31
+ };
32
+ /** A plural key family that cannot safely fall back for every locale. */
33
+ export type PluralFallbackGap = {
34
+ readonly key: string;
35
+ readonly file: string;
36
+ readonly missingKey: string;
37
+ };
38
+ export type CatalogParityReport = {
39
+ readonly missingTranslations: readonly MissingTranslation[];
40
+ readonly malformedPlaceholders: readonly MalformedPlaceholder[];
41
+ readonly placeholderMismatches: readonly PlaceholderMismatch[];
42
+ readonly pluralFallbackGaps: readonly PluralFallbackGap[];
43
+ };
44
+ /** The `{name}` slots a phrase interpolates, deduplicated. */
45
+ export declare function placeholdersOf(phrase: string): ReadonlySet<string>;
46
+ /**
47
+ * Every gap between the reference locale and the rest, as data.
48
+ *
49
+ * The reference is the first supported locale — the one every phrase is
50
+ * written in first — and the rest are measured against it.
51
+ */
52
+ export declare function checkCatalogParity(merged: MergedCopy, locales?: readonly string[]): CatalogParityReport;
53
+ /** Parity as a check: the failure message IS the translation worklist. */
54
+ export declare function assertCatalogParity(merged: MergedCopy, locales?: readonly string[]): void;
55
+ //# sourceMappingURL=catalog-parity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-parity.d.ts","sourceRoot":"","sources":["../../../src/copy/lib/catalog-parity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MA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CAC3D,CAAC;AAIF,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAElE;AAwID;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,SAAS,MAAM,EAAsB,GAC7C,mBAAmB,CAkBrB;AAuBD,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,SAAS,MAAM,EAAsB,GAC7C,IAAI,CAWN"}
@@ -0,0 +1,134 @@
1
+ import { SUPPORTED_LOCALES } from "./localized-text.js";
2
+ import { inspectPlaceholderSyntax } from "./placeholder-syntax.js";
3
+ const PLURAL_KEY = /^(.*)_(zero|one|two|few|many|other)$/;
4
+ /** The `{name}` slots a phrase interpolates, deduplicated. */
5
+ export function placeholdersOf(phrase) {
6
+ return inspectPlaceholderSyntax(phrase).names;
7
+ }
8
+ /**
9
+ * Read one locale off a side-by-side phrase by tag rather than by property.
10
+ *
11
+ * A blank phrase is UNWRITTEN, not written-as-nothing: this is the check that
12
+ * hands a translator their worklist, and a key holding `""` is exactly the work.
13
+ *
14
+ * The locale list is a parameter so a test can prove the multi-locale behavior
15
+ * before a second locale ships; that costs this narrowing, which is honest
16
+ * about a phrase object having been written by hand.
17
+ */
18
+ function writtenPhraseFor(text, locale) {
19
+ const phrases = text;
20
+ const phrase = phrases[locale];
21
+ return typeof phrase === "string" && phrase.trim().length > 0
22
+ ? phrase
23
+ : undefined;
24
+ }
25
+ function comparePlaceholders(reference, translation) {
26
+ const expected = placeholdersOf(reference);
27
+ const actual = placeholdersOf(translation);
28
+ return {
29
+ missing: [...expected].filter((name) => !actual.has(name)),
30
+ unexpected: [...actual].filter((name) => !expected.has(name)),
31
+ };
32
+ }
33
+ function findPluralFallbackGaps(merged) {
34
+ const families = new Map();
35
+ for (const [key, entry] of merged) {
36
+ const match = PLURAL_KEY.exec(key);
37
+ const baseKey = match?.[1];
38
+ const category = match?.[2];
39
+ if (baseKey === undefined || category === undefined)
40
+ continue;
41
+ const ownerAndKey = `${entry.file}\n${baseKey}`;
42
+ const family = families.get(ownerAndKey) ?? {
43
+ key: baseKey,
44
+ file: entry.file,
45
+ hasOther: false,
46
+ };
47
+ if (category === "other")
48
+ family.hasOther = true;
49
+ families.set(ownerAndKey, family);
50
+ }
51
+ return [...families.values()]
52
+ .filter((family) => !family.hasOther)
53
+ .map((family) => ({
54
+ key: family.key,
55
+ file: family.file,
56
+ missingKey: `${family.key}_other`,
57
+ }));
58
+ }
59
+ function recordMalformedPlaceholders(malformedPlaceholders, key, file, locale, phrase) {
60
+ const malformed = inspectPlaceholderSyntax(phrase).malformed;
61
+ malformedPlaceholders.push(...malformed.map((token) => ({ key, file, locale, token })));
62
+ return malformed.length > 0;
63
+ }
64
+ function checkCatalogEntry(key, entry, reference, translated, findings) {
65
+ const { file, text } = entry;
66
+ const referencePhrase = writtenPhraseFor(text, reference);
67
+ if (referencePhrase === undefined) {
68
+ findings.missingTranslations.push({ key, file, locale: reference });
69
+ return;
70
+ }
71
+ const malformedReference = recordMalformedPlaceholders(findings.malformedPlaceholders, key, file, reference, referencePhrase);
72
+ for (const locale of translated) {
73
+ const phrase = writtenPhraseFor(text, locale);
74
+ if (phrase === undefined) {
75
+ findings.missingTranslations.push({ key, file, locale });
76
+ continue;
77
+ }
78
+ const malformedTranslation = recordMalformedPlaceholders(findings.malformedPlaceholders, key, file, locale, phrase);
79
+ if (malformedReference || malformedTranslation)
80
+ continue;
81
+ const { missing, unexpected } = comparePlaceholders(referencePhrase, phrase);
82
+ if (missing.length > 0 || unexpected.length > 0) {
83
+ findings.placeholderMismatches.push({
84
+ key,
85
+ file,
86
+ locale,
87
+ missing,
88
+ unexpected,
89
+ });
90
+ }
91
+ }
92
+ }
93
+ /**
94
+ * Every gap between the reference locale and the rest, as data.
95
+ *
96
+ * The reference is the first supported locale — the one every phrase is
97
+ * written in first — and the rest are measured against it.
98
+ */
99
+ export function checkCatalogParity(merged, locales = SUPPORTED_LOCALES) {
100
+ const [reference, ...translated] = locales;
101
+ if (reference === undefined) {
102
+ throw new Error("catalog parity needs at least one locale to measure against");
103
+ }
104
+ const findings = {
105
+ missingTranslations: [],
106
+ malformedPlaceholders: [],
107
+ placeholderMismatches: [],
108
+ };
109
+ for (const [key, entry] of merged) {
110
+ checkCatalogEntry(key, entry, reference, translated, findings);
111
+ }
112
+ return { ...findings, pluralFallbackGaps: findPluralFallbackGaps(merged) };
113
+ }
114
+ function describeParityReport(report) {
115
+ const lines = [
116
+ ...report.missingTranslations.map((gap) => ` ${gap.key} (${gap.file}) has no ${gap.locale} phrase`),
117
+ ...report.malformedPlaceholders.map((gap) => ` ${gap.key} (${gap.file}) ${gap.locale} has malformed placeholder ${gap.token}`),
118
+ ...report.placeholderMismatches.map((gap) => ` ${gap.key} (${gap.file}) ${gap.locale} placeholders differ — missing [${gap.missing.join(", ")}], unexpected [${gap.unexpected.join(", ")}]`),
119
+ ...report.pluralFallbackGaps.map((gap) => ` ${gap.key} (${gap.file}) plural family has no ${gap.missingKey} fallback`),
120
+ ];
121
+ return lines.join("\n");
122
+ }
123
+ /** Parity as a check: the failure message IS the translation worklist. */
124
+ export function assertCatalogParity(merged, locales = SUPPORTED_LOCALES) {
125
+ const report = checkCatalogParity(merged, locales);
126
+ const gaps = report.missingTranslations.length +
127
+ report.malformedPlaceholders.length +
128
+ report.placeholderMismatches.length +
129
+ report.pluralFallbackGaps.length;
130
+ if (gaps === 0)
131
+ return;
132
+ throw new Error(`${String(gaps)} copy ${gaps === 1 ? "entry needs" : "entries need"} work:\n${describeParityReport(report)}`);
133
+ }
134
+ //# sourceMappingURL=catalog-parity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-parity.js","sourceRoot":"","sources":["../../../src/copy/lib/catalog-parity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E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C,GAAG,CACjC,CAAC,GAAG,EAAE,EAAE,CACN,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,mCAAmC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAClJ;QACD,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAC9B,CAAC,GAAG,EAAE,EAAE,CACN,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,0BAA0B,GAAG,CAAC,UAAU,WAAW,CAC/E;KACF,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CACjC,MAAkB,EAClB,OAAO,GAAsB,iBAAiB;IAE9C,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,IAAI,GACR,MAAM,CAAC,mBAAmB,CAAC,MAAM;QACjC,MAAM,CAAC,qBAAqB,CAAC,MAAM;QACnC,MAAM,CAAC,qBAAqB,CAAC,MAAM;QACnC,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC;IACnC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO;IACvB,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,WAAW,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAC7G,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * What pure logic returns instead of an English sentence.
3
+ *
4
+ * A template reading "Remove ROLE from COMPANY" is a sentence assembled in one
5
+ * particular language.
6
+ * Spanish moves the article, the adjective and the `de` contraction, so the
7
+ * template is wrong there in a way no translation of its pieces can fix. A
8
+ * descriptor names WHICH sentence and WHAT fills it, and the component that
9
+ * renders it resolves the whole thing in one piece — so `logic/` stays pure and
10
+ * its tests assert on the descriptor rather than on English, which is a
11
+ * stronger test than the one it replaces.
12
+ */
13
+ /** What fills a sentence's slots — including another sentence. */
14
+ export type CopyVars = Readonly<Record<string, string | number | CopyDescriptor>>;
15
+ export type CopyDescriptor<Key extends string = string> = {
16
+ readonly key: Key;
17
+ readonly vars?: CopyVars;
18
+ /** Present when the sentence pluralizes; selects `_one` / `_other`. */
19
+ readonly count?: number;
20
+ };
21
+ /**
22
+ * Name a sentence and what fills it.
23
+ *
24
+ * Absent arguments are left off the object rather than set to `undefined`, so a
25
+ * logic test can assert `toEqual({ key: "orders.empty" })` and read as what it
26
+ * means.
27
+ */
28
+ export declare function copy<Key extends string>(key: Key, vars?: CopyVars, count?: number): CopyDescriptor<Key>;
29
+ /** True for a descriptor, false for a bare key or an interpolated value. */
30
+ export declare function isCopyDescriptor(value: unknown): value is CopyDescriptor;
31
+ //# sourceMappingURL=copy-descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-descriptor.d.ts","sourceRoot":"","sources":["../../../src/copy/lib/copy-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,kEAAkE;AAClE,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC,CACjD,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,IAAI;IACxD,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;IAClB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,GAAG,SAAS,MAAM,EACrC,GAAG,EAAE,GAAG,EACR,IAAI,CAAC,EAAE,QAAQ,EACf,KAAK,CAAC,EAAE,MAAM,GACb,cAAc,CAAC,GAAG,CAAC,CAMrB;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAIxE"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * What pure logic returns instead of an English sentence.
3
+ *
4
+ * A template reading "Remove ROLE from COMPANY" is a sentence assembled in one
5
+ * particular language.
6
+ * Spanish moves the article, the adjective and the `de` contraction, so the
7
+ * template is wrong there in a way no translation of its pieces can fix. A
8
+ * descriptor names WHICH sentence and WHAT fills it, and the component that
9
+ * renders it resolves the whole thing in one piece — so `logic/` stays pure and
10
+ * its tests assert on the descriptor rather than on English, which is a
11
+ * stronger test than the one it replaces.
12
+ */
13
+ /**
14
+ * Name a sentence and what fills it.
15
+ *
16
+ * Absent arguments are left off the object rather than set to `undefined`, so a
17
+ * logic test can assert `toEqual({ key: "orders.empty" })` and read as what it
18
+ * means.
19
+ */
20
+ export function copy(key, vars, count) {
21
+ return {
22
+ key,
23
+ ...(vars === undefined ? {} : { vars }),
24
+ ...(count === undefined ? {} : { count }),
25
+ };
26
+ }
27
+ /** True for a descriptor, false for a bare key or an interpolated value. */
28
+ export function isCopyDescriptor(value) {
29
+ if (typeof value !== "object" || value === null)
30
+ return false;
31
+ if (!("key" in value))
32
+ return false;
33
+ return typeof value.key === "string";
34
+ }
35
+ //# sourceMappingURL=copy-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-descriptor.js","sourceRoot":"","sources":["../../../src/copy/lib/copy-descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAcH;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAClB,GAAQ,EACR,IAAe,EACf,KAAc;IAEd,OAAO;QACL,GAAG;QACH,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC;AACvC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { CopyDescriptor, CopyVars } from "./copy-descriptor.js";
2
+ import type { CopyCatalog } from "./localized-text.js";
3
+ import { type CopyKey } from "./translate.js";
4
+ /**
5
+ * A feature's own translator, closed over a feature's own words.
6
+ *
7
+ * This is where the blast-radius rule is actually enforced. The hook reads only
8
+ * the LOCALE from React context — never a catalog — so nothing every feature
9
+ * contributes to is consulted at render time, and editing an orders label
10
+ * cannot mark products affected. The app-level merge exists for the
11
+ * duplicate-key and glossary checks and has no runtime reader by design.
12
+ */
13
+ /** What a feature's `use<Feature>Copy()` hands back. */
14
+ export type CopyTranslator<Catalog extends CopyCatalog> = (keyOrDescriptor: CopyKey<Catalog> | CopyDescriptor<CopyKey<Catalog>>, vars?: CopyVars, count?: number) => string;
15
+ /**
16
+ * Build the hook a feature exports beside its catalog:
17
+ *
18
+ * ```ts
19
+ * export const useOrdersCopy = createCopyHook(ordersCopy);
20
+ * ```
21
+ */
22
+ export declare function createCopyHook<Catalog extends CopyCatalog>(catalog: Catalog): () => CopyTranslator<Catalog>;
23
+ //# sourceMappingURL=create-copy-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-copy-hook.d.ts","sourceRoot":"","sources":["../../../src/copy/lib/create-copy-hook.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAEzD;;;;;;;;GAQG;AAEH,wDAAwD;AACxD,MAAM,MAAM,cAAc,CAAC,OAAO,SAAS,WAAW,IAAI,CACxD,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EACpE,IAAI,CAAC,EAAE,QAAQ,EACf,KAAK,CAAC,EAAE,MAAM,KACX,MAAM,CAAC;AAEZ;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,WAAW,EACxD,OAAO,EAAE,OAAO,GACf,MAAM,cAAc,CAAC,OAAO,CAAC,CAS/B"}
@@ -0,0 +1,17 @@
1
+ import { useCallback } from "react";
2
+ import { useLocale } from "./locale-provider.js";
3
+ import { translate } from "./translate.js";
4
+ /**
5
+ * Build the hook a feature exports beside its catalog:
6
+ *
7
+ * ```ts
8
+ * export const useOrdersCopy = createCopyHook(ordersCopy);
9
+ * ```
10
+ */
11
+ export function createCopyHook(catalog) {
12
+ return function useCopy() {
13
+ const locale = useLocale();
14
+ return useCallback((keyOrDescriptor, vars, count) => translate(catalog, locale, keyOrDescriptor, vars, count), [locale]);
15
+ };
16
+ }
17
+ //# sourceMappingURL=create-copy-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-copy-hook.js","sourceRoot":"","sources":["../../../src/copy/lib/create-copy-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAgB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAmBzD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgB;IAEhB,OAAO,SAAS,OAAO;QACrB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,OAAO,WAAW,CAChB,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAC/B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,CAAC,EAC1D,CAAC,MAAM,CAAC,CACT,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { MergedCopy } from "./merge-copy.js";
2
+ /** One English chrome phrase that does not follow the authored Title Case rule. */
3
+ export type EnglishChromeCaseViolation = {
4
+ readonly key: string;
5
+ readonly file: string;
6
+ readonly phrase: string;
7
+ };
8
+ /**
9
+ * Find English buttons and titles that were authored in sentence case.
10
+ *
11
+ * This checks catalog source copy; it never rewrites output at runtime. Field
12
+ * labels, columns, headings, generic `.label` keys, errors, refusals, and
13
+ * explanatory prose stay outside the rule.
14
+ */
15
+ export declare function checkEnglishChromeCase(merged: MergedCopy): EnglishChromeCaseViolation[];
16
+ //# sourceMappingURL=english-chrome-case.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"english-chrome-case.d.ts","sourceRoot":"","sources":["../../../src/copy/lib/english-chrome-case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,mFAAmF;AACnF,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAqGF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,GACjB,0BAA0B,EAAE,CAU9B"}
@@ -0,0 +1,111 @@
1
+ const BUTTON_OR_TITLE = /(^|\.)(action|affordance|button)(\.|$)|(?:^|\.)title$/i;
2
+ const SENTENCE_CASE_KEY = /error|failure|refusal|refused|tooMany/i;
3
+ const PLACEHOLDER = /\{\w+\}/g;
4
+ const WORD = /[\p{L}\p{N}][\p{L}\p{N}'’/-]*/gu;
5
+ const LOWERCASE_CONNECTORS = new Set([
6
+ "a",
7
+ "an",
8
+ "and",
9
+ "as",
10
+ "at",
11
+ "but",
12
+ "by",
13
+ "for",
14
+ "from",
15
+ "in",
16
+ "into",
17
+ "nor",
18
+ "of",
19
+ "on",
20
+ "or",
21
+ "per",
22
+ "the",
23
+ "to",
24
+ "via",
25
+ "vs",
26
+ "with",
27
+ ]);
28
+ const INITIALISMS = new Set([
29
+ // A product name its makers and customers only ever write in capitals.
30
+ "AGRIS",
31
+ // Artificial intelligence: the AI assistants a user connects to the application.
32
+ "AI",
33
+ "API",
34
+ "CSV",
35
+ "ERP",
36
+ "HMI",
37
+ "HTTP",
38
+ "ID",
39
+ "IP",
40
+ // Information technology: a company's IT person or IT team.
41
+ "IT",
42
+ // Light-emitting diode: an LED status display.
43
+ "LED",
44
+ // Model Context Protocol: a protocol for exposing tools.
45
+ "MCP",
46
+ "OIDC",
47
+ // Personal identification number: the short code a person types to sign in.
48
+ "PIN",
49
+ "PLC",
50
+ // Quality assurance: the QA team and its walkthroughs.
51
+ "QA",
52
+ "SAML",
53
+ "SCIM",
54
+ "SKU",
55
+ "SSO",
56
+ "URL",
57
+ "USB",
58
+ "UTC",
59
+ ]);
60
+ function isEnglishChromeKey(key) {
61
+ if (SENTENCE_CASE_KEY.test(key))
62
+ return false;
63
+ return BUTTON_OR_TITLE.test(key);
64
+ }
65
+ function isPlaceholder(word) {
66
+ return word === "PLACEHOLDER";
67
+ }
68
+ function isUppercaseStart(word) {
69
+ const [first] = word;
70
+ const uppercaseFirst = first?.toLocaleUpperCase("en");
71
+ return uppercaseFirst !== undefined && first === uppercaseFirst;
72
+ }
73
+ function isAllUppercaseWord(word) {
74
+ const letters = word.match(/\p{L}/gu) ?? [];
75
+ const uppercase = word.toLocaleUpperCase("en");
76
+ const lowercase = word.toLocaleLowerCase("en");
77
+ return letters.length > 1 && word === uppercase && uppercase !== lowercase;
78
+ }
79
+ function followsEnglishTitleCase(phrase) {
80
+ const words = phrase.replaceAll(PLACEHOLDER, "PLACEHOLDER").match(WORD) ?? [];
81
+ return words.every((word, index) => {
82
+ if (isPlaceholder(word))
83
+ return true;
84
+ if (isAllUppercaseWord(word) && !INITIALISMS.has(word))
85
+ return false;
86
+ const isEdge = index === 0 || index === words.length - 1;
87
+ const lowercaseWord = word.toLocaleLowerCase("en");
88
+ if (!isEdge && LOWERCASE_CONNECTORS.has(lowercaseWord)) {
89
+ return word === lowercaseWord;
90
+ }
91
+ return isUppercaseStart(word);
92
+ });
93
+ }
94
+ /**
95
+ * Find English buttons and titles that were authored in sentence case.
96
+ *
97
+ * This checks catalog source copy; it never rewrites output at runtime. Field
98
+ * labels, columns, headings, generic `.label` keys, errors, refusals, and
99
+ * explanatory prose stay outside the rule.
100
+ */
101
+ export function checkEnglishChromeCase(merged) {
102
+ const violations = [];
103
+ for (const [key, entry] of merged) {
104
+ const phrase = entry.text.en;
105
+ if (!isEnglishChromeKey(key) || followsEnglishTitleCase(phrase))
106
+ continue;
107
+ violations.push({ key, file: entry.file, phrase });
108
+ }
109
+ return violations;
110
+ }
111
+ //# sourceMappingURL=english-chrome-case.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"english-chrome-case.js","sourceRoot":"","sources":["../../../src/copy/lib/english-chrome-case.ts"],"names":[],"mappings":"AASA,MAAM,eAAe,GACnB,wDAAwD,CAAC;AAC3D,MAAM,iBAAiB,GAAG,wCAAwC,CAAC;AACnE,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,GAAG;IACH,IAAI;IACJ,KAAK;IACL,IAAI;IACJ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I,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,MAAM,CAAC;YAAE,SAAS;QAC1E,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ExplicitDateTimeFormatOptions } from "./locale-formatting.js";
3
+ export type FormattedDateTimeProps = ExplicitDateTimeFormatOptions & {
4
+ readonly value: Date | number | string;
5
+ };
6
+ /** Render an instant in the reader locale and the caller's explicit zone. */
7
+ export declare function FormattedDateTime({ value, ...options }: FormattedDateTimeProps): ReactNode;
8
+ /** Render a whole presentation number in the reader locale. */
9
+ export declare function FormattedInteger({ value, }: {
10
+ readonly value: number | bigint;
11
+ }): ReactNode;
12
+ /** Render a decimal string without floating-point coercion or lost scale. */
13
+ export declare function FormattedExactDecimal({ value, }: {
14
+ readonly value: string;
15
+ }): ReactNode;
16
+ //# sourceMappingURL=formatted-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatted-values.d.ts","sourceRoot":"","sources":["../../../src/copy/lib/formatted-values.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAG5E,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CACxC,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,GAAG,OAAO,EACX,EAAE,sBAAsB,GAAG,SAAS,CAGpC;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC,GAAG,SAAS,CAEZ;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,GACN,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,GAAG,SAAS,CAEZ"}
@@ -0,0 +1,15 @@
1
+ import { useLocaleFormatting } from "./use-locale-formatting.js";
2
+ /** Render an instant in the reader locale and the caller's explicit zone. */
3
+ export function FormattedDateTime({ value, ...options }) {
4
+ const formatting = useLocaleFormatting();
5
+ return formatting.formatDateTime(value, options);
6
+ }
7
+ /** Render a whole presentation number in the reader locale. */
8
+ export function FormattedInteger({ value, }) {
9
+ return useLocaleFormatting().formatInteger(value);
10
+ }
11
+ /** Render a decimal string without floating-point coercion or lost scale. */
12
+ export function FormattedExactDecimal({ value, }) {
13
+ return useLocaleFormatting().formatExactDecimal(value);
14
+ }
15
+ //# sourceMappingURL=formatted-values.js.map