@dxos/keyboard 0.6.12 → 0.6.13-main.548ca8d
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"inject-globals:@inject-globals":{"bytes":
|
|
1
|
+
{"inputs":{"inject-globals:@inject-globals":{"bytes":324,"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keyboard/src/keyboard.ts":{"bytes":15902,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keyboard/src/util.ts":{"bytes":5780,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keyboard/src/index.ts":{"bytes":576,"imports":[{"path":"packages/common/keyboard/src/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"packages/common/keyboard/src/util.ts","kind":"import-statement","original":"./util"},{"path":"@inject-globals","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"packages/common/keyboard/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10505},"packages/common/keyboard/dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/node-std/inject-globals","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Keyboard","keySymbols","parseShortcut"],"entryPoint":"packages/common/keyboard/src/index.ts","inputs":{"inject-globals:@inject-globals":{"bytesInOutput":79},"packages/common/keyboard/src/keyboard.ts":{"bytesInOutput":3637},"packages/common/keyboard/src/index.ts":{"bytesInOutput":0},"packages/common/keyboard/src/util.ts":{"bytesInOutput":1184}},"bytes":5143}}}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/common/keyboard/src/keyboard.ts
|
|
4
|
+
import { invariant } from "@dxos/invariant";
|
|
5
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/common/keyboard/src/keyboard.ts";
|
|
6
|
+
var modifiers = [
|
|
7
|
+
"ctrl",
|
|
8
|
+
"shift",
|
|
9
|
+
"alt",
|
|
10
|
+
"meta"
|
|
11
|
+
];
|
|
12
|
+
var parseShortcut = (shortcut, delimiter = /[+-]/) => {
|
|
13
|
+
const parts = shortcut.toLowerCase().split(delimiter);
|
|
14
|
+
const mods = modifiers.filter((key) => parts.includes(key));
|
|
15
|
+
invariant(mods.length === 0 || mods.length === parts.length - 1, void 0, {
|
|
16
|
+
F: __dxlog_file,
|
|
17
|
+
L: 29,
|
|
18
|
+
S: void 0,
|
|
19
|
+
A: [
|
|
20
|
+
"mods.length === 0 || mods.length === parts.length - 1",
|
|
21
|
+
""
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
return mods.length ? [
|
|
25
|
+
...mods,
|
|
26
|
+
parts[parts.length - 1]
|
|
27
|
+
].join("+") : shortcut;
|
|
28
|
+
};
|
|
29
|
+
var KeyboardContext = class {
|
|
30
|
+
constructor() {
|
|
31
|
+
this._keyMap = /* @__PURE__ */ new Map();
|
|
32
|
+
}
|
|
33
|
+
get bindings() {
|
|
34
|
+
return Array.from(this._keyMap.values());
|
|
35
|
+
}
|
|
36
|
+
get(binding) {
|
|
37
|
+
return this._keyMap.get(binding);
|
|
38
|
+
}
|
|
39
|
+
bind(config) {
|
|
40
|
+
config.shortcut = parseShortcut(config.shortcut);
|
|
41
|
+
this._keyMap.set(config.shortcut, config);
|
|
42
|
+
}
|
|
43
|
+
unbind(binding) {
|
|
44
|
+
this._keyMap.delete(binding);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var ROOT = "";
|
|
48
|
+
var Keyboard = class _Keyboard {
|
|
49
|
+
constructor() {
|
|
50
|
+
this._root = new KeyboardContext();
|
|
51
|
+
this._keyMap = /* @__PURE__ */ new Map([
|
|
52
|
+
[
|
|
53
|
+
ROOT,
|
|
54
|
+
this._root
|
|
55
|
+
]
|
|
56
|
+
]);
|
|
57
|
+
this._contexts = [
|
|
58
|
+
ROOT
|
|
59
|
+
];
|
|
60
|
+
this._keyHandler = this.handleKeyDown.bind(this);
|
|
61
|
+
this._path = ROOT;
|
|
62
|
+
this.bind = this._root.bind.bind(this._root);
|
|
63
|
+
this.unbind = this._root.unbind.bind(this._root);
|
|
64
|
+
}
|
|
65
|
+
static {
|
|
66
|
+
this.singleton = new _Keyboard();
|
|
67
|
+
}
|
|
68
|
+
initialize() {
|
|
69
|
+
document.addEventListener("keydown", this._keyHandler);
|
|
70
|
+
}
|
|
71
|
+
destroy() {
|
|
72
|
+
document.removeEventListener("keydown", this._keyHandler);
|
|
73
|
+
}
|
|
74
|
+
setCurrentContext(path = ROOT) {
|
|
75
|
+
this._path = path;
|
|
76
|
+
}
|
|
77
|
+
getCurrentContext() {
|
|
78
|
+
return this._path;
|
|
79
|
+
}
|
|
80
|
+
getContext(path = ROOT) {
|
|
81
|
+
let context = this._keyMap.get(path);
|
|
82
|
+
if (!context) {
|
|
83
|
+
context = new KeyboardContext();
|
|
84
|
+
this._keyMap.set(path, context);
|
|
85
|
+
this._contexts.push(path);
|
|
86
|
+
this._contexts.sort();
|
|
87
|
+
}
|
|
88
|
+
return context;
|
|
89
|
+
}
|
|
90
|
+
getBindings() {
|
|
91
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
92
|
+
for (let i = 0; i < this._contexts.length; ++i) {
|
|
93
|
+
const path = this._contexts[i];
|
|
94
|
+
if (this._path.startsWith(path)) {
|
|
95
|
+
this.getContext(path).bindings.forEach((binding) => {
|
|
96
|
+
bindings.set(binding.shortcut, binding);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return Array.from(bindings.values());
|
|
101
|
+
}
|
|
102
|
+
handleKeyDown(event) {
|
|
103
|
+
const { altKey, ctrlKey, metaKey, shiftKey, key } = event;
|
|
104
|
+
if (key !== "Alt" && key !== "Control" && key !== "Meta" && key !== "Shift") {
|
|
105
|
+
const tagName = event.target?.tagName;
|
|
106
|
+
const isInput = tagName === "INPUT" || tagName === "TEXTAREA" || event.target?.getAttribute("contenteditable");
|
|
107
|
+
const str = [
|
|
108
|
+
ctrlKey && "ctrl",
|
|
109
|
+
shiftKey && "shift",
|
|
110
|
+
altKey && "alt",
|
|
111
|
+
metaKey && "meta",
|
|
112
|
+
key
|
|
113
|
+
].filter(Boolean).join("+");
|
|
114
|
+
for (let i = this._contexts.length - 1; i >= 0; --i) {
|
|
115
|
+
const path = this._contexts[i];
|
|
116
|
+
if (this._path.startsWith(path)) {
|
|
117
|
+
const { data, handler, disableInput } = this.getContext(path).get(str) ?? {};
|
|
118
|
+
if (handler && (!isInput || !disableInput)) {
|
|
119
|
+
const result = handler({
|
|
120
|
+
context: path,
|
|
121
|
+
shortcut: str,
|
|
122
|
+
data,
|
|
123
|
+
event
|
|
124
|
+
});
|
|
125
|
+
if (result !== false) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
event.stopPropagation();
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// packages/common/keyboard/src/util.ts
|
|
138
|
+
import { getHostPlatform } from "@dxos/util";
|
|
139
|
+
var ctrl = {
|
|
140
|
+
macos: "\u2303",
|
|
141
|
+
ios: "\u2303",
|
|
142
|
+
windows: "Ctrl",
|
|
143
|
+
linux: "Ctrl",
|
|
144
|
+
unknown: "Ctrl"
|
|
145
|
+
};
|
|
146
|
+
var alt = {
|
|
147
|
+
macos: "\u2325",
|
|
148
|
+
ios: "\u2325",
|
|
149
|
+
windows: "Alt",
|
|
150
|
+
linux: "Alt",
|
|
151
|
+
unknown: "Alt"
|
|
152
|
+
};
|
|
153
|
+
var meta = {
|
|
154
|
+
macos: "\u2318",
|
|
155
|
+
ios: "\u2318",
|
|
156
|
+
windows: "\u229E",
|
|
157
|
+
// TODO(wittjosiah): Use ⌘ or ⊞ instead? Wait for user feedback.
|
|
158
|
+
// From https://en.wikipedia.org/wiki/Super_key_(keyboard_button).
|
|
159
|
+
linux: "\u2756",
|
|
160
|
+
unknown: "\u2756"
|
|
161
|
+
};
|
|
162
|
+
var getSymbol = (part) => {
|
|
163
|
+
const platform = getHostPlatform();
|
|
164
|
+
switch (part.toLowerCase()) {
|
|
165
|
+
// Mods.
|
|
166
|
+
case "alt":
|
|
167
|
+
return alt[platform];
|
|
168
|
+
case "ctrl":
|
|
169
|
+
return ctrl[platform];
|
|
170
|
+
case "meta":
|
|
171
|
+
return meta[platform];
|
|
172
|
+
case "shift":
|
|
173
|
+
return "\u21E7";
|
|
174
|
+
// Special keys.
|
|
175
|
+
case "backspace":
|
|
176
|
+
return "\u232B";
|
|
177
|
+
case "enter":
|
|
178
|
+
return "\u23CE";
|
|
179
|
+
case "escape":
|
|
180
|
+
return "\u238B";
|
|
181
|
+
case "space":
|
|
182
|
+
return "\u2423";
|
|
183
|
+
case "tab":
|
|
184
|
+
return "\u21E5";
|
|
185
|
+
default:
|
|
186
|
+
return part.toUpperCase();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var keySymbols = (keyBinding) => {
|
|
190
|
+
const parts = keyBinding.split("+");
|
|
191
|
+
return parts.map(getSymbol);
|
|
192
|
+
};
|
|
193
|
+
export {
|
|
194
|
+
Keyboard,
|
|
195
|
+
keySymbols,
|
|
196
|
+
parseShortcut
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/keyboard.ts", "../../../src/util.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { invariant } from '@dxos/invariant';\n\nexport type KeyHandler = (props: {\n context: string;\n shortcut: string;\n data?: any;\n event: KeyboardEvent;\n}) => boolean | void;\n\nexport type KeyBinding = {\n shortcut: string;\n handler: KeyHandler;\n disableInput?: boolean;\n data?: any;\n};\n\n// Keybinding is normalized to this order.\n// https://support.apple.com/en-us/HT201236\nconst modifiers = ['ctrl', 'shift', 'alt', 'meta'];\n\n// Normalize order and case of modifiers.\nexport const parseShortcut = (shortcut: string, delimiter = /[+-]/): string => {\n const parts = shortcut.toLowerCase().split(delimiter);\n const mods = modifiers.filter((key) => parts.includes(key));\n invariant(mods.length === 0 || mods.length === parts.length - 1);\n // Assume single natural key.\n return mods.length ? [...mods, parts[parts.length - 1]].join('+') : shortcut;\n};\n\nclass KeyboardContext {\n readonly _keyMap = new Map<string, KeyBinding>();\n\n get bindings() {\n return Array.from(this._keyMap.values());\n }\n\n get(binding: string) {\n return this._keyMap.get(binding);\n }\n\n bind(config: KeyBinding) {\n config.shortcut = parseShortcut(config.shortcut);\n this._keyMap.set(config.shortcut, config);\n }\n\n unbind(binding: string) {\n this._keyMap.delete(binding);\n }\n}\n\nconst ROOT = '';\n\n/**\n * Manages context-aware key bindings.\n */\nexport class Keyboard {\n static singleton = new Keyboard();\n\n private readonly _root = new KeyboardContext();\n private readonly _keyMap = new Map<string, KeyboardContext>([[ROOT, this._root]]);\n private readonly _contexts: string[] = [ROOT];\n private readonly _keyHandler = this.handleKeyDown.bind(this);\n private _path = ROOT;\n\n initialize() {\n document.addEventListener('keydown', this._keyHandler);\n }\n\n destroy() {\n document.removeEventListener('keydown', this._keyHandler);\n }\n\n bind = this._root.bind.bind(this._root);\n unbind = this._root.unbind.bind(this._root);\n\n setCurrentContext(path = ROOT) {\n this._path = path;\n }\n\n getCurrentContext() {\n return this._path;\n }\n\n getContext(path = ROOT): KeyboardContext {\n let context = this._keyMap.get(path);\n if (!context) {\n context = new KeyboardContext();\n this._keyMap.set(path, context);\n this._contexts.push(path);\n this._contexts.sort();\n }\n\n return context;\n }\n\n getBindings() {\n const bindings = new Map<string, KeyBinding>();\n for (let i = 0; i < this._contexts.length; ++i) {\n const path = this._contexts[i];\n if (this._path.startsWith(path)) {\n this.getContext(path).bindings.forEach((binding) => {\n bindings.set(binding.shortcut, binding);\n });\n }\n }\n\n return Array.from(bindings.values());\n }\n\n handleKeyDown(event: KeyboardEvent) {\n const { altKey, ctrlKey, metaKey, shiftKey, key } = event;\n\n if (key !== 'Alt' && key !== 'Control' && key !== 'Meta' && key !== 'Shift') {\n // Binding option to check for input or contenteditable.\n const tagName = (event.target as any)?.tagName;\n const isInput =\n tagName === 'INPUT' || tagName === 'TEXTAREA' || (event.target as any)?.getAttribute('contenteditable');\n\n // Normalized key binding (order matters, see note above).\n const str = [ctrlKey && 'ctrl', shiftKey && 'shift', altKey && 'alt', metaKey && 'meta', key]\n .filter(Boolean)\n .join('+');\n\n // Scan matching contexts.\n for (let i = this._contexts.length - 1; i >= 0; --i) {\n const path = this._contexts[i];\n if (this._path.startsWith(path)) {\n const { data, handler, disableInput } = this.getContext(path).get(str) ?? {};\n if (handler && (!isInput || !disableInput)) {\n const result = handler({ context: path, shortcut: str, data, event });\n if (result !== false) {\n // TODO(burdon): This doesn't prevent actions in markdown editor.\n // Reference: https://codemirror.net/docs/ref/#view.KeyBinding\n event.preventDefault();\n event.stopPropagation();\n }\n\n return;\n }\n }\n }\n }\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { getHostPlatform } from '@dxos/util';\n\n// Resources.\n// https://www.w3.org/TR/DOM-Level-3-Events/#events-keyboardevents\n// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key\n// https://developer.apple.com/design/human-interface-guidelines/designing-for-macos\n// https://support.apple.com/en-us/HT201236\n// https://support.apple.com/guide/mac-help/what-are-those-symbols-shown-in-menus-cpmh0011/mac\n\nconst ctrl: Record<string, string> = {\n macos: '⌃',\n ios: '⌃',\n windows: 'Ctrl',\n linux: 'Ctrl',\n unknown: 'Ctrl',\n};\n\nconst alt: Record<string, string> = {\n macos: '⌥',\n ios: '⌥',\n windows: 'Alt',\n linux: 'Alt',\n unknown: 'Alt',\n};\n\nconst meta: Record<string, string> = {\n macos: '⌘',\n ios: '⌘',\n windows: '⊞',\n // TODO(wittjosiah): Use ⌘ or ⊞ instead? Wait for user feedback.\n // From https://en.wikipedia.org/wiki/Super_key_(keyboard_button).\n linux: '❖',\n unknown: '❖',\n};\n\nconst getSymbol = (part: string) => {\n const platform = getHostPlatform();\n switch (part.toLowerCase()) {\n // Mods.\n case 'alt':\n return alt[platform];\n case 'ctrl':\n return ctrl[platform];\n case 'meta':\n return meta[platform];\n case 'shift':\n return '⇧';\n // Special keys.\n case 'backspace':\n return '⌫';\n case 'enter':\n return '⏎';\n case 'escape':\n return '⎋';\n case 'space':\n return '␣';\n case 'tab':\n return '⇥';\n default:\n return part.toUpperCase();\n }\n};\n\nexport const keySymbols = (keyBinding: string): string[] => {\n const parts = keyBinding.split('+');\n return parts.map(getSymbol);\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,iBAAiB;;AAkB1B,IAAMC,YAAY;EAAC;EAAQ;EAAS;EAAO;;AAGpC,IAAMC,gBAAgB,CAACC,UAAkBC,YAAY,WAAM;AAChE,QAAMC,QAAQF,SAASG,YAAW,EAAGC,MAAMH,SAAAA;AAC3C,QAAMI,OAAOP,UAAUQ,OAAO,CAACC,QAAQL,MAAMM,SAASD,GAAAA,CAAAA;AACtDV,YAAUQ,KAAKI,WAAW,KAAKJ,KAAKI,WAAWP,MAAMO,SAAS,GAAA,QAAA;;;;;;;;;AAE9D,SAAOJ,KAAKI,SAAS;OAAIJ;IAAMH,MAAMA,MAAMO,SAAS,CAAA;IAAIC,KAAK,GAAA,IAAOV;AACtE;AAEA,IAAMW,kBAAN,MAAMA;EAAN;AACWC,mBAAU,oBAAIC,IAAAA;;EAEvB,IAAIC,WAAW;AACb,WAAOC,MAAMC,KAAK,KAAKJ,QAAQK,OAAM,CAAA;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ASC,uBAAuB;AAShC,IAAMC,OAA+B;EACnCC,OAAO;EACPC,KAAK;EACLC,SAAS;EACTC,OAAO;EACPC,SAAS;AACX;AAEA,IAAMC,MAA8B;EAClCL,OAAO;EACPC,KAAK;EACLC,SAAS;EACTC,OAAO;EACPC,SAAS;AACX;AAEA,IAAME,OAA+B;EACnCN,OAAO;EACPC,KAAK;EACLC,SAAS;;;EAGTC,OAAO;EACPC,SAAS;AACX;AAEA,IAAMG,YAAY,CAACC,SAAAA;AACjB,QAAMC,WAAWC,gBAAAA;AACjB,UAAQF,KAAKG,YAAW,GAAA;;IAEtB,KAAK;AACH,aAAON,IAAII,QAAAA;IACb,KAAK;AACH,aAAOV,KAAKU,QAAAA;IACd,KAAK;AACH,aAAOH,KAAKG,QAAAA;IACd,KAAK;AACH,aAAO;;IAET,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT;AACE,aAAOD,KAAKI,YAAW;EAC3B;AACF;AAEO,IAAMC,aAAa,CAACC,eAAAA;AACzB,QAAMC,QAAQD,WAAWE,MAAM,GAAA;AAC/B,SAAOD,MAAME,IAAIV,SAAAA;AACnB;",
|
|
6
|
+
"names": ["invariant", "modifiers", "parseShortcut", "shortcut", "delimiter", "parts", "toLowerCase", "split", "mods", "filter", "key", "includes", "length", "join", "KeyboardContext", "_keyMap", "Map", "bindings", "Array", "from", "values", "get", "binding", "bind", "config", "set", "unbind", "delete", "ROOT", "Keyboard", "_root", "_contexts", "_keyHandler", "handleKeyDown", "_path", "singleton", "initialize", "document", "addEventListener", "destroy", "removeEventListener", "setCurrentContext", "path", "getCurrentContext", "getContext", "context", "push", "sort", "getBindings", "i", "startsWith", "forEach", "event", "altKey", "ctrlKey", "metaKey", "shiftKey", "tagName", "target", "isInput", "getAttribute", "str", "Boolean", "data", "handler", "disableInput", "result", "preventDefault", "stopPropagation", "getHostPlatform", "ctrl", "macos", "ios", "windows", "linux", "unknown", "alt", "meta", "getSymbol", "part", "platform", "getHostPlatform", "toLowerCase", "toUpperCase", "keySymbols", "keyBinding", "parts", "split", "map"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/common/keyboard/src/keyboard.ts":{"bytes":15902,"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keyboard/src/util.ts":{"bytes":5780,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/keyboard/src/index.ts":{"bytes":576,"imports":[{"path":"packages/common/keyboard/src/keyboard.ts","kind":"import-statement","original":"./keyboard"},{"path":"packages/common/keyboard/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"packages/common/keyboard/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10498},"packages/common/keyboard/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Keyboard","keySymbols","parseShortcut"],"entryPoint":"packages/common/keyboard/src/index.ts","inputs":{"packages/common/keyboard/src/keyboard.ts":{"bytesInOutput":3637},"packages/common/keyboard/src/index.ts":{"bytesInOutput":0},"packages/common/keyboard/src/util.ts":{"bytesInOutput":1184}},"bytes":5088}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/keyboard",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.13-main.548ca8d",
|
|
4
4
|
"description": "Keyboard bindings",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"node": {
|
|
13
|
-
"
|
|
13
|
+
"require": "./dist/lib/node/index.cjs",
|
|
14
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
14
15
|
},
|
|
15
16
|
"types": "./dist/types/src/index.d.ts"
|
|
16
17
|
}
|
|
@@ -24,16 +25,16 @@
|
|
|
24
25
|
"src"
|
|
25
26
|
],
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/util": "0.6.
|
|
28
|
+
"@dxos/node-std": "0.6.13-main.548ca8d",
|
|
29
|
+
"@dxos/invariant": "0.6.13-main.548ca8d",
|
|
30
|
+
"@dxos/util": "0.6.13-main.548ca8d"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"react": "~18.2.0",
|
|
33
34
|
"react-dom": "~18.2.0",
|
|
34
|
-
"@dxos/react-ui": "0.6.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
35
|
+
"@dxos/react-ui": "0.6.13-main.548ca8d",
|
|
36
|
+
"@dxos/storybook-utils": "0.6.13-main.548ca8d",
|
|
37
|
+
"@dxos/react-ui-theme": "0.6.13-main.548ca8d"
|
|
37
38
|
},
|
|
38
39
|
"publishConfig": {
|
|
39
40
|
"access": "public"
|