@rindo/core 2.17.4 → 2.22.2
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 +693 -401
- package/cli/index.d.ts +3 -0
- package/cli/index.js +693 -401
- package/cli/package.json +1 -1
- package/compiler/lib.dom.d.ts +898 -184
- package/compiler/lib.dom.iterable.d.ts +22 -4
- package/compiler/lib.es2015.collection.d.ts +62 -1
- package/compiler/lib.es2015.core.d.ts +3 -3
- package/compiler/lib.es2015.iterable.d.ts +2 -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 +26 -3
- 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.bigint.d.ts +7 -5
- package/compiler/lib.es2020.d.ts +2 -0
- package/compiler/lib.es2020.date.d.ts +44 -0
- package/compiler/lib.es2020.intl.d.ts +81 -16
- package/compiler/lib.es2020.number.d.ts +30 -0
- package/compiler/lib.es2021.intl.d.ts +116 -6
- package/compiler/lib.es2022.array.d.ts +123 -0
- package/compiler/lib.es2022.d.ts +27 -0
- package/compiler/lib.es2022.error.d.ts +75 -0
- package/compiler/lib.es2022.full.d.ts +25 -0
- package/compiler/lib.es2022.intl.d.ts +111 -0
- package/compiler/lib.es2022.object.d.ts +28 -0
- package/compiler/lib.es2022.sharedmemory.d.ts +27 -0
- package/compiler/lib.es2022.string.d.ts +27 -0
- package/compiler/lib.es5.d.ts +62 -31
- package/compiler/lib.esnext.d.ts +1 -1
- package/compiler/lib.esnext.intl.d.ts +8 -1
- package/compiler/lib.webworker.d.ts +540 -81
- package/compiler/lib.webworker.iterable.d.ts +19 -4
- package/compiler/package.json +1 -1
- package/compiler/rindo.d.ts +3 -25
- package/compiler/rindo.js +54678 -52205
- package/compiler/rindo.min.js +2 -2
- package/compiler/sys/in-memory-fs.d.ts +218 -0
- package/compiler/transpile.d.ts +32 -0
- package/dependencies.json +12 -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 +1192 -1158
- 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 +1130 -823
- 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 -184
- package/internal/rindo-public-compiler.d.ts +83 -38
- 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 +526 -501
- package/mock-doc/index.d.ts +15 -14
- package/mock-doc/index.js +526 -501
- package/mock-doc/package.json +1 -1
- package/package.json +48 -59
- 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 +13 -13
- 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 +399 -413
- 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 +684 -839
- 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 +6 -5
- 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
|
|
@@ -1146,6 +1150,7 @@ export interface BuildOnEvents {
|
|
|
1146
1150
|
on(eventName: CompilerEventBuildNoChange, cb: () => void): BuildOnEventRemove;
|
|
1147
1151
|
}
|
|
1148
1152
|
export interface BuildEmitEvents {
|
|
1153
|
+
emit(eventName: CompilerEventName, path: string): void;
|
|
1149
1154
|
emit(eventName: CompilerEventFileAdd, path: string): void;
|
|
1150
1155
|
emit(eventName: CompilerEventFileDelete, path: string): void;
|
|
1151
1156
|
emit(eventName: CompilerEventFileUpdate, path: string): void;
|
|
@@ -1220,7 +1225,7 @@ export interface HmrStyleUpdate {
|
|
|
1220
1225
|
styleTag: string;
|
|
1221
1226
|
styleText: string;
|
|
1222
1227
|
}
|
|
1223
|
-
export
|
|
1228
|
+
export type BuildOnEventRemove = () => boolean;
|
|
1224
1229
|
export interface BuildEvents extends BuildOnEvents, BuildEmitEvents {
|
|
1225
1230
|
unsubscribeAll(): void;
|
|
1226
1231
|
}
|
|
@@ -1228,19 +1233,19 @@ export interface CompilerBuildStart {
|
|
|
1228
1233
|
buildId: number;
|
|
1229
1234
|
timestamp: string;
|
|
1230
1235
|
}
|
|
1231
|
-
export
|
|
1232
|
-
export
|
|
1233
|
-
export
|
|
1234
|
-
export
|
|
1235
|
-
export
|
|
1236
|
-
export
|
|
1237
|
-
export
|
|
1238
|
-
export
|
|
1239
|
-
export
|
|
1240
|
-
export
|
|
1241
|
-
export
|
|
1242
|
-
export
|
|
1243
|
-
export
|
|
1236
|
+
export type CompilerFileWatcherCallback = (fileName: string, eventKind: CompilerFileWatcherEvent) => void;
|
|
1237
|
+
export type CompilerFileWatcherEvent = CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventFileUpdate | CompilerEventDirAdd | CompilerEventDirDelete;
|
|
1238
|
+
export type CompilerEventName = CompilerEventFsChange | CompilerEventFileUpdate | CompilerEventFileAdd | CompilerEventFileDelete | CompilerEventDirAdd | CompilerEventDirDelete | CompilerEventBuildStart | CompilerEventBuildFinish | CompilerEventBuildNoChange | CompilerEventBuildLog;
|
|
1239
|
+
export type CompilerEventFsChange = 'fsChange';
|
|
1240
|
+
export type CompilerEventFileUpdate = 'fileUpdate';
|
|
1241
|
+
export type CompilerEventFileAdd = 'fileAdd';
|
|
1242
|
+
export type CompilerEventFileDelete = 'fileDelete';
|
|
1243
|
+
export type CompilerEventDirAdd = 'dirAdd';
|
|
1244
|
+
export type CompilerEventDirDelete = 'dirDelete';
|
|
1245
|
+
export type CompilerEventBuildStart = 'buildStart';
|
|
1246
|
+
export type CompilerEventBuildFinish = 'buildFinish';
|
|
1247
|
+
export type CompilerEventBuildLog = 'buildLog';
|
|
1248
|
+
export type CompilerEventBuildNoChange = 'buildNoChange';
|
|
1244
1249
|
export interface CompilerFileWatcher {
|
|
1245
1250
|
close(): void | Promise<void>;
|
|
1246
1251
|
}
|
|
@@ -1654,7 +1659,7 @@ export interface EmulateViewport {
|
|
|
1654
1659
|
* in this array without good reason!
|
|
1655
1660
|
*/
|
|
1656
1661
|
export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
1657
|
-
export
|
|
1662
|
+
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
1658
1663
|
/**
|
|
1659
1664
|
* Common logger to be used by the compiler, dev-server and CLI. The CLI will use a
|
|
1660
1665
|
* NodeJS based console logging and colors, and the web will use browser based
|
|
@@ -1698,6 +1703,27 @@ export interface OutputTargetDist extends OutputTargetBase {
|
|
|
1698
1703
|
buildDir?: string;
|
|
1699
1704
|
dir?: string;
|
|
1700
1705
|
collectionDir?: string | null;
|
|
1706
|
+
/**
|
|
1707
|
+
* When `true` this flag will transform aliased import paths defined in
|
|
1708
|
+
* a project's `tsconfig.json` to relative import paths in the compiled output's
|
|
1709
|
+
* `dist-collection` bundle if it is generated (i.e. `collectionDir` is set).
|
|
1710
|
+
*
|
|
1711
|
+
* Paths will be left in aliased format if `false` or `undefined`.
|
|
1712
|
+
*
|
|
1713
|
+
* @example
|
|
1714
|
+
* // tsconfig.json
|
|
1715
|
+
* {
|
|
1716
|
+
* paths: {
|
|
1717
|
+
* "@utils/*": ['/src/utils/*']
|
|
1718
|
+
* }
|
|
1719
|
+
* }
|
|
1720
|
+
*
|
|
1721
|
+
* // Source file
|
|
1722
|
+
* import * as dateUtils from '@utils/date-utils';
|
|
1723
|
+
* // Output file
|
|
1724
|
+
* import * as dateUtils from '../utils/date-utils';
|
|
1725
|
+
*/
|
|
1726
|
+
transformAliasedImportPathsInCollection?: boolean | null;
|
|
1701
1727
|
typesDir?: string;
|
|
1702
1728
|
esmLoaderPath?: string;
|
|
1703
1729
|
copy?: CopyTask[];
|
|
@@ -1709,6 +1735,26 @@ export interface OutputTargetDistCollection extends OutputTargetBase {
|
|
|
1709
1735
|
empty?: boolean;
|
|
1710
1736
|
dir: string;
|
|
1711
1737
|
collectionDir: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* When `true` this flag will transform aliased import paths defined in
|
|
1740
|
+
* a project's `tsconfig.json` to relative import paths in the compiled output.
|
|
1741
|
+
*
|
|
1742
|
+
* Paths will be left in aliased format if `false` or `undefined`.
|
|
1743
|
+
*
|
|
1744
|
+
* @example
|
|
1745
|
+
* // tsconfig.json
|
|
1746
|
+
* {
|
|
1747
|
+
* paths: {
|
|
1748
|
+
* "@utils/*": ['/src/utils/*']
|
|
1749
|
+
* }
|
|
1750
|
+
* }
|
|
1751
|
+
*
|
|
1752
|
+
* // Source file
|
|
1753
|
+
* import * as dateUtils from '@utils/date-utils';
|
|
1754
|
+
* // Output file
|
|
1755
|
+
* import * as dateUtils from '../utils/date-utils';
|
|
1756
|
+
*/
|
|
1757
|
+
transformAliasedImportPaths?: boolean | null;
|
|
1712
1758
|
}
|
|
1713
1759
|
export interface OutputTargetDistTypes extends OutputTargetBase {
|
|
1714
1760
|
type: 'dist-types';
|
|
@@ -1809,6 +1855,12 @@ export interface OutputTargetBaseNext {
|
|
|
1809
1855
|
export interface OutputTargetDistCustomElements extends OutputTargetBaseNext {
|
|
1810
1856
|
type: 'dist-custom-elements';
|
|
1811
1857
|
empty?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Triggers the following behaviors when enabled:
|
|
1860
|
+
* 1. All `@rindo/core/*` module references are treated as external during bundling.
|
|
1861
|
+
* 2. File names are not hashed.
|
|
1862
|
+
* 3. File minification will follow the behavior defined at the root of the Rindo config.
|
|
1863
|
+
*/
|
|
1812
1864
|
externalRuntime?: boolean;
|
|
1813
1865
|
copy?: CopyTask[];
|
|
1814
1866
|
inlineDynamicImports?: boolean;
|
|
@@ -1843,7 +1895,7 @@ export interface OutputTargetBase {
|
|
|
1843
1895
|
*/
|
|
1844
1896
|
type: string;
|
|
1845
1897
|
}
|
|
1846
|
-
export
|
|
1898
|
+
export type OutputTargetBuild = OutputTargetDistCollection | OutputTargetDistLazy;
|
|
1847
1899
|
export interface OutputTargetAngular extends OutputTargetBase {
|
|
1848
1900
|
type: 'angular';
|
|
1849
1901
|
componentCorePackage: string;
|
|
@@ -1931,7 +1983,7 @@ export interface OutputTargetWww extends OutputTargetBase {
|
|
|
1931
1983
|
serviceWorker?: ServiceWorkerConfig | null | false;
|
|
1932
1984
|
appDir?: string;
|
|
1933
1985
|
}
|
|
1934
|
-
export
|
|
1986
|
+
export type OutputTarget = OutputTargetAngular | OutputTargetCopy | OutputTargetCustom | OutputTargetDist | OutputTargetDistCollection | OutputTargetDistCustomElements | OutputTargetDistCustomElementsBundle | OutputTargetDistLazy | OutputTargetDistGlobalStyles | OutputTargetDistLazyLoader | OutputTargetDocsJson | OutputTargetDocsCustom | OutputTargetDocsReadme | OutputTargetDocsVscode | OutputTargetWww | OutputTargetHydrate | OutputTargetStats | OutputTargetDistTypes;
|
|
1935
1987
|
export interface ServiceWorkerConfig {
|
|
1936
1988
|
unregister?: boolean;
|
|
1937
1989
|
swDest?: string;
|
|
@@ -2070,7 +2122,7 @@ export interface OptimizeCssInput {
|
|
|
2070
2122
|
* Instead, this basically just serves as a label type to track
|
|
2071
2123
|
* that arguments are being passed consistently.
|
|
2072
2124
|
*/
|
|
2073
|
-
export
|
|
2125
|
+
export type AutoprefixerOptions = Object;
|
|
2074
2126
|
/**
|
|
2075
2127
|
* Output from CSS optimization functions, wrapping up optimized
|
|
2076
2128
|
* CSS and any diagnostics produced during optimization.
|
|
@@ -2134,13 +2186,6 @@ export interface FsStats {
|
|
|
2134
2186
|
ctime: Date;
|
|
2135
2187
|
birthtime: Date;
|
|
2136
2188
|
}
|
|
2137
|
-
export interface FsWriteOptions {
|
|
2138
|
-
inMemoryOnly?: boolean;
|
|
2139
|
-
clearFileCache?: boolean;
|
|
2140
|
-
immediateWrite?: boolean;
|
|
2141
|
-
useCache?: boolean;
|
|
2142
|
-
outputTargetType?: string;
|
|
2143
|
-
}
|
|
2144
2189
|
export interface Compiler {
|
|
2145
2190
|
build(): Promise<CompilerBuildResults>;
|
|
2146
2191
|
createWatcher(): Promise<CompilerWatcher>;
|
|
@@ -2247,7 +2292,7 @@ export interface TranspileOptions {
|
|
|
2247
2292
|
*/
|
|
2248
2293
|
sys?: CompilerSystem;
|
|
2249
2294
|
}
|
|
2250
|
-
export
|
|
2295
|
+
export type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | 'es5' | string | undefined;
|
|
2251
2296
|
export interface TranspileResults {
|
|
2252
2297
|
code: string;
|
|
2253
2298
|
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;
|