@templatical/core 0.0.6 → 0.1.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/LICENSE +56 -0
- package/README.md +64 -0
- package/dist/cloud/index.js +1 -0
- package/dist/cloud/index.js.map +1 -1
- package/package.json +24 -12
- package/dist/cloud/index.cjs +0 -2774
- package/dist/cloud/index.cjs.map +0 -1
- package/dist/cloud/index.d.cts +0 -480
- package/dist/editor-K644r-hl.d.cts +0 -39
- package/dist/index.cjs +0 -548
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -85
package/LICENSE
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Templatical
|
|
4
|
+
|
|
5
|
+
## Terms and Conditions
|
|
6
|
+
|
|
7
|
+
### Licensor ("We")
|
|
8
|
+
|
|
9
|
+
Templatical
|
|
10
|
+
|
|
11
|
+
### The Software
|
|
12
|
+
|
|
13
|
+
Templatical Email Editor — the visual drag-and-drop email template editor
|
|
14
|
+
(@templatical/core, @templatical/editor, and @templatical/media-library
|
|
15
|
+
packages).
|
|
16
|
+
|
|
17
|
+
### Grant of Rights
|
|
18
|
+
|
|
19
|
+
Subject to the terms and conditions of this License, We hereby grant You a
|
|
20
|
+
non-exclusive, worldwide, non-transferable license to use, copy, modify,
|
|
21
|
+
create derivative works, and redistribute the Software, subject to the
|
|
22
|
+
following conditions:
|
|
23
|
+
|
|
24
|
+
### Permitted Uses
|
|
25
|
+
|
|
26
|
+
You may use the Software for any purpose, including commercial purposes,
|
|
27
|
+
**provided that** you do not offer the Software, or a substantially similar
|
|
28
|
+
product built using the Software, as a hosted or managed service that
|
|
29
|
+
competes with Templatical's commercial offerings.
|
|
30
|
+
|
|
31
|
+
### Change Date
|
|
32
|
+
|
|
33
|
+
Two (2) years from the date of each release of the Software.
|
|
34
|
+
|
|
35
|
+
### Change License
|
|
36
|
+
|
|
37
|
+
MIT License
|
|
38
|
+
|
|
39
|
+
On the Change Date, the above copyright notice and this permission notice
|
|
40
|
+
shall be replaced with the MIT License, and the Software will be available
|
|
41
|
+
under the MIT License for all purposes without restriction.
|
|
42
|
+
|
|
43
|
+
### Notices
|
|
44
|
+
|
|
45
|
+
You must retain this license notice in all copies or substantial portions
|
|
46
|
+
of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
Note: The @templatical/types, @templatical/renderer, and
|
|
55
|
+
@templatical/import-beefree packages are licensed separately under the MIT
|
|
56
|
+
License. See LICENSE-MIT for those packages' terms.
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @templatical/core
|
|
2
|
+
|
|
3
|
+
> Framework-agnostic editor logic — state, history, auto-save. The reactive engine behind `@templatical/editor`.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@templatical/core)
|
|
6
|
+
[](https://github.com/templatical/sdk/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Powers [`@templatical/editor`](https://www.npmjs.com/package/@templatical/editor). Use this package directly if you want to build a custom UI on top of the Templatical state model — for example, a CLI tool, automation pipeline, or your own visual editor.
|
|
9
|
+
|
|
10
|
+
Built on `@vue/reactivity` (no full Vue runtime), so it works anywhere reactive primitives do.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @templatical/core @templatical/types
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { useEditor } from '@templatical/core';
|
|
22
|
+
import { createDefaultTemplateContent, createTitleBlock } from '@templatical/types';
|
|
23
|
+
import { watch } from '@vue/reactivity';
|
|
24
|
+
|
|
25
|
+
const editor = useEditor({
|
|
26
|
+
content: createDefaultTemplateContent(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Mutate state — these methods live on the editor return value
|
|
30
|
+
editor.addBlock(createTitleBlock({ text: 'Welcome!' }));
|
|
31
|
+
editor.selectBlock(editor.content.value.blocks[0].id);
|
|
32
|
+
|
|
33
|
+
// Read reactive state
|
|
34
|
+
console.log(editor.content.value); // current TemplateContent
|
|
35
|
+
console.log(editor.selectedBlock.value); // currently selected Block | null
|
|
36
|
+
console.log(editor.state.isDirty); // dirty flag
|
|
37
|
+
|
|
38
|
+
// React to changes
|
|
39
|
+
watch(editor.content, (next) => {
|
|
40
|
+
console.log('Template updated', next);
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Exports
|
|
45
|
+
|
|
46
|
+
- `useEditor` — reactive state (content, selection, viewport, darkMode, isDirty) + mutation methods (`addBlock`, `removeBlock`, `moveBlock`, `updateBlock`, `updateSettings`, `selectBlock`, …)
|
|
47
|
+
- `useHistory` — undo/redo stack
|
|
48
|
+
- `useHistoryInterceptor` — wraps mutation methods so they push onto the history stack automatically
|
|
49
|
+
- `useBlockActions` — higher-level helpers built on top of `useEditor` (`createAndAddBlock(type)`, `duplicateBlock`, `deleteBlock`, `updateBlockProperty`)
|
|
50
|
+
- `useAutoSave` — debounced save with onSave callback
|
|
51
|
+
- `useConditionPreview` — display condition preview state
|
|
52
|
+
- `useDataSourceFetch` — fetch helper for custom block data sources
|
|
53
|
+
|
|
54
|
+
## Cloud subpath
|
|
55
|
+
|
|
56
|
+
The `@templatical/core/cloud` subpath provides Templatical Cloud integrations (Auth, API client, WebSocket, AI chat/rewrite, collaboration, comments, scoring). Used by `@templatical/editor`'s `initCloud()`. See [Cloud docs](https://docs.templatical.com/cloud/).
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
Full reference at **[docs.templatical.com](https://docs.templatical.com)**.
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[FSL-1.1-MIT](https://github.com/templatical/sdk/blob/main/LICENSE) — free for any non-competing commercial use, automatically converts to MIT after 2 years per release.
|