@arbor-css/core 0.0.1 → 0.0.2
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/dist/config.d.ts +3 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/runtime/components/SystemDemo.js +1 -1
- package/dist/runtime/components/SystemDemo.js.map +1 -1
- package/dist/runtime/readProperties.js +1 -1
- package/dist/runtime/readProperties.js.map +1 -1
- package/dist/stylesheet/generateStylesheet.d.ts +2 -1
- package/dist/stylesheet/generateStylesheet.d.ts.map +1 -1
- package/dist/stylesheet/generateStylesheet.js +3 -15
- package/dist/stylesheet/generateStylesheet.js.map +1 -1
- package/package.json +14 -8
- package/dist/arborPreset.d.ts +0 -344
- package/dist/arborPreset.d.ts.map +0 -1
- package/dist/arborPreset.js +0 -198
- package/dist/arborPreset.js.map +0 -1
- package/dist/primitives/labelProps.d.ts +0 -1
- package/dist/primitives/labelProps.d.ts.map +0 -1
- package/dist/primitives/labelProps.js +0 -2
- package/dist/primitives/labelProps.js.map +0 -1
- package/dist/primitives/localProps.d.ts +0 -1
- package/dist/primitives/localProps.d.ts.map +0 -1
- package/dist/primitives/localProps.js +0 -2
- package/dist/primitives/localProps.js.map +0 -1
- package/dist/primitives/primitives.d.ts +0 -46
- package/dist/primitives/primitives.d.ts.map +0 -1
- package/dist/primitives/primitives.js +0 -75
- package/dist/primitives/primitives.js.map +0 -1
- package/dist/primitives/systemProps.d.ts +0 -329
- package/dist/primitives/systemProps.d.ts.map +0 -1
- package/dist/primitives/systemProps.js +0 -45
- package/dist/primitives/systemProps.js.map +0 -1
- package/dist/runtime/components/ColorRange.d.ts +0 -2
- package/dist/runtime/components/ColorRange.d.ts.map +0 -1
- package/dist/runtime/components/ColorRange.js +0 -52
- package/dist/runtime/components/ColorRange.js.map +0 -1
- package/dist/runtime/components/ModeTokenValues.d.ts +0 -2
- package/dist/runtime/components/ModeTokenValues.d.ts.map +0 -1
- package/dist/runtime/components/ModeTokenValues.js +0 -2
- package/dist/runtime/components/ModeTokenValues.js.map +0 -1
- package/dist/runtime/components/PrimitiveTokenValues.d.ts +0 -2
- package/dist/runtime/components/PrimitiveTokenValues.d.ts.map +0 -1
- package/dist/runtime/components/PrimitiveTokenValues.js +0 -82
- package/dist/runtime/components/PrimitiveTokenValues.js.map +0 -1
- package/dist/runtime/components/Shadows.d.ts +0 -2
- package/dist/runtime/components/Shadows.d.ts.map +0 -1
- package/dist/runtime/components/Shadows.js +0 -27
- package/dist/runtime/components/Shadows.js.map +0 -1
- package/dist/runtime/components/Spacing.d.ts +0 -2
- package/dist/runtime/components/Spacing.d.ts.map +0 -1
- package/dist/runtime/components/Spacing.js +0 -27
- package/dist/runtime/components/Spacing.js.map +0 -1
- package/dist/runtime/components/Typography.d.ts +0 -2
- package/dist/runtime/components/Typography.d.ts.map +0 -1
- package/dist/runtime/components/Typography.js +0 -30
- package/dist/runtime/components/Typography.js.map +0 -1
- package/dist/util/convertStructure.d.ts +0 -8
- package/dist/util/convertStructure.d.ts.map +0 -1
- package/dist/util/convertStructure.js +0 -30
- package/dist/util/convertStructure.js.map +0 -1
- package/dist/util/tokenifyColors.d.ts +0 -6
- package/dist/util/tokenifyColors.d.ts.map +0 -1
- package/dist/util/tokenifyColors.js +0 -10
- package/dist/util/tokenifyColors.js.map +0 -1
- package/dist/util/tokenifyColors.test.d.ts +0 -2
- package/dist/util/tokenifyColors.test.d.ts.map +0 -1
- package/dist/util/tokenifyColors.test.js +0 -25
- package/dist/util/tokenifyColors.test.js.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { isToken } from '@arbor-css/tokens';
|
|
2
|
-
import { getConfig } from '../registration.js';
|
|
3
|
-
class Typography extends HTMLElement {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
const config = getConfig();
|
|
7
|
-
const typography = config.primitives.$tokens.typography;
|
|
8
|
-
if (isToken(typography)) {
|
|
9
|
-
throw new Error(`Typography is not a valid token range (it's an individual token)`);
|
|
10
|
-
}
|
|
11
|
-
this.attachShadow({ mode: 'open' }).innerHTML = `
|
|
12
|
-
<div>
|
|
13
|
-
${Object.keys(typography)
|
|
14
|
-
.map((key) => {
|
|
15
|
-
const value = typography[key];
|
|
16
|
-
// we expect these values on typography tokens...
|
|
17
|
-
const { size, weight, lineHeight } = value;
|
|
18
|
-
if (!size || !weight || !lineHeight) {
|
|
19
|
-
throw new Error(`Typography level "${key}" is missing expected properties (size, weight, lineHeight)`);
|
|
20
|
-
}
|
|
21
|
-
console.log(value);
|
|
22
|
-
return `<div class="type-sample" style="font-size: ${size.var}; font-weight: ${weight.var}; line-height: ${lineHeight.var};">${key}: The quick brown fox jumps over the lazy dog.</div>`;
|
|
23
|
-
})
|
|
24
|
-
.join('\n')}
|
|
25
|
-
</div>
|
|
26
|
-
`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
customElements.define('arbor-typography', Typography);
|
|
30
|
-
//# sourceMappingURL=Typography.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.js","sourceRoot":"","sources":["../../../src/runtime/components/Typography.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAW,SAAQ,WAAW;IACnC;QACC,KAAK,EAAE,CAAC;QAER,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC;QAExD,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACd,kEAAkE,CAClE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,GAAG;;MAE5C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACZ,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC9B,iDAAiD;YACjD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAY,CAAC;YAClD,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACd,qBAAqB,GAAG,6DAA6D,CACrF,CAAC;YACH,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,8CAA8C,IAAI,CAAC,GAAG,kBAAkB,MAAM,CAAC,GAAG,kBAAkB,UAAU,CAAC,GAAG,MAAM,GAAG,sDAAsD,CAAC;QAC1L,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC;;GAEb,CAAC;IACH,CAAC;CACD;AAED,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Walk an object structure and convert matching items using the supplied
|
|
3
|
-
* function.
|
|
4
|
-
*/
|
|
5
|
-
export declare function convertStructure<In, Out>(input: any, matchConvertedItem: (item: any, path: (string | number)[]) => item is In, convert: (item: In, path: (string | number)[]) => Out, { path, ...options }?: {
|
|
6
|
-
path?: (string | number)[];
|
|
7
|
-
}): any;
|
|
8
|
-
//# sourceMappingURL=convertStructure.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertStructure.d.ts","sourceRoot":"","sources":["../../src/util/convertStructure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,GAAG,EACvC,KAAK,EAAE,GAAG,EACV,kBAAkB,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,IAAI,EAAE,EACxE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,GAAG,EACrD,EACC,IAAS,EACT,GAAG,OAAO,EACV,GAAE;IACF,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACtB,GACJ,GAAG,CAuBL"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Walk an object structure and convert matching items using the supplied
|
|
3
|
-
* function.
|
|
4
|
-
*/
|
|
5
|
-
export function convertStructure(input, matchConvertedItem, convert, { path = [], ...options } = {}) {
|
|
6
|
-
path ?? (path = []);
|
|
7
|
-
if (matchConvertedItem(input, path)) {
|
|
8
|
-
return convert(input, path);
|
|
9
|
-
}
|
|
10
|
-
else if (Array.isArray(input)) {
|
|
11
|
-
return input.map((item, index) => convertStructure(item, matchConvertedItem, convert, {
|
|
12
|
-
path: [...path, index],
|
|
13
|
-
...options,
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
else if (typeof input === 'object' && input !== null) {
|
|
17
|
-
const output = {};
|
|
18
|
-
for (const key in input) {
|
|
19
|
-
output[key] = convertStructure(input[key], matchConvertedItem, convert, {
|
|
20
|
-
path: [...path, key],
|
|
21
|
-
...options,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return output;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return input;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=convertStructure.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convertStructure.js","sourceRoot":"","sources":["../../src/util/convertStructure.ts"],"names":[],"mappings":"AAAA;;;GAG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C,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAQzE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createToken } from '@arbor-css/tokens';
|
|
2
|
-
import { convertStructure } from './convertStructure.js';
|
|
3
|
-
/**
|
|
4
|
-
* Replaces each level of a structure of color strings
|
|
5
|
-
* with a color Token
|
|
6
|
-
*/
|
|
7
|
-
export function tokenifyColors(obj) {
|
|
8
|
-
return convertStructure(obj, (item, path) => typeof item === 'string', (item, path) => createToken(path.join('-'), { type: 'color' }));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=tokenifyColors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenifyColors.js","sourceRoot":"","sources":["../../src/util/tokenifyColors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAgC,GAAM;IACnE,OAAO,gBAAgB,CACtB,GAAG,EACH,CAAC,IAAS,EAAE,IAAyB,EAAkB,EAAE,CACxD,OAAO,IAAI,KAAK,QAAQ,EACzB,CAAC,IAAY,EAAE,IAAyB,EAAE,EAAE,CAC3C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAC/C,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenifyColors.test.d.ts","sourceRoot":"","sources":["../../src/util/tokenifyColors.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { TOKEN_PREFIX } from '@arbor-css/tokens';
|
|
2
|
-
import { expect, it } from 'vitest';
|
|
3
|
-
import { tokenifyColors } from './tokenifyColors.js';
|
|
4
|
-
it('tokenifyColors should convert color values to tokens', () => {
|
|
5
|
-
const input = {
|
|
6
|
-
primary: {
|
|
7
|
-
light: '#fff',
|
|
8
|
-
dark: '#000',
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
const output = tokenifyColors(input);
|
|
12
|
-
expect(output).toEqual({
|
|
13
|
-
primary: {
|
|
14
|
-
light: expect.objectContaining({
|
|
15
|
-
type: 'color',
|
|
16
|
-
name: `${TOKEN_PREFIX}-primary-light`,
|
|
17
|
-
}),
|
|
18
|
-
dark: expect.objectContaining({
|
|
19
|
-
type: 'color',
|
|
20
|
-
name: `${TOKEN_PREFIX}-primary-dark`,
|
|
21
|
-
}),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=tokenifyColors.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokenifyColors.test.js","sourceRoot":"","sources":["../../src/util/tokenifyColors.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAC/D,MAAM,KAAK,GAAG;QACb,OAAO,EAAE;YACR,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MAAM;SACZ;KACD,CAAC;IACF,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;QACtB,OAAO,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;gBAC9B,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,GAAG,YAAY,gBAAgB;aACrC,CAAC;YACF,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC;gBAC7B,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,GAAG,YAAY,eAAe;aACpC,CAAC;SACF;KACD,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|