@krizaka/ui 3.78.1 → 3.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/README.md +1 -0
  2. package/dist/app-frame.d.ts +4 -1
  3. package/dist/chunk-BCD2CRFG.js +349 -0
  4. package/dist/chunk-BCD2CRFG.js.map +1 -0
  5. package/dist/{chunk-PGPNYYE2.js → chunk-BHAWCN4I.js} +128 -110
  6. package/dist/chunk-BHAWCN4I.js.map +1 -0
  7. package/dist/{chunk-SG3QJJXE.js → chunk-ENFXJUDN.js} +3 -16
  8. package/dist/chunk-ENFXJUDN.js.map +1 -0
  9. package/dist/identity-card.d.ts +39 -0
  10. package/dist/identity-card.js +34 -0
  11. package/dist/identity-card.js.map +1 -0
  12. package/dist/index.d.ts +47 -15
  13. package/dist/index.js +87 -23
  14. package/dist/index.js.map +1 -1
  15. package/dist/native.d.ts +4 -1
  16. package/dist/nav-bar.d.ts +1 -1
  17. package/dist/nav-bar.js +63 -53
  18. package/dist/nav-bar.js.map +1 -1
  19. package/dist/qr-code.d.ts +25 -2
  20. package/dist/qr-code.js +29 -339
  21. package/dist/qr-code.js.map +1 -1
  22. package/dist/rail-nav.d.ts +4 -1
  23. package/dist/{schema-CL7t7xqb.d.ts → schema-DgjBz7-8.d.ts} +1 -1
  24. package/dist/shop.d.ts +2 -2
  25. package/dist/site-cahier.d.ts +32 -19
  26. package/dist/site-cahier.js +164 -138
  27. package/dist/site-cahier.js.map +1 -1
  28. package/dist/site-footer.d.ts +59 -39
  29. package/dist/site-footer.js +94 -68
  30. package/dist/site-footer.js.map +1 -1
  31. package/dist/{sites-CVNSirrg.d.ts → sites-BLqbwmng.d.ts} +14 -0
  32. package/dist/sites.d.ts +28 -2
  33. package/dist/sites.js +10 -0
  34. package/dist/sites.js.map +1 -1
  35. package/package.json +17 -3
  36. package/registry/account-menu.json +1 -1
  37. package/registry/account-settings.json +1 -1
  38. package/registry/achievement.json +1 -1
  39. package/registry/action-bar.json +1 -1
  40. package/registry/activity-feed.json +1 -1
  41. package/registry/agenda.json +1 -1
  42. package/registry/alert.json +1 -1
  43. package/registry/analysis-report.json +1 -1
  44. package/registry/anatomy-plate.json +1 -1
  45. package/registry/app-frame.json +8 -4
  46. package/registry/app-header.json +1 -1
  47. package/registry/app-shell.json +1 -1
  48. package/registry/argument-card.json +1 -1
  49. package/registry/auth-layout.json +1 -1
  50. package/registry/avatar.json +1 -1
  51. package/registry/badge.json +1 -1
  52. package/registry/bird-plate.json +1 -1
  53. package/registry/button.json +1 -1
  54. package/registry/captcha.json +1 -1
  55. package/registry/card-grid.json +1 -1
  56. package/registry/card.json +1 -1
  57. package/registry/catalogue-page.json +1 -1
  58. package/registry/changelog-page.json +1 -1
  59. package/registry/chapter.json +1 -1
  60. package/registry/chat.json +1 -1
  61. package/registry/checkbox.json +1 -1
  62. package/registry/chip-link.json +1 -1
  63. package/registry/chip-row.json +1 -1
  64. package/registry/chip.json +1 -1
  65. package/registry/choice-grid.json +1 -1
  66. package/registry/code-block.json +1 -1
  67. package/registry/collection-switcher.json +1 -1
  68. package/registry/combobox.json +1 -1
  69. package/registry/command.json +1 -1
  70. package/registry/comparison-table.json +1 -1
  71. package/registry/component-page.json +1 -1
  72. package/registry/confirm-button.json +1 -1
  73. package/registry/contact-page.json +1 -1
  74. package/registry/continue-prompt.json +1 -1
  75. package/registry/copy-button.json +1 -1
  76. package/registry/countdown.json +1 -1
  77. package/registry/cover-hero.json +1 -1
  78. package/registry/cta-panel.json +1 -1
  79. package/registry/dashboard-layout.json +1 -1
  80. package/registry/data-table.json +1 -1
  81. package/registry/date-picker.json +1 -1
  82. package/registry/decision-list.json +1 -1
  83. package/registry/description-list.json +1 -1
  84. package/registry/desktop-window.json +1 -1
  85. package/registry/detail-layout.json +1 -1
  86. package/registry/dialog.json +1 -1
  87. package/registry/docs-article-page.json +1 -1
  88. package/registry/docs-hub-page.json +1 -1
  89. package/registry/docs-layout.json +1 -1
  90. package/registry/docs-nav.json +1 -1
  91. package/registry/document-viewer.json +1 -1
  92. package/registry/doodle.json +1 -1
  93. package/registry/drop-overlay.json +1 -1
  94. package/registry/dropdown-menu.json +1 -1
  95. package/registry/elephant.json +1 -1
  96. package/registry/embed-facade.json +1 -1
  97. package/registry/empty-state.json +1 -1
  98. package/registry/engine-flow.json +1 -1
  99. package/registry/entity-header.json +1 -1
  100. package/registry/environment-notice.json +1 -1
  101. package/registry/error-page.json +1 -1
  102. package/registry/examples/identity-card/basic.d.ts +4 -0
  103. package/registry/examples/identity-card/basic.js +33 -0
  104. package/registry/examples/identity-card/basic.tsx +29 -0
  105. package/registry/examples/site-footer/company.js +1 -0
  106. package/registry/examples/site-footer/company.tsx +3 -2
  107. package/registry/examples/site-footer/docs.tsx +1 -1
  108. package/registry/examples/site-footer/open-source-fr.js +1 -1
  109. package/registry/examples/site-footer/open-source-fr.tsx +1 -1
  110. package/registry/examples/site-footer/product.js +9 -14
  111. package/registry/examples/site-footer/product.tsx +14 -12
  112. package/registry/field.json +1 -1
  113. package/registry/file-upload.json +1 -1
  114. package/registry/filter-bar.json +1 -1
  115. package/registry/flock.json +1 -1
  116. package/registry/footnote.json +1 -1
  117. package/registry/force-update-screen.json +1 -1
  118. package/registry/form.json +1 -1
  119. package/registry/gallery-page.json +1 -1
  120. package/registry/genui.json +1 -1
  121. package/registry/glossary-term.json +1 -1
  122. package/registry/glossary.json +1 -1
  123. package/registry/glow-card.json +1 -1
  124. package/registry/goal-gauge.json +1 -1
  125. package/registry/grade-stamp.json +1 -1
  126. package/registry/identity-card.json +218 -0
  127. package/registry/image-cropper.json +1 -1
  128. package/registry/index.json +40 -9
  129. package/registry/kanban.json +1 -1
  130. package/registry/kbd.json +1 -1
  131. package/registry/kind-config-editor.json +1 -1
  132. package/registry/kpi-explained.json +1 -1
  133. package/registry/landing-page.json +1 -1
  134. package/registry/landscape.json +1 -1
  135. package/registry/language-switch.json +1 -1
  136. package/registry/legal-page.json +1 -1
  137. package/registry/link-card.json +1 -1
  138. package/registry/list.json +1 -1
  139. package/registry/loader.json +1 -1
  140. package/registry/longform-page.json +1 -1
  141. package/registry/maintenance-screen.json +1 -1
  142. package/registry/map.json +2 -2
  143. package/registry/margin-layout.json +1 -1
  144. package/registry/markdown.json +1 -1
  145. package/registry/marketing-layout.json +1 -1
  146. package/registry/mascot-quote.json +1 -1
  147. package/registry/mascot-state.json +1 -1
  148. package/registry/mascots.json +1 -1
  149. package/registry/match-dialog.json +1 -1
  150. package/registry/media-capture.json +1 -1
  151. package/registry/media-gallery.json +1 -1
  152. package/registry/meter.json +1 -1
  153. package/registry/money-input.json +1 -1
  154. package/registry/nav-bar.json +8 -4
  155. package/registry/next-actions.json +1 -1
  156. package/registry/notification-preferences.json +1 -1
  157. package/registry/number-ticker.json +1 -1
  158. package/registry/opening-hours.json +1 -1
  159. package/registry/page-header.json +1 -1
  160. package/registry/page-hero.json +1 -1
  161. package/registry/page-index.json +1 -1
  162. package/registry/page.json +1 -1
  163. package/registry/pagination.json +1 -1
  164. package/registry/pointer-light.json +1 -1
  165. package/registry/popover.json +1 -1
  166. package/registry/price-catalogue-editor.json +1 -1
  167. package/registry/pricing-page.json +1 -1
  168. package/registry/product-page.json +1 -1
  169. package/registry/profile-card.json +1 -1
  170. package/registry/progress.json +1 -1
  171. package/registry/promise-card.json +1 -1
  172. package/registry/promo-code-field.json +1 -1
  173. package/registry/proposal.json +1 -1
  174. package/registry/qr-code.json +6 -2
  175. package/registry/quota-meter.json +1 -1
  176. package/registry/radio-group.json +1 -1
  177. package/registry/rail-nav.json +8 -4
  178. package/registry/recipes.json +1 -1
  179. package/registry/retro-tv.json +1 -1
  180. package/registry/reviews.json +1 -1
  181. package/registry/router.json +1 -1
  182. package/registry/schema-form.json +1 -1
  183. package/registry/scroll-stage.json +1 -1
  184. package/registry/search-field.json +1 -1
  185. package/registry/section-backdrop.json +1 -1
  186. package/registry/separator.json +1 -1
  187. package/registry/service-card.json +1 -1
  188. package/registry/settings-layout.json +1 -1
  189. package/registry/shop-composer.json +1 -1
  190. package/registry/shop-gallery.json +1 -1
  191. package/registry/shop.json +2 -2
  192. package/registry/showcase.json +1 -1
  193. package/registry/signature.json +1 -1
  194. package/registry/site-cahier.json +1 -1
  195. package/registry/site-footer.json +87 -60
  196. package/registry/sites.json +7 -3
  197. package/registry/skeleton.json +1 -1
  198. package/registry/skip-link.json +1 -1
  199. package/registry/slider.json +1 -1
  200. package/registry/slot-picker.json +1 -1
  201. package/registry/slot.json +1 -1
  202. package/registry/specimen-tag.json +1 -1
  203. package/registry/speed-lines.json +1 -1
  204. package/registry/spinner.json +1 -1
  205. package/registry/split-view.json +1 -1
  206. package/registry/stage-banner.json +1 -1
  207. package/registry/stat.json +1 -1
  208. package/registry/status-chip.json +1 -1
  209. package/registry/status-page.json +1 -1
  210. package/registry/step-progress.json +1 -1
  211. package/registry/step-showcase.json +1 -1
  212. package/registry/stepper.json +1 -1
  213. package/registry/sticky-action.json +1 -1
  214. package/registry/stuck.json +1 -1
  215. package/registry/swipe-deck.json +1 -1
  216. package/registry/switch.json +1 -1
  217. package/registry/tabs.json +1 -1
  218. package/registry/tag-input.json +1 -1
  219. package/registry/tag-selector.json +1 -1
  220. package/registry/taped-photo.json +1 -1
  221. package/registry/terminal-replay.json +1 -1
  222. package/registry/text-style.json +1 -1
  223. package/registry/theme.json +1 -1
  224. package/registry/toast.json +1 -1
  225. package/registry/toc.json +1 -1
  226. package/registry/tooltip.json +1 -1
  227. package/registry/tree-view.json +1 -1
  228. package/registry/update-prompt.json +1 -1
  229. package/registry/upload-queue.json +1 -1
  230. package/registry/usage.json +1 -1
  231. package/registry/verified-badge.json +1 -1
  232. package/registry/versus-card.json +1 -1
  233. package/registry/vertical-video.json +1 -1
  234. package/registry/video-player.json +1 -1
  235. package/registry/video-trimmer.json +1 -1
  236. package/registry/virtual.json +1 -1
  237. package/registry/wall.json +1 -1
  238. package/registry/waveform.json +1 -1
  239. package/dist/chunk-PGPNYYE2.js.map +0 -1
  240. package/dist/chunk-SG3QJJXE.js.map +0 -1
package/dist/qr-code.js CHANGED
@@ -1,350 +1,40 @@
1
1
  import {
2
- CheckGlyph,
3
- CopyGlyph
4
- } from "./chunk-C57KK5VB.js";
5
- import {
6
- Button
7
- } from "./chunk-EB45EVPJ.js";
2
+ QrCode,
3
+ QrTooLongError,
4
+ encodeQr,
5
+ qrPath
6
+ } from "./chunk-BCD2CRFG.js";
7
+ import "./chunk-C57KK5VB.js";
8
+ import "./chunk-EB45EVPJ.js";
8
9
  import "./chunk-43PTCDTL.js";
9
10
  import "./chunk-2VNYHG4E.js";
10
- import {
11
- cn
12
- } from "./chunk-W675RFOA.js";
11
+ import "./chunk-W675RFOA.js";
13
12
 
14
- // src/qr-code/encode.ts
15
- var LEVEL_INDEX = { L: 0, M: 1, Q: 2, H: 3 };
16
- var LEVEL_BITS = { L: 1, M: 0, Q: 3, H: 2 };
17
- var ECC_PER_BLOCK = [
18
- [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
19
- [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
20
- [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
21
- [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
22
- ];
23
- var BLOCKS = [
24
- [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
25
- [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
26
- [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
27
- [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
28
- ];
29
- function rawModules(version) {
30
- let result = (16 * version + 128) * version + 64;
31
- if (version >= 2) {
32
- const align = Math.floor(version / 7) + 2;
33
- result -= (25 * align - 10) * align - 55;
34
- if (version >= 7) result -= 36;
35
- }
36
- return result;
37
- }
38
- function dataCodewords(version, level) {
39
- const l = LEVEL_INDEX[level];
40
- return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l][version] * BLOCKS[l][version];
41
- }
42
- function utf8(text) {
43
- return [...new TextEncoder().encode(text)];
44
- }
45
- function gfMultiply(x, y) {
46
- let z = 0;
47
- for (let i = 7; i >= 0; i--) {
48
- z = z << 1 ^ (z >>> 7) * 285;
49
- z ^= (y >>> i & 1) * x;
50
- }
51
- return z;
52
- }
53
- function divisor(degree) {
54
- const result = new Array(degree).fill(0);
55
- result[degree - 1] = 1;
56
- let root = 1;
57
- for (let i = 0; i < degree; i++) {
58
- for (let j = 0; j < degree; j++) {
59
- result[j] = gfMultiply(result[j], root);
60
- if (j + 1 < degree) result[j] = result[j] ^ result[j + 1];
61
- }
62
- root = gfMultiply(root, 2);
63
- }
64
- return result;
65
- }
66
- function remainder(data, div) {
67
- const result = div.map(() => 0);
68
- for (const b of data) {
69
- const factor = b ^ result.shift();
70
- result.push(0);
71
- div.forEach((coef, i) => {
72
- result[i] = result[i] ^ gfMultiply(coef, factor);
73
- });
74
- }
75
- return result;
76
- }
77
- function pushBits(bits, value, count) {
78
- for (let i = count - 1; i >= 0; i--) bits.push(value >>> i & 1);
79
- }
80
- function codewords(bytes, version, level) {
81
- const bits = [];
82
- pushBits(bits, 4, 4);
83
- pushBits(bits, bytes.length, version <= 9 ? 8 : 16);
84
- for (const b of bytes) pushBits(bits, b, 8);
85
- const capacity = dataCodewords(version, level) * 8;
86
- pushBits(bits, 0, Math.min(4, capacity - bits.length));
87
- pushBits(bits, 0, (8 - bits.length % 8) % 8);
88
- let pad = 236;
89
- while (bits.length < capacity) {
90
- pushBits(bits, pad, 8);
91
- pad ^= 236 ^ 17;
92
- }
93
- const data = [];
94
- for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(""), 2));
95
- const l = LEVEL_INDEX[level];
96
- const blocks = BLOCKS[l][version];
97
- const eccLen = ECC_PER_BLOCK[l][version];
98
- const shortBlocks = blocks - Math.floor(rawModules(version) / 8) % blocks;
99
- const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;
100
- const div = divisor(eccLen);
101
- const parts = [];
102
- for (let i = 0, k = 0; i < blocks; i++) {
103
- const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));
104
- k += chunk.length;
105
- parts.push({ data: chunk, ecc: remainder(chunk, div) });
106
- }
107
- const out = [];
108
- for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]));
109
- for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]));
110
- return out;
111
- }
112
- function alignmentPositions(version) {
113
- if (version === 1) return [];
114
- const count = Math.floor(version / 7) + 2;
115
- const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;
116
- const result = [6];
117
- let pos = version * 4 + 10;
118
- while (result.length < count) {
119
- result.splice(1, 0, pos);
120
- pos -= step;
121
- }
122
- return result;
123
- }
124
- function drawFunctionPatterns(version, level) {
125
- const size = version * 4 + 17;
126
- const dark = Array.from({ length: size }, () => new Array(size).fill(false));
127
- const fn = Array.from({ length: size }, () => new Array(size).fill(false));
128
- const set = (x, y, on) => {
129
- dark[y][x] = on;
130
- fn[y][x] = true;
131
- };
132
- for (let i = 0; i < size; i++) {
133
- set(6, i, i % 2 === 0);
134
- set(i, 6, i % 2 === 0);
135
- }
136
- const finder = (cx, cy) => {
137
- for (let dy = -4; dy <= 4; dy++)
138
- for (let dx = -4; dx <= 4; dx++) {
139
- const x = cx + dx;
140
- const y = cy + dy;
141
- if (x < 0 || x >= size || y < 0 || y >= size) continue;
142
- const dist = Math.max(Math.abs(dx), Math.abs(dy));
143
- set(x, y, dist !== 2 && dist !== 4);
144
- }
145
- };
146
- finder(3, 3);
147
- finder(size - 4, 3);
148
- finder(3, size - 4);
149
- const align = alignmentPositions(version);
150
- align.forEach(
151
- (cx, i) => align.forEach((cy, j) => {
152
- if (i === 0 && j === 0 || i === 0 && j === align.length - 1 || i === align.length - 1 && j === 0) return;
153
- for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
154
- })
155
- );
156
- drawFormat(dark, fn, size, level, 0);
157
- if (version >= 7) {
158
- let rem = version;
159
- for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
160
- const bits = version << 12 | rem;
161
- for (let i = 0; i < 18; i++) {
162
- const on = (bits >>> i & 1) !== 0;
163
- const a = size - 11 + i % 3;
164
- const b = Math.floor(i / 3);
165
- set(a, b, on);
166
- set(b, a, on);
167
- }
168
- }
169
- return { size, dark, fn };
170
- }
171
- function drawFormat(dark, fn, size, level, mask) {
172
- const data = LEVEL_BITS[level] << 3 | mask;
173
- let rem = data;
174
- for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
175
- const bits = (data << 10 | rem) ^ 21522;
176
- const bit = (i) => (bits >>> i & 1) !== 0;
177
- const set = (x, y, on) => {
178
- dark[y][x] = on;
179
- fn[y][x] = true;
180
- };
181
- for (let i = 0; i <= 5; i++) set(8, i, bit(i));
182
- set(8, 7, bit(6));
183
- set(8, 8, bit(7));
184
- set(7, 8, bit(8));
185
- for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));
186
- for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));
187
- for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));
188
- set(8, size - 8, true);
189
- }
190
- function* dataPositions(size) {
191
- for (let right = size - 1; right >= 1; right -= 2) {
192
- if (right === 6) right = 5;
193
- for (let vert = 0; vert < size; vert++) {
194
- const y = (right + 1 & 2) === 0 ? size - 1 - vert : vert;
195
- yield [right, y];
196
- yield [right - 1, y];
197
- }
198
- }
199
- }
200
- function placeData(grid, data) {
201
- const { size, dark, fn } = grid;
202
- let i = 0;
203
- for (const [x, y] of dataPositions(size)) {
204
- if (fn[y][x] || i >= data.length * 8) continue;
205
- dark[y][x] = (data[i >>> 3] >>> 7 - (i & 7) & 1) !== 0;
206
- i++;
207
- }
208
- }
209
- var MASKS = [
210
- (x, y) => (x + y) % 2 === 0,
211
- (_x, y) => y % 2 === 0,
212
- (x) => x % 3 === 0,
213
- (x, y) => (x + y) % 3 === 0,
214
- (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,
215
- (x, y) => x * y % 2 + x * y % 3 === 0,
216
- (x, y) => (x * y % 2 + x * y % 3) % 2 === 0,
217
- (x, y) => ((x + y) % 2 + x * y % 3) % 2 === 0
218
- ];
219
- function runPenalty(line) {
220
- let score = 0;
221
- let run = 1;
222
- for (let i = 1; i < line.length; i++) {
223
- run = line[i] === line[i - 1] ? run + 1 : 1;
224
- if (run === 5) score += 3;
225
- else if (run > 5) score++;
226
- }
227
- return score;
228
- }
229
- function finderPenalty(line) {
230
- const text = line.map((on) => on ? "1" : "0").join("");
231
- let score = 0;
232
- for (const pattern of ["00001011101", "10111010000"]) {
233
- for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;
234
- }
235
- return score;
236
- }
237
- function blockPenalty(dark) {
238
- let score = 0;
239
- for (let y = 0; y < dark.length - 1; y++)
240
- for (let x = 0; x < dark.length - 1; x++) {
241
- const c = dark[y][x];
242
- if (c === dark[y][x + 1] && c === dark[y + 1][x] && c === dark[y + 1][x + 1]) score += 3;
243
- }
244
- return score;
245
- }
246
- function balancePenalty(dark) {
247
- const size = dark.length;
248
- const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);
249
- return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;
250
- }
251
- function penalty(dark) {
252
- const columns = dark.map((_, x) => dark.map((row) => row[x]));
253
- const lines = [...dark, ...columns];
254
- return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);
255
- }
256
- var QrTooLongError = class extends Error {
257
- constructor(length, level) {
258
- super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);
259
- this.name = "QrTooLongError";
260
- }
261
- };
262
- function smallestVersion(bytes, level) {
263
- for (let version = 1; version <= 40; version++) {
264
- if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;
265
- }
266
- throw new QrTooLongError(bytes.length, level);
267
- }
268
- function masked(base, mask, level) {
269
- const dark = base.dark.map((row) => [...row]);
270
- const fn = base.fn.map((row) => [...row]);
271
- for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y][x] && MASKS[mask](x, y)) dark[y][x] = !dark[y][x];
272
- drawFormat(dark, fn, base.size, level, mask);
273
- return dark;
274
- }
275
- function encodeQr(text, level = "M") {
276
- const bytes = utf8(text);
277
- const version = smallestVersion(bytes, level);
278
- const base = drawFunctionPatterns(version, level);
279
- placeData(base, codewords(bytes, version, level));
280
- const candidates = MASKS.map((_, mask) => masked(base, mask, level));
281
- const scores = candidates.map(penalty);
282
- return candidates[scores.indexOf(Math.min(...scores))];
283
- }
284
- function qrPath(matrix, quiet) {
285
- const parts = [];
286
- matrix.forEach((row, y) => {
287
- for (let x = 0; x < row.length; x++) {
288
- if (!row[x]) continue;
289
- let end = x;
290
- while (end + 1 < row.length && row[end + 1]) end++;
291
- parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);
292
- x = end;
293
- }
294
- });
295
- return parts.join("");
296
- }
297
-
298
- // src/qr-code/qr-code.tsx
299
- import * as React from "react";
300
- import { jsx, jsxs } from "react/jsx-runtime";
301
- var QR_TILE = "#ffffff";
302
- var QR_MODULE = "#0b0f19";
303
- function QrCode({ value, label, size = 176, quietZone = 4, level = "M", copyLabel, copiedLabel, onCopy, className }) {
304
- const quiet = Math.max(2, Math.round(quietZone));
305
- const { matrix, path } = React.useMemo(() => {
306
- const m = encodeQr(value, level);
307
- return { matrix: m, path: qrPath(m, quiet) };
308
- }, [value, level, quiet]);
309
- const modules = matrix.length + quiet * 2;
310
- const [copied, setCopied] = React.useState(false);
311
- React.useEffect(() => {
312
- if (!copied) return;
313
- const t = setTimeout(() => setCopied(false), 1800);
314
- return () => clearTimeout(t);
315
- }, [copied]);
316
- const copy = () => navigator.clipboard?.writeText(value).then(() => {
317
- setCopied(true);
318
- onCopy?.();
319
- });
320
- return /* @__PURE__ */ jsxs("div", { className: cn("inline-flex flex-col items-start gap-3", className), "data-qr-code": true, children: [
321
- /* @__PURE__ */ jsxs(
322
- "svg",
323
- {
324
- role: "img",
325
- "aria-label": label,
326
- viewBox: `0 0 ${modules} ${modules}`,
327
- width: size,
328
- height: size,
329
- shapeRendering: "crispEdges",
330
- className: "block max-w-full rounded-lg border border-border-default",
331
- style: { height: "auto", aspectRatio: "1 / 1" },
332
- children: [
333
- /* @__PURE__ */ jsx("rect", { width: modules, height: modules, fill: QR_TILE }),
334
- /* @__PURE__ */ jsx("path", { d: path, fill: QR_MODULE })
335
- ]
336
- }
337
- ),
338
- copyLabel ? /* @__PURE__ */ jsxs(Button, { type: "button", variant: "secondary", size: "sm", onClick: copy, announce: copied ? copiedLabel ?? copyLabel : void 0, children: [
339
- copied ? /* @__PURE__ */ jsx(CheckGlyph, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(CopyGlyph, { className: "h-3.5 w-3.5" }),
340
- copied ? copiedLabel ?? copyLabel : copyLabel
341
- ] }) : null
342
- ] });
13
+ // src/qr-code/vcard.ts
14
+ var escapeVCard = (value) => value.replace(/[\\,;]/g, String.raw`\$&`).replace(/\r?\n/g, String.raw`\n`);
15
+ var present = (value) => typeof value === "string" && value.trim() !== "";
16
+ function vCard(fields) {
17
+ const { name, organization, address, email, phone, url } = fields;
18
+ const parts = address ? [address.street, address.city, address.region, address.postalCode, address.country] : [];
19
+ const lines = [
20
+ "BEGIN:VCARD",
21
+ "VERSION:3.0",
22
+ `FN:${escapeVCard(name.trim())}`,
23
+ present(organization) ? `ORG:${escapeVCard(organization.trim())}` : null,
24
+ parts.some(present) ? `ADR;TYPE=WORK:;;${parts.map((part) => escapeVCard((part ?? "").trim())).join(";")}` : null,
25
+ present(email) ? `EMAIL;TYPE=WORK:${escapeVCard(email.trim())}` : null,
26
+ present(phone) ? `TEL;TYPE=WORK:${escapeVCard(phone.trim())}` : null,
27
+ present(url) ? `URL:${escapeVCard(url.trim())}` : null,
28
+ "END:VCARD"
29
+ ];
30
+ return lines.filter((line) => line !== null).join("\r\n");
343
31
  }
344
32
  export {
345
33
  QrCode,
346
34
  QrTooLongError,
347
35
  encodeQr,
348
- qrPath
36
+ escapeVCard,
37
+ qrPath,
38
+ vCard
349
39
  };
350
40
  //# sourceMappingURL=qr-code.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/qr-code/encode.ts","../src/qr-code/qr-code.tsx"],"sourcesContent":["// The QR encoder: a string in, a square of dark/light modules out. Pure, offline, no dependency, shared by the web\n// and the native drawing. Byte mode (UTF-8), versions 1-40, the four error-correction levels, the eight masks chosen\n// by the standard's penalty rules (ISO/IEC 18004). `qr-code.test.tsx` decodes what it draws, version by version.\n\nexport type QrLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/** The square of modules, row by row: `true` is dark. */\nexport type QrMatrix = readonly (readonly boolean[])[];\n\nconst LEVEL_INDEX: Record<QrLevel, number> = { L: 0, M: 1, Q: 2, H: 3 };\nconst LEVEL_BITS: Record<QrLevel, number> = { L: 1, M: 0, Q: 3, H: 2 };\n\n// Error-correction codewords per block, and number of blocks, by level (L, M, Q, H) then version (index 0 is unused).\nconst ECC_PER_BLOCK = [\n [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],\n [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],\n] as const;\nconst BLOCKS = [\n [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],\n [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],\n [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],\n [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81],\n] as const;\n\n/** Data modules of a version (everything but the finder, timing, alignment, format and version patterns). */\nfunction rawModules(version: number): number {\n let result = (16 * version + 128) * version + 64;\n if (version >= 2) {\n const align = Math.floor(version / 7) + 2;\n result -= (25 * align - 10) * align - 55;\n if (version >= 7) result -= 36;\n }\n return result;\n}\n\nfunction dataCodewords(version: number, level: QrLevel): number {\n const l = LEVEL_INDEX[level];\n return Math.floor(rawModules(version) / 8) - ECC_PER_BLOCK[l]![version]! * BLOCKS[l]![version]!;\n}\n\nexport function utf8(text: string): number[] {\n return [...new TextEncoder().encode(text)];\n}\n\n// Reed-Solomon over GF(256), polynomial 0x11D.\nfunction gfMultiply(x: number, y: number): number {\n let z = 0;\n for (let i = 7; i >= 0; i--) {\n z = (z << 1) ^ ((z >>> 7) * 0x11d);\n z ^= ((y >>> i) & 1) * x;\n }\n return z;\n}\n\nfunction divisor(degree: number): number[] {\n const result = new Array<number>(degree).fill(0);\n result[degree - 1] = 1;\n let root = 1;\n for (let i = 0; i < degree; i++) {\n for (let j = 0; j < degree; j++) {\n result[j] = gfMultiply(result[j]!, root);\n if (j + 1 < degree) result[j] = result[j]! ^ result[j + 1]!;\n }\n root = gfMultiply(root, 0x02);\n }\n return result;\n}\n\nfunction remainder(data: readonly number[], div: readonly number[]): number[] {\n const result = div.map(() => 0);\n for (const b of data) {\n const factor = b ^ result.shift()!;\n result.push(0);\n div.forEach((coef, i) => {\n result[i] = result[i]! ^ gfMultiply(coef, factor);\n });\n }\n return result;\n}\n\nfunction pushBits(bits: number[], value: number, count: number) {\n for (let i = count - 1; i >= 0; i--) bits.push((value >>> i) & 1);\n}\n\n/** The codewords of the message: mode, length, bytes, terminator, padding, then blocks interleaved with their ECC. */\nfunction codewords(bytes: readonly number[], version: number, level: QrLevel): number[] {\n const bits: number[] = [];\n pushBits(bits, 0b0100, 4);\n pushBits(bits, bytes.length, version <= 9 ? 8 : 16);\n for (const b of bytes) pushBits(bits, b, 8);\n const capacity = dataCodewords(version, level) * 8;\n pushBits(bits, 0, Math.min(4, capacity - bits.length));\n pushBits(bits, 0, (8 - (bits.length % 8)) % 8);\n let pad = 0xec;\n while (bits.length < capacity) {\n pushBits(bits, pad, 8);\n pad ^= 0xec ^ 0x11;\n }\n const data: number[] = [];\n for (let i = 0; i < bits.length; i += 8) data.push(parseInt(bits.slice(i, i + 8).join(\"\"), 2));\n\n const l = LEVEL_INDEX[level];\n const blocks = BLOCKS[l]![version]!;\n const eccLen = ECC_PER_BLOCK[l]![version]!;\n const shortBlocks = blocks - (Math.floor(rawModules(version) / 8) % blocks);\n const shortLen = Math.floor(rawModules(version) / 8 / blocks) - eccLen;\n const div = divisor(eccLen);\n const parts: { data: number[]; ecc: number[] }[] = [];\n for (let i = 0, k = 0; i < blocks; i++) {\n const chunk = data.slice(k, k + shortLen + (i < shortBlocks ? 0 : 1));\n k += chunk.length;\n parts.push({ data: chunk, ecc: remainder(chunk, div) });\n }\n const out: number[] = [];\n for (let i = 0; i <= shortLen; i++) parts.forEach((p) => i < p.data.length && out.push(p.data[i]!));\n for (let i = 0; i < eccLen; i++) parts.forEach((p) => out.push(p.ecc[i]!));\n return out;\n}\n\nfunction alignmentPositions(version: number): number[] {\n if (version === 1) return [];\n const count = Math.floor(version / 7) + 2;\n const step = version === 32 ? 26 : Math.ceil((version * 4 + 4) / (count * 2 - 2)) * 2;\n const result = [6];\n let pos = version * 4 + 10;\n while (result.length < count) {\n result.splice(1, 0, pos);\n pos -= step;\n }\n return result;\n}\n\ntype Grid = { size: number; dark: boolean[][]; fn: boolean[][] };\n\nfunction drawFunctionPatterns(version: number, level: QrLevel): Grid {\n const size = version * 4 + 17;\n const dark = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const fn = Array.from({ length: size }, () => new Array<boolean>(size).fill(false));\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i < size; i++) {\n set(6, i, i % 2 === 0);\n set(i, 6, i % 2 === 0);\n }\n const finder = (cx: number, cy: number) => {\n for (let dy = -4; dy <= 4; dy++)\n for (let dx = -4; dx <= 4; dx++) {\n const x = cx + dx;\n const y = cy + dy;\n if (x < 0 || x >= size || y < 0 || y >= size) continue;\n const dist = Math.max(Math.abs(dx), Math.abs(dy));\n set(x, y, dist !== 2 && dist !== 4);\n }\n };\n finder(3, 3);\n finder(size - 4, 3);\n finder(3, size - 4);\n const align = alignmentPositions(version);\n align.forEach((cx, i) =>\n align.forEach((cy, j) => {\n if ((i === 0 && j === 0) || (i === 0 && j === align.length - 1) || (i === align.length - 1 && j === 0)) return;\n for (let dy = -2; dy <= 2; dy++) for (let dx = -2; dx <= 2; dx++) set(cx + dx, cy + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);\n }),\n );\n drawFormat(dark, fn, size, level, 0);\n if (version >= 7) {\n let rem = version;\n for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1f25);\n const bits = (version << 12) | rem;\n for (let i = 0; i < 18; i++) {\n const on = ((bits >>> i) & 1) !== 0;\n const a = size - 11 + (i % 3);\n const b = Math.floor(i / 3);\n set(a, b, on);\n set(b, a, on);\n }\n }\n return { size, dark, fn };\n}\n\nfunction drawFormat(dark: boolean[][], fn: boolean[][], size: number, level: QrLevel, mask: number) {\n const data = (LEVEL_BITS[level] << 3) | mask;\n let rem = data;\n for (let i = 0; i < 10; i++) rem = (rem << 1) ^ ((rem >>> 9) * 0x537);\n const bits = ((data << 10) | rem) ^ 0x5412;\n const bit = (i: number) => ((bits >>> i) & 1) !== 0;\n const set = (x: number, y: number, on: boolean) => {\n dark[y]![x] = on;\n fn[y]![x] = true;\n };\n for (let i = 0; i <= 5; i++) set(8, i, bit(i));\n set(8, 7, bit(6));\n set(8, 8, bit(7));\n set(7, 8, bit(8));\n for (let i = 9; i < 15; i++) set(14 - i, 8, bit(i));\n for (let i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));\n for (let i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));\n set(8, size - 8, true);\n}\n\n/** The data modules in the standard's order: two-column strips from the right, up then down, skipping the timing column. */\nfunction* dataPositions(size: number): Generator<[number, number]> {\n for (let right = size - 1; right >= 1; right -= 2) {\n if (right === 6) right = 5;\n for (let vert = 0; vert < size; vert++) {\n const y = ((right + 1) & 2) === 0 ? size - 1 - vert : vert;\n yield [right, y];\n yield [right - 1, y];\n }\n }\n}\n\nfunction placeData(grid: Grid, data: readonly number[]) {\n const { size, dark, fn } = grid;\n let i = 0;\n for (const [x, y] of dataPositions(size)) {\n if (fn[y]![x] || i >= data.length * 8) continue;\n dark[y]![x] = ((data[i >>> 3]! >>> (7 - (i & 7))) & 1) !== 0;\n i++;\n }\n}\n\nconst MASKS: ((x: number, y: number) => boolean)[] = [\n (x, y) => (x + y) % 2 === 0,\n (_x, y) => y % 2 === 0,\n (x) => x % 3 === 0,\n (x, y) => (x + y) % 3 === 0,\n (x, y) => (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0,\n (x, y) => ((x * y) % 2) + ((x * y) % 3) === 0,\n (x, y) => (((x * y) % 2) + ((x * y) % 3)) % 2 === 0,\n (x, y) => (((x + y) % 2) + ((x * y) % 3)) % 2 === 0,\n];\n\ntype Dark = readonly (readonly boolean[])[];\n\n/** Rule 1: runs of five or more of one colour in a line (3, then 1 per module beyond). */\nfunction runPenalty(line: readonly boolean[]): number {\n let score = 0;\n let run = 1;\n for (let i = 1; i < line.length; i++) {\n run = line[i] === line[i - 1] ? run + 1 : 1;\n if (run === 5) score += 3;\n else if (run > 5) score++;\n }\n return score;\n}\n\n/** Rule 3: the finder-like pattern 1011101 with four light modules on one side, 40 each. */\nfunction finderPenalty(line: readonly boolean[]): number {\n const text = line.map((on) => (on ? \"1\" : \"0\")).join(\"\");\n let score = 0;\n for (const pattern of [\"00001011101\", \"10111010000\"]) {\n for (let at = text.indexOf(pattern); at >= 0; at = text.indexOf(pattern, at + 1)) score += 40;\n }\n return score;\n}\n\n/** Rule 2: 2x2 blocks of one colour, 3 each. */\nfunction blockPenalty(dark: Dark): number {\n let score = 0;\n for (let y = 0; y < dark.length - 1; y++)\n for (let x = 0; x < dark.length - 1; x++) {\n const c = dark[y]![x]!;\n if (c === dark[y]![x + 1] && c === dark[y + 1]![x] && c === dark[y + 1]![x + 1]) score += 3;\n }\n return score;\n}\n\n/** Rule 4: the share of dark modules away from 50 %, 10 per started 5 %. */\nfunction balancePenalty(dark: Dark): number {\n const size = dark.length;\n const total = dark.reduce((n, row) => n + row.filter(Boolean).length, 0);\n return (Math.ceil(Math.abs(total * 20 - size * size * 10) / (size * size)) - 1) * 10;\n}\n\nfunction penalty(dark: Dark): number {\n const columns = dark.map((_, x) => dark.map((row) => row[x]!));\n const lines = [...dark, ...columns];\n return lines.reduce((n, line) => n + runPenalty(line) + finderPenalty(line), 0) + blockPenalty(dark) + balancePenalty(dark);\n}\n\n/** Thrown when the text does not fit the biggest code (version 40) at the asked level. */\nexport class QrTooLongError extends Error {\n constructor(length: number, level: QrLevel) {\n super(`The text (${length} bytes) is too long for a QR code at level ${level}.`);\n this.name = \"QrTooLongError\";\n }\n}\n\n/** The smallest version whose data capacity holds the bytes (mode and length fields included). */\nfunction smallestVersion(bytes: readonly number[], level: QrLevel): number {\n for (let version = 1; version <= 40; version++) {\n if (4 + (version <= 9 ? 8 : 16) + bytes.length * 8 <= dataCodewords(version, level) * 8) return version;\n }\n throw new QrTooLongError(bytes.length, level);\n}\n\n/** The grid with one mask applied to its data modules and its format bits written. */\nfunction masked(base: Grid, mask: number, level: QrLevel): boolean[][] {\n const dark = base.dark.map((row) => [...row]);\n const fn = base.fn.map((row) => [...row]);\n for (let y = 0; y < base.size; y++) for (let x = 0; x < base.size; x++) if (!fn[y]![x] && MASKS[mask]!(x, y)) dark[y]![x] = !dark[y]![x];\n drawFormat(dark, fn, base.size, level, mask);\n return dark;\n}\n\n/** Encodes a text as a QR code: the smallest version that holds it at `level`, the best of the eight masks. */\nexport function encodeQr(text: string, level: QrLevel = \"M\"): QrMatrix {\n const bytes = utf8(text);\n const version = smallestVersion(bytes, level);\n const base = drawFunctionPatterns(version, level);\n placeData(base, codewords(bytes, version, level));\n const candidates = MASKS.map((_, mask) => masked(base, mask, level));\n const scores = candidates.map(penalty);\n return candidates[scores.indexOf(Math.min(...scores))]!;\n}\n\n/**\n * The drawing of a matrix as one SVG path: a rectangle per horizontal run of dark modules, in module units, offset by\n * the quiet zone. Shared by the web `<svg>` and the native `<Path>`.\n */\nexport function qrPath(matrix: QrMatrix, quiet: number): string {\n const parts: string[] = [];\n matrix.forEach((row, y) => {\n for (let x = 0; x < row.length; x++) {\n if (!row[x]) continue;\n let end = x;\n while (end + 1 < row.length && row[end + 1]) end++;\n parts.push(`M${x + quiet} ${y + quiet}h${end - x + 1}v1h${x - end - 1}z`);\n x = end;\n }\n });\n return parts.join(\"\");\n}\n","// Client (the copy action). A QR code drawn from a text, offline: an SVG of dark modules on a light tile, whatever the\n// theme (a phone reads dark on light), with its quiet zone. No call to any service; the text never leaves the page.\nimport * as React from \"react\";\n\nimport { Button } from \"../button/button\";\nimport { cn } from \"../cn\";\nimport { CheckGlyph, CopyGlyph } from \"../glyphs\";\nimport { encodeQr, type QrLevel, qrPath } from \"./encode\";\n\n// The tile and the modules are the same in dark and light on purpose: a scanner needs dark modules on a light ground.\nexport const QR_TILE = \"#ffffff\";\nexport const QR_MODULE = \"#0b0f19\";\n\nexport type QrCodeProps = {\n /** The text to encode — an address, a feed URL. Encoded here, in the browser (or on the server); never sent anywhere. */\n value: string;\n /** What the code is, for a screen reader (“Calendar feed — scan with your phone”), passed translated. The image is named by it. */\n label: string;\n /** The side of the tile, in px, quiet zone included. Default 176. */\n size?: number;\n /** The quiet zone, in modules, around the code (the standard asks for 4). Default 4, never less than 2. */\n quietZone?: number;\n /** The error-correction level: L · M (default) · Q · H (a logo or wear on the print). */\n level?: QrLevel;\n /** The words of the copy action, passed translated. Without them there is no « copy » button. */\n copyLabel?: string;\n /** Said once the text is on the clipboard. Default: the copy label. */\n copiedLabel?: string;\n /** Called after the text is copied. */\n onCopy?: () => void;\n /** Classes merged last, on the wrapper. */\n className?: string;\n};\n\n/** A QR code from a text: dark modules on a light tile in both themes, a quiet zone, an accessible name, an optional copy action. */\nexport function QrCode({ value, label, size = 176, quietZone = 4, level = \"M\", copyLabel, copiedLabel, onCopy, className }: QrCodeProps) {\n const quiet = Math.max(2, Math.round(quietZone));\n const { matrix, path } = React.useMemo(() => {\n const m = encodeQr(value, level);\n return { matrix: m, path: qrPath(m, quiet) };\n }, [value, level, quiet]);\n const modules = matrix.length + quiet * 2;\n const [copied, setCopied] = React.useState(false);\n React.useEffect(() => {\n if (!copied) return;\n const t = setTimeout(() => setCopied(false), 1800);\n return () => clearTimeout(t);\n }, [copied]);\n const copy = () =>\n navigator.clipboard?.writeText(value).then(() => {\n setCopied(true);\n onCopy?.();\n });\n\n return (\n <div className={cn(\"inline-flex flex-col items-start gap-3\", className)} data-qr-code>\n <svg\n role=\"img\"\n aria-label={label}\n viewBox={`0 0 ${modules} ${modules}`}\n width={size}\n height={size}\n shapeRendering=\"crispEdges\"\n className=\"block max-w-full rounded-lg border border-border-default\"\n style={{ height: \"auto\", aspectRatio: \"1 / 1\" }}\n >\n <rect width={modules} height={modules} fill={QR_TILE} />\n <path d={path} fill={QR_MODULE} />\n </svg>\n {copyLabel ? (\n <Button type=\"button\" variant=\"secondary\" size=\"sm\" onClick={copy} announce={copied ? (copiedLabel ?? copyLabel) : undefined}>\n {copied ? <CheckGlyph className=\"h-3.5 w-3.5\" /> : <CopyGlyph className=\"h-3.5 w-3.5\" />}\n {copied ? (copiedLabel ?? copyLabel) : copyLabel}\n </Button>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AASA,IAAM,cAAuC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AACtE,IAAM,aAAsC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE;AAGrE,IAAM,gBAAgB;AAAA,EACpB,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAAA,EAClK,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;AAAA,EACnK,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,I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ts, for a QR code or a « copy the vCard » action. Pure and server-safe:\n// no dependency, nothing sent anywhere. Lines without a value are left out.\n\nexport interface VCardFields {\n /** The name a phone shows (FN): the trade name, or the person's name. */\n name: string;\n /** The organisation (ORG): the legal name. */\n organization?: string | null;\n /** The postal address, each part optional. */\n address?: { street?: string | null; city?: string | null; region?: string | null; postalCode?: string | null; country?: string | null } | null;\n email?: string | null;\n phone?: string | null;\n /** The website (URL). */\n url?: string | null;\n}\n\n/** Escapes a value for a vCard text field: backslash, newline, comma and semicolon. */\nexport const escapeVCard = (value: string): string => value.replace(/[\\\\,;]/g, String.raw`\\$&`).replace(/\\r?\\n/g, String.raw`\\n`);\n\nconst present = (value: string | null | undefined): value is string => typeof value === \"string\" && value.trim() !== \"\";\n\n/** The vCard 3.0 text of the fields, lines joined by CRLF as the format asks. */\nexport function vCard(fields: VCardFields): string {\n const { name, organization, address, email, phone, url } = fields;\n const parts = address ? [address.street, address.city, address.region, address.postalCode, address.country] : [];\n const lines = [\n \"BEGIN:VCARD\",\n \"VERSION:3.0\",\n `FN:${escapeVCard(name.trim())}`,\n present(organization) ? `ORG:${escapeVCard(organization.trim())}` : null,\n parts.some(present) ? `ADR;TYPE=WORK:;;${parts.map((part) => escapeVCard((part ?? \"\").trim())).join(\";\")}` : null,\n present(email) ? `EMAIL;TYPE=WORK:${escapeVCard(email.trim())}` : null,\n present(phone) ? `TEL;TYPE=WORK:${escapeVCard(phone.trim())}` : null,\n present(url) ? `URL:${escapeVCard(url.trim())}` : null,\n \"END:VCARD\",\n ];\n return lines.filter((line): line is string => line !== null).join(\"\\r\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;AAiBO,IAAM,cAAc,CAAC,UAA0B,MAAM,QAAQ,WAAW,OAAO,QAAQ,EAAE,QAAQ,UAAU,OAAO,OAAO;AAEhI,IAAM,UAAU,CAAC,UAAsD,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM;AAG9G,SAAS,MAAM,QAA6B;AACjD,QAAM,EAAE,MAAM,cAAc,SAAS,OAAO,OAAO,IAAI,IAAI;AAC3D,QAAM,QAAQ,UAAU,CAAC,QAAQ,QAAQ,QAAQ,MAAM,QAAQ,QAAQ,QAAQ,YAAY,QAAQ,OAAO,IAAI,CAAC;AAC/G,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA;AAAA,IACA,MAAM,YAAY,KAAK,KAAK,CAAC,CAAC;AAAA,IAC9B,QAAQ,YAAY,IAAI,OAAO,YAAY,aAAa,KAAK,CAAC,CAAC,KAAK;AAAA,IACpE,MAAM,KAAK,OAAO,IAAI,mBAAmB,MAAM,IAAI,CAAC,SAAS,aAAa,QAAQ,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,KAAK;AAAA,IAC7G,QAAQ,KAAK,IAAI,mBAAmB,YAAY,MAAM,KAAK,CAAC,CAAC,KAAK;AAAA,IAClE,QAAQ,KAAK,IAAI,iBAAiB,YAAY,MAAM,KAAK,CAAC,CAAC,KAAK;AAAA,IAChE,QAAQ,GAAG,IAAI,OAAO,YAAY,IAAI,KAAK,CAAC,CAAC,KAAK;AAAA,IAClD;AAAA,EACF;AACA,SAAO,MAAM,OAAO,CAAC,SAAyB,SAAS,IAAI,EAAE,KAAK,MAAM;AAC1E;","names":[]}
@@ -1,7 +1,10 @@
1
1
  import * as tailwind_variants from 'tailwind-variants';
2
2
  import * as React from 'react';
3
3
 
4
- /** A Krizaka brand: the company and its three products. */
4
+ /**
5
+ * A Krizaka brand by its code name: the company and its three products — sold as Verikora (`yomizaka`), Folioviv
6
+ * (`akinaza`) and Sovkora (`orazaka`). It also keys the brand palettes (maps, forms, loaders).
7
+ */
5
8
  type BrandId = "krizaka" | "orazaka" | "yomizaka" | "akinaza";
6
9
 
7
10
  declare const railNav: tailwind_variants.TVReturnType<{
@@ -88,7 +88,7 @@ declare const SECTION_DEFINITIONS: readonly [SectionDefinitionOf<"hero", readonl
88
88
  }, z.core.$strip>;
89
89
  }>, SectionDefinitionOf<"booking", readonly ["strip", "panel", "closing", "sticky"], z.ZodMiniObject<{
90
90
  serviceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
91
- count: z.ZodMiniUnion<[z.ZodMiniLiteral<6 | 3 | 4>, z.ZodMiniLiteral<6 | 3 | 4>]>;
91
+ count: z.ZodMiniUnion<[z.ZodMiniLiteral<3 | 4 | 6>, z.ZodMiniLiteral<3 | 4 | 6>]>;
92
92
  }, z.core.$strip>, Record<never, never>>, SectionDefinitionOf<"gallery", readonly ["mosaic", "filmstrip", "wall", "grid"], z.ZodMiniObject<{
93
93
  source: z.ZodMiniEnum<{
94
94
  all: "all";
package/dist/shop.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as ShopPage } from './schema-CL7t7xqb.js';
2
- export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-CL7t7xqb.js';
1
+ import { S as ShopPage } from './schema-DgjBz7-8.js';
2
+ export { L as LocalizedText, P as ParsedSection, b as SECTION_DEFINITIONS, c as SECTION_TYPES, d as SHOP_SCHEMA_VERSION, a as Section, e as SectionDefinition, f as SectionOf, g as SectionSpec, h as SectionType, i as ShopPageIssue, j as ShopPageResult, k as defineSection, p as parseShopPage, s as sectionDefinition, l as shopPageSchema } from './schema-DgjBz7-8.js';
3
3
  export { b as ShopFrame, c as ShopFrameProps, a as ShopPhoto, d as ShopSection, S as ShopSectionProps } from './frame-CNZ5VgDD.js';
4
4
  import 'zod/mini';
5
5
  import 'react';
@@ -86,6 +86,12 @@ interface OrgFacts {
86
86
  brand: {
87
87
  name: string;
88
88
  };
89
+ /**
90
+ * Every name of the family (`org.family` of `@krizaka/org`, krizaka/krizaka-internal#754): when given, the footer reads
91
+ * the names and addresses here, never from this package's registry — the company « Krizaka », products by their own
92
+ * name, libraries « Krizaka <X> ».
93
+ */
94
+ family?: readonly OrgFamilyEntry[];
89
95
  footer: {
90
96
  /** « Une entreprise de Technologies Krizaka · Fait à Montréal ». */
91
97
  line: Record<SiteLocale, string>;
@@ -96,16 +102,25 @@ interface OrgFacts {
96
102
  }[];
97
103
  };
98
104
  }
105
+ /** One entry of `org.family` (`@krizaka/org`), the part the footer reads. */
106
+ interface OrgFamilyEntry {
107
+ id: string;
108
+ name: string;
109
+ group: SiteGroup;
110
+ status: "released" | "development";
111
+ url: string;
112
+ }
99
113
 
114
+ type Tone = "product" | "cahier";
100
115
  type SiteFooterProps = Omit<React.ComponentProps<"footer">, "children"> & {
101
- /** The site this footer belongs to (`@krizaka/ui/sites`): its mark and line, its signature, marked in the family. */
116
+ /** The site this footer belongs to (`@krizaka/ui/sites`): marked in the family, its address for `path`. */
102
117
  current: SiteId;
103
118
  /**
104
119
  * The family's words, passed translated: `familyLabels.fr` from `@krizaka/ui/sites`, or your own of the same shape.
105
120
  * @default familyLabels.en
106
121
  */
107
122
  labels?: FamilyLabels;
108
- /** The site's own columns (`SiteFooter.Column`), before the family. */
123
+ /** The site's own link groups (`SiteFooter.Column`), on the first line. */
109
124
  children?: React.ReactNode;
110
125
  /** The version the site runs (`1.2.3`, shown `v1.2.3`). */
111
126
  version?: string;
@@ -113,37 +128,35 @@ type SiteFooterProps = Omit<React.ComponentProps<"footer">, "children"> & {
113
128
  env?: string;
114
129
  /**
115
130
  * The path of the page being read on this site (`/en/story`, `/blog/…`): the company link that points to this very
116
- * page says so (`aria-current="page"`, a visible state) and a click on it scrolls to the top instead of reloading.
131
+ * page says so (`aria-current="page"`) and a click on it scrolls to the top instead of reloading.
117
132
  */
118
133
  path?: string;
119
134
  /**
120
- * Shows the family in columns. Only the hub, krizaka.com, lists the family: every other site (ui., java., the blog, the
121
- * products) holds its own columns, the legal links, the version and one quiet publisher line — “A Krizaka project” —
122
- * that links back to www.krizaka.com, the only way back between the sites (2026-10-22).
123
- * @default current === "krizaka"
135
+ * Shows the family on the second line, folded on a phone. The links to the other sites live on krizaka.com only
136
+ * (founder rule, 2026-10-30): every other site and its documentation opts in on purpose, none by default.
137
+ * @default current === "krizaka" (and never in `variant="app"`)
124
138
  */
125
139
  family?: boolean;
126
- /**
127
- * The hub's product list: only these products appear in the Products column (krizaka.com shows its focus products,
128
- * and all of them once the reader asks for the whole notebook). Omit it to list every product.
129
- */
140
+ /** Only these products in the Products group (the current site always kept). Omit it to list every product. */
130
141
  products?: readonly SiteId[];
131
142
  /**
132
- * The organisation's public facts (`org` of `@krizaka/org`). The signature line is then `org.footer.line` — « Une
133
- * entreprise de Technologies Krizaka · Fait à Montréal », the same on every site — and, when `legal` is not given, the
134
- * legal links are `org.footer.legal`, in the language of `labels`. No site writes these lines by hand.
143
+ * The organisation's public facts (`org` of `@krizaka/org`) — pass them on every site. The names and addresses of the
144
+ * family are then `org.family`, the signature is `org.footer.line` (« Une entreprise de Technologies Krizaka · Fait à
145
+ * Montréal », the same everywhere) and, without `legal`, the legal links are `org.footer.legal`.
135
146
  */
136
147
  org?: OrgFacts;
137
- /** The end of the signature line: legal links, a language switch (`SiteFooter.Link`s or any inline content). */
148
+ /** The legal links, when not the org's (`SiteFooter.Link`s). */
138
149
  legal?: React.ReactNode;
150
+ /** The host's controls at the end of the last line: the language switch, the theme toggle. */
151
+ controls?: React.ReactNode;
139
152
  /**
140
- * `site` — the full footer of a marketing or company site. `docs` — a compact one for documentation pages (no site
141
- * block, the columns in a row, the documentation's width; never the family). `app` — one slim line inside a signed-in
142
- * product: the publisher line, the version and the legal links (no columns, no family); render it once, in the
143
- * layout, and not at all where the app shell has a sidebar that holds them.
153
+ * `site` — every public site. `docs` — the same under documentation, on its width. `app` — inside a signed-in product:
154
+ * the last line only; render it once, in the layout.
144
155
  * @default "site"
145
156
  */
146
157
  variant?: "site" | "docs" | "app";
158
+ /** `cahier` on the Cahier sites (www, blog, ui., java., ts., lab.), `product` in the products. @default "product" */
159
+ tone?: Tone;
147
160
  };
148
161
 
149
162
  interface SiteCahierNavItem {