@interlacejs/editor 1.1.0 → 1.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.
package/README.md CHANGED
@@ -28,24 +28,51 @@ registry.register(QuizContentType);
28
28
  <div style={{ width: 960, height: 640 }}>
29
29
  <InterlaceEditor
30
30
  contentTypeRegistry={registry}
31
- document={existingDoc} // optional: omit for a fresh document
32
- onUpload={async (file) => URL.createObjectURL(file)} // your upload story
33
- onSave={(doc) => save(doc)} // the host owns persistence
31
+ document={existingDoc} // optional: omit for a fresh document
32
+ onUpload={async (file) => URL.createObjectURL(file)} // your upload story
33
+ onSave={(doc) => save(doc)} // the host owns persistence
34
34
  onError={(e) => showError(e.message)}
35
- onDirtyChange={(dirty) => setHasUnsavedChanges(dirty)} // optional
35
+ onDirtyChange={(dirty) => setHasUnsavedChanges(dirty)} // optional
36
36
  />
37
- </div>
37
+ </div>;
38
38
  ```
39
39
 
40
40
  `onSave` receives the serialized document (JSON) ready for the player (`@interlacejs/player`). The editor never persists on its own — bring your own storage.
41
41
 
42
42
  `onDirtyChange` fires when the editor gains or loses unsaved changes, relative to the loaded `document` (or an empty one) and the last `onSave`. Use it to warn before navigating away. Duration corrections the editor makes from the video's metadata do not count as changes.
43
43
 
44
- ## Strings and theming
44
+ ## Strings
45
45
 
46
- Both `InterlaceEditor` and sub-components accept `strings`/`theme` overrides; the built-in default strings derive from `@interlacejs/core`'s `DEFAULT_STRINGS` so hosts can localize once.
46
+ `InterlaceEditor` and its sub-components accept `strings` overrides; the defaults derive from `@interlacejs/core`'s `DEFAULT_STRINGS`, so hosts can localize once.
47
47
 
48
- See the [root README](https://github.com/farayolaj/interlace) for the document format and the `apps/demo` for a working wiring.
48
+ ## Styling and theming
49
+
50
+ All Interlace UI (editor, player and quiz) draws its colours, fonts and corner radius from `--interlace-*` CSS custom properties, with the default look as the fallback. There are three ways to restyle it, from broadest to most specific:
51
+
52
+ 1. **CSS variables.** Set them anywhere above the component; no JavaScript needed, and one rule covers the editor, player and quiz together.
53
+
54
+ ```css
55
+ :root {
56
+ --interlace-accent: #6f42c1;
57
+ --interlace-radius: 4px;
58
+ --interlace-font-body: "Inter", system-ui, sans-serif;
59
+ --interlace-font-display: "Inter", system-ui, sans-serif;
60
+ }
61
+ ```
62
+
63
+ Variables: `accent`, `accent-hover`, `accent-contrast`, `accent-soft`, `text`, `text-muted`, `surface`, `surface-raised`, `border`, `border-strong`, `danger`, `danger-soft`, `warning`, `warning-soft`, `font-body`, `font-display`, `radius` (each prefixed `--interlace-`). Hover and soft tints are derived from the accent when you don't set them.
64
+
65
+ 2. **The `theme` prop.** `InterlaceEditor` and `InteractiveVideoPlayer` accept a typed `theme` (`InterlaceTheme` from `@interlacejs/core`). It is applied as the same variables on the component's root, so it reaches everything inside, including the preview and content editors.
66
+
67
+ ```tsx
68
+ <InterlaceEditor theme={{ accentColor: "#6f42c1", radius: 4 }} /* … */ />
69
+ ```
70
+
71
+ 3. **Class names.** Controls carry stable classes (`interlace-btn`, `interlace-btn--primary|secondary|ghost|danger`, `interlace-input`, `interlace-field`, `interlace-label`, `interlace-choice`, `interlace-badge`), and the root takes a `className`. The built-in rules use zero-specificity `:where()` selectors, so your own rules for these classes win without `!important`.
72
+
73
+ ## Saving
74
+
75
+ Save is blocked while any hook needs attention: no title, no content type yet, or problems reported by the content type's `validate()`. The editor lists them with links to each hook. Hooks without a content type are kept as drafts on the timeline until you finish or delete them.
49
76
 
50
77
  ## License
51
78