@airdraft/ui-core 0.1.3 → 0.1.6

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 (3) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +68 -0
  3. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.6](https://github.com/aevrHQ/airdraft/compare/ui-core@v0.1.5...ui-core@v0.1.6) (2026-05-23)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **build:** bump react-content peer dependencies ([9c33815](https://github.com/aevrHQ/airdraft/commit/9c338158eca40c418f5ad37e829b0a2f213a2e33))
11
+ * move @airdraft/core to peerDependencies in all consumer-facing packages ([f7653ff](https://github.com/aevrHQ/airdraft/commit/f7653ffd7109cbe76f09df8766a70de1b24afdba))
12
+ * **react-content:** entryCard children injection and sub-component auto-read ([a57cc48](https://github.com/aevrHQ/airdraft/commit/a57cc483b96986d5825e1c6d28a66c400bd57972))
13
+
14
+ ### [0.1.5](https://github.com/aevrHQ/airdraft/compare/ui-core@v0.1.3...ui-core@v0.1.5) (2026-05-23)
15
+
16
+
17
+ ### Documentation
18
+
19
+ * **ui-core:** add README.md for shared UI-layer constants and utilities ([91fb464](https://github.com/aevrHQ/airdraft/commit/91fb4643eb7340ea16b1db9fd06e33ce0866b4b3))
20
+
21
+ ### [0.1.4](https://github.com/aevrHQ/airdraft/compare/ui-core@v0.1.3...ui-core@v0.1.4) (2026-05-23)
22
+
5
23
  ### [0.1.3](https://github.com/aevrHQ/airdraft/compare/ui-core@v0.1.2...ui-core@v0.1.3) (2026-05-23)
6
24
 
7
25
 
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @airdraft/ui-core
2
+
3
+ Shared UI-layer constants and utilities for Airdraft. Provides field-type metadata (labels, icons, descriptions), the schema editor mutation helpers, and collection name validators consumed by `@airdraft/react-ui`.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @airdraft/ui-core
9
+ ```
10
+
11
+ This package is typically a transitive dependency — you don't need to install it directly unless you're building a custom schema editor or type picker.
12
+
13
+ ## Exports
14
+
15
+ ### Field type metadata
16
+
17
+ ```ts
18
+ import { FIELD_TYPE_META, VISIBLE_FIELD_TYPES } from '@airdraft/ui-core'
19
+ import type { FieldTypeMeta } from '@airdraft/ui-core'
20
+ ```
21
+
22
+ | Export | Description |
23
+ |---|---|
24
+ | `FIELD_TYPE_META` | `Record<FieldType, FieldTypeMeta>` — label, description, and Lucide icon name for every field type |
25
+ | `VISIBLE_FIELD_TYPES` | `FieldType[]` — all field types with `hidden !== true`; use this to populate a type picker (excludes the deprecated `image` type) |
26
+ | `FieldTypeMeta` | `{ type, label, description, icon, hidden? }` |
27
+
28
+ **Supported field types** (all included in `FIELD_TYPE_META`):
29
+
30
+ `string` · `text` · `number` · `boolean` · `date` · `datetime` · `list` · `select` · `multiselect` · `rich-text` · `relation` · `relations` · `object` · `url` · `media` · `blocks`
31
+
32
+ `image` is present but marked `hidden: true` — it is excluded from `VISIBLE_FIELD_TYPES` and the schema editor type picker. Use `media` for new fields.
33
+
34
+ ### Schema editor mutations
35
+
36
+ ```ts
37
+ import { applyFieldUpdate, applyFieldDelete, buildDefaultPath } from '@airdraft/ui-core'
38
+ ```
39
+
40
+ | Export | Description |
41
+ |---|---|
42
+ | `applyFieldUpdate(schema, collection, key, config)` | Returns a new `CmsSchema` with the field upserted |
43
+ | `applyFieldDelete(schema, collection, key)` | Returns a new `CmsSchema` with the field removed |
44
+ | `buildDefaultPath(collection, format, slugSource?)` | Generates a default `path` pattern for a new collection |
45
+
46
+ ### Validators
47
+
48
+ ```ts
49
+ import { validateFieldKey, generateFieldKey, validateCollectionName } from '@airdraft/ui-core'
50
+ ```
51
+
52
+ | Export | Description |
53
+ |---|---|
54
+ | `validateFieldKey(key)` | Returns an error string if the key is invalid (empty, reserved, non-slug), or `null` if valid |
55
+ | `generateFieldKey(label)` | Converts a human label to a valid snake_case field key |
56
+ | `validateCollectionName(name)` | Returns an error string if the name collides with a reserved route, or `null` if valid |
57
+
58
+ ### Constants
59
+
60
+ ```ts
61
+ import { RESERVED_COLLECTION_NAMES } from '@airdraft/ui-core'
62
+ ```
63
+
64
+ `RESERVED_COLLECTION_NAMES` — `Set<string>` of names that cannot be used as collection names (`schema`, `media`, `openapi`, `health`, etc.).
65
+
66
+ ## Changelog
67
+
68
+ See [CHANGELOG.md](./CHANGELOG.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airdraft/ui-core",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "description": "Airdraft UI core — field type metadata, validators, and schema mutation helpers (zero framework deps)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,15 +31,16 @@
31
31
  "access": "public"
32
32
  },
33
33
  "license": "MIT",
34
- "dependencies": {
35
- "@airdraft/core": "*"
36
- },
37
34
  "devDependencies": {
38
35
  "@types/node": "^20.0.0",
39
36
  "standard-version": "^9.5.0",
40
- "typescript": "^5.4.0"
37
+ "typescript": "^5.4.0",
38
+ "@airdraft/core": "*"
41
39
  },
42
40
  "engines": {
43
41
  "node": ">=18.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "@airdraft/core": ">=0.1.8"
44
45
  }
45
46
  }