@floegence/redevplugin-ui 0.6.22 → 0.6.24

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.
@@ -128,11 +128,26 @@ export declare const redevPluginContractArtifacts: readonly [{
128
128
  readonly path: "spec/plugin/host-capability-pin-v1.schema.json";
129
129
  readonly version: "host-capability-pin-v1";
130
130
  readonly sha256: "20526a5934f0d85a3db7882492487266f09de5bcd176e2c7936f05d0b7fe0338";
131
+ }, {
132
+ readonly id: "host-capability-publisher-config-schema";
133
+ readonly path: "spec/plugin/host-capability-publisher-config-v1.schema.json";
134
+ readonly version: "host-capability-publisher-config-v1";
135
+ readonly sha256: "f06ab3d70f3f9dd2114fe9d489841f1d6b5f169ee17b8c92aa1bfaf9bbf865c4";
131
136
  }, {
132
137
  readonly id: "host-capability-signature-schema";
133
138
  readonly path: "spec/plugin/host-capability-signature-v1.schema.json";
134
139
  readonly version: "host-capability-signature-v1";
135
140
  readonly sha256: "88cbc1d63afb7e289ca4f8b7c76f702b8d20156f7722c1b71f3ab9138a240a5e";
141
+ }, {
142
+ readonly id: "host-capability-signer-request-schema";
143
+ readonly path: "spec/plugin/host-capability-signer-request-v1.schema.json";
144
+ readonly version: "host-capability-signer-request-v1";
145
+ readonly sha256: "7f22e9e0f813b91106693edfbb91309489dde1640152c29d878961fdef6b89d8";
146
+ }, {
147
+ readonly id: "host-capability-signer-response-schema";
148
+ readonly path: "spec/plugin/host-capability-signer-response-v1.schema.json";
149
+ readonly version: "host-capability-signer-response-v1";
150
+ readonly sha256: "02a50b1fc0d1b8ae0611eab95b5560122c6425709ecc8de5e00bf0dd68085f44";
136
151
  }, {
137
152
  readonly id: "iframe-bridge-schema";
138
153
  readonly path: "spec/plugin/bridge-v7.schema.json";
@@ -122,12 +122,30 @@ export const redevPluginContractArtifacts = [
122
122
  version: "host-capability-pin-v1",
123
123
  sha256: "20526a5934f0d85a3db7882492487266f09de5bcd176e2c7936f05d0b7fe0338",
124
124
  },
125
+ {
126
+ id: "host-capability-publisher-config-schema",
127
+ path: "spec/plugin/host-capability-publisher-config-v1.schema.json",
128
+ version: "host-capability-publisher-config-v1",
129
+ sha256: "f06ab3d70f3f9dd2114fe9d489841f1d6b5f169ee17b8c92aa1bfaf9bbf865c4",
130
+ },
125
131
  {
126
132
  id: "host-capability-signature-schema",
127
133
  path: "spec/plugin/host-capability-signature-v1.schema.json",
128
134
  version: "host-capability-signature-v1",
129
135
  sha256: "88cbc1d63afb7e289ca4f8b7c76f702b8d20156f7722c1b71f3ab9138a240a5e",
130
136
  },
137
+ {
138
+ id: "host-capability-signer-request-schema",
139
+ path: "spec/plugin/host-capability-signer-request-v1.schema.json",
140
+ version: "host-capability-signer-request-v1",
141
+ sha256: "7f22e9e0f813b91106693edfbb91309489dde1640152c29d878961fdef6b89d8",
142
+ },
143
+ {
144
+ id: "host-capability-signer-response-schema",
145
+ path: "spec/plugin/host-capability-signer-response-v1.schema.json",
146
+ version: "host-capability-signer-response-v1",
147
+ sha256: "02a50b1fc0d1b8ae0611eab95b5560122c6425709ecc8de5e00bf0dd68085f44",
148
+ },
131
149
  {
132
150
  id: "iframe-bridge-schema",
133
151
  path: "spec/plugin/bridge-v7.schema.json",
@@ -0,0 +1,2 @@
1
+ export { Fragment, jsxDEV } from "./jsx-runtime.js";
2
+ export type { JSX } from "./jsx-runtime.js";
@@ -0,0 +1 @@
1
+ export { Fragment, jsxDEV } from "./jsx-runtime.js";
@@ -0,0 +1,27 @@
1
+ import type { OpaqueSurfaceAllowedTag } from "./opaque-surface-policy.gen.js";
2
+ import { type PluginUIElementVNode, type PluginUIVNode } from "./ui-reconciler.js";
3
+ export declare const Fragment: unique symbol;
4
+ export type PluginUIJSXChild = PluginUIVNode | string | number | boolean | null | undefined | readonly PluginUIJSXChild[];
5
+ export type PluginUIJSXProps = {
6
+ children?: PluginUIJSXChild;
7
+ [name: string]: unknown;
8
+ };
9
+ type PluginUIJSXType = OpaqueSurfaceAllowedTag | typeof Fragment | ((props: PluginUIJSXProps) => unknown);
10
+ export declare function jsx(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string): PluginUIElementVNode;
11
+ export declare function jsxs(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string): PluginUIElementVNode;
12
+ export declare function jsxDEV(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string, _isStaticChildren?: boolean, _source?: unknown, _self?: unknown): PluginUIElementVNode;
13
+ export declare namespace JSX {
14
+ type Element = PluginUIElementVNode;
15
+ interface ElementChildrenAttribute {
16
+ children: unknown;
17
+ }
18
+ interface IntrinsicAttributes {
19
+ key: string;
20
+ }
21
+ type IntrinsicElements = {
22
+ [Tag in OpaqueSurfaceAllowedTag]: PluginUIJSXProps & {
23
+ key: string;
24
+ };
25
+ };
26
+ }
27
+ export {};
@@ -0,0 +1,84 @@
1
+ import { validatePluginUITree, } from "./ui-reconciler.js";
2
+ export const Fragment = Symbol("ReDevPlugin.Fragment");
3
+ const keyPattern = new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$");
4
+ const attributeAliases = new Map([
5
+ ["autoComplete", "autocomplete"],
6
+ ["className", "class"],
7
+ ["htmlFor", "for"],
8
+ ["maxLength", "maxlength"],
9
+ ["readOnly", "readonly"],
10
+ ["tabIndex", "tabindex"],
11
+ ]);
12
+ export function jsx(type, props, key) {
13
+ return createElement(type, props, key);
14
+ }
15
+ export function jsxs(type, props, key) {
16
+ return createElement(type, props, key);
17
+ }
18
+ export function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
19
+ return createElement(type, props, key);
20
+ }
21
+ function createElement(type, props, key) {
22
+ if (type === Fragment)
23
+ throw new TypeError("ReDevPlugin JSX does not support Fragment; use one keyed intrinsic element");
24
+ if (typeof type !== "string")
25
+ throw new TypeError("ReDevPlugin JSX supports intrinsic elements only");
26
+ if (typeof key !== "string" || !keyPattern.test(key)) {
27
+ throw new TypeError("ReDevPlugin JSX elements require a valid stable key");
28
+ }
29
+ const attributes = {};
30
+ const source = props ?? {};
31
+ for (const [rawName, value] of Object.entries(source)) {
32
+ if (rawName === "children" || rawName === "key" || value === undefined)
33
+ continue;
34
+ const name = attributeAliases.get(rawName) ?? rawName;
35
+ if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
36
+ throw new TypeError(`ReDevPlugin JSX attribute ${rawName} must be a string, number, or boolean`);
37
+ }
38
+ attributes[name] = value;
39
+ }
40
+ const children = [];
41
+ appendChildren(children, source.children, key, []);
42
+ const tree = {
43
+ type: "element",
44
+ key,
45
+ tag: type,
46
+ ...(Object.keys(attributes).length > 0 ? { attributes } : {}),
47
+ ...(children.length > 0 ? { children } : {}),
48
+ };
49
+ return validatePluginUITree(tree);
50
+ }
51
+ function appendChildren(target, value, parentKey, path) {
52
+ if (value === null || value === undefined || typeof value === "boolean")
53
+ return;
54
+ if (Array.isArray(value)) {
55
+ value.forEach((child, index) => appendChildren(target, child, parentKey, [...path, index]));
56
+ return;
57
+ }
58
+ if (typeof value === "string" || typeof value === "number") {
59
+ const textPath = path.length > 0 ? path : [0];
60
+ target.push({ type: "text", key: textKey(parentKey, textPath), text: String(value) });
61
+ return;
62
+ }
63
+ if (typeof value === "object") {
64
+ target.push(value);
65
+ return;
66
+ }
67
+ throw new TypeError("ReDevPlugin JSX children must be VNodes or renderable primitive values");
68
+ }
69
+ function textKey(parentKey, path) {
70
+ const suffix = `.text.${path.join(".")}`;
71
+ const candidate = parentKey + suffix;
72
+ if (candidate.length <= 128)
73
+ return candidate;
74
+ const hashSuffix = `.text.${fnv1a(candidate)}`;
75
+ return parentKey.slice(0, 128 - hashSuffix.length) + hashSuffix;
76
+ }
77
+ function fnv1a(value) {
78
+ let hash = 0x811c9dc5;
79
+ for (let index = 0; index < value.length; index += 1) {
80
+ hash ^= value.charCodeAt(index);
81
+ hash = Math.imul(hash, 0x01000193);
82
+ }
83
+ return (hash >>> 0).toString(16).padStart(8, "0");
84
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/redevplugin-ui",
3
- "version": "0.6.22",
3
+ "version": "0.6.24",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -23,6 +23,14 @@
23
23
  "types": "./dist/plugin.d.ts",
24
24
  "default": "./dist/plugin.js"
25
25
  },
26
+ "./jsx-runtime": {
27
+ "types": "./dist/jsx-runtime.d.ts",
28
+ "default": "./dist/jsx-runtime.js"
29
+ },
30
+ "./jsx-dev-runtime": {
31
+ "types": "./dist/jsx-dev-runtime.d.ts",
32
+ "default": "./dist/jsx-dev-runtime.js"
33
+ },
26
34
  "./local-import": {
27
35
  "types": "./dist/local-import.d.ts",
28
36
  "default": "./dist/local-import.js"
@@ -32,7 +40,7 @@
32
40
  "dist"
33
41
  ],
34
42
  "dependencies": {
35
- "@floegence/redevplugin-contracts": "0.6.22"
43
+ "@floegence/redevplugin-contracts": "0.6.24"
36
44
  },
37
45
  "publishConfig": {
38
46
  "access": "public"
@@ -40,6 +48,6 @@
40
48
  "scripts": {
41
49
  "build": "tsc -p tsconfig.json",
42
50
  "typecheck": "tsc -p tsconfig.json --noEmit",
43
- "test": "tsc -p tsconfig.test.json && node --test dist-test/test/*.js"
51
+ "test": "tsc -p tsconfig.json && tsc -p tsconfig.test.json && node --test dist-test/test/*.js"
44
52
  }
45
53
  }