@vowt-tech/ui 0.0.0-stage → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/bin/vowt-ux-ui-design.mjs +483 -0
- package/guia/LEIA-PRIMEIRO.md +106 -0
- package/guia/VERSAO +1 -0
- package/guia/componentes.md +104 -0
- package/guia/regras/atualizar.md +136 -0
- package/guia/regras/componentes.md +374 -0
- package/guia/regras/fundamentos.md +257 -0
- package/guia/regras/marca.md +200 -0
- package/guia/regras/medidas.md +114 -0
- package/guia/regras/regras-de-base.md +85 -0
- package/guia/regras/telas/acoes.md +56 -0
- package/guia/regras/telas/direcao-ux.md +327 -0
- package/guia/regras/telas/padroes.md +58 -0
- package/guia/regras/telas/regras.md +171 -0
- package/guia/regras/telas/voz.md +134 -0
- package/package.json +72 -4
- package/src/brand/icons.ts +215 -0
- package/src/brand/logo.tsx +288 -0
- package/src/components/accordion.tsx +58 -0
- package/src/components/ai-orb.tsx +67 -0
- package/src/components/alert-dialog.tsx +227 -0
- package/src/components/alert.tsx +128 -0
- package/src/components/area-chart.tsx +180 -0
- package/src/components/attachment.tsx +339 -0
- package/src/components/avatar.tsx +197 -0
- package/src/components/badge.tsx +242 -0
- package/src/components/bar-chart.tsx +138 -0
- package/src/components/bar-list.tsx +85 -0
- package/src/components/brand-icon.tsx +52 -0
- package/src/components/breadcrumb.tsx +96 -0
- package/src/components/button-group.tsx +29 -0
- package/src/components/button.tsx +208 -0
- package/src/components/calendar.tsx +238 -0
- package/src/components/card.tsx +136 -0
- package/src/components/chart.tsx +289 -0
- package/src/components/checkbox.tsx +42 -0
- package/src/components/code-block.tsx +31 -0
- package/src/components/collapsible.tsx +114 -0
- package/src/components/color-picker.tsx +93 -0
- package/src/components/combo-chart.tsx +139 -0
- package/src/components/combobox.tsx +200 -0
- package/src/components/command.tsx +191 -0
- package/src/components/date-picker.tsx +435 -0
- package/src/components/description-list.tsx +280 -0
- package/src/components/dialog.tsx +192 -0
- package/src/components/diff-view.tsx +109 -0
- package/src/components/dropdown-menu.tsx +248 -0
- package/src/components/emoji-picker.tsx +299 -0
- package/src/components/empty.tsx +197 -0
- package/src/components/field.tsx +226 -0
- package/src/components/file-upload.tsx +186 -0
- package/src/components/funnel-chart.tsx +224 -0
- package/src/components/gauge-chart.tsx +109 -0
- package/src/components/heatmap.tsx +105 -0
- package/src/components/hover-card.tsx +47 -0
- package/src/components/image-viewer.tsx +174 -0
- package/src/components/input-otp.tsx +86 -0
- package/src/components/input.tsx +470 -0
- package/src/components/item.tsx +94 -0
- package/src/components/kbd.tsx +28 -0
- package/src/components/label.tsx +21 -0
- package/src/components/line-chart.tsx +92 -0
- package/src/components/link.tsx +34 -0
- package/src/components/message.tsx +903 -0
- package/src/components/number-field.tsx +79 -0
- package/src/components/pagination.tsx +208 -0
- package/src/components/phone-input.tsx +147 -0
- package/src/components/pie-chart.tsx +117 -0
- package/src/components/popover.tsx +102 -0
- package/src/components/powered-by.tsx +39 -0
- package/src/components/progress.tsx +278 -0
- package/src/components/prose.tsx +42 -0
- package/src/components/radar-chart.tsx +66 -0
- package/src/components/radial-chart.tsx +73 -0
- package/src/components/radio-group.tsx +135 -0
- package/src/components/rating.tsx +192 -0
- package/src/components/rich-text.tsx +1651 -0
- package/src/components/scatter-chart.tsx +115 -0
- package/src/components/scroll-area.tsx +50 -0
- package/src/components/select.tsx +193 -0
- package/src/components/separator.tsx +20 -0
- package/src/components/sheet.tsx +142 -0
- package/src/components/sidebar.tsx +570 -0
- package/src/components/skeleton.tsx +18 -0
- package/src/components/slider.tsx +47 -0
- package/src/components/sonner.tsx +178 -0
- package/src/components/sparkline.tsx +68 -0
- package/src/components/spinner.tsx +35 -0
- package/src/components/status-dot.tsx +45 -0
- package/src/components/stepper.tsx +228 -0
- package/src/components/switch.tsx +35 -0
- package/src/components/table.tsx +267 -0
- package/src/components/tabs.tsx +184 -0
- package/src/components/tag-input.tsx +238 -0
- package/src/components/textarea.tsx +47 -0
- package/src/components/time-picker.tsx +183 -0
- package/src/components/timeline.tsx +75 -0
- package/src/components/toggle-group.tsx +93 -0
- package/src/components/toggle.tsx +51 -0
- package/src/components/tooltip.tsx +160 -0
- package/src/components/tree.tsx +136 -0
- package/src/components/voice-message.tsx +193 -0
- package/src/css.d.ts +2 -0
- package/src/hooks/use-appearance.ts +57 -0
- package/src/hooks/use-mobile.ts +20 -0
- package/src/lib/appearance.ts +16 -0
- package/src/lib/button-render.ts +32 -0
- package/src/lib/char-count.tsx +67 -0
- package/src/lib/date.ts +45 -0
- package/src/lib/file-accept.ts +59 -0
- package/src/lib/markdown.ts +187 -0
- package/src/lib/utils.ts +29 -0
- package/src/lib/voice.ts +68 -0
- package/src/styles/shadcn.css +642 -0
- package/src/styles/theme.css +1825 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Texto colado em Markdown vira o conteúdo do Rich text. Só lê o que as ferramentas ligadas
|
|
2
|
+
// fazem; a marcação de uma ferramenta desligada fica como texto, igual a digitar.
|
|
3
|
+
|
|
4
|
+
/** Ferramentas que o Markdown sabe fazer. */
|
|
5
|
+
export type MarkdownTool = 'heading' | 'bold' | 'italic' | 'list' | 'divider';
|
|
6
|
+
|
|
7
|
+
/** As ferramentas ligadas no editor. */
|
|
8
|
+
export type MarkdownAllow = { has: (tool: MarkdownTool) => boolean };
|
|
9
|
+
|
|
10
|
+
type Mark = { type: 'bold' | 'italic' };
|
|
11
|
+
export type MarkdownNode = {
|
|
12
|
+
type: string;
|
|
13
|
+
attrs?: { level?: number; start?: number };
|
|
14
|
+
content?: MarkdownNode[];
|
|
15
|
+
text?: string;
|
|
16
|
+
marks?: Mark[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const HEADING = /^ {0,3}(#{1,6})[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/;
|
|
20
|
+
const EMPTY_HEADING = /^ {0,3}(#{1,6})[ \t]*$/;
|
|
21
|
+
const BULLET = /^([ \t]*)[-*+][ \t]+(.*)$/;
|
|
22
|
+
const ORDERED = /^([ \t]*)(\d{1,9})[.)][ \t]+(.*)$/;
|
|
23
|
+
const DIVIDER = /^ {0,3}([-*_])(?:[ \t]*\1){2,}[ \t]*$/;
|
|
24
|
+
const BOLD = /\*\*(?=\S)(.+?)(?<=\S)\*\*(?!\*)/;
|
|
25
|
+
const ITALIC = /(?<![*\w])\*(?=[^\s*])([^*]*?)(?<=[^\s*])\*(?![*\w])/;
|
|
26
|
+
|
|
27
|
+
// Caractere escapado, como \*, guardado num código de uso privado até o fim.
|
|
28
|
+
const ESCAPED = /\\([\\*#_\-+.!`[\]()])/g;
|
|
29
|
+
const hide = (s: string) =>
|
|
30
|
+
s.replace(ESCAPED, (_, c: string) => String.fromCharCode(0xe000 + c.charCodeAt(0)));
|
|
31
|
+
const show = (s: string) =>
|
|
32
|
+
Array.from(s, (c) => {
|
|
33
|
+
const n = c.charCodeAt(0);
|
|
34
|
+
return n >= 0xe000 && n <= 0xe0ff ? String.fromCharCode(n - 0xe000) : c;
|
|
35
|
+
}).join('');
|
|
36
|
+
|
|
37
|
+
const width = (indent: string) => indent.replace(/\t/g, ' ').length;
|
|
38
|
+
|
|
39
|
+
/** Negrito e itálico de uma linha, só os ligados. */
|
|
40
|
+
function inline(text: string, allow: MarkdownAllow, marks: Mark[] = []): MarkdownNode[] {
|
|
41
|
+
const out: MarkdownNode[] = [];
|
|
42
|
+
const push = (t: string) => {
|
|
43
|
+
if (!t) return;
|
|
44
|
+
out.push(
|
|
45
|
+
marks.length ? { type: 'text', text: show(t), marks } : { type: 'text', text: show(t) },
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
let rest = text;
|
|
49
|
+
while (rest) {
|
|
50
|
+
const b = allow.has('bold') && !marks.some((m) => m.type === 'bold') ? BOLD.exec(rest) : null;
|
|
51
|
+
const i =
|
|
52
|
+
allow.has('italic') && !marks.some((m) => m.type === 'italic') ? ITALIC.exec(rest) : null;
|
|
53
|
+
const hit = b && (!i || b.index <= i.index) ? b : i;
|
|
54
|
+
if (!hit) break;
|
|
55
|
+
push(rest.slice(0, hit.index));
|
|
56
|
+
out.push(...inline(hit[1]!, allow, [...marks, { type: hit === b ? 'bold' : 'italic' }]));
|
|
57
|
+
rest = rest.slice(hit.index + hit[0].length);
|
|
58
|
+
}
|
|
59
|
+
push(rest);
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const paragraph = (text: string, allow: MarkdownAllow): MarkdownNode => {
|
|
64
|
+
const content = inline(text, allow);
|
|
65
|
+
return content.length ? { type: 'paragraph', content } : { type: 'paragraph' };
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type Item = { indent: number; ordered: boolean; start: number; text: string };
|
|
69
|
+
|
|
70
|
+
/** Itens seguidos viram listas, com as de dentro pelo recuo. */
|
|
71
|
+
function lists(items: Item[], allow: MarkdownAllow): MarkdownNode[] {
|
|
72
|
+
let i = 0;
|
|
73
|
+
const build = (): MarkdownNode => {
|
|
74
|
+
const first = items[i]!;
|
|
75
|
+
const list: MarkdownNode = first.ordered
|
|
76
|
+
? { type: 'orderedList', attrs: { start: first.start }, content: [] }
|
|
77
|
+
: { type: 'bulletList', content: [] };
|
|
78
|
+
const entries = list.content!;
|
|
79
|
+
while (i < items.length) {
|
|
80
|
+
const it = items[i]!;
|
|
81
|
+
if (it.indent < first.indent) break;
|
|
82
|
+
if (it.indent > first.indent) {
|
|
83
|
+
if (!entries.length) entries.push({ type: 'listItem', content: [{ type: 'paragraph' }] });
|
|
84
|
+
entries.at(-1)!.content!.push(build());
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (it.ordered !== first.ordered) break;
|
|
88
|
+
entries.push({ type: 'listItem', content: [paragraph(it.text, allow)] });
|
|
89
|
+
i++;
|
|
90
|
+
}
|
|
91
|
+
return list;
|
|
92
|
+
};
|
|
93
|
+
const out: MarkdownNode[] = [];
|
|
94
|
+
while (i < items.length) out.push(build());
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Diz se o texto tem marcação de alguma ferramenta ligada. */
|
|
99
|
+
export function looksLikeMarkdown(text: string, allow: MarkdownAllow): boolean {
|
|
100
|
+
const src = hide(text);
|
|
101
|
+
return src.split(/\r\n?|\n/).some((line) => {
|
|
102
|
+
if (allow.has('heading') && (HEADING.test(line) || EMPTY_HEADING.test(line))) return true;
|
|
103
|
+
if (allow.has('divider') && DIVIDER.test(line)) return true;
|
|
104
|
+
if (allow.has('list') && (BULLET.test(line) || ORDERED.test(line))) return true;
|
|
105
|
+
if (allow.has('bold') && BOLD.test(line)) return true;
|
|
106
|
+
return allow.has('italic') && ITALIC.test(line);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Markdown para os blocos do editor: `#`, `##` e `###` são Título 1, 2 e 3, e `####` em diante
|
|
112
|
+
* também Título 3; `- `, `* ` e `+ ` são lista; `1. ` é lista numerada; `**negrito**`,
|
|
113
|
+
* `*itálico*` e `---` como linha. Linha em branco separa parágrafos; linhas seguidas se juntam,
|
|
114
|
+
* como no Markdown. Sem nenhuma marcação ligada, devolve null, e o texto entra como sempre.
|
|
115
|
+
*/
|
|
116
|
+
export function markdownToRich(text: string, allow: MarkdownAllow): MarkdownNode[] | null {
|
|
117
|
+
if (!looksLikeMarkdown(text, allow)) return null;
|
|
118
|
+
const lines = hide(text).split(/\r\n?|\n/);
|
|
119
|
+
const out: MarkdownNode[] = [];
|
|
120
|
+
let para: string[] = [];
|
|
121
|
+
let items: Item[] = [];
|
|
122
|
+
const flush = () => {
|
|
123
|
+
if (para.length) out.push(paragraph(para.join(' '), allow));
|
|
124
|
+
para = [];
|
|
125
|
+
if (items.length) out.push(...lists(items, allow));
|
|
126
|
+
items = [];
|
|
127
|
+
};
|
|
128
|
+
for (let n = 0; n < lines.length; n++) {
|
|
129
|
+
const line = lines[n]!;
|
|
130
|
+
if (!line.trim()) {
|
|
131
|
+
// Linha em branco entre itens não quebra a lista.
|
|
132
|
+
const next = lines.slice(n + 1).find((l) => l.trim());
|
|
133
|
+
if (!(items.length && next && allow.has('list') && (BULLET.test(next) || ORDERED.test(next))))
|
|
134
|
+
flush();
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const heading = allow.has('heading') && (HEADING.exec(line) ?? EMPTY_HEADING.exec(line));
|
|
138
|
+
if (heading) {
|
|
139
|
+
flush();
|
|
140
|
+
const content = inline(heading[2]?.trim() ?? '', allow);
|
|
141
|
+
out.push({
|
|
142
|
+
type: 'heading',
|
|
143
|
+
attrs: { level: Math.min(heading[1]!.length, 3) },
|
|
144
|
+
...(content.length ? { content } : {}),
|
|
145
|
+
});
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (allow.has('divider') && DIVIDER.test(line)) {
|
|
149
|
+
flush();
|
|
150
|
+
out.push({ type: 'horizontalRule' });
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const item = allow.has('list') && (BULLET.exec(line) ?? ORDERED.exec(line));
|
|
154
|
+
if (item) {
|
|
155
|
+
if (para.length) {
|
|
156
|
+
out.push(paragraph(para.join(' '), allow));
|
|
157
|
+
para = [];
|
|
158
|
+
}
|
|
159
|
+
const ordered = item.length === 4;
|
|
160
|
+
items.push({
|
|
161
|
+
indent: width(item[1]!),
|
|
162
|
+
ordered,
|
|
163
|
+
start: ordered ? Number(item[2]) : 1,
|
|
164
|
+
text: (ordered ? item[3]! : item[2]!).trim(),
|
|
165
|
+
});
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
// Linha recuada logo depois de um item continua o item.
|
|
169
|
+
if (items.length && /^[ \t]/.test(line)) {
|
|
170
|
+
const last = items.at(-1)!;
|
|
171
|
+
last.text = `${last.text} ${line.trim()}`;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (items.length) flush();
|
|
175
|
+
para.push(line.trim());
|
|
176
|
+
}
|
|
177
|
+
flush();
|
|
178
|
+
return out.length ? out : null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* HTML colado que não tem formatação de verdade, como o que um editor de código copia, só com
|
|
183
|
+
* blocos e cores. Nesse caso o texto puro vale, e o Markdown dele é lido.
|
|
184
|
+
*/
|
|
185
|
+
export function htmlHasFormatting(html: string): boolean {
|
|
186
|
+
return /<(p|h[1-6]|ul|ol|li|b|strong|em|i|u|table|a|img|blockquote|pre|hr)[\s>/]/i.test(html);
|
|
187
|
+
}
|
package/src/lib/utils.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createCn } from 'cn/config';
|
|
2
|
+
|
|
3
|
+
// Junta classes do Tailwind e resolve conflitos. As classes de texto da escala (text-heading-20,
|
|
4
|
+
// text-body-13-semibold...) precisam ser reconhecidas como tamanho: sem isso, uma cor como
|
|
5
|
+
// text-primary-foreground apaga a classe de texto, porque as duas começam com "text-", e o botão
|
|
6
|
+
// perde o peso. Uma regra, e não uma lista, para valer com qualquer tamanho da escala (D-360).
|
|
7
|
+
const TEXT_SCALE = /^(display|heading|body|mono)-\d+(-(regular|medium|semibold))?$/;
|
|
8
|
+
|
|
9
|
+
// Tokens de função do tema, D-682. Sem isso, rounded-control e rounded-full ficariam juntos, e
|
|
10
|
+
// text-title-page seria lido como cor. Criou um token de função em theme.css, pôr o nome aqui.
|
|
11
|
+
const SPACING_ROLE =
|
|
12
|
+
/^(control|icon)(-(xs|sm|lg|xl))?$|^icon-(menu|nav|solo)$|^page-(x|y)$|^section$|^card(-(sm|lg))?$/;
|
|
13
|
+
const RADIUS_ROLE = /^(control|menu|inner|item|small|badge|card)$/;
|
|
14
|
+
const TEXT_ROLE = /^title-(page|dialog|card)$|^stat(-(sm|lg|chart))?$/;
|
|
15
|
+
const SHADOW_ROLE = /^(card|panel|menu|dialog|bubble|raised|float|popup)$/;
|
|
16
|
+
|
|
17
|
+
export const cn = createCn({
|
|
18
|
+
extend: {
|
|
19
|
+
theme: {
|
|
20
|
+
spacing: [(value: string) => SPACING_ROLE.test(value)],
|
|
21
|
+
radius: [(value: string) => RADIUS_ROLE.test(value)],
|
|
22
|
+
shadow: [(value: string) => SHADOW_ROLE.test(value)],
|
|
23
|
+
text: [(value: string) => TEXT_ROLE.test(value)],
|
|
24
|
+
},
|
|
25
|
+
classGroups: {
|
|
26
|
+
'font-size': [{ text: [(value: string) => TEXT_SCALE.test(value)] }],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
package/src/lib/voice.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Contas da mensagem de voz, D-845: relógio, ondas e o teclado do controle de posição. Ficam fora
|
|
2
|
+
// do componente para os testes rodarem sem navegador, em `tests/voice.test.ts`.
|
|
3
|
+
|
|
4
|
+
/** Segundos viram "0:19" ou "1:02:05". Valor inválido vira "0:00". */
|
|
5
|
+
export function formatClock(seconds: number): string {
|
|
6
|
+
const total = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0;
|
|
7
|
+
const h = Math.floor(total / 3600);
|
|
8
|
+
const m = Math.floor((total % 3600) / 60);
|
|
9
|
+
const s = String(total % 60).padStart(2, '0');
|
|
10
|
+
return h > 0 ? `${h}:${String(m).padStart(2, '0')}:${s}` : `${m}:${s}`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** "1:02" ou "1:02:05" viram segundos; número passa direto. Fora do formato, undefined. */
|
|
14
|
+
export function parseClock(value: number | string | undefined): number | undefined {
|
|
15
|
+
if (value === undefined) return undefined;
|
|
16
|
+
if (typeof value === 'number') return Number.isFinite(value) && value >= 0 ? value : undefined;
|
|
17
|
+
const parts = value.trim().split(':');
|
|
18
|
+
if (parts.length < 2 || parts.length > 3 || parts.some((p) => !/^\d+$/.test(p))) return undefined;
|
|
19
|
+
return parts.reduce((acc, p) => acc * 60 + Number(p), 0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Teclado do controle de posição, como num controle deslizante: setas andam 5 segundos, Page Up e
|
|
24
|
+
* Page Down andam 10% do áudio, Home volta ao começo e End vai ao fim. Outra tecla, undefined.
|
|
25
|
+
*/
|
|
26
|
+
export function seekByKey(key: string, current: number, total: number): number | undefined {
|
|
27
|
+
if (!(total > 0)) return undefined;
|
|
28
|
+
const step = 5;
|
|
29
|
+
const page = Math.max(step, total / 10);
|
|
30
|
+
const next =
|
|
31
|
+
key === 'ArrowRight' || key === 'ArrowUp'
|
|
32
|
+
? current + step
|
|
33
|
+
: key === 'ArrowLeft' || key === 'ArrowDown'
|
|
34
|
+
? current - step
|
|
35
|
+
: key === 'PageUp'
|
|
36
|
+
? current + page
|
|
37
|
+
: key === 'PageDown'
|
|
38
|
+
? current - page
|
|
39
|
+
: key === 'Home'
|
|
40
|
+
? 0
|
|
41
|
+
: key === 'End'
|
|
42
|
+
? total
|
|
43
|
+
: undefined;
|
|
44
|
+
return next === undefined ? undefined : Math.min(total, Math.max(0, next));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Ondas da mensagem: as alturas que o app passa, de 0 a 1, reamostradas para `count` barras. Sem
|
|
49
|
+
* elas, um desenho fixo tirado de `seed`, o endereço do áudio, para a mesma mensagem ter sempre as
|
|
50
|
+
* mesmas ondas.
|
|
51
|
+
*/
|
|
52
|
+
export function waveformBars(values: number[] | undefined, count: number, seed = ''): number[] {
|
|
53
|
+
if (values && values.length > 0) {
|
|
54
|
+
const max = Math.max(...values.map((v) => (Number.isFinite(v) ? Math.abs(v) : 0)), 0);
|
|
55
|
+
return Array.from({ length: count }, (_, i) => {
|
|
56
|
+
const v = values[Math.min(values.length - 1, Math.floor((i * values.length) / count))] ?? 0;
|
|
57
|
+
const n = max > 0 && Number.isFinite(v) ? Math.abs(v) / max : 0;
|
|
58
|
+
return Math.max(0.12, Math.min(1, n));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
let h = 2166136261;
|
|
62
|
+
for (const ch of seed) h = Math.imul(h ^ (ch.codePointAt(0) ?? 0), 16777619) >>> 0;
|
|
63
|
+
return Array.from({ length: count }, (_, i) => {
|
|
64
|
+
h = Math.imul(h ^ (i + 1), 2654435761) >>> 0;
|
|
65
|
+
const wave = 0.55 + 0.35 * Math.sin(i / 3.1);
|
|
66
|
+
return Math.max(0.12, Math.min(1, wave * (0.45 + (h % 1000) / 1600)));
|
|
67
|
+
});
|
|
68
|
+
}
|