@playcanvas/web-components 0.9.0 → 0.10.1

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 (74) hide show
  1. package/README.md +18 -0
  2. package/dist/app.d.ts +55 -9
  3. package/dist/asset.d.ts +25 -1
  4. package/dist/async-element.d.ts +15 -2
  5. package/dist/components/button-component.d.ts +1 -1
  6. package/dist/components/camera-component.d.ts +1 -1
  7. package/dist/components/collision-component.d.ts +1 -1
  8. package/dist/components/component.d.ts +6 -5
  9. package/dist/components/element-component.d.ts +1 -1
  10. package/dist/components/gsplat-component.d.ts +1 -1
  11. package/dist/components/layoutchild-component.d.ts +1 -1
  12. package/dist/components/layoutgroup-component.d.ts +1 -1
  13. package/dist/components/light-component.d.ts +1 -1
  14. package/dist/components/particlesystem-component.d.ts +1 -1
  15. package/dist/components/render-component.d.ts +1 -1
  16. package/dist/components/rigidbody-component.d.ts +1 -1
  17. package/dist/components/screen-component.d.ts +1 -1
  18. package/dist/components/script.d.ts +8 -1
  19. package/dist/components/scrollbar-component.d.ts +1 -1
  20. package/dist/components/scrollview-component.d.ts +1 -1
  21. package/dist/components/sound-component.d.ts +1 -1
  22. package/dist/components/sound-slot.d.ts +9 -1
  23. package/dist/custom-elements.json +16704 -0
  24. package/dist/entity.d.ts +24 -5
  25. package/dist/loading-bar.d.ts +35 -0
  26. package/dist/material.d.ts +972 -4
  27. package/dist/model.d.ts +1 -1
  28. package/dist/module.d.ts +10 -0
  29. package/dist/{utils.d.ts → parse.d.ts} +63 -33
  30. package/dist/pwc.cjs +3070 -699
  31. package/dist/pwc.cjs.map +1 -1
  32. package/dist/pwc.js +3070 -699
  33. package/dist/pwc.js.map +1 -1
  34. package/dist/pwc.min.js +1 -1
  35. package/dist/pwc.min.js.map +1 -1
  36. package/dist/pwc.min.mjs +2 -0
  37. package/dist/pwc.min.mjs.map +1 -0
  38. package/dist/pwc.mjs +3071 -700
  39. package/dist/pwc.mjs.map +1 -1
  40. package/dist/scene.d.ts +12 -4
  41. package/dist/sky.d.ts +1 -1
  42. package/dist/vscode.html-custom-data.json +1800 -0
  43. package/dist/web-types.json +3836 -0
  44. package/package.json +29 -11
  45. package/src/app.ts +178 -78
  46. package/src/asset.ts +44 -2
  47. package/src/async-element.ts +17 -4
  48. package/src/components/button-component.ts +6 -6
  49. package/src/components/camera-component.ts +2 -2
  50. package/src/components/collision-component.ts +2 -2
  51. package/src/components/component.ts +8 -7
  52. package/src/components/element-component.ts +6 -6
  53. package/src/components/gsplat-component.ts +3 -3
  54. package/src/components/layoutchild-component.ts +2 -2
  55. package/src/components/layoutgroup-component.ts +2 -2
  56. package/src/components/light-component.ts +2 -2
  57. package/src/components/particlesystem-component.ts +2 -2
  58. package/src/components/render-component.ts +10 -5
  59. package/src/components/rigidbody-component.ts +2 -2
  60. package/src/components/screen-component.ts +2 -2
  61. package/src/components/script-component.ts +4 -4
  62. package/src/components/script.ts +9 -2
  63. package/src/components/scrollbar-component.ts +3 -3
  64. package/src/components/scrollview-component.ts +6 -6
  65. package/src/components/sound-component.ts +2 -2
  66. package/src/components/sound-slot.ts +31 -9
  67. package/src/entity.ts +56 -22
  68. package/src/loading-bar.ts +122 -0
  69. package/src/material.ts +2402 -59
  70. package/src/model.ts +2 -2
  71. package/src/module.ts +10 -0
  72. package/src/{utils.ts → parse.ts} +104 -65
  73. package/src/scene.ts +51 -21
  74. package/src/sky.ts +3 -3
package/dist/entity.d.ts CHANGED
@@ -5,6 +5,24 @@ import { AsyncElement } from './async-element';
5
5
  * {@link https://developer.playcanvas.com/user-manual/web-components/tags/pc-entity/ | `<pc-entity>`} elements.
6
6
  * The EntityElement interface also inherits the properties and methods of the
7
7
  * {@link HTMLElement} interface.
8
+ *
9
+ * The pointer events below are dispatched by the containing `<pc-app>` element when the pointer
10
+ * intersects this entity's geometry. They are only generated while the entity has a listener for
11
+ * them, registered either with {@link addEventListener} or with the matching inline `onpointer*`
12
+ * attribute.
13
+ *
14
+ * @attribute {string} onpointerenter - Script to run when the pointer moves onto the entity.
15
+ * @attribute {string} onpointerleave - Script to run when the pointer moves off the entity.
16
+ * @attribute {string} onpointermove - Script to run when the pointer moves over the entity.
17
+ * @attribute {string} onpointerdown - Script to run when a pointer button is pressed over the
18
+ * entity.
19
+ * @attribute {string} onpointerup - Script to run when a pointer button is released over the
20
+ * entity.
21
+ * @fires {PointerEvent} pointerenter - Fired when the pointer moves onto the entity.
22
+ * @fires {PointerEvent} pointerleave - Fired when the pointer moves off the entity.
23
+ * @fires {PointerEvent} pointermove - Fired when the pointer moves over the entity.
24
+ * @fires {PointerEvent} pointerdown - Fired when a pointer button is pressed over the entity.
25
+ * @fires {PointerEvent} pointerup - Fired when a pointer button is released over the entity.
8
26
  */
9
27
  declare class EntityElement extends AsyncElement {
10
28
  /**
@@ -45,11 +63,12 @@ declare class EntityElement extends AsyncElement {
45
63
  private _built;
46
64
  private _entity;
47
65
  /**
48
- * The PlayCanvas entity instance. Available once the element is ready await
49
- * {@link whenReady} or the element's `ready()` promise before accessing it.
50
- * @returns The entity instance.
66
+ * The PlayCanvas entity instance. `null` until the element is ready, and again once it has
67
+ * been removed from the document — await {@link whenReady} or the element's `ready()`
68
+ * promise before accessing it.
69
+ * @returns The entity instance, or `null`.
51
70
  */
52
- get entity(): Entity;
71
+ get entity(): Entity | null;
53
72
  createEntity(app: AppBase): void;
54
73
  buildHierarchy(app: AppBase): void;
55
74
  connectedCallback(): void;
@@ -127,7 +146,7 @@ declare class EntityElement extends AsyncElement {
127
146
  */
128
147
  private _updateInlineHandler;
129
148
  static get observedAttributes(): string[];
130
- attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
149
+ attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
131
150
  addEventListener(type: string, listener: EventListener, options?: boolean | AddEventListenerOptions): void;
132
151
  removeEventListener(type: string, listener: EventListener, options?: boolean | EventListenerOptions): void;
133
152
  hasListeners(type: string): boolean;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The slim progress bar `<pc-app>` shows while it boots and preloads. An implementation detail of
3
+ * AppElement rather than a custom element, so its shape can change without a breaking change.
4
+ *
5
+ * All styling is inline, so the library injects no stylesheet. The colors and height resolve CSS
6
+ * custom properties — `--pc-loading-bar-color`, `--pc-loading-bar-background` and
7
+ * `--pc-loading-bar-height` — so a page can theme the bar from `pc-app` or `:root`.
8
+ */
9
+ declare class LoadingBar {
10
+ private _track;
11
+ private _fill;
12
+ private _sweep;
13
+ private _removal;
14
+ /**
15
+ * Creates the bar and appends it to `parent`, starting in the indeterminate state.
16
+ * @param parent - The element to append the bar to.
17
+ */
18
+ constructor(parent: HTMLElement);
19
+ /**
20
+ * Reflects preload progress, switching the bar from indeterminate to determinate on the first
21
+ * call.
22
+ * @param loaded - The number of assets that have finished loading.
23
+ * @param total - The number of assets being preloaded.
24
+ */
25
+ progress(loaded: number, total: number): void;
26
+ /**
27
+ * Fills the bar, fades it out and removes it. Idempotent.
28
+ */
29
+ complete(): void;
30
+ /**
31
+ * Removes the bar immediately, cancelling any pending fade. Idempotent.
32
+ */
33
+ destroy(): void;
34
+ }
35
+ export { LoadingBar };