@colixsystems/widget-sdk 0.198.0 → 0.199.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/README.md +92 -3
- package/dist/bundled-assets-fs.js +60 -0
- package/dist/bundled-assets.cjs +239 -0
- package/dist/bundled-assets.js +239 -0
- package/dist/cli.js +52 -11
- package/dist/contract.cjs +42 -3
- package/dist/contract.js +42 -3
- package/dist/devserver.js +68 -10
- package/dist/hooks.js +14 -0
- package/dist/index.d.ts +70 -1
- package/dist/index.js +6 -0
- package/dist/index.native.js +6 -0
- package/dist/linter.cjs +28 -0
- package/dist/linter.js +28 -0
- package/dist/manifest.cjs +1 -0
- package/dist/manifest.js +1 -0
- package/package.json +7 -1
- package/src/contract.js +42 -3
package/dist/manifest.cjs
CHANGED
package/dist/manifest.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colixsystems/widget-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.199.0",
|
|
4
4
|
"description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
|
|
5
5
|
"homepage": "https://github.com/Colix-AB/AppStudio",
|
|
6
6
|
"type": "module",
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
"import": "./dist/contract.js",
|
|
36
36
|
"default": "./dist/contract.cjs"
|
|
37
37
|
},
|
|
38
|
+
"./bundled-assets": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"require": "./dist/bundled-assets.cjs",
|
|
41
|
+
"import": "./dist/bundled-assets.js",
|
|
42
|
+
"default": "./dist/bundled-assets.cjs"
|
|
43
|
+
},
|
|
38
44
|
"./src/webbundle.js": "./src/webbundle.js"
|
|
39
45
|
},
|
|
40
46
|
"bin": {
|
package/src/contract.js
CHANGED
|
@@ -1171,6 +1171,20 @@ const HOOKS = [
|
|
|
1171
1171
|
requiredContextSlice: ["assets.list"],
|
|
1172
1172
|
scopes: null,
|
|
1173
1173
|
},
|
|
1174
|
+
{
|
|
1175
|
+
name: "useBundledAsset",
|
|
1176
|
+
signature: "useBundledAsset(fileName)",
|
|
1177
|
+
description:
|
|
1178
|
+
"Returns the URL of an image or sound file the widget package ships in " +
|
|
1179
|
+
"its assets/ directory, or null when the package has no file with that " +
|
|
1180
|
+
"name. Only an uploaded package can bundle files; a widget written in " +
|
|
1181
|
+
"the Studio has none.",
|
|
1182
|
+
returnShape: {
|
|
1183
|
+
"(returns)": "string | null",
|
|
1184
|
+
},
|
|
1185
|
+
requiredContextSlice: ["widget.assets"],
|
|
1186
|
+
scopes: null,
|
|
1187
|
+
},
|
|
1174
1188
|
{
|
|
1175
1189
|
name: "useFilestoreFiles",
|
|
1176
1190
|
signature: "useFilestoreFiles({ spaceType, recordId, folderId, q, type })",
|
|
@@ -2884,6 +2898,19 @@ const ACTION_SCRIPT_GLOBALS = [
|
|
|
2884
2898
|
// Mirrors action.service.js SCRIPT_MAX_BYTES.
|
|
2885
2899
|
const ACTION_SCRIPT_MAX_BYTES = 200 * 1024;
|
|
2886
2900
|
|
|
2901
|
+
// The one package size limit; the backend derives its upload caps from it.
|
|
2902
|
+
const PACKAGE_MAX_BYTES = 12 * 1024 * 1024;
|
|
2903
|
+
|
|
2904
|
+
const BUNDLED_ASSETS = {
|
|
2905
|
+
directory: "assets",
|
|
2906
|
+
maxFiles: 50,
|
|
2907
|
+
maxNameLength: 64,
|
|
2908
|
+
types: {
|
|
2909
|
+
image: { extensions: ["png", "jpg", "jpeg", "gif", "webp"] },
|
|
2910
|
+
audio: { extensions: ["mp3", "m4a", "wav"] },
|
|
2911
|
+
},
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2887
2914
|
/**
|
|
2888
2915
|
* sc-4915 — the trigger set a manifest action declares, canonically ordered.
|
|
2889
2916
|
*
|
|
@@ -3067,9 +3094,15 @@ const WIDGET_CONTEXT_SHAPE = {
|
|
|
3067
3094
|
},
|
|
3068
3095
|
widget: {
|
|
3069
3096
|
description:
|
|
3070
|
-
"Identity of the currently rendered widget instance ({ id, version })
|
|
3097
|
+
"Identity of the currently rendered widget instance ({ id, version }) " +
|
|
3098
|
+
"and the files its package bundles.",
|
|
3071
3099
|
required: true,
|
|
3072
|
-
fields: {
|
|
3100
|
+
fields: {
|
|
3101
|
+
id: "manifest.id",
|
|
3102
|
+
version: "manifest.version",
|
|
3103
|
+
assets:
|
|
3104
|
+
"{ [fileName]: string } — bundled file name → absolute URL; {} when the package bundles nothing",
|
|
3105
|
+
},
|
|
3073
3106
|
},
|
|
3074
3107
|
// REQ-LAY-08 — optional host layout hint backing useFill(). True when the
|
|
3075
3108
|
// host sized this widget to fill its layout slot's available height (a
|
|
@@ -5264,7 +5297,11 @@ const CONTRACT = deepFreeze({
|
|
|
5264
5297
|
// asset carrying `durationMs`. New `useHardwareBack(handler)` walks a
|
|
5265
5298
|
// widget's own pages on Android's back button (optional
|
|
5266
5299
|
// `ctx.navigation.onHardwareBack`; unsupported on the web).
|
|
5267
|
-
|
|
5300
|
+
// 1.159.0: additive (sc-10721) — a package may ship images and sounds in a
|
|
5301
|
+
// flat `assets/` directory (`bundledAssets`, within `packageMaxBytes`).
|
|
5302
|
+
// New `useBundledAsset(fileName)` resolves one through the new
|
|
5303
|
+
// `widget.assets` map; linter rule `bundled-asset-missing` (error).
|
|
5304
|
+
version: "1.159.0",
|
|
5268
5305
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
5269
5306
|
hooks: HOOKS,
|
|
5270
5307
|
primitives: PRIMITIVES,
|
|
@@ -5274,6 +5311,8 @@ const CONTRACT = deepFreeze({
|
|
|
5274
5311
|
actionTriggerTypes: ACTION_TRIGGER_TYPES,
|
|
5275
5312
|
actionScriptGlobals: ACTION_SCRIPT_GLOBALS,
|
|
5276
5313
|
actionScriptMaxBytes: ACTION_SCRIPT_MAX_BYTES,
|
|
5314
|
+
packageMaxBytes: PACKAGE_MAX_BYTES,
|
|
5315
|
+
bundledAssets: BUNDLED_ASSETS,
|
|
5277
5316
|
themeTokens: DEFAULT_THEME_TOKENS,
|
|
5278
5317
|
themeColorTokens: THEME_COLOR_TOKENS,
|
|
5279
5318
|
themeComponents: THEME_COMPONENTS,
|