@handijitcom/ui 1.0.0 → 1.1.1

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 (107) hide show
  1. package/README.md +34 -32
  2. package/build/calendar.cjs.map +1 -1
  3. package/build/calendar.js.map +1 -1
  4. package/build/charts.cjs +1 -1
  5. package/build/charts.cjs.map +1 -1
  6. package/build/charts.js +1 -1
  7. package/build/charts.js.map +1 -1
  8. package/build/chat.cjs +1 -1
  9. package/build/chat.cjs.map +1 -1
  10. package/build/chat.js +1 -1
  11. package/build/chat.js.map +1 -1
  12. package/build/components/MoneyInput/index.cjs.map +1 -1
  13. package/build/components/MoneyInput/index.d.cts +1 -1
  14. package/build/components/MoneyInput/index.d.ts +1 -1
  15. package/build/components/MoneyInput/index.js.map +1 -1
  16. package/build/constants/breakpoint.constants.cjs +1 -1
  17. package/build/constants/breakpoint.constants.cjs.map +1 -1
  18. package/build/constants/breakpoint.constants.d.cts +1 -1
  19. package/build/constants/breakpoint.constants.d.ts +1 -1
  20. package/build/constants/breakpoint.constants.js +1 -1
  21. package/build/constants/breakpoint.constants.js.map +1 -1
  22. package/build/constants/scale.constants.cjs.map +1 -1
  23. package/build/constants/scale.constants.d.cts +2 -3
  24. package/build/constants/scale.constants.d.ts +2 -3
  25. package/build/constants/scale.constants.js.map +1 -1
  26. package/build/design/fonts/LICENSE-archivo.txt +93 -0
  27. package/build/design/fonts/LICENSE-ibm-plex-mono.txt +93 -0
  28. package/build/design/fonts/LICENSE-inter.txt +93 -0
  29. package/build/design/fonts/archivo-latin-ext-wdth-normal.woff2 +0 -0
  30. package/build/design/fonts/archivo-latin-wdth-normal.woff2 +0 -0
  31. package/build/design/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  32. package/build/design/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  33. package/build/design/fonts/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  34. package/build/design/fonts/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  35. package/build/design/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  36. package/build/design/fonts/inter-latin-wght-normal.woff2 +0 -0
  37. package/build/design/fonts.css +75 -0
  38. package/build/design/fonts.d.css.ts +1 -0
  39. package/build/design/index.cjs +778 -0
  40. package/build/design/index.cjs.map +1 -0
  41. package/build/design/index.d.cts +263 -0
  42. package/build/design/index.d.mts +263 -0
  43. package/build/design/index.mjs +751 -0
  44. package/build/design/index.mjs.map +1 -0
  45. package/build/design/index.umd.cjs +2 -0
  46. package/build/design/index.umd.cjs.map +1 -0
  47. package/build/design/logos/horizontal.svg +1 -0
  48. package/build/design/logos/mark.svg +1 -0
  49. package/build/design/tokens.css +477 -0
  50. package/build/design/tokens.d.css.ts +1 -0
  51. package/build/design/tokens.json +542 -0
  52. package/build/design/tokens.scss +616 -0
  53. package/build/helpers/scaled-number.helper.cjs.map +1 -1
  54. package/build/helpers/scaled-number.helper.d.cts +3 -4
  55. package/build/helpers/scaled-number.helper.d.ts +3 -4
  56. package/build/helpers/scaled-number.helper.js.map +1 -1
  57. package/build/helpers/theme.helper.cjs +1 -1
  58. package/build/helpers/theme.helper.cjs.map +1 -1
  59. package/build/helpers/theme.helper.d.cts +2 -2
  60. package/build/helpers/theme.helper.d.ts +2 -2
  61. package/build/helpers/theme.helper.js +1 -1
  62. package/build/helpers/theme.helper.js.map +1 -1
  63. package/build/hooks/useUiTheme.cjs +1 -1
  64. package/build/hooks/useUiTheme.cjs.map +1 -1
  65. package/build/hooks/useUiTheme.d.cts +1 -1
  66. package/build/hooks/useUiTheme.d.ts +1 -1
  67. package/build/hooks/useUiTheme.js +1 -1
  68. package/build/hooks/useUiTheme.js.map +1 -1
  69. package/build/hooks/useUiTokens.cjs +1 -1
  70. package/build/hooks/useUiTokens.cjs.map +1 -1
  71. package/build/hooks/useUiTokens.d.cts +2 -2
  72. package/build/hooks/useUiTokens.d.ts +2 -2
  73. package/build/hooks/useUiTokens.js +1 -1
  74. package/build/hooks/useUiTokens.js.map +1 -1
  75. package/build/index.cjs +1 -1
  76. package/build/index.d.cts +1 -1
  77. package/build/index.d.ts +1 -1
  78. package/build/index.js +1 -1
  79. package/build/scss/_index.scss +1 -1
  80. package/build/scss/_variables.scss +3 -3
  81. package/build/theme/UiProvider.cjs.map +1 -1
  82. package/build/theme/UiProvider.d.cts +1 -1
  83. package/build/theme/UiProvider.d.ts +1 -1
  84. package/build/theme/UiProvider.js.map +1 -1
  85. package/build/theme/UiThemeScript.cjs +1 -1
  86. package/build/theme/UiThemeScript.cjs.map +1 -1
  87. package/build/theme/UiThemeScript.d.cts +1 -1
  88. package/build/theme/UiThemeScript.d.ts +1 -1
  89. package/build/theme/UiThemeScript.js +1 -1
  90. package/build/theme/UiThemeScript.js.map +1 -1
  91. package/build/types/calendar/Calendar/index.d.cts +2 -2
  92. package/build/types/calendar/Calendar/index.d.ts +2 -2
  93. package/build/types/calendar/core/time.d.cts +1 -1
  94. package/build/types/calendar/core/time.d.ts +1 -1
  95. package/build/types/calendar/core/types.d.cts +1 -1
  96. package/build/types/calendar/core/types.d.ts +1 -1
  97. package/build/types/calendar/index.d.cts +1 -1
  98. package/build/types/calendar/index.d.ts +1 -1
  99. package/build/types/charts/core/palette.d.cts +1 -1
  100. package/build/types/charts/core/palette.d.ts +1 -1
  101. package/build/types/chat/Legend/index.d.cts +1 -1
  102. package/build/types/chat/Legend/index.d.ts +1 -1
  103. package/build/types/theme.type.d.cts +2 -2
  104. package/build/types/theme.type.d.ts +2 -2
  105. package/build/types/types/theme.type.d.cts +2 -2
  106. package/build/types/types/theme.type.d.ts +2 -2
  107. package/package.json +30 -6
@@ -6,13 +6,12 @@
6
6
  * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,
7
7
  * so "0,1" at 2 is exactly `10`, never `10.000000000000002`.
8
8
  *
9
- * ⚠ The GRAMMAR is the one of `@handijit/app-kit` `parseDecimal` (data contract §4.3), on
10
- * purpose and pinned by the same vectors in `__tests__/helpers/scaled-number.helper.test.ts`:
9
+ * ⚠ The GRAMMAR is the data contract's (§4.3), pinned by the vectors in `__tests__/helpers/scaled-number.helper.test.ts`:
11
10
  * the comma is the decimal point; with a comma, dots may only group the whole part by three;
12
11
  * without one, a dot followed by groups of three groups thousands ("1.250" is 1250) unless the
13
12
  * first group starts with zero ("0.250" is 0,25), and any other single dot is the point ("12.5"
14
- * is 12,5 — the dot key of a number pad). `ui` is a platform package and cannot import app-kit or
15
- * `@handijit/decimal`; the two copies must say the same thing, and the test is where they meet.
13
+ * is 12,5 — the dot key of a number pad). `ui` depends on no decimal library; the test table is the
14
+ * reference for the grammar.
16
15
  */
17
16
  /** Text the field cannot hold: the keystroke that produced it is refused. */
18
17
  export declare const REFUSED: unique symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"scaled-number.helper.js","sources":["../../src/helpers/scaled-number.helper.ts"],"sourcesContent":["/**\n * A SCALED INTEGER as a person types and reads it — the text side of `ScaledInput` (2.4).\n *\n * The value is a safe integer that carries `scaleDigits` decimal places (`123456` at 2 is\n * \"1.234,56\"): the scaled types of the data contract (`Kurus`, `Qty4`, `Price4`, `Rate6`, `Pct2`).\n * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,\n * so \"0,1\" at 2 is exactly `10`, never `10.000000000000002`.\n *\n * ⚠ The GRAMMAR is the one of `@handijit/app-kit` `parseDecimal` (data contract §4.3), on\n * purpose and pinned by the same vectors in `__tests__/helpers/scaled-number.helper.test.ts`:\n * the comma is the decimal point; with a comma, dots may only group the whole part by three;\n * without one, a dot followed by groups of three groups thousands (\"1.250\" is 1250) unless the\n * first group starts with zero (\"0.250\" is 0,25), and any other single dot is the point (\"12.5\"\n * is 12,5 — the dot key of a number pad). `ui` is a platform package and cannot import app-kit or\n * `@handijit/decimal`; the two copies must say the same thing, and the test is where they meet.\n */\n\n/** Text the field cannot hold: the keystroke that produced it is refused. */\nexport const REFUSED = Symbol('refused');\n\nexport type ScaledReadOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places a person may type (≤ `scaleDigits`). */\n maxFractionDigits: number;\n /** The smallest value; a minus sign is refused when it is 0 or more. */\n min: number;\n /** The largest value; a keystroke past it is refused. */\n max: number;\n};\n\n/**\n * What the typed text means: a scaled integer, `null` (nothing yet, or a number still being\n * typed that is not one on its own: \"-\", \",\", \"1.250.0\"), or `REFUSED` (no number starts this\n * way, or it has more decimals than allowed, or it is out of range).\n */\nexport type ScaledReading = number | null | typeof REFUSED;\n\n/** The whole part grouped by three, every group complete: \"1.250\", \"12.345.678\". */\nconst THOUSANDS = /^[1-9]\\d{0,2}(\\.\\d{3})+$/;\n/** On the way to `THOUSANDS`: the last group may still be short (\"1.250.0\"). */\nconst THOUSANDS_PREFIX = /^[1-9]\\d{0,2}(\\.\\d{3})*\\.\\d{0,3}$/;\n\n/**\n * Drops spaces anywhere and signs around the number (a currency code, \"%\", a plus) — a pasted\n * \"1.234,56 TL\" reads. A letter INSIDE the number stays and refuses it: \"1e3\" is not 13.\n */\nexport const cleanScaledText = (input: string): string =>\n input.replace(/\\s/g, '').replace(/^[^\\d.,-]+|[^\\d.,-]+$/g, '');\n\n/** Sign, whole digits and fraction digits of a complete number, or `null`. */\nconst split = (text: string): { isNegative: boolean; whole: string; fraction: string } | null => {\n const isNegative = text.startsWith('-');\n const body = isNegative ? text.slice(1) : text;\n const [whole, fraction, ...more] = body.split(',') as [string, ...string[]];\n\n if (more.length > 0 || body.includes('-')) return null;\n\n if (fraction !== undefined) {\n if (fraction.includes('.')) return null;\n if (whole.includes('.') && !THOUSANDS.test(whole)) return null;\n\n return { isNegative, whole: whole.replaceAll('.', ''), fraction };\n }\n\n if (THOUSANDS.test(whole)) return { isNegative, whole: whole.replaceAll('.', ''), fraction: '' };\n\n const [integer, point, ...rest] = whole.split('.') as [string, ...string[]];\n if (rest.length > 0) return null;\n\n return { isNegative, whole: integer, fraction: point ?? '' };\n};\n\n/** Reads typed text as a scaled integer; see `ScaledReading`. */\nexport const readScaledText = (input: string, options: ScaledReadOptions): ScaledReading => {\n const text = cleanScaledText(input);\n if (/[^\\d.,-]/.test(text)) return REFUSED;\n const parts = split(text);\n\n if (!parts) {\n /* Not a number, but maybe the start of one: \"1.250.0\" on the way to \"1.250.000\". */\n const body = text.startsWith('-') ? text.slice(1) : text;\n return THOUSANDS_PREFIX.test(body) && (options.min < 0 || !text.startsWith('-'))\n ? null\n : REFUSED;\n }\n\n const { isNegative, whole, fraction } = parts;\n if (isNegative && options.min >= 0) return REFUSED;\n const allowedFraction = Math.min(options.maxFractionDigits, options.scaleDigits);\n if (fraction.length > allowedFraction) return REFUSED;\n /* A whole-number field takes no decimal comma at all — \"3,\" would wait for a digit it refuses. */\n if (allowedFraction === 0 && text.includes(',')) return REFUSED;\n if (whole === '' && fraction === '') return null;\n\n const magnitude = BigInt(`${whole}${fraction.padEnd(options.scaleDigits, '0')}`);\n const signed = isNegative ? -magnitude : magnitude;\n\n const isTooLarge = signed > BigInt(Math.trunc(options.max));\n /* Under a positive `min` the field still takes the digits on the way up (\"0\" towards \"5\"). */\n const isTooSmall = signed < BigInt(Math.trunc(Math.min(options.min, 0)));\n if (isTooLarge || isTooSmall) return REFUSED;\n\n /* No negative zero: \"-0\" is 0. */\n return Number(signed) + 0;\n};\n\nexport type ScaledFormatOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places always shown (\"12,50\" at 2); trailing zeros past them are dropped. */\n minFractionDigits: number;\n /** Groups the whole part by three with a dot (\"1.234,5\"); off while the field is edited. */\n isGrouped: boolean;\n};\n\n/**\n * A scaled integer as text: `123450` at 2 → \"1.234,50\" (min 2) or \"1234,5\" (min 0, ungrouped).\n * Every carried digit that is not a trailing zero is shown — the field never hides part of the\n * value it holds.\n */\nexport const formatScaledValue = (value: number, options: ScaledFormatOptions): string => {\n const { scaleDigits, minFractionDigits, isGrouped } = options;\n const digits = String(Math.abs(value)).padStart(scaleDigits + 1, '0');\n const whole = digits.slice(0, digits.length - scaleDigits);\n const fraction = digits.slice(digits.length - scaleDigits).replace(/0+$/, '');\n const shownFraction = fraction.padEnd(Math.min(minFractionDigits, scaleDigits), '0');\n const shownWhole = isGrouped ? whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.') : whole;\n const sign = value < 0 ? '-' : '';\n\n return `${sign}${shownWhole}${shownFraction === '' ? '' : `,${shownFraction}`}`;\n};\n"],"names":["REFUSED","THOUSANDS","THOUSANDS_PREFIX","cleanScaledText","input","split","text","isNegative","body","whole","fraction","more","integer","point","rest","readScaledText","options","parts","allowedFraction","magnitude","signed","isTooLarge","isTooSmall","formatScaledValue","value","scaleDigits","minFractionDigits","isGrouped","digits","shownFraction","shownWhole"],"mappings":"AAkBO,MAAMA,IAAU,OAAO,SAAS,GAqBjCC,IAAY,4BAEZC,IAAmB,qCAMZC,IAAkB,CAACC,MAC9BA,EAAM,QAAQ,OAAO,EAAE,EAAE,QAAQ,0BAA0B,EAAE,GAGzDC,IAAQ,CAACC,MAAkF;AAC/F,QAAMC,IAAaD,EAAK,WAAW,GAAG,GAChCE,IAAOD,IAAaD,EAAK,MAAM,CAAC,IAAIA,GACpC,CAACG,GAAOC,GAAU,GAAGC,CAAI,IAAIH,EAAK,MAAM,GAAG;AAEjD,MAAIG,EAAK,SAAS,KAAKH,EAAK,SAAS,GAAG,EAAG,QAAO;AAElD,MAAIE,MAAa;AAEf,WADIA,EAAS,SAAS,GAAG,KACrBD,EAAM,SAAS,GAAG,KAAK,CAACR,EAAU,KAAKQ,CAAK,IAAU,OAEnD,EAAE,YAAAF,GAAY,OAAOE,EAAM,WAAW,KAAK,EAAE,GAAG,UAAAC,EAAA;AAGzD,MAAIT,EAAU,KAAKQ,CAAK,UAAU,EAAE,YAAAF,GAAY,OAAOE,EAAM,WAAW,KAAK,EAAE,GAAG,UAAU,GAAA;AAE5F,QAAM,CAACG,GAASC,GAAO,GAAGC,CAAI,IAAIL,EAAM,MAAM,GAAG;AACjD,SAAIK,EAAK,SAAS,IAAU,OAErB,EAAE,YAAAP,GAAY,OAAOK,GAAS,UAAUC,KAAS,GAAA;AAC1D,GAGaE,IAAiB,CAACX,GAAeY,MAA8C;AAC1F,QAAMV,IAAOH,EAAgBC,CAAK;AAClC,MAAI,WAAW,KAAKE,CAAI,EAAG,QAAON;AAClC,QAAMiB,IAAQZ,EAAMC,CAAI;AAExB,MAAI,CAACW,GAAO;AAEV,UAAMT,IAAOF,EAAK,WAAW,GAAG,IAAIA,EAAK,MAAM,CAAC,IAAIA;AACpD,WAAOJ,EAAiB,KAAKM,CAAI,MAAMQ,EAAQ,MAAM,KAAK,CAACV,EAAK,WAAW,GAAG,KAC1E,OACAN;AAAA,EACN;AAEA,QAAM,EAAE,YAAAO,GAAY,OAAAE,GAAO,UAAAC,EAAA,IAAaO;AACxC,MAAIV,KAAcS,EAAQ,OAAO,EAAG,QAAOhB;AAC3C,QAAMkB,IAAkB,KAAK,IAAIF,EAAQ,mBAAmBA,EAAQ,WAAW;AAG/E,MAFIN,EAAS,SAASQ,KAElBA,MAAoB,KAAKZ,EAAK,SAAS,GAAG,EAAG,QAAON;AACxD,MAAIS,MAAU,MAAMC,MAAa,GAAI,QAAO;AAE5C,QAAMS,IAAY,OAAO,GAAGV,CAAK,GAAGC,EAAS,OAAOM,EAAQ,aAAa,GAAG,CAAC,EAAE,GACzEI,IAASb,IAAa,CAACY,IAAYA,GAEnCE,IAAaD,IAAS,OAAO,KAAK,MAAMJ,EAAQ,GAAG,CAAC,GAEpDM,IAAaF,IAAS,OAAO,KAAK,MAAM,KAAK,IAAIJ,EAAQ,KAAK,CAAC,CAAC,CAAC;AACvE,SAAIK,KAAcC,IAAmBtB,IAG9B,OAAOoB,CAAM,IAAI;AAC1B,GAgBaG,IAAoB,CAACC,GAAeR,MAAyC;AACxF,QAAM,EAAE,aAAAS,GAAa,mBAAAC,GAAmB,WAAAC,EAAA,IAAcX,GAChDY,IAAS,OAAO,KAAK,IAAIJ,CAAK,CAAC,EAAE,SAASC,IAAc,GAAG,GAAG,GAC9DhB,IAAQmB,EAAO,MAAM,GAAGA,EAAO,SAASH,CAAW,GAEnDI,IADWD,EAAO,MAAMA,EAAO,SAASH,CAAW,EAAE,QAAQ,OAAO,EAAE,EAC7C,OAAO,KAAK,IAAIC,GAAmBD,CAAW,GAAG,GAAG,GAC7EK,IAAaH,IAAYlB,EAAM,QAAQ,yBAAyB,GAAG,IAAIA;AAG7E,SAAO,GAFMe,IAAQ,IAAI,MAAM,EAEjB,GAAGM,CAAU,GAAGD,MAAkB,KAAK,KAAK,IAAIA,CAAa,EAAE;AAC/E;"}
1
+ {"version":3,"file":"scaled-number.helper.js","sources":["../../src/helpers/scaled-number.helper.ts"],"sourcesContent":["/**\n * A SCALED INTEGER as a person types and reads it — the text side of `ScaledInput` (2.4).\n *\n * The value is a safe integer that carries `scaleDigits` decimal places (`123456` at 2 is\n * \"1.234,56\"): the scaled types of the data contract (`Kurus`, `Qty4`, `Price4`, `Rate6`, `Pct2`).\n * Nothing here goes through a float: the digits are read as text and put together with `BigInt`,\n * so \"0,1\" at 2 is exactly `10`, never `10.000000000000002`.\n *\n * ⚠ The GRAMMAR is the data contract's (§4.3), pinned by the vectors in `__tests__/helpers/scaled-number.helper.test.ts`:\n * the comma is the decimal point; with a comma, dots may only group the whole part by three;\n * without one, a dot followed by groups of three groups thousands (\"1.250\" is 1250) unless the\n * first group starts with zero (\"0.250\" is 0,25), and any other single dot is the point (\"12.5\"\n * is 12,5 — the dot key of a number pad). `ui` depends on no decimal library; the test table is the\n * reference for the grammar.\n */\n\n/** Text the field cannot hold: the keystroke that produced it is refused. */\nexport const REFUSED = Symbol('refused');\n\nexport type ScaledReadOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places a person may type (≤ `scaleDigits`). */\n maxFractionDigits: number;\n /** The smallest value; a minus sign is refused when it is 0 or more. */\n min: number;\n /** The largest value; a keystroke past it is refused. */\n max: number;\n};\n\n/**\n * What the typed text means: a scaled integer, `null` (nothing yet, or a number still being\n * typed that is not one on its own: \"-\", \",\", \"1.250.0\"), or `REFUSED` (no number starts this\n * way, or it has more decimals than allowed, or it is out of range).\n */\nexport type ScaledReading = number | null | typeof REFUSED;\n\n/** The whole part grouped by three, every group complete: \"1.250\", \"12.345.678\". */\nconst THOUSANDS = /^[1-9]\\d{0,2}(\\.\\d{3})+$/;\n/** On the way to `THOUSANDS`: the last group may still be short (\"1.250.0\"). */\nconst THOUSANDS_PREFIX = /^[1-9]\\d{0,2}(\\.\\d{3})*\\.\\d{0,3}$/;\n\n/**\n * Drops spaces anywhere and signs around the number (a currency code, \"%\", a plus) — a pasted\n * \"1.234,56 TL\" reads. A letter INSIDE the number stays and refuses it: \"1e3\" is not 13.\n */\nexport const cleanScaledText = (input: string): string =>\n input.replace(/\\s/g, '').replace(/^[^\\d.,-]+|[^\\d.,-]+$/g, '');\n\n/** Sign, whole digits and fraction digits of a complete number, or `null`. */\nconst split = (text: string): { isNegative: boolean; whole: string; fraction: string } | null => {\n const isNegative = text.startsWith('-');\n const body = isNegative ? text.slice(1) : text;\n const [whole, fraction, ...more] = body.split(',') as [string, ...string[]];\n\n if (more.length > 0 || body.includes('-')) return null;\n\n if (fraction !== undefined) {\n if (fraction.includes('.')) return null;\n if (whole.includes('.') && !THOUSANDS.test(whole)) return null;\n\n return { isNegative, whole: whole.replaceAll('.', ''), fraction };\n }\n\n if (THOUSANDS.test(whole)) return { isNegative, whole: whole.replaceAll('.', ''), fraction: '' };\n\n const [integer, point, ...rest] = whole.split('.') as [string, ...string[]];\n if (rest.length > 0) return null;\n\n return { isNegative, whole: integer, fraction: point ?? '' };\n};\n\n/** Reads typed text as a scaled integer; see `ScaledReading`. */\nexport const readScaledText = (input: string, options: ScaledReadOptions): ScaledReading => {\n const text = cleanScaledText(input);\n if (/[^\\d.,-]/.test(text)) return REFUSED;\n const parts = split(text);\n\n if (!parts) {\n /* Not a number, but maybe the start of one: \"1.250.0\" on the way to \"1.250.000\". */\n const body = text.startsWith('-') ? text.slice(1) : text;\n return THOUSANDS_PREFIX.test(body) && (options.min < 0 || !text.startsWith('-'))\n ? null\n : REFUSED;\n }\n\n const { isNegative, whole, fraction } = parts;\n if (isNegative && options.min >= 0) return REFUSED;\n const allowedFraction = Math.min(options.maxFractionDigits, options.scaleDigits);\n if (fraction.length > allowedFraction) return REFUSED;\n /* A whole-number field takes no decimal comma at all — \"3,\" would wait for a digit it refuses. */\n if (allowedFraction === 0 && text.includes(',')) return REFUSED;\n if (whole === '' && fraction === '') return null;\n\n const magnitude = BigInt(`${whole}${fraction.padEnd(options.scaleDigits, '0')}`);\n const signed = isNegative ? -magnitude : magnitude;\n\n const isTooLarge = signed > BigInt(Math.trunc(options.max));\n /* Under a positive `min` the field still takes the digits on the way up (\"0\" towards \"5\"). */\n const isTooSmall = signed < BigInt(Math.trunc(Math.min(options.min, 0)));\n if (isTooLarge || isTooSmall) return REFUSED;\n\n /* No negative zero: \"-0\" is 0. */\n return Number(signed) + 0;\n};\n\nexport type ScaledFormatOptions = {\n /** Decimal places the integer carries. */\n scaleDigits: number;\n /** Decimal places always shown (\"12,50\" at 2); trailing zeros past them are dropped. */\n minFractionDigits: number;\n /** Groups the whole part by three with a dot (\"1.234,5\"); off while the field is edited. */\n isGrouped: boolean;\n};\n\n/**\n * A scaled integer as text: `123450` at 2 → \"1.234,50\" (min 2) or \"1234,5\" (min 0, ungrouped).\n * Every carried digit that is not a trailing zero is shown — the field never hides part of the\n * value it holds.\n */\nexport const formatScaledValue = (value: number, options: ScaledFormatOptions): string => {\n const { scaleDigits, minFractionDigits, isGrouped } = options;\n const digits = String(Math.abs(value)).padStart(scaleDigits + 1, '0');\n const whole = digits.slice(0, digits.length - scaleDigits);\n const fraction = digits.slice(digits.length - scaleDigits).replace(/0+$/, '');\n const shownFraction = fraction.padEnd(Math.min(minFractionDigits, scaleDigits), '0');\n const shownWhole = isGrouped ? whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, '.') : whole;\n const sign = value < 0 ? '-' : '';\n\n return `${sign}${shownWhole}${shownFraction === '' ? '' : `,${shownFraction}`}`;\n};\n"],"names":["REFUSED","THOUSANDS","THOUSANDS_PREFIX","cleanScaledText","input","split","text","isNegative","body","whole","fraction","more","integer","point","rest","readScaledText","options","parts","allowedFraction","magnitude","signed","isTooLarge","isTooSmall","formatScaledValue","value","scaleDigits","minFractionDigits","isGrouped","digits","shownFraction","shownWhole"],"mappings":"AAiBO,MAAMA,IAAU,OAAO,SAAS,GAqBjCC,IAAY,4BAEZC,IAAmB,qCAMZC,IAAkB,CAACC,MAC9BA,EAAM,QAAQ,OAAO,EAAE,EAAE,QAAQ,0BAA0B,EAAE,GAGzDC,IAAQ,CAACC,MAAkF;AAC/F,QAAMC,IAAaD,EAAK,WAAW,GAAG,GAChCE,IAAOD,IAAaD,EAAK,MAAM,CAAC,IAAIA,GACpC,CAACG,GAAOC,GAAU,GAAGC,CAAI,IAAIH,EAAK,MAAM,GAAG;AAEjD,MAAIG,EAAK,SAAS,KAAKH,EAAK,SAAS,GAAG,EAAG,QAAO;AAElD,MAAIE,MAAa;AAEf,WADIA,EAAS,SAAS,GAAG,KACrBD,EAAM,SAAS,GAAG,KAAK,CAACR,EAAU,KAAKQ,CAAK,IAAU,OAEnD,EAAE,YAAAF,GAAY,OAAOE,EAAM,WAAW,KAAK,EAAE,GAAG,UAAAC,EAAA;AAGzD,MAAIT,EAAU,KAAKQ,CAAK,UAAU,EAAE,YAAAF,GAAY,OAAOE,EAAM,WAAW,KAAK,EAAE,GAAG,UAAU,GAAA;AAE5F,QAAM,CAACG,GAASC,GAAO,GAAGC,CAAI,IAAIL,EAAM,MAAM,GAAG;AACjD,SAAIK,EAAK,SAAS,IAAU,OAErB,EAAE,YAAAP,GAAY,OAAOK,GAAS,UAAUC,KAAS,GAAA;AAC1D,GAGaE,IAAiB,CAACX,GAAeY,MAA8C;AAC1F,QAAMV,IAAOH,EAAgBC,CAAK;AAClC,MAAI,WAAW,KAAKE,CAAI,EAAG,QAAON;AAClC,QAAMiB,IAAQZ,EAAMC,CAAI;AAExB,MAAI,CAACW,GAAO;AAEV,UAAMT,IAAOF,EAAK,WAAW,GAAG,IAAIA,EAAK,MAAM,CAAC,IAAIA;AACpD,WAAOJ,EAAiB,KAAKM,CAAI,MAAMQ,EAAQ,MAAM,KAAK,CAACV,EAAK,WAAW,GAAG,KAC1E,OACAN;AAAA,EACN;AAEA,QAAM,EAAE,YAAAO,GAAY,OAAAE,GAAO,UAAAC,EAAA,IAAaO;AACxC,MAAIV,KAAcS,EAAQ,OAAO,EAAG,QAAOhB;AAC3C,QAAMkB,IAAkB,KAAK,IAAIF,EAAQ,mBAAmBA,EAAQ,WAAW;AAG/E,MAFIN,EAAS,SAASQ,KAElBA,MAAoB,KAAKZ,EAAK,SAAS,GAAG,EAAG,QAAON;AACxD,MAAIS,MAAU,MAAMC,MAAa,GAAI,QAAO;AAE5C,QAAMS,IAAY,OAAO,GAAGV,CAAK,GAAGC,EAAS,OAAOM,EAAQ,aAAa,GAAG,CAAC,EAAE,GACzEI,IAASb,IAAa,CAACY,IAAYA,GAEnCE,IAAaD,IAAS,OAAO,KAAK,MAAMJ,EAAQ,GAAG,CAAC,GAEpDM,IAAaF,IAAS,OAAO,KAAK,MAAM,KAAK,IAAIJ,EAAQ,KAAK,CAAC,CAAC,CAAC;AACvE,SAAIK,KAAcC,IAAmBtB,IAG9B,OAAOoB,CAAM,IAAI;AAC1B,GAgBaG,IAAoB,CAACC,GAAeR,MAAyC;AACxF,QAAM,EAAE,aAAAS,GAAa,mBAAAC,GAAmB,WAAAC,EAAA,IAAcX,GAChDY,IAAS,OAAO,KAAK,IAAIJ,CAAK,CAAC,EAAE,SAASC,IAAc,GAAG,GAAG,GAC9DhB,IAAQmB,EAAO,MAAM,GAAGA,EAAO,SAASH,CAAW,GAEnDI,IADWD,EAAO,MAAMA,EAAO,SAASH,CAAW,EAAE,QAAQ,OAAO,EAAE,EAC7C,OAAO,KAAK,IAAIC,GAAmBD,CAAW,GAAG,GAAG,GAC7EK,IAAaH,IAAYlB,EAAM,QAAQ,yBAAyB,GAAG,IAAIA;AAG7E,SAAO,GAFMe,IAAQ,IAAI,MAAM,EAEjB,GAAGM,CAAU,GAAGD,MAAkB,KAAK,KAAK,IAAIA,CAAa,EAAE;AAC/E;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@handijit/design"),r=require("@handijitcom/utils"),n="ui-theme-switching",o="(prefers-color-scheme: dark)",i=e=>e==="light"||e==="dark",s=()=>{var e;return r.isClient()&&((e=window.matchMedia)!=null&&e.call(window,o).matches)?"dark":"light"},c=()=>{if(!r.isClient())return"system";try{const e=window.localStorage.getItem(t.THEME_STORAGE_KEY);return i(e)?e:"system"}catch{return"system"}},m=()=>{if(!r.isClient())return"light";const e=document.documentElement.getAttribute(t.THEME_ATTRIBUTE);return i(e)?e:s()},T=e=>{if(r.isClient()){try{e==="system"?window.localStorage.removeItem(t.THEME_STORAGE_KEY):window.localStorage.setItem(t.THEME_STORAGE_KEY,e)}catch{}document.documentElement.setAttribute(t.THEME_ATTRIBUTE,e==="system"?s():e)}};exports.THEME_SWITCHING_CLASS=n;exports.applyThemePreference=T;exports.readActiveTheme=m;exports.readStoredPreference=c;exports.readSystemTheme=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@handijitcom/ui/design"),r=require("@handijitcom/utils"),n="ui-theme-switching",o="(prefers-color-scheme: dark)",i=e=>e==="light"||e==="dark",s=()=>{var e;return r.isClient()&&((e=window.matchMedia)!=null&&e.call(window,o).matches)?"dark":"light"},c=()=>{if(!r.isClient())return"system";try{const e=window.localStorage.getItem(t.THEME_STORAGE_KEY);return i(e)?e:"system"}catch{return"system"}},m=()=>{if(!r.isClient())return"light";const e=document.documentElement.getAttribute(t.THEME_ATTRIBUTE);return i(e)?e:s()},T=e=>{if(r.isClient()){try{e==="system"?window.localStorage.removeItem(t.THEME_STORAGE_KEY):window.localStorage.setItem(t.THEME_STORAGE_KEY,e)}catch{}document.documentElement.setAttribute(t.THEME_ATTRIBUTE,e==="system"?s():e)}};exports.THEME_SWITCHING_CLASS=n;exports.applyThemePreference=T;exports.readActiveTheme=m;exports.readStoredPreference=c;exports.readSystemTheme=s;
2
2
  //# sourceMappingURL=theme.helper.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme.helper.cjs","sources":["../../src/helpers/theme.helper.ts"],"sourcesContent":["import {\n THEME_ATTRIBUTE,\n THEME_STORAGE_KEY,\n type ThemeName,\n type ThemePreference,\n} from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Turns transitions off for one frame while the theme flips (see `base.scss`). */\nexport const THEME_SWITCHING_CLASS = 'ui-theme-switching';\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\nconst isThemeName = (value: unknown): value is ThemeName => value === 'light' || value === 'dark';\n\n/** The operating system's setting; `light` on the server. */\nexport const readSystemTheme = (): ThemeName =>\n isClient() && window.matchMedia?.(DARK_QUERY).matches ? 'dark' : 'light';\n\n/**\n * The user's stored choice. \"System\" is the absence of the key, and a storage that throws (private\n * window, blocked site data) counts as no choice — the same reading as the design boot script.\n */\nexport const readStoredPreference = (): ThemePreference => {\n if (!isClient()) return 'system';\n\n try {\n const stored = window.localStorage.getItem(THEME_STORAGE_KEY);\n return isThemeName(stored) ? stored : 'system';\n } catch {\n return 'system';\n }\n};\n\n/** The theme drawn on the page: the root attribute when it names a theme, else the system's. */\nexport const readActiveTheme = (): ThemeName => {\n if (!isClient()) return 'light';\n\n const attribute = document.documentElement.getAttribute(THEME_ATTRIBUTE);\n return isThemeName(attribute) ? attribute : readSystemTheme();\n};\n\n/**\n * Stores the choice and applies it to the root element, the way `@handijit/design` documents it:\n * only `light` / `dark` are stored, \"system\" removes the key, and the attribute always carries the\n * resolved theme so the boot script and this function agree.\n */\nexport const applyThemePreference = (preference: ThemePreference): void => {\n if (!isClient()) return;\n\n try {\n if (preference === 'system') window.localStorage.removeItem(THEME_STORAGE_KEY);\n else window.localStorage.setItem(THEME_STORAGE_KEY, preference);\n } catch {\n /* The choice still applies for this page view; it just cannot be remembered. */\n }\n\n document.documentElement.setAttribute(\n THEME_ATTRIBUTE,\n preference === 'system' ? readSystemTheme() : preference,\n );\n};\n"],"names":["THEME_SWITCHING_CLASS","DARK_QUERY","isThemeName","value","readSystemTheme","isClient","_a","readStoredPreference","stored","THEME_STORAGE_KEY","readActiveTheme","attribute","THEME_ATTRIBUTE","applyThemePreference","preference"],"mappings":"oJASaA,EAAwB,qBAE/BC,EAAa,+BAEbC,EAAeC,GAAuCA,IAAU,SAAWA,IAAU,OAG9EC,EAAkB,IAAA,OAC7BC,OAAAA,EAAAA,SAAA,KAAcC,EAAA,OAAO,aAAP,MAAAA,EAAA,YAAoBL,GAAY,SAAU,OAAS,SAMtDM,EAAuB,IAAuB,CACzD,GAAI,CAACF,EAAAA,SAAA,EAAY,MAAO,SAExB,GAAI,CACF,MAAMG,EAAS,OAAO,aAAa,QAAQC,EAAAA,iBAAiB,EAC5D,OAAOP,EAAYM,CAAM,EAAIA,EAAS,QACxC,MAAQ,CACN,MAAO,QACT,CACF,EAGaE,EAAkB,IAAiB,CAC9C,GAAI,CAACL,EAAAA,SAAA,EAAY,MAAO,QAExB,MAAMM,EAAY,SAAS,gBAAgB,aAAaC,EAAAA,eAAe,EACvE,OAAOV,EAAYS,CAAS,EAAIA,EAAYP,EAAA,CAC9C,EAOaS,EAAwBC,GAAsC,CACzE,GAAKT,EAAAA,WAEL,IAAI,CACES,IAAe,SAAU,OAAO,aAAa,WAAWL,EAAAA,iBAAiB,EACxE,OAAO,aAAa,QAAQA,EAAAA,kBAAmBK,CAAU,CAChE,MAAQ,CAER,CAEA,SAAS,gBAAgB,aACvBF,EAAAA,gBACAE,IAAe,SAAWV,IAAoBU,CAAA,EAElD"}
1
+ {"version":3,"file":"theme.helper.cjs","sources":["../../src/helpers/theme.helper.ts"],"sourcesContent":["import {\n THEME_ATTRIBUTE,\n THEME_STORAGE_KEY,\n type ThemeName,\n type ThemePreference,\n} from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Turns transitions off for one frame while the theme flips (see `base.scss`). */\nexport const THEME_SWITCHING_CLASS = 'ui-theme-switching';\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\nconst isThemeName = (value: unknown): value is ThemeName => value === 'light' || value === 'dark';\n\n/** The operating system's setting; `light` on the server. */\nexport const readSystemTheme = (): ThemeName =>\n isClient() && window.matchMedia?.(DARK_QUERY).matches ? 'dark' : 'light';\n\n/**\n * The user's stored choice. \"System\" is the absence of the key, and a storage that throws (private\n * window, blocked site data) counts as no choice — the same reading as the design boot script.\n */\nexport const readStoredPreference = (): ThemePreference => {\n if (!isClient()) return 'system';\n\n try {\n const stored = window.localStorage.getItem(THEME_STORAGE_KEY);\n return isThemeName(stored) ? stored : 'system';\n } catch {\n return 'system';\n }\n};\n\n/** The theme drawn on the page: the root attribute when it names a theme, else the system's. */\nexport const readActiveTheme = (): ThemeName => {\n if (!isClient()) return 'light';\n\n const attribute = document.documentElement.getAttribute(THEME_ATTRIBUTE);\n return isThemeName(attribute) ? attribute : readSystemTheme();\n};\n\n/**\n * Stores the choice and applies it to the root element, the way `@handijitcom/ui/design` documents it:\n * only `light` / `dark` are stored, \"system\" removes the key, and the attribute always carries the\n * resolved theme so the boot script and this function agree.\n */\nexport const applyThemePreference = (preference: ThemePreference): void => {\n if (!isClient()) return;\n\n try {\n if (preference === 'system') window.localStorage.removeItem(THEME_STORAGE_KEY);\n else window.localStorage.setItem(THEME_STORAGE_KEY, preference);\n } catch {\n /* The choice still applies for this page view; it just cannot be remembered. */\n }\n\n document.documentElement.setAttribute(\n THEME_ATTRIBUTE,\n preference === 'system' ? readSystemTheme() : preference,\n );\n};\n"],"names":["THEME_SWITCHING_CLASS","DARK_QUERY","isThemeName","value","readSystemTheme","isClient","_a","readStoredPreference","stored","THEME_STORAGE_KEY","readActiveTheme","attribute","THEME_ATTRIBUTE","applyThemePreference","preference"],"mappings":"0JASaA,EAAwB,qBAE/BC,EAAa,+BAEbC,EAAeC,GAAuCA,IAAU,SAAWA,IAAU,OAG9EC,EAAkB,IAAA,OAC7BC,OAAAA,EAAAA,SAAA,KAAcC,EAAA,OAAO,aAAP,MAAAA,EAAA,YAAoBL,GAAY,SAAU,OAAS,SAMtDM,EAAuB,IAAuB,CACzD,GAAI,CAACF,EAAAA,SAAA,EAAY,MAAO,SAExB,GAAI,CACF,MAAMG,EAAS,OAAO,aAAa,QAAQC,EAAAA,iBAAiB,EAC5D,OAAOP,EAAYM,CAAM,EAAIA,EAAS,QACxC,MAAQ,CACN,MAAO,QACT,CACF,EAGaE,EAAkB,IAAiB,CAC9C,GAAI,CAACL,EAAAA,SAAA,EAAY,MAAO,QAExB,MAAMM,EAAY,SAAS,gBAAgB,aAAaC,EAAAA,eAAe,EACvE,OAAOV,EAAYS,CAAS,EAAIA,EAAYP,EAAA,CAC9C,EAOaS,EAAwBC,GAAsC,CACzE,GAAKT,EAAAA,WAEL,IAAI,CACES,IAAe,SAAU,OAAO,aAAa,WAAWL,EAAAA,iBAAiB,EACxE,OAAO,aAAa,QAAQA,EAAAA,kBAAmBK,CAAU,CAChE,MAAQ,CAER,CAEA,SAAS,gBAAgB,aACvBF,EAAAA,gBACAE,IAAe,SAAWV,IAAoBU,CAAA,EAElD"}
@@ -1,4 +1,4 @@
1
- import { ThemeName, ThemePreference } from '@handijit/design';
1
+ import { ThemeName, ThemePreference } from '@handijitcom/ui/design';
2
2
  /** Turns transitions off for one frame while the theme flips (see `base.scss`). */
3
3
  export declare const THEME_SWITCHING_CLASS = "ui-theme-switching";
4
4
  /** The operating system's setting; `light` on the server. */
@@ -11,7 +11,7 @@ export declare const readStoredPreference: () => ThemePreference;
11
11
  /** The theme drawn on the page: the root attribute when it names a theme, else the system's. */
12
12
  export declare const readActiveTheme: () => ThemeName;
13
13
  /**
14
- * Stores the choice and applies it to the root element, the way `@handijit/design` documents it:
14
+ * Stores the choice and applies it to the root element, the way `@handijitcom/ui/design` documents it:
15
15
  * only `light` / `dark` are stored, "system" removes the key, and the attribute always carries the
16
16
  * resolved theme so the boot script and this function agree.
17
17
  */
@@ -1,4 +1,4 @@
1
- import { ThemeName, ThemePreference } from '@handijit/design';
1
+ import { ThemeName, ThemePreference } from '@handijitcom/ui/design';
2
2
  /** Turns transitions off for one frame while the theme flips (see `base.scss`). */
3
3
  export declare const THEME_SWITCHING_CLASS = "ui-theme-switching";
4
4
  /** The operating system's setting; `light` on the server. */
@@ -11,7 +11,7 @@ export declare const readStoredPreference: () => ThemePreference;
11
11
  /** The theme drawn on the page: the root attribute when it names a theme, else the system's. */
12
12
  export declare const readActiveTheme: () => ThemeName;
13
13
  /**
14
- * Stores the choice and applies it to the root element, the way `@handijit/design` documents it:
14
+ * Stores the choice and applies it to the root element, the way `@handijitcom/ui/design` documents it:
15
15
  * only `light` / `dark` are stored, "system" removes the key, and the attribute always carries the
16
16
  * resolved theme so the boot script and this function agree.
17
17
  */
@@ -1,4 +1,4 @@
1
- import { THEME_STORAGE_KEY as r, THEME_ATTRIBUTE as o } from "@handijit/design";
1
+ import { THEME_STORAGE_KEY as r, THEME_ATTRIBUTE as o } from "@handijitcom/ui/design";
2
2
  import { isClient as e } from "@handijitcom/utils";
3
3
  const a = "ui-theme-switching", n = "(prefers-color-scheme: dark)", s = (t) => t === "light" || t === "dark", m = () => {
4
4
  var t;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.helper.js","sources":["../../src/helpers/theme.helper.ts"],"sourcesContent":["import {\n THEME_ATTRIBUTE,\n THEME_STORAGE_KEY,\n type ThemeName,\n type ThemePreference,\n} from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Turns transitions off for one frame while the theme flips (see `base.scss`). */\nexport const THEME_SWITCHING_CLASS = 'ui-theme-switching';\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\nconst isThemeName = (value: unknown): value is ThemeName => value === 'light' || value === 'dark';\n\n/** The operating system's setting; `light` on the server. */\nexport const readSystemTheme = (): ThemeName =>\n isClient() && window.matchMedia?.(DARK_QUERY).matches ? 'dark' : 'light';\n\n/**\n * The user's stored choice. \"System\" is the absence of the key, and a storage that throws (private\n * window, blocked site data) counts as no choice — the same reading as the design boot script.\n */\nexport const readStoredPreference = (): ThemePreference => {\n if (!isClient()) return 'system';\n\n try {\n const stored = window.localStorage.getItem(THEME_STORAGE_KEY);\n return isThemeName(stored) ? stored : 'system';\n } catch {\n return 'system';\n }\n};\n\n/** The theme drawn on the page: the root attribute when it names a theme, else the system's. */\nexport const readActiveTheme = (): ThemeName => {\n if (!isClient()) return 'light';\n\n const attribute = document.documentElement.getAttribute(THEME_ATTRIBUTE);\n return isThemeName(attribute) ? attribute : readSystemTheme();\n};\n\n/**\n * Stores the choice and applies it to the root element, the way `@handijit/design` documents it:\n * only `light` / `dark` are stored, \"system\" removes the key, and the attribute always carries the\n * resolved theme so the boot script and this function agree.\n */\nexport const applyThemePreference = (preference: ThemePreference): void => {\n if (!isClient()) return;\n\n try {\n if (preference === 'system') window.localStorage.removeItem(THEME_STORAGE_KEY);\n else window.localStorage.setItem(THEME_STORAGE_KEY, preference);\n } catch {\n /* The choice still applies for this page view; it just cannot be remembered. */\n }\n\n document.documentElement.setAttribute(\n THEME_ATTRIBUTE,\n preference === 'system' ? readSystemTheme() : preference,\n );\n};\n"],"names":["THEME_SWITCHING_CLASS","DARK_QUERY","isThemeName","value","readSystemTheme","isClient","_a","readStoredPreference","stored","THEME_STORAGE_KEY","readActiveTheme","attribute","THEME_ATTRIBUTE","applyThemePreference","preference"],"mappings":";;AASO,MAAMA,IAAwB,sBAE/BC,IAAa,gCAEbC,IAAc,CAACC,MAAuCA,MAAU,WAAWA,MAAU,QAG9EC,IAAkB,MAAA;;AAC7B,SAAAC,EAAA,OAAcC,IAAA,OAAO,eAAP,QAAAA,EAAA,aAAoBL,GAAY,WAAU,SAAS;AAAA,GAMtDM,IAAuB,MAAuB;AACzD,MAAI,CAACF,EAAA,EAAY,QAAO;AAExB,MAAI;AACF,UAAMG,IAAS,OAAO,aAAa,QAAQC,CAAiB;AAC5D,WAAOP,EAAYM,CAAM,IAAIA,IAAS;AAAA,EACxC,QAAQ;AACN,WAAO;AAAA,EACT;AACF,GAGaE,IAAkB,MAAiB;AAC9C,MAAI,CAACL,EAAA,EAAY,QAAO;AAExB,QAAMM,IAAY,SAAS,gBAAgB,aAAaC,CAAe;AACvE,SAAOV,EAAYS,CAAS,IAAIA,IAAYP,EAAA;AAC9C,GAOaS,IAAuB,CAACC,MAAsC;AACzE,MAAKT,KAEL;AAAA,QAAI;AACF,MAAIS,MAAe,WAAU,OAAO,aAAa,WAAWL,CAAiB,IACxE,OAAO,aAAa,QAAQA,GAAmBK,CAAU;AAAA,IAChE,QAAQ;AAAA,IAER;AAEA,aAAS,gBAAgB;AAAA,MACvBF;AAAA,MACAE,MAAe,WAAWV,MAAoBU;AAAA,IAAA;AAAA;AAElD;"}
1
+ {"version":3,"file":"theme.helper.js","sources":["../../src/helpers/theme.helper.ts"],"sourcesContent":["import {\n THEME_ATTRIBUTE,\n THEME_STORAGE_KEY,\n type ThemeName,\n type ThemePreference,\n} from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Turns transitions off for one frame while the theme flips (see `base.scss`). */\nexport const THEME_SWITCHING_CLASS = 'ui-theme-switching';\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\nconst isThemeName = (value: unknown): value is ThemeName => value === 'light' || value === 'dark';\n\n/** The operating system's setting; `light` on the server. */\nexport const readSystemTheme = (): ThemeName =>\n isClient() && window.matchMedia?.(DARK_QUERY).matches ? 'dark' : 'light';\n\n/**\n * The user's stored choice. \"System\" is the absence of the key, and a storage that throws (private\n * window, blocked site data) counts as no choice — the same reading as the design boot script.\n */\nexport const readStoredPreference = (): ThemePreference => {\n if (!isClient()) return 'system';\n\n try {\n const stored = window.localStorage.getItem(THEME_STORAGE_KEY);\n return isThemeName(stored) ? stored : 'system';\n } catch {\n return 'system';\n }\n};\n\n/** The theme drawn on the page: the root attribute when it names a theme, else the system's. */\nexport const readActiveTheme = (): ThemeName => {\n if (!isClient()) return 'light';\n\n const attribute = document.documentElement.getAttribute(THEME_ATTRIBUTE);\n return isThemeName(attribute) ? attribute : readSystemTheme();\n};\n\n/**\n * Stores the choice and applies it to the root element, the way `@handijitcom/ui/design` documents it:\n * only `light` / `dark` are stored, \"system\" removes the key, and the attribute always carries the\n * resolved theme so the boot script and this function agree.\n */\nexport const applyThemePreference = (preference: ThemePreference): void => {\n if (!isClient()) return;\n\n try {\n if (preference === 'system') window.localStorage.removeItem(THEME_STORAGE_KEY);\n else window.localStorage.setItem(THEME_STORAGE_KEY, preference);\n } catch {\n /* The choice still applies for this page view; it just cannot be remembered. */\n }\n\n document.documentElement.setAttribute(\n THEME_ATTRIBUTE,\n preference === 'system' ? readSystemTheme() : preference,\n );\n};\n"],"names":["THEME_SWITCHING_CLASS","DARK_QUERY","isThemeName","value","readSystemTheme","isClient","_a","readStoredPreference","stored","THEME_STORAGE_KEY","readActiveTheme","attribute","THEME_ATTRIBUTE","applyThemePreference","preference"],"mappings":";;AASO,MAAMA,IAAwB,sBAE/BC,IAAa,gCAEbC,IAAc,CAACC,MAAuCA,MAAU,WAAWA,MAAU,QAG9EC,IAAkB,MAAA;;AAC7B,SAAAC,EAAA,OAAcC,IAAA,OAAO,eAAP,QAAAA,EAAA,aAAoBL,GAAY,WAAU,SAAS;AAAA,GAMtDM,IAAuB,MAAuB;AACzD,MAAI,CAACF,EAAA,EAAY,QAAO;AAExB,MAAI;AACF,UAAMG,IAAS,OAAO,aAAa,QAAQC,CAAiB;AAC5D,WAAOP,EAAYM,CAAM,IAAIA,IAAS;AAAA,EACxC,QAAQ;AACN,WAAO;AAAA,EACT;AACF,GAGaE,IAAkB,MAAiB;AAC9C,MAAI,CAACL,EAAA,EAAY,QAAO;AAExB,QAAMM,IAAY,SAAS,gBAAgB,aAAaC,CAAe;AACvE,SAAOV,EAAYS,CAAS,IAAIA,IAAYP,EAAA;AAC9C,GAOaS,IAAuB,CAACC,MAAsC;AACzE,MAAKT,KAEL;AAAA,QAAI;AACF,MAAIS,MAAe,WAAU,OAAO,aAAa,WAAWL,CAAiB,IACxE,OAAO,aAAa,QAAQA,GAAmBK,CAAU;AAAA,IAChE,QAAQ;AAAA,IAER;AAEA,aAAS,gBAAgB;AAAA,MACvBF;AAAA,MACAE,MAAe,WAAWV,MAAoBU;AAAA,IAAA;AAAA;AAElD;"}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),T=require("@handijit/design"),l=require("@handijitcom/utils"),e=require("../helpers/theme.helper.cjs"),E=()=>{const[m,o]=r.useState("system"),[c,i]=r.useState("light"),[h,S]=r.useState(!1);r.useEffect(()=>{var d;if(!l.isClient())return;const t=()=>{o(e.readStoredPreference()),i(e.readActiveTheme())};t(),S(!0);const n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[T.THEME_ATTRIBUTE]});const s=(d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)"),u=()=>{e.readStoredPreference()==="system"&&e.applyThemePreference("system"),t()};return s==null||s.addEventListener("change",u),()=>{n.disconnect(),s==null||s.removeEventListener("change",u)}},[]);const a=r.useCallback(t=>{if(!l.isClient())return;const n=document.documentElement;n.classList.add(e.THEME_SWITCHING_CLASS),e.applyThemePreference(t),o(t),i(e.readActiveTheme()),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>n.classList.remove(e.THEME_SWITCHING_CLASS))})},[]),f=r.useCallback(()=>a(c==="dark"?"light":"dark"),[c,a]);return{scheme:c,preference:m,setScheme:a,toggle:f,isReady:h}};exports.default=E;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),T=require("@handijitcom/ui/design"),l=require("@handijitcom/utils"),e=require("../helpers/theme.helper.cjs"),E=()=>{const[m,o]=r.useState("system"),[c,i]=r.useState("light"),[h,S]=r.useState(!1);r.useEffect(()=>{var d;if(!l.isClient())return;const t=()=>{o(e.readStoredPreference()),i(e.readActiveTheme())};t(),S(!0);const n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[T.THEME_ATTRIBUTE]});const s=(d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)"),u=()=>{e.readStoredPreference()==="system"&&e.applyThemePreference("system"),t()};return s==null||s.addEventListener("change",u),()=>{n.disconnect(),s==null||s.removeEventListener("change",u)}},[]);const a=r.useCallback(t=>{if(!l.isClient())return;const n=document.documentElement;n.classList.add(e.THEME_SWITCHING_CLASS),e.applyThemePreference(t),o(t),i(e.readActiveTheme()),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>n.classList.remove(e.THEME_SWITCHING_CLASS))})},[]),f=r.useCallback(()=>a(c==="dark"?"light":"dark"),[c,a]);return{scheme:c,preference:m,setScheme:a,toggle:f,isReady:h}};exports.default=E;
2
2
  //# sourceMappingURL=useUiTheme.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUiTheme.cjs","sources":["../../src/hooks/useUiTheme.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { THEME_ATTRIBUTE } from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\nimport {\n applyThemePreference,\n readActiveTheme,\n readStoredPreference,\n THEME_SWITCHING_CLASS,\n} from '../helpers/theme.helper';\nimport type { UiColorPreference, UiColorScheme, UiThemeState } from '@/types/theme.type';\n\n/**\n * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijit/design`.\n *\n * The choice lives where the design boot script reads it (`localStorage[\"hd-theme\"]`), so a choice\n * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.\n * @example const { scheme, toggle, isReady } = useUiTheme();\n */\nconst useUiTheme = (): UiThemeState => {\n /*\n * The first value is a constant: the server has no `document`, and reading the real value during\n * the first client render produced a hydration mismatch. `isReady` tells when it is real.\n */\n const [preference, setPreferenceState] = useState<UiColorPreference>('system');\n const [scheme, setSchemeState] = useState<UiColorScheme>('light');\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n if (!isClient()) return;\n\n const sync = () => {\n setPreferenceState(readStoredPreference());\n setSchemeState(readActiveTheme());\n };\n\n sync();\n setIsReady(true);\n\n /* The boot script, another hook instance or the application may write the attribute. */\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE],\n });\n\n /*\n * Without the boot script nobody rewrites the attribute when the system setting changes; a page\n * that follows the system has to be moved here.\n */\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n const handleSystemChange = () => {\n if (readStoredPreference() === 'system') applyThemePreference('system');\n sync();\n };\n query?.addEventListener('change', handleSystemChange);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', handleSystemChange);\n };\n }, []);\n\n const setScheme = useCallback((next: UiColorPreference) => {\n if (!isClient()) return;\n\n const root = document.documentElement;\n\n root.classList.add(THEME_SWITCHING_CLASS);\n applyThemePreference(next);\n setPreferenceState(next);\n setSchemeState(readActiveTheme());\n\n /* The class comes off on the NEXT frame, after the new colours have been painted once. */\n window.requestAnimationFrame(() => {\n window.requestAnimationFrame(() => root.classList.remove(THEME_SWITCHING_CLASS));\n });\n }, []);\n\n const toggle = useCallback(\n () => setScheme(scheme === 'dark' ? 'light' : 'dark'),\n [scheme, setScheme],\n );\n\n return { scheme, preference, setScheme, toggle, isReady };\n};\n\nexport default useUiTheme;\n"],"names":["useUiTheme","preference","setPreferenceState","useState","scheme","setSchemeState","isReady","setIsReady","useEffect","isClient","sync","readStoredPreference","readActiveTheme","observer","THEME_ATTRIBUTE","query","_a","handleSystemChange","applyThemePreference","setScheme","useCallback","next","root","THEME_SWITCHING_CLASS","toggle"],"mappings":"yPAqBMA,EAAa,IAAoB,CAKrC,KAAM,CAACC,EAAYC,CAAkB,EAAIC,EAAAA,SAA4B,QAAQ,EACvE,CAACC,EAAQC,CAAc,EAAIF,EAAAA,SAAwB,OAAO,EAC1D,CAACG,EAASC,CAAU,EAAIJ,EAAAA,SAAS,EAAK,EAE5CK,EAAAA,UAAU,IAAM,OACd,GAAI,CAACC,EAAAA,WAAY,OAEjB,MAAMC,EAAO,IAAM,CACjBR,EAAmBS,EAAAA,sBAAsB,EACzCN,EAAeO,EAAAA,iBAAiB,CAClC,EAEAF,EAAA,EACAH,EAAW,EAAI,EAGf,MAAMM,EAAW,IAAI,iBAAiBH,CAAI,EAC1CG,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAACC,EAAAA,eAAe,CAAA,CAClC,EAMD,MAAMC,GAAQC,EAAA,OAAO,aAAP,YAAAA,EAAA,YAAoB,gCAC5BC,EAAqB,IAAM,CAC3BN,uBAAA,IAA2B,UAAUO,EAAAA,qBAAqB,QAAQ,EACtER,EAAA,CACF,EACA,OAAAK,GAAA,MAAAA,EAAO,iBAAiB,SAAUE,GAE3B,IAAM,CACXJ,EAAS,WAAA,EACTE,GAAA,MAAAA,EAAO,oBAAoB,SAAUE,EACvC,CACF,EAAG,CAAA,CAAE,EAEL,MAAME,EAAYC,cAAaC,GAA4B,CACzD,GAAI,CAACZ,EAAAA,WAAY,OAEjB,MAAMa,EAAO,SAAS,gBAEtBA,EAAK,UAAU,IAAIC,uBAAqB,EACxCL,EAAAA,qBAAqBG,CAAI,EACzBnB,EAAmBmB,CAAI,EACvBhB,EAAeO,EAAAA,iBAAiB,EAGhC,OAAO,sBAAsB,IAAM,CACjC,OAAO,sBAAsB,IAAMU,EAAK,UAAU,OAAOC,EAAAA,qBAAqB,CAAC,CACjF,CAAC,CACH,EAAG,CAAA,CAAE,EAECC,EAASJ,EAAAA,YACb,IAAMD,EAAUf,IAAW,OAAS,QAAU,MAAM,EACpD,CAACA,EAAQe,CAAS,CAAA,EAGpB,MAAO,CAAE,OAAAf,EAAQ,WAAAH,EAAY,UAAAkB,EAAW,OAAAK,EAAQ,QAAAlB,CAAA,CAClD"}
1
+ {"version":3,"file":"useUiTheme.cjs","sources":["../../src/hooks/useUiTheme.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { THEME_ATTRIBUTE } from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\nimport {\n applyThemePreference,\n readActiveTheme,\n readStoredPreference,\n THEME_SWITCHING_CLASS,\n} from '../helpers/theme.helper';\nimport type { UiColorPreference, UiColorScheme, UiThemeState } from '@/types/theme.type';\n\n/**\n * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijitcom/ui/design`.\n *\n * The choice lives where the design boot script reads it (`localStorage[\"hd-theme\"]`), so a choice\n * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.\n * @example const { scheme, toggle, isReady } = useUiTheme();\n */\nconst useUiTheme = (): UiThemeState => {\n /*\n * The first value is a constant: the server has no `document`, and reading the real value during\n * the first client render produced a hydration mismatch. `isReady` tells when it is real.\n */\n const [preference, setPreferenceState] = useState<UiColorPreference>('system');\n const [scheme, setSchemeState] = useState<UiColorScheme>('light');\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n if (!isClient()) return;\n\n const sync = () => {\n setPreferenceState(readStoredPreference());\n setSchemeState(readActiveTheme());\n };\n\n sync();\n setIsReady(true);\n\n /* The boot script, another hook instance or the application may write the attribute. */\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE],\n });\n\n /*\n * Without the boot script nobody rewrites the attribute when the system setting changes; a page\n * that follows the system has to be moved here.\n */\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n const handleSystemChange = () => {\n if (readStoredPreference() === 'system') applyThemePreference('system');\n sync();\n };\n query?.addEventListener('change', handleSystemChange);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', handleSystemChange);\n };\n }, []);\n\n const setScheme = useCallback((next: UiColorPreference) => {\n if (!isClient()) return;\n\n const root = document.documentElement;\n\n root.classList.add(THEME_SWITCHING_CLASS);\n applyThemePreference(next);\n setPreferenceState(next);\n setSchemeState(readActiveTheme());\n\n /* The class comes off on the NEXT frame, after the new colours have been painted once. */\n window.requestAnimationFrame(() => {\n window.requestAnimationFrame(() => root.classList.remove(THEME_SWITCHING_CLASS));\n });\n }, []);\n\n const toggle = useCallback(\n () => setScheme(scheme === 'dark' ? 'light' : 'dark'),\n [scheme, setScheme],\n );\n\n return { scheme, preference, setScheme, toggle, isReady };\n};\n\nexport default useUiTheme;\n"],"names":["useUiTheme","preference","setPreferenceState","useState","scheme","setSchemeState","isReady","setIsReady","useEffect","isClient","sync","readStoredPreference","readActiveTheme","observer","THEME_ATTRIBUTE","query","_a","handleSystemChange","applyThemePreference","setScheme","useCallback","next","root","THEME_SWITCHING_CLASS","toggle"],"mappings":"+PAqBMA,EAAa,IAAoB,CAKrC,KAAM,CAACC,EAAYC,CAAkB,EAAIC,EAAAA,SAA4B,QAAQ,EACvE,CAACC,EAAQC,CAAc,EAAIF,EAAAA,SAAwB,OAAO,EAC1D,CAACG,EAASC,CAAU,EAAIJ,EAAAA,SAAS,EAAK,EAE5CK,EAAAA,UAAU,IAAM,OACd,GAAI,CAACC,EAAAA,WAAY,OAEjB,MAAMC,EAAO,IAAM,CACjBR,EAAmBS,EAAAA,sBAAsB,EACzCN,EAAeO,EAAAA,iBAAiB,CAClC,EAEAF,EAAA,EACAH,EAAW,EAAI,EAGf,MAAMM,EAAW,IAAI,iBAAiBH,CAAI,EAC1CG,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAACC,EAAAA,eAAe,CAAA,CAClC,EAMD,MAAMC,GAAQC,EAAA,OAAO,aAAP,YAAAA,EAAA,YAAoB,gCAC5BC,EAAqB,IAAM,CAC3BN,uBAAA,IAA2B,UAAUO,EAAAA,qBAAqB,QAAQ,EACtER,EAAA,CACF,EACA,OAAAK,GAAA,MAAAA,EAAO,iBAAiB,SAAUE,GAE3B,IAAM,CACXJ,EAAS,WAAA,EACTE,GAAA,MAAAA,EAAO,oBAAoB,SAAUE,EACvC,CACF,EAAG,CAAA,CAAE,EAEL,MAAME,EAAYC,cAAaC,GAA4B,CACzD,GAAI,CAACZ,EAAAA,WAAY,OAEjB,MAAMa,EAAO,SAAS,gBAEtBA,EAAK,UAAU,IAAIC,uBAAqB,EACxCL,EAAAA,qBAAqBG,CAAI,EACzBnB,EAAmBmB,CAAI,EACvBhB,EAAeO,EAAAA,iBAAiB,EAGhC,OAAO,sBAAsB,IAAM,CACjC,OAAO,sBAAsB,IAAMU,EAAK,UAAU,OAAOC,EAAAA,qBAAqB,CAAC,CACjF,CAAC,CACH,EAAG,CAAA,CAAE,EAECC,EAASJ,EAAAA,YACb,IAAMD,EAAUf,IAAW,OAAS,QAAU,MAAM,EACpD,CAACA,EAAQe,CAAS,CAAA,EAGpB,MAAO,CAAE,OAAAf,EAAQ,WAAAH,EAAY,UAAAkB,EAAW,OAAAK,EAAQ,QAAAlB,CAAA,CAClD"}
@@ -1,6 +1,6 @@
1
1
  import { UiThemeState } from '../types/theme.type.cjs';
2
2
  /**
3
- * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijit/design`.
3
+ * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijitcom/ui/design`.
4
4
  *
5
5
  * The choice lives where the design boot script reads it (`localStorage["hd-theme"]`), so a choice
6
6
  * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.
@@ -1,6 +1,6 @@
1
1
  import { UiThemeState } from '../types/theme.type.js';
2
2
  /**
3
- * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijit/design`.
3
+ * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijitcom/ui/design`.
4
4
  *
5
5
  * The choice lives where the design boot script reads it (`localStorage["hd-theme"]`), so a choice
6
6
  * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useState as o, useEffect as g, useCallback as d } from "react";
3
- import { THEME_ATTRIBUTE as w } from "@handijit/design";
3
+ import { THEME_ATTRIBUTE as w } from "@handijitcom/ui/design";
4
4
  import { isClient as u } from "@handijitcom/utils";
5
5
  import { THEME_SWITCHING_CLASS as l, applyThemePreference as f, readActiveTheme as h, readStoredPreference as E } from "../helpers/theme.helper.js";
6
6
  const L = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"useUiTheme.js","sources":["../../src/hooks/useUiTheme.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { THEME_ATTRIBUTE } from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\nimport {\n applyThemePreference,\n readActiveTheme,\n readStoredPreference,\n THEME_SWITCHING_CLASS,\n} from '../helpers/theme.helper';\nimport type { UiColorPreference, UiColorScheme, UiThemeState } from '@/types/theme.type';\n\n/**\n * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijit/design`.\n *\n * The choice lives where the design boot script reads it (`localStorage[\"hd-theme\"]`), so a choice\n * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.\n * @example const { scheme, toggle, isReady } = useUiTheme();\n */\nconst useUiTheme = (): UiThemeState => {\n /*\n * The first value is a constant: the server has no `document`, and reading the real value during\n * the first client render produced a hydration mismatch. `isReady` tells when it is real.\n */\n const [preference, setPreferenceState] = useState<UiColorPreference>('system');\n const [scheme, setSchemeState] = useState<UiColorScheme>('light');\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n if (!isClient()) return;\n\n const sync = () => {\n setPreferenceState(readStoredPreference());\n setSchemeState(readActiveTheme());\n };\n\n sync();\n setIsReady(true);\n\n /* The boot script, another hook instance or the application may write the attribute. */\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE],\n });\n\n /*\n * Without the boot script nobody rewrites the attribute when the system setting changes; a page\n * that follows the system has to be moved here.\n */\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n const handleSystemChange = () => {\n if (readStoredPreference() === 'system') applyThemePreference('system');\n sync();\n };\n query?.addEventListener('change', handleSystemChange);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', handleSystemChange);\n };\n }, []);\n\n const setScheme = useCallback((next: UiColorPreference) => {\n if (!isClient()) return;\n\n const root = document.documentElement;\n\n root.classList.add(THEME_SWITCHING_CLASS);\n applyThemePreference(next);\n setPreferenceState(next);\n setSchemeState(readActiveTheme());\n\n /* The class comes off on the NEXT frame, after the new colours have been painted once. */\n window.requestAnimationFrame(() => {\n window.requestAnimationFrame(() => root.classList.remove(THEME_SWITCHING_CLASS));\n });\n }, []);\n\n const toggle = useCallback(\n () => setScheme(scheme === 'dark' ? 'light' : 'dark'),\n [scheme, setScheme],\n );\n\n return { scheme, preference, setScheme, toggle, isReady };\n};\n\nexport default useUiTheme;\n"],"names":["useUiTheme","preference","setPreferenceState","useState","scheme","setSchemeState","isReady","setIsReady","useEffect","isClient","sync","readStoredPreference","readActiveTheme","observer","THEME_ATTRIBUTE","query","_a","handleSystemChange","applyThemePreference","setScheme","useCallback","next","root","THEME_SWITCHING_CLASS","toggle"],"mappings":";;;;;AAqBA,MAAMA,IAAa,MAAoB;AAKrC,QAAM,CAACC,GAAYC,CAAkB,IAAIC,EAA4B,QAAQ,GACvE,CAACC,GAAQC,CAAc,IAAIF,EAAwB,OAAO,GAC1D,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK;AAE5C,EAAAK,EAAU,MAAM;;AACd,QAAI,CAACC,IAAY;AAEjB,UAAMC,IAAO,MAAM;AACjB,MAAAR,EAAmBS,GAAsB,GACzCN,EAAeO,GAAiB;AAAA,IAClC;AAEA,IAAAF,EAAA,GACAH,EAAW,EAAI;AAGf,UAAMM,IAAW,IAAI,iBAAiBH,CAAI;AAC1C,IAAAG,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAACC,CAAe;AAAA,IAAA,CAClC;AAMD,UAAMC,KAAQC,IAAA,OAAO,eAAP,gBAAAA,EAAA,aAAoB,iCAC5BC,IAAqB,MAAM;AAC/B,MAAIN,EAAA,MAA2B,YAAUO,EAAqB,QAAQ,GACtER,EAAA;AAAA,IACF;AACA,WAAAK,KAAA,QAAAA,EAAO,iBAAiB,UAAUE,IAE3B,MAAM;AACX,MAAAJ,EAAS,WAAA,GACTE,KAAA,QAAAA,EAAO,oBAAoB,UAAUE;AAAA,IACvC;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAME,IAAYC,EAAY,CAACC,MAA4B;AACzD,QAAI,CAACZ,IAAY;AAEjB,UAAMa,IAAO,SAAS;AAEtB,IAAAA,EAAK,UAAU,IAAIC,CAAqB,GACxCL,EAAqBG,CAAI,GACzBnB,EAAmBmB,CAAI,GACvBhB,EAAeO,GAAiB,GAGhC,OAAO,sBAAsB,MAAM;AACjC,aAAO,sBAAsB,MAAMU,EAAK,UAAU,OAAOC,CAAqB,CAAC;AAAA,IACjF,CAAC;AAAA,EACH,GAAG,CAAA,CAAE,GAECC,IAASJ;AAAA,IACb,MAAMD,EAAUf,MAAW,SAAS,UAAU,MAAM;AAAA,IACpD,CAACA,GAAQe,CAAS;AAAA,EAAA;AAGpB,SAAO,EAAE,QAAAf,GAAQ,YAAAH,GAAY,WAAAkB,GAAW,QAAAK,GAAQ,SAAAlB,EAAA;AAClD;"}
1
+ {"version":3,"file":"useUiTheme.js","sources":["../../src/hooks/useUiTheme.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { THEME_ATTRIBUTE } from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\nimport {\n applyThemePreference,\n readActiveTheme,\n readStoredPreference,\n THEME_SWITCHING_CLASS,\n} from '../helpers/theme.helper';\nimport type { UiColorPreference, UiColorScheme, UiThemeState } from '@/types/theme.type';\n\n/**\n * Reads and changes the light/dark choice, on the `data-theme` contract of `@handijitcom/ui/design`.\n *\n * The choice lives where the design boot script reads it (`localStorage[\"hd-theme\"]`), so a choice\n * made here survives a reload without a flash when `UiThemeScript` is in `<head>`.\n * @example const { scheme, toggle, isReady } = useUiTheme();\n */\nconst useUiTheme = (): UiThemeState => {\n /*\n * The first value is a constant: the server has no `document`, and reading the real value during\n * the first client render produced a hydration mismatch. `isReady` tells when it is real.\n */\n const [preference, setPreferenceState] = useState<UiColorPreference>('system');\n const [scheme, setSchemeState] = useState<UiColorScheme>('light');\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n if (!isClient()) return;\n\n const sync = () => {\n setPreferenceState(readStoredPreference());\n setSchemeState(readActiveTheme());\n };\n\n sync();\n setIsReady(true);\n\n /* The boot script, another hook instance or the application may write the attribute. */\n const observer = new MutationObserver(sync);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE],\n });\n\n /*\n * Without the boot script nobody rewrites the attribute when the system setting changes; a page\n * that follows the system has to be moved here.\n */\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n const handleSystemChange = () => {\n if (readStoredPreference() === 'system') applyThemePreference('system');\n sync();\n };\n query?.addEventListener('change', handleSystemChange);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', handleSystemChange);\n };\n }, []);\n\n const setScheme = useCallback((next: UiColorPreference) => {\n if (!isClient()) return;\n\n const root = document.documentElement;\n\n root.classList.add(THEME_SWITCHING_CLASS);\n applyThemePreference(next);\n setPreferenceState(next);\n setSchemeState(readActiveTheme());\n\n /* The class comes off on the NEXT frame, after the new colours have been painted once. */\n window.requestAnimationFrame(() => {\n window.requestAnimationFrame(() => root.classList.remove(THEME_SWITCHING_CLASS));\n });\n }, []);\n\n const toggle = useCallback(\n () => setScheme(scheme === 'dark' ? 'light' : 'dark'),\n [scheme, setScheme],\n );\n\n return { scheme, preference, setScheme, toggle, isReady };\n};\n\nexport default useUiTheme;\n"],"names":["useUiTheme","preference","setPreferenceState","useState","scheme","setSchemeState","isReady","setIsReady","useEffect","isClient","sync","readStoredPreference","readActiveTheme","observer","THEME_ATTRIBUTE","query","_a","handleSystemChange","applyThemePreference","setScheme","useCallback","next","root","THEME_SWITCHING_CLASS","toggle"],"mappings":";;;;;AAqBA,MAAMA,IAAa,MAAoB;AAKrC,QAAM,CAACC,GAAYC,CAAkB,IAAIC,EAA4B,QAAQ,GACvE,CAACC,GAAQC,CAAc,IAAIF,EAAwB,OAAO,GAC1D,CAACG,GAASC,CAAU,IAAIJ,EAAS,EAAK;AAE5C,EAAAK,EAAU,MAAM;;AACd,QAAI,CAACC,IAAY;AAEjB,UAAMC,IAAO,MAAM;AACjB,MAAAR,EAAmBS,GAAsB,GACzCN,EAAeO,GAAiB;AAAA,IAClC;AAEA,IAAAF,EAAA,GACAH,EAAW,EAAI;AAGf,UAAMM,IAAW,IAAI,iBAAiBH,CAAI;AAC1C,IAAAG,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAACC,CAAe;AAAA,IAAA,CAClC;AAMD,UAAMC,KAAQC,IAAA,OAAO,eAAP,gBAAAA,EAAA,aAAoB,iCAC5BC,IAAqB,MAAM;AAC/B,MAAIN,EAAA,MAA2B,YAAUO,EAAqB,QAAQ,GACtER,EAAA;AAAA,IACF;AACA,WAAAK,KAAA,QAAAA,EAAO,iBAAiB,UAAUE,IAE3B,MAAM;AACX,MAAAJ,EAAS,WAAA,GACTE,KAAA,QAAAA,EAAO,oBAAoB,UAAUE;AAAA,IACvC;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAME,IAAYC,EAAY,CAACC,MAA4B;AACzD,QAAI,CAACZ,IAAY;AAEjB,UAAMa,IAAO,SAAS;AAEtB,IAAAA,EAAK,UAAU,IAAIC,CAAqB,GACxCL,EAAqBG,CAAI,GACzBnB,EAAmBmB,CAAI,GACvBhB,EAAeO,GAAiB,GAGhC,OAAO,sBAAsB,MAAM;AACjC,aAAO,sBAAsB,MAAMU,EAAK,UAAU,OAAOC,CAAqB,CAAC;AAAA,IACjF,CAAC;AAAA,EACH,GAAG,CAAA,CAAE,GAECC,IAASJ;AAAA,IACb,MAAMD,EAAUf,MAAW,SAAS,UAAU,MAAM;AAAA,IACpD,CAACA,GAAQe,CAAS;AAAA,EAAA;AAGpB,SAAO,EAAE,QAAAf,GAAQ,YAAAH,GAAY,WAAAkB,GAAW,QAAAK,GAAQ,SAAAlB,EAAA;AAClD;"}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),m=require("@handijit/design"),E=require("@handijitcom/utils"),b="currentColor",g=(e,t)=>{const s=getComputedStyle(t);return Object.fromEntries(e.map(r=>[r,s.getPropertyValue(m.cssVarName(r)).trim()||b]))},v=(e,t)=>Object.keys(e).every(s=>e[s]===t[s]),h=e=>{const t=e.join("|"),[s,r]=d.useState(()=>Object.fromEntries(e.map(c=>[c,b])));return d.useEffect(()=>{var l;if(!E.isClient())return;const c=t.split("|"),o=()=>r(i=>{const a=g(c,document.documentElement);return v(i,a)&&Object.keys(i).length===c.length?i:a});o();const u=new MutationObserver(o);u.observe(document.documentElement,{attributes:!0,attributeFilter:[m.THEME_ATTRIBUTE,"style","class"]}),u.observe(document.head,{childList:!0});const n=(l=window.matchMedia)==null?void 0:l.call(window,"(prefers-color-scheme: dark)");return n==null||n.addEventListener("change",o),()=>{u.disconnect(),n==null||n.removeEventListener("change",o)}},[t]),s};exports.default=h;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("react"),m=require("@handijitcom/ui/design"),E=require("@handijitcom/utils"),b="currentColor",g=(e,t)=>{const s=getComputedStyle(t);return Object.fromEntries(e.map(r=>[r,s.getPropertyValue(m.cssVarName(r)).trim()||b]))},v=(e,t)=>Object.keys(e).every(s=>e[s]===t[s]),h=e=>{const t=e.join("|"),[s,r]=d.useState(()=>Object.fromEntries(e.map(c=>[c,b])));return d.useEffect(()=>{var l;if(!E.isClient())return;const c=t.split("|"),o=()=>r(i=>{const a=g(c,document.documentElement);return v(i,a)&&Object.keys(i).length===c.length?i:a});o();const u=new MutationObserver(o);u.observe(document.documentElement,{attributes:!0,attributeFilter:[m.THEME_ATTRIBUTE,"style","class"]}),u.observe(document.head,{childList:!0});const n=(l=window.matchMedia)==null?void 0:l.call(window,"(prefers-color-scheme: dark)");return n==null||n.addEventListener("change",o),()=>{u.disconnect(),n==null||n.removeEventListener("change",o)}},[t]),s};exports.default=h;
2
2
  //# sourceMappingURL=useUiTokens.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUiTokens.cjs","sources":["../../src/hooks/useUiTokens.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { cssVarName, THEME_ATTRIBUTE, type TokenName } from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Returned on the server and in the first frame: drawing libraries paint an empty string black. */\nconst FALLBACK = 'currentColor';\n\nconst read = <TName extends TokenName>(\n names: readonly TName[],\n element: Element,\n): Record<TName, string> => {\n const style = getComputedStyle(element);\n\n return Object.fromEntries(\n names.map(name => [name, style.getPropertyValue(cssVarName(name)).trim() || FALLBACK]),\n ) as Record<TName, string>;\n};\n\nconst isSame = (first: Record<string, string>, second: Record<string, string>): boolean =>\n Object.keys(first).every(key => first[key] === second[key]);\n\n/**\n * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable\n * (a canvas, an SVG attribute that rejects `var(--…)`).\n * Names are the token names of `@handijit/design` without the `--hd-` prefix. The values follow the\n * root theme (`data-theme`, the system setting, an inline override on `<html>`).\n * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.\n * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);\n */\nconst useUiTokens = <TName extends TokenName>(names: readonly TName[]): Record<TName, string> => {\n /* The array may be a new object on every render; the subscription follows the NAMES. */\n const key = names.join('|');\n\n const [values, setValues] = useState(\n () => Object.fromEntries(names.map(name => [name, FALLBACK])) as Record<TName, string>,\n );\n\n useEffect(() => {\n if (!isClient()) return;\n\n const list = key.split('|') as TName[];\n const update = () =>\n setValues(previous => {\n const next = read(list, document.documentElement);\n return isSame(previous, next) && Object.keys(previous).length === list.length\n ? previous\n : next;\n });\n\n update();\n\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE, 'style', 'class'],\n });\n /* A stylesheet added later (the application's brand override) changes the values too. */\n observer.observe(document.head, { childList: true });\n\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n query?.addEventListener('change', update);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', update);\n };\n }, [key]);\n\n return values;\n};\n\nexport default useUiTokens;\n"],"names":["FALLBACK","read","names","element","style","name","cssVarName","isSame","first","second","key","useUiTokens","values","setValues","useState","useEffect","isClient","list","update","previous","next","observer","THEME_ATTRIBUTE","query","_a"],"mappings":"gNAOMA,EAAW,eAEXC,EAAO,CACXC,EACAC,IAC0B,CAC1B,MAAMC,EAAQ,iBAAiBD,CAAO,EAEtC,OAAO,OAAO,YACZD,EAAM,IAAIG,GAAQ,CAACA,EAAMD,EAAM,iBAAiBE,EAAAA,WAAWD,CAAI,CAAC,EAAE,KAAA,GAAUL,CAAQ,CAAC,CAAA,CAEzF,EAEMO,EAAS,CAACC,EAA+BC,IAC7C,OAAO,KAAKD,CAAK,EAAE,SAAaA,EAAME,CAAG,IAAMD,EAAOC,CAAG,CAAC,EAUtDC,EAAwCT,GAAmD,CAE/F,MAAMQ,EAAMR,EAAM,KAAK,GAAG,EAEpB,CAACU,EAAQC,CAAS,EAAIC,EAAAA,SAC1B,IAAM,OAAO,YAAYZ,EAAM,OAAY,CAACG,EAAML,CAAQ,CAAC,CAAC,CAAA,EAG9De,OAAAA,EAAAA,UAAU,IAAM,OACd,GAAI,CAACC,EAAAA,WAAY,OAEjB,MAAMC,EAAOP,EAAI,MAAM,GAAG,EACpBQ,EAAS,IACbL,EAAUM,GAAY,CACpB,MAAMC,EAAOnB,EAAKgB,EAAM,SAAS,eAAe,EAChD,OAAOV,EAAOY,EAAUC,CAAI,GAAK,OAAO,KAAKD,CAAQ,EAAE,SAAWF,EAAK,OACnEE,EACAC,CACN,CAAC,EAEHF,EAAA,EAEA,MAAMG,EAAW,IAAI,iBAAiBH,CAAM,EAC5CG,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAACC,kBAAiB,QAAS,OAAO,CAAA,CACpD,EAEDD,EAAS,QAAQ,SAAS,KAAM,CAAE,UAAW,GAAM,EAEnD,MAAME,GAAQC,EAAA,OAAO,aAAP,YAAAA,EAAA,YAAoB,gCAClC,OAAAD,GAAA,MAAAA,EAAO,iBAAiB,SAAUL,GAE3B,IAAM,CACXG,EAAS,WAAA,EACTE,GAAA,MAAAA,EAAO,oBAAoB,SAAUL,EACvC,CACF,EAAG,CAACR,CAAG,CAAC,EAEDE,CACT"}
1
+ {"version":3,"file":"useUiTokens.cjs","sources":["../../src/hooks/useUiTokens.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { cssVarName, THEME_ATTRIBUTE, type TokenName } from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Returned on the server and in the first frame: drawing libraries paint an empty string black. */\nconst FALLBACK = 'currentColor';\n\nconst read = <TName extends TokenName>(\n names: readonly TName[],\n element: Element,\n): Record<TName, string> => {\n const style = getComputedStyle(element);\n\n return Object.fromEntries(\n names.map(name => [name, style.getPropertyValue(cssVarName(name)).trim() || FALLBACK]),\n ) as Record<TName, string>;\n};\n\nconst isSame = (first: Record<string, string>, second: Record<string, string>): boolean =>\n Object.keys(first).every(key => first[key] === second[key]);\n\n/**\n * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable\n * (a canvas, an SVG attribute that rejects `var(--…)`).\n * Names are the token names of `@handijitcom/ui/design` without the `--hd-` prefix. The values follow the\n * root theme (`data-theme`, the system setting, an inline override on `<html>`).\n * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.\n * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);\n */\nconst useUiTokens = <TName extends TokenName>(names: readonly TName[]): Record<TName, string> => {\n /* The array may be a new object on every render; the subscription follows the NAMES. */\n const key = names.join('|');\n\n const [values, setValues] = useState(\n () => Object.fromEntries(names.map(name => [name, FALLBACK])) as Record<TName, string>,\n );\n\n useEffect(() => {\n if (!isClient()) return;\n\n const list = key.split('|') as TName[];\n const update = () =>\n setValues(previous => {\n const next = read(list, document.documentElement);\n return isSame(previous, next) && Object.keys(previous).length === list.length\n ? previous\n : next;\n });\n\n update();\n\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE, 'style', 'class'],\n });\n /* A stylesheet added later (the application's brand override) changes the values too. */\n observer.observe(document.head, { childList: true });\n\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n query?.addEventListener('change', update);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', update);\n };\n }, [key]);\n\n return values;\n};\n\nexport default useUiTokens;\n"],"names":["FALLBACK","read","names","element","style","name","cssVarName","isSame","first","second","key","useUiTokens","values","setValues","useState","useEffect","isClient","list","update","previous","next","observer","THEME_ATTRIBUTE","query","_a"],"mappings":"sNAOMA,EAAW,eAEXC,EAAO,CACXC,EACAC,IAC0B,CAC1B,MAAMC,EAAQ,iBAAiBD,CAAO,EAEtC,OAAO,OAAO,YACZD,EAAM,IAAIG,GAAQ,CAACA,EAAMD,EAAM,iBAAiBE,EAAAA,WAAWD,CAAI,CAAC,EAAE,KAAA,GAAUL,CAAQ,CAAC,CAAA,CAEzF,EAEMO,EAAS,CAACC,EAA+BC,IAC7C,OAAO,KAAKD,CAAK,EAAE,SAAaA,EAAME,CAAG,IAAMD,EAAOC,CAAG,CAAC,EAUtDC,EAAwCT,GAAmD,CAE/F,MAAMQ,EAAMR,EAAM,KAAK,GAAG,EAEpB,CAACU,EAAQC,CAAS,EAAIC,EAAAA,SAC1B,IAAM,OAAO,YAAYZ,EAAM,OAAY,CAACG,EAAML,CAAQ,CAAC,CAAC,CAAA,EAG9De,OAAAA,EAAAA,UAAU,IAAM,OACd,GAAI,CAACC,EAAAA,WAAY,OAEjB,MAAMC,EAAOP,EAAI,MAAM,GAAG,EACpBQ,EAAS,IACbL,EAAUM,GAAY,CACpB,MAAMC,EAAOnB,EAAKgB,EAAM,SAAS,eAAe,EAChD,OAAOV,EAAOY,EAAUC,CAAI,GAAK,OAAO,KAAKD,CAAQ,EAAE,SAAWF,EAAK,OACnEE,EACAC,CACN,CAAC,EAEHF,EAAA,EAEA,MAAMG,EAAW,IAAI,iBAAiBH,CAAM,EAC5CG,EAAS,QAAQ,SAAS,gBAAiB,CACzC,WAAY,GACZ,gBAAiB,CAACC,kBAAiB,QAAS,OAAO,CAAA,CACpD,EAEDD,EAAS,QAAQ,SAAS,KAAM,CAAE,UAAW,GAAM,EAEnD,MAAME,GAAQC,EAAA,OAAO,aAAP,YAAAA,EAAA,YAAoB,gCAClC,OAAAD,GAAA,MAAAA,EAAO,iBAAiB,SAAUL,GAE3B,IAAM,CACXG,EAAS,WAAA,EACTE,GAAA,MAAAA,EAAO,oBAAoB,SAAUL,EACvC,CACF,EAAG,CAACR,CAAG,CAAC,EAEDE,CACT"}
@@ -1,8 +1,8 @@
1
- import { TokenName } from '@handijit/design';
1
+ import { TokenName } from '@handijitcom/ui/design';
2
2
  /**
3
3
  * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable
4
4
  * (a canvas, an SVG attribute that rejects `var(--…)`).
5
- * Names are the token names of `@handijit/design` without the `--hd-` prefix. The values follow the
5
+ * Names are the token names of `@handijitcom/ui/design` without the `--hd-` prefix. The values follow the
6
6
  * root theme (`data-theme`, the system setting, an inline override on `<html>`).
7
7
  * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.
8
8
  * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);
@@ -1,8 +1,8 @@
1
- import { TokenName } from '@handijit/design';
1
+ import { TokenName } from '@handijitcom/ui/design';
2
2
  /**
3
3
  * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable
4
4
  * (a canvas, an SVG attribute that rejects `var(--…)`).
5
- * Names are the token names of `@handijit/design` without the `--hd-` prefix. The values follow the
5
+ * Names are the token names of `@handijitcom/ui/design` without the `--hd-` prefix. The values follow the
6
6
  * root theme (`data-theme`, the system setting, an inline override on `<html>`).
7
7
  * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.
8
8
  * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useState as d, useEffect as b } from "react";
3
- import { THEME_ATTRIBUTE as E, cssVarName as f } from "@handijit/design";
3
+ import { THEME_ATTRIBUTE as E, cssVarName as f } from "@handijitcom/ui/design";
4
4
  import { isClient as p } from "@handijitcom/utils";
5
5
  const l = "currentColor", h = (e, t) => {
6
6
  const n = getComputedStyle(t);
@@ -1 +1 @@
1
- {"version":3,"file":"useUiTokens.js","sources":["../../src/hooks/useUiTokens.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { cssVarName, THEME_ATTRIBUTE, type TokenName } from '@handijit/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Returned on the server and in the first frame: drawing libraries paint an empty string black. */\nconst FALLBACK = 'currentColor';\n\nconst read = <TName extends TokenName>(\n names: readonly TName[],\n element: Element,\n): Record<TName, string> => {\n const style = getComputedStyle(element);\n\n return Object.fromEntries(\n names.map(name => [name, style.getPropertyValue(cssVarName(name)).trim() || FALLBACK]),\n ) as Record<TName, string>;\n};\n\nconst isSame = (first: Record<string, string>, second: Record<string, string>): boolean =>\n Object.keys(first).every(key => first[key] === second[key]);\n\n/**\n * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable\n * (a canvas, an SVG attribute that rejects `var(--…)`).\n * Names are the token names of `@handijit/design` without the `--hd-` prefix. The values follow the\n * root theme (`data-theme`, the system setting, an inline override on `<html>`).\n * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.\n * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);\n */\nconst useUiTokens = <TName extends TokenName>(names: readonly TName[]): Record<TName, string> => {\n /* The array may be a new object on every render; the subscription follows the NAMES. */\n const key = names.join('|');\n\n const [values, setValues] = useState(\n () => Object.fromEntries(names.map(name => [name, FALLBACK])) as Record<TName, string>,\n );\n\n useEffect(() => {\n if (!isClient()) return;\n\n const list = key.split('|') as TName[];\n const update = () =>\n setValues(previous => {\n const next = read(list, document.documentElement);\n return isSame(previous, next) && Object.keys(previous).length === list.length\n ? previous\n : next;\n });\n\n update();\n\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE, 'style', 'class'],\n });\n /* A stylesheet added later (the application's brand override) changes the values too. */\n observer.observe(document.head, { childList: true });\n\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n query?.addEventListener('change', update);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', update);\n };\n }, [key]);\n\n return values;\n};\n\nexport default useUiTokens;\n"],"names":["FALLBACK","read","names","element","style","name","cssVarName","isSame","first","second","key","useUiTokens","values","setValues","useState","useEffect","isClient","list","update","previous","next","observer","THEME_ATTRIBUTE","query","_a"],"mappings":";;;;AAOA,MAAMA,IAAW,gBAEXC,IAAO,CACXC,GACAC,MAC0B;AAC1B,QAAMC,IAAQ,iBAAiBD,CAAO;AAEtC,SAAO,OAAO;AAAA,IACZD,EAAM,IAAI,CAAAG,MAAQ,CAACA,GAAMD,EAAM,iBAAiBE,EAAWD,CAAI,CAAC,EAAE,KAAA,KAAUL,CAAQ,CAAC;AAAA,EAAA;AAEzF,GAEMO,IAAS,CAACC,GAA+BC,MAC7C,OAAO,KAAKD,CAAK,EAAE,MAAM,OAAOA,EAAME,CAAG,MAAMD,EAAOC,CAAG,CAAC,GAUtDC,IAAc,CAA0BT,MAAmD;AAE/F,QAAMQ,IAAMR,EAAM,KAAK,GAAG,GAEpB,CAACU,GAAQC,CAAS,IAAIC;AAAA,IAC1B,MAAM,OAAO,YAAYZ,EAAM,IAAI,OAAQ,CAACG,GAAML,CAAQ,CAAC,CAAC;AAAA,EAAA;AAG9D,SAAAe,EAAU,MAAM;;AACd,QAAI,CAACC,IAAY;AAEjB,UAAMC,IAAOP,EAAI,MAAM,GAAG,GACpBQ,IAAS,MACbL,EAAU,CAAAM,MAAY;AACpB,YAAMC,IAAOnB,EAAKgB,GAAM,SAAS,eAAe;AAChD,aAAOV,EAAOY,GAAUC,CAAI,KAAK,OAAO,KAAKD,CAAQ,EAAE,WAAWF,EAAK,SACnEE,IACAC;AAAA,IACN,CAAC;AAEH,IAAAF,EAAA;AAEA,UAAMG,IAAW,IAAI,iBAAiBH,CAAM;AAC5C,IAAAG,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAACC,GAAiB,SAAS,OAAO;AAAA,IAAA,CACpD,GAEDD,EAAS,QAAQ,SAAS,MAAM,EAAE,WAAW,IAAM;AAEnD,UAAME,KAAQC,IAAA,OAAO,eAAP,gBAAAA,EAAA,aAAoB;AAClC,WAAAD,KAAA,QAAAA,EAAO,iBAAiB,UAAUL,IAE3B,MAAM;AACX,MAAAG,EAAS,WAAA,GACTE,KAAA,QAAAA,EAAO,oBAAoB,UAAUL;AAAA,IACvC;AAAA,EACF,GAAG,CAACR,CAAG,CAAC,GAEDE;AACT;"}
1
+ {"version":3,"file":"useUiTokens.js","sources":["../../src/hooks/useUiTokens.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { cssVarName, THEME_ATTRIBUTE, type TokenName } from '@handijitcom/ui/design';\nimport { isClient } from '@handijitcom/utils';\n\n/** Returned on the server and in the first frame: drawing libraries paint an empty string black. */\nconst FALLBACK = 'currentColor';\n\nconst read = <TName extends TokenName>(\n names: readonly TName[],\n element: Element,\n): Record<TName, string> => {\n const style = getComputedStyle(element);\n\n return Object.fromEntries(\n names.map(name => [name, style.getPropertyValue(cssVarName(name)).trim() || FALLBACK]),\n ) as Record<TName, string>;\n};\n\nconst isSame = (first: Record<string, string>, second: Record<string, string>): boolean =>\n Object.keys(first).every(key => first[key] === second[key]);\n\n/**\n * The RESOLVED values of design tokens — for drawing libraries that cannot read a CSS variable\n * (a canvas, an SVG attribute that rejects `var(--…)`).\n * Names are the token names of `@handijitcom/ui/design` without the `--hd-` prefix. The values follow the\n * root theme (`data-theme`, the system setting, an inline override on `<html>`).\n * ⚠ Every value is `currentColor` in the server output and in the first frame before hydration.\n * @example const colors = useUiTokens(['chart-1', 'chart-2', 'border']);\n */\nconst useUiTokens = <TName extends TokenName>(names: readonly TName[]): Record<TName, string> => {\n /* The array may be a new object on every render; the subscription follows the NAMES. */\n const key = names.join('|');\n\n const [values, setValues] = useState(\n () => Object.fromEntries(names.map(name => [name, FALLBACK])) as Record<TName, string>,\n );\n\n useEffect(() => {\n if (!isClient()) return;\n\n const list = key.split('|') as TName[];\n const update = () =>\n setValues(previous => {\n const next = read(list, document.documentElement);\n return isSame(previous, next) && Object.keys(previous).length === list.length\n ? previous\n : next;\n });\n\n update();\n\n const observer = new MutationObserver(update);\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [THEME_ATTRIBUTE, 'style', 'class'],\n });\n /* A stylesheet added later (the application's brand override) changes the values too. */\n observer.observe(document.head, { childList: true });\n\n const query = window.matchMedia?.('(prefers-color-scheme: dark)');\n query?.addEventListener('change', update);\n\n return () => {\n observer.disconnect();\n query?.removeEventListener('change', update);\n };\n }, [key]);\n\n return values;\n};\n\nexport default useUiTokens;\n"],"names":["FALLBACK","read","names","element","style","name","cssVarName","isSame","first","second","key","useUiTokens","values","setValues","useState","useEffect","isClient","list","update","previous","next","observer","THEME_ATTRIBUTE","query","_a"],"mappings":";;;;AAOA,MAAMA,IAAW,gBAEXC,IAAO,CACXC,GACAC,MAC0B;AAC1B,QAAMC,IAAQ,iBAAiBD,CAAO;AAEtC,SAAO,OAAO;AAAA,IACZD,EAAM,IAAI,CAAAG,MAAQ,CAACA,GAAMD,EAAM,iBAAiBE,EAAWD,CAAI,CAAC,EAAE,KAAA,KAAUL,CAAQ,CAAC;AAAA,EAAA;AAEzF,GAEMO,IAAS,CAACC,GAA+BC,MAC7C,OAAO,KAAKD,CAAK,EAAE,MAAM,OAAOA,EAAME,CAAG,MAAMD,EAAOC,CAAG,CAAC,GAUtDC,IAAc,CAA0BT,MAAmD;AAE/F,QAAMQ,IAAMR,EAAM,KAAK,GAAG,GAEpB,CAACU,GAAQC,CAAS,IAAIC;AAAA,IAC1B,MAAM,OAAO,YAAYZ,EAAM,IAAI,OAAQ,CAACG,GAAML,CAAQ,CAAC,CAAC;AAAA,EAAA;AAG9D,SAAAe,EAAU,MAAM;;AACd,QAAI,CAACC,IAAY;AAEjB,UAAMC,IAAOP,EAAI,MAAM,GAAG,GACpBQ,IAAS,MACbL,EAAU,CAAAM,MAAY;AACpB,YAAMC,IAAOnB,EAAKgB,GAAM,SAAS,eAAe;AAChD,aAAOV,EAAOY,GAAUC,CAAI,KAAK,OAAO,KAAKD,CAAQ,EAAE,WAAWF,EAAK,SACnEE,IACAC;AAAA,IACN,CAAC;AAEH,IAAAF,EAAA;AAEA,UAAMG,IAAW,IAAI,iBAAiBH,CAAM;AAC5C,IAAAG,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAACC,GAAiB,SAAS,OAAO;AAAA,IAAA,CACpD,GAEDD,EAAS,QAAQ,SAAS,MAAM,EAAE,WAAW,IAAM;AAEnD,UAAME,KAAQC,IAAA,OAAO,eAAP,gBAAAA,EAAA,aAAoB;AAClC,WAAAD,KAAA,QAAAA,EAAO,iBAAiB,UAAUL,IAE3B,MAAM;AACX,MAAAG,EAAS,WAAA,GACTE,KAAA,QAAAA,EAAO,oBAAoB,UAAUL;AAAA,IACvC;AAAA,EACF,GAAG,CAACR,CAAG,CAAC,GAEDE;AACT;"}
package/build/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./theme/UiProvider.cjs"),T=require("./theme/UiThemeScript.cjs"),$=require("./theme/context.cjs"),r=require("@handijit/design"),E=require("./helpers/focus.helper.cjs"),S=require("./hooks/useAnnounce.cjs"),_=require("./hooks/useUiTheme.cjs"),R=require("./hooks/useUiTokens.cjs"),B=require("./hooks/useStickToBottom.cjs"),p=require("./hooks/useListboxNavigation.cjs"),P=require("./hooks/usePositioning.cjs"),A=require("./hooks/useVirtualList.cjs"),I=require("./enums/ui-variant.enum.cjs"),m=require("./enums/ui-size.enum.cjs"),e=require("./constants/breakpoint.constants.cjs"),d=require("./helpers/text.helper.cjs"),O=require("./components/Button/index.cjs"),C=require("./components/IconButton/index.cjs"),b=require("./components/TextLink/index.cjs"),g=require("./components/Tooltip/index.cjs"),o=require("./components/Menu/index.cjs"),M=require("./components/Popover/index.cjs"),D=require("./components/Chip/index.cjs"),y=require("./components/ChipGroup/index.cjs"),U=require("./components/Combobox/index.cjs"),h=require("./components/SegmentedControl/index.cjs"),H=require("./components/Select/index.cjs"),k=require("./components/Checkbox/index.cjs"),L=require("./components/Switch/index.cjs"),F=require("./components/Radio/index.cjs"),w=require("./components/RadioCard/index.cjs"),v=require("./components/RangeSlider/index.cjs"),K=require("./components/RatingInput/index.cjs"),N=require("./components/QuantityStepper/index.cjs"),Q=require("./components/TableCheckbox/index.cjs"),V=require("./components/Input/index.cjs"),Y=require("./components/PasswordInput/index.cjs"),j=require("./components/ScaledInput/index.cjs"),G=require("./components/MoneyInput/index.cjs"),z=require("./components/QuantityInput/index.cjs"),J=require("./components/RateInput/index.cjs"),W=require("./components/PercentInput/index.cjs"),X=require("./components/TagInput/index.cjs"),Z=require("./components/Textarea/index.cjs"),a=require("./components/DateField/index.cjs"),ee=require("./components/Field/index.cjs"),te=require("./components/FileUpload/index.cjs"),re=require("./components/Alert/index.cjs"),ie=require("./components/Avatar/index.cjs"),ne=require("./components/Badge/index.cjs"),ue=require("./components/Breadcrumb/index.cjs"),t=require("./components/Card/index.cjs"),de=require("./components/Carousel/index.cjs"),oe=require("./components/CodeBadge/index.cjs"),ae=require("./components/Kbd/index.cjs"),le=require("./components/StatusDot/index.cjs"),se=require("./components/CopyField/index.cjs"),ce=require("./components/Divider/index.cjs"),i=require("./components/Directory/index.cjs"),fe=require("./components/EmptyState/index.cjs"),qe=require("./components/PageHeader/index.cjs"),u=require("./components/Panel/index.cjs"),xe=require("./components/Price/index.cjs"),Te=require("./components/Rating/index.cjs"),$e=require("./components/SectionHeader/index.cjs"),Ee=require("./components/ScrollArea/index.cjs"),n=require("./components/Skeleton/index.cjs"),Se=require("./components/Stat/index.cjs"),_e=require("./components/SummaryCard/index.cjs"),l=require("./components/Progress/index.cjs"),Re=require("./components/Spinner/index.cjs"),s=require("./components/Toast/index.cjs"),Be=require("./components/ToastPortal/index.cjs"),pe=require("./components/Accordion/index.cjs"),Pe=require("./components/Disclosure/index.cjs"),Ae=require("./components/Steps/index.cjs"),Ie=require("./components/Tabs/index.cjs"),me=require("./components/Tile/index.cjs"),Oe=require("./components/Timeline/index.cjs"),Ce=require("./components/BottomSheet/index.cjs"),be=require("./components/Modal/index.cjs"),ge=require("./components/CommandPalette/index.cjs"),Me=require("./components/ConfirmDialog/index.cjs"),De=require("./components/Drawer/index.cjs"),ye=require("./components/PromptDialog/index.cjs"),c=require("./components/Table/index.cjs"),f=require("./components/DataTable/index.cjs"),q=require("./components/FilterBar/index.cjs"),Ue=require("./components/Pagination/index.cjs");exports.UiProvider=x.default;exports.UiThemeScript=T.default;exports.useUi=$.useUi;Object.defineProperty(exports,"THEME_ATTRIBUTE",{enumerable:!0,get:()=>r.THEME_ATTRIBUTE});Object.defineProperty(exports,"THEME_BOOT_SCRIPT",{enumerable:!0,get:()=>r.THEME_BOOT_SCRIPT});Object.defineProperty(exports,"THEME_BOOT_SCRIPT_HASH",{enumerable:!0,get:()=>r.THEME_BOOT_SCRIPT_HASH});Object.defineProperty(exports,"THEME_STORAGE_KEY",{enumerable:!0,get:()=>r.THEME_STORAGE_KEY});exports.hasOpenSurface=E.hasOpenSurface;exports.useAnnounce=S.default;exports.useUiTheme=_.default;exports.useUiTokens=R.default;exports.useStickToBottom=B.default;exports.useListboxNavigation=p.default;exports.usePositioning=P.default;exports.useVirtualList=A.default;exports.UIVariant=I.default;exports.UISize=m.default;exports.ABOVE_MOBILE_MEDIA_QUERY=e.ABOVE_MOBILE_MEDIA_QUERY;exports.ABOVE_TABLET_MEDIA_QUERY=e.ABOVE_TABLET_MEDIA_QUERY;exports.MOBILE_BREAKPOINT=e.MOBILE_BREAKPOINT;exports.SHEET_MEDIA_QUERY=e.SHEET_MEDIA_QUERY;exports.TABLET_BREAKPOINT=e.TABLET_BREAKPOINT;exports.TABLET_PORTRAIT_BREAKPOINT=e.TABLET_PORTRAIT_BREAKPOINT;exports.matchesSearch=d.matchesSearch;exports.normalizeSearchTerm=d.normalizeSearchTerm;exports.Button=O.default;exports.IconButton=C.default;exports.TextLink=b.default;exports.Tooltip=g.default;exports.ContextMenu=o.ContextMenu;exports.Menu=o.default;exports.Popover=M.default;exports.Chip=D.default;exports.ChipGroup=y.default;exports.Combobox=U.default;exports.SegmentedControl=h.default;exports.Select=H.default;exports.Checkbox=k.default;exports.Switch=L.default;exports.Radio=F.default;exports.RadioCard=w.default;exports.RangeSlider=v.default;exports.RatingInput=K.default;exports.QuantityStepper=N.default;exports.TableCheckbox=Q.default;exports.Input=V.default;exports.PasswordInput=Y.default;exports.ScaledInput=j.default;exports.MoneyInput=G.default;exports.QuantityInput=z.default;exports.RateInput=J.default;exports.PercentInput=W.default;exports.TagInput=X.default;exports.Textarea=Z.default;exports.DateField=a.default;exports.DateRange=a.DateRange;exports.Field=ee.default;exports.FileUpload=te.default;exports.Alert=re.default;exports.Avatar=ie.default;exports.Badge=ne.default;exports.Breadcrumb=ue.default;exports.Card=t.default;exports.CardBody=t.CardBody;exports.CardFooter=t.CardFooter;exports.CardMedia=t.CardMedia;exports.CardOverlay=t.CardOverlay;exports.Carousel=de.default;exports.CodeBadge=oe.default;exports.Kbd=ae.default;exports.StatusDot=le.default;exports.CopyField=se.default;exports.Divider=ce.default;exports.Directory=i.default;exports.DirectoryGroup=i.DirectoryGroup;exports.DirectoryJump=i.DirectoryJump;exports.DirectoryRow=i.DirectoryRow;exports.EmptyState=fe.default;exports.PageHeader=qe.default;exports.Panel=u.default;exports.PanelForm=u.PanelForm;exports.PanelRow=u.PanelRow;exports.Price=xe.default;exports.Rating=Te.default;exports.SectionHeader=$e.default;exports.ScrollArea=Ee.default;exports.Skeleton=n.default;exports.SkeletonCard=n.SkeletonCard;exports.SkeletonRows=n.SkeletonRows;exports.SkeletonTable=n.SkeletonTable;exports.Stat=Se.default;exports.SummaryCard=_e.default;exports.Progress=l.default;exports.ProgressCircle=l.ProgressCircle;exports.Spinner=Re.default;exports.ToastHub=s.default;exports.toast=s.toast;exports.ToastPortal=Be.default;exports.Accordion=pe.default;exports.Disclosure=Pe.default;exports.Steps=Ae.default;exports.Tabs=Ie.default;exports.Tile=me.default;exports.Timeline=Oe.default;exports.BottomSheet=Ce.default;exports.Modal=be.default;exports.CommandPalette=ge.default;exports.ConfirmDialog=Me.default;exports.Drawer=De.default;exports.PromptDialog=ye.default;exports.Table=c.default;exports.TableScroller=c.TableScroller;exports.DataTable=f.default;exports.DataTableRow=f.DataTableRow;exports.FilterBar=q.default;exports.FilterBarField=q.FilterBarField;exports.Pagination=Ue.default;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./theme/UiProvider.cjs"),T=require("./theme/UiThemeScript.cjs"),$=require("./theme/context.cjs"),r=require("@handijitcom/ui/design"),E=require("./helpers/focus.helper.cjs"),S=require("./hooks/useAnnounce.cjs"),_=require("./hooks/useUiTheme.cjs"),R=require("./hooks/useUiTokens.cjs"),B=require("./hooks/useStickToBottom.cjs"),p=require("./hooks/useListboxNavigation.cjs"),P=require("./hooks/usePositioning.cjs"),A=require("./hooks/useVirtualList.cjs"),I=require("./enums/ui-variant.enum.cjs"),m=require("./enums/ui-size.enum.cjs"),e=require("./constants/breakpoint.constants.cjs"),d=require("./helpers/text.helper.cjs"),O=require("./components/Button/index.cjs"),C=require("./components/IconButton/index.cjs"),b=require("./components/TextLink/index.cjs"),g=require("./components/Tooltip/index.cjs"),o=require("./components/Menu/index.cjs"),M=require("./components/Popover/index.cjs"),D=require("./components/Chip/index.cjs"),y=require("./components/ChipGroup/index.cjs"),U=require("./components/Combobox/index.cjs"),h=require("./components/SegmentedControl/index.cjs"),H=require("./components/Select/index.cjs"),k=require("./components/Checkbox/index.cjs"),L=require("./components/Switch/index.cjs"),F=require("./components/Radio/index.cjs"),w=require("./components/RadioCard/index.cjs"),v=require("./components/RangeSlider/index.cjs"),K=require("./components/RatingInput/index.cjs"),N=require("./components/QuantityStepper/index.cjs"),Q=require("./components/TableCheckbox/index.cjs"),V=require("./components/Input/index.cjs"),Y=require("./components/PasswordInput/index.cjs"),j=require("./components/ScaledInput/index.cjs"),G=require("./components/MoneyInput/index.cjs"),z=require("./components/QuantityInput/index.cjs"),J=require("./components/RateInput/index.cjs"),W=require("./components/PercentInput/index.cjs"),X=require("./components/TagInput/index.cjs"),Z=require("./components/Textarea/index.cjs"),a=require("./components/DateField/index.cjs"),ee=require("./components/Field/index.cjs"),te=require("./components/FileUpload/index.cjs"),re=require("./components/Alert/index.cjs"),ie=require("./components/Avatar/index.cjs"),ne=require("./components/Badge/index.cjs"),ue=require("./components/Breadcrumb/index.cjs"),t=require("./components/Card/index.cjs"),de=require("./components/Carousel/index.cjs"),oe=require("./components/CodeBadge/index.cjs"),ae=require("./components/Kbd/index.cjs"),le=require("./components/StatusDot/index.cjs"),se=require("./components/CopyField/index.cjs"),ce=require("./components/Divider/index.cjs"),i=require("./components/Directory/index.cjs"),fe=require("./components/EmptyState/index.cjs"),qe=require("./components/PageHeader/index.cjs"),u=require("./components/Panel/index.cjs"),xe=require("./components/Price/index.cjs"),Te=require("./components/Rating/index.cjs"),$e=require("./components/SectionHeader/index.cjs"),Ee=require("./components/ScrollArea/index.cjs"),n=require("./components/Skeleton/index.cjs"),Se=require("./components/Stat/index.cjs"),_e=require("./components/SummaryCard/index.cjs"),l=require("./components/Progress/index.cjs"),Re=require("./components/Spinner/index.cjs"),s=require("./components/Toast/index.cjs"),Be=require("./components/ToastPortal/index.cjs"),pe=require("./components/Accordion/index.cjs"),Pe=require("./components/Disclosure/index.cjs"),Ae=require("./components/Steps/index.cjs"),Ie=require("./components/Tabs/index.cjs"),me=require("./components/Tile/index.cjs"),Oe=require("./components/Timeline/index.cjs"),Ce=require("./components/BottomSheet/index.cjs"),be=require("./components/Modal/index.cjs"),ge=require("./components/CommandPalette/index.cjs"),Me=require("./components/ConfirmDialog/index.cjs"),De=require("./components/Drawer/index.cjs"),ye=require("./components/PromptDialog/index.cjs"),c=require("./components/Table/index.cjs"),f=require("./components/DataTable/index.cjs"),q=require("./components/FilterBar/index.cjs"),Ue=require("./components/Pagination/index.cjs");exports.UiProvider=x.default;exports.UiThemeScript=T.default;exports.useUi=$.useUi;Object.defineProperty(exports,"THEME_ATTRIBUTE",{enumerable:!0,get:()=>r.THEME_ATTRIBUTE});Object.defineProperty(exports,"THEME_BOOT_SCRIPT",{enumerable:!0,get:()=>r.THEME_BOOT_SCRIPT});Object.defineProperty(exports,"THEME_BOOT_SCRIPT_HASH",{enumerable:!0,get:()=>r.THEME_BOOT_SCRIPT_HASH});Object.defineProperty(exports,"THEME_STORAGE_KEY",{enumerable:!0,get:()=>r.THEME_STORAGE_KEY});exports.hasOpenSurface=E.hasOpenSurface;exports.useAnnounce=S.default;exports.useUiTheme=_.default;exports.useUiTokens=R.default;exports.useStickToBottom=B.default;exports.useListboxNavigation=p.default;exports.usePositioning=P.default;exports.useVirtualList=A.default;exports.UIVariant=I.default;exports.UISize=m.default;exports.ABOVE_MOBILE_MEDIA_QUERY=e.ABOVE_MOBILE_MEDIA_QUERY;exports.ABOVE_TABLET_MEDIA_QUERY=e.ABOVE_TABLET_MEDIA_QUERY;exports.MOBILE_BREAKPOINT=e.MOBILE_BREAKPOINT;exports.SHEET_MEDIA_QUERY=e.SHEET_MEDIA_QUERY;exports.TABLET_BREAKPOINT=e.TABLET_BREAKPOINT;exports.TABLET_PORTRAIT_BREAKPOINT=e.TABLET_PORTRAIT_BREAKPOINT;exports.matchesSearch=d.matchesSearch;exports.normalizeSearchTerm=d.normalizeSearchTerm;exports.Button=O.default;exports.IconButton=C.default;exports.TextLink=b.default;exports.Tooltip=g.default;exports.ContextMenu=o.ContextMenu;exports.Menu=o.default;exports.Popover=M.default;exports.Chip=D.default;exports.ChipGroup=y.default;exports.Combobox=U.default;exports.SegmentedControl=h.default;exports.Select=H.default;exports.Checkbox=k.default;exports.Switch=L.default;exports.Radio=F.default;exports.RadioCard=w.default;exports.RangeSlider=v.default;exports.RatingInput=K.default;exports.QuantityStepper=N.default;exports.TableCheckbox=Q.default;exports.Input=V.default;exports.PasswordInput=Y.default;exports.ScaledInput=j.default;exports.MoneyInput=G.default;exports.QuantityInput=z.default;exports.RateInput=J.default;exports.PercentInput=W.default;exports.TagInput=X.default;exports.Textarea=Z.default;exports.DateField=a.default;exports.DateRange=a.DateRange;exports.Field=ee.default;exports.FileUpload=te.default;exports.Alert=re.default;exports.Avatar=ie.default;exports.Badge=ne.default;exports.Breadcrumb=ue.default;exports.Card=t.default;exports.CardBody=t.CardBody;exports.CardFooter=t.CardFooter;exports.CardMedia=t.CardMedia;exports.CardOverlay=t.CardOverlay;exports.Carousel=de.default;exports.CodeBadge=oe.default;exports.Kbd=ae.default;exports.StatusDot=le.default;exports.CopyField=se.default;exports.Divider=ce.default;exports.Directory=i.default;exports.DirectoryGroup=i.DirectoryGroup;exports.DirectoryJump=i.DirectoryJump;exports.DirectoryRow=i.DirectoryRow;exports.EmptyState=fe.default;exports.PageHeader=qe.default;exports.Panel=u.default;exports.PanelForm=u.PanelForm;exports.PanelRow=u.PanelRow;exports.Price=xe.default;exports.Rating=Te.default;exports.SectionHeader=$e.default;exports.ScrollArea=Ee.default;exports.Skeleton=n.default;exports.SkeletonCard=n.SkeletonCard;exports.SkeletonRows=n.SkeletonRows;exports.SkeletonTable=n.SkeletonTable;exports.Stat=Se.default;exports.SummaryCard=_e.default;exports.Progress=l.default;exports.ProgressCircle=l.ProgressCircle;exports.Spinner=Re.default;exports.ToastHub=s.default;exports.toast=s.toast;exports.ToastPortal=Be.default;exports.Accordion=pe.default;exports.Disclosure=Pe.default;exports.Steps=Ae.default;exports.Tabs=Ie.default;exports.Tile=me.default;exports.Timeline=Oe.default;exports.BottomSheet=Ce.default;exports.Modal=be.default;exports.CommandPalette=ge.default;exports.ConfirmDialog=Me.default;exports.Drawer=De.default;exports.PromptDialog=ye.default;exports.Table=c.default;exports.TableScroller=c.TableScroller;exports.DataTable=f.default;exports.DataTableRow=f.DataTableRow;exports.FilterBar=q.default;exports.FilterBarField=q.FilterBarField;exports.Pagination=Ue.default;
2
2
  //# sourceMappingURL=index.cjs.map
package/build/index.d.cts CHANGED
@@ -5,7 +5,7 @@
5
5
  export { default as UiProvider } from './theme/UiProvider.cjs';
6
6
  export { default as UiThemeScript } from './theme/UiThemeScript.cjs';
7
7
  export { useUi } from './theme/context.cjs';
8
- export { THEME_ATTRIBUTE, THEME_BOOT_SCRIPT, THEME_BOOT_SCRIPT_HASH, THEME_STORAGE_KEY, } from '@handijit/design';
8
+ export { THEME_ATTRIBUTE, THEME_BOOT_SCRIPT, THEME_BOOT_SCRIPT_HASH, THEME_STORAGE_KEY, } from '@handijitcom/ui/design';
9
9
  export { hasOpenSurface } from './helpers/focus.helper.cjs';
10
10
  export { default as useAnnounce } from './hooks/useAnnounce.cjs';
11
11
  export { default as useUiTheme } from './hooks/useUiTheme.cjs';
package/build/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  export { default as UiProvider } from './theme/UiProvider.js';
6
6
  export { default as UiThemeScript } from './theme/UiThemeScript.js';
7
7
  export { useUi } from './theme/context.js';
8
- export { THEME_ATTRIBUTE, THEME_BOOT_SCRIPT, THEME_BOOT_SCRIPT_HASH, THEME_STORAGE_KEY, } from '@handijit/design';
8
+ export { THEME_ATTRIBUTE, THEME_BOOT_SCRIPT, THEME_BOOT_SCRIPT_HASH, THEME_STORAGE_KEY, } from '@handijitcom/ui/design';
9
9
  export { hasOpenSurface } from './helpers/focus.helper.js';
10
10
  export { default as useAnnounce } from './hooks/useAnnounce.js';
11
11
  export { default as useUiTheme } from './hooks/useUiTheme.js';
package/build/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { default as o } from "./theme/UiProvider.js";
2
2
  import { default as r } from "./theme/UiThemeScript.js";
3
3
  import { useUi as l } from "./theme/context.js";
4
- import { THEME_ATTRIBUTE as d, THEME_BOOT_SCRIPT as p, THEME_BOOT_SCRIPT_HASH as s, THEME_STORAGE_KEY as m } from "@handijit/design";
4
+ import { THEME_ATTRIBUTE as d, THEME_BOOT_SCRIPT as p, THEME_BOOT_SCRIPT_HASH as s, THEME_STORAGE_KEY as m } from "@handijitcom/ui/design";
5
5
  import { hasOpenSurface as i } from "./helpers/focus.helper.js";
6
6
  import { default as T } from "./hooks/useAnnounce.js";
7
7
  import { default as E } from "./hooks/useUiTheme.js";
@@ -1,6 +1,6 @@
1
1
  // SCSS API — `@use '@handijitcom/ui/scss' as ui;`
2
2
  // The one door through which a consumer takes the variables and mixins without copying them. The
3
- // variables are `var(--hd-…)` strings pointing at the tokens of `@handijit/design`: the theme is
3
+ // variables are `var(--hd-…)` strings pointing at the tokens of `@handijitcom/ui/design`: the theme is
4
4
  // resolved at run time, nothing is fixed at compile time.
5
5
  // ⚠ Every name that enters here is a VERSION COMMITMENT (see CLAUDE.md, "SCSS API").
6
6
  @forward 'variables';
@@ -1,8 +1,8 @@
1
- // SCSS names for the tokens of `@handijit/design`.
1
+ // SCSS names for the tokens of `@handijitcom/ui/design`.
2
2
  //
3
3
  // Nothing in this file holds a colour, a size or a duration of its own: every theme-aware value is a
4
4
  // `var(--hd-*)` reference, so the consuming application decides the values by loading
5
- // `@handijit/design/tokens.css` once. `__tests__/styles/design-contract.test.ts` fails when a name
5
+ // `@handijitcom/ui/tokens.css` once. `__tests__/styles/design-contract.test.ts` fails when a name
6
6
  // below points at a custom property the installed design package does not define.
7
7
  //
8
8
  // ⚠ The values are `var()` references: they cannot go through Sass colour functions (`darken`,
@@ -205,7 +205,7 @@ $z-tooltip: var(--hd-z-tooltip);
205
205
 
206
206
  // --- Breakpoints ---
207
207
  // Media queries cannot read custom properties, so these are the design values as numbers; the
208
- // contract test compares them with `breakpoints` from `@handijit/design`.
208
+ // contract test compares them with `breakpoints` from `@handijitcom/ui/design`.
209
209
  $breakpoint-sm: 640px;
210
210
  $breakpoint-md: 768px;
211
211
  $breakpoint-lg: 1024px;
@@ -1 +1 @@
1
- {"version":3,"file":"UiProvider.cjs","sources":["../../src/theme/UiProvider.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useMemo } from 'react';\n\nimport type { UiLinkComponent } from '../types/link.type';\nimport UiContext from './context';\nimport type { UiLabels } from '@/types/theme.type';\n\ntype Props = {\n children: ReactNode;\n /**\n * The application's link component.\n * @example import NextLink from 'next/link'; <UiProvider linkComponent={NextLink}>…</UiProvider>\n */\n linkComponent?: UiLinkComponent;\n /** Interface strings — once, here. */\n labels?: UiLabels;\n};\n\n/**\n * Library provider: the router's link component and the interface strings.\n *\n * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from\n * `@handijit/design/tokens.css`, which the application loads once; a brand override is a plain\n * `--hd-*` declaration in the application's own stylesheet.\n * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>\n */\nconst UiProvider: FC<Props> = ({ children, linkComponent, labels }) => {\n const value = useMemo(() => ({ linkComponent, labels }), [linkComponent, labels]);\n\n return <UiContext.Provider value={value}>{children}</UiContext.Provider>;\n};\n\nexport default UiProvider;\n"],"names":["UiProvider","children","linkComponent","labels","value","useMemo","jsx","UiContext"],"mappings":"4MA0BMA,EAAwB,CAAC,CAAE,SAAAC,EAAU,cAAAC,EAAe,OAAAC,KAAa,CACrE,MAAMC,EAAQC,UAAQ,KAAO,CAAE,cAAAH,EAAe,OAAAC,IAAW,CAACD,EAAeC,CAAM,CAAC,EAEhF,OAAOG,EAAAA,IAACC,EAAAA,QAAU,SAAV,CAAmB,MAAAH,EAAe,SAAAH,CAAA,CAAS,CACrD"}
1
+ {"version":3,"file":"UiProvider.cjs","sources":["../../src/theme/UiProvider.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useMemo } from 'react';\n\nimport type { UiLinkComponent } from '../types/link.type';\nimport UiContext from './context';\nimport type { UiLabels } from '@/types/theme.type';\n\ntype Props = {\n children: ReactNode;\n /**\n * The application's link component.\n * @example import NextLink from 'next/link'; <UiProvider linkComponent={NextLink}>…</UiProvider>\n */\n linkComponent?: UiLinkComponent;\n /** Interface strings — once, here. */\n labels?: UiLabels;\n};\n\n/**\n * Library provider: the router's link component and the interface strings.\n *\n * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from\n * `@handijitcom/ui/tokens.css`, which the application loads once; a brand override is a plain\n * `--hd-*` declaration in the application's own stylesheet.\n * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>\n */\nconst UiProvider: FC<Props> = ({ children, linkComponent, labels }) => {\n const value = useMemo(() => ({ linkComponent, labels }), [linkComponent, labels]);\n\n return <UiContext.Provider value={value}>{children}</UiContext.Provider>;\n};\n\nexport default UiProvider;\n"],"names":["UiProvider","children","linkComponent","labels","value","useMemo","jsx","UiContext"],"mappings":"4MA0BMA,EAAwB,CAAC,CAAE,SAAAC,EAAU,cAAAC,EAAe,OAAAC,KAAa,CACrE,MAAMC,EAAQC,UAAQ,KAAO,CAAE,cAAAH,EAAe,OAAAC,IAAW,CAACD,EAAeC,CAAM,CAAC,EAEhF,OAAOG,EAAAA,IAACC,EAAAA,QAAU,SAAV,CAAmB,MAAAH,EAAe,SAAAH,CAAA,CAAS,CACrD"}
@@ -15,7 +15,7 @@ type Props = {
15
15
  * Library provider: the router's link component and the interface strings.
16
16
  *
17
17
  * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from
18
- * `@handijit/design/tokens.css`, which the application loads once; a brand override is a plain
18
+ * `@handijitcom/ui/tokens.css`, which the application loads once; a brand override is a plain
19
19
  * `--hd-*` declaration in the application's own stylesheet.
20
20
  * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>
21
21
  */
@@ -15,7 +15,7 @@ type Props = {
15
15
  * Library provider: the router's link component and the interface strings.
16
16
  *
17
17
  * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from
18
- * `@handijit/design/tokens.css`, which the application loads once; a brand override is a plain
18
+ * `@handijitcom/ui/tokens.css`, which the application loads once; a brand override is a plain
19
19
  * `--hd-*` declaration in the application's own stylesheet.
20
20
  * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>
21
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"UiProvider.js","sources":["../../src/theme/UiProvider.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useMemo } from 'react';\n\nimport type { UiLinkComponent } from '../types/link.type';\nimport UiContext from './context';\nimport type { UiLabels } from '@/types/theme.type';\n\ntype Props = {\n children: ReactNode;\n /**\n * The application's link component.\n * @example import NextLink from 'next/link'; <UiProvider linkComponent={NextLink}>…</UiProvider>\n */\n linkComponent?: UiLinkComponent;\n /** Interface strings — once, here. */\n labels?: UiLabels;\n};\n\n/**\n * Library provider: the router's link component and the interface strings.\n *\n * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from\n * `@handijit/design/tokens.css`, which the application loads once; a brand override is a plain\n * `--hd-*` declaration in the application's own stylesheet.\n * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>\n */\nconst UiProvider: FC<Props> = ({ children, linkComponent, labels }) => {\n const value = useMemo(() => ({ linkComponent, labels }), [linkComponent, labels]);\n\n return <UiContext.Provider value={value}>{children}</UiContext.Provider>;\n};\n\nexport default UiProvider;\n"],"names":["UiProvider","children","linkComponent","labels","value","useMemo","jsx","UiContext"],"mappings":";;;;AA0BA,MAAMA,IAAwB,CAAC,EAAE,UAAAC,GAAU,eAAAC,GAAe,QAAAC,QAAa;AACrE,QAAMC,IAAQC,EAAQ,OAAO,EAAE,eAAAH,GAAe,QAAAC,MAAW,CAACD,GAAeC,CAAM,CAAC;AAEhF,SAAO,gBAAAG,EAACC,EAAU,UAAV,EAAmB,OAAAH,GAAe,UAAAH,EAAA,CAAS;AACrD;"}
1
+ {"version":3,"file":"UiProvider.js","sources":["../../src/theme/UiProvider.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, type ReactNode, useMemo } from 'react';\n\nimport type { UiLinkComponent } from '../types/link.type';\nimport UiContext from './context';\nimport type { UiLabels } from '@/types/theme.type';\n\ntype Props = {\n children: ReactNode;\n /**\n * The application's link component.\n * @example import NextLink from 'next/link'; <UiProvider linkComponent={NextLink}>…</UiProvider>\n */\n linkComponent?: UiLinkComponent;\n /** Interface strings — once, here. */\n labels?: UiLabels;\n};\n\n/**\n * Library provider: the router's link component and the interface strings.\n *\n * It renders nothing of its own and injects no style. Colours, type, spacing and motion come from\n * `@handijitcom/ui/tokens.css`, which the application loads once; a brand override is a plain\n * `--hd-*` declaration in the application's own stylesheet.\n * @example <UiProvider linkComponent={NextLink} labels={{ close: 'Kapat' }}><App /></UiProvider>\n */\nconst UiProvider: FC<Props> = ({ children, linkComponent, labels }) => {\n const value = useMemo(() => ({ linkComponent, labels }), [linkComponent, labels]);\n\n return <UiContext.Provider value={value}>{children}</UiContext.Provider>;\n};\n\nexport default UiProvider;\n"],"names":["UiProvider","children","linkComponent","labels","value","useMemo","jsx","UiContext"],"mappings":";;;;AA0BA,MAAMA,IAAwB,CAAC,EAAE,UAAAC,GAAU,eAAAC,GAAe,QAAAC,QAAa;AACrE,QAAMC,IAAQC,EAAQ,OAAO,EAAE,eAAAH,GAAe,QAAAC,MAAW,CAACD,GAAeC,CAAM,CAAC;AAEhF,SAAO,gBAAAG,EAACC,EAAU,UAAV,EAAmB,OAAAH,GAAe,UAAAH,EAAA,CAAS;AACrD;"}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),r=require("@handijit/design"),s=({nonce:e})=>t.jsx("script",{nonce:e,dangerouslySetInnerHTML:{__html:r.THEME_BOOT_SCRIPT}});exports.default=s;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),r=require("@handijitcom/ui/design"),s=({nonce:e})=>t.jsx("script",{nonce:e,dangerouslySetInnerHTML:{__html:r.THEME_BOOT_SCRIPT}});exports.default=s;
2
2
  //# sourceMappingURL=UiThemeScript.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"UiThemeScript.cjs","sources":["../../src/theme/UiThemeScript.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport { THEME_BOOT_SCRIPT } from '@handijit/design';\n\ntype Props = {\n /**\n * The request's CSP nonce. Leave it out when the policy allows the script by hash\n * (`THEME_BOOT_SCRIPT_HASH`), which also works for statically rendered pages.\n */\n nonce?: string;\n};\n\n/**\n * The theme before the first paint — rendered in `<head>`, in the server output.\n *\n * It inlines the boot script of `@handijit/design` unchanged, so its text matches\n * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage[\"hd-theme\"]`) or the system setting is\n * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on\n * `<html>`: the attribute is set before React hydrates.\n *\n * A component and not a function: the package carries `'use client'`, and a plain exported function\n * cannot be called from a Next server component, while a component renders on the server too.\n * @example <head><UiThemeScript nonce={nonce} /></head>\n */\nconst UiThemeScript: FC<Props> = ({ nonce }) => (\n <script nonce={nonce} dangerouslySetInnerHTML={{ __html: THEME_BOOT_SCRIPT }} />\n);\n\nexport default UiThemeScript;\n"],"names":["UiThemeScript","nonce","jsx","THEME_BOOT_SCRIPT"],"mappings":"4LAyBMA,EAA2B,CAAC,CAAE,MAAAC,CAAA,IAClCC,MAAC,SAAA,CAAO,MAAAD,EAAc,wBAAyB,CAAE,OAAQE,EAAAA,iBAAA,CAAkB,CAAG"}
1
+ {"version":3,"file":"UiThemeScript.cjs","sources":["../../src/theme/UiThemeScript.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport { THEME_BOOT_SCRIPT } from '@handijitcom/ui/design';\n\ntype Props = {\n /**\n * The request's CSP nonce. Leave it out when the policy allows the script by hash\n * (`THEME_BOOT_SCRIPT_HASH`), which also works for statically rendered pages.\n */\n nonce?: string;\n};\n\n/**\n * The theme before the first paint — rendered in `<head>`, in the server output.\n *\n * It inlines the boot script of `@handijitcom/ui/design` unchanged, so its text matches\n * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage[\"hd-theme\"]`) or the system setting is\n * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on\n * `<html>`: the attribute is set before React hydrates.\n *\n * A component and not a function: the package carries `'use client'`, and a plain exported function\n * cannot be called from a Next server component, while a component renders on the server too.\n * @example <head><UiThemeScript nonce={nonce} /></head>\n */\nconst UiThemeScript: FC<Props> = ({ nonce }) => (\n <script nonce={nonce} dangerouslySetInnerHTML={{ __html: THEME_BOOT_SCRIPT }} />\n);\n\nexport default UiThemeScript;\n"],"names":["UiThemeScript","nonce","jsx","THEME_BOOT_SCRIPT"],"mappings":"kMAyBMA,EAA2B,CAAC,CAAE,MAAAC,CAAA,IAClCC,MAAC,SAAA,CAAO,MAAAD,EAAc,wBAAyB,CAAE,OAAQE,EAAAA,iBAAA,CAAkB,CAAG"}
@@ -9,7 +9,7 @@ type Props = {
9
9
  /**
10
10
  * The theme before the first paint — rendered in `<head>`, in the server output.
11
11
  *
12
- * It inlines the boot script of `@handijit/design` unchanged, so its text matches
12
+ * It inlines the boot script of `@handijitcom/ui/design` unchanged, so its text matches
13
13
  * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage["hd-theme"]`) or the system setting is
14
14
  * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on
15
15
  * `<html>`: the attribute is set before React hydrates.
@@ -9,7 +9,7 @@ type Props = {
9
9
  /**
10
10
  * The theme before the first paint — rendered in `<head>`, in the server output.
11
11
  *
12
- * It inlines the boot script of `@handijit/design` unchanged, so its text matches
12
+ * It inlines the boot script of `@handijitcom/ui/design` unchanged, so its text matches
13
13
  * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage["hd-theme"]`) or the system setting is
14
14
  * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on
15
15
  * `<html>`: the attribute is set before React hydrates.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as e } from "react/jsx-runtime";
3
- import { THEME_BOOT_SCRIPT as r } from "@handijit/design";
3
+ import { THEME_BOOT_SCRIPT as r } from "@handijitcom/ui/design";
4
4
  const m = ({ nonce: t }) => /* @__PURE__ */ e("script", { nonce: t, dangerouslySetInnerHTML: { __html: r } });
5
5
  export {
6
6
  m as default
@@ -1 +1 @@
1
- {"version":3,"file":"UiThemeScript.js","sources":["../../src/theme/UiThemeScript.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport { THEME_BOOT_SCRIPT } from '@handijit/design';\n\ntype Props = {\n /**\n * The request's CSP nonce. Leave it out when the policy allows the script by hash\n * (`THEME_BOOT_SCRIPT_HASH`), which also works for statically rendered pages.\n */\n nonce?: string;\n};\n\n/**\n * The theme before the first paint — rendered in `<head>`, in the server output.\n *\n * It inlines the boot script of `@handijit/design` unchanged, so its text matches\n * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage[\"hd-theme\"]`) or the system setting is\n * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on\n * `<html>`: the attribute is set before React hydrates.\n *\n * A component and not a function: the package carries `'use client'`, and a plain exported function\n * cannot be called from a Next server component, while a component renders on the server too.\n * @example <head><UiThemeScript nonce={nonce} /></head>\n */\nconst UiThemeScript: FC<Props> = ({ nonce }) => (\n <script nonce={nonce} dangerouslySetInnerHTML={{ __html: THEME_BOOT_SCRIPT }} />\n);\n\nexport default UiThemeScript;\n"],"names":["UiThemeScript","nonce","jsx","THEME_BOOT_SCRIPT"],"mappings":";;;AAyBA,MAAMA,IAA2B,CAAC,EAAE,OAAAC,EAAA,MAClC,gBAAAC,EAAC,UAAA,EAAO,OAAAD,GAAc,yBAAyB,EAAE,QAAQE,EAAA,EAAkB,CAAG;"}
1
+ {"version":3,"file":"UiThemeScript.js","sources":["../../src/theme/UiThemeScript.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n\nimport { THEME_BOOT_SCRIPT } from '@handijitcom/ui/design';\n\ntype Props = {\n /**\n * The request's CSP nonce. Leave it out when the policy allows the script by hash\n * (`THEME_BOOT_SCRIPT_HASH`), which also works for statically rendered pages.\n */\n nonce?: string;\n};\n\n/**\n * The theme before the first paint — rendered in `<head>`, in the server output.\n *\n * It inlines the boot script of `@handijitcom/ui/design` unchanged, so its text matches\n * `THEME_BOOT_SCRIPT_HASH`: the stored choice (`localStorage[\"hd-theme\"]`) or the system setting is\n * written to `<html data-theme>` while the HTML is parsed. Put `suppressHydrationWarning` on\n * `<html>`: the attribute is set before React hydrates.\n *\n * A component and not a function: the package carries `'use client'`, and a plain exported function\n * cannot be called from a Next server component, while a component renders on the server too.\n * @example <head><UiThemeScript nonce={nonce} /></head>\n */\nconst UiThemeScript: FC<Props> = ({ nonce }) => (\n <script nonce={nonce} dangerouslySetInnerHTML={{ __html: THEME_BOOT_SCRIPT }} />\n);\n\nexport default UiThemeScript;\n"],"names":["UiThemeScript","nonce","jsx","THEME_BOOT_SCRIPT"],"mappings":";;;AAyBA,MAAMA,IAA2B,CAAC,EAAE,OAAAC,EAAA,MAClC,gBAAAC,EAAC,UAAA,EAAO,OAAAD,GAAc,yBAAyB,EAAE,QAAQE,EAAA,EAAkB,CAAG;"}