@lipsjs/lips 0.3.1 → 0.4.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.
Files changed (45) hide show
  1. package/README.md +122 -9
  2. package/dist/lips.js +915 -669
  3. package/dist/lips.js.map +15 -12
  4. package/dist/lips.min.js +12 -12
  5. package/dist/lips.min.js.map +15 -12
  6. package/dist/lynx-background.min.js +3 -0
  7. package/dist/lynx-background.min.js.map +13 -0
  8. package/dist/lynx-main.min.js +3 -0
  9. package/dist/lynx-main.min.js.map +11 -0
  10. package/dist/lynx-plugin.mjs +1487 -0
  11. package/dist/lynx.min.js +8 -8
  12. package/dist/lynx.min.js.map +11 -10
  13. package/dist/mf2.min.js.map +1 -1
  14. package/dist/parts.min.js +19 -0
  15. package/dist/parts.min.js.map +11 -0
  16. package/dist/precompile.min.js +15 -15
  17. package/dist/precompile.min.js.map +8 -7
  18. package/dist/runtime.min.js +4 -4
  19. package/dist/runtime.min.js.map +11 -9
  20. package/dist/stylis.min.js.map +1 -1
  21. package/dist/types/component.d.ts +32 -0
  22. package/dist/types/ir/compiler.d.ts +2 -4
  23. package/dist/types/ir/facade.d.ts +63 -12
  24. package/dist/types/ir/host.d.ts +9 -1
  25. package/dist/types/ir/initial.d.ts +16 -0
  26. package/dist/types/ir/router.d.ts +2 -0
  27. package/dist/types/ir/tags.d.ts +16 -0
  28. package/dist/types/lips.d.ts +7 -7
  29. package/dist/types/lynx/a11y.d.ts +1 -0
  30. package/dist/types/lynx/background.d.ts +52 -3
  31. package/dist/types/lynx/main.d.ts +9 -5
  32. package/dist/types/lynx/plugin.d.ts +8 -0
  33. package/dist/types/lynx/protocol.d.ts +55 -4
  34. package/dist/types/lynx/style.d.ts +7 -0
  35. package/dist/types/lynx/template.d.ts +6 -0
  36. package/dist/types/parts/menu.d.ts +44 -0
  37. package/dist/types/parts/popover.d.ts +83 -0
  38. package/dist/types/parts.d.ts +16 -0
  39. package/dist/types/precompile.d.ts +8 -11
  40. package/dist/types/runtime.d.ts +1 -0
  41. package/dist/types/types.d.ts +181 -57
  42. package/dist/untrusted.min.js +4 -4
  43. package/dist/untrusted.min.js.map +7 -7
  44. package/package.json +24 -3
  45. package/dist/types/i18n/formatters.d.ts +0 -3
@@ -10,7 +10,7 @@
10
10
  "import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine, filter, assign} from './Utility.js'\nimport {copy, lift, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(children = element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, callback = /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n",
11
11
  "/**\n * Opt-in CSS preprocessor.\n *\n * import Lips from '@lipsjs/lips'\n * import { stylisPreprocessor } from '@lipsjs/lips/stylis'\n *\n * const lips = new Lips({ stylePreprocessor: stylisPreprocessor })\n *\n * and for build-time precompilation:\n *\n * precompile( template, { name, preprocess: stylisPreprocessor })\n * lipsPlugin({ preprocess: stylisPreprocessor })\n *\n * WITHOUT it Lips still compiles, scopes and injects stylesheets: the\n * scope wrap `[rel=\"card\"] { … }` is ordinary CSS nesting, which every\n * engine with CSS nesting resolves natively (Chrome/Edge 112+, Safari\n * 16.5+, Firefox 117+), and the compiler itself hoists the at-rules that\n * cannot legally nest (`@keyframes`, `@font-face`, …) and compacts the\n * text.\n *\n * What Stylis adds is FLATTENING: `[rel=\"card\"] .a { … }` instead of a\n * nested block, for engines older than native nesting — where a nested\n * sheet is dropped whole. It also accepts Stylis-only syntax such as\n * `&-suffix` concatenation. It costs ~1.9 KB gzipped, which is why it is\n * a choice rather than a default.\n *\n * It does NOT vendor-prefix — the full build never did. Stylis's\n * `prefixer` emits mostly obsolete prefixes (`-webkit-box`,\n * `-ms-flexbox`, …) and nearly doubles the cost; if you need it anyway:\n *\n * import { compile, serialize, middleware, prefixer, stringify } from 'stylis'\n * new Lips({ stylePreprocessor: css => serialize( compile( css ), middleware([ prefixer, stringify ]) ) })\n *\n * NB: it is handed over as a VALUE, never wired by importing this module\n * for its side effect. Each published entry (`@lipsjs/lips`,\n * `@lipsjs/lips/precompile`, this one) is a separate bundle with its own\n * copy of the style compiler, so a global set from one is invisible to\n * the others — passing the function is the only wiring that crosses that\n * boundary.\n */\nimport { compile, serialize, stringify, middleware } from 'stylis'\n\n/** Hand this to `new Lips({ stylePreprocessor })` or `precompile(…, { preprocess })` */\nexport const stylisPreprocessor = ( css: string ) =>\n serialize( compile( css ), middleware([ stringify ]) )\n"
12
12
  ],
13
- "mappings": "AAIO,IAAI,EAAU,OACV,EAAU,OACV,EAAc,OAIlB,IAAI,EAAS,UAKb,IAAI,EAAY,aACZ,GAAY,aAIhB,IAAI,GAAQ,SChBZ,IAAI,EAAM,KAAK,IAMX,EAAO,OAAO,aAqBlB,SAAS,CAAK,CAAC,EAAO,CAC5B,OAAO,EAAM,KAAK,EAkBZ,SAAS,CAAQ,CAAC,EAAO,EAAS,EAAa,CACrD,OAAO,EAAM,QAAQ,EAAS,CAAW,EASnC,SAAS,EAAQ,CAAC,EAAO,EAAQ,EAAU,CACjD,OAAO,EAAM,QAAQ,EAAQ,CAAQ,EAQ/B,SAAS,CAAO,CAAC,EAAO,EAAO,CACrC,OAAO,EAAM,WAAW,CAAK,EAAI,EAS3B,SAAS,CAAO,CAAC,EAAO,EAAO,EAAK,CAC1C,OAAO,EAAM,MAAM,EAAO,CAAG,EAOvB,SAAS,CAAO,CAAC,EAAO,CAC9B,OAAO,EAAM,OAOP,SAAS,CAAO,CAAC,EAAO,CAC9B,OAAO,EAAM,OAQP,SAAS,CAAO,CAAC,EAAO,EAAO,CACrC,OAAO,EAAM,KAAK,CAAK,EAAG,ECvGpB,IAAI,EAAO,EACP,EAAS,EACT,GAAS,EACT,EAAW,EACX,EAAY,EACZ,EAAa,GAYjB,SAAS,CAAK,CAAC,EAAO,EAAM,EAAQ,EAAM,EAAO,EAAU,EAAQ,EAAU,CACnF,MAAO,CAAC,MAAO,EAAO,KAAM,EAAM,OAAQ,EAAQ,KAAM,EAAM,MAAO,EAAO,SAAU,EAAU,KAAM,EAAM,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EAAS,EAAO,CAAU,EAE9B,OAAO,QAAS,CAAC,EAAS,EAAO,EAAU,EAAU,CACpD,IAAI,EAAS,GAEb,QAAS,EAAI,EAAG,EAAI,EAAQ,IAC3B,GAAU,EAAW,GAAG,EAAS,EAAO,EAAU,CAAQ,GAAK,GAEhE,OAAO,GCwBF,IAAM,GAAqB,CAAE,IACA,EAAW,GAAS,CAAI,EAAG,GAAW,CAAE,EAAU,CAAC,CAAE",
14
14
  "debugId": "AF142D960144E6D064756E2164756E21",
15
15
  "names": []
16
16
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * `component()` — a component written apart from where it is used, its
3
+ * types inferred.
4
+ *
5
+ * Written in a `register`, `render` or `root` call, a component needs
6
+ * nothing: those calls infer it themselves. Written apart — its own `.ts`
7
+ * file, a route table — its handlers' `this` is fixed where it is written,
8
+ * before any of them sees it, and this is what types it there.
9
+ *
10
+ * Returns what it is given: the object is the component, as it always
11
+ * was. All it adds is types: `state` and `static` read from their values,
12
+ * the handlers from themselves, and `this` in every handler from all
13
+ * three, its sibling handlers included.
14
+ *
15
+ * const counter = component({
16
+ * state: { count: 0 },
17
+ * handler: {
18
+ * step( by: number ){ this.state.count += by },
19
+ * reset(){ this.step( -this.state.count ) }
20
+ * },
21
+ * default: `<button on-click(step, 1)>{state.count}</button>`
22
+ * })
23
+ *
24
+ * What no value shows is named, by part, in a first call: the `input` a
25
+ * parent hands it, a `state` whose start says too little (`null`, `[]`),
26
+ * or a `context` other than the app's `SharedContext`:
27
+ *
28
+ * component<{ input: { initial?: number }, state: { picked: string | null } }>()({ … })
29
+ */
30
+ import type { TypedComponent, Definition, Inferred, Parts } from './types';
31
+ export declare function component<P extends Parts>(): <State extends object = {}, Static extends object = {}, Methods = {}>(definition: Definition<Inferred<P, State, Static>, Methods>) => TypedComponent<Inferred<P, State, Static>>;
32
+ export declare function component<State extends object = {}, Static extends object = {}, Methods = {}>(definition: Definition<Inferred<{}, State, Static>, Methods>): TypedComponent<Inferred<{}, State, Static>>;
@@ -21,6 +21,8 @@
21
21
  * one rather than parse markup (RFC-006 §4.1).
22
22
  */
23
23
  import type { TemplateNode, TemplateDiagnostic } from './parser';
24
+ import { CONTROL_TAGS, ARM_TAGS, HTML_TAGS } from './tags';
25
+ export { CONTROL_TAGS, ARM_TAGS, HTML_TAGS };
24
26
  export type Path = number[];
25
27
  export type E = number;
26
28
  export type CompInput = {
@@ -219,8 +221,4 @@ export interface CompileOptions {
219
221
  */
220
222
  check?: (nodes: TemplateNode[], diagnostics: TemplateDiagnostic[], src: string) => void;
221
223
  }
222
- export declare const CONTROL_TAGS: Set<string>;
223
- export declare const ARM_TAGS: Set<string>;
224
- /** Standard HTML + common SVG tags — anything else is a component candidate */
225
- export declare const HTML_TAGS: Set<string>;
226
224
  export declare function compileTemplate(src: string, options?: CompileOptions): CompileResult;
@@ -27,28 +27,34 @@ type StyleCompilerFn = (src: string, options: StyleCompileOptions) => StyleCompi
27
27
  export declare function setStyleCompiler(fn: StyleCompilerFn): void;
28
28
  export declare function setMessageFormat(engine: MessageFormatEngine): void;
29
29
  export declare function registerBuiltin(name: string, template: any): void;
30
+ export declare function setNameCheck(fn: (name: string) => string | undefined): void;
30
31
  import type { RuntimeOptions } from './runtime';
31
32
  import Events from '../events';
32
33
  import type { StyleIR, StyleCompileResult, StyleCompileOptions } from './style';
33
- import type { Template, Metavars, LipsConfig, MessageFormatEngine } from '../types';
34
+ import type { Component, TypedComponent, Definition, Inferred, Shape, LipsConfig, MessageFormatEngine, Plugin } from '../types';
34
35
  import I18N from '../i18n';
35
36
  /**
36
- * The authoring shape IS the public `Template<MT>` — one type, not a
37
+ * The authoring shape IS the public `Component<S>` — one type, not a
37
38
  * parallel internal one. `FacadeTemplate` remains as the erased form
38
- * used where the metavars are not known (caches, dynamic resolution).
39
+ * used where the shape is not known (caches, dynamic resolution).
39
40
  */
40
- type FacadeTemplate = Template<any>;
41
+ type FacadeTemplate = Component<any>;
41
42
  type FacadeConfig<Context extends Object = Record<string, any>> = LipsConfig<Context> & {
42
43
  mode?: 'compiled' | 'interpreted';
43
44
  };
44
- export declare class IRFacadeComponent<MT extends Metavars = Metavars> extends Events {
45
+ /**
46
+ * Names template handlers must not override on the component
47
+ * self — mirrors the old engine's reserved-member guard.
48
+ */
49
+ export declare const RESERVED: readonly ["state", "input", "static", "context", "emit", "on", "once", "off", "node", "lang", "setContext", "setLanguage", "destroy", "appendTo", "prependTo", "replaceWith", "render", "swap"];
50
+ export declare class IRFacadeComponent<S extends Shape = Shape> extends Events {
45
51
  private lips;
46
52
  private template;
47
- readonly state: MT['State'];
53
+ readonly state: S['state'];
48
54
  private instance;
49
55
  private contextWatcher?;
50
56
  private destroyed;
51
- constructor(lips: IRLips<any>, name: string, template: Template<MT>, input: MT['Input'] | undefined, ir: TemplateIR, options: RuntimeOptions);
57
+ constructor(lips: IRLips<any>, name: string, template: Component<S>, input: S['input'] | undefined, ir: TemplateIR, options: RuntimeOptions);
52
58
  /**
53
59
  * The component bus is bidirectional.
54
60
  *
@@ -73,10 +79,13 @@ export declare class IRFacadeComponent<MT extends Metavars = Metavars> extends E
73
79
  swap(newIR: TemplateIR): import("./swap").SwapReport;
74
80
  destroy(): void;
75
81
  }
76
- export declare class IRLips<Context extends Object = Record<string, any>> {
82
+ /** `Context` left out is the app's `SharedContext`: the context of a shape that names none */
83
+ export declare class IRLips<Context extends Object = Shape<{}>['context']> {
77
84
  private config?;
78
85
  debug: boolean;
79
86
  private store;
87
+ /** Installed plugins, by name (`use`) */
88
+ private plugins;
80
89
  private irCache;
81
90
  private defCache;
82
91
  private styleCache;
@@ -101,7 +110,26 @@ export declare class IRLips<Context extends Object = Record<string, any>> {
101
110
  */
102
111
  private componentsProxy;
103
112
  constructor(config?: FacadeConfig<Context> | undefined);
104
- register<MT extends Metavars = Metavars>(name: string, template: Template<MT>): this;
113
+ /**
114
+ * A component by name. A name the compiler reads as an element or a
115
+ * syntax tag is refused: the compiler resolves those tags before it
116
+ * looks here, so the component would never render, and what fails
117
+ * instead is whatever its markup reads (`./tags`).
118
+ */
119
+ register<S extends Shape>(name: string, template: TypedComponent<S>): this;
120
+ /** Written in the call: its state, static and handlers inferred, `this` typed in each */
121
+ register<State extends object = {}, Static extends object = {}, Methods = {}>(name: string, template: Definition<Inferred<{
122
+ input: Record<string, any>;
123
+ }, State, Static>, Methods>): this;
124
+ /**
125
+ * Install a plugin: what it requires first, then its components, then
126
+ * its own setup. Once per Lips: using it again, or another plugin that
127
+ * requires it, does nothing. Refused: another plugin of the same name,
128
+ * and a component name something else holds.
129
+ *
130
+ * lips.use( menu ) // and the popover it is built on
131
+ */
132
+ use<O>(plugin: Plugin<O>, options?: O): this;
105
133
  unregister(name: string): this;
106
134
  has(name: string): boolean;
107
135
  private compile;
@@ -111,9 +139,30 @@ export declare class IRLips<Context extends Object = Record<string, any>> {
111
139
  * per component type, so this runs once no matter how many instances.
112
140
  */
113
141
  styleFor(name: string, template: FacadeTemplate): StyleIR | undefined;
142
+ /**
143
+ * The scope of a template placed by value with no `name` (a route page,
144
+ * `<{state.view}/>`): one per template object. A name it shared with
145
+ * every other unnamed template made their sheets one `<style>`, the
146
+ * first one's, so the second never injected while the first lived.
147
+ */
148
+ private unnamed;
149
+ private anonymous;
150
+ private anonymousCount;
114
151
  private defFor;
115
- render<MT extends Metavars = Metavars>(name: string, template: Template<MT>, input?: MT['Input']): IRFacadeComponent<MT>;
116
- root<MT extends Metavars = Metavars>(template: Template<MT>, selector: string): IRFacadeComponent<any>;
152
+ render<S extends Shape>(name: string, template: TypedComponent<S>, input?: S['input']): IRFacadeComponent<S>;
153
+ /** Written in the call: inferred as `register()` infers it, `input` as what it is handed */
154
+ render<State extends object = {}, Static extends object = {}, Methods = {}, Input extends object = Record<string, any>>(name: string, template: Definition<Inferred<{
155
+ input: Input;
156
+ }, State, Static>, Methods>, input?: Input): IRFacadeComponent<Inferred<{
157
+ input: Input;
158
+ }, State, Static>>;
159
+ root<S extends Shape>(template: TypedComponent<S>, selector: string): IRFacadeComponent<S>;
160
+ /** Written in the call: inferred as `register()` infers it */
161
+ root<State extends object = {}, Static extends object = {}, Methods = {}>(template: Definition<Inferred<{
162
+ input: Record<string, any>;
163
+ }, State, Static>, Methods>, selector: string): IRFacadeComponent<Inferred<{
164
+ input: Record<string, any>;
165
+ }, State, Static>>;
117
166
  /**
118
167
  * The only way to change language. Writing `lips.i18n.lang` directly
119
168
  * updates the dictionary lookup but not the signal, so nothing already
@@ -125,7 +174,9 @@ export declare class IRLips<Context extends Object = Record<string, any>> {
125
174
  /** Reactive store, indexed dynamically — Context only types the surface */
126
175
  private get ctx();
127
176
  getContext(): Context;
128
- setContext(arg: (keyof Context & string) | Partial<Context>, value?: any): void;
177
+ /** One field, its value of its type; or several at once */
178
+ setContext<K extends keyof Context & string>(key: K, value: Context[K]): void;
179
+ setContext(fields: Partial<Context>): void;
129
180
  /**
130
181
  * Subscribe to a subset of context fields — the effect tracks
131
182
  * exactly those keys, so unrelated context writes don't fire it.
@@ -63,7 +63,15 @@ export interface Host<N = any> {
63
63
  styleVar(el: N, prop: string, value: string | null): void;
64
64
  /** Mark a component root with its stylesheet scope. An inner scope already set wins */
65
65
  scope(el: N, nsp: string): void;
66
- /** Returns the unlisten function */
66
+ /**
67
+ * Returns the unlisten function. `name` may carry modifiers, as the
68
+ * template writes them (`on-click.stop( … )`), and the host gives them
69
+ * one meaning:
70
+ * - `.stop`: the event goes no further up once this handler has it
71
+ * - `.capture`: this handler has it on the way down, before its target
72
+ * - `.outside`: the handler runs for the event anywhere EXCEPT in this
73
+ * element, seen before anything on the way can stop it
74
+ */
67
75
  listen(el: N, name: string, fn: (event: any) => void): () => void;
68
76
  /** Capture focus before a swap moves nodes; the returned function restores it */
69
77
  keepFocus?(): () => void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * An instance's own copy of what its template declares (`state`, `static`).
3
+ *
4
+ * A template is written once and drawn many times: each instance starts
5
+ * from what it declares and changes its own copy, never the template's
6
+ * nor its siblings'. The legacy engine copied both per instance; the IR
7
+ * engine had dropped it, so two instances pushing into a declared list
8
+ * pushed into one array, the template's.
9
+ *
10
+ * What is copied is what an author declares as data: plain objects,
11
+ * arrays, `Map`, `Set`, `Date`, `RegExp` and typed arrays, deeply, cycles
12
+ * kept. Anything else (a class instance, a function, a promise) is a value
13
+ * the author holds, kept as it is: a client copied field by field would
14
+ * lose its private fields and stop being the one the app configured.
15
+ */
16
+ export declare function initial<T>(value: T, seen?: WeakMap<object, unknown>): T;
@@ -31,6 +31,8 @@ export declare const routerTemplate: {
31
31
  global?: boolean;
32
32
  }): void;
33
33
  onAttach(this: any): void;
34
+ /** A router that is gone stops answering the browser */
35
+ onDestroy(this: any): void;
34
36
  navigate(this: any, path: string, back?: boolean): void;
35
37
  match(this: any, path: string): false | {
36
38
  route: Route;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The tags the compiler reads as something other than a component.
3
+ *
4
+ * Their own module, so the registry can refuse a component named after one
5
+ * (`IRLips.register`) in a build that ships no compiler (`./runtime`).
6
+ */
7
+ export declare const CONTROL_TAGS: Set<string>;
8
+ export declare const ARM_TAGS: Set<string>;
9
+ /** Standard HTML + common SVG tags — anything else is a component candidate */
10
+ export declare const HTML_TAGS: Set<string>;
11
+ /**
12
+ * What `name` is to the compiler when it is not a component, or undefined
13
+ * when a component of that name renders as one. Tag names reach the
14
+ * compiler lowercased, so `Menu` is `menu`.
15
+ */
16
+ export declare function taken(name: string): string | undefined;
@@ -10,17 +10,17 @@
10
10
  * time (see `compileTemplate`) for CSP-safe, parse-free startup.
11
11
  */
12
12
  import { IRLips, IRFacadeComponent } from './ir/facade';
13
- import type { Metavars } from './types';
13
+ import type { Shape } from './types';
14
14
  export * from './types';
15
+ export { component } from './component';
15
16
  export type { TemplatePolicy, Refusal, Verdict, Untrusted } from './ir/policy';
16
17
  export { parseTemplate, parseSFC, compileTemplate, compileStyle, renderIR, signal, effect, untrack, reactive, batch } from './ir';
17
18
  export type { TemplateIR, BlockIR, NodeIR, CompileOptions, Host, BindIR, ChildIR, CompileResult, StyleIR, StyleBindIR, StyleCompileResult, TemplateDiagnostic, IRInstance, IRComponentDef, RuntimeOptions, RenderSetup, SwapReport, SwapChange } from './ir';
18
19
  /**
19
- * A rendered component handle. Generic over the same `Metavars` the
20
- * template declares, so `component.state` is typed, not `any`:
20
+ * A rendered component: what `render()` and `root()` return, typed by the
21
+ * component it rendered, so `c.state` is not `any`:
21
22
  *
22
- * type MT = Metavars<{ tone: string }, { count: number }>
23
- * const c: Component<MT> = lips.render<MT>('counter', counter)
23
+ * const c = lips.render('counter', counter)
24
24
  * c.state.count++ // number
25
25
  *
26
26
  * Its event bus runs both ways — `c.on('saved', …)` receives what the
@@ -28,7 +28,7 @@ export type { TemplateIR, BlockIR, NodeIR, CompileOptions, Host, BindIR, ChildIR
28
28
  * registered with `this.on(…)`. Inbound events do NOT invoke handler
29
29
  * methods by name, so what a component accepts stays explicit.
30
30
  */
31
- export type Component<MT extends Metavars = Metavars> = IRFacadeComponent<MT>;
31
+ export type Rendered<S extends Shape = Shape> = IRFacadeComponent<S>;
32
32
  /** The Lips instance, generic over the shared context shape */
33
- export type Lips<Context extends Object = Record<string, any>> = IRLips<Context>;
33
+ export type Lips<Context extends Object = Shape<{}>['context']> = IRLips<Context>;
34
34
  export default IRLips;
@@ -16,6 +16,7 @@
16
16
  * aria-modal accessibility-exclusive-focus
17
17
  * aria-live, role=status|log|alert lynx.accessibilityAnnounce of the region's text
18
18
  * tabindex focusable
19
+ * disabled on a button accessibility-value, as aria-disabled; its taps are dropped
19
20
  *
20
21
  * What has no Lynx equivalent is a compile-time warning (`./template`).
21
22
  */
@@ -15,13 +15,23 @@
15
15
  * Markers, fragments and stray text never cross. Insert positions skip
16
16
  * them, so the main thread sees exactly the real children, in order.
17
17
  *
18
+ * An element node answers the DOM element's own methods (`focus`, `blur`,
19
+ * `scrollTo`, `scrollIntoView`, `animate`), so a `@ref` means the same on
20
+ * both: each is a UI method, run once the batch is flushed (lips#37).
21
+ *
22
+ * Nor do the parts of an `<svg>` (the elements the template pass stamped
23
+ * `lips-svg`): Lynx draws an svg as one view from a markup string, so its
24
+ * subtree is written into its `content`, once per flush when it changed.
25
+ *
18
26
  * const lynxHost = createBackgroundHost( ops => send( ops ) )
19
27
  * renderIR( ir, setup, { host: lynxHost.host } ).mount( lynxHost.root )
20
28
  */
21
29
  import type { Host } from '../ir/host';
22
30
  import { type TreeNode } from '../ir/tree';
23
31
  import { type Aria, type Words } from './a11y';
24
- import { type WireEvent } from './protocol';
32
+ import { type WireEvent, type WireReply } from './protocol';
33
+ /** A DOM `animate` option: its duration alone, or the options Lynx's `animate` reads as they are */
34
+ type AnimateOptions = number | Record<string, unknown>;
25
35
  export interface LynxNode extends TreeNode {
26
36
  parent: LynxNode | null;
27
37
  first: LynxNode | null;
@@ -46,6 +56,44 @@ export interface LynxNode extends TreeNode {
46
56
  idv?: string;
47
57
  sent?: Record<string, unknown>;
48
58
  said?: string;
59
+ /** Each attribute as last written: an equal write is not sent again */
60
+ wrote?: Record<string, string | null>;
61
+ /** What a `@ref` calls, as on the DOM element (lips#37) */
62
+ focus(): void;
63
+ blur(): void;
64
+ scrollTo(x?: number | {
65
+ top?: number;
66
+ left?: number;
67
+ behavior?: string;
68
+ }, y?: number): void;
69
+ scrollIntoView(arg?: boolean | {
70
+ behavior?: string;
71
+ block?: string;
72
+ inline?: string;
73
+ }): void;
74
+ animate(keyframes: unknown, options?: AnimateOptions): {
75
+ id: string;
76
+ play(): void;
77
+ pause(): void;
78
+ cancel(): void;
79
+ finish(): void;
80
+ };
81
+ /** Its box once laid out, or null when Lynx cannot measure it: a promise here, so `await` it on both hosts */
82
+ getBoundingClientRect(): Promise<Rect | null>;
83
+ /** Part of an svg's markup: its SVG spelling. On an svg: the markup last sent */
84
+ part?: string;
85
+ drawn?: string;
86
+ }
87
+ /** A box as the DOM's `getBoundingClientRect()` gives it, in CSS pixels */
88
+ export interface Rect {
89
+ x: number;
90
+ y: number;
91
+ width: number;
92
+ height: number;
93
+ top: number;
94
+ right: number;
95
+ bottom: number;
96
+ left: number;
49
97
  }
50
98
  export interface BackgroundOptions {
51
99
  /** Speak a live region's new text: `lynx.accessibilityAnnounce` on the real thread */
@@ -57,8 +105,8 @@ export interface BackgroundHost {
57
105
  host: Host<LynxNode>;
58
106
  /** The page: mount the root instance here */
59
107
  root: LynxNode;
60
- /** An element event forwarded by the main thread */
61
- receive(wire: WireEvent): void;
108
+ /** An element event forwarded by the main thread, or a UI method's result */
109
+ receive(wire: WireEvent | WireReply): void;
62
110
  /** Send what is pending now instead of at the end of the microtask */
63
111
  flush(): void;
64
112
  }
@@ -69,3 +117,4 @@ export declare function createBackgroundHost(send: (ops: unknown[]) => void, { a
69
117
  * thread, both ways.
70
118
  */
71
119
  export declare function connectBackground(words?: Words): BackgroundHost;
120
+ export {};
@@ -9,10 +9,10 @@
9
9
  * `__InsertElementBefore` / `__AppendElement` / `__RemoveElement`,
10
10
  * `__SetAttribute` / `__SetClasses` / `__SetID` / `__AddDataset`,
11
11
  * `__SetInlineStyles`, `__AddEventListener` / `__RemoveEventListener`,
12
- * `__CreateList` with `update-list-info`, `__InvokeUIMethod` and
13
- * `__FlushElementTree`.
12
+ * `__CreateList` with `update-list-info`, `__InvokeUIMethod`,
13
+ * `__ElementAnimate` and `__FlushElementTree`.
14
14
  */
15
- import { type WireEvent } from './protocol';
15
+ import { type WireEvent, type WireReply } from './protocol';
16
16
  /** An Element PAPI handle — opaque, never read or sent */
17
17
  type Ref = object;
18
18
  declare global {
@@ -34,10 +34,14 @@ declare global {
34
34
  function __SetInlineStyles(el: Ref, styles: unknown): void;
35
35
  function __AddEventListener(el: Ref, name: string, fn: (e: any) => void, options: object): void;
36
36
  function __RemoveEventListener(el: Ref, name: string, fn: (e: any) => void, options: object): void;
37
- function __InvokeUIMethod(el: Ref, method: string, params: object, callback: (result: unknown) => void): void;
37
+ function __InvokeUIMethod(el: Ref, method: string, params: object, callback: (result: {
38
+ code: number;
39
+ data?: unknown;
40
+ }) => void): void;
41
+ function __ElementAnimate(el: Ref, args: unknown[]): void;
38
42
  function __FlushElementTree(el?: Ref, options?: object): void;
39
43
  }
40
- export declare function createApplier(page: Ref, forward: (wire: WireEvent) => void): (ops: any[]) => void;
44
+ export declare function createApplier(page: Ref, forward: (wire: WireEvent | WireReply) => void): (ops: any[]) => void;
41
45
  /**
42
46
  * Wire an applier to the real thread bridge. On the main thread
43
47
  * `lynx.getJSContext()` is the endpoint connected to the background.
@@ -0,0 +1,8 @@
1
+ /** What this plugin uses of Rsbuild's plugin API: kept local, so Lips takes no build tool as a dependency */
2
+ export interface LipsRsbuildPlugin {
3
+ name: string;
4
+ setup(api: any): void;
5
+ }
6
+ /** Compile one sheet; any error fails the build, warnings are printed */
7
+ export declare function buildSheet(source: string, path: string): import("../ir").StyleIR;
8
+ export declare const pluginLips: () => LipsRsbuildPlugin;
@@ -15,11 +15,15 @@
15
15
  * ATTR id, name, value routed: class / id / data-* / attribute
16
16
  * SET_TEXT id, value raw text's value
17
17
  * STYLES id, css the whole inline style
18
- * LISTEN id, name forward that event to the background
18
+ * LISTEN id, name forward that event to the background;
19
+ * `name.capture`, `name.stop` bind it so
19
20
  * UNLISTEN id, name stop forwarding it
20
21
  * RELEASE id forget the id (the node is gone)
21
- * INVOKE id, method, params a UI method (`setValue`, `scrollTo`, …),
22
- * once the batch is flushed
22
+ * INVOKE id, method, params, a UI method (`setValue`, `scrollTo`, …),
23
+ * call once the batch is flushed; `animate`
24
+ * is `__ElementAnimate( params )`. A
25
+ * `call` other than 0 asks for its
26
+ * result, sent back as a `WireReply`
23
27
  *
24
28
  * A `list` is the exception to "INSERT inserts": Lynx asks for its cells
25
29
  * as they scroll into view. The applier keeps each list's order and
@@ -32,15 +36,56 @@ export declare const PAGE_ID = 1;
32
36
  /** Cross-thread event names — background → main, and main → background */
33
37
  export declare const OPS_EVENT = "lips:ops";
34
38
  export declare const DOM_EVENT = "lips:event";
35
- /** An element event as it crosses to the background: data only, never a ref */
39
+ /** Where an event happened, or who listens: an element's `id` and `dataset` */
40
+ export interface WireTarget {
41
+ id?: string;
42
+ dataset: Record<string, unknown>;
43
+ }
44
+ /** A touch point, as Lynx reports it */
45
+ export interface WirePoint {
46
+ identifier?: number;
47
+ x?: number;
48
+ y?: number;
49
+ pageX?: number;
50
+ pageY?: number;
51
+ clientX?: number;
52
+ clientY?: number;
53
+ }
54
+ /**
55
+ * An element event as it crosses to the background: data only, never a
56
+ * ref. What each kind carries is picked on the main thread (`./main`).
57
+ */
36
58
  export interface WireEvent {
37
59
  id: number;
38
60
  name: string;
61
+ /** The Lips id of the element the event happened on, when it is one */
62
+ t?: number;
39
63
  event: {
40
64
  type: string;
41
65
  detail?: unknown;
66
+ target?: WireTarget;
67
+ currentTarget?: WireTarget;
68
+ /** Key events */
69
+ key?: string;
70
+ repeat?: boolean;
71
+ altKey?: boolean;
72
+ ctrlKey?: boolean;
73
+ metaKey?: boolean;
74
+ shiftKey?: boolean;
75
+ /** Touch events */
76
+ touches?: WirePoint[];
77
+ changedTouches?: WirePoint[];
42
78
  };
43
79
  }
80
+ /**
81
+ * A UI method's result, for the INVOKE that asked (`call`): what Lynx's
82
+ * callback was given, `code` 0 for success (`LynxUIMethodConstants`).
83
+ */
84
+ export interface WireReply {
85
+ call: number;
86
+ code: number;
87
+ data?: unknown;
88
+ }
44
89
  export declare const LYNX_TAG: Record<string, string>;
45
90
  /**
46
91
  * The class a stylesheet scope stamps on a component's roots — what its
@@ -48,5 +93,11 @@ export declare const LYNX_TAG: Record<string, string>;
48
93
  * match on Lynx, so the DOM's `rel` cannot be used.
49
94
  */
50
95
  export declare const scopeClass: (nsp: string) => string;
96
+ /**
97
+ * The attribute the template pass stamps on every element inside an
98
+ * `<svg>`, holding its SVG spelling: it is part of the svg's markup, and
99
+ * never an element of its own on the main thread.
100
+ */
101
+ export declare const SVG_PART = "lips-svg";
51
102
  /** Template event name → Lynx event name: DOM spellings keep working */
52
103
  export declare const LYNX_EVENT: Record<string, string>;
@@ -40,10 +40,17 @@ export interface LynxStyleOptions {
40
40
  * - `enableCSSInheritance`: `color`, `font-size` and the other text
41
41
  * properties inherit, as on the web. Templates are HTML-shaped and
42
42
  * sheets are written for the web's cascade.
43
+ * - `enableA11y` (lips#44): Android's helper accessibility path, the only
44
+ * one that reads `accessibility-traits` and role descriptions. Without
45
+ * it TalkBack gets a button as `LynxFlattenUI`, with no role; with it,
46
+ * as `android.widget.Button` (Android emulator, RFC-006 §9.4). It is
47
+ * page-wide: an app that wants the default path sets `enableA11y:
48
+ * false` in its own page config, which `pluginLips` keeps.
43
49
  */
44
50
  export declare const LYNX_PAGE_CONFIG: {
45
51
  enableCSSInlineVariables: boolean;
46
52
  enableCSSRule: boolean;
47
53
  enableCSSInheritance: boolean;
54
+ enableA11y: boolean;
48
55
  };
49
56
  export declare function compileLynxStyle(source: string, options: LynxStyleOptions): StyleCompileResult;
@@ -15,6 +15,11 @@
15
15
  * - A `list` holds `list-item`s: Lynx renders nothing else in one.
16
16
  * - ARIA Lynx cannot read is a warning: the content stays readable, the
17
17
  * semantics are lost (RFC-006 §4.8; what it can read, `./a11y`).
18
+ * - An `<svg>` is kept whole: Lynx draws it as ONE native view from a
19
+ * markup string, not from child elements. Every element inside is
20
+ * stamped `lips-svg` with its SVG spelling, and the background host
21
+ * writes the subtree into the svg's `content` (`./background`). What
22
+ * Lynx's svg does not read is a warning.
18
23
  *
19
24
  * code what
20
25
  * LIPS-L101 HTML tag with no Lynx element
@@ -24,6 +29,7 @@
24
29
  * LIPS-L105 a role with no Lynx equivalent (warning)
25
30
  * LIPS-L106 an aria-* attribute with no Lynx equivalent (warning)
26
31
  * LIPS-L107 a positive tabindex: Lynx has no focus order (warning)
32
+ * LIPS-L108 inside an svg: a tag, attribute, event or component Lynx's svg does not draw (warning)
27
33
  *
28
34
  * Macro bodies are inlined after this pass, so it does not see them.
29
35
  */
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Menu: a popover's panel of actions (RFC-008 §5; WAI-ARIA's menu button).
3
+ *
4
+ * lips.use( menu ) // and the popover it is built on
5
+ *
6
+ * <popover open=state.open on-change( setOpen )>
7
+ * <popover-trigger haspopup="menu"><span>Actions</span></popover-trigger>
8
+ * <popover-menu items=state.actions class="menu" item="menu-item" on-select( run )/>
9
+ * </popover>
10
+ *
11
+ * Named `popover-menu`: `menu` is an HTML element, which the compiler
12
+ * reads as one.
13
+ *
14
+ * Its items are data, `{ id, label, disabled? }`, each drawn as its label
15
+ * or by the slot, which gets `item` and `active`:
16
+ * `<popover-menu … [item, active]><span>{item.label}</span></popover-menu>`.
17
+ *
18
+ * Its list is the popup (`popup="content"`): mounted each time the menu
19
+ * opens, it starts on the item the trigger asked for, takes focus, and
20
+ * names the active item with `aria-activedescendant`. Arrows move it, Home
21
+ * and End go to the first and last, a letter to the next item it starts,
22
+ * all past disabled items. Enter or Space selects it; a tap selects the
23
+ * item tapped. Selecting emits `select` with the item and closes the menu,
24
+ * giving focus back to the trigger. Tab closes it and lets focus move on.
25
+ * On Lynx, which has no menu role, each item is a button.
26
+ *
27
+ * The active item has the class `is-active`; a disabled one,
28
+ * `aria-disabled` and `is-disabled`.
29
+ */
30
+ import type { Plugin } from '../types';
31
+ export interface MenuItem {
32
+ readonly id: string;
33
+ readonly label: string;
34
+ readonly disabled?: boolean;
35
+ }
36
+ /**
37
+ * The next item to make active from `from`, by `step` (±1), wrapping and
38
+ * skipping disabled ones; -1 when none can be. `from` -1 starts before the
39
+ * first item, `items.length` after the last.
40
+ */
41
+ export declare function move(items: readonly MenuItem[], from: number, step: 1 | -1): number;
42
+ /** The next enabled item after `from` whose label starts with `letter`, wrapping; -1 when none */
43
+ export declare function typed(items: readonly MenuItem[], from: number, letter: string): number;
44
+ export declare const menu: Plugin;