@rindo/core 2.18.0 → 2.22.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/cli/config-flags.d.ts +33 -21
- package/cli/index.cjs +670 -388
- package/cli/index.d.ts +3 -0
- package/cli/index.js +670 -388
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +434 -251
- package/compiler/lib.dom.iterable.d.ts +7 -13
- package/compiler/lib.es2015.collection.d.ts +62 -1
- package/compiler/lib.es2015.promise.d.ts +9 -4
- package/compiler/lib.es2015.proxy.d.ts +91 -2
- package/compiler/lib.es2015.reflect.d.ts +25 -2
- package/compiler/lib.es2015.symbol.wellknown.d.ts +3 -3
- package/compiler/lib.es2017.intl.d.ts +16 -1
- package/compiler/lib.es2019.d.ts +1 -0
- package/compiler/lib.es2019.intl.d.ts +25 -0
- package/compiler/lib.es2020.intl.d.ts +31 -6
- package/compiler/lib.es2021.intl.d.ts +11 -3
- package/compiler/lib.es2022.d.ts +1 -0
- package/compiler/lib.es2022.error.d.ts +2 -2
- package/compiler/lib.es2022.sharedmemory.d.ts +27 -0
- package/compiler/lib.es5.d.ts +39 -14
- package/compiler/lib.esnext.intl.d.ts +5 -1
- package/compiler/lib.webworker.d.ts +318 -55
- package/compiler/lib.webworker.iterable.d.ts +11 -3
- package/compiler/package.json +1 -1
- package/compiler/rindo.d.ts +3 -25
- package/compiler/rindo.js +53912 -51834
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +3 -3
- package/compiler/transpile.d.ts +32 -0
- package/dependencies.json +3 -1
- package/dev-server/client/app-error.d.ts +1 -1
- package/dev-server/client/index.d.ts +2 -2
- package/dev-server/client/index.js +241 -241
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +3 -3
- package/dev-server/index.d.ts +1 -1
- package/dev-server/index.js +2 -2
- package/dev-server/open-in-editor-api.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1182 -1148
- package/dev-server/ws.js +1 -1
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +2 -2
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +800 -673
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +19 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/polyfills/css-shim.js +1 -1
- package/internal/client/shadow-css.js +1 -1
- package/internal/hydrate/index.js +154 -143
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.d.ts +1 -1
- package/internal/hydrate/runner.js +106 -106
- package/internal/package.json +1 -1
- package/internal/rindo-core/index.d.ts +9 -10
- package/internal/rindo-private.d.ts +149 -80
- package/internal/rindo-public-compiler.d.ts +68 -32
- package/internal/rindo-public-docs.d.ts +24 -0
- package/internal/rindo-public-runtime.d.ts +79 -7
- package/internal/testing/index.js +187 -175
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +905 -896
- package/mock-doc/index.d.ts +2 -2
- package/mock-doc/index.js +905 -896
- package/mock-doc/package.json +1 -1
- package/package.json +48 -57
- package/readme.md +44 -31
- package/screenshot/compare/build/p-f4745c2f.entry.js +1 -1
- package/screenshot/index.d.ts +1 -1
- package/screenshot/index.js +3 -3
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +983 -849
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/glob.js +1 -1
- package/sys/node/index.d.ts +4 -0
- package/sys/node/index.js +407 -418
- package/sys/node/package.json +1 -1
- package/sys/node/prompts.js +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.d.ts +6 -6
- package/testing/index.js +1136 -1277
- package/testing/jest/jest-config.d.ts +1 -1
- package/testing/jest/jest-preprocessor.d.ts +3 -3
- package/testing/jest/jest-serializer.d.ts +1 -2
- package/testing/matchers/index.d.ts +3 -3
- package/testing/mock-fetch.d.ts +1 -1
- package/testing/mocks.d.ts +2 -2
- package/testing/package.json +1 -1
- package/testing/puppeteer/puppeteer-declarations.d.ts +5 -5
- package/testing/puppeteer/puppeteer-element.d.ts +2 -2
- package/testing/puppeteer/puppeteer-events.d.ts +1 -1
- package/testing/testing-logger.d.ts +1 -1
- package/testing/testing-utils.d.ts +1 -1
- package/testing/testing.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { JsonDocs } from './rindo-public-docs';
|
|
2
|
-
import type { PrerenderUrlResults } from '../internal';
|
|
3
1
|
import type { ConfigFlags } from '../cli/config-flags';
|
|
2
|
+
import type { PrerenderUrlResults } from '../internal';
|
|
3
|
+
import type { JsonDocs } from './rindo-public-docs';
|
|
4
4
|
export * from './rindo-public-docs';
|
|
5
5
|
/**
|
|
6
6
|
* https://rindojs.web.app/docs/config/
|
|
@@ -66,7 +66,7 @@ export interface RindoConfig {
|
|
|
66
66
|
* The namespace config is a string representing a namespace for the app.
|
|
67
67
|
* For apps that are not meant to be a library of reusable components,
|
|
68
68
|
* the default of App is just fine. However, if the app is meant to be consumed
|
|
69
|
-
* as a third-party library, such as
|
|
69
|
+
* as a third-party library, such as Family, a unique namespace is required.
|
|
70
70
|
*/
|
|
71
71
|
namespace?: string;
|
|
72
72
|
/**
|
|
@@ -153,7 +153,7 @@ export interface RindoConfig {
|
|
|
153
153
|
*/
|
|
154
154
|
hydratedFlag?: HydratedFlag;
|
|
155
155
|
/**
|
|
156
|
-
*
|
|
156
|
+
* Family prefers to hide all components prior to hydration with a style tag appended
|
|
157
157
|
* to the head of the document containing some `visibility: hidden;` css rules.
|
|
158
158
|
*
|
|
159
159
|
* Disabling this will remove the style tag that sets `visibility: hidden;` on all
|
|
@@ -163,7 +163,7 @@ export interface RindoConfig {
|
|
|
163
163
|
*/
|
|
164
164
|
invisiblePrehydration?: boolean;
|
|
165
165
|
/**
|
|
166
|
-
* Sets the task queue used by
|
|
166
|
+
* Sets the task queue used by Rindo's runtime. The task queue schedules DOM read and writes
|
|
167
167
|
* across the frames to efficiently render and reduce layout thrashing. By default,
|
|
168
168
|
* `async` is used. It's recommended to also try each setting to decide which works
|
|
169
169
|
* best for your use-case. In all cases, if your app has many CPU intensive tasks causing the
|
|
@@ -351,12 +351,12 @@ export interface Config extends RindoConfig {
|
|
|
351
351
|
* conforming to a given interface. For best results, pair with a validation
|
|
352
352
|
* function as shown in the example.
|
|
353
353
|
*/
|
|
354
|
-
|
|
354
|
+
type Loose<T extends Object> = Record<string, any> & Partial<T>;
|
|
355
355
|
/**
|
|
356
356
|
* A Loose version of the Config interface. This is intended to let us load a partial config
|
|
357
357
|
* and have type information carry though as we construct an object which is a valid `Config`.
|
|
358
358
|
*/
|
|
359
|
-
export
|
|
359
|
+
export type UnvalidatedConfig = Loose<Config>;
|
|
360
360
|
/**
|
|
361
361
|
* Helper type to strip optional markers from keys in a type, while preserving other type information for the key.
|
|
362
362
|
* This type takes a union of keys, K, in type T to allow for the type T to be gradually updated.
|
|
@@ -366,20 +366,20 @@ export declare type UnvalidatedConfig = Loose<Config>;
|
|
|
366
366
|
* type ReqFieldFoo = RequireFields<Foo, 'bar'>; // { bar: number, baz?: string }
|
|
367
367
|
* ```
|
|
368
368
|
*/
|
|
369
|
-
|
|
369
|
+
type RequireFields<T, K extends keyof T> = T & {
|
|
370
370
|
[P in K]-?: T[P];
|
|
371
371
|
};
|
|
372
372
|
/**
|
|
373
373
|
* Fields in {@link Config} to make required for {@link ValidatedConfig}
|
|
374
374
|
*/
|
|
375
|
-
|
|
375
|
+
type StrictConfigFields = 'flags' | 'logger' | 'outputTargets' | 'rootDir' | 'sys' | 'testing';
|
|
376
376
|
/**
|
|
377
377
|
* A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
|
|
378
378
|
* When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
|
|
379
379
|
* about the data from a type-safety perspective, this type is intended to be used throughout the codebase once
|
|
380
380
|
* validations have occurred at runtime.
|
|
381
381
|
*/
|
|
382
|
-
export
|
|
382
|
+
export type ValidatedConfig = RequireFields<Config, StrictConfigFields>;
|
|
383
383
|
export interface HydratedFlag {
|
|
384
384
|
/**
|
|
385
385
|
* Defaults to `hydrated`.
|
|
@@ -512,6 +512,10 @@ export interface RindoDevServerConfig {
|
|
|
512
512
|
export interface DevServerConfig extends RindoDevServerConfig {
|
|
513
513
|
browserUrl?: string;
|
|
514
514
|
devServerDir?: string;
|
|
515
|
+
/**
|
|
516
|
+
* A list of glob patterns like `subdir/*.js` to exclude from hot-module
|
|
517
|
+
* reloading updates.
|
|
518
|
+
*/
|
|
515
519
|
excludeHmr?: string[];
|
|
516
520
|
historyApiFallback?: HistoryApiFallback;
|
|
517
521
|
openBrowser?: boolean;
|
|
@@ -529,8 +533,8 @@ export interface DevServerEditor {
|
|
|
529
533
|
supported?: boolean;
|
|
530
534
|
priority?: number;
|
|
531
535
|
}
|
|
532
|
-
export
|
|
533
|
-
export
|
|
536
|
+
export type TaskCommand = 'build' | 'docs' | 'generate' | 'g' | 'help' | 'info' | 'prerender' | 'serve' | 'telemetry' | 'test' | 'version';
|
|
537
|
+
export type PageReloadStrategy = 'hmr' | 'pageReload' | null;
|
|
534
538
|
/**
|
|
535
539
|
* The prerender config is used when prerendering a `www` output target.
|
|
536
540
|
* Within `rindo.config.ts`, set the path to the prerendering
|
|
@@ -1052,7 +1056,23 @@ export interface CompilerSystem {
|
|
|
1052
1056
|
statSync(p: string): CompilerFsStats;
|
|
1053
1057
|
tmpDirSync(): string;
|
|
1054
1058
|
watchDirectory?(p: string, callback: CompilerFileWatcherCallback, recursive?: boolean): CompilerFileWatcher;
|
|
1055
|
-
|
|
1059
|
+
/**
|
|
1060
|
+
* A `watchFile` implementation in order to hook into the rest of the {@link CompilerSystem} implementation that is
|
|
1061
|
+
* used when running Rindo's compiler in "watch mode".
|
|
1062
|
+
*
|
|
1063
|
+
* It is analogous to TypeScript's `watchFile` implementation.
|
|
1064
|
+
*
|
|
1065
|
+
* Note, this function may be called for full builds of Rindo projects by the TypeScript compiler. It should not
|
|
1066
|
+
* assume that it will only be called in watch mode.
|
|
1067
|
+
*
|
|
1068
|
+
* This function should not perform any file watcher registration itself. Each `path` provided to it when called
|
|
1069
|
+
* should already have been registered as a file to watch.
|
|
1070
|
+
*
|
|
1071
|
+
* @param path the path to the file that is being watched
|
|
1072
|
+
* @param callback a callback to invoke when a file that is being watched has changed in some way
|
|
1073
|
+
* @returns an object with a method for unhooking the file watcher from the system
|
|
1074
|
+
*/
|
|
1075
|
+
watchFile?(path: string, callback: CompilerFileWatcherCallback): CompilerFileWatcher;
|
|
1056
1076
|
/**
|
|
1057
1077
|
* How many milliseconds to wait after a change before calling watch callbacks.
|
|
1058
1078
|
*/
|
|
@@ -1146,6 +1166,7 @@ export interface BuildOnEvents {
|
|
|
1146
1166
|
on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
|
|
1147
1167
|
}
|
|
1148
1168
|
export interface BuildEmitEvents {
|
|
1169
|
+
emit(eventName: CompilerEventName, path: string): void;
|
|
1149
1170
|
emit(eventName: CompilerEventFileAdd, path: string): void;
|
|
1150
1171
|
emit(eventName: CompilerEventFileDelete, path: string): void;
|
|
1151
1172
|
emit(eventName: CompilerEventFileUpdate, path: string): void;
|
|
@@ -1220,7 +1241,7 @@ export interface HmrStyleUpdate {
|
|
|
1220
1241
|
styleTag: string;
|
|
1221
1242
|
styleText: string;
|
|
1222
1243
|
}
|
|
1223
|
-
export
|
|
1244
|
+
export type BuildOnEventRemove = () => boolean;
|
|
1224
1245
|
export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
|
|
1225
1246
|
unsubscribeAll(): void;
|
|
1226
1247
|
}
|
|
@@ -1228,19 +1249,28 @@ export interface CompilerBuildStart {
|
|
|
1228
1249
|
buildId: number;
|
|
1229
1250
|
timestamp: string;
|
|
1230
1251
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
export
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
export
|
|
1242
|
-
export
|
|
1243
|
-
export
|
|
1252
|
+
/**
|
|
1253
|
+
* A type describing a function to call when an event is emitted by a file watcher
|
|
1254
|
+
* @param fileName the path of the file tied to event
|
|
1255
|
+
* @param eventKind a variant describing the type of event that was emitter (added, edited, etc.)
|
|
1256
|
+
*/
|
|
1257
|
+
export type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
|
|
1258
|
+
/**
|
|
1259
|
+
* A type describing the different types of events that Rindo expects may happen when a file being watched is altered
|
|
1260
|
+
* in some way
|
|
1261
|
+
*/
|
|
1262
|
+
export type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
|
|
1263
|
+
export type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
|
|
1264
|
+
export type CompilerEventFsChange = 'fsChange';
|
|
1265
|
+
export type CompilerEventFileUpdate = 'fileUpdate';
|
|
1266
|
+
export type CompilerEventFileAdd = 'fileAdd';
|
|
1267
|
+
export type CompilerEventFileDelete = 'fileDelete';
|
|
1268
|
+
export type CompilerEventDirAdd = 'dirAdd';
|
|
1269
|
+
export type CompilerEventDirDelete = 'dirDelete';
|
|
1270
|
+
export type CompilerEventBuildStart = 'buildStart';
|
|
1271
|
+
export type CompilerEventBuildFinish = 'buildFinish';
|
|
1272
|
+
export type CompilerEventBuildLog = 'buildLog';
|
|
1273
|
+
export type CompilerEventBuildNoChange = 'buildNoChange';
|
|
1244
1274
|
export interface CompilerFileWatcher {
|
|
1245
1275
|
close(): void | Promise<void>;
|
|
1246
1276
|
}
|
|
@@ -1654,7 +1684,7 @@ export interface EmulateViewport {
|
|
|
1654
1684
|
* in this array without good reason!
|
|
1655
1685
|
*/
|
|
1656
1686
|
export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
1657
|
-
export
|
|
1687
|
+
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
1658
1688
|
/**
|
|
1659
1689
|
* Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
|
|
1660
1690
|
* NodeJS based console logging and colors, and the web will use browser based
|
|
@@ -1850,6 +1880,12 @@ export interface OutputTargetBaseNext {
|
|
|
1850
1880
|
export interface OutputTargetDistCustomElements extends OutputTargetBaseNext {
|
|
1851
1881
|
type: 'dist-custom-elements';
|
|
1852
1882
|
empty?: boolean;
|
|
1883
|
+
/**
|
|
1884
|
+
* Triggers the following behaviors when enabled:
|
|
1885
|
+
* 1. All `@rindo/core/*` module references are treated as external during bundling.
|
|
1886
|
+
* 2. File names are not hashed.
|
|
1887
|
+
* 3. File minification will follow the behavior defined at the root of the Rindo config.
|
|
1888
|
+
*/
|
|
1853
1889
|
externalRuntime?: boolean;
|
|
1854
1890
|
copy?: CopyTask[];
|
|
1855
1891
|
inlineDynamicImports?: boolean;
|
|
@@ -1884,7 +1920,7 @@ export interface OutputTargetBase {
|
|
|
1884
1920
|
*/
|
|
1885
1921
|
type: string;
|
|
1886
1922
|
}
|
|
1887
|
-
export
|
|
1923
|
+
export type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
|
|
1888
1924
|
export interface OutputTargetAngular extends OutputTargetBase {
|
|
1889
1925
|
type: 'angular';
|
|
1890
1926
|
componentCorePackage: string;
|
|
@@ -1972,7 +2008,7 @@ export interface OutputTargetWww extends OutputTargetBase {
|
|
|
1972
2008
|
serviceWorker?: ServiceWorkerConfig | null | false;
|
|
1973
2009
|
appDir?: string;
|
|
1974
2010
|
}
|
|
1975
|
-
export
|
|
2011
|
+
export type OutputTarget = OutputTargetAngular | OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistCustomElementsBundle | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
|
|
1976
2012
|
export interface ServiceWorkerConfig {
|
|
1977
2013
|
unregister?: boolean;
|
|
1978
2014
|
swDest?: string;
|
|
@@ -2111,7 +2147,7 @@ export interface OptimizeCssInput {
|
|
|
2111
2147
|
* Instead, this basically just serves as a label type to track
|
|
2112
2148
|
* that arguments are being passed consistently.
|
|
2113
2149
|
*/
|
|
2114
|
-
export
|
|
2150
|
+
export type AutoprefixerOptions = Object;
|
|
2115
2151
|
/**
|
|
2116
2152
|
* Output from CSS optimization functions, wrapping up optimized
|
|
2117
2153
|
* CSS and any diagnostics produced during optimization.
|
|
@@ -2281,7 +2317,7 @@ export interface TranspileOptions {
|
|
|
2281
2317
|
*/
|
|
2282
2318
|
sys?: CompilerSystem;
|
|
2283
2319
|
}
|
|
2284
|
-
export
|
|
2320
|
+
export type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
|
|
2285
2321
|
export interface TranspileResults {
|
|
2286
2322
|
code: string;
|
|
2287
2323
|
data?: any[];
|
|
@@ -18,6 +18,10 @@ export interface JsonDocsComponent {
|
|
|
18
18
|
readme: string;
|
|
19
19
|
docs: string;
|
|
20
20
|
docsTags: JsonDocsTag[];
|
|
21
|
+
/**
|
|
22
|
+
* The text from the class-level JSDoc for a Rindo component, if present.
|
|
23
|
+
*/
|
|
24
|
+
overview?: string;
|
|
21
25
|
usage: JsonDocsUsage;
|
|
22
26
|
props: JsonDocsProp[];
|
|
23
27
|
methods: JsonDocsMethod[];
|
|
@@ -42,6 +46,26 @@ export interface JsonDocsValue {
|
|
|
42
46
|
value?: string;
|
|
43
47
|
type: string;
|
|
44
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A mapping of file names to their contents.
|
|
51
|
+
*
|
|
52
|
+
* This type is meant to be used when reading one or more usage markdown files associated with a component. For the
|
|
53
|
+
* given directory structure:
|
|
54
|
+
* ```
|
|
55
|
+
* src/components/my-component
|
|
56
|
+
* ├── my-component.tsx
|
|
57
|
+
* └── usage
|
|
58
|
+
* ├── bar.md
|
|
59
|
+
* └── foo.md
|
|
60
|
+
* ```
|
|
61
|
+
* an instance of this type would include the name of the markdown file, mapped to its contents:
|
|
62
|
+
* ```ts
|
|
63
|
+
* {
|
|
64
|
+
* 'bar': STRING_CONTENTS_OF_BAR.MD
|
|
65
|
+
* 'foo': STRING_CONTENTS_OF_FOO.MD
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
45
69
|
export interface JsonDocsUsage {
|
|
46
70
|
[key: string]: string;
|
|
47
71
|
}
|
|
@@ -133,7 +133,7 @@ export interface ListenOptions {
|
|
|
133
133
|
*/
|
|
134
134
|
passive?: boolean;
|
|
135
135
|
}
|
|
136
|
-
export
|
|
136
|
+
export type ListenTargetOptions = 'body' | 'document' | 'window';
|
|
137
137
|
export interface StateDecorator {
|
|
138
138
|
(): PropertyDecorator;
|
|
139
139
|
}
|
|
@@ -214,14 +214,16 @@ export declare const State: StateDecorator;
|
|
|
214
214
|
* https://rindojs.web.app/docs/reactive-data#watch-decorator
|
|
215
215
|
*/
|
|
216
216
|
export declare const Watch: WatchDecorator;
|
|
217
|
-
export
|
|
218
|
-
export
|
|
217
|
+
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
218
|
+
export type ErrorHandler = (err: any, element?: HTMLElement) => void;
|
|
219
219
|
/**
|
|
220
220
|
* `setMode()` is used for libraries which provide multiple "modes" for styles.
|
|
221
221
|
*/
|
|
222
222
|
export declare const setMode: (handler: ResolutionHandler) => void;
|
|
223
223
|
/**
|
|
224
|
-
* getMode
|
|
224
|
+
* `getMode()` is used for libraries which provide multiple "modes" for styles.
|
|
225
|
+
* @param ref a reference to the node to get styles for
|
|
226
|
+
* @returns the current mode or undefined, if not found
|
|
225
227
|
*/
|
|
226
228
|
export declare function getMode<T = string | undefined>(ref: any): T;
|
|
227
229
|
export declare function setPlatformHelpers(helpers: {
|
|
@@ -234,6 +236,9 @@ export declare function setPlatformHelpers(helpers: {
|
|
|
234
236
|
/**
|
|
235
237
|
* Get the base path to where the assets can be found. Use `setAssetPath(path)`
|
|
236
238
|
* if the path needs to be customized.
|
|
239
|
+
* @param path the path to use in calculating the asset path. this value will be
|
|
240
|
+
* used in conjunction with the base asset path
|
|
241
|
+
* @returns the base path
|
|
237
242
|
*/
|
|
238
243
|
export declare function getAssetPath(path: string): string;
|
|
239
244
|
/**
|
|
@@ -246,22 +251,38 @@ export declare function getAssetPath(path: string): string;
|
|
|
246
251
|
* `setAssetPath(document.currentScript.src)`, or using a bundler's replace plugin to
|
|
247
252
|
* dynamically set the path at build time, such as `setAssetPath(process.env.ASSET_PATH)`.
|
|
248
253
|
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
249
|
-
*
|
|
254
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
250
255
|
* will have to ensure the static assets are copied to its build directory.
|
|
256
|
+
* @param path the asset path to set
|
|
257
|
+
* @returns the set path
|
|
251
258
|
*/
|
|
252
259
|
export declare function setAssetPath(path: string): string;
|
|
253
260
|
/**
|
|
254
|
-
*
|
|
261
|
+
* Used to specify a nonce value that corresponds with an application's
|
|
262
|
+
* [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP).
|
|
263
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
264
|
+
* Alternatively, the nonce value can be set on a `meta` tag in the DOM head
|
|
265
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) and will result in the same behavior.
|
|
266
|
+
* @param nonce The value to be used for the nonce attribute.
|
|
267
|
+
*/
|
|
268
|
+
export declare function setNonce(nonce: string): void;
|
|
269
|
+
/**
|
|
270
|
+
* Retrieve a Rindo element for a given reference
|
|
271
|
+
* @param ref the ref to get the Rindo element for
|
|
272
|
+
* @returns a reference to the element
|
|
255
273
|
*/
|
|
256
274
|
export declare function getElement(ref: any): HTMLRindoElement;
|
|
257
275
|
/**
|
|
258
276
|
* Schedules a new render of the given instance or element even if no state changed.
|
|
259
277
|
*
|
|
260
|
-
* Notice `forceUpdate()` is not
|
|
278
|
+
* Notice `forceUpdate()` is not synchronous and might perform the DOM render in the next frame.
|
|
279
|
+
*
|
|
280
|
+
* @param ref the node/element to force the re-render of
|
|
261
281
|
*/
|
|
262
282
|
export declare function forceUpdate(ref: any): void;
|
|
263
283
|
/**
|
|
264
284
|
* getRenderingRef
|
|
285
|
+
* @returns the rendering ref
|
|
265
286
|
*/
|
|
266
287
|
export declare function getRenderingRef(): any;
|
|
267
288
|
export interface HTMLRindoElement extends HTMLElement {
|
|
@@ -272,6 +293,8 @@ export interface HTMLRindoElement extends HTMLElement {
|
|
|
272
293
|
* in the best moment to perform DOM mutation without causing layout thrashing.
|
|
273
294
|
*
|
|
274
295
|
* For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
|
|
296
|
+
*
|
|
297
|
+
* @param task the DOM-write to schedule
|
|
275
298
|
*/
|
|
276
299
|
export declare function writeTask(task: RafCallback): void;
|
|
277
300
|
/**
|
|
@@ -279,6 +302,8 @@ export declare function writeTask(task: RafCallback): void;
|
|
|
279
302
|
* in the best moment to perform DOM reads without causing layout thrashing.
|
|
280
303
|
*
|
|
281
304
|
* For further information: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
|
|
305
|
+
*
|
|
306
|
+
* @param task the DOM-read to schedule
|
|
282
307
|
*/
|
|
283
308
|
export declare function readTask(task: RafCallback): void;
|
|
284
309
|
/**
|
|
@@ -417,13 +442,57 @@ interface HostAttributes {
|
|
|
417
442
|
ref?: (el: HTMLElement | null) => void;
|
|
418
443
|
[prop: string]: any;
|
|
419
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* Utilities for working with functional Rindo components. An object
|
|
447
|
+
* conforming to this interface is passed by the Rindo runtime as the third
|
|
448
|
+
* argument to a functional component, allowing component authors to work with
|
|
449
|
+
* features like children.
|
|
450
|
+
*
|
|
451
|
+
* The children of a functional component will be passed as the second
|
|
452
|
+
* argument, so a functional component which uses these utils to transform its
|
|
453
|
+
* children might look like the following:
|
|
454
|
+
*
|
|
455
|
+
* ```ts
|
|
456
|
+
* export const AddClass: FunctionalComponent = (_, children, utils) => (
|
|
457
|
+
* utils.map(children, child => ({
|
|
458
|
+
* ...child,
|
|
459
|
+
* vattrs: {
|
|
460
|
+
* ...child.vattrs,
|
|
461
|
+
* class: `${child.vattrs.class} add-class`
|
|
462
|
+
* }
|
|
463
|
+
* }))
|
|
464
|
+
* );
|
|
465
|
+
* ```
|
|
466
|
+
*
|
|
467
|
+
* For more see the Rindo documentation, here:
|
|
468
|
+
* https://rindojs.web.app/docs/functional-components
|
|
469
|
+
*/
|
|
420
470
|
export interface FunctionalUtilities {
|
|
471
|
+
/**
|
|
472
|
+
* Utility for reading the children of a functional component at runtime.
|
|
473
|
+
* Since the Rindo runtime uses a different interface for children it is
|
|
474
|
+
* not recommendeded to read the children directly, and is preferable to use
|
|
475
|
+
* this utility to, for instance, perform a side effect for each child.
|
|
476
|
+
*/
|
|
421
477
|
forEach: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => void) => void;
|
|
478
|
+
/**
|
|
479
|
+
* Utility for transforming the children of a functional component. Given an
|
|
480
|
+
* array of children and a callback this will return a list of the results of
|
|
481
|
+
* passing each child to the supplied callback.
|
|
482
|
+
*/
|
|
422
483
|
map: (children: VNode[], cb: (vnode: ChildNode, index: number, array: ChildNode[]) => ChildNode) => VNode[];
|
|
423
484
|
}
|
|
424
485
|
export interface FunctionalComponent<T = {}> {
|
|
425
486
|
(props: T, children: VNode[], utils: FunctionalUtilities): VNode | VNode[];
|
|
426
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* A Child VDOM node
|
|
490
|
+
*
|
|
491
|
+
* This has most of the same properties as {@link VNode} but friendlier names
|
|
492
|
+
* (i.e. `vtag` instead of `$tag$`, `vchildren` instead of `$children$`) in
|
|
493
|
+
* order to provide a friendlier public interface for users of the
|
|
494
|
+
* {@link FunctionalUtilities}).
|
|
495
|
+
*/
|
|
427
496
|
export interface ChildNode {
|
|
428
497
|
vtag?: string | number | Function;
|
|
429
498
|
vkey?: string | number;
|
|
@@ -470,6 +539,9 @@ export declare function h(sel: any, children: Array<VNode | undefined | null>):
|
|
|
470
539
|
export declare function h(sel: any, data: VNodeData | null, text: string): VNode;
|
|
471
540
|
export declare function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode;
|
|
472
541
|
export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode;
|
|
542
|
+
/**
|
|
543
|
+
* A virtual DOM node
|
|
544
|
+
*/
|
|
473
545
|
export interface VNode {
|
|
474
546
|
$flags$: number;
|
|
475
547
|
$tag$: string | number | Function;
|