@publish.os/nextjs 0.0.1-alpha.4 → 0.0.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/config/createNextConfig.js +3 -3
- package/dist/index.js +7 -5
- package/dist/kernel/components/blocks/color-palette.js +35 -4
- package/dist/kernel/components/blocks/design-system-preview.js +18 -17
- package/dist/kernel/components/blocks/link-playground.js +3 -3
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -12
- package/dist/kernel/components/blocks/navbar.js +1 -1
- package/dist/kernel/components/blocks/navigation-progress-playground.js +2 -2
- package/dist/kernel/components/mdx/components/image.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -1
- package/dist/kernel/components/ui/breadcrumb-trail.js +1 -0
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -5
- package/dist/kernel/components/ui/breadcrumb.js +1 -16
- package/dist/kernel/components/ui/button-group.d.ts +2 -2
- package/dist/kernel/components/ui/button-group.js +2 -3
- package/dist/kernel/components/ui/button.d.ts +3 -4
- package/dist/kernel/components/ui/button.js +4 -12
- package/dist/kernel/components/ui/card.d.ts +1 -1
- package/dist/kernel/components/ui/menu.js +5 -5
- package/dist/kernel/components/ui/navigation-menu.js +2 -2
- package/dist/kernel/components/ui/popover.js +5 -11
- package/dist/kernel/components/ui/select.js +5 -5
- package/dist/kernel/components/ui/tag.d.ts +14 -0
- package/dist/kernel/components/ui/tag.js +76 -0
- package/dist/kernel/components/ui/text.d.ts +1 -1
- package/dist/kernel/components/ui/text.js +109 -106
- package/dist/kernel/components/ui/theme-toggle.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +2 -2
- package/dist/kernel/defaults.registry.d.ts +63 -72
- package/dist/kernel/defaults.registry.js +62 -70
- package/dist/kernel/routes/agent/markdown.js +2 -2
- package/dist/kernel/routes/metadata/feed.js +2 -2
- package/dist/kernel/routes/metadata/llms.js +4 -2
- package/dist/kernel/routes/metadata/og-image.d.ts +1 -1
- package/dist/kernel/routes/metadata/robots.js +2 -2
- package/dist/kernel/routes/metadata/sitemap.js +2 -2
- package/dist/utils/cn.d.ts +1 -1
- package/package.json +4 -9
- package/release/package.json +4 -3
- package/release/release.json +5 -5
- package/release/{pnpm-lock.yaml → runtime-pnpm-lock.yaml} +348 -224
- package/dist/cache/tags.cjs +0 -79
- package/dist/cache/tags.d.cts +0 -13
- package/dist/config/createNextConfig.cjs +0 -52
- package/dist/config/createNextConfig.d.cts +0 -8
- package/dist/config.cjs +0 -78
- package/dist/config.d.cts +0 -101
- package/dist/config.d.ts +0 -101
- package/dist/config.js +0 -48
- package/dist/index.cjs +0 -1266
- package/dist/index.d.cts +0 -18
- package/dist/kernel/components/blocks/AgentActions.cjs +0 -425
- package/dist/kernel/components/blocks/AgentActions.d.cts +0 -52
- package/dist/kernel/components/blocks/animated-icon-swap.cjs +0 -101
- package/dist/kernel/components/blocks/animated-icon-swap.d.cts +0 -16
- package/dist/kernel/components/blocks/color-palette.cjs +0 -413
- package/dist/kernel/components/blocks/color-palette.d.cts +0 -7
- package/dist/kernel/components/blocks/design-system-preview.cjs +0 -592
- package/dist/kernel/components/blocks/design-system-preview.d.cts +0 -29
- package/dist/kernel/components/blocks/link-playground.cjs +0 -816
- package/dist/kernel/components/blocks/link-playground.d.cts +0 -5
- package/dist/kernel/components/blocks/logo-block.cjs +0 -156
- package/dist/kernel/components/blocks/logo-block.d.cts +0 -21
- package/dist/kernel/components/blocks/nav-breadcrumb.cjs +0 -122
- package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +0 -11
- package/dist/kernel/components/blocks/navbar.cjs +0 -154
- package/dist/kernel/components/blocks/navbar.d.cts +0 -16
- package/dist/kernel/components/blocks/navigation-progress-playground.cjs +0 -735
- package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +0 -5
- package/dist/kernel/components/blocks/navigation-progress.cjs +0 -270
- package/dist/kernel/components/blocks/navigation-progress.d.cts +0 -16
- package/dist/kernel/components/blocks/next-prev.cjs +0 -142
- package/dist/kernel/components/blocks/next-prev.d.cts +0 -11
- package/dist/kernel/components/blocks/page-list.cjs +0 -59
- package/dist/kernel/components/blocks/page-list.d.cts +0 -11
- package/dist/kernel/components/blocks/search.cjs +0 -717
- package/dist/kernel/components/blocks/search.d.cts +0 -77
- package/dist/kernel/components/blocks/sidebar-node.cjs +0 -309
- package/dist/kernel/components/blocks/sidebar-node.d.cts +0 -8
- package/dist/kernel/components/blocks/sidebar.cjs +0 -317
- package/dist/kernel/components/blocks/sidebar.d.cts +0 -33
- package/dist/kernel/components/blocks/theme-toggle.cjs +0 -31
- package/dist/kernel/components/blocks/theme-toggle.d.cts +0 -6
- package/dist/kernel/components/blocks/toc.cjs +0 -356
- package/dist/kernel/components/blocks/toc.d.cts +0 -10
- package/dist/kernel/components/mdx/components/blockquote.cjs +0 -66
- package/dist/kernel/components/mdx/components/blockquote.d.cts +0 -6
- package/dist/kernel/components/mdx/components/callout.cjs +0 -137
- package/dist/kernel/components/mdx/components/callout.d.cts +0 -18
- package/dist/kernel/components/mdx/components/code-block.cjs +0 -39
- package/dist/kernel/components/mdx/components/code-block.d.cts +0 -9
- package/dist/kernel/components/mdx/components/figure-caption.cjs +0 -63
- package/dist/kernel/components/mdx/components/figure-caption.d.cts +0 -6
- package/dist/kernel/components/mdx/components/figure.cjs +0 -78
- package/dist/kernel/components/mdx/components/figure.d.cts +0 -10
- package/dist/kernel/components/mdx/components/footnotes.cjs +0 -66
- package/dist/kernel/components/mdx/components/footnotes.d.cts +0 -6
- package/dist/kernel/components/mdx/components/heading-copy-link.cjs +0 -108
- package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +0 -23
- package/dist/kernel/components/mdx/components/heading.cjs +0 -166
- package/dist/kernel/components/mdx/components/heading.d.cts +0 -8
- package/dist/kernel/components/mdx/components/hr.cjs +0 -34
- package/dist/kernel/components/mdx/components/hr.d.cts +0 -9
- package/dist/kernel/components/mdx/components/image-zoom.cjs +0 -49
- package/dist/kernel/components/mdx/components/image-zoom.d.cts +0 -10
- package/dist/kernel/components/mdx/components/image.cjs +0 -192
- package/dist/kernel/components/mdx/components/image.d.cts +0 -21
- package/dist/kernel/components/mdx/components/inline-code.cjs +0 -66
- package/dist/kernel/components/mdx/components/inline-code.d.cts +0 -6
- package/dist/kernel/components/mdx/components/kbd.cjs +0 -34
- package/dist/kernel/components/mdx/components/kbd.d.cts +0 -10
- package/dist/kernel/components/mdx/components/link.cjs +0 -49
- package/dist/kernel/components/mdx/components/link.d.cts +0 -11
- package/dist/kernel/components/mdx/components/paragraph.cjs +0 -87
- package/dist/kernel/components/mdx/components/paragraph.d.cts +0 -5
- package/dist/kernel/components/mdx/components/pre.cjs +0 -66
- package/dist/kernel/components/mdx/components/pre.d.cts +0 -6
- package/dist/kernel/components/mdx/components/strikethrough.cjs +0 -63
- package/dist/kernel/components/mdx/components/strikethrough.d.cts +0 -6
- package/dist/kernel/components/mdx/components/table.cjs +0 -59
- package/dist/kernel/components/mdx/components/table.d.cts +0 -10
- package/dist/kernel/components/mdx/components/task-list.cjs +0 -88
- package/dist/kernel/components/mdx/components/task-list.d.cts +0 -8
- package/dist/kernel/components/mdx/components/video-player.cjs +0 -173
- package/dist/kernel/components/mdx/components/video-player.d.cts +0 -18
- package/dist/kernel/components/mdx/components/video.cjs +0 -185
- package/dist/kernel/components/mdx/components/video.d.cts +0 -15
- package/dist/kernel/components/mdx/error-boundary.cjs +0 -62
- package/dist/kernel/components/mdx/error-boundary.d.cts +0 -8
- package/dist/kernel/components/mdx/error-fallback.cjs +0 -58
- package/dist/kernel/components/mdx/error-fallback.d.cts +0 -9
- package/dist/kernel/components/mdx/mdx.cjs +0 -141
- package/dist/kernel/components/mdx/mdx.d.cts +0 -22
- package/dist/kernel/components/mdx/rehype-heading-ids.cjs +0 -113
- package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +0 -10
- package/dist/kernel/components/mdx/types.cjs +0 -18
- package/dist/kernel/components/mdx/types.d.cts +0 -18
- package/dist/kernel/components/ui/accordion.cjs +0 -104
- package/dist/kernel/components/ui/accordion.d.cts +0 -16
- package/dist/kernel/components/ui/badge.cjs +0 -75
- package/dist/kernel/components/ui/badge.d.cts +0 -12
- package/dist/kernel/components/ui/badge.d.ts +0 -12
- package/dist/kernel/components/ui/badge.js +0 -47
- package/dist/kernel/components/ui/breadcrumb-trail.cjs +0 -238
- package/dist/kernel/components/ui/breadcrumb-trail.d.cts +0 -13
- package/dist/kernel/components/ui/breadcrumb.cjs +0 -399
- package/dist/kernel/components/ui/breadcrumb.d.cts +0 -52
- package/dist/kernel/components/ui/button-group.cjs +0 -144
- package/dist/kernel/components/ui/button-group.d.cts +0 -19
- package/dist/kernel/components/ui/button.cjs +0 -147
- package/dist/kernel/components/ui/button.d.cts +0 -23
- package/dist/kernel/components/ui/card.cjs +0 -133
- package/dist/kernel/components/ui/card.d.cts +0 -17
- package/dist/kernel/components/ui/dialog.cjs +0 -149
- package/dist/kernel/components/ui/dialog.d.cts +0 -22
- package/dist/kernel/components/ui/drawer.cjs +0 -163
- package/dist/kernel/components/ui/drawer.d.cts +0 -24
- package/dist/kernel/components/ui/input.cjs +0 -96
- package/dist/kernel/components/ui/input.d.cts +0 -18
- package/dist/kernel/components/ui/kbd.cjs +0 -105
- package/dist/kernel/components/ui/kbd.d.cts +0 -13
- package/dist/kernel/components/ui/link.cjs +0 -253
- package/dist/kernel/components/ui/link.d.cts +0 -31
- package/dist/kernel/components/ui/menu.cjs +0 -301
- package/dist/kernel/components/ui/menu.d.cts +0 -70
- package/dist/kernel/components/ui/meta-key.cjs +0 -34
- package/dist/kernel/components/ui/meta-key.d.cts +0 -12
- package/dist/kernel/components/ui/navigation-menu.cjs +0 -253
- package/dist/kernel/components/ui/navigation-menu.d.cts +0 -47
- package/dist/kernel/components/ui/popover.cjs +0 -168
- package/dist/kernel/components/ui/popover.d.cts +0 -24
- package/dist/kernel/components/ui/progress.cjs +0 -112
- package/dist/kernel/components/ui/progress.d.cts +0 -16
- package/dist/kernel/components/ui/scroll-area.cjs +0 -413
- package/dist/kernel/components/ui/scroll-area.d.cts +0 -58
- package/dist/kernel/components/ui/select.cjs +0 -244
- package/dist/kernel/components/ui/select.d.cts +0 -40
- package/dist/kernel/components/ui/separator.cjs +0 -73
- package/dist/kernel/components/ui/separator.d.cts +0 -8
- package/dist/kernel/components/ui/table.cjs +0 -131
- package/dist/kernel/components/ui/table.d.cts +0 -11
- package/dist/kernel/components/ui/tabs.cjs +0 -450
- package/dist/kernel/components/ui/tabs.d.cts +0 -82
- package/dist/kernel/components/ui/text.cjs +0 -184
- package/dist/kernel/components/ui/text.d.cts +0 -17
- package/dist/kernel/components/ui/theme-toggle.cjs +0 -108
- package/dist/kernel/components/ui/theme-toggle.d.cts +0 -10
- package/dist/kernel/components/ui/toast.cjs +0 -154
- package/dist/kernel/components/ui/toast.d.cts +0 -26
- package/dist/kernel/components/ui/tooltip.cjs +0 -127
- package/dist/kernel/components/ui/tooltip.d.cts +0 -20
- package/dist/kernel/defaults.registry.cjs +0 -541
- package/dist/kernel/defaults.registry.d.cts +0 -469
- package/dist/kernel/routes/agent/markdown.cjs +0 -202
- package/dist/kernel/routes/agent/markdown.d.cts +0 -58
- package/dist/kernel/routes/layouts/group.cjs +0 -181
- package/dist/kernel/routes/layouts/group.d.cts +0 -20
- package/dist/kernel/routes/metadata/feed.cjs +0 -293
- package/dist/kernel/routes/metadata/feed.d.cts +0 -20
- package/dist/kernel/routes/metadata/llms.cjs +0 -239
- package/dist/kernel/routes/metadata/llms.d.cts +0 -26
- package/dist/kernel/routes/metadata/og-image.cjs +0 -630
- package/dist/kernel/routes/metadata/og-image.d.cts +0 -62
- package/dist/kernel/routes/metadata/robots.cjs +0 -148
- package/dist/kernel/routes/metadata/robots.d.cts +0 -6
- package/dist/kernel/routes/metadata/sitemap.cjs +0 -192
- package/dist/kernel/routes/metadata/sitemap.d.cts +0 -8
- package/dist/kernel/routes/pages/group.cjs +0 -263
- package/dist/kernel/routes/pages/group.d.cts +0 -17
- package/dist/kernel/routes/pages/leaf.cjs +0 -421
- package/dist/kernel/routes/pages/leaf.d.cts +0 -36
- package/dist/kernel/routes/pages/root.cjs +0 -229
- package/dist/kernel/routes/pages/root.d.cts +0 -16
- package/dist/keyboard-shortcuts.cjs +0 -345
- package/dist/keyboard-shortcuts.d.cts +0 -34
- package/dist/resolvers/manifest-resolver.cjs +0 -111
- package/dist/resolvers/manifest-resolver.d.cts +0 -13
- package/dist/search.cjs +0 -411
- package/dist/search.d.cts +0 -20
- package/dist/types.cjs +0 -30
- package/dist/types.d.cts +0 -269
- package/dist/utils/cn.cjs +0 -49
- package/dist/utils/cn.d.cts +0 -15
- package/dist/utils/heading-ids.cjs +0 -119
- package/dist/utils/heading-ids.d.cts +0 -15
- package/dist/utils/pretty-date.cjs +0 -55
- package/dist/utils/pretty-date.d.cts +0 -6
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/keyboard-shortcuts.tsx
|
|
22
|
-
var keyboard_shortcuts_exports = {};
|
|
23
|
-
__export(keyboard_shortcuts_exports, {
|
|
24
|
-
KeyboardShortcutsProvider: () => KeyboardShortcutsProvider,
|
|
25
|
-
formatShortcut: () => formatShortcut,
|
|
26
|
-
useShortcut: () => useShortcut,
|
|
27
|
-
useShortcutRegistry: () => useShortcutRegistry
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(keyboard_shortcuts_exports);
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var DEFAULT_OPTIONS = {
|
|
33
|
-
description: "",
|
|
34
|
-
enabled: true,
|
|
35
|
-
enableOnContentEditable: false,
|
|
36
|
-
enableOnFormFields: false,
|
|
37
|
-
enableWhileComposing: false,
|
|
38
|
-
group: "",
|
|
39
|
-
preventDefault: true,
|
|
40
|
-
priority: 0,
|
|
41
|
-
stopPropagation: false
|
|
42
|
-
};
|
|
43
|
-
var MODIFIER_TOKENS = /* @__PURE__ */ new Set([
|
|
44
|
-
"mod",
|
|
45
|
-
"meta",
|
|
46
|
-
"ctrl",
|
|
47
|
-
"alt",
|
|
48
|
-
"shift"
|
|
49
|
-
]);
|
|
50
|
-
var KEY_ALIASES = {
|
|
51
|
-
cmd: "meta",
|
|
52
|
-
command: "meta",
|
|
53
|
-
control: "ctrl",
|
|
54
|
-
del: "delete",
|
|
55
|
-
down: "arrowdown",
|
|
56
|
-
esc: "escape",
|
|
57
|
-
ins: "insert",
|
|
58
|
-
left: "arrowleft",
|
|
59
|
-
opt: "alt",
|
|
60
|
-
option: "alt",
|
|
61
|
-
plus: "+",
|
|
62
|
-
return: "enter",
|
|
63
|
-
right: "arrowright",
|
|
64
|
-
space: " ",
|
|
65
|
-
spacebar: " ",
|
|
66
|
-
up: "arrowup"
|
|
67
|
-
};
|
|
68
|
-
var EDITABLE_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]);
|
|
69
|
-
var SYMBOLS_MAC = {
|
|
70
|
-
" ": "Space",
|
|
71
|
-
alt: "\u2325",
|
|
72
|
-
arrowdown: "\u2193",
|
|
73
|
-
arrowleft: "\u2190",
|
|
74
|
-
arrowright: "\u2192",
|
|
75
|
-
arrowup: "\u2191",
|
|
76
|
-
backspace: "\u232B",
|
|
77
|
-
ctrl: "\u2303",
|
|
78
|
-
delete: "\u2326",
|
|
79
|
-
enter: "\u21B5",
|
|
80
|
-
escape: "\u238B",
|
|
81
|
-
meta: "\u2318",
|
|
82
|
-
shift: "\u21E7"
|
|
83
|
-
};
|
|
84
|
-
var LABELS_OTHER = {
|
|
85
|
-
" ": "Space",
|
|
86
|
-
alt: "Alt",
|
|
87
|
-
arrowdown: "\u2193",
|
|
88
|
-
arrowleft: "\u2190",
|
|
89
|
-
arrowright: "\u2192",
|
|
90
|
-
arrowup: "\u2191",
|
|
91
|
-
backspace: "Backspace",
|
|
92
|
-
ctrl: "Ctrl",
|
|
93
|
-
delete: "Delete",
|
|
94
|
-
enter: "Enter",
|
|
95
|
-
escape: "Esc",
|
|
96
|
-
meta: "Win",
|
|
97
|
-
shift: "Shift"
|
|
98
|
-
};
|
|
99
|
-
function platform() {
|
|
100
|
-
if (typeof navigator === "undefined") return "";
|
|
101
|
-
return navigator.platform ?? "";
|
|
102
|
-
}
|
|
103
|
-
function isMacPlatform() {
|
|
104
|
-
return /mac|iphone|ipad|ipod/i.test(platform());
|
|
105
|
-
}
|
|
106
|
-
function parseChord(input) {
|
|
107
|
-
const source = input.trim();
|
|
108
|
-
const rawParts = source.split("+").map((part) => part.trim().toLowerCase()).filter(Boolean);
|
|
109
|
-
if (rawParts.length === 0) {
|
|
110
|
-
throw new Error(`useShortcut: empty key combo "${input}"`);
|
|
111
|
-
}
|
|
112
|
-
let alt = false;
|
|
113
|
-
let ctrl = false;
|
|
114
|
-
let key = "";
|
|
115
|
-
let meta = false;
|
|
116
|
-
let shift = false;
|
|
117
|
-
for (const part of rawParts) {
|
|
118
|
-
const aliased = KEY_ALIASES[part] ?? part;
|
|
119
|
-
if (MODIFIER_TOKENS.has(aliased)) {
|
|
120
|
-
switch (aliased) {
|
|
121
|
-
case "mod":
|
|
122
|
-
if (isMacPlatform()) meta = true;
|
|
123
|
-
else ctrl = true;
|
|
124
|
-
break;
|
|
125
|
-
case "meta":
|
|
126
|
-
meta = true;
|
|
127
|
-
break;
|
|
128
|
-
case "ctrl":
|
|
129
|
-
ctrl = true;
|
|
130
|
-
break;
|
|
131
|
-
case "alt":
|
|
132
|
-
alt = true;
|
|
133
|
-
break;
|
|
134
|
-
case "shift":
|
|
135
|
-
shift = true;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
if (key) {
|
|
141
|
-
throw new Error(
|
|
142
|
-
`useShortcut: combo "${input}" has more than one non-modifier key`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
key = aliased;
|
|
146
|
-
}
|
|
147
|
-
if (!key) {
|
|
148
|
-
throw new Error(`useShortcut: combo "${input}" has no non-modifier key`);
|
|
149
|
-
}
|
|
150
|
-
return { alt, ctrl, key, meta, shift, source };
|
|
151
|
-
}
|
|
152
|
-
function codeToLogicalKey(code) {
|
|
153
|
-
if (code.length === 4 && code.startsWith("Key")) {
|
|
154
|
-
return code[3]?.toLowerCase() ?? null;
|
|
155
|
-
}
|
|
156
|
-
if (code.length === 6 && code.startsWith("Digit")) {
|
|
157
|
-
return code[5] ?? null;
|
|
158
|
-
}
|
|
159
|
-
switch (code) {
|
|
160
|
-
case "Backquote":
|
|
161
|
-
return "`";
|
|
162
|
-
case "Backslash":
|
|
163
|
-
return "\\";
|
|
164
|
-
case "BracketLeft":
|
|
165
|
-
return "[";
|
|
166
|
-
case "BracketRight":
|
|
167
|
-
return "]";
|
|
168
|
-
case "Comma":
|
|
169
|
-
return ",";
|
|
170
|
-
case "Equal":
|
|
171
|
-
return "=";
|
|
172
|
-
case "Minus":
|
|
173
|
-
return "-";
|
|
174
|
-
case "Period":
|
|
175
|
-
return ".";
|
|
176
|
-
case "Quote":
|
|
177
|
-
return "'";
|
|
178
|
-
case "Semicolon":
|
|
179
|
-
return ";";
|
|
180
|
-
case "Slash":
|
|
181
|
-
return "/";
|
|
182
|
-
default:
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function chordMatches(event, chord) {
|
|
187
|
-
if (event.metaKey !== chord.meta || event.ctrlKey !== chord.ctrl || event.altKey !== chord.alt) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
const keyIsSingleChar = chord.key.length === 1;
|
|
191
|
-
if (!keyIsSingleChar && event.shiftKey !== chord.shift) return false;
|
|
192
|
-
if (keyIsSingleChar && chord.shift && !event.shiftKey) return false;
|
|
193
|
-
if (event.key.toLowerCase() === chord.key) return true;
|
|
194
|
-
const logicalKey = codeToLogicalKey(event.code);
|
|
195
|
-
return logicalKey !== null && logicalKey === chord.key;
|
|
196
|
-
}
|
|
197
|
-
function inspectTarget(target) {
|
|
198
|
-
if (!(target instanceof HTMLElement)) {
|
|
199
|
-
return { isContentEditable: false, isFormField: false };
|
|
200
|
-
}
|
|
201
|
-
return {
|
|
202
|
-
isContentEditable: target.isContentEditable,
|
|
203
|
-
isFormField: EDITABLE_TAGS.has(target.tagName)
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
function resolvedOptions(options) {
|
|
207
|
-
return { ...DEFAULT_OPTIONS, ...options };
|
|
208
|
-
}
|
|
209
|
-
var ShortcutContext = (0, import_react.createContext)(null);
|
|
210
|
-
function KeyboardShortcutsProvider({
|
|
211
|
-
children
|
|
212
|
-
}) {
|
|
213
|
-
const registry = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
214
|
-
const ordered = (0, import_react.useRef)([]);
|
|
215
|
-
const rebuildOrder = (0, import_react.useCallback)(() => {
|
|
216
|
-
const next = Array.from(registry.current.values());
|
|
217
|
-
next.sort((a, b) => b.priority - a.priority);
|
|
218
|
-
ordered.current = next;
|
|
219
|
-
}, []);
|
|
220
|
-
const register = (0, import_react.useCallback)(
|
|
221
|
-
(registration) => {
|
|
222
|
-
registry.current.set(registration.id, registration);
|
|
223
|
-
rebuildOrder();
|
|
224
|
-
return () => {
|
|
225
|
-
registry.current.delete(registration.id);
|
|
226
|
-
rebuildOrder();
|
|
227
|
-
};
|
|
228
|
-
},
|
|
229
|
-
[rebuildOrder]
|
|
230
|
-
);
|
|
231
|
-
const list = (0, import_react.useCallback)(() => {
|
|
232
|
-
const items = [];
|
|
233
|
-
for (const registration of registry.current.values()) {
|
|
234
|
-
const { options } = registration.ref.current;
|
|
235
|
-
items.push({
|
|
236
|
-
description: options.description,
|
|
237
|
-
enabled: options.enabled,
|
|
238
|
-
group: options.group,
|
|
239
|
-
id: registration.id,
|
|
240
|
-
source: registration.chords.map((chord) => chord.source)
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
return items;
|
|
244
|
-
}, []);
|
|
245
|
-
const handleKeyDown = (0, import_react.useCallback)((event) => {
|
|
246
|
-
const registrations = ordered.current;
|
|
247
|
-
if (registrations.length === 0) return;
|
|
248
|
-
let target = null;
|
|
249
|
-
for (const registration of registrations) {
|
|
250
|
-
const { handler, options } = registration.ref.current;
|
|
251
|
-
if (!options.enabled) continue;
|
|
252
|
-
if ((event.isComposing || event.keyCode === 229) && !options.enableWhileComposing) {
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
let matched = false;
|
|
256
|
-
for (const chord of registration.chords) {
|
|
257
|
-
if (chordMatches(event, chord)) {
|
|
258
|
-
matched = true;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
if (!matched) continue;
|
|
263
|
-
target ??= inspectTarget(event.target);
|
|
264
|
-
if (target.isFormField && !options.enableOnFormFields) continue;
|
|
265
|
-
if (target.isContentEditable && !options.enableOnContentEditable) {
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
if (options.preventDefault) event.preventDefault();
|
|
269
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
270
|
-
handler(event);
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
}, []);
|
|
274
|
-
(0, import_react.useEffect)(() => {
|
|
275
|
-
window.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
276
|
-
return () => {
|
|
277
|
-
window.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
278
|
-
};
|
|
279
|
-
}, [handleKeyDown]);
|
|
280
|
-
const api = (0, import_react.useMemo)(
|
|
281
|
-
() => ({ list, register }),
|
|
282
|
-
[list, register]
|
|
283
|
-
);
|
|
284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShortcutContext, { value: api, children });
|
|
285
|
-
}
|
|
286
|
-
function useShortcut(combo, handler, options) {
|
|
287
|
-
const api = (0, import_react.use)(ShortcutContext);
|
|
288
|
-
if (!api) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
"useShortcut must be used within <KeyboardShortcutsProvider>."
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
const id = (0, import_react.useId)();
|
|
294
|
-
const comboKey = typeof combo === "string" ? combo : combo.join("\0");
|
|
295
|
-
const chords = (0, import_react.useMemo)(() => {
|
|
296
|
-
return comboKey.split("\0").map(parseChord);
|
|
297
|
-
}, [comboKey]);
|
|
298
|
-
const optionsPriority = options?.priority ?? DEFAULT_OPTIONS.priority;
|
|
299
|
-
const live = (0, import_react.useRef)({
|
|
300
|
-
handler,
|
|
301
|
-
options: resolvedOptions(options)
|
|
302
|
-
});
|
|
303
|
-
live.current.handler = handler;
|
|
304
|
-
live.current.options = resolvedOptions(options);
|
|
305
|
-
(0, import_react.useEffect)(() => {
|
|
306
|
-
return api.register({ chords, id, priority: optionsPriority, ref: live });
|
|
307
|
-
}, [api, chords, id, optionsPriority]);
|
|
308
|
-
}
|
|
309
|
-
function useShortcutRegistry() {
|
|
310
|
-
const api = (0, import_react.use)(ShortcutContext);
|
|
311
|
-
if (!api) {
|
|
312
|
-
throw new Error(
|
|
313
|
-
"useShortcutRegistry must be used within <KeyboardShortcutsProvider>."
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
return { list: api.list };
|
|
317
|
-
}
|
|
318
|
-
function formatShortcut(source) {
|
|
319
|
-
const chord = parseChord(source);
|
|
320
|
-
const labels = isMacPlatform() ? SYMBOLS_MAC : LABELS_OTHER;
|
|
321
|
-
const tokens = [];
|
|
322
|
-
const push = (name) => tokens.push(labels[name] ?? name);
|
|
323
|
-
if (isMacPlatform()) {
|
|
324
|
-
if (chord.ctrl) push("ctrl");
|
|
325
|
-
if (chord.alt) push("alt");
|
|
326
|
-
if (chord.shift) push("shift");
|
|
327
|
-
if (chord.meta) push("meta");
|
|
328
|
-
} else {
|
|
329
|
-
if (chord.meta) push("meta");
|
|
330
|
-
if (chord.ctrl) push("ctrl");
|
|
331
|
-
if (chord.alt) push("alt");
|
|
332
|
-
if (chord.shift) push("shift");
|
|
333
|
-
}
|
|
334
|
-
tokens.push(
|
|
335
|
-
labels[chord.key] ?? (chord.key.length === 1 ? chord.key.toUpperCase() : chord.key.replace(/^\w/, (character) => character.toUpperCase()))
|
|
336
|
-
);
|
|
337
|
-
return tokens;
|
|
338
|
-
}
|
|
339
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
340
|
-
0 && (module.exports = {
|
|
341
|
-
KeyboardShortcutsProvider,
|
|
342
|
-
formatShortcut,
|
|
343
|
-
useShortcut,
|
|
344
|
-
useShortcutRegistry
|
|
345
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
type Modifier = "mod" | "meta" | "ctrl" | "alt" | "shift";
|
|
5
|
-
type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
6
|
-
interface ShortcutOptions {
|
|
7
|
-
description?: string;
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
enableOnContentEditable?: boolean;
|
|
10
|
-
enableOnFormFields?: boolean;
|
|
11
|
-
enableWhileComposing?: boolean;
|
|
12
|
-
group?: string;
|
|
13
|
-
preventDefault?: boolean;
|
|
14
|
-
priority?: number;
|
|
15
|
-
stopPropagation?: boolean;
|
|
16
|
-
}
|
|
17
|
-
type ShortcutRegistryItem = {
|
|
18
|
-
description: string;
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
group: string;
|
|
21
|
-
id: string;
|
|
22
|
-
source: string[];
|
|
23
|
-
};
|
|
24
|
-
type ShortcutRegistryApi = {
|
|
25
|
-
list: () => readonly ShortcutRegistryItem[];
|
|
26
|
-
};
|
|
27
|
-
declare function KeyboardShortcutsProvider({ children, }: {
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
}): react_jsx_runtime.JSX.Element;
|
|
30
|
-
declare function useShortcut(combo: string | readonly string[], handler: ShortcutHandler, options?: ShortcutOptions): void;
|
|
31
|
-
declare function useShortcutRegistry(): ShortcutRegistryApi;
|
|
32
|
-
declare function formatShortcut(source: string): string[];
|
|
33
|
-
|
|
34
|
-
export { KeyboardShortcutsProvider, type Modifier, type ShortcutHandler, type ShortcutOptions, type ShortcutRegistryApi, type ShortcutRegistryItem, formatShortcut, useShortcut, useShortcutRegistry };
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/resolvers/manifest-resolver.ts
|
|
21
|
-
var manifest_resolver_exports = {};
|
|
22
|
-
__export(manifest_resolver_exports, {
|
|
23
|
-
listStaticParams: () => listStaticParams,
|
|
24
|
-
resolveGroup: () => resolveGroup,
|
|
25
|
-
resolveGroupLayout: () => resolveGroupLayout,
|
|
26
|
-
resolveLeaf: () => resolveLeaf
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(manifest_resolver_exports);
|
|
29
|
-
function findNodeInTree(nodes, id) {
|
|
30
|
-
for (const node of nodes) {
|
|
31
|
-
if (node.type === "page") {
|
|
32
|
-
if (node.fileID === id) return node;
|
|
33
|
-
} else if (node.id === id) {
|
|
34
|
-
return node;
|
|
35
|
-
}
|
|
36
|
-
if (node.type === "section" || node.type === "folder") {
|
|
37
|
-
const found = findNodeInTree(node.children, id);
|
|
38
|
-
if (found) return found;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
function pageNode(page) {
|
|
44
|
-
return {
|
|
45
|
-
type: "page",
|
|
46
|
-
fileID: page.fileID,
|
|
47
|
-
title: page.title,
|
|
48
|
-
path: page.path,
|
|
49
|
-
group: page.group,
|
|
50
|
-
description: page.description,
|
|
51
|
-
status: page.status,
|
|
52
|
-
publishedAt: page.publishedAt,
|
|
53
|
-
updatedAt: page.updatedAt,
|
|
54
|
-
authors: page.authors,
|
|
55
|
-
tags: page.tags,
|
|
56
|
-
meta: page.meta
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function groupNode(group) {
|
|
60
|
-
return {
|
|
61
|
-
type: "section",
|
|
62
|
-
id: group.key,
|
|
63
|
-
title: group.title,
|
|
64
|
-
path: group.path,
|
|
65
|
-
group: group.key,
|
|
66
|
-
children: group.tree
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function resolveLeaf(manifest, group, slug) {
|
|
70
|
-
const slugPath = Array.isArray(slug) ? slug.join("/") : slug;
|
|
71
|
-
const page = manifest.pages.find((p) => p.group === group && p.slug === slugPath) ?? null;
|
|
72
|
-
if (!page) return null;
|
|
73
|
-
const groupData = manifest.groups[group];
|
|
74
|
-
if (!groupData) return null;
|
|
75
|
-
return {
|
|
76
|
-
site: manifest.site,
|
|
77
|
-
tree: groupData.tree,
|
|
78
|
-
node: findNodeInTree(groupData.tree, page.fileID) ?? pageNode(page),
|
|
79
|
-
page,
|
|
80
|
-
currentPath: page.path,
|
|
81
|
-
group
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function resolveGroup(manifest, group) {
|
|
85
|
-
const groupData = manifest.groups[group];
|
|
86
|
-
if (!groupData) return null;
|
|
87
|
-
return {
|
|
88
|
-
site: manifest.site,
|
|
89
|
-
tree: groupData.tree,
|
|
90
|
-
node: groupNode(groupData),
|
|
91
|
-
currentPath: groupData.path,
|
|
92
|
-
group
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function resolveGroupLayout(manifest, group, children) {
|
|
96
|
-
const resolved = resolveGroup(manifest, group);
|
|
97
|
-
if (!resolved) return null;
|
|
98
|
-
return { ...resolved, children };
|
|
99
|
-
}
|
|
100
|
-
function listStaticParams(manifest, group) {
|
|
101
|
-
const groupData = manifest.groups[group];
|
|
102
|
-
if (!groupData) return [];
|
|
103
|
-
return groupData.pages.map((page) => ({ slug: page.slug.split("/") }));
|
|
104
|
-
}
|
|
105
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
-
0 && (module.exports = {
|
|
107
|
-
listStaticParams,
|
|
108
|
-
resolveGroup,
|
|
109
|
-
resolveGroupLayout,
|
|
110
|
-
resolveLeaf
|
|
111
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import react__default from 'react';
|
|
2
|
-
import { ManifestLike, IndexPageProps, LayoutProps, PageProps } from '../types.cjs';
|
|
3
|
-
|
|
4
|
-
type ResolvedLeaf = PageProps;
|
|
5
|
-
type ResolvedGroup = Omit<IndexPageProps, "children">;
|
|
6
|
-
declare function resolveLeaf(manifest: ManifestLike, group: string, slug: string | string[]): ResolvedLeaf | null;
|
|
7
|
-
declare function resolveGroup(manifest: ManifestLike, group: string): ResolvedGroup | null;
|
|
8
|
-
declare function resolveGroupLayout(manifest: ManifestLike, group: string, children: react__default.ReactNode): LayoutProps | null;
|
|
9
|
-
declare function listStaticParams(manifest: ManifestLike, group: string): Array<{
|
|
10
|
-
slug: string[];
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export { type ResolvedGroup, type ResolvedLeaf, listStaticParams, resolveGroup, resolveGroupLayout, resolveLeaf };
|