@plasmicapp/host 1.0.129 → 1.0.131

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/canvas-host.d.ts +41 -41
  2. package/dist/common.d.ts +1 -1
  3. package/dist/data.d.ts +43 -43
  4. package/dist/element-types.d.ts +115 -115
  5. package/dist/exports.d.ts +10 -10
  6. package/dist/fetcher.d.ts +40 -40
  7. package/dist/global-actions.d.ts +9 -9
  8. package/dist/host.esm.js +441 -406
  9. package/dist/host.esm.js.map +1 -1
  10. package/dist/index.cjs.js +457 -422
  11. package/dist/index.cjs.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/lang-utils.d.ts +3 -3
  14. package/dist/registerComponent.d.ts +590 -589
  15. package/dist/registerGlobalContext.d.ts +75 -75
  16. package/dist/registerToken.d.ts +13 -13
  17. package/dist/registerTrait.d.ts +20 -20
  18. package/dist/repeatedElement.d.ts +15 -15
  19. package/dist/useForceUpdate.d.ts +1 -1
  20. package/dist/version.d.ts +1 -1
  21. package/package.json +5 -6
  22. package/registerComponent/dist/element-types.d.ts +115 -115
  23. package/registerComponent/dist/index.cjs.js +12 -12
  24. package/registerComponent/dist/index.esm.js +12 -12
  25. package/registerComponent/dist/registerComponent.d.ts +590 -589
  26. package/registerGlobalContext/dist/element-types.d.ts +115 -115
  27. package/registerGlobalContext/dist/index.cjs.js +12 -12
  28. package/registerGlobalContext/dist/index.esm.js +12 -12
  29. package/registerGlobalContext/dist/registerComponent.d.ts +590 -589
  30. package/registerGlobalContext/dist/registerGlobalContext.d.ts +75 -75
  31. package/registerToken/dist/index.cjs.js +6 -6
  32. package/registerToken/dist/index.esm.js +6 -6
  33. package/registerToken/dist/registerToken.d.ts +13 -13
  34. package/registerTrait/dist/index.cjs.js +9 -9
  35. package/registerTrait/dist/index.esm.js +9 -9
  36. package/registerTrait/dist/registerTrait.d.ts +20 -20
@@ -1,75 +1,75 @@
1
- /// <reference types="react" />
2
- import { BooleanType, ChoiceType, CustomType, FunctionParam, JSONLikeType, NumberType, StringType, SupportControlled } from "./registerComponent";
3
- export declare type PropType<P> = SupportControlled<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P> | ChoiceType<P> | CustomType<P>>;
4
- declare type RestrictPropType<T, P> = T extends string ? SupportControlled<StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>> : T extends boolean ? SupportControlled<BooleanType<P> | JSONLikeType<P> | CustomType<P>> : T extends number ? SupportControlled<NumberType<P> | JSONLikeType<P> | CustomType<P>> : PropType<P>;
5
- declare type DistributedKeyOf<T> = T extends any ? keyof T : never;
6
- export interface GlobalContextMeta<P> {
7
- /**
8
- * Any unique string name used to identify that context. Each context
9
- * should be registered with a different `meta.name`, even if they have the
10
- * same name in the code.
11
- */
12
- name: string;
13
- /**
14
- * The name to be displayed for the context in Studio. Optional: if not
15
- * specified, `meta.name` is used.
16
- */
17
- displayName?: string;
18
- /**
19
- * The description of the context to be shown in Studio.
20
- */
21
- description?: string;
22
- /**
23
- * The javascript name to be used when generating code. Optional: if not
24
- * provided, `meta.name` is used.
25
- */
26
- importName?: string;
27
- /**
28
- * An object describing the context properties to be used in Studio.
29
- * For each `prop`, there should be an entry `meta.props[prop]` describing
30
- * its type.
31
- */
32
- props: {
33
- [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P>;
34
- } & {
35
- [prop: string]: PropType<P>;
36
- };
37
- /**
38
- * The path to be used when importing the context in the generated code.
39
- * It can be the name of the package that contains the context, or the path
40
- * to the file in the project (relative to the root directory).
41
- */
42
- importPath: string;
43
- /**
44
- * Whether the context is the default export from that path. Optional: if
45
- * not specified, it's considered `false`.
46
- */
47
- isDefaultExport?: boolean;
48
- /**
49
- * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`
50
- * to interact with components, so it's not used in the generated code.
51
- * Optional: If not provided, the usual `ref` is used.
52
- */
53
- refProp?: string;
54
- /**
55
- * Whether the global context provides data to its children using DataProvider.
56
- */
57
- providesData?: boolean;
58
- unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;
59
- }
60
- export interface GlobalContextRegistration {
61
- component: React.ComponentType<any>;
62
- meta: GlobalContextMeta<any>;
63
- }
64
- export interface GlobalActionRegistration<P> {
65
- displayName?: string;
66
- description?: string;
67
- parameters: FunctionParam<P>[];
68
- }
69
- declare global {
70
- interface Window {
71
- __PlasmicContextRegistry: GlobalContextRegistration[];
72
- }
73
- }
74
- export default function registerGlobalContext<T extends React.ComponentType<any>>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
75
- export {};
1
+ /// <reference types="react" />
2
+ import { BooleanType, ChoiceType, CustomType, FunctionParam, JSONLikeType, NumberType, StringType, SupportControlled } from "./registerComponent";
3
+ export type PropType<P> = SupportControlled<StringType<P> | BooleanType<P> | NumberType<P> | JSONLikeType<P> | ChoiceType<P> | CustomType<P>>;
4
+ type RestrictPropType<T, P> = T extends string ? SupportControlled<StringType<P> | ChoiceType<P> | JSONLikeType<P> | CustomType<P>> : T extends boolean ? SupportControlled<BooleanType<P> | JSONLikeType<P> | CustomType<P>> : T extends number ? SupportControlled<NumberType<P> | JSONLikeType<P> | CustomType<P>> : PropType<P>;
5
+ type DistributedKeyOf<T> = T extends any ? keyof T : never;
6
+ export interface GlobalContextMeta<P> {
7
+ /**
8
+ * Any unique string name used to identify that context. Each context
9
+ * should be registered with a different `meta.name`, even if they have the
10
+ * same name in the code.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The name to be displayed for the context in Studio. Optional: if not
15
+ * specified, `meta.name` is used.
16
+ */
17
+ displayName?: string;
18
+ /**
19
+ * The description of the context to be shown in Studio.
20
+ */
21
+ description?: string;
22
+ /**
23
+ * The javascript name to be used when generating code. Optional: if not
24
+ * provided, `meta.name` is used.
25
+ */
26
+ importName?: string;
27
+ /**
28
+ * An object describing the context properties to be used in Studio.
29
+ * For each `prop`, there should be an entry `meta.props[prop]` describing
30
+ * its type.
31
+ */
32
+ props: {
33
+ [prop in DistributedKeyOf<P>]?: RestrictPropType<P[prop], P>;
34
+ } & {
35
+ [prop: string]: PropType<P>;
36
+ };
37
+ /**
38
+ * The path to be used when importing the context in the generated code.
39
+ * It can be the name of the package that contains the context, or the path
40
+ * to the file in the project (relative to the root directory).
41
+ */
42
+ importPath: string;
43
+ /**
44
+ * Whether the context is the default export from that path. Optional: if
45
+ * not specified, it's considered `false`.
46
+ */
47
+ isDefaultExport?: boolean;
48
+ /**
49
+ * The prop that receives and forwards a React `ref`. Plasmic only uses `ref`
50
+ * to interact with components, so it's not used in the generated code.
51
+ * Optional: If not provided, the usual `ref` is used.
52
+ */
53
+ refProp?: string;
54
+ /**
55
+ * Whether the global context provides data to its children using DataProvider.
56
+ */
57
+ providesData?: boolean;
58
+ unstable__globalActions?: Record<string, GlobalActionRegistration<P>>;
59
+ }
60
+ export interface GlobalContextRegistration {
61
+ component: React.ComponentType<any>;
62
+ meta: GlobalContextMeta<any>;
63
+ }
64
+ export interface GlobalActionRegistration<P> {
65
+ displayName?: string;
66
+ description?: string;
67
+ parameters: FunctionParam<P>[];
68
+ }
69
+ declare global {
70
+ interface Window {
71
+ __PlasmicContextRegistry: GlobalContextRegistration[];
72
+ }
73
+ }
74
+ export default function registerGlobalContext<T extends React.ComponentType<any>>(component: T, meta: GlobalContextMeta<React.ComponentProps<T>>): void;
75
+ export {};
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var root = globalThis;
6
- if (root.__PlasmicTokenRegistry == null) {
7
- root.__PlasmicTokenRegistry = [];
8
- }
9
- function registerToken(token) {
10
- root.__PlasmicTokenRegistry.push(token);
5
+ var root = globalThis;
6
+ if (root.__PlasmicTokenRegistry == null) {
7
+ root.__PlasmicTokenRegistry = [];
8
+ }
9
+ function registerToken(token) {
10
+ root.__PlasmicTokenRegistry.push(token);
11
11
  }
12
12
 
13
13
  exports['default'] = registerToken;
@@ -1,9 +1,9 @@
1
- var root = globalThis;
2
- if (root.__PlasmicTokenRegistry == null) {
3
- root.__PlasmicTokenRegistry = [];
4
- }
5
- function registerToken(token) {
6
- root.__PlasmicTokenRegistry.push(token);
1
+ var root = globalThis;
2
+ if (root.__PlasmicTokenRegistry == null) {
3
+ root.__PlasmicTokenRegistry = [];
4
+ }
5
+ function registerToken(token) {
6
+ root.__PlasmicTokenRegistry.push(token);
7
7
  }
8
8
 
9
9
  export { registerToken as default };
@@ -1,13 +1,13 @@
1
- export declare type TokenType = "color" | "spacing" | "font-family" | "font-size" | "line-height" | "opacity";
2
- export interface TokenRegistration {
3
- name: string;
4
- displayName: string;
5
- value: string;
6
- type: TokenType;
7
- }
8
- declare global {
9
- interface Window {
10
- __PlasmicTokenRegistry: TokenRegistration[];
11
- }
12
- }
13
- export default function registerToken(token: TokenRegistration): void;
1
+ export type TokenType = "color" | "spacing" | "font-family" | "font-size" | "line-height" | "opacity";
2
+ export interface TokenRegistration {
3
+ name: string;
4
+ displayName: string;
5
+ value: string;
6
+ type: TokenType;
7
+ }
8
+ declare global {
9
+ interface Window {
10
+ __PlasmicTokenRegistry: TokenRegistration[];
11
+ }
12
+ }
13
+ export default function registerToken(token: TokenRegistration): void;
@@ -3,15 +3,15 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var root = globalThis;
7
- if (root.__PlasmicTraitRegistry == null) {
8
- root.__PlasmicTraitRegistry = [];
9
- }
10
- function registerTrait(trait, meta) {
11
- root.__PlasmicTraitRegistry.push({
12
- trait: trait,
13
- meta: meta,
14
- });
6
+ var root = globalThis;
7
+ if (root.__PlasmicTraitRegistry == null) {
8
+ root.__PlasmicTraitRegistry = [];
9
+ }
10
+ function registerTrait(trait, meta) {
11
+ root.__PlasmicTraitRegistry.push({
12
+ trait: trait,
13
+ meta: meta,
14
+ });
15
15
  }
16
16
 
17
17
  exports['default'] = registerTrait;
@@ -1,13 +1,13 @@
1
1
  'use client';
2
- var root = globalThis;
3
- if (root.__PlasmicTraitRegistry == null) {
4
- root.__PlasmicTraitRegistry = [];
5
- }
6
- function registerTrait(trait, meta) {
7
- root.__PlasmicTraitRegistry.push({
8
- trait: trait,
9
- meta: meta,
10
- });
2
+ var root = globalThis;
3
+ if (root.__PlasmicTraitRegistry == null) {
4
+ root.__PlasmicTraitRegistry = [];
5
+ }
6
+ function registerTrait(trait, meta) {
7
+ root.__PlasmicTraitRegistry.push({
8
+ trait: trait,
9
+ meta: meta,
10
+ });
11
11
  }
12
12
 
13
13
  export { registerTrait as default };
@@ -1,20 +1,20 @@
1
- export interface BasicTrait {
2
- label?: string;
3
- type: "text" | "number" | "boolean";
4
- }
5
- export interface ChoiceTrait {
6
- label?: string;
7
- type: "choice";
8
- options: string[];
9
- }
10
- export declare type TraitMeta = BasicTrait | ChoiceTrait;
11
- export interface TraitRegistration {
12
- trait: string;
13
- meta: TraitMeta;
14
- }
15
- declare global {
16
- interface Window {
17
- __PlasmicTraitRegistry: TraitRegistration[];
18
- }
19
- }
20
- export default function registerTrait(trait: string, meta: TraitMeta): void;
1
+ export interface BasicTrait {
2
+ label?: string;
3
+ type: "text" | "number" | "boolean";
4
+ }
5
+ export interface ChoiceTrait {
6
+ label?: string;
7
+ type: "choice";
8
+ options: string[];
9
+ }
10
+ export type TraitMeta = BasicTrait | ChoiceTrait;
11
+ export interface TraitRegistration {
12
+ trait: string;
13
+ meta: TraitMeta;
14
+ }
15
+ declare global {
16
+ interface Window {
17
+ __PlasmicTraitRegistry: TraitRegistration[];
18
+ }
19
+ }
20
+ export default function registerTrait(trait: string, meta: TraitMeta): void;