@hjmds/react 1.13.1 → 1.15.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 (127) hide show
  1. package/dist/agreement.d.ts.map +1 -1
  2. package/dist/agreement.js +5 -3
  3. package/dist/agreement.js.map +1 -1
  4. package/dist/asset.d.ts.map +1 -1
  5. package/dist/asset.js +4 -1
  6. package/dist/asset.js.map +1 -1
  7. package/dist/clipboard.d.ts.map +1 -1
  8. package/dist/clipboard.js +39 -5
  9. package/dist/clipboard.js.map +1 -1
  10. package/dist/code-block.d.ts.map +1 -1
  11. package/dist/code-block.js +3 -1
  12. package/dist/code-block.js.map +1 -1
  13. package/dist/collapsible.d.ts +4 -0
  14. package/dist/collapsible.d.ts.map +1 -1
  15. package/dist/collapsible.js +4 -4
  16. package/dist/collapsible.js.map +1 -1
  17. package/dist/command-palette.d.ts.map +1 -1
  18. package/dist/command-palette.js +3 -1
  19. package/dist/command-palette.js.map +1 -1
  20. package/dist/content-transition.d.ts +7 -3
  21. package/dist/content-transition.d.ts.map +1 -1
  22. package/dist/content-transition.js +47 -3
  23. package/dist/content-transition.js.map +1 -1
  24. package/dist/context-menu.d.ts.map +1 -1
  25. package/dist/context-menu.js +3 -1
  26. package/dist/context-menu.js.map +1 -1
  27. package/dist/date-entry.d.ts +9 -0
  28. package/dist/date-entry.d.ts.map +1 -0
  29. package/dist/date-entry.js +13 -0
  30. package/dist/date-entry.js.map +1 -0
  31. package/dist/design-profile.d.ts +18 -0
  32. package/dist/design-profile.d.ts.map +1 -0
  33. package/dist/design-profile.js +27 -0
  34. package/dist/design-profile.js.map +1 -0
  35. package/dist/document-resource.d.ts +3 -0
  36. package/dist/document-resource.d.ts.map +1 -0
  37. package/dist/document-resource.js +2 -0
  38. package/dist/document-resource.js.map +1 -0
  39. package/dist/effect-surface.d.ts.map +1 -1
  40. package/dist/effect-surface.js +2 -2
  41. package/dist/effect-surface.js.map +1 -1
  42. package/dist/evidence.d.ts +1 -1
  43. package/dist/evidence.js +1 -1
  44. package/dist/evidence.js.map +1 -1
  45. package/dist/field-group.d.ts +22 -0
  46. package/dist/field-group.d.ts.map +1 -0
  47. package/dist/field-group.js +20 -0
  48. package/dist/field-group.js.map +1 -0
  49. package/dist/floating-action-button.d.ts +1 -1
  50. package/dist/forms.d.ts +1 -0
  51. package/dist/forms.d.ts.map +1 -1
  52. package/dist/forms.js +5 -3
  53. package/dist/forms.js.map +1 -1
  54. package/dist/heading.d.ts.map +1 -1
  55. package/dist/heading.js +3 -1
  56. package/dist/heading.js.map +1 -1
  57. package/dist/image-comparison.d.ts +12 -0
  58. package/dist/image-comparison.d.ts.map +1 -0
  59. package/dist/image-comparison.js +14 -0
  60. package/dist/image-comparison.js.map +1 -0
  61. package/dist/internal/document-resource.d.ts +9 -0
  62. package/dist/internal/document-resource.d.ts.map +1 -0
  63. package/dist/internal/document-resource.js +37 -0
  64. package/dist/internal/document-resource.js.map +1 -0
  65. package/dist/internal/overlay-origin-motion.d.ts +13 -0
  66. package/dist/internal/overlay-origin-motion.d.ts.map +1 -0
  67. package/dist/internal/overlay-origin-motion.js +76 -0
  68. package/dist/internal/overlay-origin-motion.js.map +1 -0
  69. package/dist/internal.d.ts +54 -0
  70. package/dist/internal.d.ts.map +1 -1
  71. package/dist/internal.js +7 -1
  72. package/dist/internal.js.map +1 -1
  73. package/dist/layout.d.ts.map +1 -1
  74. package/dist/layout.js +6 -3
  75. package/dist/layout.js.map +1 -1
  76. package/dist/menubar.d.ts.map +1 -1
  77. package/dist/menubar.js +3 -1
  78. package/dist/menubar.js.map +1 -1
  79. package/dist/navigation.d.ts.map +1 -1
  80. package/dist/navigation.js +30 -9
  81. package/dist/navigation.js.map +1 -1
  82. package/dist/overlays.d.ts +3 -0
  83. package/dist/overlays.d.ts.map +1 -1
  84. package/dist/overlays.js +16 -12
  85. package/dist/overlays.js.map +1 -1
  86. package/dist/popover.d.ts +3 -0
  87. package/dist/popover.d.ts.map +1 -1
  88. package/dist/popover.js +11 -5
  89. package/dist/popover.js.map +1 -1
  90. package/dist/portal.d.ts +3 -1
  91. package/dist/portal.d.ts.map +1 -1
  92. package/dist/portal.js +5 -2
  93. package/dist/portal.js.map +1 -1
  94. package/dist/progressive-blur.d.ts +7 -0
  95. package/dist/progressive-blur.d.ts.map +1 -0
  96. package/dist/progressive-blur.js +20 -0
  97. package/dist/progressive-blur.js.map +1 -0
  98. package/dist/provider.d.ts +4 -0
  99. package/dist/provider.d.ts.map +1 -1
  100. package/dist/provider.js +5 -2
  101. package/dist/provider.js.map +1 -1
  102. package/dist/rating.d.ts +19 -0
  103. package/dist/rating.d.ts.map +1 -0
  104. package/dist/rating.js +34 -0
  105. package/dist/rating.js.map +1 -0
  106. package/dist/screens.d.ts +7 -2
  107. package/dist/screens.d.ts.map +1 -1
  108. package/dist/screens.js +20 -7
  109. package/dist/screens.js.map +1 -1
  110. package/dist/selection.d.ts +4 -0
  111. package/dist/selection.d.ts.map +1 -1
  112. package/dist/selection.js +48 -3
  113. package/dist/selection.js.map +1 -1
  114. package/dist/styles.css +69 -9
  115. package/dist/styles.layered.css +69 -9
  116. package/dist/task-list.d.ts +6 -1
  117. package/dist/task-list.d.ts.map +1 -1
  118. package/dist/task-list.js +8 -3
  119. package/dist/task-list.js.map +1 -1
  120. package/dist/text-annotation.d.ts +10 -0
  121. package/dist/text-annotation.d.ts.map +1 -0
  122. package/dist/text-annotation.js +107 -0
  123. package/dist/text-annotation.js.map +1 -0
  124. package/dist/theme.d.ts.map +1 -1
  125. package/dist/theme.js +28 -7
  126. package/dist/theme.js.map +1 -1
  127. package/package.json +38 -3
package/dist/task-list.js CHANGED
@@ -1,13 +1,18 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { validateTasks } from '@hjmds/design-contracts/task-list';
3
3
  import { Checkbox } from './selection.js';
4
4
  import { List } from './advanced-display.js';
5
5
  /** Canonical Checkbox/List own semantics; optional collection composition keeps drag peers out of this entry. */
6
- export function TaskList({ label, items, onCompletedChange, disabled = false, emptyContent, renderCollection, layoutStyle }) {
6
+ export function TaskList({ label, items, onCompletedChange, disabled = false, emptyContent, renderItemAction, renderCollection, layoutStyle }) {
7
7
  validateTasks(items);
8
8
  if (!label.trim())
9
9
  throw new TypeError('TaskList needs a localized label');
10
- const renderItem = (item) => { const control = _jsx(Checkbox, { label: item.label, checked: item.completed, disabled: disabled || item.disabled === true, onCheckedChange: completed => onCompletedChange(item.id, completed), ...(item.description === undefined ? {} : { description: item.description }) }); return _jsx("div", { style: { padding: "var(--hjm-space-md)" }, children: control }); };
10
+ const renderItem = (item) => {
11
+ const control = _jsx(Checkbox, { label: item.label, checked: item.completed, disabled: disabled || item.disabled === true, onCheckedChange: completed => onCompletedChange(item.id, completed), ...(item.description === undefined ? {} : { description: item.description }) });
12
+ const action = renderItemAction?.({ item, disabled: disabled || item.disabled === true });
13
+ // Independent actions must not live inside Checkbox's label. A separate line preserves long labels at large text sizes.
14
+ return _jsxs("div", { style: { padding: "var(--hjm-space-md)" }, children: [control, action == null ? null : _jsx("div", { style: { marginBlockStart: "var(--hjm-space-sm)" }, children: action })] });
15
+ };
11
16
  if (items.length === 0)
12
17
  return _jsx(List, { label: label, ...(layoutStyle === undefined ? {} : { layoutStyle }), children: emptyContent });
13
18
  if (renderCollection)
@@ -1 +1 @@
1
- {"version":3,"file":"task-list.js","sourceRoot":"","sources":["../src/task-list.tsx"],"names":[],"mappings":";AACA,OAAM,EAAC,aAAa,EAAe,MAAI,mCAAmC,CAAC;AAC3E,OAAM,EAAC,QAAQ,EAAC,MAAI,gBAAgB,CAAC;AAAA,OAAM,EAAC,IAAI,EAAC,MAAI,uBAAuB,CAAC;AAK7E,iHAAiH;AACjH,MAAM,UAAU,QAAQ,CAAC,EAAC,KAAK,EAAC,KAAK,EAAC,iBAAiB,EAAC,QAAQ,GAAC,KAAK,EAAC,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GAAG,CAAC,IAAI,CAAA,EAAE,CAAA,wBAAoB,UAAU,CAAC,IAAI,CAAC,IAA1B,IAAI,CAAC,EAAE,CAA0B,CAAC,GAAQ,CAAC;AACvK,CAAC","sourcesContent":["import type{ReactNode}from'react';\nimport{validateTasks,type TaskItem}from'@hjmds/design-contracts/task-list';\nimport{Checkbox}from'./selection.js';import{List}from'./advanced-display.js';\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type TaskListProps=Readonly<{label:string;items:readonly TaskItem[];onCompletedChange:(id:string,completed:boolean)=>void;disabled?:boolean;emptyContent?:ReactNode;renderCollection?:(context:Readonly<{items:readonly TaskItem[];renderItem:(item:TaskItem)=>ReactNode}>)=>ReactNode;\n /** Canonical layout-only placement on the List root. With `renderCollection` the product owns the root, so place that instead. */\n layoutStyle?:HjmCompositionStyleProp}>;\n/** Canonical Checkbox/List own semantics; optional collection composition keeps drag peers out of this entry. */\nexport function TaskList({label,items,onCompletedChange,disabled=false,emptyContent,renderCollection,layoutStyle}:TaskListProps){validateTasks(items);if(!label.trim())throw new TypeError('TaskList needs a localized label');\n const renderItem=(item:TaskItem)=>{const control=<Checkbox label={item.label} checked={item.completed} disabled={disabled||item.disabled===true} onCheckedChange={completed=>onCompletedChange(item.id,completed)} {...(item.description===undefined?{}:{description:item.description})}/>;return <div style={{padding:\"var(--hjm-space-md)\"}}>{control}</div>;};\n if(items.length===0)return <List label={label} {...(layoutStyle===undefined?{}:{layoutStyle})}>{emptyContent}</List>;\n if(renderCollection)return <>{renderCollection({items,renderItem})}</>;\n return <List label={label} appearance=\"grouped\" {...(layoutStyle===undefined?{}:{layoutStyle})}>{items.map(item=><div key={item.id}>{renderItem(item)}</div>)}</List>;\n}\n"]}
1
+ {"version":3,"file":"task-list.js","sourceRoot":"","sources":["../src/task-list.tsx"],"names":[],"mappings":";AACA,OAAM,EAAC,aAAa,EAAe,MAAI,mCAAmC,CAAC;AAC3E,OAAM,EAAC,QAAQ,EAAC,MAAI,gBAA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K,CAAC,MAAM,KAAG,CAAC;QAAC,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,KAAM,CAAC,WAAW,KAAG,SAAS,CAAA,CAAC,CAAA,EAAE,CAAA,CAAC,CAAA,EAAC,WAAW,EAAC,CAAC,YAAG,YAAY,GAAQ,CAAC;IACrH,IAAG,gBAAgB;QAAC,OAAO,4BAAG,gBAAgB,CAAC,EAAC,KAAK,EAAC,UAAU,EAAC,CAAC,GAAI,CAAC;IACvE,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAC,SAAS,KAAK,CAAC,WAAW,KAAG,SAAS,CAAA,CAAC,CAAA,EAAE,CAAA,CAAC,CAAA,EAAC,WAAW,EAAC,CAAC,YAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAA,wBAAoB,UAAU,CAAC,IAAI,CAAC,IAA1B,IAAI,CAAC,EAAE,CAA0B,CAAC,GAAQ,CAAC;AACvK,CAAC","sourcesContent":["import type{ReactNode}from'react';\nimport{validateTasks,type TaskItem}from'@hjmds/design-contracts/task-list';\nimport{Checkbox}from'./selection.js';import{List}from'./advanced-display.js';\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type TaskListProps=Readonly<{label:string;items:readonly TaskItem[];onCompletedChange:(id:string,completed:boolean)=>void;disabled?:boolean;emptyContent?:ReactNode;\n /** Independent row action below the checkbox; apply disabled to the supplied control. */\n renderItemAction?:(context:Readonly<{item:TaskItem;disabled:boolean}>)=>ReactNode;\n renderCollection?:(context:Readonly<{items:readonly TaskItem[];renderItem:(item:TaskItem)=>ReactNode}>)=>ReactNode;\n /** Canonical layout-only placement on the List root. With `renderCollection` the product owns the root, so place that instead. */\n layoutStyle?:HjmCompositionStyleProp}>;\n/** Canonical Checkbox/List own semantics; optional collection composition keeps drag peers out of this entry. */\nexport function TaskList({label,items,onCompletedChange,disabled=false,emptyContent,renderItemAction,renderCollection,layoutStyle}:TaskListProps){validateTasks(items);if(!label.trim())throw new TypeError('TaskList needs a localized label');\n const renderItem=(item:TaskItem)=>{const control=<Checkbox label={item.label} checked={item.completed} disabled={disabled||item.disabled===true} onCheckedChange={completed=>onCompletedChange(item.id,completed)} {...(item.description===undefined?{}:{description:item.description})}/>;const action=renderItemAction?.({item,disabled:disabled||item.disabled===true});\n // Independent actions must not live inside Checkbox's label. A separate line preserves long labels at large text sizes.\n return <div style={{padding:\"var(--hjm-space-md)\"}}>{control}{action==null?null:<div style={{marginBlockStart:\"var(--hjm-space-sm)\"}}>{action}</div>}</div>;};\n if(items.length===0)return <List label={label} {...(layoutStyle===undefined?{}:{layoutStyle})}>{emptyContent}</List>;\n if(renderCollection)return <>{renderCollection({items,renderItem})}</>;\n return <List label={label} appearance=\"grouped\" {...(layoutStyle===undefined?{}:{layoutStyle})}>{items.map(item=><div key={item.id}>{renderItem(item)}</div>)}</List>;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { type TextAnnotationAction } from '@hjmds/design-contracts/text-annotation';
2
+ /** Internal renderer while Native range measurement and the public API are
3
+ * being developed. Kept out of package exports until both paths are reviewable.
4
+ */
5
+ export type TextAnnotationProps = Readonly<{
6
+ children: string;
7
+ action?: TextAnnotationAction;
8
+ }>;
9
+ export declare function TextAnnotation({ children, action }: TextAnnotationProps): import("react").JSX.Element;
10
+ //# sourceMappingURL=text-annotation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-annotation.d.ts","sourceRoot":"","sources":["../src/text-annotation.tsx"],"names":[],"mappings":"AACA,OAAO,EAA+D,KAAK,oBAAoB,EAA2B,MAAM,yCAAyC,CAAC;AAI1K;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,CAAC,CAAC;AAEH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAoB,EAAE,EAAE,mBAAmB,+BAmGrF"}
@@ -0,0 +1,107 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { motion } from '@hjmds/design-contracts/foundations';
3
+ import { mergeTextAnnotationFragments, resolveTextAnnotationGeometry } from '@hjmds/design-contracts/text-annotation';
4
+ import { useLayoutEffect, useRef, useState } from 'react';
5
+ import { useHjmTheme } from './provider.js';
6
+ export function TextAnnotation({ children, action = 'highlight' }) {
7
+ const { environment } = useHjmTheme();
8
+ const textRef = useRef(null);
9
+ const anchorRef = useRef(null);
10
+ const svgRef = useRef(null);
11
+ const played = useRef(null);
12
+ const measured = useRef('');
13
+ const [measurement, setMeasurement] = useState({ content: children, lines: [] });
14
+ // A new string must not briefly receive paths measured for the old string.
15
+ const lines = measurement.content === children ? measurement.lines : [];
16
+ const geometry = resolveTextAnnotationGeometry(lines, action);
17
+ const key = `${action}:${children}`;
18
+ useLayoutEffect(() => {
19
+ const text = textRef.current, anchor = anchorRef.current;
20
+ if (!text || !anchor)
21
+ return;
22
+ let frame = 0, alive = true;
23
+ const measure = () => {
24
+ frame = 0;
25
+ if (!alive)
26
+ return;
27
+ const origin = anchor.getBoundingClientRect();
28
+ const range = document.createRange();
29
+ range.selectNodeContents(text);
30
+ // Range rectangles are actual shaped fragments, including mixed-direction
31
+ // runs. An inline-block or character-width estimate changes line wrapping.
32
+ const fragments = Array.from(range.getClientRects()).filter(rect => rect.width > 0 && rect.height > 0);
33
+ const bands = [];
34
+ const next = mergeTextAnnotationFragments(fragments.map(rect => {
35
+ // Chromium splits a mixed Arabic/English line into adjacent bidi runs.
36
+ // Separate outlines create interior seams (QA highlighter §11). Merge
37
+ // only measured matching vertical bands; guessing by character order or
38
+ // overlap alone could merge distinct lines with a tight line-height.
39
+ let lineIndex = bands.findIndex(band => Math.abs(band.top - rect.top) < 0.01 && Math.abs(band.height - rect.height) < 0.01);
40
+ if (lineIndex < 0) {
41
+ lineIndex = bands.length;
42
+ bands.push({ top: rect.top, height: rect.height });
43
+ }
44
+ return { x: rect.left - origin.left, y: rect.top - origin.top, width: rect.width, height: rect.height, lineIndex };
45
+ }));
46
+ const signature = JSON.stringify([children, next]);
47
+ if (measured.current !== signature) {
48
+ measured.current = signature;
49
+ setMeasurement({ content: children, lines: next });
50
+ }
51
+ };
52
+ const schedule = () => { if (!frame)
53
+ frame = requestAnimationFrame(measure); };
54
+ measure();
55
+ const observer = new ResizeObserver(schedule);
56
+ const mutation = new MutationObserver(records => {
57
+ if (records.some(record => !anchor.contains(record.target)))
58
+ schedule();
59
+ });
60
+ // Inline fragments themselves may not emit ResizeObserver notifications.
61
+ // Observe ancestors too: a preceding sibling can move the first fragment
62
+ // without changing its text or font.
63
+ for (let element = text; element; element = element.parentElement) {
64
+ observer.observe(element);
65
+ mutation.observe(element, { attributes: true, attributeFilter: ['style', 'class', 'dir'] });
66
+ }
67
+ const paragraph = text.closest('p, h1, h2, h3, h4, h5, h6, li') ?? text.parentElement?.parentElement;
68
+ // Ignore our SVG's mutations; measuring it would create an observer loop.
69
+ if (paragraph)
70
+ mutation.observe(paragraph, { childList: true, characterData: true, subtree: true, attributes: true, attributeFilter: ['style', 'class', 'dir'] });
71
+ document.fonts.addEventListener('loadingdone', schedule);
72
+ void document.fonts.ready.then(() => { if (alive)
73
+ schedule(); });
74
+ window.addEventListener('resize', schedule);
75
+ return () => { alive = false; cancelAnimationFrame(frame); observer.disconnect(); mutation.disconnect(); document.fonts.removeEventListener('loadingdone', schedule); window.removeEventListener('resize', schedule); };
76
+ }, [children, environment.textScale, environment.direction]);
77
+ useLayoutEffect(() => {
78
+ const svg = svgRef.current;
79
+ if (!svg || !geometry.paths.length || played.current === key)
80
+ return;
81
+ played.current = key;
82
+ // Geometry updates are not new content. Do not replay entry motion on every
83
+ // ResizeObserver delivery, unlike the upstream hide/show-on-body-resize path.
84
+ if (environment.reducedMotion || document.hidden)
85
+ return;
86
+ const animations = [];
87
+ for (const path of svg.querySelectorAll('path')) {
88
+ if (action === 'highlight') {
89
+ const start = environment.direction === 'rtl' ? 'inset(0 0 0 100%)' : 'inset(0 100% 0 0)';
90
+ animations.push(path.animate([{ clipPath: start }, { clipPath: 'inset(0 0 0 0)' }], { duration: motion.slow, easing: 'ease-out' }));
91
+ }
92
+ else {
93
+ const length = path.getTotalLength();
94
+ animations.push(path.animate([{ strokeDasharray: `${length}`, strokeDashoffset: length }, { strokeDasharray: `${length}`, strokeDashoffset: 0 }], { duration: motion.slow, easing: 'ease-out' }));
95
+ }
96
+ }
97
+ const stop = () => { for (const animation of animations)
98
+ animation.cancel(); };
99
+ const visibility = () => { if (document.hidden)
100
+ stop(); };
101
+ document.addEventListener('visibilitychange', visibility);
102
+ return () => { stop(); document.removeEventListener('visibilitychange', visibility); };
103
+ }, [key, lines, action, environment.reducedMotion, environment.direction, geometry.paths.length]);
104
+ const bounds = geometry.bounds;
105
+ return _jsxs("span", { "data-hjm-text-annotation": action, style: { display: 'inline', position: 'relative', isolation: 'isolate' }, children: [_jsx("span", { ref: anchorRef, "aria-hidden": "true", style: { position: 'absolute', left: 0, top: 0, width: 0, height: 0, pointerEvents: 'none' }, children: bounds ? _jsx("svg", { ref: svgRef, "aria-hidden": "true", focusable: "false", width: bounds.width, height: bounds.height, viewBox: `${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`, style: { position: 'absolute', left: bounds.x, top: bounds.y, overflow: 'visible', pointerEvents: 'none' }, children: geometry.paths.map((path, index) => _jsx("path", { d: path.d, "data-line": path.lineIndex, fill: path.paint === 'fill' ? 'var(--hjm-color-primary)' : 'none', fillOpacity: path.paint === 'fill' ? 0.2 : 1, stroke: path.paint === 'stroke' ? 'var(--hjm-color-content-brand)' : 'none', strokeWidth: path.strokeWidth, strokeLinecap: "round", strokeLinejoin: "round" }, index)) }) : null }), _jsx("span", { ref: textRef, "data-hjm-annotation-text": "", style: { position: 'relative' }, children: children })] });
106
+ }
107
+ //# sourceMappingURL=text-annotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-annotation.js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,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,YAIzR,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,eAAkB,CAAC,EAAE,IAAI,CAAC,CAAC,eAAa,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,IAAtT,KAAK,CAAoT,CAAC,GACtW,CAAC,CAAC,CAAC,IAAI,GACR,EACP,eAAM,GAAG,EAAE,OAAO,8BAA2B,EAAE,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAG,QAAQ,GAAQ,IAC7F,CAAC;AACV,CAAC","sourcesContent":["import { motion } from '@hjmds/design-contracts/foundations';\nimport { mergeTextAnnotationFragments, resolveTextAnnotationGeometry, type TextAnnotationAction, type TextAnnotationRect } from '@hjmds/design-contracts/text-annotation';\nimport { useLayoutEffect, useRef, useState } from 'react';\nimport { useHjmTheme } from './provider.js';\n\n/** Internal renderer while Native range measurement and the public API are\n * being developed. Kept out of package exports until both paths are reviewable.\n */\nexport type TextAnnotationProps = Readonly<{\n children: string;\n action?: TextAnnotationAction;\n}>;\n\nexport function TextAnnotation({ children, action = 'highlight' }: TextAnnotationProps) {\n const { environment } = useHjmTheme();\n const textRef = useRef<HTMLSpanElement>(null);\n const anchorRef = useRef<HTMLSpanElement>(null);\n const svgRef = useRef<SVGSVGElement>(null);\n const played = useRef<string | null>(null);\n const measured = useRef('');\n const [measurement, setMeasurement] = useState<{ content: string; lines: readonly TextAnnotationRect[] }>({ content: children, lines: [] });\n // A new string must not briefly receive paths measured for the old string.\n const lines = measurement.content === children ? measurement.lines : [];\n const geometry = resolveTextAnnotationGeometry(lines, action);\n const key = `${action}:${children}`;\n\n useLayoutEffect(() => {\n const text = textRef.current, anchor = anchorRef.current;\n if (!text || !anchor) return;\n let frame = 0, alive = true;\n const measure = () => {\n frame = 0;\n if (!alive) return;\n const origin = anchor.getBoundingClientRect();\n const range = document.createRange();\n range.selectNodeContents(text);\n // Range rectangles are actual shaped fragments, including mixed-direction\n // runs. An inline-block or character-width estimate changes line wrapping.\n const fragments = Array.from(range.getClientRects()).filter(rect => rect.width > 0 && rect.height > 0);\n const bands: { top: number; height: number }[] = [];\n const next = mergeTextAnnotationFragments(fragments.map(rect => {\n // Chromium splits a mixed Arabic/English line into adjacent bidi runs.\n // Separate outlines create interior seams (QA highlighter §11). Merge\n // only measured matching vertical bands; guessing by character order or\n // overlap alone could merge distinct lines with a tight line-height.\n let lineIndex = bands.findIndex(band => Math.abs(band.top - rect.top) < 0.01 && Math.abs(band.height - rect.height) < 0.01);\n if (lineIndex < 0) { lineIndex = bands.length; bands.push({ top: rect.top, height: rect.height }); }\n return { x: rect.left - origin.left, y: rect.top - origin.top, width: rect.width, height: rect.height, lineIndex };\n }));\n const signature = JSON.stringify([children, next]);\n if (measured.current !== signature) {\n measured.current = signature;\n setMeasurement({ content: children, lines: next });\n }\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(measure); };\n measure();\n const observer = new ResizeObserver(schedule);\n const mutation = new MutationObserver(records => {\n if (records.some(record => !anchor.contains(record.target))) schedule();\n });\n // Inline fragments themselves may not emit ResizeObserver notifications.\n // Observe ancestors too: a preceding sibling can move the first fragment\n // without changing its text or font.\n for (let element: Element | null = text; element; element = element.parentElement) {\n observer.observe(element);\n mutation.observe(element, { attributes: true, attributeFilter: ['style', 'class', 'dir'] });\n }\n const paragraph = text.closest('p, h1, h2, h3, h4, h5, h6, li') ?? text.parentElement?.parentElement;\n // Ignore our SVG's mutations; measuring it would create an observer loop.\n if (paragraph) mutation.observe(paragraph, { childList: true, characterData: true, subtree: true, attributes: true, attributeFilter: ['style', 'class', 'dir'] });\n document.fonts.addEventListener('loadingdone', schedule);\n void document.fonts.ready.then(() => { if (alive) schedule(); });\n window.addEventListener('resize', schedule);\n return () => { alive = false; cancelAnimationFrame(frame); observer.disconnect(); mutation.disconnect(); document.fonts.removeEventListener('loadingdone', schedule); window.removeEventListener('resize', schedule); };\n }, [children, environment.textScale, environment.direction]);\n\n useLayoutEffect(() => {\n const svg = svgRef.current;\n if (!svg || !geometry.paths.length || played.current === key) return;\n played.current = key;\n // Geometry updates are not new content. Do not replay entry motion on every\n // ResizeObserver delivery, unlike the upstream hide/show-on-body-resize path.\n if (environment.reducedMotion || document.hidden) return;\n const animations: Animation[] = [];\n for (const path of svg.querySelectorAll('path')) {\n if (action === 'highlight') {\n const start = environment.direction === 'rtl' ? 'inset(0 0 0 100%)' : 'inset(0 100% 0 0)';\n animations.push(path.animate([{ clipPath: start }, { clipPath: 'inset(0 0 0 0)' }], { duration: motion.slow, easing: 'ease-out' }));\n } else {\n const length = path.getTotalLength();\n animations.push(path.animate([{ strokeDasharray: `${length}`, strokeDashoffset: length }, { strokeDasharray: `${length}`, strokeDashoffset: 0 }], { duration: motion.slow, easing: 'ease-out' }));\n }\n }\n const stop = () => { for (const animation of animations) animation.cancel(); };\n const visibility = () => { if (document.hidden) stop(); };\n document.addEventListener('visibilitychange', visibility);\n return () => { stop(); document.removeEventListener('visibilitychange', visibility); };\n }, [key, lines, action, environment.reducedMotion, environment.direction, geometry.paths.length]);\n\n const bounds = geometry.bounds;\n return <span data-hjm-text-annotation={action} style={{ display: 'inline', position: 'relative', isolation: 'isolate' }}>\n <span ref={anchorRef} aria-hidden=\"true\" style={{ position: 'absolute', left: 0, top: 0, width: 0, height: 0, pointerEvents: 'none' }}>\n {bounds ? <svg ref={svgRef} aria-hidden=\"true\" focusable=\"false\" width={bounds.width} height={bounds.height} viewBox={`${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`} style={{ position: 'absolute', left: bounds.x, top: bounds.y, overflow: 'visible', pointerEvents: 'none' }}>\n {/* Marker ink stays behind unchanged foreground text. The experimental\n 20% wash avoids replacing its semantic foreground with a brand color;\n product-palette contrast still needs validation before promotion. */}\n {geometry.paths.map((path, index) => <path key={index} d={path.d} data-line={path.lineIndex} fill={path.paint === 'fill' ? 'var(--hjm-color-primary)' : 'none'} fillOpacity={path.paint === 'fill' ? 0.2 : 1} stroke={path.paint === 'stroke' ? 'var(--hjm-color-content-brand)' : 'none'} strokeWidth={path.strokeWidth} strokeLinecap=\"round\" strokeLinejoin=\"round\" />)}\n </svg> : null}\n </span>\n <span ref={textRef} data-hjm-annotation-text=\"\" style={{ position: 'relative' }}>{children}</span>\n </span>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,2DAA2D,CAAC;AAgBnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,aAAa,GACvC,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAmB7C,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,GAC/B,aAAa,CAuJf"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,2DAA2D,CAAC;AAgBnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,aAAa,GACvC,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAmB7C,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,GAC/B,aAAa,CA2Kf"}
package/dist/theme.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { resolveSurfaceFillOpacity } from "@hjmds/design-contracts/palette-contrast";
1
2
  import { backdrop, control, easing, fontFamily, fontWeight, motion, layer, radius, shadow, spacing, stroke, typography, } from "@hjmds/design-contracts/foundations";
2
3
  import { resolveColorReference } from "@hjmds/design-contracts/color-references";
3
4
  import { focusIndicatorContract } from "@hjmds/design-contracts/contracts";
@@ -8,16 +9,17 @@ function kebab(value) {
8
9
  return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
9
10
  }
10
11
  // RN shadow token -> CSS; blur = radius, as react-native-web maps it.
11
- function shadowCss(token) {
12
+ function shadowCss(token, offsetX = 0) {
12
13
  const hex = token.color.replace("#", "");
13
14
  const [r, g, b] = [0, 2, 4].map((start) => Number.parseInt(hex.slice(start, start + 2), 16));
14
- return `0 ${token.offsetY}px ${token.radius}px rgb(${r} ${g} ${b} / ${Math.round(token.opacity * 100)}%)`;
15
+ return `${offsetX}px ${token.offsetY}px ${token.radius}px rgb(${r} ${g} ${b} / ${Math.round(token.opacity * 100)}%)`;
15
16
  }
16
17
  function rem(value) {
17
18
  return `${Number((value / 16).toFixed(5))}rem`;
18
19
  }
19
20
  export function createHjmThemeStyle(value) {
20
21
  const { environment, palette } = value;
22
+ const profileTokens = value.designProfile?.tokens;
21
23
  const style = {
22
24
  "--hjm-backdrop-modal": `color-mix(in srgb, ${backdrop.modal.color} ${backdrop.modal.opacity * 100}%, transparent)`,
23
25
  "--hjm-text-scale": environment.textScale,
@@ -38,10 +40,10 @@ export function createHjmThemeStyle(value) {
38
40
  for (const [name, value] of Object.entries(spacing)) {
39
41
  style[`--hjm-space-${kebab(name)}`] = `${value}px`;
40
42
  }
41
- for (const [name, value] of Object.entries(radius)) {
43
+ for (const [name, value] of Object.entries(profileTokens?.radius ?? radius)) {
42
44
  style[`--hjm-radius-${kebab(name)}`] = `${value}px`;
43
45
  }
44
- for (const [name, value] of Object.entries(typography)) {
46
+ for (const [name, value] of Object.entries(profileTokens?.typography ?? typography)) {
45
47
  style[`--hjm-type-${kebab(name)}-size`] =
46
48
  `calc(${rem(value.fontSize)} * var(--hjm-text-scale))`;
47
49
  style[`--hjm-type-${kebab(name)}-line-height`] =
@@ -56,7 +58,8 @@ export function createHjmThemeStyle(value) {
56
58
  ? "0ms"
57
59
  : `${value}ms`;
58
60
  }
59
- style["--hjm-font-family-ui"] = fontFamily.ui.join(", ");
61
+ style["--hjm-font-family-ui"] = (profileTokens?.fontFamily.ui ?? fontFamily.ui).join(", ");
62
+ style["--hjm-font-family-code"] = (profileTokens?.fontFamily.code ?? fontFamily.code).join(", ");
60
63
  for (const [name, value] of Object.entries(stroke)) {
61
64
  style[`--hjm-stroke-${kebab(name)}`] = `${value}px`;
62
65
  }
@@ -96,16 +99,34 @@ export function createHjmThemeStyle(value) {
96
99
  for (const [name, value] of Object.entries(layer)) {
97
100
  style[`--hjm-layer-${kebab(name)}`] = value;
98
101
  }
99
- for (const [name, token] of Object.entries(shadow)) {
102
+ for (const [name, token] of Object.entries(profileTokens?.shadow ?? shadow)) {
100
103
  style[`--hjm-shadow-${kebab(name)}`] = shadowCss(token);
101
104
  }
105
+ const surfaceMaterial = value.designProfile?.material.surface;
106
+ // Defaults are emitted on every Provider, so a nested neutral profile clears
107
+ // inherited glass/clay. Unsupported transparency remains an opaque CSS fill.
108
+ style["--hjm-surface-blur"] = surfaceMaterial?.blurStrength ? `blur(${surfaceMaterial.blurStrength * 32}px)` : "none";
109
+ style["--hjm-surface-fill-opacity"] = surfaceMaterial?.blurStrength ? resolveSurfaceFillOpacity(surfaceMaterial.fillOpacity, palette.theme) : 1;
110
+ const insetShadow = surfaceMaterial?.insetShadows.length
111
+ ? surfaceMaterial.insetShadows.map(token => `inset ${shadowCss(token, token.offsetX)}`).join(", ")
112
+ : "";
113
+ style["--hjm-surface-inset-shadow"] = insetShadow || "none";
114
+ style["--hjm-surface-raised-shadow"] = shadowCss(profileTokens?.shadow.floating ?? shadow.floating) + (insetShadow ? `, ${insetShadow}` : "");
115
+ // BottomCTA overlaps content above it (bottomCtaRecipe rationale). Profile
116
+ // strength is shared, but its shadow must cast upward rather than behind the
117
+ // footer; preserve the stylesheet-only legacy path when no profile is supplied.
118
+ style["--hjm-bottom-cta-shadow"] = profileTokens
119
+ ? shadowCss({ ...profileTokens.shadow.floating, offsetY: -Math.abs(profileTokens.shadow.floating.offsetY) })
120
+ : "none";
102
121
  // Overlay chrome and sizes come from the recipes Native reads (1.5.0).
103
122
  for (const [name, chrome] of [["dialog", dialogRecipe.content], ["sheet", sheetRecipe.content], ["toast", toastRecipe.surface]]) {
104
123
  style[`--hjm-${name}-background`] = resolveColorReference(chrome.background, palette);
105
124
  style[`--hjm-${name}-border`] = resolveColorReference(chrome.border, palette);
106
125
  style[`--hjm-${name}-border-width`] = `${chrome.borderWidth}px`;
107
126
  style[`--hjm-${name}-radius`] = `var(--hjm-radius-${chrome.radius})`;
108
- style[`--hjm-${name}-shadow`] = shadowCss(chrome.shadow);
127
+ // Recipes select the floating role. Resolve its value from the profile so
128
+ // dialogs, sheets and toasts cannot retain neutral shadows after a theme switch.
129
+ style[`--hjm-${name}-shadow`] = shadowCss(profileTokens?.shadow.floating ?? chrome.shadow);
109
130
  }
110
131
  style["--hjm-sheet-max-height"] = `${sheetRecipe.content.maxHeightRatio * 100}dvh`;
111
132
  style["--hjm-sheet-max-width"] = `${sheetRecipe.web.maxWidth}px`;
package/dist/theme.js.map CHANGED
@@ -1 +1 @@
1
- {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,8BAA8B,CAAC,GAAG,WAAW,CAAC,eAAe,CAAC;IACpE,KAAK,CAAC,gCAAgC,CAAC,GAAG,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC;IACxE,KAAK,CAAC,4BAA4B,CAAC,GAAG,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC;IACjE,KAAK,CAAC,kCAAkC,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAChF,KAAK,CAAC,2BAA2B,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACtE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjE,2EAA2E;QAC3E,yEAAyE;QACzE,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,GAAG,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import {\n backdrop,\n control,\n easing,\n fontFamily,\n fontWeight,\n motion,\n layer,\n radius,\n shadow,\n spacing,\n stroke,\n typography,\n} from \"@hjmds/design-contracts/foundations\";\nimport { resolveColorReference } from \"@hjmds/design-contracts/color-references\";\nimport { focusIndicatorContract } from \"@hjmds/design-contracts/contracts\";\nimport {\n visibleControlHeight,\n type DesignSystemProviderValue,\n} from \"@hjmds/design-contracts/components/design-system-provider\";\nimport { buttonRecipe, fieldRecipe } from \"@hjmds/design-contracts/recipes/base\";\nimport {\n bottomNavigationRecipe,\n comboboxRecipe,\n dialogRecipe,\n listRowRecipe,\n menuRecipe,\n searchFieldRecipe,\n selectRecipe,\n sheetRecipe,\n skeletonRecipe,\n tooltipRecipe,\n switchRecipe,\n toastRecipe,\n} from \"@hjmds/design-contracts/recipes\";\nimport type { CSSProperties } from \"react\";\n\nexport type HjmThemeStyle = CSSProperties &\n Record<`--hjm-${string}`, string | number>;\n\nfunction kebab(value: string): string {\n return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\ntype ShadowToken = Readonly<{ color: string; opacity: number; radius: number; offsetY: number }>;\n\n// RN shadow token -> CSS; blur = radius, as react-native-web maps it.\nfunction shadowCss(token: ShadowToken): string {\n const hex = token.color.replace(\"#\", \"\");\n const [r, g, b] = [0, 2, 4].map((start) => Number.parseInt(hex.slice(start, start + 2), 16));\n return `0 ${token.offsetY}px ${token.radius}px rgb(${r} ${g} ${b} / ${Math.round(token.opacity * 100)}%)`;\n}\n\nfunction rem(value: number): string {\n return `${Number((value / 16).toFixed(5))}rem`;\n}\n\nexport function createHjmThemeStyle(\n value: DesignSystemProviderValue,\n): HjmThemeStyle {\n const { environment, palette } = value;\n const style: HjmThemeStyle = {\n \"--hjm-backdrop-modal\": `color-mix(in srgb, ${backdrop.modal.color} ${backdrop.modal.opacity * 100}%, transparent)`,\n \"--hjm-text-scale\": environment.textScale,\n \"--hjm-motion-scale\": environment.reducedMotion ? 0 : 1,\n colorScheme: environment.theme,\n backgroundColor: palette.theme.bg,\n color: palette.theme.text,\n };\n\n for (const [name, color] of Object.entries(palette.theme)) {\n style[`--hjm-color-${kebab(name)}`] = color;\n }\n for (const [name, color] of Object.entries(palette.statusAccents)) {\n style[`--hjm-accent-${kebab(name)}`] = color;\n }\n for (const [name, color] of Object.entries(palette.statusAccentFills)) {\n style[`--hjm-accent-fill-${kebab(name)}`] = color;\n }\n for (const [name, value] of Object.entries(spacing)) {\n style[`--hjm-space-${kebab(name)}`] = `${value}px`;\n }\n for (const [name, value] of Object.entries(radius)) {\n style[`--hjm-radius-${kebab(name)}`] = `${value}px`;\n }\n for (const [name, value] of Object.entries(typography)) {\n style[`--hjm-type-${kebab(name)}-size`] =\n `calc(${rem(value.fontSize)} * var(--hjm-text-scale))`;\n style[`--hjm-type-${kebab(name)}-line-height`] =\n `calc(${rem(value.lineHeight)} * var(--hjm-text-scale))`;\n style[`--hjm-type-${kebab(name)}-weight`] = value.fontWeight;\n }\n for (const [name, value] of Object.entries(fontWeight)) {\n style[`--hjm-font-weight-${kebab(name)}`] = value;\n }\n for (const [name, value] of Object.entries(motion)) {\n style[`--hjm-motion-${kebab(name)}`] = environment.reducedMotion\n ? \"0ms\"\n : `${value}ms`;\n }\n\n style[\"--hjm-font-family-ui\"] = fontFamily.ui.join(\", \");\n for (const [name, value] of Object.entries(stroke)) {\n style[`--hjm-stroke-${kebab(name)}`] = `${value}px`;\n }\n // Unset before 1.4.1, so focus rules were invalid and drew no ring.\n style[\"--hjm-color-focus\"] = resolveColorReference(focusIndicatorContract.color, palette);\n style[\"--hjm-focus-width\"] = `${focusIndicatorContract.width}px`;\n style[\"--hjm-focus-offset\"] = `${focusIndicatorContract.offset}px`;\n style[\"--hjm-bottom-navigation-pressed-background\"] = resolveColorReference(\n bottomNavigationRecipe.states.pressedBackground,\n palette,\n );\n // Row rhythm and the leading frame come from the recipe so the stylesheet\n // does not carry a second copy of the same numbers.\n style[\"--hjm-list-row-gap\"] = rem(listRowRecipe.gap);\n style[\"--hjm-list-row-leading-size\"] = rem(listRowRecipe.leadingSize);\n for (const [name, value] of Object.entries(switchRecipe.sizes)) {\n style[`--hjm-switch-${kebab(name)}-width`] = rem(value.width);\n style[`--hjm-switch-${kebab(name)}-height`] = rem(value.height);\n style[`--hjm-switch-${kebab(name)}-thumb`] = rem(value.thumb);\n style[`--hjm-switch-${kebab(name)}-inset`] = rem(value.inset);\n style[`--hjm-switch-${kebab(name)}-offset`] = rem(\n value.width - value.thumb - value.inset * 2,\n );\n }\n for (const [name, value] of Object.entries(listRowRecipe.density)) {\n style[`--hjm-list-row-${kebab(name)}-one-line`] = rem(value.oneLineMinHeight);\n style[`--hjm-list-row-${kebab(name)}-two-line`] = rem(value.twoLineMinHeight);\n style[`--hjm-list-row-${kebab(name)}-padding-inline`] = rem(value.paddingHorizontal);\n style[`--hjm-list-row-${kebab(name)}-padding-block`] = rem(value.paddingVertical);\n }\n // The recipe owns these; a second copy in the stylesheet drifts silently\n // because the gates read that file as text only. Block and text heights\n // already resolve through --hjm-space-*, so they are not re-emitted.\n const skeletonCurve = easing[skeletonRecipe.animation.easing];\n style[\"--hjm-skeleton-circle-size\"] =\n `${skeletonRecipe.shapes.circle.defaultHeight}px`;\n style[\"--hjm-skeleton-duration\"] = `${skeletonRecipe.animation.duration}ms`;\n style[\"--hjm-skeleton-easing\"] = `cubic-bezier(${skeletonCurve.join(\", \")})`;\n style[\"--hjm-skeleton-from-opacity\"] = skeletonRecipe.animation.fromOpacity;\n style[\"--hjm-skeleton-to-opacity\"] = skeletonRecipe.animation.toOpacity;\n // Export the shared order instead of keeping a second numeric scale in CSS.\n for (const [name, value] of Object.entries(layer)) {\n style[`--hjm-layer-${kebab(name)}`] = value;\n }\n for (const [name, token] of Object.entries(shadow)) {\n style[`--hjm-shadow-${kebab(name)}`] = shadowCss(token);\n }\n // Overlay chrome and sizes come from the recipes Native reads (1.5.0).\n for (const [name, chrome] of [[\"dialog\", dialogRecipe.content], [\"sheet\", sheetRecipe.content], [\"toast\", toastRecipe.surface]] as const) {\n style[`--hjm-${name}-background`] = resolveColorReference(chrome.background, palette);\n style[`--hjm-${name}-border`] = resolveColorReference(chrome.border, palette);\n style[`--hjm-${name}-border-width`] = `${chrome.borderWidth}px`;\n style[`--hjm-${name}-radius`] = `var(--hjm-radius-${chrome.radius})`;\n style[`--hjm-${name}-shadow`] = shadowCss(chrome.shadow);\n }\n style[\"--hjm-sheet-max-height\"] = `${sheetRecipe.content.maxHeightRatio * 100}dvh`;\n style[\"--hjm-sheet-max-width\"] = `${sheetRecipe.web.maxWidth}px`;\n style[\"--hjm-sheet-handle-width\"] = `${sheetRecipe.handle.width}px`;\n style[\"--hjm-sheet-handle-height\"] = `${sheetRecipe.handle.height}px`;\n style[\"--hjm-sheet-handle-color\"] = resolveColorReference(sheetRecipe.handle.color, palette);\n for (const [name, ratio] of Object.entries(sheetRecipe.sizes)) {\n if (ratio !== null) style[`--hjm-sheet-size-${name}`] = `${ratio * 100}dvh`;\n }\n // Toast badge/action colours resolve from the recipe so Web and Native share one tone table (1.10.0).\n for (const [tone, contract] of Object.entries(toastRecipe.tones)) {\n style[`--hjm-toast-accent-${tone}`] = resolveColorReference(contract.accent, palette);\n style[`--hjm-toast-badge-${tone}`] = resolveColorReference(contract.badge, palette);\n }\n style[\"--hjm-toast-badge-size\"] = `${toastRecipe.icon.badgeDiameter}px`;\n style[\"--hjm-toast-action-background\"] = resolveColorReference(toastRecipe.action.background, palette);\n style[\"--hjm-toast-action-color\"] = resolveColorReference(toastRecipe.action.color, palette);\n style[\"--hjm-toast-description-color\"] = resolveColorReference(toastRecipe.description.color, palette);\n const toastExit = toastRecipe.transition.web.exit;\n style[\"--hjm-toast-exit-duration\"] = environment.reducedMotion ? \"0ms\" : `${toastExit.duration}ms`;\n style[\"--hjm-toast-exit-easing\"] = `cubic-bezier(${easing[toastExit.easing].join(\", \")})`;\n // SearchField geometry comes from searchFieldRecipe (2026-10-06 follow-up). Web had drawn TextField's\n // 16px padding for both sizes and a 44px clear button even at `medium`, where the recipe and Native\n // use a 36 circle with a 4px hit slop (44 target, 36 footprint).\n for (const [name, size] of Object.entries(searchFieldRecipe.sizes)) {\n style[`--hjm-search-field-padding-${name}`] = `${size.paddingHorizontal}px`;\n style[`--hjm-search-field-gap-${name}`] = `${size.gap}px`;\n style[`--hjm-search-field-clear-${name}`] = `${size.clearDiameter}px`;\n style[`--hjm-search-field-clear-slop-${name}`] = `${size.clearHitSlop}px`;\n }\n style[\"--hjm-tooltip-max-width\"] = `${tooltipRecipe.content.maxWidth}px`;\n style[\"--hjm-tooltip-padding\"] = `${tooltipRecipe.surface.padding}px`;\n // Floating collection surfaces read their padding from the recipe (2026-10-06): the stylesheet's 4 had drifted from 8.\n style[\"--hjm-menu-padding\"] = `${menuRecipe.surface.padding}px`;\n style[\"--hjm-select-popover-padding\"] = `${selectRecipe.popover.padding}px`;\n style[\"--hjm-combobox-popover-padding\"] = `${comboboxRecipe.popover.padding}px`;\n style[\"--hjm-tooltip-collision-padding\"] = `${tooltipRecipe.positioning.collisionPadding}px`;\n style[\"--hjm-button-pressed-opacity\"] = buttonRecipe.opacity.pressed;\n style[\"--hjm-button-disabled-opacity\"] = buttonRecipe.opacity.disabled;\n style[\"--hjm-field-border-width\"] = `${fieldRecipe.borderWidth}px`;\n style[\"--hjm-field-focus-ring-width\"] = `${fieldRecipe.focusRingWidth}px`;\n style[\"--hjm-field-disabled-opacity\"] = fieldRecipe.disabledOpacity;\n style[\"--hjm-control-min-touch-target\"] = `${control.minTouchTarget}px`;\n style[\"--hjm-control-field-height\"] = `${control.fieldHeight}px`;\n style[\"--hjm-field-multiline-min-height\"] = rem(fieldRecipe.multilineMinHeight);\n style[\"--hjm-field-padding-block\"] = rem(fieldRecipe.paddingVertical);\n for (const [name, value] of Object.entries(control.buttonHeight)) {\n // The axis is applied to the emitted variables rather than to each rule so\n // that every stylesheet consumer of a control height honours it at once.\n style[`--hjm-control-button-${kebab(name)}`] =\n `${visibleControlHeight(value, environment.minimumVisualTarget)}px`;\n }\n\n return style;\n}\n"]}
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAU,EACV,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,UAAU,GACX,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EACL,oBAAoB,GAErB,MAAM,2DAA2D,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE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C;IAC1E,KAAK,CAAC,8BAA8B,CAAC,GAAG,WAAW,CAAC,eAAe,CAAC;IACpE,KAAK,CAAC,gCAAgC,CAAC,GAAG,GAAG,OAAO,CAAC,cAAc,IAAI,CAAC;IACxE,KAAK,CAAC,4BAA4B,CAAC,GAAG,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC;IACjE,KAAK,CAAC,kCAAkC,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAChF,KAAK,CAAC,2BAA2B,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACtE,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACjE,2EAA2E;QAC3E,yEAAyE;QACzE,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,GAAG,oBAAoB,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC;IACxE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { resolveSurfaceFillOpacity } from \"@hjmds/design-contracts/palette-contrast\";\nimport {\n backdrop,\n control,\n easing,\n fontFamily,\n fontWeight,\n motion,\n layer,\n radius,\n shadow,\n spacing,\n stroke,\n typography,\n} from \"@hjmds/design-contracts/foundations\";\nimport { resolveColorReference } from \"@hjmds/design-contracts/color-references\";\nimport { focusIndicatorContract } from \"@hjmds/design-contracts/contracts\";\nimport {\n visibleControlHeight,\n type DesignSystemProviderValue,\n} from \"@hjmds/design-contracts/components/design-system-provider\";\nimport { buttonRecipe, fieldRecipe } from \"@hjmds/design-contracts/recipes/base\";\nimport {\n bottomNavigationRecipe,\n comboboxRecipe,\n dialogRecipe,\n listRowRecipe,\n menuRecipe,\n searchFieldRecipe,\n selectRecipe,\n sheetRecipe,\n skeletonRecipe,\n tooltipRecipe,\n switchRecipe,\n toastRecipe,\n} from \"@hjmds/design-contracts/recipes\";\nimport type { CSSProperties } from \"react\";\n\nexport type HjmThemeStyle = CSSProperties &\n Record<`--hjm-${string}`, string | number>;\n\nfunction kebab(value: string): string {\n return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\ntype ShadowToken = Readonly<{ color: string; opacity: number; radius: number; offsetY: number }>;\n\n// RN shadow token -> CSS; blur = radius, as react-native-web maps it.\nfunction shadowCss(token: ShadowToken, offsetX = 0): string {\n const hex = token.color.replace(\"#\", \"\");\n const [r, g, b] = [0, 2, 4].map((start) => Number.parseInt(hex.slice(start, start + 2), 16));\n return `${offsetX}px ${token.offsetY}px ${token.radius}px rgb(${r} ${g} ${b} / ${Math.round(token.opacity * 100)}%)`;\n}\n\nfunction rem(value: number): string {\n return `${Number((value / 16).toFixed(5))}rem`;\n}\n\nexport function createHjmThemeStyle(\n value: DesignSystemProviderValue,\n): HjmThemeStyle {\n const { environment, palette } = value;\n const profileTokens = value.designProfile?.tokens;\n const style: HjmThemeStyle = {\n \"--hjm-backdrop-modal\": `color-mix(in srgb, ${backdrop.modal.color} ${backdrop.modal.opacity * 100}%, transparent)`,\n \"--hjm-text-scale\": environment.textScale,\n \"--hjm-motion-scale\": environment.reducedMotion ? 0 : 1,\n colorScheme: environment.theme,\n backgroundColor: palette.theme.bg,\n color: palette.theme.text,\n };\n\n for (const [name, color] of Object.entries(palette.theme)) {\n style[`--hjm-color-${kebab(name)}`] = color;\n }\n for (const [name, color] of Object.entries(palette.statusAccents)) {\n style[`--hjm-accent-${kebab(name)}`] = color;\n }\n for (const [name, color] of Object.entries(palette.statusAccentFills)) {\n style[`--hjm-accent-fill-${kebab(name)}`] = color;\n }\n for (const [name, value] of Object.entries(spacing)) {\n style[`--hjm-space-${kebab(name)}`] = `${value}px`;\n }\n for (const [name, value] of Object.entries(profileTokens?.radius ?? radius)) {\n style[`--hjm-radius-${kebab(name)}`] = `${value}px`;\n }\n for (const [name, value] of Object.entries(profileTokens?.typography ?? typography)) {\n style[`--hjm-type-${kebab(name)}-size`] =\n `calc(${rem(value.fontSize)} * var(--hjm-text-scale))`;\n style[`--hjm-type-${kebab(name)}-line-height`] =\n `calc(${rem(value.lineHeight)} * var(--hjm-text-scale))`;\n style[`--hjm-type-${kebab(name)}-weight`] = value.fontWeight;\n }\n for (const [name, value] of Object.entries(fontWeight)) {\n style[`--hjm-font-weight-${kebab(name)}`] = value;\n }\n for (const [name, value] of Object.entries(motion)) {\n style[`--hjm-motion-${kebab(name)}`] = environment.reducedMotion\n ? \"0ms\"\n : `${value}ms`;\n }\n\n style[\"--hjm-font-family-ui\"] = (profileTokens?.fontFamily.ui ?? fontFamily.ui).join(\", \");\n style[\"--hjm-font-family-code\"] = (profileTokens?.fontFamily.code ?? fontFamily.code).join(\", \");\n for (const [name, value] of Object.entries(stroke)) {\n style[`--hjm-stroke-${kebab(name)}`] = `${value}px`;\n }\n // Unset before 1.4.1, so focus rules were invalid and drew no ring.\n style[\"--hjm-color-focus\"] = resolveColorReference(focusIndicatorContract.color, palette);\n style[\"--hjm-focus-width\"] = `${focusIndicatorContract.width}px`;\n style[\"--hjm-focus-offset\"] = `${focusIndicatorContract.offset}px`;\n style[\"--hjm-bottom-navigation-pressed-background\"] = resolveColorReference(\n bottomNavigationRecipe.states.pressedBackground,\n palette,\n );\n // Row rhythm and the leading frame come from the recipe so the stylesheet\n // does not carry a second copy of the same numbers.\n style[\"--hjm-list-row-gap\"] = rem(listRowRecipe.gap);\n style[\"--hjm-list-row-leading-size\"] = rem(listRowRecipe.leadingSize);\n for (const [name, value] of Object.entries(switchRecipe.sizes)) {\n style[`--hjm-switch-${kebab(name)}-width`] = rem(value.width);\n style[`--hjm-switch-${kebab(name)}-height`] = rem(value.height);\n style[`--hjm-switch-${kebab(name)}-thumb`] = rem(value.thumb);\n style[`--hjm-switch-${kebab(name)}-inset`] = rem(value.inset);\n style[`--hjm-switch-${kebab(name)}-offset`] = rem(\n value.width - value.thumb - value.inset * 2,\n );\n }\n for (const [name, value] of Object.entries(listRowRecipe.density)) {\n style[`--hjm-list-row-${kebab(name)}-one-line`] = rem(value.oneLineMinHeight);\n style[`--hjm-list-row-${kebab(name)}-two-line`] = rem(value.twoLineMinHeight);\n style[`--hjm-list-row-${kebab(name)}-padding-inline`] = rem(value.paddingHorizontal);\n style[`--hjm-list-row-${kebab(name)}-padding-block`] = rem(value.paddingVertical);\n }\n // The recipe owns these; a second copy in the stylesheet drifts silently\n // because the gates read that file as text only. Block and text heights\n // already resolve through --hjm-space-*, so they are not re-emitted.\n const skeletonCurve = easing[skeletonRecipe.animation.easing];\n style[\"--hjm-skeleton-circle-size\"] =\n `${skeletonRecipe.shapes.circle.defaultHeight}px`;\n style[\"--hjm-skeleton-duration\"] = `${skeletonRecipe.animation.duration}ms`;\n style[\"--hjm-skeleton-easing\"] = `cubic-bezier(${skeletonCurve.join(\", \")})`;\n style[\"--hjm-skeleton-from-opacity\"] = skeletonRecipe.animation.fromOpacity;\n style[\"--hjm-skeleton-to-opacity\"] = skeletonRecipe.animation.toOpacity;\n // Export the shared order instead of keeping a second numeric scale in CSS.\n for (const [name, value] of Object.entries(layer)) {\n style[`--hjm-layer-${kebab(name)}`] = value;\n }\n for (const [name, token] of Object.entries(profileTokens?.shadow ?? shadow)) {\n style[`--hjm-shadow-${kebab(name)}`] = shadowCss(token);\n }\n const surfaceMaterial = value.designProfile?.material.surface;\n // Defaults are emitted on every Provider, so a nested neutral profile clears\n // inherited glass/clay. Unsupported transparency remains an opaque CSS fill.\n style[\"--hjm-surface-blur\"] = surfaceMaterial?.blurStrength ? `blur(${surfaceMaterial.blurStrength * 32}px)` : \"none\";\n style[\"--hjm-surface-fill-opacity\"] = surfaceMaterial?.blurStrength ? resolveSurfaceFillOpacity(surfaceMaterial.fillOpacity, palette.theme) : 1;\n const insetShadow = surfaceMaterial?.insetShadows.length\n ? surfaceMaterial.insetShadows.map(token => `inset ${shadowCss(token, token.offsetX)}`).join(\", \")\n : \"\";\n style[\"--hjm-surface-inset-shadow\"] = insetShadow || \"none\";\n style[\"--hjm-surface-raised-shadow\"] = shadowCss(profileTokens?.shadow.floating ?? shadow.floating) + (insetShadow ? `, ${insetShadow}` : \"\");\n // BottomCTA overlaps content above it (bottomCtaRecipe rationale). Profile\n // strength is shared, but its shadow must cast upward rather than behind the\n // footer; preserve the stylesheet-only legacy path when no profile is supplied.\n style[\"--hjm-bottom-cta-shadow\"] = profileTokens\n ? shadowCss({ ...profileTokens.shadow.floating, offsetY: -Math.abs(profileTokens.shadow.floating.offsetY) })\n : \"none\";\n // Overlay chrome and sizes come from the recipes Native reads (1.5.0).\n for (const [name, chrome] of [[\"dialog\", dialogRecipe.content], [\"sheet\", sheetRecipe.content], [\"toast\", toastRecipe.surface]] as const) {\n style[`--hjm-${name}-background`] = resolveColorReference(chrome.background, palette);\n style[`--hjm-${name}-border`] = resolveColorReference(chrome.border, palette);\n style[`--hjm-${name}-border-width`] = `${chrome.borderWidth}px`;\n style[`--hjm-${name}-radius`] = `var(--hjm-radius-${chrome.radius})`;\n // Recipes select the floating role. Resolve its value from the profile so\n // dialogs, sheets and toasts cannot retain neutral shadows after a theme switch.\n style[`--hjm-${name}-shadow`] = shadowCss(profileTokens?.shadow.floating ?? chrome.shadow);\n }\n style[\"--hjm-sheet-max-height\"] = `${sheetRecipe.content.maxHeightRatio * 100}dvh`;\n style[\"--hjm-sheet-max-width\"] = `${sheetRecipe.web.maxWidth}px`;\n style[\"--hjm-sheet-handle-width\"] = `${sheetRecipe.handle.width}px`;\n style[\"--hjm-sheet-handle-height\"] = `${sheetRecipe.handle.height}px`;\n style[\"--hjm-sheet-handle-color\"] = resolveColorReference(sheetRecipe.handle.color, palette);\n for (const [name, ratio] of Object.entries(sheetRecipe.sizes)) {\n if (ratio !== null) style[`--hjm-sheet-size-${name}`] = `${ratio * 100}dvh`;\n }\n // Toast badge/action colours resolve from the recipe so Web and Native share one tone table (1.10.0).\n for (const [tone, contract] of Object.entries(toastRecipe.tones)) {\n style[`--hjm-toast-accent-${tone}`] = resolveColorReference(contract.accent, palette);\n style[`--hjm-toast-badge-${tone}`] = resolveColorReference(contract.badge, palette);\n }\n style[\"--hjm-toast-badge-size\"] = `${toastRecipe.icon.badgeDiameter}px`;\n style[\"--hjm-toast-action-background\"] = resolveColorReference(toastRecipe.action.background, palette);\n style[\"--hjm-toast-action-color\"] = resolveColorReference(toastRecipe.action.color, palette);\n style[\"--hjm-toast-description-color\"] = resolveColorReference(toastRecipe.description.color, palette);\n const toastExit = toastRecipe.transition.web.exit;\n style[\"--hjm-toast-exit-duration\"] = environment.reducedMotion ? \"0ms\" : `${toastExit.duration}ms`;\n style[\"--hjm-toast-exit-easing\"] = `cubic-bezier(${easing[toastExit.easing].join(\", \")})`;\n // SearchField geometry comes from searchFieldRecipe (2026-10-06 follow-up). Web had drawn TextField's\n // 16px padding for both sizes and a 44px clear button even at `medium`, where the recipe and Native\n // use a 36 circle with a 4px hit slop (44 target, 36 footprint).\n for (const [name, size] of Object.entries(searchFieldRecipe.sizes)) {\n style[`--hjm-search-field-padding-${name}`] = `${size.paddingHorizontal}px`;\n style[`--hjm-search-field-gap-${name}`] = `${size.gap}px`;\n style[`--hjm-search-field-clear-${name}`] = `${size.clearDiameter}px`;\n style[`--hjm-search-field-clear-slop-${name}`] = `${size.clearHitSlop}px`;\n }\n style[\"--hjm-tooltip-max-width\"] = `${tooltipRecipe.content.maxWidth}px`;\n style[\"--hjm-tooltip-padding\"] = `${tooltipRecipe.surface.padding}px`;\n // Floating collection surfaces read their padding from the recipe (2026-10-06): the stylesheet's 4 had drifted from 8.\n style[\"--hjm-menu-padding\"] = `${menuRecipe.surface.padding}px`;\n style[\"--hjm-select-popover-padding\"] = `${selectRecipe.popover.padding}px`;\n style[\"--hjm-combobox-popover-padding\"] = `${comboboxRecipe.popover.padding}px`;\n style[\"--hjm-tooltip-collision-padding\"] = `${tooltipRecipe.positioning.collisionPadding}px`;\n style[\"--hjm-button-pressed-opacity\"] = buttonRecipe.opacity.pressed;\n style[\"--hjm-button-disabled-opacity\"] = buttonRecipe.opacity.disabled;\n style[\"--hjm-field-border-width\"] = `${fieldRecipe.borderWidth}px`;\n style[\"--hjm-field-focus-ring-width\"] = `${fieldRecipe.focusRingWidth}px`;\n style[\"--hjm-field-disabled-opacity\"] = fieldRecipe.disabledOpacity;\n style[\"--hjm-control-min-touch-target\"] = `${control.minTouchTarget}px`;\n style[\"--hjm-control-field-height\"] = `${control.fieldHeight}px`;\n style[\"--hjm-field-multiline-min-height\"] = rem(fieldRecipe.multilineMinHeight);\n style[\"--hjm-field-padding-block\"] = rem(fieldRecipe.paddingVertical);\n for (const [name, value] of Object.entries(control.buttonHeight)) {\n // The axis is applied to the emitted variables rather than to each rule so\n // that every stylesheet consumer of a control height honours it at once.\n style[`--hjm-control-button-${kebab(name)}`] =\n `${visibleControlHeight(value, environment.minimumVisualTarget)}px`;\n }\n\n return style;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hjmds/react",
3
- "version": "1.13.1",
3
+ "version": "1.15.0",
4
4
  "description": "Accessible React 19 renderers for HJM design contracts.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -356,6 +356,16 @@
356
356
  "import": "./dist/content-transition.js",
357
357
  "default": "./dist/content-transition.js"
358
358
  },
359
+ "./rating": {
360
+ "types": "./dist/rating.d.ts",
361
+ "import": "./dist/rating.js",
362
+ "default": "./dist/rating.js"
363
+ },
364
+ "./image-comparison": {
365
+ "types": "./dist/image-comparison.d.ts",
366
+ "import": "./dist/image-comparison.js",
367
+ "default": "./dist/image-comparison.js"
368
+ },
359
369
  "./carousel-motion": {
360
370
  "types": "./dist/carousel-motion.d.ts",
361
371
  "import": "./dist/carousel-motion.js",
@@ -472,6 +482,31 @@
472
482
  "types": "./dist/saved-items.d.ts",
473
483
  "import": "./dist/saved-items.js",
474
484
  "default": "./dist/saved-items.js"
485
+ },
486
+ "./progressive-blur": {
487
+ "types": "./dist/progressive-blur.d.ts",
488
+ "import": "./dist/progressive-blur.js",
489
+ "default": "./dist/progressive-blur.js"
490
+ },
491
+ "./date-entry": {
492
+ "types": "./dist/date-entry.d.ts",
493
+ "import": "./dist/date-entry.js",
494
+ "default": "./dist/date-entry.js"
495
+ },
496
+ "./field-group": {
497
+ "types": "./dist/field-group.d.ts",
498
+ "import": "./dist/field-group.js",
499
+ "default": "./dist/field-group.js"
500
+ },
501
+ "./document-resource": {
502
+ "types": "./dist/document-resource.d.ts",
503
+ "import": "./dist/document-resource.js",
504
+ "default": "./dist/document-resource.js"
505
+ },
506
+ "./design-profile": {
507
+ "types": "./dist/design-profile.d.ts",
508
+ "import": "./dist/design-profile.js",
509
+ "default": "./dist/design-profile.js"
475
510
  }
476
511
  },
477
512
  "files": [
@@ -481,7 +516,7 @@
481
516
  "THIRD_PARTY_NOTICES.md"
482
517
  ],
483
518
  "peerDependencies": {
484
- "@hjmds/design-contracts": ">=1.13.0 <1.14.0",
519
+ "@hjmds/design-contracts": ">=1.15.0 <1.16.0",
485
520
  "react": ">=19.0.0",
486
521
  "react-dom": ">=19.0.0",
487
522
  "@number-flow/react": "0.6.2",
@@ -518,7 +553,7 @@
518
553
  "blobatar": "2.7.0",
519
554
  "@blobatar/react": "2.7.0",
520
555
  "lucide-react": "1.49.0",
521
- "@hjmds/design-contracts": "1.13.1"
556
+ "@hjmds/design-contracts": "1.15.0"
522
557
  },
523
558
  "peerDependenciesMeta": {
524
559
  "@number-flow/react": {