Skip to content

Commit 9222a61

Browse files
authored
Merge pull request #13 from customerio/html-mso-properties
2 parents 5ade02f + db01b5d commit 9222a61

9 files changed

Lines changed: 7098 additions & 5 deletions

File tree

.changeset/tasty-snakes-bet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ciolabs/html-mso-properties': patch
3+
---
4+
5+
initial release

packages/html-mod/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"magic-string": "^0.30.0"
4141
},
4242
"devDependencies": {
43-
"@types/escape-html": "^1.0.0",
44-
"@types/node": "^20.0.0"
43+
"@types/escape-html": "^1.0.0"
4544
}
4645
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# @ciolabs/html-mso-properties
2+
3+
> Microsoft Office CSS properties
4+
5+
A comprehensive TypeScript package containing all Microsoft Office (MSO) CSS properties, their valid values, defaults, and inheritance behavior.
6+
7+
## Install
8+
9+
```bash
10+
npm install @ciolabs/html-mso-properties
11+
```
12+
13+
## Usage
14+
15+
### Import the data
16+
17+
```typescript
18+
import msoProperties from '@ciolabs/html-mso-properties';
19+
20+
// Get all MSO properties
21+
console.log(msoProperties.length); // 1000+ properties
22+
23+
// Find a specific property
24+
const borderAlt = msoProperties.find(prop => prop.property === 'mso-border-alt');
25+
console.log(borderAlt);
26+
// {
27+
// property: 'mso-border-alt',
28+
// values: ['apples', 'arched-scallops', 'auto', ...],
29+
// default: null,
30+
// inherits: false
31+
// }
32+
```
33+
34+
### Import the types
35+
36+
```typescript
37+
import { MsoProperty } from '@ciolabs/html-mso-properties';
38+
39+
function processProperty(prop: MsoProperty) {
40+
console.log(`Property: ${prop.property}`);
41+
console.log(`Valid values: ${prop.values.join(', ')}`);
42+
console.log(`Default: ${prop.default}`);
43+
console.log(`Inherits: ${prop.inherits}`);
44+
}
45+
```
46+
47+
## Data Structure
48+
49+
The package exports an array of `MsoProperty` objects. Each object contains:
50+
51+
- **`property`** (`string`) - Name of the CSS property (e.g., `'mso-border-alt'`)
52+
- **`values`** (`string[]`) - Array of valid values for the property
53+
- **`default`** (`string | number | null`) - The default value, or `null` if no default
54+
- **`inherits`** (`boolean`) - Whether the property value is inherited from parent elements
55+
56+
## TypeScript Support
57+
58+
This package includes full TypeScript support with exported interfaces:
59+
60+
```typescript
61+
export interface MsoProperty {
62+
property: string;
63+
values: string[];
64+
default: string | number | null;
65+
inherits: boolean;
66+
}
67+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@ciolabs/html-mso-properties",
3+
"version": "0.0.0",
4+
"description": "Microsoft Office CSS properties",
5+
"main": "./dist/index.js",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.mjs",
12+
"require": "./dist/index.js"
13+
}
14+
},
15+
"files": [
16+
"dist"
17+
],
18+
"author": "Customer.io <win@customer.io>",
19+
"license": "Apache-2.0 WITH Commons-Clause",
20+
"repository": {
21+
"type": "git",
22+
"url": "https://github.com/customerio/ciolabs.git",
23+
"directory": "packages/html-mso-properties"
24+
},
25+
"homepage": "https://github.com/customerio/ciolabs/tree/main/packages/html-mso-properties#readme",
26+
"publishConfig": {
27+
"access": "public"
28+
},
29+
"scripts": {
30+
"build": "tsup",
31+
"dev": "tsup --watch",
32+
"clean": "rm -rf dist",
33+
"test": "vitest run"
34+
}
35+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, expect, test } from 'vitest';
2+
3+
import msoProperties from './index';
4+
5+
describe('@ciolabs/html-mso-properties', () => {
6+
test('should export an array of MSO properties', () => {
7+
expect(Array.isArray(msoProperties)).toBe(true);
8+
});
9+
10+
test('should have more than 400 properties', () => {
11+
expect(msoProperties.length).toBeGreaterThan(400);
12+
});
13+
14+
test('should have font-color as the first property', () => {
15+
expect(msoProperties[0].property).toBe('font-color');
16+
});
17+
});

0 commit comments

Comments
 (0)