@adobe/data 0.9.68 → 0.9.69

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 (36) hide show
  1. package/dist/ecs/plugins/scheduler/scheduler.js +9 -2
  2. package/dist/ecs/plugins/scheduler/scheduler.js.map +1 -1
  3. package/dist/math/mat4x4/functions.js +6 -3
  4. package/dist/math/mat4x4/functions.js.map +1 -1
  5. package/dist/math/quat/index.d.ts +1 -3
  6. package/dist/math/quat/schema.d.ts +3 -0
  7. package/dist/math/quat/schema.js +4 -0
  8. package/dist/math/quat/schema.js.map +1 -1
  9. package/dist/schema/index.d.ts +2 -0
  10. package/dist/schema/index.js +1 -0
  11. package/dist/schema/index.js.map +1 -1
  12. package/dist/schema/schema.d.ts +5 -0
  13. package/dist/service/ui-service/public.d.ts +1 -0
  14. package/dist/service/ui-service/public.js +1 -0
  15. package/dist/service/ui-service/public.js.map +1 -1
  16. package/dist/service/ui-service/restrict.d.ts +17 -0
  17. package/dist/service/ui-service/restrict.js +5 -0
  18. package/dist/service/ui-service/restrict.js.map +1 -0
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/typed-buffer/structs/index.d.ts +1 -0
  21. package/dist/typed-buffer/structs/index.js +1 -0
  22. package/dist/typed-buffer/structs/index.js.map +1 -1
  23. package/dist/typed-buffer/structs/wgsl-struct-fields.d.ts +17 -0
  24. package/dist/typed-buffer/structs/wgsl-struct-fields.js +58 -0
  25. package/dist/typed-buffer/structs/wgsl-struct-fields.js.map +1 -0
  26. package/package.json +1 -1
  27. package/references/data-lit/package.json +1 -1
  28. package/references/data-lit/src/elements/database-element.ts +22 -7
  29. package/references/data-lit-tictactoe/package.json +1 -1
  30. package/references/data-lit-tictactoe/src/elements/tictactoe-app/tictactoe-app.ts +1 -1
  31. package/references/data-react/package.json +1 -1
  32. package/references/data-react-hello/package.json +3 -2
  33. package/references/data-react-pixie/package.json +1 -1
  34. package/dist/service/async-data-service/index.d.ts +0 -1
  35. package/dist/service/async-data-service/index.js +0 -3
  36. package/dist/service/async-data-service/index.js.map +0 -1
@@ -1,2 +1,3 @@
1
1
  export { getStructLayout } from "./get-struct-layout.js";
2
2
  export * from "./struct-layout.js";
3
+ export { wgslStructFields } from "./wgsl-struct-fields.js";
@@ -1,4 +1,5 @@
1
1
  // © 2026 Adobe. MIT License. See /LICENSE for details.
2
2
  export { getStructLayout } from "./get-struct-layout.js";
3
3
  export * from "./struct-layout.js";
4
+ export { wgslStructFields } from "./wgsl-struct-fields.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/typed-buffer/structs/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/typed-buffer/structs/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { type Schema } from "../../schema/index.js";
2
+ /**
3
+ * Generates WGSL struct field declarations from a JSON Schema object type.
4
+ *
5
+ * Maps each property to the appropriate WGSL type (f32, vec3f, mat4x4f, etc.)
6
+ * using the same schema that drives host-side TypedBuffer layout — so the host
7
+ * struct and the WGSL struct are guaranteed to agree on field order and types.
8
+ *
9
+ * Usage:
10
+ * ```ts
11
+ * const source = `
12
+ * struct MyUniforms {
13
+ * ${wgslStructFields(MyUniforms.schema)}
14
+ * }`;
15
+ * ```
16
+ */
17
+ export declare const wgslStructFields: (schema: Schema) => string;
@@ -0,0 +1,58 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ const primitiveWgslType = (schema) => {
3
+ if (schema.type === "number")
4
+ return "f32";
5
+ if (schema.type === "integer") {
6
+ return schema.minimum !== undefined && schema.minimum >= 0 ? "u32" : "i32";
7
+ }
8
+ return null;
9
+ };
10
+ const fieldWgslType = (schema) => {
11
+ const prim = primitiveWgslType(schema);
12
+ if (prim)
13
+ return prim;
14
+ if (schema.type === "array" &&
15
+ schema.items !== undefined &&
16
+ !Array.isArray(schema.items) &&
17
+ schema.minItems === schema.maxItems &&
18
+ schema.minItems !== undefined) {
19
+ const elemType = primitiveWgslType(schema.items);
20
+ if (!elemType)
21
+ return null;
22
+ const n = schema.minItems;
23
+ const suffix = elemType === "f32" ? "f" : elemType === "i32" ? "i" : "u";
24
+ if (n === 16 && suffix === "f")
25
+ return "mat4x4f";
26
+ if (n === 2 || n === 3 || n === 4)
27
+ return `vec${n}${suffix}`;
28
+ }
29
+ return null;
30
+ };
31
+ /**
32
+ * Generates WGSL struct field declarations from a JSON Schema object type.
33
+ *
34
+ * Maps each property to the appropriate WGSL type (f32, vec3f, mat4x4f, etc.)
35
+ * using the same schema that drives host-side TypedBuffer layout — so the host
36
+ * struct and the WGSL struct are guaranteed to agree on field order and types.
37
+ *
38
+ * Usage:
39
+ * ```ts
40
+ * const source = `
41
+ * struct MyUniforms {
42
+ * ${wgslStructFields(MyUniforms.schema)}
43
+ * }`;
44
+ * ```
45
+ */
46
+ export const wgslStructFields = (schema) => {
47
+ if (schema.type !== "object" || !schema.properties)
48
+ return "";
49
+ return Object.entries(schema.properties)
50
+ .map(([name, fieldSchema]) => {
51
+ const type = fieldWgslType(fieldSchema);
52
+ if (!type)
53
+ throw new Error(`Cannot map schema field "${name}" to a WGSL type`);
54
+ return ` ${name}: ${type},`;
55
+ })
56
+ .join("\n");
57
+ };
58
+ //# sourceMappingURL=wgsl-struct-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wgsl-struct-fields.js","sourceRoot":"","sources":["../../../src/typed-buffer/structs/wgsl-struct-fields.ts"],"names":[],"mappings":"AAAA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C,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE;IACvD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAC9D,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;SACnC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE;QACzB,MAAM,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,kBAAkB,CAAC,CAAC;QAC/E,OAAO,OAAO,IAAI,KAAK,IAAI,GAAG,CAAC;IACnC,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "Adobe data oriented programming library",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-lit",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "Adobe data Lit bindings - hooks, elements, decorators",
5
5
  "type": "module",
6
6
  "private": false,
@@ -9,8 +9,23 @@ import { attachDecorator, withHooks } from '../index.js';
9
9
 
10
10
  export abstract class DatabaseElement<P extends Database.Plugin> extends LitElement {
11
11
 
12
+ /**
13
+ * The live database, fully typed. Set by an ancestor via DI (`.database=…`)
14
+ * or created from `plugin` on connect. Bootstrap containers — those that own
15
+ * a controller or drive a streaming (async-generator) transaction — read
16
+ * this directly; pure widgets use the restricted `service` view below.
17
+ */
12
18
  @property({ type: Object, reflect: false })
13
- service!: UIService.FromService<Database.Plugin.ToDatabase<P>>;
19
+ database!: Database.Plugin.ToDatabase<P>;
20
+
21
+ /**
22
+ * UI-restricted view of {@link database} for pure-widget rendering: every
23
+ * transaction / mutator is rewritten to fire-and-forget `void` so a widget
24
+ * can never await on or read back a mutation; reads go through `observe`.
25
+ */
26
+ get service(): UIService.FromService<Database.Plugin.ToDatabase<P>> {
27
+ return UIService.restrict(this.database);
28
+ }
14
29
 
15
30
  constructor() {
16
31
  super();
@@ -20,18 +35,18 @@ export abstract class DatabaseElement<P extends Database.Plugin> extends LitElem
20
35
  abstract get plugin(): P;
21
36
 
22
37
  connectedCallback(): void {
23
- if (!this.service) {
24
- const service = this.findAncestorDatabase();
25
- this.service = (service?.extend(this.plugin) ?? Database.create(this.plugin)) as unknown as UIService.FromService<Database.Plugin.ToDatabase<P>>;
38
+ if (!this.database) {
39
+ const ancestor = this.findAncestorDatabase();
40
+ this.database = ancestor?.extend(this.plugin) ?? Database.create(this.plugin);
26
41
  }
27
42
  super.connectedCallback();
28
43
  }
29
44
 
30
45
  protected findAncestorDatabase(): Database | void {
31
46
  for (const element of iterateSelfAndAncestors(this)) {
32
- const { service } = element as Partial<DatabaseElement<any>>;
33
- if (Database.is(service)) {
34
- return service;
47
+ const { database } = element as Partial<DatabaseElement<any>>;
48
+ if (Database.is(database)) {
49
+ return database;
35
50
  }
36
51
  }
37
52
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-lit-tictactoe",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "Tic-Tac-Toe sample - Lit web components with @adobe/data-lit and AgenticService",
5
5
  "type": "module",
6
6
  "private": true,
@@ -14,5 +14,5 @@ type TictactoeService = Database.Plugin.ToDatabase<typeof tictactoePlugin>;
14
14
  */
15
15
  export const Tictactoe = <S extends TictactoeService>(args: { service: S }): TemplateResult => {
16
16
  void import("./tictactoe-app-element.js");
17
- return html`<tictactoe-app .service=${args.service}></tictactoe-app>`;
17
+ return html`<tictactoe-app .database=${args.service}></tictactoe-app>`;
18
18
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-react",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "Adobe data React bindings — hooks and context for ECS database",
5
5
  "type": "module",
6
6
  "private": false,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-react-hello",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "Hello World sample - click counter using @adobe/data-react",
5
5
  "type": "module",
6
6
  "private": true,
@@ -18,8 +18,9 @@
18
18
  "devDependencies": {
19
19
  "@types/react": "^19",
20
20
  "@types/react-dom": "^19",
21
+ "@vitejs/plugin-react": "^4.3.0",
21
22
  "typescript": "^5.8.3",
22
23
  "vite": "^5.1.1",
23
- "@vitejs/plugin-react": "^4.3.0"
24
+ "vite-plugin-checker": "^0.12.0"
24
25
  }
25
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-react-pixie",
3
- "version": "0.9.68",
3
+ "version": "0.9.69",
4
4
  "description": "PixiJS React sample - ECS sprites (bunny, fox) with @adobe/data-react",
5
5
  "type": "module",
6
6
  "private": true,
@@ -1 +0,0 @@
1
- export * as AsyncDataService from "./public.js";
@@ -1,3 +0,0 @@
1
- // © 2026 Adobe. MIT License. See /LICENSE for details.
2
- export * as AsyncDataService from "./public.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/service/async-data-service/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,KAAK,gBAAgB,MAAM,aAAa,CAAC"}