@rimelight/ui 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/ui",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment UI Library.",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -49,6 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
+ "@astrojs/prism": "^4.0.1",
52
53
  "@astrojs/vue": "6.0.1",
53
54
  "@iconify-json/lucide": "^1.2.102",
54
55
  "@nuxt/ui": "4.6.1",
@@ -1,39 +1,73 @@
1
- ---
1
+ ---
2
2
  import { Tabs, TabItem } from "@astrojs/starlight/components"
3
- import { Code } from "astro:components"
4
-
5
- interface Props {
6
- pkg: string
7
- type?: "add" | "create" | "install" | "remove" | "run"
8
- dev?: boolean
9
- }
10
-
11
- const { pkg, type = "add", dev = false } = Astro.props
12
-
13
- const commands: Record<string, Record<string, string>> = {
14
- npm: { add: "npm i", create: "npm create", install: "npm install", remove: "npm uninstall", run: "npm run", devOption: "-D" },
15
- yarn: { add: "yarn add", create: "yarn create", install: "yarn install", remove: "yarn remove", run: "yarn run", devOption: "-D" },
16
- pnpm: { add: "pnpm add", create: "pnpm create", install: "pnpm install", remove: "pnpm remove", run: "pnpm run", devOption: "-D" },
17
- bun: { add: "bun add", create: "bun create", install: "bun install", remove: "bun remove", run: "bun run", devOption: "-d" },
18
- }
19
-
20
- const managers = ["npm", "pnpm", "yarn", "bun"] as const
21
-
22
- function getCommand(manager: string, cmdType: string, pkgName: string, devFlag: boolean): string {
23
- const mgrCmds = commands[manager]
24
- if (!mgrCmds) return ""
25
- let cmd = mgrCmds[cmdType]
26
- if (!cmd) return ""
27
- if (cmdType === "add" && devFlag && mgrCmds.devOption) cmd += " " + mgrCmds.devOption
28
- if (pkgName && cmdType !== "install") cmd += " " + pkgName
29
- return cmd
30
- }
31
- ---
32
-
33
- <Tabs syncKey="package-managers">
34
- {managers.map((manager) => (
35
- <TabItem label={manager}>
36
- <Code code={getCommand(manager, type, pkg, dev)} lang="sh" />
37
- </TabItem>
38
- ))}
39
- </Tabs>
3
+ import { Prism } from "@astrojs/prism"
4
+
5
+ interface Props {
6
+ pkg?: string
7
+ type?: "add" | "create" | "dlx" | "exec" | "install" | "remove" | "run"
8
+ dev?: boolean
9
+ args?: string
10
+ comment?: string
11
+ prefix?: string
12
+ }
13
+
14
+ const {
15
+ pkg,
16
+ type = "add",
17
+ dev = false,
18
+ args,
19
+ comment,
20
+ prefix,
21
+ } = Astro.props
22
+
23
+ type Manager = "npm" | "yarn" | "pnpm" | "bun"
24
+ type CommandType = NonNullable<Props["type"]>
25
+
26
+ const commands: Record<Manager, Partial<Record<CommandType, string>> & { dev: string }> = {
27
+ npm: { add: "npm i", create: "npm create", dlx: "npx", exec: "npx", install: "npm install", run: "npm run", remove: "npm uninstall", dev: "-D" },
28
+ yarn: { add: "yarn add", create: "yarn create", dlx: "yarn dlx", exec: "yarn", install: "yarn install", run: "yarn run", remove: "yarn remove", dev: "-D" },
29
+ pnpm: { add: "pnpm add", create: "pnpm create", dlx: "pnpx", exec: "pnpm", install: "pnpm install", run: "pnpm run", remove: "pnpm remove", dev: "-D" },
30
+ bun: { add: "bun add", create: "bun create", install: "bun install", run: "bun run", remove: "bun remove", dev: "-d" },
31
+ }
32
+
33
+ const managers: Manager[] = ["npm", "pnpm", "yarn", "bun"]
34
+
35
+ function getCommand(mgr: Manager, cmdType: CommandType): string | undefined {
36
+ let cmd = commands[mgr][cmdType]
37
+ if (cmd === undefined) return undefined
38
+
39
+ if (prefix) cmd = `${prefix} ${cmd}`
40
+ if (comment) cmd = `# ${comment.replaceAll("{PKG}", mgr)}\n${cmd}`
41
+ if (dev && cmdType === "add") cmd += ` ${commands[mgr].dev}`
42
+
43
+ if (pkg) {
44
+ // Logic to strip version tags for yarn create
45
+ const processedPkg = (cmdType === "create" && mgr === "yarn")
46
+ ? pkg.replace(/@(?![^@]*\/)[^\s]*$/, "")
47
+ : pkg
48
+ cmd += ` ${processedPkg}`
49
+ }
50
+
51
+ if (args) {
52
+ const needsDoubleDash = mgr === "npm" && !["dlx", "exec", "run"].includes(cmdType)
53
+ cmd += `${needsDoubleDash ? " --" : ""} ${args}`
54
+ }
55
+
56
+ return cmd
57
+ }
58
+
59
+ const tabs = managers
60
+ .map((mgr) => ({
61
+ mgr,
62
+ cmd: getCommand(mgr, type),
63
+ }))
64
+ .filter((tab) => tab.cmd !== undefined)
65
+ ---
66
+
67
+ <Tabs syncKey="package-managers">
68
+ {tabs.map((tab) => (
69
+ <TabItem label={tab.mgr}>
70
+ <Prism lang="sh" code={tab.cmd!} />
71
+ </TabItem>
72
+ ))}
73
+ </Tabs>
@@ -26,7 +26,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
26
26
  export interface StarlightAddonsConfig {
27
27
  copy?: boolean
28
28
  share?: boolean
29
- packageManagers?: string[]
30
29
  // Merged config for Topics
31
30
  topics?: StarlightSidebarTopicsUserConfig
32
31
  topicOptions?: StarlightSidebarTopicsUserOptions
@@ -36,8 +35,7 @@ export default function starlightAddons(userConfig?: StarlightAddonsConfig): Sta
36
35
  // 1. Setup default and merged config for Addons
37
36
  const defaultAddonConfig: StarlightAddonsConfig = {
38
37
  copy: true,
39
- share: true,
40
- packageManagers: ["npm"]
38
+ share: true
41
39
  }
42
40
 
43
41
  const addonConfig = { ...defaultAddonConfig, ...userConfig }
@@ -65,7 +63,6 @@ export default function starlightAddons(userConfig?: StarlightAddonsConfig): Sta
65
63
  addIntegration,
66
64
  updateConfig,
67
65
  logger,
68
- addRouteMiddleware,
69
66
  command,
70
67
  config: starlightConfig
71
68
  }) {
@@ -92,11 +89,7 @@ export default function starlightAddons(userConfig?: StarlightAddonsConfig): Sta
92
89
  }
93
90
 
94
91
  // --- Addons Logic ---
95
- if (
96
- !addonConfig.copy &&
97
- !addonConfig.share &&
98
- (!addonConfig.packageManagers || addonConfig.packageManagers.length === 0)
99
- ) {
92
+ if (!addonConfig.copy && !addonConfig.share) {
100
93
  logger.warn("StarlightAddons: No features enabled.")
101
94
  }
102
95
 
@@ -1,2 +1,3 @@
1
1
  @import "tailwindcss";
2
2
  @import "@nuxt/ui";
3
+ @import "./prism.css";
@@ -0,0 +1,42 @@
1
+ /* Minimal Prism theme to be used with @astrojs/prism */
2
+ pre[class*="language-"],
3
+ code[class*="language-"] {
4
+ color: #d4e1f5;
5
+ background: #1e1e1e;
6
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
7
+ font-size: 0.95em;
8
+ line-height: 1.5;
9
+ padding: 1em;
10
+ border-radius: 6px;
11
+ overflow: auto;
12
+ }
13
+ .token.comment,
14
+ .token.prolog,
15
+ .token.doctype,
16
+ .token.cdata {
17
+ color: #6a9955; /* greenish */
18
+ font-style: italic;
19
+ }
20
+ .token.punctuation {
21
+ color: #d4e1f5;
22
+ }
23
+ .token.keyword {
24
+ color: #569cd6;
25
+ }
26
+ .token.boolean {
27
+ color: #d19a66;
28
+ }
29
+ .token.number {
30
+ color: #b5cea8;
31
+ }
32
+ .token.string {
33
+ color: #ce9178;
34
+ }
35
+ .token.function {
36
+ color: #dcdcaa;
37
+ }
38
+
39
+ /* Basic line highlighting compatibility helpers (optional) */
40
+ .code-line {
41
+ display: block;
42
+ }