@rimelight/cms 0.0.8 → 0.0.10

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.
@@ -0,0 +1,39 @@
1
+ ---
2
+ import type { BaseBlock } from "../../core/types/blocks"
3
+
4
+ interface Props {
5
+ block: BaseBlock
6
+ locale?: string
7
+ }
8
+
9
+ const { block } = Astro.props
10
+ const {
11
+ location = "LOCATION",
12
+ timeOfDay = "DAY",
13
+ setting = "INT.",
14
+ transition = "CUT TO:",
15
+ description = ""
16
+ } = block.props || {}
17
+ ---
18
+
19
+ <div class="cms-scene-block my-6 font-mono text-sm" data-block-id={block.id}>
20
+ {transition && (
21
+ <div class="text-right text-xs font-bold uppercase tracking-wider text-neutral-500 dark:text-neutral-400 mb-2">
22
+ {transition}
23
+ </div>
24
+ )}
25
+
26
+ <div class="bg-neutral-100 dark:bg-neutral-800/80 px-4 py-2.5 rounded-lg border-l-4 border-primary-500 font-bold uppercase tracking-wide text-neutral-900 dark:text-neutral-100 mb-3">
27
+ {setting} {location} - {timeOfDay}
28
+ </div>
29
+
30
+ {description && (
31
+ <p class="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-4 pl-4 border-l-2 border-transparent">
32
+ {description}
33
+ </p>
34
+ )}
35
+
36
+ <div class="scene-content pl-4 space-y-3">
37
+ <slot />
38
+ </div>
39
+ </div>
@@ -0,0 +1,77 @@
1
+ ---
2
+ import type { BaseBlock } from "../../core/types/blocks"
3
+
4
+ interface Props {
5
+ block: BaseBlock
6
+ locale?: string
7
+ }
8
+
9
+ const { block } = Astro.props
10
+ const {
11
+ title = "Untitled Script",
12
+ synopsis = "",
13
+ characters = [],
14
+ aPlot = "",
15
+ bPlot = "",
16
+ cPlot = "",
17
+ stinger = ""
18
+ } = block.props || {}
19
+ ---
20
+
21
+ <div
22
+ class="cms-script-block my-8 rounded-2xl border border-neutral-200 dark:border-neutral-800 bg-neutral-50/50 dark:bg-neutral-900/40 p-6 md:p-8 font-sans"
23
+ data-block-id={block.id}
24
+ >
25
+ <header class="border-b border-neutral-200 dark:border-neutral-800 pb-6 mb-6">
26
+ <div class="flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-primary-600 dark:text-primary-400 mb-1">
27
+ <span class="i-lucide-clapperboard size-4" aria-hidden="true" />
28
+ Screenplay / Narrative Script
29
+ </div>
30
+ <h3 class="text-2xl md:text-3xl font-bold text-neutral-900 dark:text-neutral-100">{title}</h3>
31
+ {synopsis && <p class="mt-2 text-sm text-neutral-600 dark:text-neutral-400 italic">{synopsis}</p>}
32
+
33
+ {characters && characters.length > 0 && (
34
+ <div class="mt-4 flex flex-wrap items-center gap-2">
35
+ <span class="text-xs font-medium text-neutral-500 dark:text-neutral-400">Characters:</span>
36
+ {characters.map((char: string) => (
37
+ <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-neutral-200/70 dark:bg-neutral-800 text-neutral-800 dark:text-neutral-200">
38
+ {char}
39
+ </span>
40
+ ))}
41
+ </div>
42
+ )}
43
+
44
+ {(aPlot || bPlot || cPlot || stinger) && (
45
+ <div class="mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 text-xs bg-white/60 dark:bg-neutral-800/40 p-3.5 rounded-xl border border-neutral-200/60 dark:border-neutral-700/40">
46
+ {aPlot && (
47
+ <div>
48
+ <span class="font-semibold text-neutral-700 dark:text-neutral-300">A Plot:</span>
49
+ <p class="text-neutral-600 dark:text-neutral-400 truncate">{aPlot}</p>
50
+ </div>
51
+ )}
52
+ {bPlot && (
53
+ <div>
54
+ <span class="font-semibold text-neutral-700 dark:text-neutral-300">B Plot:</span>
55
+ <p class="text-neutral-600 dark:text-neutral-400 truncate">{bPlot}</p>
56
+ </div>
57
+ )}
58
+ {cPlot && (
59
+ <div>
60
+ <span class="font-semibold text-neutral-700 dark:text-neutral-300">C Plot:</span>
61
+ <p class="text-neutral-600 dark:text-neutral-400 truncate">{cPlot}</p>
62
+ </div>
63
+ )}
64
+ {stinger && (
65
+ <div>
66
+ <span class="font-semibold text-neutral-700 dark:text-neutral-300">Stinger:</span>
67
+ <p class="text-neutral-600 dark:text-neutral-400 truncate">{stinger}</p>
68
+ </div>
69
+ )}
70
+ </div>
71
+ )}
72
+ </header>
73
+
74
+ <div class="script-body font-mono text-sm space-y-4">
75
+ <slot />
76
+ </div>
77
+ </div>
@@ -1,5 +1,7 @@
1
1
  ---
2
2
  import type { BaseBlock } from "../../core/types/blocks"
3
+ import RLATable from "@rimelight/ui/components/table/RLATable.astro"
4
+ import type { TableColumn } from "@rimelight/ui/components/table/table.ts"
3
5
 
4
6
  interface Props {
5
7
  block: BaseBlock
@@ -7,43 +9,34 @@ interface Props {
7
9
  }
8
10
 
9
11
  const { block } = Astro.props
10
- const { columns = [], rows = [], caption } = block.props || {}
12
+ const { columns = [], rows = [], caption, striped = true, bordered = false, hoverable = true } = block.props || {}
13
+
14
+ const resolvedColumns: TableColumn[] = columns.map((col: any) => {
15
+ const key = typeof col === "string" ? col : col.key || col.id
16
+ const header = typeof col === "string" ? col : col.header || key
17
+ const align = typeof col === "object" ? col.align : undefined
18
+ return {
19
+ accessorKey: key,
20
+ header,
21
+ meta: align
22
+ ? {
23
+ class: {
24
+ th: align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left",
25
+ td: align === "right" ? "text-right" : align === "center" ? "text-center" : "text-left"
26
+ }
27
+ }
28
+ : undefined
29
+ }
30
+ })
11
31
  ---
12
32
 
13
- <div class="cms-table my-6 overflow-x-auto rounded-lg border border-neutral-200" data-block-id={block.id}>
14
- <table class="w-full text-left text-sm border-collapse">
15
- {caption && (
16
- <caption class="p-2 text-xs text-neutral-500 italic text-left">
17
- {caption}
18
- </caption>
19
- )}
20
- {columns.length > 0 && (
21
- <thead class="bg-neutral-50 border-b border-neutral-200 font-medium text-neutral-700">
22
- <tr>
23
- {columns.map((col: any) => (
24
- <th
25
- class="px-4 py-3 text-xs font-semibold uppercase tracking-wider"
26
- style={col.align ? `text-align: ${col.align};` : undefined}
27
- >
28
- {col.header || col.key}
29
- </th>
30
- ))}
31
- </tr>
32
- </thead>
33
- )}
34
- <tbody class="divide-y divide-neutral-200 bg-default">
35
- {rows.map((row: any) => (
36
- <tr class="hover:bg-neutral-50/50 transition-colors">
37
- {columns.map((col: any) => (
38
- <td
39
- class="px-4 py-3 text-neutral-800"
40
- style={col.align ? `text-align: ${col.align};` : undefined}
41
- >
42
- {row[col.key] ?? ""}
43
- </td>
44
- ))}
45
- </tr>
46
- ))}
47
- </tbody>
48
- </table>
33
+ <div class="cms-table my-6" data-block-id={block.id}>
34
+ <RLATable
35
+ data={rows}
36
+ columns={resolvedColumns}
37
+ caption={caption}
38
+ striped={striped}
39
+ bordered={bordered}
40
+ hoverable={hoverable}
41
+ />
49
42
  </div>
@@ -13,6 +13,10 @@ import CardBlock from "./CardBlock.astro"
13
13
  import FileTreeBlock from "./FileTreeBlock.astro"
14
14
  import UnorderedListBlock from "./UnorderedListBlock.astro"
15
15
  import OrderedListBlock from "./OrderedListBlock.astro"
16
+ import ScriptBlock from "./ScriptBlock.astro"
17
+ import SceneBlock from "./SceneBlock.astro"
18
+ import DialogueBlock from "./DialogueBlock.astro"
19
+ import LivePreviewBlock from "./LivePreviewBlock.astro"
16
20
 
17
21
  export const defaultBlockComponents: Record<string, any> = {
18
22
  ParagraphBlock,
@@ -29,7 +33,11 @@ export const defaultBlockComponents: Record<string, any> = {
29
33
  CardBlock,
30
34
  FileTreeBlock,
31
35
  UnorderedListBlock,
32
- OrderedListBlock
36
+ OrderedListBlock,
37
+ ScriptBlock,
38
+ SceneBlock,
39
+ DialogueBlock,
40
+ LivePreviewBlock
33
41
  }
34
42
 
35
43
  export default defaultBlockComponents
package/src/env.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- declare module "*.astro" {
2
- const component: any
3
- export default component
4
- }
5
-
6
1
  declare module "virtual:rimelight-cms/parent-layout" {
7
2
  const layout: any
8
3
  export default layout
@@ -21,3 +16,10 @@ declare module "virtual:rimelight-cms/auth" {
21
16
  export const authAdapter: AuthAdapter
22
17
  export default authAdapter
23
18
  }
19
+
20
+ declare module "cloudflare:workers" {
21
+ /**
22
+ * Ambient Cloudflare Workers env — populated at runtime by the CF runtime.
23
+ */
24
+ export const env: Record<string, any>
25
+ }
@@ -131,8 +131,7 @@ export async function getCmsCollection(
131
131
  const conditions: SQL[] = [isNull(pages.deletedAt)]
132
132
 
133
133
  if (type) {
134
- // eslint-disable-next-line typescript/no-unsafe-type-assertion
135
- conditions.push(eq(pages.type, type as PageType))
134
+ conditions.push(eq(pages.type, type))
136
135
  }
137
136
 
138
137
  if (!includeDrafts) {