@celljs/ta-web 4.9.0 → 4.9.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 (127) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-extension.js +13 -5
  4. package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
  5. package/esm/browser/assistant/assistant-task-source.js +2 -0
  6. package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
  7. package/esm/browser/assistant/assistant-task-util.js +8 -0
  8. package/esm/browser/assistant/assistant-tasks.js +3 -2
  9. package/esm/browser/assistant/assistant.d.ts +20 -0
  10. package/esm/browser/assistant/assistant.js +45 -1
  11. package/esm/browser/assistant/task-views.d.ts +40 -6
  12. package/esm/browser/assistant/task-views.js +73 -21
  13. package/esm/browser/avatar/dino-avatar.d.ts +3 -4
  14. package/esm/browser/avatar/dino-avatar.js +4 -178
  15. package/esm/browser/avatar/dino-face.d.ts +19 -0
  16. package/esm/browser/avatar/dino-face.js +142 -0
  17. package/esm/browser/avatar/dino-geometry.d.ts +11 -0
  18. package/esm/browser/avatar/dino-geometry.js +38 -0
  19. package/esm/browser/avatar/dino-kinds.d.ts +15 -0
  20. package/esm/browser/avatar/dino-kinds.js +544 -0
  21. package/esm/browser/avatar/dino-motion.js +1 -1
  22. package/esm/browser/avatar/dino-shape.d.ts +80 -0
  23. package/esm/browser/avatar/dino-shape.js +113 -0
  24. package/esm/browser/avatar/dino-species.d.ts +1 -61
  25. package/esm/browser/avatar/dino-species.js +2 -653
  26. package/esm/browser/components/access-view.js +1 -1
  27. package/esm/browser/components/account-menu.js +1 -1
  28. package/esm/browser/components/app-shell-hooks.d.ts +47 -0
  29. package/esm/browser/components/app-shell-hooks.js +165 -0
  30. package/esm/browser/components/app-view.js +6 -151
  31. package/esm/browser/components/auth-view.js +1 -1
  32. package/esm/browser/components/composer.js +17 -10
  33. package/esm/browser/components/dino.js +1 -1
  34. package/esm/browser/components/folder-picker.js +4 -1
  35. package/esm/browser/components/host-view.d.ts +1 -1
  36. package/esm/browser/components/host-view.js +1 -1
  37. package/esm/browser/components/select-bar.d.ts +9 -0
  38. package/esm/browser/components/select-bar.js +24 -0
  39. package/esm/browser/components/settings-choices.d.ts +35 -0
  40. package/esm/browser/components/settings-choices.js +117 -0
  41. package/esm/browser/components/settings-parts.d.ts +21 -0
  42. package/esm/browser/components/settings-parts.js +300 -0
  43. package/esm/browser/components/settings-view.d.ts +0 -6
  44. package/esm/browser/components/settings-view.js +4 -406
  45. package/esm/browser/components/workbench-view.js +1 -1
  46. package/esm/browser/extension/icons.js +2 -1
  47. package/esm/browser/extension/web-extension-api.d.ts +38 -1
  48. package/esm/browser/extension/web-extensions.js +6 -1
  49. package/esm/browser/extension/web-tasks.d.ts +9 -1
  50. package/esm/browser/extension/web-tasks.js +24 -0
  51. package/esm/browser/hooks.d.ts +3 -1
  52. package/esm/browser/hooks.js +8 -0
  53. package/esm/browser/i18n/locales.d.ts +6 -1
  54. package/esm/browser/i18n/messages.d.ts +5 -0
  55. package/esm/browser/i18n/messages.js +10 -0
  56. package/esm/browser/style/device.js +16 -0
  57. package/esm/browser/style/shell.d.ts +1 -1
  58. package/esm/browser/style/shell.js +1 -0
  59. package/esm/browser/style/tasks.d.ts +1 -1
  60. package/esm/browser/style/tasks.js +2 -0
  61. package/esm/browser/workbench-util.d.ts +61 -0
  62. package/esm/browser/workbench-util.js +138 -0
  63. package/esm/browser/workbench.d.ts +1 -37
  64. package/esm/browser/workbench.js +2 -136
  65. package/lib/browser/assistant/assistant-extension.js +13 -5
  66. package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
  67. package/lib/browser/assistant/assistant-task-source.js +2 -0
  68. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  69. package/lib/browser/assistant/assistant-task-util.js +8 -0
  70. package/lib/browser/assistant/assistant-tasks.js +2 -1
  71. package/lib/browser/assistant/assistant.d.ts +20 -0
  72. package/lib/browser/assistant/assistant.js +45 -1
  73. package/lib/browser/assistant/task-views.d.ts +40 -6
  74. package/lib/browser/assistant/task-views.js +74 -21
  75. package/lib/browser/avatar/dino-avatar.d.ts +3 -4
  76. package/lib/browser/avatar/dino-avatar.js +27 -202
  77. package/lib/browser/avatar/dino-face.d.ts +20 -0
  78. package/lib/browser/avatar/dino-face.js +148 -0
  79. package/lib/browser/avatar/dino-geometry.d.ts +12 -0
  80. package/lib/browser/avatar/dino-geometry.js +47 -0
  81. package/lib/browser/avatar/dino-kinds.d.ts +16 -0
  82. package/lib/browser/avatar/dino-kinds.js +547 -0
  83. package/lib/browser/avatar/dino-motion.js +2 -2
  84. package/lib/browser/avatar/dino-shape.d.ts +81 -0
  85. package/lib/browser/avatar/dino-shape.js +126 -0
  86. package/lib/browser/avatar/dino-species.d.ts +1 -61
  87. package/lib/browser/avatar/dino-species.js +34 -687
  88. package/lib/browser/components/access-view.js +2 -2
  89. package/lib/browser/components/account-menu.js +2 -2
  90. package/lib/browser/components/app-shell-hooks.d.ts +48 -0
  91. package/lib/browser/components/app-shell-hooks.js +207 -0
  92. package/lib/browser/components/app-view.js +16 -161
  93. package/lib/browser/components/auth-view.js +3 -3
  94. package/lib/browser/components/composer.js +17 -10
  95. package/lib/browser/components/dino.js +3 -3
  96. package/lib/browser/components/folder-picker.js +4 -1
  97. package/lib/browser/components/host-view.d.ts +1 -1
  98. package/lib/browser/components/host-view.js +5 -5
  99. package/lib/browser/components/select-bar.d.ts +10 -0
  100. package/lib/browser/components/select-bar.js +61 -0
  101. package/lib/browser/components/settings-choices.d.ts +36 -0
  102. package/lib/browser/components/settings-choices.js +156 -0
  103. package/lib/browser/components/settings-parts.d.ts +22 -0
  104. package/lib/browser/components/settings-parts.js +336 -0
  105. package/lib/browser/components/settings-view.d.ts +0 -6
  106. package/lib/browser/components/settings-view.js +2 -405
  107. package/lib/browser/components/workbench-view.js +3 -3
  108. package/lib/browser/extension/icons.js +1 -0
  109. package/lib/browser/extension/web-extension-api.d.ts +38 -1
  110. package/lib/browser/extension/web-extensions.js +5 -0
  111. package/lib/browser/extension/web-tasks.d.ts +9 -1
  112. package/lib/browser/extension/web-tasks.js +24 -0
  113. package/lib/browser/hooks.d.ts +3 -1
  114. package/lib/browser/hooks.js +9 -0
  115. package/lib/browser/i18n/locales.d.ts +6 -1
  116. package/lib/browser/i18n/messages.d.ts +5 -0
  117. package/lib/browser/i18n/messages.js +10 -0
  118. package/lib/browser/style/device.js +16 -0
  119. package/lib/browser/style/shell.d.ts +1 -1
  120. package/lib/browser/style/shell.js +1 -0
  121. package/lib/browser/style/tasks.d.ts +1 -1
  122. package/lib/browser/style/tasks.js +2 -0
  123. package/lib/browser/workbench-util.d.ts +62 -0
  124. package/lib/browser/workbench-util.js +144 -0
  125. package/lib/browser/workbench.d.ts +1 -37
  126. package/lib/browser/workbench.js +24 -159
  127. package/package.json +7 -7
@@ -1,4 +1,6 @@
1
- import { type Bone, DinoSpecies, type Point } from './dino-species';
1
+ import { type Matrix } from './dino-geometry';
2
+ import { type Bone, type Point } from './dino-shape';
3
+ import { DinoSpecies } from './dino-species';
2
4
  /** What ta is doing, as its face and pose show it. */
3
5
  export type Mood = 'idle' | 'listening' | 'thinking' | 'working' | 'speaking' | 'attention' | 'done' | 'sleeping';
4
6
  export declare const MOODS: Mood[];
@@ -39,8 +41,6 @@ export interface Pose {
39
41
  wing: number;
40
42
  }
41
43
  export declare const REST: Pose;
42
- /** A 2D affine transform [a, b, c, d, e, f], as in SVG's matrix(). */
43
- export type Matrix = [number, number, number, number, number, number];
44
44
  /**
45
45
  * How many pieces the rounded side of the head and body is made of, from the far side to the near one.
46
46
  * Between two pieces the outline is swept, not stacked, so the side is smooth at every angle.
@@ -70,7 +70,6 @@ export declare function rig(pose: Pose, species?: DinoSpecies): Rig;
70
70
  export declare function skin(r: Rig): string;
71
71
  /** Where the middle of the head is in a pose, in the coordinates of the drawing; the eyes follow what is around it from there. */
72
72
  export declare function headAt(pose: Pose, species?: DinoSpecies): Point;
73
- export declare function matrix(m: Matrix): string;
74
73
  /** The transforms and the outline a pose draws, ready for the attributes of the drawing. */
75
74
  export interface Frame {
76
75
  skin: string;
@@ -4,18 +4,14 @@ exports.DinoAvatar = exports.DEPTH = exports.REST = exports.AVATAR_VIEWBOX = exp
4
4
  exports.rig = rig;
5
5
  exports.skin = skin;
6
6
  exports.headAt = headAt;
7
- exports.matrix = matrix;
8
7
  exports.frame = frame;
8
+ const dino_face_1 = require("./dino-face");
9
+ const dino_geometry_1 = require("./dino-geometry");
10
+ const dino_shape_1 = require("./dino-shape");
9
11
  const dino_species_1 = require("./dino-species");
10
12
  exports.MOODS = ['idle', 'listening', 'thinking', 'working', 'speaking', 'attention', 'done', 'sleeping'];
11
13
  /** The viewBox of assets/logo.svg with a little room around it for the marks. */
12
14
  exports.AVATAR_VIEWBOX = '-8 -8 272 272';
13
- /** The eye of the logo: the eye of every kind is drawn here, then moved and scaled onto its own. */
14
- const EYE = { x: 141.3, y: 44.6, r: 10.9 };
15
- const DARK = '#06281d';
16
- const WHITE = '#fff';
17
- /** The cheeks of a close-up, as the faces of the agents blush. */
18
- const BLUSH = 'rgba(255, 128, 160, 0.7)';
19
15
  exports.REST = {
20
16
  x: 0,
21
17
  y: 0,
@@ -36,27 +32,6 @@ exports.REST = {
36
32
  arm: 0,
37
33
  wing: 0,
38
34
  };
39
- function multiply(m, n) {
40
- return [
41
- m[0] * n[0] + m[2] * n[1],
42
- m[1] * n[0] + m[3] * n[1],
43
- m[0] * n[2] + m[2] * n[3],
44
- m[1] * n[2] + m[3] * n[3],
45
- m[0] * n[4] + m[2] * n[5] + m[4],
46
- m[1] * n[4] + m[3] * n[5] + m[5],
47
- ];
48
- }
49
- /** Turn by `degrees` around `at`, scaling by `sx`, `sy` there. */
50
- function around(at, degrees, sx = 1, sy = 1) {
51
- const a = (degrees * Math.PI) / 180;
52
- const cos = Math.cos(a);
53
- const sin = Math.sin(a);
54
- const m = [cos * sx, sin * sx, -sin * sy, cos * sy, 0, 0];
55
- m[4] = at.x - m[0] * at.x - m[2] * at.y;
56
- m[5] = at.y - m[1] * at.x - m[3] * at.y;
57
- return m;
58
- }
59
- const move = (x, y) => [1, 0, 0, 1, x, y];
60
35
  const SKINS = new Map();
61
36
  function skinOf(species) {
62
37
  var _a;
@@ -234,43 +209,43 @@ const vector = (m, x, y) => [m[0] * x + m[2] * y, m[1] * x + m[3] * y];
234
209
  function rig(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT)) {
235
210
  var _a, _b, _c;
236
211
  const { feet, neck, jaw, tail, tip, hip } = species.joints;
237
- const place = multiply(move(pose.x, pose.y), multiply(facing(feet.x, pose.face), around(feet, pose.lean * ((_a = species.leans) !== null && _a !== void 0 ? _a : 1), pose.sx, pose.sy)));
238
- const within = (m) => multiply(place, m);
212
+ const place = (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(pose.x, pose.y), (0, dino_geometry_1.multiply)(facing(feet.x, pose.face), (0, dino_geometry_1.around)(feet, pose.lean * ((_a = species.leans) !== null && _a !== void 0 ? _a : 1), pose.sx, pose.sy)));
213
+ const within = (m) => (0, dino_geometry_1.multiply)(place, m);
239
214
  const yaw = (pose.turn * ((_b = species.turns) !== null && _b !== void 0 ? _b : 1) * YAW * Math.PI) / 180;
240
215
  const spin = pose.spin * ((_c = species.spins) !== null && _c !== void 0 ? _c : 1);
241
216
  const sin = Math.sin(yaw);
242
- const turned = around(neck, pose.head);
243
- const head = multiply(turned, around(species.head.axis, 0, Math.cos(yaw), 1));
244
- const tailBone = around(tail, pose.tail);
217
+ const turned = (0, dino_geometry_1.around)(neck, pose.head);
218
+ const head = (0, dino_geometry_1.multiply)(turned, (0, dino_geometry_1.around)(species.head.axis, 0, Math.cos(yaw), 1));
219
+ const tailBone = (0, dino_geometry_1.around)(tail, pose.tail);
245
220
  const headSide = vector(within(turned), -species.head.depth * sin, 0);
246
221
  const bodySide = vector(place, -species.body.depth * spin, 0);
247
222
  // The eye of the logo, moved and scaled onto the eye of the kind.
248
- const k = species.eye.r / EYE.r;
249
- const fit = [k, 0, 0, k, species.eye.x - k * EYE.x, species.eye.y - k * EYE.y];
223
+ const k = species.eye.r / dino_face_1.EYE.r;
224
+ const fit = [k, 0, 0, k, species.eye.x - k * dino_face_1.EYE.x, species.eye.y - k * dino_face_1.EYE.y];
250
225
  // The eye sits on the near side of the head, moving with it; seen at a slant it narrows less than the head does.
251
- const slant = around(species.eye, 0, (1 - 0.3 * sin) / Math.cos(yaw), 1);
226
+ const slant = (0, dino_geometry_1.around)(species.eye, 0, (1 - 0.3 * sin) / Math.cos(yaw), 1);
252
227
  // The sides of the head draw in toward its middle as it turns (outline()); its eyes with them.
253
- const rounded = around(species.head.center, 0, 1 - ROUND_HEAD * sin, 1 - ROUND_HEAD * sin);
254
- const eye = within(multiply(head, multiply(rounded, multiply(slant, fit))));
228
+ const rounded = (0, dino_geometry_1.around)(species.head.center, 0, 1 - ROUND_HEAD * sin, 1 - ROUND_HEAD * sin);
229
+ const eye = within((0, dino_geometry_1.multiply)(head, (0, dino_geometry_1.multiply)(rounded, (0, dino_geometry_1.multiply)(slant, fit))));
255
230
  // A leg swings as far as the logo's does, whatever its length: a long one by a smaller angle, so its foot goes as far.
256
- const swing = (angle, joint) => angle * Math.min(1.6, Math.max(0.45, dino_species_1.LEG / Math.max(20, feet.y - joint.y)));
257
- const sides = (k, m) => multiply(move(k * (headSide[0] + bodySide[0]), k * (headSide[1] + bodySide[1])), m);
231
+ const swing = (angle, joint) => angle * Math.min(1.6, Math.max(0.45, dino_shape_1.LEG / Math.max(20, feet.y - joint.y)));
232
+ const sides = (k, m) => (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(k * (headSide[0] + bodySide[0]), k * (headSide[1] + bodySide[1])), m);
258
233
  return {
259
234
  species,
260
235
  bones: {
261
236
  body: place,
262
237
  head: within(head),
263
- jaw: within(multiply(head, around(jaw, pose.jaw))),
238
+ jaw: within((0, dino_geometry_1.multiply)(head, (0, dino_geometry_1.around)(jaw, pose.jaw))),
264
239
  tail: within(tailBone),
265
- tip: within(multiply(tailBone, around(tip, pose.tip))),
266
- back: within(multiply(move(0, -pose.backLift), around(hip, swing(pose.back, hip)))),
240
+ tip: within((0, dino_geometry_1.multiply)(tailBone, (0, dino_geometry_1.around)(tip, pose.tip))),
241
+ back: within((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(0, -pose.backLift), (0, dino_geometry_1.around)(hip, swing(pose.back, hip)))),
267
242
  },
268
243
  // The parts move with their sides: the far ones away from you, the near ones toward you.
269
244
  parts: species.parts.map(part => {
270
245
  const side = part.far ? -1 : 1;
271
246
  const lift = part.lift ? pose[part.lift] : 0;
272
247
  const angle = part.lift ? swing(pose[part.swing], part.joint) : pose[part.swing];
273
- return multiply(move(side * bodySide[0], side * bodySide[1]), within(multiply(move(0, -lift), around(part.joint, angle))));
248
+ return (0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(side * bodySide[0], side * bodySide[1]), within((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(0, -lift), (0, dino_geometry_1.around)(part.joint, angle))));
274
249
  }),
275
250
  eye: sides(1, eye),
276
251
  head: headSide,
@@ -280,7 +255,6 @@ function rig(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSp
280
255
  };
281
256
  }
282
257
  const r1 = (n) => Math.round(n * 10) / 10;
283
- const round = (n) => Math.round(n * 100) / 100;
284
258
  /**
285
259
  * The points of the outline in a pose, each moved by its bones blended by its weights: `side` 1 for
286
260
  * the side you see, -1 for the far side, and in between for the inside of the solid; `eye` with the
@@ -383,142 +357,6 @@ function headAt(pose, species = dino_species_1.DinoSpecies.of(dino_species_1.Din
383
357
  const { center } = species.head;
384
358
  return { x: m[0] * center.x + m[2] * center.y + m[4], y: m[1] * center.x + m[3] * center.y + m[5] };
385
359
  }
386
- function matrix(m) {
387
- return `matrix(${m.map(n => Math.round(n * 1000) / 1000).join(' ')})`;
388
- }
389
- const EYES = {
390
- idle: 'open',
391
- listening: 'wide',
392
- thinking: 'up',
393
- working: 'down',
394
- speaking: 'open',
395
- attention: 'wide',
396
- done: 'happy',
397
- sleeping: 'closed',
398
- };
399
- /** Where the slit of the pupil looks, and how low the brow comes down over the eye (its back, its front over the snout). */
400
- const GAZE = {
401
- open: { dx: 2.4, dy: 0.8, brow: [34, 43] },
402
- wide: { dx: 1.2, dy: 0, brow: [32, 39] },
403
- up: { dx: -0.4, dy: -2.4, brow: [33, 41] },
404
- down: { dx: 3.4, dy: 2.6, brow: [35.5, 45] },
405
- };
406
- const IRIS = '<stop offset="0" stop-color="#FEF08A"/><stop offset="0.35" stop-color="#FACC15"/><stop offset="0.75" stop-color="#F97316"/><stop offset="1" stop-color="#B91C1C"/>';
407
- /** A closed eye: a heavy line cut out of the skin, frowning, or curved and content in a close-up. */
408
- function shut(skin, content) {
409
- const { x, y, r } = EYE;
410
- const line = content ? `M${x - 8} ${y - 1} Q${x} ${y + 6} ${x + 8} ${y - 1}` : `M${x - 9} ${y - 3} Q${x} ${y + 3} ${x + 9} ${y + 2}`;
411
- return `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="${line}" fill="none" stroke="${DARK}" stroke-width="3.6" stroke-linecap="round"/>`;
412
- }
413
- /** When the lids of a drawing blink: each drawing at its own moment and pace, so the dinosaurs of a page never blink together. */
414
- function blink(id) {
415
- let hash = 0;
416
- for (const char of id) {
417
- hash = (hash * 31 + char.charCodeAt(0)) | 0;
418
- }
419
- const at = Math.abs(hash % 97) / 97;
420
- return ` style="animation-delay:-${(at * 5).toFixed(2)}s;animation-duration:${(4.4 + at * 2.4).toFixed(2)}s"`;
421
- }
422
- /** The fierce eye of a whole dinosaur: a slit pupil in a yellow-red iris under a low brow. */
423
- function eye(kind, id, species) {
424
- const { x, y, r } = EYE;
425
- const { skin, ridge } = species.colors;
426
- if (kind === 'closed') {
427
- return shut(skin, false);
428
- }
429
- const defs = `<radialGradient id="${id}-iris" cx="0.4" cy="0.6" r="0.62">${IRIS}</radialGradient>` +
430
- `<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>`;
431
- const ball = `<circle cx="${x}" cy="${y}" r="${r + 1}" fill="url(#${id}-iris)"/>`;
432
- if (kind === 'happy') {
433
- // Pleased with itself: a smug, narrowed eye, the lower lid pushed up under the brow.
434
- return (defs +
435
- `<g clip-path="url(#${id}-eye)">${ball}<ellipse cx="${x + 2.4}" cy="${y}" rx="1.4" ry="6" fill="${DARK}"/>` +
436
- `<path d="M${x - r - 1} ${y - r - 1} H${x + r + 1} V${y - 1} L${x - r - 1} ${y - 6}Z" fill="${skin}"/>` +
437
- `<path d="M${x - r - 1} ${y + r + 1} V${y + 3} Q${x} ${y - 2} ${x + r + 1} ${y + 3} V${y + r + 1}Z" fill="${skin}"/></g>` +
438
- brow(ridge, x - r - 4, y - 7, x + r + 5, y - 2));
439
- }
440
- const gaze = GAZE[kind];
441
- const px = x + gaze.dx;
442
- const py = y + gaze.dy;
443
- const [back, front] = gaze.brow;
444
- return (defs +
445
- `<g clip-path="url(#${id}-eye)">${ball}` +
446
- `<g class="ta-dino-pupil"><path d="M${px} ${py - 8.6} Q${px + 2.6} ${py} ${px} ${py + 8.6} Q${px - 2.6} ${py} ${px} ${py - 8.6}Z" fill="${DARK}"/><circle cx="${px - 3.4}" cy="${py - 3}" r="1.2" fill="${WHITE}" opacity="0.9"/></g>` +
447
- // The upper lid comes down to the brow, lowest over the snout, so it glares; the lower lid narrows it from below.
448
- `<path d="M${x - r - 1} ${y - r - 2} H${x + r + 1} V${front} L${x - r - 1} ${back}Z" fill="${skin}"/>` +
449
- `<path d="M${x - r - 1} ${y + r + 1} V${y + 6} Q${x} ${y + 9.5} ${x + r + 1} ${y + 8} V${y + r + 1}Z" fill="${skin}"/>` +
450
- `<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>` +
451
- brow(ridge, x - r - 4, back - 1.6, x + r + 5, front + 0.4));
452
- }
453
- /**
454
- * The eye of a close-up, the dinosaur at its sweetest: round and dark with two glints, a blush below it;
455
- * the glints follow the pointer. Pleased (done, or poked), it squeezes shut into an arc.
456
- */
457
- function cuteEye(kind, id, species) {
458
- const { x, y, r } = EYE;
459
- const { skin } = species.colors;
460
- const cheek = `<ellipse cx="${x + 3}" cy="${y + r + 6}" rx="${round(r * 0.8)}" ry="${round(r * 0.42)}" fill="${BLUSH}"/>`;
461
- const joy = `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="M${x - 7.5} ${y + 3} Q${x} ${y - 7} ${x + 7.5} ${y + 3}" fill="none" stroke="${DARK}" stroke-width="3.4" stroke-linecap="round"/>`;
462
- // A close-up has bigger eyes than the whole dinosaur.
463
- const big = (inner) => `<g transform="translate(${x} ${y}) scale(1.2) translate(${-x} ${-y})">${inner}</g>`;
464
- if (kind === 'closed') {
465
- return big(shut(skin, true)) + cheek;
466
- }
467
- if (kind === 'happy') {
468
- return big(joy) + cheek;
469
- }
470
- const look = `<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>` +
471
- `<g clip-path="url(#${id}-eye)"><circle cx="${x}" cy="${y}" r="${r + 1}" fill="${DARK}"/>` +
472
- `<g class="ta-dino-pupil"><circle cx="${x + 2.6}" cy="${y - 3.2}" r="${round(r * 0.36)}" fill="${WHITE}"/><circle cx="${x - 3.6}" cy="${y + 3.6}" r="${round(r * 0.16)}" fill="${WHITE}" opacity="0.85"/></g>` +
473
- `<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>`;
474
- // Poked, the round eye gives way to the pleased one for a moment (a class on the drawing, set as it plays).
475
- return big(`<g class="ta-dino-look">${look}</g><g class="ta-dino-joy">${joy}</g>`) + cheek;
476
- }
477
- /** The ridge of the brow over the lid: a wedge, thin at the back, thick and low over the snout. */
478
- function brow(color, x1, y1, x2, y2) {
479
- const p = (x, y) => `${round(x)} ${round(y)}`;
480
- return `<path class="ta-dino-brow" d="M${p(x1, y1 - 1)} Q${p((x1 + x2) / 2, (y1 + y2) / 2 - 4.4)} ${p(x2 + 1, y2 - 3.6)} Q${p(x2 + 3, y2 + 1.4)} ${p(x2 - 1, y2 + 2.2)} L${p(x1 + 1, y1 + 1.4)} Q${p(x1 - 1.4, y1 + 0.6)} ${p(x1, y1 - 1)}Z" fill="${color}"/>`;
481
- }
482
- /** A round mark above the back, ringed in the color of the page so it stands off the dinosaur. */
483
- function badge(at, color, inner) {
484
- return `<g transform="translate(${at.x} ${at.y}) scale(1.3)"><g class="ta-dino-badge"><circle r="23" fill="${color}" stroke="var(--ta-main, #fff)" stroke-width="5"/>${inner}</g></g>`;
485
- }
486
- function mark(mood, species) {
487
- const at = species.badge;
488
- switch (mood) {
489
- case 'attention':
490
- return badge(at, '#F59E0B', `<path d="M0 -11 L0 2.5" stroke="${WHITE}" stroke-width="5.4" stroke-linecap="round"/><circle cy="10" r="3.2" fill="${WHITE}"/>`);
491
- case 'working':
492
- return badge(at, '#3B82F6', [-9, 0, 9].map(x => `<circle class="ta-dino-dot" cx="${x}" r="3.4" fill="${WHITE}"/>`).join(''));
493
- case 'listening':
494
- return badge(at, '#8B5CF6', `<rect x="-5" y="-12" width="10" height="16" rx="5" fill="${WHITE}"/><path d="M-9.5 -1 Q-9.5 9 0 9 Q9.5 9 9.5 -1 M0 9 L0 13" fill="none" stroke="${WHITE}" stroke-width="3.2" stroke-linecap="round"/>`);
495
- case 'thinking':
496
- // Bubbles rising from the head to where the mark goes.
497
- return [
498
- [48, -10, 6],
499
- [24, -24, 8.5],
500
- [-6, -30, 12],
501
- ]
502
- .map(([x, y, r]) => `<circle class="ta-dino-bubble" cx="${at.x + x}" cy="${at.y + y}" r="${r}" fill="var(--ta-muted, #8e8e93)"/>`)
503
- .join('');
504
- case 'sleeping':
505
- return [
506
- [32, 0, 0.9],
507
- [0, -22, 1.35],
508
- ]
509
- .map(([x, y, s]) => `<path class="ta-dino-z" transform="translate(${at.x + x} ${at.y + y}) scale(${s})" d="M-8 -8 L8 -8 L-8 8 L8 8" fill="none" stroke="var(--ta-muted, #8e8e93)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>`)
510
- .join('');
511
- case 'speaking': {
512
- // Waves from the snout.
513
- const { x, y } = species.snout;
514
- return [12, 22]
515
- .map(r => `<path class="ta-dino-wave" d="M${x + r * 0.3} ${y - r} Q${x + r} ${y} ${x + r * 0.3} ${y + r}" fill="none" stroke="${species.colors.skin}" stroke-width="4.5" stroke-linecap="round"/>`)
516
- .join('');
517
- }
518
- default:
519
- return '';
520
- }
521
- }
522
360
  const fixed = (n) => String(Math.round(n * 100) / 100);
523
361
  /**
524
362
  * What a pose draws. `fine` for a large drawing; a small one (a few dozen pixels) is swept in fewer
@@ -543,30 +381,17 @@ function frame(pose, fine = true, species = dino_species_1.DinoSpecies.of(dino_s
543
381
  skin: near,
544
382
  far: path(species, pieces[0]),
545
383
  wall: solid ? wall(pieces, fine ? FLAT : 1) : '',
546
- eye: matrix(r.eye),
384
+ eye: (0, dino_geometry_1.matrix)(r.eye),
547
385
  nostrils: [nostril(0.5), nostril(-0.5)],
548
- front: fixed(smoothstep((Math.max(r.turn, r.spin) - 0.12) / 0.38)),
549
- parts: r.parts.map(matrix),
386
+ front: fixed((0, dino_geometry_1.smoothstep)((Math.max(r.turn, r.spin) - 0.12) / 0.38)),
387
+ parts: r.parts.map(dino_geometry_1.matrix),
550
388
  decor: ((_a = species.decor) !== null && _a !== void 0 ? _a : []).map(({ depth: deep }) => [
551
- matrix(multiply(move(-deep * across[0], -deep * across[1]), m)),
552
- matrix(multiply(move(deep * across[0], deep * across[1]), m)),
389
+ (0, dino_geometry_1.matrix)((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(-deep * across[0], -deep * across[1]), m)),
390
+ (0, dino_geometry_1.matrix)((0, dino_geometry_1.multiply)((0, dino_geometry_1.move)(deep * across[0], deep * across[1]), m)),
553
391
  ]),
554
392
  shadow: { cx: fixed(feet.x + (middle - feet.x) * pose.face + pose.x), rx: fixed(width), opacity: fixed(1 - Math.min(0.7, lifted / 32)) },
555
393
  };
556
394
  }
557
- function smoothstep(x) {
558
- const t = Math.min(1, Math.max(0, x));
559
- return t * t * (3 - 2 * t);
560
- }
561
- /** A color of six hex digits mixed toward another by `k` (0 to 1). */
562
- function mix(color, toward, k) {
563
- const channel = (hex, i) => Number.parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
564
- return `#${[0, 1, 2]
565
- .map(i => Math.round(channel(color, i) + (channel(toward, i) - channel(color, i)) * k)
566
- .toString(16)
567
- .padStart(2, '0'))
568
- .join('')}`;
569
- }
570
395
  /**
571
396
  * The body of a kind in a pose, with the eye `eyes` draws. `detail` for a drawing
572
397
  * large enough to show it: its shadow on the ground, and a gap of the page between the body and the legs and arms
@@ -581,7 +406,7 @@ function body(species, pose, eyes, id, detail) {
581
406
  const gradient = (name, [top, bottom]) => `<linearGradient id="${id}-${name}" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="${top}"/><stop offset="1" stop-color="${bottom}"/></linearGradient>`;
582
407
  // The mask covers everywhere it walks to (pose.x), or what walks out of it would be cut off.
583
408
  const gaps = detail ? species.parts.map((part, i) => (part.gap ? i : -1)).filter(i => i >= 0) : [];
584
- const defs = (sheen ? gradient('sheen', sheen) + gradient('lit', [mix(sheen[0], '#ffffff', 0.3), mix(sheen[1], '#ffffff', 0.3)]) : '') +
409
+ const defs = (sheen ? gradient('sheen', sheen) + gradient('lit', [(0, dino_geometry_1.mix)(sheen[0], '#ffffff', 0.3), (0, dino_geometry_1.mix)(sheen[1], '#ffffff', 0.3)]) : '') +
585
410
  (gaps.length
586
411
  ? `<mask id="${id}-gap" maskUnits="userSpaceOnUse" x="-400" y="-200" width="1056" height="656"><rect x="-400" y="-200" width="1056" height="656" fill="#fff"/>${gaps
587
412
  .map(i => `<path class="ta-dino-gap-${i}" d="${species.parts[i].d}" transform="${f.parts[i]}" fill="#000" stroke="#000" stroke-width="5" stroke-linejoin="round"/>`)
@@ -631,12 +456,12 @@ var DinoAvatar;
631
456
  DinoAvatar.markText = markText;
632
457
  /** The whole dinosaur, with the mark of its mood; `detail` for a drawing large enough to show its shadow and the gaps by its legs. */
633
458
  function render(mood, id = 'ta', pose = exports.REST, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT), detail = false) {
634
- return body(species, pose, eye(EYES[mood], id, species), id, detail) + mark(mood, species);
459
+ return body(species, pose, (0, dino_face_1.eye)(dino_face_1.EYES[mood], id, species), id, detail) + (0, dino_face_1.mark)(mood, species);
635
460
  }
636
461
  DinoAvatar.render = render;
637
462
  /** A close-up of its head, sweet rather than fierce: for a figure as small as that of the account. */
638
463
  function face(mood, id = 'ta', pose = exports.REST, species = dino_species_1.DinoSpecies.of(dino_species_1.DinoSpecies.DEFAULT)) {
639
- return body(species, pose, cuteEye(EYES[mood], id, species), id, false);
464
+ return body(species, pose, (0, dino_face_1.cuteEye)(dino_face_1.EYES[mood], id, species), id, false);
640
465
  }
641
466
  DinoAvatar.face = face;
642
467
  /** The viewBox of a close-up. */
@@ -0,0 +1,20 @@
1
+ import type { Mood } from './dino-avatar';
2
+ import type { DinoSpecies } from './dino-species';
3
+ /** The eye of the logo: the eye of every kind is drawn here, then moved and scaled onto its own. */
4
+ export declare const EYE: {
5
+ x: number;
6
+ y: number;
7
+ r: number;
8
+ };
9
+ type Eyes = 'open' | 'wide' | 'up' | 'down' | 'happy' | 'closed';
10
+ export declare const EYES: Record<Mood, Eyes>;
11
+ /** The fierce eye of a whole dinosaur: a slit pupil in a yellow-red iris under a low brow. */
12
+ export declare function eye(kind: Eyes, id: string, species: DinoSpecies): string;
13
+ /**
14
+ * The eye of a close-up, the dinosaur at its sweetest: round and dark with two glints, a blush below it;
15
+ * the glints follow the pointer. Pleased (done, or poked), it squeezes shut into an arc.
16
+ */
17
+ export declare function cuteEye(kind: Eyes, id: string, species: DinoSpecies): string;
18
+ export declare function mark(mood: Mood, species: DinoSpecies): string;
19
+ export {};
20
+ //# sourceMappingURL=dino-face.d.ts.map
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EYES = exports.EYE = void 0;
4
+ exports.eye = eye;
5
+ exports.cuteEye = cuteEye;
6
+ exports.mark = mark;
7
+ /* The face of the dinosaur: its eyes, brows and the marks of its moods, as markup for dino-avatar.ts. */
8
+ /** The eye of the logo: the eye of every kind is drawn here, then moved and scaled onto its own. */
9
+ exports.EYE = { x: 141.3, y: 44.6, r: 10.9 };
10
+ const DARK = '#06281d';
11
+ const WHITE = '#fff';
12
+ /** The cheeks of a close-up, as the faces of the agents blush. */
13
+ const BLUSH = 'rgba(255, 128, 160, 0.7)';
14
+ const round = (n) => Math.round(n * 100) / 100;
15
+ exports.EYES = {
16
+ idle: 'open',
17
+ listening: 'wide',
18
+ thinking: 'up',
19
+ working: 'down',
20
+ speaking: 'open',
21
+ attention: 'wide',
22
+ done: 'happy',
23
+ sleeping: 'closed',
24
+ };
25
+ /** Where the slit of the pupil looks, and how low the brow comes down over the eye (its back, its front over the snout). */
26
+ const GAZE = {
27
+ open: { dx: 2.4, dy: 0.8, brow: [34, 43] },
28
+ wide: { dx: 1.2, dy: 0, brow: [32, 39] },
29
+ up: { dx: -0.4, dy: -2.4, brow: [33, 41] },
30
+ down: { dx: 3.4, dy: 2.6, brow: [35.5, 45] },
31
+ };
32
+ const IRIS = '<stop offset="0" stop-color="#FEF08A"/><stop offset="0.35" stop-color="#FACC15"/><stop offset="0.75" stop-color="#F97316"/><stop offset="1" stop-color="#B91C1C"/>';
33
+ /** A closed eye: a heavy line cut out of the skin, frowning, or curved and content in a close-up. */
34
+ function shut(skin, content) {
35
+ const { x, y, r } = exports.EYE;
36
+ const line = content ? `M${x - 8} ${y - 1} Q${x} ${y + 6} ${x + 8} ${y - 1}` : `M${x - 9} ${y - 3} Q${x} ${y + 3} ${x + 9} ${y + 2}`;
37
+ return `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="${line}" fill="none" stroke="${DARK}" stroke-width="3.6" stroke-linecap="round"/>`;
38
+ }
39
+ /** When the lids of a drawing blink: each drawing at its own moment and pace, so the dinosaurs of a page never blink together. */
40
+ function blink(id) {
41
+ let hash = 0;
42
+ for (const char of id) {
43
+ hash = (hash * 31 + char.charCodeAt(0)) | 0;
44
+ }
45
+ const at = Math.abs(hash % 97) / 97;
46
+ return ` style="animation-delay:-${(at * 5).toFixed(2)}s;animation-duration:${(4.4 + at * 2.4).toFixed(2)}s"`;
47
+ }
48
+ /** The fierce eye of a whole dinosaur: a slit pupil in a yellow-red iris under a low brow. */
49
+ function eye(kind, id, species) {
50
+ const { x, y, r } = exports.EYE;
51
+ const { skin, ridge } = species.colors;
52
+ if (kind === 'closed') {
53
+ return shut(skin, false);
54
+ }
55
+ const defs = `<radialGradient id="${id}-iris" cx="0.4" cy="0.6" r="0.62">${IRIS}</radialGradient>` +
56
+ `<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>`;
57
+ const ball = `<circle cx="${x}" cy="${y}" r="${r + 1}" fill="url(#${id}-iris)"/>`;
58
+ if (kind === 'happy') {
59
+ // Pleased with itself: a smug, narrowed eye, the lower lid pushed up under the brow.
60
+ return (defs +
61
+ `<g clip-path="url(#${id}-eye)">${ball}<ellipse cx="${x + 2.4}" cy="${y}" rx="1.4" ry="6" fill="${DARK}"/>` +
62
+ `<path d="M${x - r - 1} ${y - r - 1} H${x + r + 1} V${y - 1} L${x - r - 1} ${y - 6}Z" fill="${skin}"/>` +
63
+ `<path d="M${x - r - 1} ${y + r + 1} V${y + 3} Q${x} ${y - 2} ${x + r + 1} ${y + 3} V${y + r + 1}Z" fill="${skin}"/></g>` +
64
+ brow(ridge, x - r - 4, y - 7, x + r + 5, y - 2));
65
+ }
66
+ const gaze = GAZE[kind];
67
+ const px = x + gaze.dx;
68
+ const py = y + gaze.dy;
69
+ const [back, front] = gaze.brow;
70
+ return (defs +
71
+ `<g clip-path="url(#${id}-eye)">${ball}` +
72
+ `<g class="ta-dino-pupil"><path d="M${px} ${py - 8.6} Q${px + 2.6} ${py} ${px} ${py + 8.6} Q${px - 2.6} ${py} ${px} ${py - 8.6}Z" fill="${DARK}"/><circle cx="${px - 3.4}" cy="${py - 3}" r="1.2" fill="${WHITE}" opacity="0.9"/></g>` +
73
+ // The upper lid comes down to the brow, lowest over the snout, so it glares; the lower lid narrows it from below.
74
+ `<path d="M${x - r - 1} ${y - r - 2} H${x + r + 1} V${front} L${x - r - 1} ${back}Z" fill="${skin}"/>` +
75
+ `<path d="M${x - r - 1} ${y + r + 1} V${y + 6} Q${x} ${y + 9.5} ${x + r + 1} ${y + 8} V${y + r + 1}Z" fill="${skin}"/>` +
76
+ `<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>` +
77
+ brow(ridge, x - r - 4, back - 1.6, x + r + 5, front + 0.4));
78
+ }
79
+ /**
80
+ * The eye of a close-up, the dinosaur at its sweetest: round and dark with two glints, a blush below it;
81
+ * the glints follow the pointer. Pleased (done, or poked), it squeezes shut into an arc.
82
+ */
83
+ function cuteEye(kind, id, species) {
84
+ const { x, y, r } = exports.EYE;
85
+ const { skin } = species.colors;
86
+ const cheek = `<ellipse cx="${x + 3}" cy="${y + r + 6}" rx="${round(r * 0.8)}" ry="${round(r * 0.42)}" fill="${BLUSH}"/>`;
87
+ const joy = `<circle cx="${x}" cy="${y}" r="${r + 0.6}" fill="${skin}"/><path d="M${x - 7.5} ${y + 3} Q${x} ${y - 7} ${x + 7.5} ${y + 3}" fill="none" stroke="${DARK}" stroke-width="3.4" stroke-linecap="round"/>`;
88
+ // A close-up has bigger eyes than the whole dinosaur.
89
+ const big = (inner) => `<g transform="translate(${x} ${y}) scale(1.2) translate(${-x} ${-y})">${inner}</g>`;
90
+ if (kind === 'closed') {
91
+ return big(shut(skin, true)) + cheek;
92
+ }
93
+ if (kind === 'happy') {
94
+ return big(joy) + cheek;
95
+ }
96
+ const look = `<clipPath id="${id}-eye"><circle cx="${x}" cy="${y}" r="${r + 0.8}"/></clipPath>` +
97
+ `<g clip-path="url(#${id}-eye)"><circle cx="${x}" cy="${y}" r="${r + 1}" fill="${DARK}"/>` +
98
+ `<g class="ta-dino-pupil"><circle cx="${x + 2.6}" cy="${y - 3.2}" r="${round(r * 0.36)}" fill="${WHITE}"/><circle cx="${x - 3.6}" cy="${y + 3.6}" r="${round(r * 0.16)}" fill="${WHITE}" opacity="0.85"/></g>` +
99
+ `<rect class="ta-dino-lid"${blink(id)} x="${x - r - 1}" y="${y - r - 1}" width="${r * 2 + 2}" height="${r * 2 + 2}" fill="${skin}"/></g>`;
100
+ // Poked, the round eye gives way to the pleased one for a moment (a class on the drawing, set as it plays).
101
+ return big(`<g class="ta-dino-look">${look}</g><g class="ta-dino-joy">${joy}</g>`) + cheek;
102
+ }
103
+ /** The ridge of the brow over the lid: a wedge, thin at the back, thick and low over the snout. */
104
+ function brow(color, x1, y1, x2, y2) {
105
+ const p = (x, y) => `${round(x)} ${round(y)}`;
106
+ return `<path class="ta-dino-brow" d="M${p(x1, y1 - 1)} Q${p((x1 + x2) / 2, (y1 + y2) / 2 - 4.4)} ${p(x2 + 1, y2 - 3.6)} Q${p(x2 + 3, y2 + 1.4)} ${p(x2 - 1, y2 + 2.2)} L${p(x1 + 1, y1 + 1.4)} Q${p(x1 - 1.4, y1 + 0.6)} ${p(x1, y1 - 1)}Z" fill="${color}"/>`;
107
+ }
108
+ /** A round mark above the back, ringed in the color of the page so it stands off the dinosaur. */
109
+ function badge(at, color, inner) {
110
+ return `<g transform="translate(${at.x} ${at.y}) scale(1.3)"><g class="ta-dino-badge"><circle r="23" fill="${color}" stroke="var(--ta-main, #fff)" stroke-width="5"/>${inner}</g></g>`;
111
+ }
112
+ function mark(mood, species) {
113
+ const at = species.badge;
114
+ switch (mood) {
115
+ case 'attention':
116
+ return badge(at, '#F59E0B', `<path d="M0 -11 L0 2.5" stroke="${WHITE}" stroke-width="5.4" stroke-linecap="round"/><circle cy="10" r="3.2" fill="${WHITE}"/>`);
117
+ case 'working':
118
+ return badge(at, '#3B82F6', [-9, 0, 9].map(x => `<circle class="ta-dino-dot" cx="${x}" r="3.4" fill="${WHITE}"/>`).join(''));
119
+ case 'listening':
120
+ return badge(at, '#8B5CF6', `<rect x="-5" y="-12" width="10" height="16" rx="5" fill="${WHITE}"/><path d="M-9.5 -1 Q-9.5 9 0 9 Q9.5 9 9.5 -1 M0 9 L0 13" fill="none" stroke="${WHITE}" stroke-width="3.2" stroke-linecap="round"/>`);
121
+ case 'thinking':
122
+ // Bubbles rising from the head to where the mark goes.
123
+ return [
124
+ [48, -10, 6],
125
+ [24, -24, 8.5],
126
+ [-6, -30, 12],
127
+ ]
128
+ .map(([x, y, r]) => `<circle class="ta-dino-bubble" cx="${at.x + x}" cy="${at.y + y}" r="${r}" fill="var(--ta-muted, #8e8e93)"/>`)
129
+ .join('');
130
+ case 'sleeping':
131
+ return [
132
+ [32, 0, 0.9],
133
+ [0, -22, 1.35],
134
+ ]
135
+ .map(([x, y, s]) => `<path class="ta-dino-z" transform="translate(${at.x + x} ${at.y + y}) scale(${s})" d="M-8 -8 L8 -8 L-8 8 L8 8" fill="none" stroke="var(--ta-muted, #8e8e93)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>`)
136
+ .join('');
137
+ case 'speaking': {
138
+ // Waves from the snout.
139
+ const { x, y } = species.snout;
140
+ return [12, 22]
141
+ .map(r => `<path class="ta-dino-wave" d="M${x + r * 0.3} ${y - r} Q${x + r} ${y} ${x + r * 0.3} ${y + r}" fill="none" stroke="${species.colors.skin}" stroke-width="4.5" stroke-linecap="round"/>`)
142
+ .join('');
143
+ }
144
+ default:
145
+ return '';
146
+ }
147
+ }
148
+ //# sourceMappingURL=dino-face.js.map
@@ -0,0 +1,12 @@
1
+ import type { Point } from './dino-shape';
2
+ /** A 2D affine transform [a, b, c, d, e, f], as in SVG's matrix(). */
3
+ export type Matrix = [number, number, number, number, number, number];
4
+ export declare function multiply(m: Matrix, n: Matrix): Matrix;
5
+ /** Turn by `degrees` around `at`, scaling by `sx`, `sy` there. */
6
+ export declare function around(at: Point, degrees: number, sx?: number, sy?: number): Matrix;
7
+ export declare const move: (x: number, y: number) => Matrix;
8
+ export declare function matrix(m: Matrix): string;
9
+ export declare function smoothstep(x: number): number;
10
+ /** A color of six hex digits mixed toward another by `k` (0 to 1). */
11
+ export declare function mix(color: string, toward: string, k: number): string;
12
+ //# sourceMappingURL=dino-geometry.d.ts.map
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.move = void 0;
4
+ exports.multiply = multiply;
5
+ exports.around = around;
6
+ exports.matrix = matrix;
7
+ exports.smoothstep = smoothstep;
8
+ exports.mix = mix;
9
+ function multiply(m, n) {
10
+ return [
11
+ m[0] * n[0] + m[2] * n[1],
12
+ m[1] * n[0] + m[3] * n[1],
13
+ m[0] * n[2] + m[2] * n[3],
14
+ m[1] * n[2] + m[3] * n[3],
15
+ m[0] * n[4] + m[2] * n[5] + m[4],
16
+ m[1] * n[4] + m[3] * n[5] + m[5],
17
+ ];
18
+ }
19
+ /** Turn by `degrees` around `at`, scaling by `sx`, `sy` there. */
20
+ function around(at, degrees, sx = 1, sy = 1) {
21
+ const a = (degrees * Math.PI) / 180;
22
+ const cos = Math.cos(a);
23
+ const sin = Math.sin(a);
24
+ const m = [cos * sx, sin * sx, -sin * sy, cos * sy, 0, 0];
25
+ m[4] = at.x - m[0] * at.x - m[2] * at.y;
26
+ m[5] = at.y - m[1] * at.x - m[3] * at.y;
27
+ return m;
28
+ }
29
+ const move = (x, y) => [1, 0, 0, 1, x, y];
30
+ exports.move = move;
31
+ function matrix(m) {
32
+ return `matrix(${m.map(n => Math.round(n * 1000) / 1000).join(' ')})`;
33
+ }
34
+ function smoothstep(x) {
35
+ const t = Math.min(1, Math.max(0, x));
36
+ return t * t * (3 - 2 * t);
37
+ }
38
+ /** A color of six hex digits mixed toward another by `k` (0 to 1). */
39
+ function mix(color, toward, k) {
40
+ const channel = (hex, i) => Number.parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
41
+ return `#${[0, 1, 2]
42
+ .map(i => Math.round(channel(color, i) + (channel(toward, i) - channel(color, i)) * k)
43
+ .toString(16)
44
+ .padStart(2, '0'))
45
+ .join('')}`;
46
+ }
47
+ //# sourceMappingURL=dino-geometry.js.map
@@ -0,0 +1,16 @@
1
+ import type { DinoSpecies } from './dino-species';
2
+ /** ta as the logo draws it. */
3
+ export declare const TREX: DinoSpecies;
4
+ /** Three horns and a frill; on four legs. */
5
+ export declare const TRICERATOPS: DinoSpecies;
6
+ /** Plates along its back and spikes at the end of its tail; on four legs, its head low. */
7
+ export declare const STEGOSAURUS: DinoSpecies;
8
+ /** A neck that reaches up to the trees; on four legs, the front ones long. */
9
+ export declare const BRACHIOSAURUS: DinoSpecies;
10
+ /** Quick and lean, a long straight tail; on two legs. */
11
+ export declare const VELOCIRAPTOR: DinoSpecies;
12
+ /** Armored all over, spikes on its back and a club at the end of its tail; low, on four legs. */
13
+ export declare const ANKYLOSAURUS: DinoSpecies;
14
+ /** A flier: wings, a long beak and a crest behind it; it stands on small legs. */
15
+ export declare const PTERANODON: DinoSpecies;
16
+ //# sourceMappingURL=dino-kinds.d.ts.map