@wireweave/language-data 1.6.0-beta.6 → 1.6.0-beta.7
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 +15 -80
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,94 +1,29 @@
|
|
|
1
1
|
# @wireweave/language-data
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Language catalogs and editor adapters for Wireweave.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The [public tool contract](../../docs/spec/TOOLING.md#editor-integrations) defines this package's APIs, behavior, configuration and compatibility. The [language contract](../../docs/spec/LANGUAGE.md) defines the DSL. [Package metadata](package.json) owns package versions, exports, dependencies and scripts.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Runtime output depends on the `./spec` subpath only, so no parser or renderer code reaches a bundle. The tests reach further, into core as a whole: `./spec` is a copy of what the grammar, AST types, and renderer actually do, and checking a copy against itself proves nothing. Runtime dependency and test oracle are separate axes, and the oracle is the wider of the two by design.
|
|
12
|
-
|
|
13
|
-
Optional subpath entries provide ready-made editor integrations:
|
|
14
|
-
|
|
15
|
-
- `@wireweave/language-data/monaco` — register the Wireweave language with Monaco Editor.
|
|
16
|
-
- `@wireweave/language-data/codemirror` — tokenizer, completion, hover, and linting sources for CodeMirror 6.
|
|
17
|
-
|
|
18
|
-
The editor adapters rely on optional peer dependencies (`monaco-editor`, `@codemirror/*`) — install only the ones for the integration you use.
|
|
19
|
-
|
|
20
|
-
## Install
|
|
9
|
+
Use Node.js >=22.13.0. Replace `<pinned-version>` with the release selected for your toolchain.
|
|
21
10
|
|
|
22
11
|
```bash
|
|
23
|
-
|
|
12
|
+
pnpm add --save-exact '@wireweave/language-data@<pinned-version>'
|
|
24
13
|
```
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
The optional Monaco and CodeMirror adapters use their declared peer dependencies; install the editor peers for the adapter you select.
|
|
27
16
|
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
ALL_COMPONENTS,
|
|
31
|
-
ATTRIBUTES,
|
|
32
|
-
getComponent,
|
|
33
|
-
getAttribute,
|
|
34
|
-
getValidChildren,
|
|
35
|
-
getComponentAttributes,
|
|
36
|
-
isValidChild,
|
|
37
|
-
} from '@wireweave/language-data'
|
|
38
|
-
|
|
39
|
-
// Component definition
|
|
40
|
-
const card = getComponent('card')
|
|
41
|
-
console.log(card?.description)
|
|
42
|
-
|
|
43
|
-
// Attributes allowed on a component
|
|
44
|
-
const cardAttrs = getComponentAttributes('card')
|
|
45
|
-
|
|
46
|
-
// Validity checks for the editor
|
|
47
|
-
isValidChild('page', 'card') // true / false
|
|
48
|
-
getValidChildren('grid') // valid child component names
|
|
49
|
-
|
|
50
|
-
// Full vocabulary
|
|
51
|
-
console.log(ALL_COMPONENTS.length, ATTRIBUTES.length)
|
|
52
|
-
```
|
|
17
|
+
## Development
|
|
53
18
|
|
|
54
|
-
|
|
19
|
+
Run from the monorepo root after the [workspace setup](../../README.md).
|
|
55
20
|
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
### CodeMirror 6 integration
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
import {
|
|
67
|
-
createTokenizer,
|
|
68
|
-
getLanguageConfig,
|
|
69
|
-
createCompletionSource,
|
|
70
|
-
createHoverTooltipSource,
|
|
71
|
-
createLinter,
|
|
72
|
-
} from '@wireweave/language-data/codemirror'
|
|
21
|
+
```bash
|
|
22
|
+
pnpm --filter @wireweave/language-data run build
|
|
23
|
+
pnpm --filter @wireweave/language-data run typecheck
|
|
24
|
+
pnpm --filter @wireweave/language-data run lint
|
|
25
|
+
pnpm --filter @wireweave/language-data run test
|
|
26
|
+
pnpm --filter @wireweave/language-data run format:check
|
|
73
27
|
```
|
|
74
28
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
| Export | Description |
|
|
78
|
-
| -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
79
|
-
| `ALL_COMPONENTS`, `COMPONENT_MAP`, `NODE_TYPE_MAP`, `VALID_COMPONENT_NAMES` | Component definitions and lookup maps. |
|
|
80
|
-
| `ATTRIBUTES`, `ATTRIBUTE_MAP`, `COMMON_ATTRIBUTES`, `VALID_ATTRIBUTE_NAMES` | Attribute definitions and lookup maps. |
|
|
81
|
-
| `CATEGORY_LABELS`, `VALUE_KEYWORDS`, `COMMON_NUMBERS`, `SPACING_SCALE` | Categories, value keywords, and numeric scales for completion. |
|
|
82
|
-
| `getComponent`, `getComponentByNodeType`, `getComponentAttributes`, `getComponentsByCategory` | Component lookups. |
|
|
83
|
-
| `getAttribute`, `getAttributeTypeLabel`, `formatAttributeValues` | Attribute lookups and formatting. |
|
|
84
|
-
| `getValidChildren`, `isValidChild` | Containment rules for validation. |
|
|
85
|
-
| `isComponent`, `isAttribute`, `getComponentNames`, `getAttributeNames`, `getCategories` | Membership checks and name listings. |
|
|
86
|
-
| `ComponentDef`, `AttributeDef`, `ComponentCategory`, `AttributeValueType` | Type definitions. |
|
|
87
|
-
| `registerWireframeLanguage` (`/monaco`) | Register the language with Monaco Editor. |
|
|
88
|
-
| `createTokenizer`, `getLanguageConfig`, `createCompletionSource`, `createHoverTooltipSource`, `createLinter`, `validateCode` (`/codemirror`) | CodeMirror 6 language sources. |
|
|
89
|
-
|
|
90
|
-
Part of the [Wireweave monorepo](https://github.com/wireweave/wireweave).
|
|
91
|
-
|
|
92
|
-
## License
|
|
93
|
-
|
|
94
|
-
MIT
|
|
29
|
+
License: MIT.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireweave/language-data",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.7",
|
|
4
4
|
"description": "Shared language definitions for Wireweave DSL editors",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"node": ">=22.13.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@wireweave/core": "
|
|
49
|
+
"@wireweave/core": "4.0.0-beta.12"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@codemirror/autocomplete": "^6.0.0",
|