@openwaggle/extension-sdk 0.0.0-bootstrap.0 → 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.
- package/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/agent-loop.d.ts +128 -0
- package/dist/agent-loop.js +47 -0
- package/dist/broker-validation.d.ts +17 -0
- package/dist/broker-validation.js +99 -0
- package/dist/broker.d.ts +193 -0
- package/dist/broker.js +81 -0
- package/dist/constants.d.ts +183 -0
- package/dist/constants.js +245 -0
- package/dist/context.d.ts +66 -0
- package/dist/context.js +49 -0
- package/dist/contribution-types.d.ts +21 -0
- package/dist/contribution-types.js +1 -0
- package/dist/core-types.d.ts +58 -0
- package/dist/core-types.js +1 -0
- package/dist/docs-validation.d.ts +3 -0
- package/dist/docs-validation.js +93 -0
- package/dist/docs.d.ts +231 -0
- package/dist/docs.js +85 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10 -0
- package/dist/internal-validation.d.ts +4 -0
- package/dist/internal-validation.js +24 -0
- package/dist/json.d.ts +9 -0
- package/dist/json.js +3 -0
- package/dist/manifest-contributions.d.ts +380 -0
- package/dist/manifest-contributions.js +75 -0
- package/dist/manifest-primitives.d.ts +20 -0
- package/dist/manifest-primitives.js +118 -0
- package/dist/manifest.d.ts +303 -0
- package/dist/manifest.js +89 -0
- package/dist/openwaggle-sdk.d.ts +2 -0
- package/dist/openwaggle-sdk.js +127 -0
- package/dist/openwaggle-types.d.ts +111 -0
- package/dist/openwaggle-types.js +1 -0
- package/dist/openwaggle-validation.d.ts +12 -0
- package/dist/openwaggle-validation.js +135 -0
- package/dist/registry-types.d.ts +34 -0
- package/dist/registry-types.js +1 -0
- package/dist/runtime-sdk.d.ts +2 -0
- package/dist/runtime-sdk.js +19 -0
- package/dist/runtime-types.d.ts +19 -0
- package/dist/runtime-types.js +1 -0
- package/dist/runtime.d.ts +22 -0
- package/dist/runtime.js +22 -0
- package/dist/schema.d.ts +13 -0
- package/dist/schema.js +25 -0
- package/dist/sdk-types.d.ts +92 -0
- package/dist/sdk-types.js +1 -0
- package/dist/storage-sdk.d.ts +2 -0
- package/dist/storage-sdk.js +51 -0
- package/dist/storage-types.d.ts +40 -0
- package/dist/storage-types.js +1 -0
- package/dist/theme-data.d.ts +126 -0
- package/dist/theme-data.js +144 -0
- package/dist/theme-types.d.ts +61 -0
- package/dist/theme-types.js +1 -0
- package/dist/theme.d.ts +6 -0
- package/dist/theme.js +128 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +1 -0
- package/dist/ui-constants.d.ts +24 -0
- package/dist/ui-constants.js +22 -0
- package/dist/ui-stylesheet.d.ts +8 -0
- package/dist/ui-stylesheet.js +223 -0
- package/dist/ui.d.ts +6 -0
- package/dist/ui.js +16 -0
- package/dist-cjs/agent-loop.js +83 -0
- package/dist-cjs/broker-validation.js +109 -0
- package/dist-cjs/broker.js +120 -0
- package/dist-cjs/constants.js +248 -0
- package/dist-cjs/context.js +54 -0
- package/dist-cjs/contribution-types.js +2 -0
- package/dist-cjs/core-types.js +2 -0
- package/dist-cjs/docs-validation.js +97 -0
- package/dist-cjs/docs.js +121 -0
- package/dist-cjs/index.js +56 -0
- package/dist-cjs/internal-validation.js +30 -0
- package/dist-cjs/json.js +39 -0
- package/dist-cjs/manifest-contributions.js +111 -0
- package/dist-cjs/manifest-primitives.js +158 -0
- package/dist-cjs/manifest.js +140 -0
- package/dist-cjs/openwaggle-sdk.js +130 -0
- package/dist-cjs/openwaggle-types.js +2 -0
- package/dist-cjs/openwaggle-validation.js +148 -0
- package/dist-cjs/package.json +3 -0
- package/dist-cjs/registry-types.js +2 -0
- package/dist-cjs/runtime-sdk.js +22 -0
- package/dist-cjs/runtime-types.js +2 -0
- package/dist-cjs/runtime.js +61 -0
- package/dist-cjs/schema.js +61 -0
- package/dist-cjs/sdk-types.js +2 -0
- package/dist-cjs/storage-sdk.js +54 -0
- package/dist-cjs/storage-types.js +2 -0
- package/dist-cjs/theme-data.js +147 -0
- package/dist-cjs/theme-types.js +2 -0
- package/dist-cjs/theme.js +135 -0
- package/dist-cjs/types.js +2 -0
- package/dist-cjs/ui-constants.js +25 -0
- package/dist-cjs/ui-stylesheet.js +227 -0
- package/dist-cjs/ui.js +24 -0
- package/package.json +98 -8
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXTENSION_THEME_ELEVATION_KEYS = exports.EXTENSION_THEME_FOCUS_KEYS = exports.EXTENSION_THEME_RADIUS_KEYS = exports.EXTENSION_THEME_SPACING_KEYS = exports.EXTENSION_THEME_TYPOGRAPHY_KEYS = exports.EXTENSION_THEME_COLOR_KEYS = exports.SOURCE_EXTENSION_THEME_CSS_VARIABLES = exports.DEFAULT_EXTENSION_THEME_TOKENS = exports.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES = void 0;
|
|
4
|
+
exports.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES = {
|
|
5
|
+
color: {
|
|
6
|
+
background: '--ow-color-background',
|
|
7
|
+
surface: '--ow-color-surface',
|
|
8
|
+
surfaceRaised: '--ow-color-surface-raised',
|
|
9
|
+
surfaceHover: '--ow-color-surface-hover',
|
|
10
|
+
surfaceActive: '--ow-color-surface-active',
|
|
11
|
+
border: '--ow-color-border',
|
|
12
|
+
borderStrong: '--ow-color-border-strong',
|
|
13
|
+
text: '--ow-color-text',
|
|
14
|
+
textSubtle: '--ow-color-text-subtle',
|
|
15
|
+
textMuted: '--ow-color-text-muted',
|
|
16
|
+
textDim: '--ow-color-text-dim',
|
|
17
|
+
accent: '--ow-color-accent',
|
|
18
|
+
accentDim: '--ow-color-accent-dim',
|
|
19
|
+
success: '--ow-color-success',
|
|
20
|
+
danger: '--ow-color-danger',
|
|
21
|
+
warning: '--ow-color-warning',
|
|
22
|
+
info: '--ow-color-info',
|
|
23
|
+
},
|
|
24
|
+
typography: {
|
|
25
|
+
sansFamily: '--ow-font-family-sans',
|
|
26
|
+
monoFamily: '--ow-font-family-mono',
|
|
27
|
+
},
|
|
28
|
+
spacing: {
|
|
29
|
+
xs: '--ow-space-xs',
|
|
30
|
+
sm: '--ow-space-sm',
|
|
31
|
+
md: '--ow-space-md',
|
|
32
|
+
lg: '--ow-space-lg',
|
|
33
|
+
xl: '--ow-space-xl',
|
|
34
|
+
},
|
|
35
|
+
radius: {
|
|
36
|
+
sm: '--ow-radius-sm',
|
|
37
|
+
md: '--ow-radius-md',
|
|
38
|
+
lg: '--ow-radius-lg',
|
|
39
|
+
panel: '--ow-radius-panel',
|
|
40
|
+
},
|
|
41
|
+
focus: {
|
|
42
|
+
ring: '--ow-focus-ring',
|
|
43
|
+
shadow: '--ow-focus-shadow',
|
|
44
|
+
},
|
|
45
|
+
elevation: {
|
|
46
|
+
card: '--ow-elevation-card',
|
|
47
|
+
overlay: '--ow-elevation-overlay',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
exports.DEFAULT_EXTENSION_THEME_TOKENS = {
|
|
51
|
+
color: {
|
|
52
|
+
background: '#141619',
|
|
53
|
+
surface: '#1a1d22',
|
|
54
|
+
surfaceRaised: '#1f232a',
|
|
55
|
+
surfaceHover: '#262b33',
|
|
56
|
+
surfaceActive: '#1d1a10',
|
|
57
|
+
border: '#1e2229',
|
|
58
|
+
borderStrong: '#2a3240',
|
|
59
|
+
text: '#e7e9ee',
|
|
60
|
+
textSubtle: '#c9cdd6',
|
|
61
|
+
textMuted: '#9098a8',
|
|
62
|
+
textDim: '#666f7d',
|
|
63
|
+
accent: '#f5a623',
|
|
64
|
+
accentDim: '#b87410',
|
|
65
|
+
success: '#4caf72',
|
|
66
|
+
danger: '#ef4444',
|
|
67
|
+
warning: '#f5a623',
|
|
68
|
+
info: '#61a8ff',
|
|
69
|
+
},
|
|
70
|
+
typography: {
|
|
71
|
+
sansFamily: 'Inter, "SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
72
|
+
monoFamily: '"SF Mono", "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace',
|
|
73
|
+
},
|
|
74
|
+
spacing: {
|
|
75
|
+
xs: '4px',
|
|
76
|
+
sm: '8px',
|
|
77
|
+
md: '12px',
|
|
78
|
+
lg: '16px',
|
|
79
|
+
xl: '24px',
|
|
80
|
+
},
|
|
81
|
+
radius: {
|
|
82
|
+
sm: '6px',
|
|
83
|
+
md: '9px',
|
|
84
|
+
lg: '12px',
|
|
85
|
+
panel: '22px',
|
|
86
|
+
},
|
|
87
|
+
focus: {
|
|
88
|
+
ring: '#9aa3b2',
|
|
89
|
+
shadow: '0 0 0 1px color-mix(in srgb, #9aa3b2 76%, transparent), 0 0 0 3px color-mix(in srgb, #9aa3b2 15%, transparent)',
|
|
90
|
+
},
|
|
91
|
+
elevation: {
|
|
92
|
+
card: 'inset 0 1px 0 rgba(255, 255, 255, 0.02)',
|
|
93
|
+
overlay: '0 24px 80px rgba(0, 0, 0, 0.45)',
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
exports.SOURCE_EXTENSION_THEME_CSS_VARIABLES = {
|
|
97
|
+
color: {
|
|
98
|
+
background: '--color-bg',
|
|
99
|
+
surface: '--color-bg-secondary',
|
|
100
|
+
surfaceRaised: '--color-bg-tertiary',
|
|
101
|
+
surfaceHover: '--color-bg-hover',
|
|
102
|
+
surfaceActive: '--color-bg-active',
|
|
103
|
+
border: '--color-border',
|
|
104
|
+
borderStrong: '--color-border-light',
|
|
105
|
+
text: '--color-text-primary',
|
|
106
|
+
textSubtle: '--color-text-secondary',
|
|
107
|
+
textMuted: '--color-text-tertiary',
|
|
108
|
+
textDim: '--color-text-muted',
|
|
109
|
+
accent: '--color-accent',
|
|
110
|
+
accentDim: '--color-accent-dim',
|
|
111
|
+
success: '--color-success',
|
|
112
|
+
danger: '--color-error',
|
|
113
|
+
warning: '--color-warning',
|
|
114
|
+
info: '--color-info',
|
|
115
|
+
},
|
|
116
|
+
typography: {
|
|
117
|
+
sansFamily: '--font-sans',
|
|
118
|
+
monoFamily: '--font-mono',
|
|
119
|
+
},
|
|
120
|
+
radius: {
|
|
121
|
+
panel: '--radius-panel',
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
exports.EXTENSION_THEME_COLOR_KEYS = [
|
|
125
|
+
'background',
|
|
126
|
+
'surface',
|
|
127
|
+
'surfaceRaised',
|
|
128
|
+
'surfaceHover',
|
|
129
|
+
'surfaceActive',
|
|
130
|
+
'border',
|
|
131
|
+
'borderStrong',
|
|
132
|
+
'text',
|
|
133
|
+
'textSubtle',
|
|
134
|
+
'textMuted',
|
|
135
|
+
'textDim',
|
|
136
|
+
'accent',
|
|
137
|
+
'accentDim',
|
|
138
|
+
'success',
|
|
139
|
+
'danger',
|
|
140
|
+
'warning',
|
|
141
|
+
'info',
|
|
142
|
+
];
|
|
143
|
+
exports.EXTENSION_THEME_TYPOGRAPHY_KEYS = ['sansFamily', 'monoFamily'];
|
|
144
|
+
exports.EXTENSION_THEME_SPACING_KEYS = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
145
|
+
exports.EXTENSION_THEME_RADIUS_KEYS = ['sm', 'md', 'lg', 'panel'];
|
|
146
|
+
exports.EXTENSION_THEME_FOCUS_KEYS = ['ring', 'shadow'];
|
|
147
|
+
exports.EXTENSION_THEME_ELEVATION_KEYS = ['card', 'overlay'];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES = void 0;
|
|
4
|
+
exports.createOpenWaggleExtensionTheme = createOpenWaggleExtensionTheme;
|
|
5
|
+
exports.extensionThemeCssVariableEntries = extensionThemeCssVariableEntries;
|
|
6
|
+
exports.isOpenWaggleExtensionTheme = isOpenWaggleExtensionTheme;
|
|
7
|
+
const internal_validation_js_1 = require("./internal-validation.js");
|
|
8
|
+
const theme_data_js_1 = require("./theme-data.js");
|
|
9
|
+
var theme_data_js_2 = require("./theme-data.js");
|
|
10
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES", { enumerable: true, get: function () { return theme_data_js_2.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES; } });
|
|
11
|
+
const EMPTY_LENGTH = 0;
|
|
12
|
+
function resolvedCssValue(resolver, cssVariable, fallback) {
|
|
13
|
+
if (resolver === undefined || cssVariable === undefined) {
|
|
14
|
+
return fallback;
|
|
15
|
+
}
|
|
16
|
+
const resolved = resolver(cssVariable, fallback).trim();
|
|
17
|
+
return resolved.length > EMPTY_LENGTH ? resolved : fallback;
|
|
18
|
+
}
|
|
19
|
+
function colorTokens(resolve) {
|
|
20
|
+
const source = theme_data_js_1.SOURCE_EXTENSION_THEME_CSS_VARIABLES.color;
|
|
21
|
+
const fallback = theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.color;
|
|
22
|
+
return {
|
|
23
|
+
background: resolvedCssValue(resolve, source.background, fallback.background),
|
|
24
|
+
surface: resolvedCssValue(resolve, source.surface, fallback.surface),
|
|
25
|
+
surfaceRaised: resolvedCssValue(resolve, source.surfaceRaised, fallback.surfaceRaised),
|
|
26
|
+
surfaceHover: resolvedCssValue(resolve, source.surfaceHover, fallback.surfaceHover),
|
|
27
|
+
surfaceActive: resolvedCssValue(resolve, source.surfaceActive, fallback.surfaceActive),
|
|
28
|
+
border: resolvedCssValue(resolve, source.border, fallback.border),
|
|
29
|
+
borderStrong: resolvedCssValue(resolve, source.borderStrong, fallback.borderStrong),
|
|
30
|
+
text: resolvedCssValue(resolve, source.text, fallback.text),
|
|
31
|
+
textSubtle: resolvedCssValue(resolve, source.textSubtle, fallback.textSubtle),
|
|
32
|
+
textMuted: resolvedCssValue(resolve, source.textMuted, fallback.textMuted),
|
|
33
|
+
textDim: resolvedCssValue(resolve, source.textDim, fallback.textDim),
|
|
34
|
+
accent: resolvedCssValue(resolve, source.accent, fallback.accent),
|
|
35
|
+
accentDim: resolvedCssValue(resolve, source.accentDim, fallback.accentDim),
|
|
36
|
+
success: resolvedCssValue(resolve, source.success, fallback.success),
|
|
37
|
+
danger: resolvedCssValue(resolve, source.danger, fallback.danger),
|
|
38
|
+
warning: resolvedCssValue(resolve, source.warning, fallback.warning),
|
|
39
|
+
info: resolvedCssValue(resolve, source.info, fallback.info),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function typographyTokens(resolve) {
|
|
43
|
+
const source = theme_data_js_1.SOURCE_EXTENSION_THEME_CSS_VARIABLES.typography;
|
|
44
|
+
const fallback = theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.typography;
|
|
45
|
+
return {
|
|
46
|
+
sansFamily: resolvedCssValue(resolve, source.sansFamily, fallback.sansFamily),
|
|
47
|
+
monoFamily: resolvedCssValue(resolve, source.monoFamily, fallback.monoFamily),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function radiusTokens(resolve) {
|
|
51
|
+
const fallback = theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.radius;
|
|
52
|
+
return {
|
|
53
|
+
sm: fallback.sm,
|
|
54
|
+
md: fallback.md,
|
|
55
|
+
lg: fallback.lg,
|
|
56
|
+
panel: resolvedCssValue(resolve, theme_data_js_1.SOURCE_EXTENSION_THEME_CSS_VARIABLES.radius.panel, fallback.panel),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function hasStringKeys(value, keys) {
|
|
60
|
+
if (!(0, internal_validation_js_1.isRecord)(value)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
for (const key of keys) {
|
|
64
|
+
if (typeof value[key] !== 'string') {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
function hasThemeTokenGroups(value) {
|
|
71
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
72
|
+
hasStringKeys(value.color, theme_data_js_1.EXTENSION_THEME_COLOR_KEYS) &&
|
|
73
|
+
hasStringKeys(value.typography, theme_data_js_1.EXTENSION_THEME_TYPOGRAPHY_KEYS) &&
|
|
74
|
+
hasStringKeys(value.spacing, theme_data_js_1.EXTENSION_THEME_SPACING_KEYS) &&
|
|
75
|
+
hasStringKeys(value.radius, theme_data_js_1.EXTENSION_THEME_RADIUS_KEYS) &&
|
|
76
|
+
hasStringKeys(value.focus, theme_data_js_1.EXTENSION_THEME_FOCUS_KEYS) &&
|
|
77
|
+
hasStringKeys(value.elevation, theme_data_js_1.EXTENSION_THEME_ELEVATION_KEYS));
|
|
78
|
+
}
|
|
79
|
+
function createOpenWaggleExtensionTheme(options = {}) {
|
|
80
|
+
const resolve = options.resolveCssVariable;
|
|
81
|
+
return {
|
|
82
|
+
colorScheme: 'dark',
|
|
83
|
+
tokens: {
|
|
84
|
+
color: colorTokens(resolve),
|
|
85
|
+
typography: typographyTokens(resolve),
|
|
86
|
+
spacing: theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.spacing,
|
|
87
|
+
radius: radiusTokens(resolve),
|
|
88
|
+
focus: theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.focus,
|
|
89
|
+
elevation: theme_data_js_1.DEFAULT_EXTENSION_THEME_TOKENS.elevation,
|
|
90
|
+
},
|
|
91
|
+
cssVariables: theme_data_js_1.OPENWAGGLE_EXTENSION_THEME_CSS_VARIABLES,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function extensionThemeCssVariableEntries(theme) {
|
|
95
|
+
return [
|
|
96
|
+
{ name: theme.cssVariables.color.background, value: theme.tokens.color.background },
|
|
97
|
+
{ name: theme.cssVariables.color.surface, value: theme.tokens.color.surface },
|
|
98
|
+
{ name: theme.cssVariables.color.surfaceRaised, value: theme.tokens.color.surfaceRaised },
|
|
99
|
+
{ name: theme.cssVariables.color.surfaceHover, value: theme.tokens.color.surfaceHover },
|
|
100
|
+
{ name: theme.cssVariables.color.surfaceActive, value: theme.tokens.color.surfaceActive },
|
|
101
|
+
{ name: theme.cssVariables.color.border, value: theme.tokens.color.border },
|
|
102
|
+
{ name: theme.cssVariables.color.borderStrong, value: theme.tokens.color.borderStrong },
|
|
103
|
+
{ name: theme.cssVariables.color.text, value: theme.tokens.color.text },
|
|
104
|
+
{ name: theme.cssVariables.color.textSubtle, value: theme.tokens.color.textSubtle },
|
|
105
|
+
{ name: theme.cssVariables.color.textMuted, value: theme.tokens.color.textMuted },
|
|
106
|
+
{ name: theme.cssVariables.color.textDim, value: theme.tokens.color.textDim },
|
|
107
|
+
{ name: theme.cssVariables.color.accent, value: theme.tokens.color.accent },
|
|
108
|
+
{ name: theme.cssVariables.color.accentDim, value: theme.tokens.color.accentDim },
|
|
109
|
+
{ name: theme.cssVariables.color.success, value: theme.tokens.color.success },
|
|
110
|
+
{ name: theme.cssVariables.color.danger, value: theme.tokens.color.danger },
|
|
111
|
+
{ name: theme.cssVariables.color.warning, value: theme.tokens.color.warning },
|
|
112
|
+
{ name: theme.cssVariables.color.info, value: theme.tokens.color.info },
|
|
113
|
+
{ name: theme.cssVariables.typography.sansFamily, value: theme.tokens.typography.sansFamily },
|
|
114
|
+
{ name: theme.cssVariables.typography.monoFamily, value: theme.tokens.typography.monoFamily },
|
|
115
|
+
{ name: theme.cssVariables.spacing.xs, value: theme.tokens.spacing.xs },
|
|
116
|
+
{ name: theme.cssVariables.spacing.sm, value: theme.tokens.spacing.sm },
|
|
117
|
+
{ name: theme.cssVariables.spacing.md, value: theme.tokens.spacing.md },
|
|
118
|
+
{ name: theme.cssVariables.spacing.lg, value: theme.tokens.spacing.lg },
|
|
119
|
+
{ name: theme.cssVariables.spacing.xl, value: theme.tokens.spacing.xl },
|
|
120
|
+
{ name: theme.cssVariables.radius.sm, value: theme.tokens.radius.sm },
|
|
121
|
+
{ name: theme.cssVariables.radius.md, value: theme.tokens.radius.md },
|
|
122
|
+
{ name: theme.cssVariables.radius.lg, value: theme.tokens.radius.lg },
|
|
123
|
+
{ name: theme.cssVariables.radius.panel, value: theme.tokens.radius.panel },
|
|
124
|
+
{ name: theme.cssVariables.focus.ring, value: theme.tokens.focus.ring },
|
|
125
|
+
{ name: theme.cssVariables.focus.shadow, value: theme.tokens.focus.shadow },
|
|
126
|
+
{ name: theme.cssVariables.elevation.card, value: theme.tokens.elevation.card },
|
|
127
|
+
{ name: theme.cssVariables.elevation.overlay, value: theme.tokens.elevation.overlay },
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
function isOpenWaggleExtensionTheme(value) {
|
|
131
|
+
return ((0, internal_validation_js_1.isRecord)(value) &&
|
|
132
|
+
value.colorScheme === 'dark' &&
|
|
133
|
+
hasThemeTokenGroups(value.tokens) &&
|
|
134
|
+
hasThemeTokenGroups(value.cssVariables));
|
|
135
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES = exports.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES = void 0;
|
|
4
|
+
exports.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES = {
|
|
5
|
+
root: 'ow-extension-root',
|
|
6
|
+
panel: 'ow-extension-panel',
|
|
7
|
+
stack: 'ow-extension-stack',
|
|
8
|
+
row: 'ow-extension-row',
|
|
9
|
+
heading: 'ow-extension-heading',
|
|
10
|
+
text: 'ow-extension-text',
|
|
11
|
+
muted: 'ow-extension-muted',
|
|
12
|
+
divider: 'ow-extension-divider',
|
|
13
|
+
button: 'ow-extension-button',
|
|
14
|
+
input: 'ow-extension-input',
|
|
15
|
+
textarea: 'ow-extension-textarea',
|
|
16
|
+
select: 'ow-extension-select',
|
|
17
|
+
checkbox: 'ow-extension-checkbox',
|
|
18
|
+
badge: 'ow-extension-badge',
|
|
19
|
+
field: 'ow-extension-field',
|
|
20
|
+
alert: 'ow-extension-alert',
|
|
21
|
+
};
|
|
22
|
+
exports.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES = {
|
|
23
|
+
tone: 'data-ow-tone',
|
|
24
|
+
variant: 'data-ow-variant',
|
|
25
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extensionThemeCssVariableDeclarations = extensionThemeCssVariableDeclarations;
|
|
4
|
+
exports.createOpenWaggleExtensionUiStylesheet = createOpenWaggleExtensionUiStylesheet;
|
|
5
|
+
const theme_js_1 = require("./theme.js");
|
|
6
|
+
const ui_constants_js_1 = require("./ui-constants.js");
|
|
7
|
+
const DEFAULT_UI_SCOPE_SELECTOR = `.${ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES.root}`;
|
|
8
|
+
function extensionThemeCssVariableDeclarations(theme = (0, theme_js_1.createOpenWaggleExtensionTheme)()) {
|
|
9
|
+
const declarations = [];
|
|
10
|
+
for (const entry of (0, theme_js_1.extensionThemeCssVariableEntries)(theme)) {
|
|
11
|
+
declarations.push(` ${entry.name}: ${entry.value};`);
|
|
12
|
+
}
|
|
13
|
+
return declarations.join('\n');
|
|
14
|
+
}
|
|
15
|
+
function themeVariableRule(theme, selector) {
|
|
16
|
+
return `${selector} {
|
|
17
|
+
${extensionThemeCssVariableDeclarations(theme)}
|
|
18
|
+
}`;
|
|
19
|
+
}
|
|
20
|
+
function baseUiRules(selector) {
|
|
21
|
+
const classes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES;
|
|
22
|
+
return `${selector} {
|
|
23
|
+
color: var(--ow-color-text);
|
|
24
|
+
font-family: var(--ow-font-family-sans);
|
|
25
|
+
font-size: 13px;
|
|
26
|
+
line-height: 1.45;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
${selector} *,
|
|
31
|
+
${selector} *::before,
|
|
32
|
+
${selector} *::after {
|
|
33
|
+
box-sizing: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${selector} .${classes.panel} {
|
|
37
|
+
background: var(--ow-color-surface);
|
|
38
|
+
border: 1px solid var(--ow-color-border);
|
|
39
|
+
border-radius: var(--ow-radius-panel);
|
|
40
|
+
box-shadow: var(--ow-elevation-card);
|
|
41
|
+
padding: var(--ow-space-lg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${selector} .${classes.stack} {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--ow-space-md);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
${selector} .${classes.row} {
|
|
51
|
+
align-items: center;
|
|
52
|
+
display: flex;
|
|
53
|
+
gap: var(--ow-space-sm);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
${selector} .${classes.heading} {
|
|
57
|
+
color: var(--ow-color-text);
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
font-weight: 650;
|
|
60
|
+
line-height: 1.25;
|
|
61
|
+
margin: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
${selector} .${classes.text} {
|
|
65
|
+
color: var(--ow-color-text-subtle);
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
${selector} .${classes.muted} {
|
|
70
|
+
color: var(--ow-color-text-muted);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${selector} .${classes.divider} {
|
|
74
|
+
background: var(--ow-color-border);
|
|
75
|
+
border: 0;
|
|
76
|
+
height: 1px;
|
|
77
|
+
margin: var(--ow-space-xs) 0;
|
|
78
|
+
}`;
|
|
79
|
+
}
|
|
80
|
+
function controlUiRules(selector) {
|
|
81
|
+
const classes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES;
|
|
82
|
+
const attributes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES;
|
|
83
|
+
return `${selector} .${classes.button} {
|
|
84
|
+
align-items: center;
|
|
85
|
+
background: var(--ow-color-surface-raised);
|
|
86
|
+
border: 1px solid var(--ow-color-border-strong);
|
|
87
|
+
border-radius: var(--ow-radius-md);
|
|
88
|
+
color: var(--ow-color-text);
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
font: inherit;
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
gap: var(--ow-space-sm);
|
|
94
|
+
justify-content: center;
|
|
95
|
+
min-height: 32px;
|
|
96
|
+
padding: 0 var(--ow-space-md);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
${selector} .${classes.button}:focus-visible,
|
|
100
|
+
${selector} .${classes.input}:focus-visible,
|
|
101
|
+
${selector} .${classes.textarea}:focus-visible,
|
|
102
|
+
${selector} .${classes.select}:focus-visible,
|
|
103
|
+
${selector} .${classes.checkbox}:focus-visible {
|
|
104
|
+
box-shadow: var(--ow-focus-shadow);
|
|
105
|
+
outline: 1px solid var(--ow-focus-ring);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
${selector} .${classes.button}[${attributes.variant}="primary"] {
|
|
109
|
+
background: var(--ow-color-accent);
|
|
110
|
+
border-color: var(--ow-color-accent);
|
|
111
|
+
color: var(--ow-color-background);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
${selector} .${classes.button}[${attributes.variant}="ghost"] {
|
|
115
|
+
background: transparent;
|
|
116
|
+
border-color: transparent;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
${selector} .${classes.input},
|
|
120
|
+
${selector} .${classes.textarea},
|
|
121
|
+
${selector} .${classes.select} {
|
|
122
|
+
background: var(--ow-color-surface-raised);
|
|
123
|
+
border: 1px solid var(--ow-color-border-strong);
|
|
124
|
+
border-radius: var(--ow-radius-md);
|
|
125
|
+
color: var(--ow-color-text);
|
|
126
|
+
font: inherit;
|
|
127
|
+
min-height: 32px;
|
|
128
|
+
padding: 0 var(--ow-space-md);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
${selector} .${classes.textarea} {
|
|
132
|
+
min-height: 88px;
|
|
133
|
+
padding-bottom: var(--ow-space-sm);
|
|
134
|
+
padding-top: var(--ow-space-sm);
|
|
135
|
+
resize: vertical;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
${selector} .${classes.input}::placeholder,
|
|
139
|
+
${selector} .${classes.textarea}::placeholder {
|
|
140
|
+
color: var(--ow-color-text-dim);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
${selector} .${classes.checkbox} {
|
|
144
|
+
accent-color: var(--ow-color-accent);
|
|
145
|
+
min-height: 16px;
|
|
146
|
+
min-width: 16px;
|
|
147
|
+
}`;
|
|
148
|
+
}
|
|
149
|
+
function badgeUiRules(selector) {
|
|
150
|
+
const classes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES;
|
|
151
|
+
const attributes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES;
|
|
152
|
+
return `${selector} .${classes.badge},
|
|
153
|
+
${selector} .${classes.alert} {
|
|
154
|
+
align-items: center;
|
|
155
|
+
background: var(--ow-color-surface-raised);
|
|
156
|
+
border: 1px solid var(--ow-color-border);
|
|
157
|
+
border-radius: var(--ow-radius-sm);
|
|
158
|
+
color: var(--ow-color-text-muted);
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
font-size: 12px;
|
|
161
|
+
font-weight: 600;
|
|
162
|
+
gap: var(--ow-space-xs);
|
|
163
|
+
line-height: 1;
|
|
164
|
+
padding: var(--ow-space-xs) var(--ow-space-sm);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
${selector} .${classes.alert} {
|
|
168
|
+
align-items: flex-start;
|
|
169
|
+
border-radius: var(--ow-radius-md);
|
|
170
|
+
line-height: 1.4;
|
|
171
|
+
padding: var(--ow-space-md);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
${selector} .${classes.badge}[${attributes.tone}="accent"],
|
|
175
|
+
${selector} .${classes.alert}[${attributes.tone}="accent"] {
|
|
176
|
+
border-color: var(--ow-color-accent-dim);
|
|
177
|
+
color: var(--ow-color-accent);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
${selector} .${classes.badge}[${attributes.tone}="success"],
|
|
181
|
+
${selector} .${classes.alert}[${attributes.tone}="success"] {
|
|
182
|
+
color: var(--ow-color-success);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
${selector} .${classes.badge}[${attributes.tone}="warning"],
|
|
186
|
+
${selector} .${classes.alert}[${attributes.tone}="warning"] {
|
|
187
|
+
color: var(--ow-color-warning);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
${selector} .${classes.badge}[${attributes.tone}="danger"],
|
|
191
|
+
${selector} .${classes.alert}[${attributes.tone}="danger"] {
|
|
192
|
+
color: var(--ow-color-danger);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
${selector} .${classes.badge}[${attributes.tone}="info"],
|
|
196
|
+
${selector} .${classes.alert}[${attributes.tone}="info"] {
|
|
197
|
+
color: var(--ow-color-info);
|
|
198
|
+
}`;
|
|
199
|
+
}
|
|
200
|
+
function formUiRules(selector) {
|
|
201
|
+
const classes = ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES;
|
|
202
|
+
return `${selector} .${classes.field} {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
gap: var(--ow-space-xs);
|
|
206
|
+
}`;
|
|
207
|
+
}
|
|
208
|
+
function extensionUiRules(selector) {
|
|
209
|
+
return `${baseUiRules(selector)}
|
|
210
|
+
|
|
211
|
+
${controlUiRules(selector)}
|
|
212
|
+
|
|
213
|
+
${badgeUiRules(selector)}
|
|
214
|
+
|
|
215
|
+
${formUiRules(selector)}`;
|
|
216
|
+
}
|
|
217
|
+
function createOpenWaggleExtensionUiStylesheet(options = {}) {
|
|
218
|
+
const theme = options.theme ?? (0, theme_js_1.createOpenWaggleExtensionTheme)();
|
|
219
|
+
const selector = options.scopeSelector ?? DEFAULT_UI_SCOPE_SELECTOR;
|
|
220
|
+
const rules = extensionUiRules(selector);
|
|
221
|
+
if (options.includeThemeVariables === false) {
|
|
222
|
+
return rules;
|
|
223
|
+
}
|
|
224
|
+
return `${themeVariableRule(theme, selector)}
|
|
225
|
+
|
|
226
|
+
${rules}`;
|
|
227
|
+
}
|
package/dist-cjs/ui.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extensionThemeCssVariableDeclarations = exports.createOpenWaggleExtensionUiStylesheet = exports.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES = exports.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES = void 0;
|
|
4
|
+
exports.openWaggleExtensionClassName = openWaggleExtensionClassName;
|
|
5
|
+
var ui_constants_js_1 = require("./ui-constants.js");
|
|
6
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_UI_ATTRIBUTES", { enumerable: true, get: function () { return ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_ATTRIBUTES; } });
|
|
7
|
+
Object.defineProperty(exports, "OPENWAGGLE_EXTENSION_UI_CLASS_NAMES", { enumerable: true, get: function () { return ui_constants_js_1.OPENWAGGLE_EXTENSION_UI_CLASS_NAMES; } });
|
|
8
|
+
const EMPTY_LENGTH = 0;
|
|
9
|
+
function openWaggleExtensionClassName(...parts) {
|
|
10
|
+
const classNames = [];
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
if (typeof part !== 'string') {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const className = part.trim();
|
|
16
|
+
if (className.length > EMPTY_LENGTH) {
|
|
17
|
+
classNames.push(className);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return classNames.join(' ');
|
|
21
|
+
}
|
|
22
|
+
var ui_stylesheet_js_1 = require("./ui-stylesheet.js");
|
|
23
|
+
Object.defineProperty(exports, "createOpenWaggleExtensionUiStylesheet", { enumerable: true, get: function () { return ui_stylesheet_js_1.createOpenWaggleExtensionUiStylesheet; } });
|
|
24
|
+
Object.defineProperty(exports, "extensionThemeCssVariableDeclarations", { enumerable: true, get: function () { return ui_stylesheet_js_1.extensionThemeCssVariableDeclarations; } });
|
package/package.json
CHANGED
|
@@ -1,12 +1,102 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "Namespace-only bootstrap placeholder. This package contains no runtime code.",
|
|
3
|
-
"files": [],
|
|
4
|
-
"license": "UNLICENSED",
|
|
5
2
|
"name": "@openwaggle/extension-sdk",
|
|
6
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Browser-safe OpenWaggle extension SDK schemas, types, broker helpers, theme tokens, and federated-module context helpers.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.19.0"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/OpenWaggle/OpenWaggle.git",
|
|
13
|
+
"directory": "packages/extension-sdk"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"openwaggle",
|
|
17
|
+
"extensions",
|
|
18
|
+
"sdk"
|
|
19
|
+
],
|
|
7
20
|
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"effect": "3.21.2"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"dist-cjs",
|
|
30
|
+
"CHANGELOG.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist-cjs/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./agent-loop": {
|
|
41
|
+
"types": "./dist/agent-loop.d.ts",
|
|
42
|
+
"import": "./dist/agent-loop.js",
|
|
43
|
+
"require": "./dist-cjs/agent-loop.js"
|
|
44
|
+
},
|
|
45
|
+
"./broker": {
|
|
46
|
+
"types": "./dist/broker.d.ts",
|
|
47
|
+
"import": "./dist/broker.js",
|
|
48
|
+
"require": "./dist-cjs/broker.js"
|
|
49
|
+
},
|
|
50
|
+
"./constants": {
|
|
51
|
+
"types": "./dist/constants.d.ts",
|
|
52
|
+
"import": "./dist/constants.js",
|
|
53
|
+
"require": "./dist-cjs/constants.js"
|
|
54
|
+
},
|
|
55
|
+
"./context": {
|
|
56
|
+
"types": "./dist/context.d.ts",
|
|
57
|
+
"import": "./dist/context.js",
|
|
58
|
+
"require": "./dist-cjs/context.js"
|
|
59
|
+
},
|
|
60
|
+
"./docs": {
|
|
61
|
+
"types": "./dist/docs.d.ts",
|
|
62
|
+
"import": "./dist/docs.js",
|
|
63
|
+
"require": "./dist-cjs/docs.js"
|
|
64
|
+
},
|
|
65
|
+
"./json": {
|
|
66
|
+
"types": "./dist/json.d.ts",
|
|
67
|
+
"import": "./dist/json.js",
|
|
68
|
+
"require": "./dist-cjs/json.js"
|
|
69
|
+
},
|
|
70
|
+
"./manifest": {
|
|
71
|
+
"types": "./dist/manifest.d.ts",
|
|
72
|
+
"import": "./dist/manifest.js",
|
|
73
|
+
"require": "./dist-cjs/manifest.js"
|
|
74
|
+
},
|
|
75
|
+
"./runtime": {
|
|
76
|
+
"types": "./dist/runtime.d.ts",
|
|
77
|
+
"import": "./dist/runtime.js",
|
|
78
|
+
"require": "./dist-cjs/runtime.js"
|
|
79
|
+
},
|
|
80
|
+
"./theme": {
|
|
81
|
+
"types": "./dist/theme.d.ts",
|
|
82
|
+
"import": "./dist/theme.js",
|
|
83
|
+
"require": "./dist-cjs/theme.js"
|
|
84
|
+
},
|
|
85
|
+
"./types": {
|
|
86
|
+
"types": "./dist/types.d.ts",
|
|
87
|
+
"import": "./dist/types.js",
|
|
88
|
+
"require": "./dist-cjs/types.js"
|
|
89
|
+
},
|
|
90
|
+
"./ui": {
|
|
91
|
+
"types": "./dist/ui.d.ts",
|
|
92
|
+
"import": "./dist/ui.js",
|
|
93
|
+
"require": "./dist-cjs/ui.js"
|
|
94
|
+
}
|
|
10
95
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
96
|
+
"types": "./dist/index.d.ts",
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.cjs.json && tsx ../../scripts/write-cjs-package-json.ts",
|
|
99
|
+
"typecheck": "tsc -p tsconfig.build.json --noEmit",
|
|
100
|
+
"pack:check": "pnpm build && pnpm pack --pack-destination .pack --json"
|
|
101
|
+
}
|
|
102
|
+
}
|