timvir 0.1.46 → 0.2.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 (36) hide show
  1. package/blocks/Arbitrary/Arbitrary.d.ts +1 -1
  2. package/blocks/Arbitrary/index.js +20 -10
  3. package/blocks/Code/index.js +19 -9
  4. package/blocks/Code/styles.css +1 -1
  5. package/blocks/ColorBar/index.js +19 -9
  6. package/blocks/ColorBook/index.js +19 -9
  7. package/blocks/Cover/index.js +19 -9
  8. package/blocks/Exhibit/Exhibit.d.ts +1 -1
  9. package/blocks/Exhibit/index.js +19 -9
  10. package/blocks/Font/index.js +19 -9
  11. package/blocks/Grid/Grid.d.ts +1 -1
  12. package/blocks/Grid/index.js +21 -11
  13. package/blocks/Icon/Icon.d.ts +1 -1
  14. package/blocks/Icon/index.js +19 -9
  15. package/blocks/Message/index.js +19 -9
  16. package/blocks/Swatch/index.js +19 -9
  17. package/blocks/Viewport/index.js +19 -9
  18. package/blocks/WebLink/index.js +19 -9
  19. package/blocks/styles.css +1 -1
  20. package/context/index.d.ts +2 -0
  21. package/core/components/Commands/Commands.d.ts +5 -0
  22. package/core/components/Commands/index.d.ts +1 -0
  23. package/core/components/Commands/internal/Action.d.ts +7 -0
  24. package/core/components/Commands/internal/Dialog.d.ts +8 -0
  25. package/core/components/Commands/internal/index.d.ts +2 -0
  26. package/core/components/Page/Page.d.ts +1 -1
  27. package/core/index.js +335 -53
  28. package/core/layout.d.ts +2 -2
  29. package/core/styles.css +9 -0
  30. package/package.json +5 -4
  31. package/search/Search/docs/index.mdx +1 -1
  32. package/search/SearchBoxInput/SearchBoxInput.d.ts +1 -1
  33. package/search/SearchBoxListItem/SearchBoxListItem.d.ts +1 -1
  34. package/search/SearchBoxListItem/docs/index.mdx +1 -1
  35. package/search/index.js +19 -9
  36. package/styles.css +10 -1
package/core/index.js CHANGED
@@ -6,6 +6,9 @@ import React__default, { useRef, useCallback, useEffect } from 'react';
6
6
  import { useImmer } from 'use-immer';
7
7
  import { MDXProvider } from '@mdx-js/react';
8
8
  import { makeBus } from 'timvir/bus';
9
+ import { castDraft } from 'immer';
10
+ import * as ReactDOM from 'react-dom';
11
+ import { defaultSearch } from 'timvir/search';
9
12
 
10
13
  /**
11
14
  * Takes a list of class names and filters for truthy ones, joining them into a single class name for convenience.
@@ -13,24 +16,34 @@ import { makeBus } from 'timvir/bus';
13
16
  * ```js
14
17
  * cx('red', isBig && 'big') // returns 'red big' if `isBig` is true, otherwise returns 'red'
15
18
  * ```
16
- * If arguments provided are objects, these objects are merged together, and the values are taken as class names:
19
+ * If space separated atomic styles are provided, they are deduplicated according to the first hashed valued:
17
20
  *
18
21
  * ```js
19
- * cx({ color: 'class1', textDecoration: 'class2'}, { color: 'class3' }) // returns `class3 class2`
22
+ * cx('atm_a_class1 atm_b_class2', 'atm_a_class3') // returns `atm_a_class3 atm_b_class2`
20
23
  * ```
21
24
  *
22
25
  * @returns the combined, space separated class names that can be applied directly to the class attribute
23
26
  */
24
27
  const cx = function cx() {
25
- const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean); // In the basic case, `cx` is passed all strings, and we simply need to join them together with space separators
26
-
27
- const classNamesResult = presentClassNames.filter(arg => typeof arg !== 'object'); // There might also be objects (eg. from the atomic API) such as cx('foo', {
28
- // key1: 'bar', key2: 'fizz'}, { key1: 'buzz' }) the desired behavior is to
29
- // deduplicate the values based on their properties. The object's values are
30
- // the class names
28
+ const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean);
29
+ const atomicClasses = {};
30
+ const nonAtomicClasses = [];
31
+
32
+ for (const className of presentClassNames) {
33
+ // className could be the output of a previous cx call, so split by ' ' first
34
+ const individualClassNames = className.split(' ');
35
+
36
+ for (const className of individualClassNames) {
37
+ if (className.startsWith('atm_')) {
38
+ const [, keyHash] = className.split('_');
39
+ atomicClasses[keyHash] = className;
40
+ } else {
41
+ nonAtomicClasses.push(className);
42
+ }
43
+ }
44
+ }
31
45
 
32
- const styleCollectionResult = Object.values(Object.assign({}, ...presentClassNames.filter(arg => typeof arg === 'object')));
33
- return [...styleCollectionResult, ...classNamesResult].join(' ');
46
+ return [...Object.values(atomicClasses), ...nonAtomicClasses].join(' ');
34
47
  };
35
48
 
36
49
  const noLayout = "nc2e9vn";
@@ -52,35 +65,35 @@ function Footer(props, ref) {
52
65
  } = props;
53
66
  return /*#__PURE__*/React.createElement(Root$2, {
54
67
  ref: ref,
55
- className: cx(className, classes$2.root),
68
+ className: cx(className, classes$5.root),
56
69
  ...rest
57
70
  }, links && /*#__PURE__*/React.createElement("div", {
58
71
  className: grid
59
72
  }, /*#__PURE__*/React.createElement("div", {
60
- className: classes$2.linkGroups
73
+ className: classes$5.linkGroups
61
74
  }, links.map(({
62
75
  group,
63
76
  items
64
77
  }, i) => /*#__PURE__*/React.createElement("div", {
65
78
  key: i
66
79
  }, /*#__PURE__*/React.createElement("div", {
67
- className: classes$2.linkGroupTitle
80
+ className: classes$5.linkGroupTitle
68
81
  }, group), /*#__PURE__*/React.createElement("div", null, items.map(({
69
82
  label,
70
83
  href
71
84
  }, j) => /*#__PURE__*/React.createElement("a", {
72
85
  key: j,
73
86
  href: href,
74
- className: classes$2.link
87
+ className: classes$5.link
75
88
  }, label))))))), /*#__PURE__*/React.createElement("div", {
76
- className: cx(grid, classes$2.meta)
89
+ className: cx(grid, classes$5.meta)
77
90
  }, /*#__PURE__*/React.createElement("div", null, "Built with ", /*#__PURE__*/React.createElement("a", {
78
91
  href: "https://timvir.vercel.app"
79
92
  }, "Timvir"))));
80
93
  }
81
94
 
82
95
  var Footer$1 = /*#__PURE__*/React.forwardRef(Footer);
83
- const classes$2 = {
96
+ const classes$5 = {
84
97
  root: "rwhrdvg",
85
98
  linkGroups: "l1u1x7q7",
86
99
  linkGroupTitle: "l1x5jo3a",
@@ -88,20 +101,19 @@ const classes$2 = {
88
101
  meta: "m1ojti9g"
89
102
  };
90
103
 
91
- /*!
92
- * hotkeys-js v3.8.7
93
- * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
94
- *
95
- * Copyright (c) 2021 kenny wong <wowohoo@qq.com>
96
- * http://jaywcjlove.github.io/hotkeys
104
+ /**!
105
+ * hotkeys-js v3.9.3
106
+ * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
97
107
  *
98
- * Licensed under the MIT license.
108
+ * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
109
+ * http://jaywcjlove.github.io/hotkeys
110
+ * Licensed under the MIT license
99
111
  */
100
112
  var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
101
113
 
102
- function addEvent(object, event, method) {
114
+ function addEvent(object, event, method, useCapture) {
103
115
  if (object.addEventListener) {
104
- object.addEventListener(event, method, false);
116
+ object.addEventListener(event, method, useCapture);
105
117
  } else if (object.attachEvent) {
106
118
  object.attachEvent("on".concat(event), function () {
107
119
  method(window.event);
@@ -244,6 +256,8 @@ for (var k = 1; k < 20; k++) {
244
256
 
245
257
  var _downKeys = []; // 记录摁下的绑定键
246
258
 
259
+ var winListendFocus = false; // window是否已经监听了focus事件
260
+
247
261
  var _scope = 'all'; // 默认热键范围
248
262
 
249
263
  var elementHasBindEvent = []; // 已绑定事件的节点记录
@@ -395,21 +409,20 @@ var eachUnbind = function eachUnbind(_ref) {
395
409
 
396
410
  if (!scope) scope = getScope();
397
411
  var mods = len > 1 ? getMods(_modifier, unbindKeys) : [];
398
- _handlers[keyCode] = _handlers[keyCode].map(function (record) {
412
+ _handlers[keyCode] = _handlers[keyCode].filter(function (record) {
399
413
  // 通过函数判断,是否解除绑定,函数相等直接返回
400
414
  var isMatchingMethod = method ? record.method === method : true;
401
-
402
- if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) {
403
- return {};
404
- }
405
-
406
- return record;
415
+ return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods));
407
416
  });
408
417
  });
409
418
  }; // 对监听对应快捷键的回调函数进行处理
410
419
 
411
420
 
412
- function eventHandler(event, handler, scope) {
421
+ function eventHandler(event, handler, scope, element) {
422
+ if (handler.element !== element) {
423
+ return;
424
+ }
425
+
413
426
  var modifiersMatch; // 看它是否在当前范围
414
427
 
415
428
  if (handler.scope === scope || handler.scope === 'all') {
@@ -436,7 +449,7 @@ function eventHandler(event, handler, scope) {
436
449
  } // 处理keydown事件
437
450
 
438
451
 
439
- function dispatch(event) {
452
+ function dispatch(event, element) {
440
453
  var asterisk = _handlers['*'];
441
454
  var key = event.keyCode || event.which || event.charCode; // 表单控件过滤 默认表单控件不触发快捷键
442
455
 
@@ -521,7 +534,7 @@ function dispatch(event) {
521
534
  if (asterisk) {
522
535
  for (var i = 0; i < asterisk.length; i++) {
523
536
  if (asterisk[i].scope === scope && (event.type === 'keydown' && asterisk[i].keydown || event.type === 'keyup' && asterisk[i].keyup)) {
524
- eventHandler(event, asterisk[i], scope);
537
+ eventHandler(event, asterisk[i], scope, element);
525
538
  }
526
539
  }
527
540
  } // key 不在 _handlers 中返回
@@ -543,7 +556,7 @@ function dispatch(event) {
543
556
 
544
557
  if (_downKeysCurrent.sort().join('') === _downKeys.sort().join('')) {
545
558
  // 找到处理内容
546
- eventHandler(event, record, scope);
559
+ eventHandler(event, record, scope, element);
547
560
  }
548
561
  }
549
562
  }
@@ -567,7 +580,8 @@ function hotkeys(key, option, method) {
567
580
  var i = 0;
568
581
  var keyup = false;
569
582
  var keydown = true;
570
- var splitKey = '+'; // 对为设定范围的判断
583
+ var splitKey = '+';
584
+ var capture = false; // 对为设定范围的判断
571
585
 
572
586
  if (method === undefined && typeof option === 'function') {
573
587
  method = option;
@@ -582,6 +596,8 @@ function hotkeys(key, option, method) {
582
596
 
583
597
  if (option.keydown !== undefined) keydown = option.keydown; // eslint-disable-line
584
598
 
599
+ if (option.capture !== undefined) capture = option.capture; // eslint-disable-line
600
+
585
601
  if (typeof option.splitKey === 'string') splitKey = option.splitKey; // eslint-disable-line
586
602
  }
587
603
 
@@ -608,7 +624,8 @@ function hotkeys(key, option, method) {
608
624
  shortcut: keys[i],
609
625
  method: method,
610
626
  key: keys[i],
611
- splitKey: splitKey
627
+ splitKey: splitKey,
628
+ element: element
612
629
  });
613
630
  } // 在全局document上设置快捷键
614
631
 
@@ -616,18 +633,36 @@ function hotkeys(key, option, method) {
616
633
  if (typeof element !== 'undefined' && !isElementBind(element) && window) {
617
634
  elementHasBindEvent.push(element);
618
635
  addEvent(element, 'keydown', function (e) {
619
- dispatch(e);
620
- });
621
- addEvent(window, 'focus', function () {
622
- _downKeys = [];
623
- });
636
+ dispatch(e, element);
637
+ }, capture);
638
+
639
+ if (!winListendFocus) {
640
+ winListendFocus = true;
641
+ addEvent(window, 'focus', function () {
642
+ _downKeys = [];
643
+ }, capture);
644
+ }
645
+
624
646
  addEvent(element, 'keyup', function (e) {
625
- dispatch(e);
647
+ dispatch(e, element);
626
648
  clearModifier(e);
627
- });
649
+ }, capture);
628
650
  }
629
651
  }
630
652
 
653
+ function trigger(shortcut) {
654
+ var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
655
+ Object.keys(_handlers).forEach(function (key) {
656
+ var data = _handlers[key].find(function (item) {
657
+ return item.scope === scope && item.shortcut === shortcut;
658
+ });
659
+
660
+ if (data && data.method) {
661
+ data.method();
662
+ }
663
+ });
664
+ }
665
+
631
666
  var _api = {
632
667
  setScope: setScope,
633
668
  getScope: getScope,
@@ -635,7 +670,11 @@ var _api = {
635
670
  getPressedKeyCodes: getPressedKeyCodes,
636
671
  isPressed: isPressed,
637
672
  filter: filter,
638
- unbind: unbind
673
+ trigger: trigger,
674
+ unbind: unbind,
675
+ keyMap: _keyMap,
676
+ modifier: _modifier,
677
+ modifierMap: modifierMap
639
678
  };
640
679
 
641
680
  for (var a$1 in _api) {
@@ -730,6 +769,8 @@ function useHotkeys(keys, callback, options, deps) {
730
769
  return ref;
731
770
  }
732
771
 
772
+ hotkeys.isPressed;
773
+
733
774
  function define (constructor, factory, prototype) {
734
775
  constructor.prototype = factory.prototype = prototype;
735
776
  prototype.constructor = constructor;
@@ -1244,6 +1285,239 @@ define(Cubehelix, cubehelix, extend(Color, {
1244
1285
 
1245
1286
  const theme = "t1amubg3";
1246
1287
 
1288
+ function Action(props) {
1289
+ const {
1290
+ label,
1291
+ ...rest
1292
+ } = props;
1293
+ return /*#__PURE__*/React.createElement("div", {
1294
+ className: classes$4.root,
1295
+ ...rest
1296
+ }, /*#__PURE__*/React.createElement("div", {
1297
+ className: classes$4.icon
1298
+ }, /*#__PURE__*/React.createElement("svg", {
1299
+ viewBox: "0 0 24 24",
1300
+ fill: "none",
1301
+ stroke: "currentColor",
1302
+ strokeWidth: "2",
1303
+ strokeLinecap: "round",
1304
+ strokeLinejoin: "round"
1305
+ }, /*#__PURE__*/React.createElement("line", {
1306
+ x1: "5",
1307
+ y1: "12",
1308
+ x2: "19",
1309
+ y2: "12"
1310
+ }), /*#__PURE__*/React.createElement("polyline", {
1311
+ points: "12 5 19 12 12 19"
1312
+ }))), /*#__PURE__*/React.createElement("div", {
1313
+ className: classes$4.label
1314
+ }, label));
1315
+ }
1316
+ const classes$4 = {
1317
+ root: "ru1mblv",
1318
+ icon: "i1wyx06o",
1319
+ label: "legxg01"
1320
+ };
1321
+
1322
+ function Dialog(props) {
1323
+ const {
1324
+ toc
1325
+ } = useContext();
1326
+ const {
1327
+ open,
1328
+ onClose,
1329
+ onDispose,
1330
+ ...rest
1331
+ } = props;
1332
+ const [state, mutate] = useImmer({
1333
+ style: {
1334
+ opacity: 0,
1335
+ transform: "scale(0.98)"
1336
+ },
1337
+ query: "",
1338
+ commands: []
1339
+ });
1340
+ React.useEffect(() => {
1341
+ mutate(draft => {
1342
+ if (open) {
1343
+ draft.style = {
1344
+ opacity: 1,
1345
+ transform: "none"
1346
+ };
1347
+ } else {
1348
+ draft.style = {
1349
+ opacity: 0,
1350
+ transform: "scale(0.95)"
1351
+ };
1352
+ setTimeout(() => {
1353
+ onDispose === null || onDispose === void 0 ? void 0 : onDispose();
1354
+ }, 200);
1355
+ }
1356
+ });
1357
+ }, [mutate, open]);
1358
+ React.useEffect(() => {
1359
+ (async () => {
1360
+ const {
1361
+ edges
1362
+ } = await defaultSearch(toc).q(state.query);
1363
+ mutate(draft => {
1364
+ draft.commands = edges;
1365
+ });
1366
+ })();
1367
+ }, [mutate, state.query]);
1368
+ return /*#__PURE__*/React.createElement("div", {
1369
+ className: classes$3.root,
1370
+ style: state.style,
1371
+ ...rest
1372
+ }, /*#__PURE__*/React.createElement("div", {
1373
+ className: classes$3.context
1374
+ }, "Context"), /*#__PURE__*/React.createElement("div", {
1375
+ className: classes$3.prompt
1376
+ }, /*#__PURE__*/React.createElement("input", {
1377
+ autoFocus: true,
1378
+ placeholder: "Type a command or search\u2026",
1379
+ value: state.query,
1380
+ onChange: ev => {
1381
+ const query = ev.currentTarget.value;
1382
+ mutate(draft => {
1383
+ draft.query = query;
1384
+ });
1385
+ }
1386
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
1387
+ className: classes$3.subheader
1388
+ }, "Pages"), /*#__PURE__*/React.createElement("div", {
1389
+ className: classes$3.commands
1390
+ }, state.commands.map(({
1391
+ node
1392
+ }, index) => /*#__PURE__*/React.createElement(Action, {
1393
+ key: index,
1394
+ label: node.label,
1395
+ onClick: () => {
1396
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1397
+ window.location.href = node.path;
1398
+ }
1399
+ })))));
1400
+ }
1401
+ const classes$3 = {
1402
+ root: "r1fo6voy",
1403
+ context: "c185xiij",
1404
+ prompt: "p1ky3ya3",
1405
+ subheader: "snq1o7g",
1406
+ commands: "cchvluj"
1407
+ };
1408
+
1409
+ function Commands(props) {
1410
+ var _state$dialog$reactPo, _state$dialog;
1411
+ const [state, mutate] = useImmer({
1412
+ /**
1413
+ * Whether the command palette should be open or not. The command palette is
1414
+ * opened by cmd+k, and closed by escape or clicking outside of the dialog.
1415
+ */
1416
+ open: false,
1417
+
1418
+ /**
1419
+ * If the dialog is visible (even during the closing transition), this
1420
+ * object contains both the container element (a div appended to the end of
1421
+ * the body) and the React Portal (that is returned by this component).
1422
+ */
1423
+ dialog: null
1424
+ });
1425
+
1426
+ function open() {
1427
+ mutate(draft => {
1428
+ draft.open = true;
1429
+
1430
+ if (!draft.dialog) {
1431
+ const containerElement = document.createElement("div");
1432
+ document.body.appendChild(containerElement);
1433
+ const reactPortal = /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
1434
+ className: classes$2.root,
1435
+ onClick: ev => {
1436
+ if (ev.target === ev.currentTarget) {
1437
+ close();
1438
+ }
1439
+ }
1440
+ }, /*#__PURE__*/React.createElement(Dialog, {
1441
+ open: true,
1442
+ onClose: close
1443
+ })), containerElement);
1444
+ draft.dialog = castDraft({
1445
+ containerElement,
1446
+ reactPortal
1447
+ });
1448
+ } else {
1449
+ const reactPortal = /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
1450
+ className: classes$2.root,
1451
+ onClick: ev => {
1452
+ if (ev.target === ev.currentTarget) {
1453
+ close();
1454
+ }
1455
+ }
1456
+ }, /*#__PURE__*/React.createElement(Dialog, {
1457
+ open: true,
1458
+ onClose: close
1459
+ })), draft.dialog.containerElement);
1460
+ draft.dialog.reactPortal = reactPortal;
1461
+ }
1462
+ });
1463
+ }
1464
+
1465
+ function close() {
1466
+ mutate(draft => {
1467
+ draft.open = false;
1468
+
1469
+ if (draft.dialog) {
1470
+ const reactPortal = /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
1471
+ className: classes$2.root
1472
+ }, /*#__PURE__*/React.createElement(Dialog, {
1473
+ onDispose: () => {
1474
+ mutate(draft => {
1475
+ if (!draft.open && draft.dialog) {
1476
+ document.body.removeChild(draft.dialog.containerElement);
1477
+ draft.dialog = null;
1478
+ }
1479
+ });
1480
+ }
1481
+ })), draft.dialog.containerElement);
1482
+ draft.dialog.reactPortal = reactPortal;
1483
+ }
1484
+ });
1485
+ }
1486
+
1487
+ useHotkeys("command+k", ev => {
1488
+ ev.preventDefault();
1489
+
1490
+ if (!state.open) {
1491
+ open();
1492
+ } else {
1493
+ close();
1494
+ }
1495
+ }, {
1496
+ enableOnTags: ["INPUT"]
1497
+ });
1498
+ useHotkeys("escape", () => {
1499
+ close();
1500
+ }, {
1501
+ enableOnTags: ["INPUT"]
1502
+ });
1503
+ /*
1504
+ * Crude body scroll lock when the dialog is open.
1505
+ */
1506
+
1507
+ React.useEffect(() => {
1508
+ if (state.open) {
1509
+ document.body.style.overflow = "hidden";
1510
+ return () => {
1511
+ document.body.style.overflow = "";
1512
+ };
1513
+ }
1514
+ }, [state.open]);
1515
+ return (_state$dialog$reactPo = (_state$dialog = state.dialog) === null || _state$dialog === void 0 ? void 0 : _state$dialog.reactPortal) !== null && _state$dialog$reactPo !== void 0 ? _state$dialog$reactPo : null;
1516
+ }
1517
+ const classes$2 = {
1518
+ root: "rfei6z8"
1519
+ };
1520
+
1247
1521
  /**
1248
1522
  * The underlying DOM element which is rendered by this component.
1249
1523
  */
@@ -1323,11 +1597,18 @@ var index = memoize(function (prop) {
1323
1597
  * - injects CSS variables used to define dynamic styles based on props
1324
1598
  */
1325
1599
 
1326
- const restOp = (obj, keysToExclude) => Object.keys(obj).filter(prop => keysToExclude.indexOf(prop) === -1).reduce((acc, curr) => {
1327
- acc[curr] = obj[curr];
1328
- return acc;
1329
- }, {}); // rest operator workaround
1600
+ const restOp = (obj, keys) => {
1601
+ const res = {};
1602
+ let key;
1330
1603
 
1604
+ for (key in obj) {
1605
+ if (keys.indexOf(key) === -1) {
1606
+ res[key] = obj[key];
1607
+ }
1608
+ }
1609
+
1610
+ return res;
1611
+ };
1331
1612
 
1332
1613
  const warnIfInvalid = (value, componentName) => {
1333
1614
  if (process.env.NODE_ENV !== 'production') {
@@ -1697,8 +1978,9 @@ function Page(props, ref) {
1697
1978
  bus,
1698
1979
  location,
1699
1980
  Link,
1700
- blocks
1701
- }), [bus, location, Link, blocks]);
1981
+ blocks,
1982
+ toc
1983
+ }), [bus, location, Link, blocks, toc]);
1702
1984
  useHotkeys("command+p,escape", (ev, handler) => {
1703
1985
  switch (handler.key) {
1704
1986
  case "command+p":
@@ -1801,7 +2083,7 @@ function Page(props, ref) {
1801
2083
  draft.search.open = false;
1802
2084
  });
1803
2085
  }
1804
- })));
2086
+ })), /*#__PURE__*/React.createElement(Commands, null));
1805
2087
  }
1806
2088
 
1807
2089
  var Page$1 = /*#__PURE__*/React.forwardRef(Page);
package/core/layout.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const noLayout: import("@linaria/core").LinariaClassName;
2
2
  export declare const grid: import("@linaria/core").LinariaClassName;
3
- export declare const extendedWidth: import("@linaria/core").LinariaClassName;
4
- export declare const fullWidth: import("@linaria/core").LinariaClassName;
3
+ export declare const extendedWidth: string;
4
+ export declare const fullWidth: string;
package/core/styles.css CHANGED
@@ -31,6 +31,7 @@
31
31
  .p1d7vdmn{margin:0 0 1rem;}
32
32
  .ugfnift{margin:0 0 1rem;}
33
33
  .o3pt2dg{margin:0 0 1rem;}
34
+ .rfei6z8{position:fixed;inset:0px;display:flex;z-index:900;align-items:flex-start;justify-content:center;padding:13vh 16px 16px;font-family:system-ui,sans-serif;font-feature-settings:"liga","kern";text-rendering:optimizelegibility;font-size:16px;line-height:1.725;}
34
35
  .re625n1{padding:50px 0;background:#282c34;color:white;display:grid;grid-auto-rows:min-content;grid-template-columns:[le] 16px [lex lc] 1fr [rc rex] 16px [re];}@media (min-width:48rem){.re625n1{grid-template-columns:[le] 24px [lex] 1fr [lc] minmax(0,48rem) [rc] 1fr [rex] 24px [re];}}@media (min-width:72rem){.re625n1{grid-template-columns:[le] 1fr 24px [lex] minmax(0,12rem) [lc] 48rem [rc] minmax(0,12rem) [rex] 24px 1fr [re];}}.re625n1 > *{grid-column:lc / rc;}
35
36
  .d19gj27w{display:flex;align-items:flex-start;justify-content:space-between;}
36
37
  .d15ohs1l{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;text-align:left;}
@@ -46,3 +47,11 @@
46
47
  .s1f74255{padding:24px 3px 30px;overflow-y:auto;flex-grow:1;overscroll-behavior:contain;}
47
48
  .d5l3c45{font-family:system-ui;}
48
49
  .d15ju3pv{color:var(--timvir-text-color);font-size:14px;font-weight:500;line-height:1.725;cursor:pointer;padding:2px 24px;border-radius:3px;display:flex;align-items:center;}.d15ju3pv:hover{background:var(--timvir-sidebar-highlight-color);}.d15ju3pv > svg{display:block;margin-right:4px;}
50
+ .ru1mblv{background-color:transparent;color:rgb(214,214,214);white-space:nowrap;display:flex;flex:0 0 100%;align-items:center;transition:color 0.1s;height:46px;display:flex;flex-shrink:initial;flex-basis:initial;flex-direction:row;flex-grow:1;overflow:hidden;align-items:center;padding-inline:14px;border-left:none;cursor:default;}.ru1mblv:hover{background-color:rgb(55,55,60);}
51
+ .i1wyx06o{margin-right:12px;width:16px;}.i1wyx06o > svg{display:block;width:16px;height:16px;}
52
+ .legxg01{font-size:0.8125rem;color:rgb(247,248,248);}
53
+ .r1fo6voy{position:relative;display:flex;flex-direction:column;flex-shrink:1;flex-grow:1;min-width:min-content;will-change:transform;transform-origin:center center;background:linear-gradient(136.61deg,rgb(39,40,43) 13.72%,rgb(45,46,49) 74.3%);border-radius:8px;box-shadow:rgb(0 0 0 / 50%) 0px 16px 70px;max-width:640px;color:rgb(214,214,214);overflow:hidden;transition:opacity 0.2s,transform 0.2s;}
54
+ .c185xiij{margin:16px 16px 0px;height:25px;line-height:25px;padding:0px 8px;font-size:0.8em;flex-shrink:0;align-self:flex-start;color:rgb(138,143,152);background:rgb(49,50,54);border-radius:4px;max-width:calc(100vw - 60px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
55
+ .p1ky3ya3{border-bottom:1px solid rgb(49,50,54);display:grid;grid-template-columns:1fr;align-items:center;position:relative;flex-shrink:0;height:62px;}.p1ky3ya3 > input{padding:20px;grid-area:1 / 1 / auto / auto;margin:0px;border:none;appearance:none;font-size:inherit;height:62px;background:transparent;color:rgb(214,214,214);caret-color:rgb(110,94,210);outline:none;width:100%;}
56
+ .snq1o7g{background:rgba(247,247,248,0.03);height:24px;padding-inline:14px;font-size:0.75rem;color:rgb(129,128,142);}
57
+ .cchvluj{height:300px;overflow:auto;}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "timvir",
4
- "version": "0.1.46",
4
+ "version": "0.2.1",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "exports": {
8
- "./style.css": "./style.css",
8
+ "./styles.css": "./styles.css",
9
9
  "./blocks": "./blocks/index.js",
10
10
  "./blocks/*": "./blocks/*/index.js",
11
11
  "./bus": "./bus/index.js",
@@ -15,7 +15,7 @@
15
15
  "./search": "./search/index.js"
16
16
  },
17
17
  "dependencies": {
18
- "bytestring": "^0.0.5",
18
+ "bytestring": "^1",
19
19
  "downshift": "^6",
20
20
  "fuzzaldrin-plus": "^0.6.0",
21
21
  "immer": "^9",
@@ -26,6 +26,7 @@
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@mdx-js/react": "*",
29
- "react": "*"
29
+ "react": "*",
30
+ "react-dom": "*"
30
31
  }
31
32
  }
@@ -1,6 +1,6 @@
1
1
  import { Search } from "..";
2
2
 
3
- import { Exhibit } from "@timvir/blocks";
3
+ import { Exhibit } from "timvir/blocks";
4
4
 
5
5
  # Search
6
6
 
@@ -7,5 +7,5 @@ interface Props extends React.ComponentProps<typeof Root> {
7
7
  value?: string;
8
8
  onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
9
9
  }
10
- declare const _default: React.ForwardRefExoticComponent<Pick<Props, "key" | "dir" | "onError" | "hidden" | "color" | "style" | "translate" | "prefix" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "value" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;
10
+ declare const _default: React.ForwardRefExoticComponent<Pick<Props, "hidden" | "color" | "style" | "translate" | "prefix" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "value" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;
11
11
  export default _default;