@master/css-schema 2.0.0-rc.72 → 2.0.0-rc.74

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.
@@ -0,0 +1,20 @@
1
+ //#region src/utility-type.ts
2
+ const UtilityType = {
3
+ /**
4
+ * semantic utility classes
5
+ * @example block, inline
6
+ */
7
+ Semantic: -2,
8
+ /**
9
+ * shorthand
10
+ * @example border, padding, margin
11
+ */
12
+ Shorthand: -1,
13
+ /**
14
+ * normal
15
+ * @example grid-cols
16
+ */
17
+ Normal: 0
18
+ };
19
+ //#endregion
20
+ export { UtilityType, UtilityType as default };
package/package.json CHANGED
@@ -1 +1,99 @@
1
- {"name":"@master/css-schema","type":"module","scripts":{"build":"techor build \"src/**/*.ts\" --formats esm","dev":"pnpm build --watch","lint":"eslint","type-check":"tsc --noEmit","test":"vitest"},"license":"MIT","description":"Public Master CSS schema and wire-format contracts.","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/schema"},"keywords":["schema","manifest","css","mastercss"],"sideEffects":false,"main":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs"},"./manifest":{"types":"./dist/manifest.d.ts","import":"./dist/manifest.mjs","default":"./dist/manifest.mjs"},"./manifest-json":{"types":"./dist/manifest-json.d.ts","import":"./dist/manifest-json.mjs","default":"./dist/manifest-json.mjs"},"./hydration-manifest":{"types":"./dist/hydration-manifest.d.ts","import":"./dist/hydration-manifest.mjs","default":"./dist/hydration-manifest.mjs"},"./css-directives":{"types":"./dist/css-directives.d.ts","import":"./dist/css-directives.mjs","default":"./dist/css-directives.mjs"},"./css-syntax":{"types":"./dist/css-syntax.d.ts","import":"./dist/css-syntax.mjs","default":"./dist/css-syntax.mjs"},"./utility-type":{"types":"./dist/utility-type.d.ts","import":"./dist/utility-type.mjs","default":"./dist/utility-type.mjs"},"./runtime-style":{"types":"./dist/runtime-style.d.ts","import":"./dist/runtime-style.mjs","default":"./dist/runtime-style.mjs"},"./native-css-shorthand":{"types":"./dist/native-css-shorthand.d.ts","import":"./dist/native-css-shorthand.mjs","default":"./dist/native-css-shorthand.mjs"},"./css-common":{"types":"./dist/css-common.d.ts","import":"./dist/css-common.mjs","default":"./dist/css-common.mjs"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"csstype":"^3.2.3"},"version":"2.0.0-rc.72"}
1
+ {
2
+ "name": "@master/css-schema",
3
+ "type": "module",
4
+ "license": "MIT",
5
+ "description": "Public Master CSS schema and wire-format contracts.",
6
+ "author": "Aoyue Design LLC.",
7
+ "funding": "https://rc.css.master.co/sponsor",
8
+ "homepage": "https://css.master.co",
9
+ "bugs": {
10
+ "url": "https://github.com/master-co/css/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/master-co/css.git",
15
+ "directory": "packages/schema"
16
+ },
17
+ "keywords": [
18
+ "schema",
19
+ "manifest",
20
+ "css",
21
+ "mastercss"
22
+ ],
23
+ "sideEffects": false,
24
+ "main": "./dist/index.js",
25
+ "jsnext:main": "./dist/index.js",
26
+ "esnext": "./dist/index.js",
27
+ "module": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./manifest": {
36
+ "types": "./dist/manifest.d.ts",
37
+ "import": "./dist/manifest.js",
38
+ "default": "./dist/manifest.js"
39
+ },
40
+ "./manifest-json": {
41
+ "types": "./dist/manifest-json.d.ts",
42
+ "import": "./dist/manifest-json.js",
43
+ "default": "./dist/manifest-json.js"
44
+ },
45
+ "./hydration-manifest": {
46
+ "types": "./dist/hydration-manifest.d.ts",
47
+ "import": "./dist/hydration-manifest.js",
48
+ "default": "./dist/hydration-manifest.js"
49
+ },
50
+ "./css-directives": {
51
+ "types": "./dist/css-directives.d.ts",
52
+ "import": "./dist/css-directives.js",
53
+ "default": "./dist/css-directives.js"
54
+ },
55
+ "./css-syntax": {
56
+ "types": "./dist/css-syntax.d.ts",
57
+ "import": "./dist/css-syntax.js",
58
+ "default": "./dist/css-syntax.js"
59
+ },
60
+ "./utility-type": {
61
+ "types": "./dist/utility-type.d.ts",
62
+ "import": "./dist/utility-type.js",
63
+ "default": "./dist/utility-type.js"
64
+ },
65
+ "./runtime-style": {
66
+ "types": "./dist/runtime-style.d.ts",
67
+ "import": "./dist/runtime-style.js",
68
+ "default": "./dist/runtime-style.js"
69
+ },
70
+ "./native-css-shorthand": {
71
+ "types": "./dist/native-css-shorthand.d.ts",
72
+ "import": "./dist/native-css-shorthand.js",
73
+ "default": "./dist/native-css-shorthand.js"
74
+ },
75
+ "./css-common": {
76
+ "types": "./dist/css-common.d.ts",
77
+ "import": "./dist/css-common.js",
78
+ "default": "./dist/css-common.js"
79
+ }
80
+ },
81
+ "files": [
82
+ "dist"
83
+ ],
84
+ "publishConfig": {
85
+ "access": "public",
86
+ "provenance": true
87
+ },
88
+ "dependencies": {
89
+ "csstype": "^3.2.3"
90
+ },
91
+ "version": "2.0.0-rc.74",
92
+ "scripts": {
93
+ "build": "tsdown --config ../../shared/tsdown-package.config.ts",
94
+ "dev": "tsdown --config ../../shared/tsdown-package.config.ts --watch",
95
+ "lint": "eslint",
96
+ "type-check": "tsc -b tsconfig.typecheck.json",
97
+ "test": "vitest"
98
+ }
99
+ }
@@ -1 +0,0 @@
1
-
@@ -1,51 +0,0 @@
1
- class CSSDirectiveError extends Error {
2
- code;
3
- source;
4
- related;
5
- constructor(code, message, source, related){
6
- super(message);
7
- this.name = 'CSSDirectiveError';
8
- this.code = code;
9
- this.source = source;
10
- this.related = related;
11
- }
12
- }
13
- function offsetToLocation(source, offset) {
14
- let line = 1;
15
- let column = 1;
16
- for(let index = 0; index < offset && index < source.length; index++){
17
- if (source[index] === '\n') {
18
- line++;
19
- column = 1;
20
- } else {
21
- column++;
22
- }
23
- }
24
- return {
25
- line,
26
- column
27
- };
28
- }
29
- function createCSSDirectiveSourceReference(file, range, source) {
30
- return {
31
- ...file ? {
32
- file
33
- } : {},
34
- range,
35
- ...source ? {
36
- loc: {
37
- start: offsetToLocation(source, range.start),
38
- end: offsetToLocation(source, range.end)
39
- }
40
- } : {}
41
- };
42
- }
43
- const CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX = '__master_variant__:';
44
- function createCSSDirectiveVariantReference(token) {
45
- return CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX + token;
46
- }
47
- function readCSSDirectiveVariantReference(atRule) {
48
- return atRule.startsWith(CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX) ? atRule.slice(CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX.length) : undefined;
49
- }
50
-
51
- export { CSSDirectiveError, CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX, createCSSDirectiveSourceReference, createCSSDirectiveVariantReference, readCSSDirectiveVariantReference };
@@ -1 +0,0 @@
1
-
@@ -1,12 +0,0 @@
1
- const MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID = 'master-css-hydration-manifest';
2
- const MASTER_CSS_HYDRATION_MANIFEST_ATTR = 'data-master-css-hydration-manifest';
3
- const MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE = '/_master-css/hydration/';
4
- const MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME = 'master-css-hydration';
5
- function serializeMasterCSSHydrationManifest(hydrationManifest) {
6
- return JSON.stringify(hydrationManifest).replace(/</g, '\\u003c');
7
- }
8
- function createMasterCSSHydrationManifestScript(hydrationManifest) {
9
- return `<script type="application/json" id="${MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID}">${serializeMasterCSSHydrationManifest(hydrationManifest)}</script>`;
10
- }
11
-
12
- export { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest };
package/dist/index.mjs DELETED
@@ -1,7 +0,0 @@
1
- export { flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables } from './manifest.mjs';
2
- export { normalizeMasterCSSManifestForJSON, stringifyMasterCSSManifestJSON } from './manifest-json.mjs';
3
- export { MASTER_CSS_HYDRATION_MANIFEST_ASSET_BASE, MASTER_CSS_HYDRATION_MANIFEST_ATTR, MASTER_CSS_HYDRATION_MANIFEST_FILE_BASENAME, MASTER_CSS_HYDRATION_MANIFEST_SCRIPT_ID, createMasterCSSHydrationManifestScript, serializeMasterCSSHydrationManifest } from './hydration-manifest.mjs';
4
- export { CSSDirectiveError, CSS_DIRECTIVE_VARIANT_REFERENCE_PREFIX, createCSSDirectiveSourceReference, createCSSDirectiveVariantReference, readCSSDirectiveVariantReference } from './css-directives.mjs';
5
- export { UtilityType } from './utility-type.mjs';
6
- export { MASTER_CSS_RUNTIME_STYLE_ID } from './runtime-style.mjs';
7
- export { isNativeCSSShorthandProperty } from './native-css-shorthand.mjs';
@@ -1,62 +0,0 @@
1
- function getVariableName(namespace, variable) {
2
- return variable.name || (namespace ? `${namespace}${variable.key ? '-' + variable.key : ''}` : variable.key);
3
- }
4
- function normalizeTemplateDeclarations(declarations) {
5
- const normalized = {};
6
- for(const propertyName in declarations){
7
- const value = declarations[propertyName];
8
- normalized[propertyName] = Array.isArray(value) ? value.map((part)=>part === undefined ? null : part) : value === undefined ? null : value;
9
- }
10
- return normalized;
11
- }
12
- function normalizeVariablesForJSON(variables) {
13
- if (!variables) return;
14
- const normalized = {};
15
- for (const [namespace, definitions] of Object.entries(variables)){
16
- const nextDefinitions = definitions.map((definition)=>{
17
- const normalizedDefinition = {
18
- ...definition
19
- };
20
- if (normalizedDefinition.namespace === namespace || !namespace) delete normalizedDefinition.namespace;
21
- if (normalizedDefinition.name === getVariableName(namespace, normalizedDefinition)) {
22
- delete normalizedDefinition.name;
23
- }
24
- if (normalizedDefinition.type === 'string') delete normalizedDefinition.type;
25
- return normalizedDefinition;
26
- });
27
- if (nextDefinitions.length) normalized[namespace] = nextDefinitions;
28
- }
29
- return Object.keys(normalized).length ? normalized : undefined;
30
- }
31
- function normalizeUtilityForJSON(utility) {
32
- const normalized = {
33
- ...utility
34
- };
35
- if (normalized.name === normalized.id) delete normalized.name;
36
- if (normalized.layer === 'utilities') delete normalized.layer;
37
- delete normalized.order;
38
- if (normalized.emit.type !== 'template') return normalized;
39
- return {
40
- ...normalized,
41
- emit: {
42
- ...normalized.emit,
43
- declarations: normalizeTemplateDeclarations(normalized.emit.declarations)
44
- }
45
- };
46
- }
47
- function normalizeMasterCSSManifestForJSON(manifest) {
48
- return {
49
- ...manifest,
50
- ...manifest.variables ? {
51
- variables: normalizeVariablesForJSON(manifest.variables)
52
- } : {},
53
- ...manifest.utilities?.length ? {
54
- utilities: manifest.utilities.map(normalizeUtilityForJSON)
55
- } : {}
56
- };
57
- }
58
- function stringifyMasterCSSManifestJSON(manifest) {
59
- return JSON.stringify(normalizeMasterCSSManifestForJSON(manifest));
60
- }
61
-
62
- export { normalizeMasterCSSManifestForJSON, stringifyMasterCSSManifestJSON };
package/dist/manifest.mjs DELETED
@@ -1,33 +0,0 @@
1
- function getMasterCSSManifestVariableName(namespace, variable) {
2
- return variable.name || (namespace ? `${namespace}${variable.key ? '-' + variable.key : ''}` : variable.key);
3
- }
4
- function flattenMasterCSSManifestVariables(variables) {
5
- const flattened = [];
6
- for (const [namespace, definitions] of Object.entries(variables || {})){
7
- for (const definition of definitions){
8
- const type = definition.type || (typeof definition.value === 'number' ? 'number' : 'string');
9
- flattened.push({
10
- ...definition,
11
- name: getMasterCSSManifestVariableName(namespace, definition),
12
- ...namespace ? {
13
- namespace
14
- } : {},
15
- type
16
- });
17
- }
18
- }
19
- return flattened;
20
- }
21
- function groupMasterCSSManifestVariables(variables) {
22
- if (!variables?.length) return;
23
- const grouped = {};
24
- for (const variable of variables){
25
- const namespace = variable.namespace || '';
26
- const group = grouped[namespace] ||= [];
27
- const { namespace: _namespace, ...definition } = variable;
28
- group.push(definition);
29
- }
30
- return Object.keys(grouped).length ? grouped : undefined;
31
- }
32
-
33
- export { flattenMasterCSSManifestVariables, getMasterCSSManifestVariableName, groupMasterCSSManifestVariables };
@@ -1,85 +0,0 @@
1
- const nativeCSSShorthandProperties = new Set([
2
- 'all',
3
- 'animation',
4
- 'animation-range',
5
- 'background',
6
- 'background-position',
7
- 'background-repeat',
8
- 'border',
9
- 'border-block',
10
- 'border-block-color',
11
- 'border-block-end',
12
- 'border-block-start',
13
- 'border-block-style',
14
- 'border-block-width',
15
- 'border-bottom',
16
- 'border-color',
17
- 'border-image',
18
- 'border-inline',
19
- 'border-inline-color',
20
- 'border-inline-end',
21
- 'border-inline-start',
22
- 'border-inline-style',
23
- 'border-inline-width',
24
- 'border-left',
25
- 'border-radius',
26
- 'border-right',
27
- 'border-style',
28
- 'border-top',
29
- 'border-width',
30
- 'column-rule',
31
- 'columns',
32
- 'contain-intrinsic-size',
33
- 'container',
34
- 'flex',
35
- 'flex-flow',
36
- 'font',
37
- 'font-synthesis',
38
- 'font-variant',
39
- 'gap',
40
- 'grid',
41
- 'grid-area',
42
- 'grid-column',
43
- 'grid-row',
44
- 'grid-template',
45
- 'inset',
46
- 'inset-block',
47
- 'inset-inline',
48
- 'line-clamp',
49
- 'list-style',
50
- 'margin',
51
- 'margin-block',
52
- 'margin-inline',
53
- 'mask',
54
- 'mask-border',
55
- 'mask-position',
56
- 'mask-repeat',
57
- 'offset',
58
- 'outline',
59
- 'overflow',
60
- 'overscroll-behavior',
61
- 'padding',
62
- 'padding-block',
63
- 'padding-inline',
64
- 'place-content',
65
- 'place-items',
66
- 'place-self',
67
- 'scroll-margin',
68
- 'scroll-margin-block',
69
- 'scroll-margin-inline',
70
- 'scroll-padding',
71
- 'scroll-padding-block',
72
- 'scroll-padding-inline',
73
- 'scroll-timeline',
74
- 'text-decoration',
75
- 'text-emphasis',
76
- 'text-wrap',
77
- 'transition',
78
- 'view-timeline',
79
- 'white-space'
80
- ]);
81
- function isNativeCSSShorthandProperty(property) {
82
- return nativeCSSShorthandProperties.has(property);
83
- }
84
-
85
- export { nativeCSSShorthandProperties as default, isNativeCSSShorthandProperty };
@@ -1,3 +0,0 @@
1
- const MASTER_CSS_RUNTIME_STYLE_ID = 'master-css';
2
-
3
- export { MASTER_CSS_RUNTIME_STYLE_ID };
@@ -1,16 +0,0 @@
1
- const UtilityType = {
2
- /**
3
- * semantic utility classes
4
- * @example block, inline
5
- */ Semantic: -2,
6
- /**
7
- * shorthand
8
- * @example border, padding, margin
9
- */ Shorthand: -1,
10
- /**
11
- * normal
12
- * @example grid-cols
13
- */ Normal: 0
14
- };
15
-
16
- export { UtilityType, UtilityType as default };