@motionscript/core 0.1.1-alpha.1 → 0.1.1-alpha.3
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 +17 -0
- package/dist/browser/chunks/{chunk-MNMIIGNE.js → chunk-BPA7KSK2.js} +6 -6
- package/dist/browser/chunks/{chunk-MNMIIGNE.js.map → chunk-BPA7KSK2.js.map} +3 -3
- package/dist/browser/chunks/{chunk-5GLXFSCC.js → chunk-TL432UO5.js} +2 -2
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/components/factory/style.d.ts +8 -0
- package/dist/components/factory/style.d.ts.map +1 -1
- package/dist/components/factory/style.js +17 -0
- package/dist/components/factory/style.js.map +1 -1
- package/dist/components/factory/types.d.ts +3 -0
- package/dist/components/factory/types.d.ts.map +1 -1
- package/dist/components/factory/types.js +3 -1
- package/dist/components/factory/types.js.map +1 -1
- package/dist/experimental.d.ts +1 -0
- package/dist/experimental.d.ts.map +1 -1
- package/package.json +1 -1
- /package/dist/browser/chunks/{chunk-5GLXFSCC.js.map → chunk-TL432UO5.js.map} +0 -0
|
@@ -12,7 +12,7 @@ import { shadowOps } from "../../attributes/shape/shadow/shadow.js";
|
|
|
12
12
|
import { strokeOps } from "../../attributes/shape/stroke/stroke.js";
|
|
13
13
|
import { textOps } from "../../attributes/text/ops.js";
|
|
14
14
|
import { defOf } from "../../components/factory/type-def.js";
|
|
15
|
-
import { paletteDef, styleDef } from "../../components/factory/style.js";
|
|
15
|
+
import { paletteDef, styleDef, typographyDef } from "../../components/factory/style.js";
|
|
16
16
|
function make(def) {
|
|
17
17
|
return { _def: def };
|
|
18
18
|
}
|
|
@@ -79,6 +79,8 @@ export const Types = {
|
|
|
79
79
|
},
|
|
80
80
|
/** A colour per series or item, cycled by index. */
|
|
81
81
|
palette: (initial = []) => make(paletteDef(initial)),
|
|
82
|
+
/** A text style (face, size, weight, spacing, paint) for text a component draws; a partial one is laid over `initial`. */
|
|
83
|
+
typography: (initial = {}) => make(typographyDef(initial)),
|
|
82
84
|
/**
|
|
83
85
|
* A component's look as one entry: fields written in groups (`colors`, `text`, …), read flat
|
|
84
86
|
* (`style.palette`). A host edits it field by field, saves it, and lays a saved one onto any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/factory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAyC,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAkB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAgB,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAoD,MAAM,0CAA0C,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAkD,MAAM,yCAAyC,CAAC;AACzH,OAAO,EAAE,UAAU,EAAe,MAAM,kCAAkC,CAAC;AAI3E,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAoC,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,SAAS,EAAoC,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIhD,OAAO,EAAE,KAAK,EAA8B,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAA2F,MAAM,4BAA4B,CAAC;AAkC3J,SAAS,IAAI,CAA6B,GAAY;IAClD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAsB,CAAC;AAC7C,CAAC;AAED,6FAA6F;AAC7F,SAA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uGAAuG;IACvG,OAAO,EAAE,CAAC,OAAO,GAAG,EAAE,EAAiC,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACpJ,uFAAuF;IACvF,IAAI,EAAE,CAAC,OAAO,GAAG,CAAC,EAAgB,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;CAC5G,CAAC","sourcesContent":["import { alignmentOps, type Alignment } from \"@/attributes/layout/alignment\";\nimport { insetsOps, type InsetsProps, type InsetsResolved } from \"@/attributes/layout/insets\";\nimport { sizeInputOps, type SizeInput } from \"@/attributes/layout/size\";\nimport { vector2Ops, type Vector2 } from \"@/attributes/layout/vector2\";\nimport type { PropertyEditor } from \"@/attributes/properties/decorator\";\nimport { cornerRadiusOps, type CornerRadiusResolved, type RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { cornerStyleOps, type CornerStyleResolved, type RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { effectsOps, type Effect } from \"@/attributes/shape/effects/chain\";\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\nimport { colorOps } from \"@/attributes/shape/fill/lerp\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { pathOps } from \"@/attributes/shape/path/ops\";\nimport { shadowOps, type Shadow, type ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\nimport { strokeOps, type Stroke, type StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\nimport { textOps } from \"@/attributes/text/ops\";\nimport type { TweenFn } from \"@/props/host\";\nimport type { PathData } from \"@/render/descriptors/path\";\nimport type { AnyType, InOf, Inputs, NodeView, OutOf, StateSpec, Type, Values } from \"@/components/factory/api\";\nimport { defOf, type Inherit, type TypeDef } from \"@/components/factory/type-def\";\nimport { paletteDef, styleDef, type StyleGroups, type StyleInput, type StyleOptions, type StyleShape, type StyleValues } from \"@/components/factory/style\";\n\nexport interface EntryOptions {\n /** Not in documents or calls; only commands write it. A seek restores it like any entry. */\n readonly private?: boolean;\n /** `false`: `to` switches it rather than moving it. */\n readonly animatable?: boolean;\n /** Where it comes from when the author leaves it unset: what an ancestor provides. */\n readonly inherit?: Inherit;\n}\n\nexport interface NumberOptions extends EntryOptions {\n readonly min?: number;\n readonly max?: number;\n readonly step?: number;\n readonly unit?: string;\n /** Shown multiplied by this: `100` with `unit: \"%\"` for a 0–1 fraction. */\n readonly scale?: number;\n}\n\nexport interface TextOptions extends EntryOptions {\n /** `to` types the text out instead of switching at the end. */\n readonly typing?: boolean;\n /** It holds lines, not a label. */\n readonly multiline?: boolean;\n}\n\ntype PrivateOf<O> = O extends { readonly private: true } ? true : false;\n\n/** An attribute type: usable bare (`Types.fill`) or called with a default (`Types.fill('red')`). */\nexport interface Attribute<In, Out> extends Type<In, Out, false> {\n <const O extends EntryOptions = {}>(initial?: In, options?: EntryOptions & O): Type<In, Out, PrivateOf<O>>;\n}\n\nfunction make<In, Out, P extends boolean>(def: TypeDef): Type<In, Out, P> {\n return { _def: def } as Type<In, Out, P>;\n}\n\n/** The editor half of an options object: what the value means, never how an app shows it. */\nfunction meaning(kind: string, options: object | undefined, extra?: PropertyEditor): PropertyEditor {\n const { private: _private, typing: _typing, inherit: _inherit, ...rest } = (options ?? {}) as Record<string, unknown>;\n return { kind, ...extra, ...rest };\n}\n\nfunction attribute<In, Out>(\n kind: string, fallback: In, mapper?: (ext: any, prev?: any) => Out, tween?: TweenFn<Out>,\n): Attribute<In, Out> {\n const base: TypeDef = { default: fallback, mapper, tween, editor: { kind }, private: false };\n const call = <const O extends EntryOptions = {}>(initial?: In, options?: EntryOptions & O): Type<In, Out, PrivateOf<O>> =>\n make({ ...base, default: initial === undefined ? base.default : initial, editor: meaning(kind, options), private: options?.private === true, inherit: options?.inherit });\n return Object.assign(call, { _def: base }) as unknown as Attribute<In, Out>;\n}\n\nfunction defaultsOf(shape: StateSpec): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key in shape) out[key] = defOf(shape[key]).default;\n return out;\n}\n\n/**\n * What a state entry can be. Each lowers onto the `property` options of the\n * attribute it names, so a Type and a typed property are the same pair.\n */\nexport const Types = {\n number<const O extends NumberOptions = {}>(initial = 0, options?: NumberOptions & O): Type<number, number, PrivateOf<O>> {\n return make({ default: initial, editor: meaning(\"number\", options), private: options?.private === true, inherit: options?.inherit });\n },\n text<const O extends TextOptions = {}>(initial = \"\", options?: TextOptions & O): Type<string, string, PrivateOf<O>> {\n return make({ default: initial, tween: options?.typing ? textOps.lerp : undefined, editor: meaning(\"text\", options), private: options?.private === true, inherit: options?.inherit });\n },\n boolean<const O extends EntryOptions = {}>(initial = false, options?: EntryOptions & O): Type<boolean, boolean, PrivateOf<O>> {\n return make({ default: initial, editor: meaning(\"boolean\", options), private: options?.private === true, inherit: options?.inherit });\n },\n oneOf<const V extends readonly string[], const O extends EntryOptions = {}>(\n values: V, options?: EntryOptions & O & { readonly default?: V[number] },\n ): Type<V[number], V[number], PrivateOf<O>> {\n const { default: initial, ...rest } = options ?? ({} as O & { default?: V[number] });\n return make({ default: initial ?? values[0], editor: meaning(\"enum\", rest, { options: values }), private: options?.private === true, inherit: options?.inherit });\n },\n\n fill: attribute<Fill, FillResolved[]>(\"fills\", [], fillOps.resolve, fillOps.lerp),\n stroke: attribute<Stroke, StrokeResolved[]>(\"strokes\", [], strokeOps.resolve, strokeOps.lerp),\n shadow: attribute<Shadow, ShadowResolved[]>(\"shadows\", [], shadowOps.resolve, shadowOps.lerp),\n effects: attribute<Effect, NodeEffect[]>(\"effects\", [], effectsOps.resolve, effectsOps.lerp),\n color: attribute<Color, NormalizedColor>(\"color\", \"black\", colorOps.resolve, colorOps.lerp),\n cornerRadius: attribute<RectCornerRadius, CornerRadiusResolved>(\"cornerRadius\", 0, cornerRadiusOps.resolve, cornerRadiusOps.lerp),\n cornerStyle: attribute<RectCornerStyle, CornerStyleResolved>(\"cornerStyle\", \"rounded\", cornerStyleOps.resolve, cornerStyleOps.lerp),\n path: attribute<PathData, PathData>(\"path\", \"\", undefined, pathOps.lerp),\n insets: attribute<InsetsProps, InsetsResolved>(\"insets\", 0, insetsOps.resolve, insetsOps.lerp),\n alignment: attribute<Alignment, Vector2>(\"alignment\", \"center\", alignmentOps.resolve, alignmentOps.lerp),\n vector2: attribute<Vector2, Vector2>(\"vector2\", { x: 0, y: 0 }, undefined, vector2Ops.lerp),\n size: attribute<SizeInput, SizeInput>(\"size\", \"fill\", undefined, sizeInputOps.lerp),\n\n /** A point in the component's own frame: an editor can drag it. */\n point<const O extends EntryOptions = {}>(initial: Vector2 = { x: 0, y: 0 }, options?: EntryOptions & O): Type<Vector2, Vector2, PrivateOf<O>> {\n return make({ default: initial, tween: vector2Ops.lerp, editor: meaning(\"point\", options), private: options?.private === true, inherit: options?.inherit });\n },\n list<const T extends AnyType, const O extends EntryOptions = {}>(item: T, options?: EntryOptions & O): Type<InOf<T>[], OutOf<T>[], PrivateOf<O>> {\n return make({ default: () => [], editor: meaning(\"list\", options, { item: item._def.editor }), private: options?.private === true, inherit: options?.inherit });\n },\n object<const S extends StateSpec>(shape: S): Type<Inputs<S>, Values<S>> {\n return make({ default: () => defaultsOf(shape), editor: { kind: \"object\" }, private: false });\n },\n custom<In, Out = In, const O extends EntryOptions = {}>(initial: In, options?: EntryOptions & O & {\n readonly resolve?: (value: In) => Out;\n readonly lerp?: (from: Out, to: Out, t: number) => Out;\n /** What the value is, when a host can't tell from the default (`\"vector2\"`), and its parts. */\n readonly kind?: string;\n readonly properties?: PropertyEditor[\"properties\"];\n }): Type<In, Out, PrivateOf<O>> {\n const { resolve, lerp, private: _private, inherit: _inherit, ...rest } = options ?? ({} as NonNullable<typeof options>);\n // No kind of its own: a host reads one off the default, as for a bare `property`.\n return make({ default: initial, mapper: resolve, tween: lerp, editor: rest as PropertyEditor, private: options?.private === true, inherit: options?.inherit });\n },\n /** A colour per series or item, cycled by index. */\n palette: (initial: readonly Fill[] = []): Type<Fill[], FillResolved[][]> => make(paletteDef(initial)),\n /**\n * A component's look as one entry: fields written in groups (`colors`, `text`, …), read flat\n * (`style.palette`). A host edits it field by field, saves it, and lays a saved one onto any\n * component of the same `family`; `to({ style })` tweens it field by field.\n */\n style<const G extends StyleGroups>(family: string, groups: G, options?: StyleOptions<StyleShape<G>>): Type<StyleInput<StyleShape<G>>, StyleValues<StyleShape<G>>> {\n return make(styleDef(family, groups, options as StyleOptions<unknown>));\n },\n image: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"image\" }, private: false }),\n video: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"video\" }, private: false }),\n audio: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"audio\" }, private: false }),\n font: (family = \"\"): Type<string> => make({ default: family, editor: { kind: \"font\" }, private: false }),\n /** Another node, by id: a document holds the id, and a field reads a view of that node (or `null`). */\n nodeRef: (initial = \"\"): Type<string, NodeView | null> => make({ default: initial, editor: { kind: \"nodeRef\", animatable: false }, private: false }),\n /** A seed for deterministic randomness: procedural motion stays a function of time. */\n seed: (initial = 1): Type<number> => make({ default: initial, editor: { kind: \"seed\" }, private: false }),\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/factory/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAyC,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAkB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,UAAU,EAA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EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;CAC5G,CAAC","sourcesContent":["import { alignmentOps, type Alignment } from \"@/attributes/layout/alignment\";\nimport { insetsOps, type InsetsProps, type InsetsResolved } from \"@/attributes/layout/insets\";\nimport { sizeInputOps, type SizeInput } from \"@/attributes/layout/size\";\nimport { vector2Ops, type Vector2 } from \"@/attributes/layout/vector2\";\nimport type { PropertyEditor } from \"@/attributes/properties/decorator\";\nimport { cornerRadiusOps, type CornerRadiusResolved, type RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { cornerStyleOps, type CornerStyleResolved, type RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { effectsOps, type Effect } from \"@/attributes/shape/effects/chain\";\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\nimport type { Fill } from \"@/attributes/shape/fill/chain\";\nimport type { Color, NormalizedColor } from \"@/attributes/shape/fill/color/parser\";\nimport { colorOps } from \"@/attributes/shape/fill/lerp\";\nimport { fillOps } from \"@/attributes/shape/fill/registry\";\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { pathOps } from \"@/attributes/shape/path/ops\";\nimport { shadowOps, type Shadow, type ShadowResolved } from \"@/attributes/shape/shadow/shadow\";\nimport { strokeOps, type Stroke, type StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\nimport { textOps } from \"@/attributes/text/ops\";\nimport type { TextStyle } from \"@/attributes/text/types\";\nimport type { TweenFn } from \"@/props/host\";\nimport type { PathData } from \"@/render/descriptors/path\";\nimport type { AnyType, InOf, Inputs, NodeView, OutOf, StateSpec, Type, Values } from \"@/components/factory/api\";\nimport { defOf, type Inherit, type TypeDef } from \"@/components/factory/type-def\";\nimport { paletteDef, styleDef, typographyDef, type StyleGroups, type StyleInput, type StyleOptions, type StyleShape, type StyleValues } from \"@/components/factory/style\";\n\nexport interface EntryOptions {\n /** Not in documents or calls; only commands write it. A seek restores it like any entry. */\n readonly private?: boolean;\n /** `false`: `to` switches it rather than moving it. */\n readonly animatable?: boolean;\n /** Where it comes from when the author leaves it unset: what an ancestor provides. */\n readonly inherit?: Inherit;\n}\n\nexport interface NumberOptions extends EntryOptions {\n readonly min?: number;\n readonly max?: number;\n readonly step?: number;\n readonly unit?: string;\n /** Shown multiplied by this: `100` with `unit: \"%\"` for a 0–1 fraction. */\n readonly scale?: number;\n}\n\nexport interface TextOptions extends EntryOptions {\n /** `to` types the text out instead of switching at the end. */\n readonly typing?: boolean;\n /** It holds lines, not a label. */\n readonly multiline?: boolean;\n}\n\ntype PrivateOf<O> = O extends { readonly private: true } ? true : false;\n\n/** An attribute type: usable bare (`Types.fill`) or called with a default (`Types.fill('red')`). */\nexport interface Attribute<In, Out> extends Type<In, Out, false> {\n <const O extends EntryOptions = {}>(initial?: In, options?: EntryOptions & O): Type<In, Out, PrivateOf<O>>;\n}\n\nfunction make<In, Out, P extends boolean>(def: TypeDef): Type<In, Out, P> {\n return { _def: def } as Type<In, Out, P>;\n}\n\n/** The editor half of an options object: what the value means, never how an app shows it. */\nfunction meaning(kind: string, options: object | undefined, extra?: PropertyEditor): PropertyEditor {\n const { private: _private, typing: _typing, inherit: _inherit, ...rest } = (options ?? {}) as Record<string, unknown>;\n return { kind, ...extra, ...rest };\n}\n\nfunction attribute<In, Out>(\n kind: string, fallback: In, mapper?: (ext: any, prev?: any) => Out, tween?: TweenFn<Out>,\n): Attribute<In, Out> {\n const base: TypeDef = { default: fallback, mapper, tween, editor: { kind }, private: false };\n const call = <const O extends EntryOptions = {}>(initial?: In, options?: EntryOptions & O): Type<In, Out, PrivateOf<O>> =>\n make({ ...base, default: initial === undefined ? base.default : initial, editor: meaning(kind, options), private: options?.private === true, inherit: options?.inherit });\n return Object.assign(call, { _def: base }) as unknown as Attribute<In, Out>;\n}\n\nfunction defaultsOf(shape: StateSpec): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key in shape) out[key] = defOf(shape[key]).default;\n return out;\n}\n\n/**\n * What a state entry can be. Each lowers onto the `property` options of the\n * attribute it names, so a Type and a typed property are the same pair.\n */\nexport const Types = {\n number<const O extends NumberOptions = {}>(initial = 0, options?: NumberOptions & O): Type<number, number, PrivateOf<O>> {\n return make({ default: initial, editor: meaning(\"number\", options), private: options?.private === true, inherit: options?.inherit });\n },\n text<const O extends TextOptions = {}>(initial = \"\", options?: TextOptions & O): Type<string, string, PrivateOf<O>> {\n return make({ default: initial, tween: options?.typing ? textOps.lerp : undefined, editor: meaning(\"text\", options), private: options?.private === true, inherit: options?.inherit });\n },\n boolean<const O extends EntryOptions = {}>(initial = false, options?: EntryOptions & O): Type<boolean, boolean, PrivateOf<O>> {\n return make({ default: initial, editor: meaning(\"boolean\", options), private: options?.private === true, inherit: options?.inherit });\n },\n oneOf<const V extends readonly string[], const O extends EntryOptions = {}>(\n values: V, options?: EntryOptions & O & { readonly default?: V[number] },\n ): Type<V[number], V[number], PrivateOf<O>> {\n const { default: initial, ...rest } = options ?? ({} as O & { default?: V[number] });\n return make({ default: initial ?? values[0], editor: meaning(\"enum\", rest, { options: values }), private: options?.private === true, inherit: options?.inherit });\n },\n\n fill: attribute<Fill, FillResolved[]>(\"fills\", [], fillOps.resolve, fillOps.lerp),\n stroke: attribute<Stroke, StrokeResolved[]>(\"strokes\", [], strokeOps.resolve, strokeOps.lerp),\n shadow: attribute<Shadow, ShadowResolved[]>(\"shadows\", [], shadowOps.resolve, shadowOps.lerp),\n effects: attribute<Effect, NodeEffect[]>(\"effects\", [], effectsOps.resolve, effectsOps.lerp),\n color: attribute<Color, NormalizedColor>(\"color\", \"black\", colorOps.resolve, colorOps.lerp),\n cornerRadius: attribute<RectCornerRadius, CornerRadiusResolved>(\"cornerRadius\", 0, cornerRadiusOps.resolve, cornerRadiusOps.lerp),\n cornerStyle: attribute<RectCornerStyle, CornerStyleResolved>(\"cornerStyle\", \"rounded\", cornerStyleOps.resolve, cornerStyleOps.lerp),\n path: attribute<PathData, PathData>(\"path\", \"\", undefined, pathOps.lerp),\n insets: attribute<InsetsProps, InsetsResolved>(\"insets\", 0, insetsOps.resolve, insetsOps.lerp),\n alignment: attribute<Alignment, Vector2>(\"alignment\", \"center\", alignmentOps.resolve, alignmentOps.lerp),\n vector2: attribute<Vector2, Vector2>(\"vector2\", { x: 0, y: 0 }, undefined, vector2Ops.lerp),\n size: attribute<SizeInput, SizeInput>(\"size\", \"fill\", undefined, sizeInputOps.lerp),\n\n /** A point in the component's own frame: an editor can drag it. */\n point<const O extends EntryOptions = {}>(initial: Vector2 = { x: 0, y: 0 }, options?: EntryOptions & O): Type<Vector2, Vector2, PrivateOf<O>> {\n return make({ default: initial, tween: vector2Ops.lerp, editor: meaning(\"point\", options), private: options?.private === true, inherit: options?.inherit });\n },\n list<const T extends AnyType, const O extends EntryOptions = {}>(item: T, options?: EntryOptions & O): Type<InOf<T>[], OutOf<T>[], PrivateOf<O>> {\n return make({ default: () => [], editor: meaning(\"list\", options, { item: item._def.editor }), private: options?.private === true, inherit: options?.inherit });\n },\n object<const S extends StateSpec>(shape: S): Type<Inputs<S>, Values<S>> {\n return make({ default: () => defaultsOf(shape), editor: { kind: \"object\" }, private: false });\n },\n custom<In, Out = In, const O extends EntryOptions = {}>(initial: In, options?: EntryOptions & O & {\n readonly resolve?: (value: In) => Out;\n readonly lerp?: (from: Out, to: Out, t: number) => Out;\n /** What the value is, when a host can't tell from the default (`\"vector2\"`), and its parts. */\n readonly kind?: string;\n readonly properties?: PropertyEditor[\"properties\"];\n }): Type<In, Out, PrivateOf<O>> {\n const { resolve, lerp, private: _private, inherit: _inherit, ...rest } = options ?? ({} as NonNullable<typeof options>);\n // No kind of its own: a host reads one off the default, as for a bare `property`.\n return make({ default: initial, mapper: resolve, tween: lerp, editor: rest as PropertyEditor, private: options?.private === true, inherit: options?.inherit });\n },\n /** A colour per series or item, cycled by index. */\n palette: (initial: readonly Fill[] = []): Type<Fill[], FillResolved[][]> => make(paletteDef(initial)),\n /** A text style (face, size, weight, spacing, paint) for text a component draws; a partial one is laid over `initial`. */\n typography: (initial: TextStyle = {}): Type<TextStyle, TextStyle> => make(typographyDef(initial)),\n /**\n * A component's look as one entry: fields written in groups (`colors`, `text`, …), read flat\n * (`style.palette`). A host edits it field by field, saves it, and lays a saved one onto any\n * component of the same `family`; `to({ style })` tweens it field by field.\n */\n style<const G extends StyleGroups>(family: string, groups: G, options?: StyleOptions<StyleShape<G>>): Type<StyleInput<StyleShape<G>>, StyleValues<StyleShape<G>>> {\n return make(styleDef(family, groups, options as StyleOptions<unknown>));\n },\n image: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"image\" }, private: false }),\n video: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"video\" }, private: false }),\n audio: (src = \"\"): Type<string> => make({ default: src, editor: { kind: \"audio\" }, private: false }),\n font: (family = \"\"): Type<string> => make({ default: family, editor: { kind: \"font\" }, private: false }),\n /** Another node, by id: a document holds the id, and a field reads a view of that node (or `null`). */\n nodeRef: (initial = \"\"): Type<string, NodeView | null> => make({ default: initial, editor: { kind: \"nodeRef\", animatable: false }, private: false }),\n /** A seed for deterministic randomness: procedural motion stays a function of time. */\n seed: (initial = 1): Type<number> => make({ default: initial, editor: { kind: \"seed\" }, private: false }),\n};\n"]}
|
package/dist/experimental.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export declare const Types: {
|
|
|
60
60
|
readonly private: true;
|
|
61
61
|
} ? true : false>;
|
|
62
62
|
palette: (initial?: readonly import("./attributes/index.js").Fill[]) => import("./components/factory/api.js").Type<import("./attributes/index.js").Fill[], import("./attributes/index.js").FillResolved[][]>;
|
|
63
|
+
typography: (initial?: import("./attributes/index.js").TextStyle) => import("./components/factory/api.js").Type<import("./attributes/index.js").TextStyle, import("./attributes/index.js").TextStyle>;
|
|
63
64
|
style<const G extends import("./sdk/index.js").StyleGroups>(family: string, groups: G, options?: import("./sdk/index.js").StyleOptions<import("./sdk/index.js").StyleShape<G>>): import("./components/factory/api.js").Type<import("./sdk/index.js").StyleInput<import("./sdk/index.js").StyleShape<G>>, import("./sdk/index.js").StyleValues<import("./sdk/index.js").StyleShape<G>>>;
|
|
64
65
|
image: (src?: string) => import("./components/factory/api.js").Type<string>;
|
|
65
66
|
video: (src?: string) => import("./components/factory/api.js").Type<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGjE,iEAAiE;AACjE,eAAO,MAAM,WAAW,qBAAe,CAAC;AACxC,oEAAoE;AACpE,eAAO,MAAM,cAAc,wBAAkB,CAAC;AAC9C,iEAAiE;AACjE,eAAO,MAAM,WAAW,qBAAe,CAAC;AACxC,iEAAiE;AACjE,eAAO,MAAM,WAAW,qBAAe,CAAC;AACxC,2DAA2D;AAC3D,eAAO,MAAM,KAAK;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"experimental.d.ts","sourceRoot":"","sources":["../src/experimental.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,WAAW,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,0BAA0B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