@zj-dynamics/design 0.0.0-stage → 0.1.0

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/foundationColors.d.ts +3 -0
  4. package/dist/foundationColors.js +25 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.js +2 -0
  7. package/dist/theme.d.ts +47 -0
  8. package/dist/theme.js +78 -0
  9. package/foundation/native/LICENSE +21 -0
  10. package/foundation/native/assets/icon.map.d.ts +1832 -0
  11. package/foundation/native/assets/tokens.all.colors.d.ts +295 -0
  12. package/foundation/native/assets/tokens.android.d.ts +387 -0
  13. package/foundation/native/assets/tokens.color.d.ts +80 -0
  14. package/foundation/native/assets/tokens.dark.android.d.ts +118 -0
  15. package/foundation/native/assets/tokens.dark.d.ts +91 -0
  16. package/foundation/native/assets/tokens.dark.ios.d.ts +118 -0
  17. package/foundation/native/assets/tokens.ios.d.ts +387 -0
  18. package/foundation/native/assets/tokens.semantic.d.ts +55 -0
  19. package/foundation/native/assets/tokens.web.d.ts +359 -0
  20. package/foundation/native/color.css +79 -0
  21. package/foundation/native/colors.cjs +79 -0
  22. package/foundation/native/colors.mjs +79 -0
  23. package/foundation/native/dark.mode.css +135 -0
  24. package/foundation/native/dark.theme.css +90 -0
  25. package/foundation/native/foundation.css +405 -0
  26. package/foundation/native/foundation.local.css +404 -0
  27. package/foundation/native/iconStyles/iconColors.d.ts +157 -0
  28. package/foundation/native/iconStyles/iconSizes.d.ts +16 -0
  29. package/foundation/native/iconStyles/iconStyles.mobile.d.ts +1 -0
  30. package/foundation/native/iconStyles/iconStyles.web.d.ts +1 -0
  31. package/foundation/native/iconStyles/icons.types.d.ts +11 -0
  32. package/foundation/native/index.cjs +4737 -0
  33. package/foundation/native/index.d.mts +59 -0
  34. package/foundation/native/index.mjs +4718 -0
  35. package/foundation/native/scripts/iconMap.types.d.ts +11 -0
  36. package/foundation/native/semantic.css +54 -0
  37. package/foundation/native/tailwind/rulnarPlugin.d.ts +4 -0
  38. package/foundation/native/tailwind.cjs +432 -0
  39. package/foundation/native/tailwind.mjs +430 -0
  40. package/foundation/web/LICENSE +21 -0
  41. package/foundation/web/assets/icon.map.d.ts +1854 -0
  42. package/foundation/web/assets/tokens.all.colors.d.ts +295 -0
  43. package/foundation/web/assets/tokens.android.d.ts +387 -0
  44. package/foundation/web/assets/tokens.color.d.ts +80 -0
  45. package/foundation/web/assets/tokens.dark.d.ts +91 -0
  46. package/foundation/web/assets/tokens.ios.d.ts +387 -0
  47. package/foundation/web/assets/tokens.semantic.d.ts +55 -0
  48. package/foundation/web/assets/tokens.web.d.ts +359 -0
  49. package/foundation/web/color.css +79 -0
  50. package/foundation/web/colors.cjs +79 -0
  51. package/foundation/web/colors.mjs +79 -0
  52. package/foundation/web/dark.mode.css +135 -0
  53. package/foundation/web/dark.theme.css +90 -0
  54. package/foundation/web/foundation.css +405 -0
  55. package/foundation/web/foundation.local.css +404 -0
  56. package/foundation/web/iconStyles/iconColors.d.ts +157 -0
  57. package/foundation/web/iconStyles/iconSizes.d.ts +16 -0
  58. package/foundation/web/iconStyles/iconStyles.mobile.d.ts +1 -0
  59. package/foundation/web/iconStyles/iconStyles.web.d.ts +1 -0
  60. package/foundation/web/iconStyles/icons.types.d.ts +11 -0
  61. package/foundation/web/index.cjs +4524 -0
  62. package/foundation/web/index.d.mts +57 -0
  63. package/foundation/web/index.mjs +4507 -0
  64. package/foundation/web/scripts/iconMap.types.d.ts +11 -0
  65. package/foundation/web/semantic.css +54 -0
  66. package/foundation/web/tailwind/rulnarPlugin.d.ts +4 -0
  67. package/foundation/web/tailwind.cjs +432 -0
  68. package/foundation/web/tailwind.mjs +430 -0
  69. package/package.json +105 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZJ Dynamics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
- # Temporary Holding Version
1
+ # @zj-dynamics/design
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Import shared theme tokens from `@zj-dynamics/design`. Use `@zj-dynamics/design/web` for Web tokens and icons or `@zj-dynamics/design/native` for Native tokens and icons.
4
+
5
+ ## License
6
+
7
+ The MIT license in `LICENSE` applies to Rulnar-owned code. Third-party materials retain their accompanying licenses and notices.
@@ -0,0 +1,3 @@
1
+ import type { ColorOverrides } from './theme.js';
2
+ /** Map explicitly supplied brand colors onto legacy semantic token names. */
3
+ export declare function foundationColorOverrides(colors: ColorOverrides): Record<string, string>;
@@ -0,0 +1,25 @@
1
+ const foundationRoles = {
2
+ surface: ['color-surface'],
3
+ background: ['color-surface--background'],
4
+ text: ['color-text', 'color-icon'],
5
+ textMuted: ['color-text--secondary', 'color-icon--secondary'],
6
+ border: ['color-border'],
7
+ interactive: ['color-interactive'],
8
+ interactiveSubtle: ['color-interactive--subtle'],
9
+ textReverse: ['color-text--reverse'],
10
+ destructive: ['color-destructive'],
11
+ focus: ['color-focus'],
12
+ overlay: ['color-overlay'],
13
+ };
14
+ /** Map explicitly supplied brand colors onto legacy semantic token names. */
15
+ export function foundationColorOverrides(colors) {
16
+ const overrides = {};
17
+ for (const role of Object.keys(foundationRoles)) {
18
+ const value = colors[role];
19
+ if (value === undefined)
20
+ continue;
21
+ for (const token of foundationRoles[role])
22
+ overrides[token] = value;
23
+ }
24
+ return overrides;
25
+ }
@@ -0,0 +1,3 @@
1
+ export { colorRoles, createTheme, defaultBrand, effectiveMode, motion, radii, resolveTheme, spacing, toCSSVariables, typography, } from './theme.js';
2
+ export type { BrandTheme, ColorOverrides, ColorRole, EffectiveMode, Mode, SemanticColors, ThemeInput } from './theme.js';
3
+ export { foundationColorOverrides } from './foundationColors.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { colorRoles, createTheme, defaultBrand, effectiveMode, motion, radii, resolveTheme, spacing, toCSSVariables, typography, } from './theme.js';
2
+ export { foundationColorOverrides } from './foundationColors.js';
@@ -0,0 +1,47 @@
1
+ export type Mode = 'light' | 'dark' | 'system';
2
+ export type EffectiveMode = Exclude<Mode, 'system'>;
3
+ export declare const colorRoles: readonly ["surface", "background", "text", "textMuted", "border", "interactive", "interactiveSubtle", "textReverse", "destructive", "focus", "overlay"];
4
+ export type ColorRole = typeof colorRoles[number];
5
+ export type ColorOverrides = Readonly<Partial<Record<ColorRole, string>>>;
6
+ export interface ThemeInput {
7
+ readonly name: string;
8
+ readonly light: ColorOverrides;
9
+ readonly dark: ColorOverrides;
10
+ }
11
+ export type BrandTheme = ThemeInput;
12
+ export declare function createTheme(input: ThemeInput): BrandTheme;
13
+ /** Caller supplies a complete platform/mode baseline. No CSS/RN imports or mutable global store. */
14
+ export declare function resolveColors(base: Readonly<Record<ColorRole, string>>, brand: BrandTheme, mode: EffectiveMode, scope?: ColorOverrides): Readonly<Record<ColorRole, string>>;
15
+ export declare function effectiveMode(mode: Mode, system: EffectiveMode | null): EffectiveMode;
16
+ export type SemanticColors = Readonly<Record<ColorRole, string>>;
17
+ export declare const defaultBrand: ThemeInput;
18
+ export declare const spacing: Readonly<{
19
+ small: 8;
20
+ base: 16;
21
+ large: 24;
22
+ }>;
23
+ export declare const radii: Readonly<{
24
+ control: 4;
25
+ panel: 8;
26
+ }>;
27
+ export declare const typography: Readonly<{
28
+ fontSize: 16;
29
+ lineHeight: 1.5;
30
+ headingWeight: 600;
31
+ }>;
32
+ export declare const motion: Readonly<{
33
+ standard: 140;
34
+ reduced: 0;
35
+ }>;
36
+ export declare function resolveTheme(brand: BrandTheme, mode: EffectiveMode, scope?: ColorOverrides): SemanticColors;
37
+ export declare function toCSSVariables(colors: SemanticColors): {
38
+ '--rulnar-space-small': string;
39
+ '--rulnar-space-base': string;
40
+ '--rulnar-space-large': string;
41
+ '--rulnar-radius-control': string;
42
+ '--rulnar-radius-panel': string;
43
+ '--rulnar-font-size': string;
44
+ '--rulnar-line-height': string;
45
+ '--rulnar-heading-weight': string;
46
+ '--rulnar-motion-standard': string;
47
+ };
package/dist/theme.js ADDED
@@ -0,0 +1,78 @@
1
+ export const colorRoles = [
2
+ 'surface', 'background', 'text', 'textMuted', 'border', 'interactive',
3
+ 'interactiveSubtle', 'textReverse', 'destructive', 'focus', 'overlay',
4
+ ];
5
+ function object(value, label) {
6
+ if (!value || typeof value !== 'object' || Array.isArray(value) ||
7
+ ![Object.prototype, null].includes(Object.getPrototypeOf(value))) {
8
+ throw new TypeError(`${label} must be a plain object`);
9
+ }
10
+ }
11
+ function colors(value, label) {
12
+ object(value, label);
13
+ const copy = {};
14
+ for (const [key, color] of Object.entries(value)) {
15
+ if (!colorRoles.includes(key))
16
+ throw new TypeError(`Unknown ${label} role: ${key}`);
17
+ // This prototype intentionally accepts only portable 6/8-digit hex values.
18
+ if (typeof color !== 'string' || !/^#(?:[\da-f]{6}|[\da-f]{8})$/i.test(color)) {
19
+ throw new TypeError(`Invalid ${label}.${key} color`);
20
+ }
21
+ copy[key] = color;
22
+ }
23
+ return Object.freeze(copy);
24
+ }
25
+ export function createTheme(input) {
26
+ object(input, 'theme');
27
+ for (const key of Object.keys(input)) {
28
+ if (!['name', 'light', 'dark'].includes(key))
29
+ throw new TypeError(`Unknown theme key: ${key}`);
30
+ }
31
+ if (typeof input.name !== 'string' || input.name.trim().length === 0)
32
+ throw new TypeError('Theme name is required');
33
+ return Object.freeze({ name: input.name, light: colors(input.light, 'light'), dark: colors(input.dark, 'dark') });
34
+ }
35
+ /** Caller supplies a complete platform/mode baseline. No CSS/RN imports or mutable global store. */
36
+ export function resolveColors(base, brand, mode, scope = {}) {
37
+ return Object.freeze({ ...base, ...brand[mode], ...colors(scope, 'scope') });
38
+ }
39
+ export function effectiveMode(mode, system) {
40
+ return mode === 'system' ? (system ?? 'light') : mode;
41
+ }
42
+ export const defaultBrand = createTheme({ name: 'rulnar', light: {}, dark: {} });
43
+ const baseline = Object.freeze({
44
+ light: Object.freeze({
45
+ surface: '#ffffff', background: '#eeece7', text: '#233b48', textMuted: '#496572',
46
+ border: '#dadee2', interactive: '#388523', interactiveSubtle: '#e7f3df',
47
+ textReverse: '#ffffff', destructive: '#c43d30', focus: '#466e83', overlay: '#00000066',
48
+ }),
49
+ dark: Object.freeze({
50
+ surface: '#222f38', background: '#17232c', text: '#e4eef3', textMuted: '#b5c7d1',
51
+ border: '#586d79', interactive: '#8fc733', interactiveSubtle: '#304027',
52
+ textReverse: '#19242b', destructive: '#ff9a8e', focus: '#c8deee', overlay: '#00000099',
53
+ }),
54
+ });
55
+ export const spacing = Object.freeze({ small: 8, base: 16, large: 24 });
56
+ export const radii = Object.freeze({ control: 4, panel: 8 });
57
+ export const typography = Object.freeze({ fontSize: 16, lineHeight: 1.5, headingWeight: 600 });
58
+ export const motion = Object.freeze({ standard: 140, reduced: 0 });
59
+ export function resolveTheme(brand, mode, scope = {}) {
60
+ return resolveColors(baseline[mode], brand, mode, scope);
61
+ }
62
+ export function toCSSVariables(colors) {
63
+ const colorEntries = colorRoles.map(role => [
64
+ `--rulnar-color-${role.replace(/[A-Z]/g, char => '-' + char.toLowerCase())}`, colors[role],
65
+ ]);
66
+ return {
67
+ ...Object.fromEntries(colorEntries),
68
+ '--rulnar-space-small': `${spacing.small}px`,
69
+ '--rulnar-space-base': `${spacing.base}px`,
70
+ '--rulnar-space-large': `${spacing.large}px`,
71
+ '--rulnar-radius-control': `${radii.control}px`,
72
+ '--rulnar-radius-panel': `${radii.panel}px`,
73
+ '--rulnar-font-size': `${typography.fontSize}px`,
74
+ '--rulnar-line-height': String(typography.lineHeight),
75
+ '--rulnar-heading-weight': String(typography.headingWeight),
76
+ '--rulnar-motion-standard': `${motion.standard}ms`,
77
+ };
78
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Octopusapp Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.