@fcomurs/theme 0.1.0 → 0.2.0

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 (2) hide show
  1. package/index.d.ts +8 -2
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -101,6 +101,12 @@ export function block<const F extends Fields>(settings: F, options?: { label?: s
101
101
 
102
102
  type BlocksOf<B extends Record<string, BlockKind>> = { [K in keyof B]: { id: string; type: K; settings: SettingsOf<B[K]['settings']> } }[keyof B][];
103
103
 
104
+ /**
105
+ * The theme's own settings (config/settings.json → the editor's "Theme settings"), by key.
106
+ * In CSS they're also var(--theme-<key in kebab-case>) — colours, numbers, choices.
107
+ */
108
+ export type ThemeSettings = Record<string, string | number | boolean | null>;
109
+
104
110
  // ---- sections
105
111
 
106
112
  export interface SectionDefinition<F extends Fields, B extends Record<string, BlockKind>, D> {
@@ -112,9 +118,9 @@ export interface SectionDefinition<F extends Fields, B extends Record<string, Bl
112
118
  /** At most this many blocks (default 50). */
113
119
  maxBlocks?: number;
114
120
  /** Server only: the store data this section needs. Its result goes to `render` as `data`. */
115
- data?(input: { settings: SettingsOf<F>; store: Store }): Promise<D> | D;
121
+ data?(input: { settings: SettingsOf<F>; theme: ThemeSettings; store: Store }): Promise<D> | D;
116
122
  /** Server only, once per page view. Components from 'use client' files become islands. */
117
- render(props: { settings: SettingsOf<F>; blocks: BlocksOf<B>; data: D; section: { id: string }; store: StoreInfo }): ReactNode;
123
+ render(props: { settings: SettingsOf<F>; blocks: BlocksOf<B>; data: D; section: { id: string }; store: StoreInfo; theme: ThemeSettings }): ReactNode;
118
124
  }
119
125
 
120
126
  export function defineSection<const F extends Fields = {}, const B extends Record<string, BlockKind> = {}, D = undefined>(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fcomurs/theme",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Write fcomurs theme sections as React components: defineSection, typed settings, store data, Image and Link.",
5
5
  "keywords": ["fcomurs", "theme", "react", "nextjs", "ecommerce"],
6
6
  "homepage": "https://doc.fcomurs.com/en/first-theme",