gesso-framework 0.6.30 → 0.8.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 +98 -0
- package/dist/{FunctionComponent-CHtojpp7.d.ts → FunctionComponent-BDVrANP0.d.ts} +371 -115
- package/dist/{serveChannels-BlEag7WU.js → WorkerPorts-m_hLRoPj.js} +8 -240
- package/dist/WorkerPorts-m_hLRoPj.js.map +1 -0
- package/dist/agent/index.d.ts +55 -2
- package/dist/agent/index.js +8 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/app-De3z58x7.js +638 -0
- package/dist/app-De3z58x7.js.map +1 -0
- package/dist/computed-DyW9SPpq.js +587 -0
- package/dist/computed-DyW9SPpq.js.map +1 -0
- package/dist/createComponent-DJads88q.js +47 -0
- package/dist/createComponent-DJads88q.js.map +1 -0
- package/dist/{index-DZbSb8IN.d.ts → index-DocVauCS.d.ts} +593 -119
- package/dist/index.d.ts +4 -5
- package/dist/index.js +609 -6641
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +8 -5
- package/dist/jsx/jsx-runtime.js +15 -6
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/{persisted-fUzIU8FZ.js → persisted-qEBOHDnj.js} +4 -576
- package/dist/persisted-qEBOHDnj.js.map +1 -0
- package/dist/remote/index.d.ts +2 -2
- package/dist/remote/index.js +2 -1
- package/dist/remote/index.js.map +1 -1
- package/dist/{remote-BoB8zh7z.js → remote-B4bjdTzg.js} +19 -4
- package/dist/remote-B4bjdTzg.js.map +1 -0
- package/dist/render-W2XO444K.js +7310 -0
- package/dist/render-W2XO444K.js.map +1 -0
- package/dist/serveChannels-DReCmRxO.js +241 -0
- package/dist/serveChannels-DReCmRxO.js.map +1 -0
- package/dist/{createComponent-3n1ZSql8.js → show-D0MevHaV.js} +2 -46
- package/dist/show-D0MevHaV.js.map +1 -0
- package/dist/{ui-CHtNccR8.d.ts → tools-Bl8LZ7LR.d.ts} +351 -8
- package/dist/{webmcp-CdDq2nzS.js → webmcp-D7IlA0fu.js} +3 -3
- package/dist/webmcp-D7IlA0fu.js.map +1 -0
- package/dist/worker/index.d.ts +3 -4
- package/dist/worker/index.js +5 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/ChannelProtocol-ByNoHujM.d.ts +0 -247
- package/dist/app-Yig59Ygf.js +0 -326
- package/dist/app-Yig59Ygf.js.map +0 -1
- package/dist/createComponent-3n1ZSql8.js.map +0 -1
- package/dist/persisted-fUzIU8FZ.js.map +0 -1
- package/dist/remote-BoB8zh7z.js.map +0 -1
- package/dist/serveChannels-BlEag7WU.js.map +0 -1
- package/dist/webmcp-CdDq2nzS.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/metadata.ts
|
|
2
|
+
const metadataStore = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function getComponentMetadata(constructor) {
|
|
4
|
+
let metadata = metadataStore.get(constructor);
|
|
5
|
+
if (metadata === void 0) {
|
|
6
|
+
metadata = {
|
|
7
|
+
tag: constructor.name,
|
|
8
|
+
inputs: /* @__PURE__ */ new Set(),
|
|
9
|
+
states: /* @__PURE__ */ new Set(),
|
|
10
|
+
injects: /* @__PURE__ */ new Map(),
|
|
11
|
+
channels: /* @__PURE__ */ new Map()
|
|
12
|
+
};
|
|
13
|
+
metadataStore.set(constructor, metadata);
|
|
14
|
+
}
|
|
15
|
+
return metadata;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/createComponent.ts
|
|
19
|
+
/**
|
|
20
|
+
* Creates a ComponentElement for use as a child of a UiElement.
|
|
21
|
+
*
|
|
22
|
+
* Column(
|
|
23
|
+
* createComponent(Counter, { label: 'Count' }),
|
|
24
|
+
* createComponent(TodoItem, { todo }, todo.id)
|
|
25
|
+
* )
|
|
26
|
+
*
|
|
27
|
+
* The component may be a class extending Component or a function
|
|
28
|
+
* `(props, ctx) => UiChild`. Props are typed from the component: a
|
|
29
|
+
* class's `input()` fields, or a function's `Inputs<P>` parameter. A
|
|
30
|
+
* misspelled prop, a value of the wrong type, and a missing required
|
|
31
|
+
* prop are compile errors; props may be omitted only when none is
|
|
32
|
+
* required.
|
|
33
|
+
*/
|
|
34
|
+
function createComponent(component, ...args) {
|
|
35
|
+
const [props, key] = args;
|
|
36
|
+
return {
|
|
37
|
+
kind: "component",
|
|
38
|
+
tag: getComponentMetadata(component).tag,
|
|
39
|
+
component,
|
|
40
|
+
props: props ?? {},
|
|
41
|
+
key
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { getComponentMetadata as n, createComponent as t };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=createComponent-DJads88q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComponent-DJads88q.js","names":[],"sources":["../src/metadata.ts","../src/createComponent.ts"],"sourcesContent":["export const COMPONENT_METADATA_KEY = Symbol('gesso:component:metadata');\n\nexport interface ComponentMetadata {\n tag: string;\n inputs: Set<string>;\n states: Set<string>;\n injects: Map<string, Function>;\n /** Property name → the channel token it resolves to (`@Channel`). */\n channels: Map<string, { name: string }>;\n}\n\nconst metadataStore = new WeakMap<Function, ComponentMetadata>();\n\nexport function getComponentMetadata(constructor: Function): ComponentMetadata {\n let metadata = metadataStore.get(constructor);\n if (metadata === undefined) {\n metadata = { tag: constructor.name, inputs: new Set(), states: new Set(), injects: new Map(), channels: new Map() };\n metadataStore.set(constructor, metadata);\n }\n return metadata;\n}\n\nexport function hasComponentMetadata(constructor: Function): boolean {\n return metadataStore.has(constructor);\n}\n","import type { ComponentElement } from './ComponentElement';\nimport type { ComponentArgs, ComponentProps, ComponentType } from './FunctionComponent';\nimport { getComponentMetadata } from './metadata';\n\n/**\n * Creates a ComponentElement for use as a child of a UiElement.\n *\n * Column(\n * createComponent(Counter, { label: 'Count' }),\n * createComponent(TodoItem, { todo }, todo.id)\n * )\n *\n * The component may be a class extending Component or a function\n * `(props, ctx) => UiChild`. Props are typed from the component: a\n * class's `input()` fields, or a function's `Inputs<P>` parameter. A\n * misspelled prop, a value of the wrong type, and a missing required\n * prop are compile errors; props may be omitted only when none is\n * required.\n */\nexport function createComponent<C extends ComponentType>(\n component: C,\n ...args: ComponentArgs<C>\n): ComponentElement<ComponentProps<C>> {\n const [props, key] = args as [ComponentProps<C> | undefined, string | number | undefined];\n const metadata = getComponentMetadata(component);\n return {\n kind: 'component',\n tag: metadata.tag,\n component,\n props: (props ?? {}) as ComponentProps<C>,\n key\n };\n}\n"],"mappings":";AAWA,MAAM,gCAAgB,IAAI,QAAqC;AAE/D,SAAgB,qBAAqB,aAA0C;CAC7E,IAAI,WAAW,cAAc,IAAI,WAAW;CAC5C,IAAI,aAAa,KAAA,GAAW;EAC1B,WAAW;GAAE,KAAK,YAAY;GAAM,wBAAQ,IAAI,IAAI;GAAG,wBAAQ,IAAI,IAAI;GAAG,yBAAS,IAAI,IAAI;GAAG,0BAAU,IAAI,IAAI;EAAE;EAClH,cAAc,IAAI,aAAa,QAAQ;CACzC;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;;ACDA,SAAgB,gBACd,WACA,GAAG,MACkC;CACrC,MAAM,CAAC,OAAO,OAAO;CAErB,OAAO;EACL,MAAM;EACN,KAHe,qBAAqB,SAGxB,CAAC,CAAC;EACd;EACA,OAAQ,SAAS,CAAC;EAClB;CACF;AACF"}
|