@dr.pogodin/react-utils 1.47.4 → 1.48.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.
- package/build/development/client/getInj.js +4 -0
- package/build/development/client/getInj.js.map +1 -1
- package/build/development/index.js +1 -1
- package/build/development/index.js.map +1 -1
- package/build/development/server/server.js +0 -1
- package/build/development/server/server.js.map +1 -1
- package/build/development/shared/components/Button/index.js +13 -9
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Checkbox/index.js +8 -7
- package/build/development/shared/components/Checkbox/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +14 -12
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +15 -3
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/PageLayout/index.js +18 -15
- package/build/development/shared/components/PageLayout/index.js.map +1 -1
- package/build/development/shared/components/TextArea/index.js +9 -8
- package/build/development/shared/components/TextArea/index.js.map +1 -1
- package/build/development/shared/components/Throbber/index.js +15 -12
- package/build/development/shared/components/Throbber/index.js.map +1 -1
- package/build/development/shared/components/WithTooltip/index.js +6 -6
- package/build/development/shared/components/WithTooltip/index.js.map +1 -1
- package/build/development/shared/components/YouTubeVideo/index.js +6 -5
- package/build/development/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/development/shared/components/selectors/CustomDropdown/index.js +13 -12
- package/build/development/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +11 -10
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/Switch/index.js +9 -9
- package/build/development/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/components/selectors/index.js +1 -1
- package/build/development/shared/components/selectors/index.js.map +1 -1
- package/build/development/shared/utils/index.js +2 -5
- package/build/development/shared/utils/index.js.map +1 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js +0 -1
- package/build/development/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/production/client/getInj.js +2 -2
- package/build/production/client/getInj.js.map +1 -1
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/server/server.js +1 -1
- package/build/production/server/server.js.map +1 -1
- package/build/production/shared/components/Button/index.js +3 -8
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Checkbox/index.js +1 -1
- package/build/production/shared/components/Checkbox/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +6 -6
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +3 -2
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/PageLayout/index.js +2 -2
- package/build/production/shared/components/PageLayout/index.js.map +1 -1
- package/build/production/shared/components/TextArea/index.js +4 -4
- package/build/production/shared/components/TextArea/index.js.map +1 -1
- package/build/production/shared/components/Throbber/index.js +2 -2
- package/build/production/shared/components/Throbber/index.js.map +1 -1
- package/build/production/shared/components/WithTooltip/index.js +3 -3
- package/build/production/shared/components/WithTooltip/index.js.map +1 -1
- package/build/production/shared/components/YouTubeVideo/index.js +4 -4
- package/build/production/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/production/shared/components/selectors/CustomDropdown/index.js +2 -2
- package/build/production/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +3 -3
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/Switch/index.js +1 -1
- package/build/production/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/components/selectors/index.js +1 -1
- package/build/production/shared/components/selectors/index.js.map +1 -1
- package/build/production/shared/utils/index.js +1 -1
- package/build/production/shared/utils/index.js.map +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js +1 -1
- package/build/production/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/build/types-code/index.d.ts +1 -1
- package/build/types-code/shared/components/Button/index.d.ts +6 -10
- package/build/types-code/shared/components/Checkbox/index.d.ts +4 -3
- package/build/types-code/shared/components/Input/index.d.ts +12 -4
- package/build/types-code/shared/components/Modal/index.d.ts +6 -3
- package/build/types-code/shared/components/PageLayout/index.d.ts +19 -4
- package/build/types-code/shared/components/TextArea/index.d.ts +4 -4
- package/build/types-code/shared/components/Throbber/index.d.ts +13 -3
- package/build/types-code/shared/components/WithTooltip/index.d.ts +18 -4
- package/build/types-code/shared/components/YouTubeVideo/index.d.ts +20 -4
- package/build/types-code/shared/components/selectors/CustomDropdown/index.d.ts +3 -2
- package/build/types-code/shared/components/selectors/NativeDropdown/index.d.ts +22 -2
- package/build/types-code/shared/components/selectors/Switch/index.d.ts +7 -6
- package/build/types-code/shared/components/selectors/common.d.ts +2 -3
- package/build/types-code/shared/components/selectors/index.d.ts +2 -2
- package/build/types-code/shared/utils/index.d.ts +2 -7
- package/build/web/client/getInj.js +3 -0
- package/build/web/client/getInj.js.map +1 -1
- package/build/web/index.js +1 -1
- package/build/web/index.js.map +1 -1
- package/build/web/server/server.js +0 -1
- package/build/web/server/server.js.map +1 -1
- package/build/web/shared/components/Button/index.js +13 -9
- package/build/web/shared/components/Button/index.js.map +1 -1
- package/build/web/shared/components/Checkbox/index.js +8 -7
- package/build/web/shared/components/Checkbox/index.js.map +1 -1
- package/build/web/shared/components/Input/index.js +14 -12
- package/build/web/shared/components/Input/index.js.map +1 -1
- package/build/web/shared/components/Modal/index.js +15 -3
- package/build/web/shared/components/Modal/index.js.map +1 -1
- package/build/web/shared/components/PageLayout/index.js +18 -15
- package/build/web/shared/components/PageLayout/index.js.map +1 -1
- package/build/web/shared/components/TextArea/index.js +9 -8
- package/build/web/shared/components/TextArea/index.js.map +1 -1
- package/build/web/shared/components/Throbber/index.js +15 -12
- package/build/web/shared/components/Throbber/index.js.map +1 -1
- package/build/web/shared/components/WithTooltip/index.js +6 -6
- package/build/web/shared/components/WithTooltip/index.js.map +1 -1
- package/build/web/shared/components/YouTubeVideo/index.js +6 -5
- package/build/web/shared/components/YouTubeVideo/index.js.map +1 -1
- package/build/web/shared/components/selectors/CustomDropdown/index.js +13 -12
- package/build/web/shared/components/selectors/CustomDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/NativeDropdown/index.js +11 -10
- package/build/web/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/web/shared/components/selectors/Switch/index.js +9 -9
- package/build/web/shared/components/selectors/Switch/index.js.map +1 -1
- package/build/web/shared/components/selectors/common.js.map +1 -1
- package/build/web/shared/components/selectors/index.js +1 -1
- package/build/web/shared/components/selectors/index.js.map +1 -1
- package/build/web/shared/utils/index.js +2 -5
- package/build/web/shared/utils/index.js.map +1 -1
- package/build/web/shared/utils/jest/E2eSsrEnv.js +0 -1
- package/build/web/shared/utils/jest/E2eSsrEnv.js.map +1 -1
- package/config/babel/webpack.js +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getConfig","isomorphy","time","webpack","assertEmptyObject","Barrier","Cached","Emitter","Semaphore","withRetries","COMPOSE","THEME_COMPOSE","PRIORITY","THEME_PRIORITY","ThemeProvider","useTheme","getSsrContext","default","splitComponent"],"sources":["../../../../src/shared/utils/index.ts"],"sourcesContent":["import { getConfig } from './config';\nimport * as isomorphy from './isomorphy';\nimport time from './time';\nimport * as webpack from './webpack';\n\nexport {\n assertEmptyObject,\n type Listener,\n type ObjectKey,\n Barrier,\n Cached,\n Emitter,\n Semaphore,\n withRetries,\n} from '@dr.pogodin/js-utils';\n\nexport {\n COMPOSE as THEME_COMPOSE,\n PRIORITY as THEME_PRIORITY,\n type Theme,\n ThemeProvider,\n useTheme,\n} from '@dr.pogodin/react-themes';\n\nexport { getSsrContext } from './globalState';\nexport { default as splitComponent } from './splitComponent';\n\nexport {\n getConfig,\n isomorphy,\n time,\n webpack,\n};\n"],"mappings":"OAASA,SAAS,yBACX,GAAK,CAAAC,SAAS,kCACd,CAAAC,IAAI,uBACJ,GAAK,CAAAC,OAAO,oBAEnB,OACEC,iBAAiB,CAGjBC,OAAO,CACPC,MAAM,CACNC,OAAO,CACPC,SAAS,CACTC,WAAW,KACN,sBAAsB,CAE7B,OACEC,OAAO,GAAI,CAAAC,aAAa,CACxBC,QAAQ,GAAI,CAAAC,cAAc,CAE1BC,aAAa,CACbC,QAAQ,KACH,0BAA0B,QAExBC,aAAa,+BACbC,OAAO,GAAI,CAAAC,cAAc,2BAElC,OACElB,SAAS,CACTC,SAAS,CACTC,IAAI,CACJC,OAAO","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ import path from"node:path";import{defaults,set}from"lodash-es";// As this envir
|
|
|
21
21
|
*/async loadWebpackConfig(){const optionsString=this.pragmas["webpack-config-options"];const options=optionsString?JSON.parse(optionsString):{};defaults(options,{context:this.testFolder,fs:this.global.webpackOutputFs});const factoryPath=this.pragmas["webpack-config-factory"];let factory=await import(/* webpackChunkName: "not-a-valid-chunk" */path.resolve(this.rootDir,factoryPath));factory="default"in factory?factory.default:factory;this.global.webpackConfig=factory(options);const fs=this.global.webpackOutputFs;let buildInfo=`${options.context}/.build-info`;if(fs.existsSync(buildInfo)){buildInfo=fs.readFileSync(buildInfo,"utf8");this.global.buildInfo=JSON.parse(buildInfo)}}/**
|
|
22
22
|
* Executes Webpack build.
|
|
23
23
|
* @return {Promise}
|
|
24
|
-
*/async runWebpack(){await this.loadWebpackConfig();if(!this.global.webpackConfig)throw Error("Failed to load Webpack config");const compiler=webpack(this.global.webpackConfig)
|
|
24
|
+
*/async runWebpack(){await this.loadWebpackConfig();if(!this.global.webpackConfig)throw Error("Failed to load Webpack config");const compiler=webpack(this.global.webpackConfig);// TODO: The "as typeof compiler.outputFileSystem" piece below is
|
|
25
25
|
// a workaround for the Webpack regression:
|
|
26
26
|
// https://github.com/webpack/webpack/issues/18242
|
|
27
27
|
compiler.outputFileSystem=this.global.webpackOutputFs;return new Promise((done,fail)=>{compiler.run((err,stats)=>{if(err)fail(err);if(stats?.hasErrors()){// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2eSsrEnv.js","names":["path","defaults","set","register","JsdomEnv","Volume","createFsFromVolume","webpack","noop","E2eSsrEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","ssrFactory","renderer","status","markup","ssrRequest","cookie","send","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","dirname","testPath","withSsr","root","process","cwd","envName","babelEnv","extensions","setup","require","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'node:path';\n\nimport type { Request, Response } from 'express';\n\nimport { defaults, set } from 'lodash-es';\n\nimport type { ReactNode } from 'react';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nfunction noop() {\n // NOOP\n}\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private async loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n\n let factory = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n path.resolve(this.rootDir, factoryPath)\n ) as (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n await this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n if (!compiler) throw Error('Failed to construct Webpack compiler');\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n const module = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n p\n ) as NodeJS.Module;\n\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const { default: ssrFactory } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */ 'server/renderer');\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n\n // BEWARE: Anything imported prior to this register() call seems to be\n // transpiled again by Babel if loaded after this call. This causes very\n // confusing errors when testing the code dependent on some sort of contexts\n // (because loading a module again effectively creates a new context object,\n // which is not recognized by the code expecting another context instance).\n // That's why below we prefer dynamic imports for some React Utils methods.\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n\n const { setBuildInfo } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */'../isomorphy/buildInfo');\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n await super.teardown();\n }\n}\n"],"mappings":"mJAAA;AACA;AACA;AACA;AACA;AACA,GAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA,MAAO,CAAAA,IAAI,KAAM,WAAW,CAI5B,OAASC,QAAQ,CAAEC,GAAG,KAAQ,WAAW,CAIzC;AACA;AACA,sDACA,MAAO,CAAAC,QAAQ,KAAM,qCAAqC,CAE1D,MAAO,CAAAC,QAAQ,KAAM,wBAAwB,CAC7C,OAASC,MAAM,CAAEC,kBAAkB,KAAQ,OAAO,CAClD,MAAO,CAAAC,OAAO,KAA8B,SAAS,CACrD,qDAOA,QAAS,CAAAC,IAAIA,CAAA,CAAG,CACd;AAAA,CAGF,cAAe,MAAM,CAAAC,SAAS,QAAS,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ACC,KAAK,CAAC,CAACO,OAAO,CAAEC,GAAG,EAAK,CAC1C,MAAO,CAAAT,OAAO,CAACC,KAAK,CAACQ,GAAG,CAC1B,CAAC,CAAC,CACFjG,QAAQ,CAACkG,MAAM,CAAC,CAAC,CACjB,KAAM,MAAK,CAACL,QAAQ,CAAC,CACvB,CACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"E2eSsrEnv.js","names":["path","defaults","set","register","JsdomEnv","Volume","createFsFromVolume","webpack","noop","E2eSsrEnv","loadWebpackConfig","optionsString","pragmas","options","JSON","parse","context","testFolder","fs","global","webpackOutputFs","factoryPath","factory","resolve","rootDir","default","webpackConfig","buildInfo","existsSync","readFileSync","runWebpack","Error","compiler","outputFileSystem","Promise","done","fail","run","err","stats","hasErrors","console","error","toJson","errors","webpackStats","runSsr","logger","debug","info","log","warn","cleanup","entry","p","module","exportName","entryExportName","Application","ssrFactory","renderer","status","markup","ssrRequest","cookie","send","value","locals","devMiddleware","ssrMarkup","ssrOptions","ssrStatus","constructor","config","docblockPragmas","requestString","request","url","csrfToken","projectConfig","dom","dirname","testPath","withSsr","root","process","cwd","envName","babelEnv","extensions","setup","require","cache","setBuildInfo","undefined","REACT_UTILS_FORCE_CLIENT_SIDE","teardown","Object","keys","forEach","key","revert"],"sources":["../../../../../src/shared/utils/jest/E2eSsrEnv.ts"],"sourcesContent":["/**\n * Jest environment for end-to-end SSR and client-side testing. It relies on\n * the standard react-utils mechanics to execute SSR of given scene, and also\n * Webpack build of the code for client-side execution, it further exposes\n * Jsdom environment for the client-side testing of the outcomes.\n */\n\n// BEWARE: The module is not imported into the JU module / the main assembly of\n// the library, because doing so easily breaks stuff:\n// 1) This module depends on Node-specific modules, which would make JU\n// incompatible with JsDom if included into JU.\n// 2) If this module is weakly imported from somewhere else in the lib,\n// it seems to randomly break tests using it for a different reason,\n// probably some sort of a require-loop, or some issues with weak\n// require in that scenario.\n\n// TODO: We need to add correct typing for environment options.\n\nimport path from 'node:path';\n\nimport type { Request, Response } from 'express';\n\nimport { defaults, set } from 'lodash-es';\n\nimport type { ReactNode } from 'react';\n\n// As this environment is a part of the Jest testing utils,\n// we assume development dependencies are available when it is used.\n/* eslint-disable import/no-extraneous-dependencies */\nimport register from '@babel/register/experimental-worker';\n\nimport JsdomEnv from 'jest-environment-jsdom';\nimport { Volume, createFsFromVolume } from 'memfs';\nimport webpack, { type Configuration } from 'webpack';\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\n\nfunction noop() {\n // NOOP\n}\n\nexport default class E2eSsrEnv extends JsdomEnv {\n pragmas: Record<string, string | string[]>;\n\n ssrRequest: object;\n\n rootDir: string;\n\n testFolder: string;\n\n withSsr: boolean;\n\n webpackStats?: webpack.StatsCompilation;\n\n /**\n * Loads Webpack config, and exposes it to the environment via global\n * webpackConfig object.\n */\n private async loadWebpackConfig() {\n const optionsString = this.pragmas['webpack-config-options'] as string;\n\n const options = (optionsString ? JSON.parse(optionsString) : {}) as\n webpack.Configuration;\n\n defaults(options, {\n context: this.testFolder,\n fs: this.global.webpackOutputFs,\n });\n\n const factoryPath = this.pragmas['webpack-config-factory'] as string;\n\n let factory = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n path.resolve(this.rootDir, factoryPath)\n ) as (((ops: Configuration) => Configuration) | {\n default: (ops: Configuration) => Configuration;\n });\n\n factory = 'default' in factory ? factory.default : factory;\n\n this.global.webpackConfig = factory(options);\n\n const fs = this.global.webpackOutputFs;\n let buildInfo = `${options.context}/.build-info`;\n if (fs.existsSync(buildInfo)) {\n buildInfo = fs.readFileSync(buildInfo, 'utf8') as string;\n this.global.buildInfo = JSON.parse(buildInfo);\n }\n }\n\n /**\n * Executes Webpack build.\n * @return {Promise}\n */\n async runWebpack(): Promise<void> {\n await this.loadWebpackConfig();\n\n if (!this.global.webpackConfig) throw Error('Failed to load Webpack config');\n const compiler = webpack(this.global.webpackConfig);\n\n // TODO: The \"as typeof compiler.outputFileSystem\" piece below is\n // a workaround for the Webpack regression:\n // https://github.com/webpack/webpack/issues/18242\n compiler.outputFileSystem = this.global.webpackOutputFs as\n typeof compiler.outputFileSystem;\n\n return new Promise<void>((done, fail) => {\n compiler.run((err, stats) => {\n if (err) fail(err);\n if (stats?.hasErrors()) {\n // eslint-disable-next-line no-console\n console.error(stats.toJson().errors);\n fail(Error('Webpack compilation failed'));\n }\n\n this.global.webpackStats = stats?.toJson();\n\n // Keeps reference to the raw Webpack stats object, which should be\n // explicitly passed to the server-side renderer alongside the request,\n // so that it can to pick up asset paths for different named chunks.\n this.webpackStats = stats;\n\n done();\n });\n });\n }\n\n async runSsr(): Promise<void> {\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n\n // TODO: This is temporary to shortcut the logging added to SSR.\n options.logger ??= {\n debug: noop,\n info: noop,\n log: noop,\n warn: noop,\n };\n\n options.buildInfo ??= this.global.buildInfo;\n\n let cleanup: (() => void) | undefined;\n\n if (options.entry) {\n const p = path.resolve(this.testFolder, options.entry as string);\n const module = await import(/* webpackChunkName: \"not-a-valid-chunk\" */\n p\n ) as NodeJS.Module;\n\n if ('cleanup' in module) cleanup = module.cleanup as () => void;\n\n const exportName = (options.entryExportName as string) || 'default';\n if (exportName in module) {\n options.Application = (\n module as unknown as Record<string, unknown>\n )[exportName] as ReactNode;\n }\n }\n\n const { default: ssrFactory } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */ 'server/renderer');\n const renderer = ssrFactory(this.global.webpackConfig!, options);\n let status = 200; // OK\n const markup = await new Promise<string>((done, fail) => {\n void renderer(\n this.ssrRequest as Request,\n\n // TODO: This will do for now, with the current implementation of\n // the renderer, but it will require a rework once the renderer is\n // updated to do streaming.\n ({\n cookie: noop,\n send: done,\n set: noop,\n status: (value: number) => {\n status = value;\n },\n\n // This is how up-to-date Webpack stats are passed to the server in\n // development mode, and we use this here always, instead of having\n // to pass some information via filesystem.\n locals: {\n webpack: {\n devMiddleware: {\n stats: this.webpackStats,\n },\n },\n },\n } as unknown) as Response,\n\n (error) => {\n // TODO: Strictly speaking, that error as Error casting is not all\n // correct, but it works, so no need to spend time on it right now.\n if (error) fail(error as Error);\n else done('');\n },\n );\n });\n\n this.global.ssrMarkup = markup;\n this.global.ssrOptions = options;\n this.global.ssrStatus = status;\n\n if (cleanup) cleanup();\n }\n\n constructor(\n config: JestEnvironmentConfig,\n context: EnvironmentContext,\n ) {\n const pragmas = context.docblockPragmas;\n\n const requestString = pragmas['ssr-request'] as string;\n const request = requestString\n ? JSON.parse(requestString) as Record<string, unknown>\n : {};\n\n request.url ??= '/';\n request.csrfToken = noop;\n\n // This ensures the initial JsDom URL matches the value we use for SSR.\n set(\n config.projectConfig,\n 'testEnvironmentOptions.url',\n `http://localhost${request.url as string}`,\n );\n\n super(config, context);\n\n this.global.dom = this.dom;\n this.global.webpackOutputFs = createFsFromVolume(new Volume());\n\n // Extracts necessary settings from config and context.\n const { projectConfig } = config;\n this.rootDir = projectConfig.rootDir;\n this.testFolder = path.dirname(context.testPath);\n this.withSsr = !pragmas['no-ssr'];\n this.ssrRequest = request;\n this.pragmas = pragmas;\n\n // The usual \"babel-jest\" transformation setup does not apply to\n // the environment code and imports from it, this workaround enables it.\n const optionsString = this.pragmas['ssr-options'] as string;\n const options = optionsString\n ? JSON.parse(optionsString) as Record<string, unknown>\n : {};\n let root;\n switch (options.root) {\n case 'TEST':\n root = this.testFolder;\n break;\n default: root = process.cwd();\n }\n\n // BEWARE: Anything imported prior to this register() call seems to be\n // transpiled again by Babel if loaded after this call. This causes very\n // confusing errors when testing the code dependent on some sort of contexts\n // (because loading a module again effectively creates a new context object,\n // which is not recognized by the code expecting another context instance).\n // That's why below we prefer dynamic imports for some React Utils methods.\n register({\n envName: options.babelEnv as string,\n extensions: ['.js', '.jsx', '.ts', '.tsx', '.svg'],\n root,\n });\n }\n\n async setup(): Promise<void> {\n await super.setup();\n await this.runWebpack();\n\n // NOTE: It is possible that the Webpack run above, and the SSR run below\n // load different versions of the same module (CommonJS, and ES), and it may\n // cause very confusing problems (e.g. see:\n // https://github.com/birdofpreyru/react-utils/issues/413).\n // It seems we can't reset the cache of ES modules, and Jest's module reset\n // does not reset modules loaded in this enviroment module, and also only\n // replacing entire cache object by and empty {} seems to help (in contrast\n // to deleting all entries by their keys, as it is done within .teardown()\n // method below). Thus, for now we do this as a hotfix, and we also reset\n // build info to undefined, because ES module version not beeing reset\n // triggers an error on the subsequent test using the environment.\n // TODO: Look for a cleaner solution.\n require.cache = {};\n\n const { setBuildInfo } = await import(/* webpackChunkName: \"not-a-valid-chunk\" */'../isomorphy/buildInfo');\n setBuildInfo(undefined, true);\n\n if (this.withSsr) await this.runSsr();\n this.global.REACT_UTILS_FORCE_CLIENT_SIDE = true;\n }\n\n async teardown(): Promise<void> {\n delete this.global.REACT_UTILS_FORCE_CLIENT_SIDE;\n\n // Resets module cache and @babel/register. Effectively this ensures that\n // the next time an instance of this environment is set up, all modules are\n // transformed by Babel from scratch, thus taking into account the latest\n // Babel config (which may change between different environment instances,\n // which does not seem to be taken into account by Babel / Node caches\n // automatically).\n Object.keys(require.cache).forEach((key) => {\n delete require.cache[key];\n });\n register.revert();\n await super.teardown();\n }\n}\n"],"mappings":"mJAAA;AACA;AACA;AACA;AACA;AACA,GAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA,MAAO,CAAAA,IAAI,KAAM,WAAW,CAI5B,OAASC,QAAQ,CAAEC,GAAG,KAAQ,WAAW,CAIzC;AACA;AACA,sDACA,MAAO,CAAAC,QAAQ,KAAM,qCAAqC,CAE1D,MAAO,CAAAC,QAAQ,KAAM,wBAAwB,CAC7C,OAASC,MAAM,CAAEC,kBAAkB,KAAQ,OAAO,CAClD,MAAO,CAAAC,OAAO,KAA8B,SAAS,CACrD,qDAOA,QAAS,CAAAC,IAAIA,CAAA,CAAG,CACd;AAAA,CAGF,cAAe,MAAM,CAAAC,SA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CAAAT,OAAO,CAACC,KAAK,CAACQ,GAAG,CAC1B,CAAC,CAAC,CACFjG,QAAQ,CAACkG,MAAM,CAAC,CAAC,CACjB,KAAM,MAAK,CAACL,QAAQ,CAAC,CACvB,CACF","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { type AsyncCollectionT, type AsyncCollectionLoaderT, type AsyncDataEnvelopeT, type AsyncDataLoaderT, type ForceT, type UseAsyncDataOptionsT, type UseAsyncDataResT, type UseGlobalStateResT, type ValueOrInitializerT, getGlobalState, GlobalStateProvider, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, withGlobalStateType, } from '@dr.pogodin/react-global-state';
|
|
2
2
|
export * from './shared/components';
|
|
3
3
|
export { type BeforeRenderResT, type BeforeRenderT, type ConfigT, type ServerSsrContext, type ServerT, } from './server';
|
|
4
|
-
export { assertEmptyObject, Barrier, Cached, Emitter, getConfig, isomorphy, getSsrContext, type Listener, type ObjectKey, Semaphore, splitComponent, type Theme,
|
|
4
|
+
export { assertEmptyObject, Barrier, Cached, Emitter, getConfig, isomorphy, getSsrContext, type Listener, type ObjectKey, Semaphore, splitComponent, type Theme, THEME_COMPOSE, THEME_PRIORITY, ThemeProvider, time, useTheme, webpack, withRetries, } from './shared/utils';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { FunctionComponent, KeyboardEventHandler, MouseEventHandler, PointerEventHandler, ReactNode } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
|
+
type ThemeT = Theme<'active' | 'button' | 'disabled'>;
|
|
3
4
|
type PropsT = {
|
|
4
5
|
active?: boolean;
|
|
5
6
|
children?: ReactNode;
|
|
@@ -15,16 +16,11 @@ type PropsT = {
|
|
|
15
16
|
openNewTab?: boolean;
|
|
16
17
|
replace?: boolean;
|
|
17
18
|
testId?: string;
|
|
18
|
-
theme:
|
|
19
|
+
theme: ThemeT;
|
|
19
20
|
to?: object | string;
|
|
20
21
|
};
|
|
21
22
|
export declare const BaseButton: FunctionComponent<PropsT>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* @prop {string} [button] to the root element of any button.
|
|
27
|
-
* @prop {string} [disabled] to the root element of disabled button.
|
|
28
|
-
*/
|
|
29
|
-
declare const _default: import("@dr.pogodin/react-themes").ThemedComponent<PropsT>;
|
|
30
|
-
export default _default;
|
|
23
|
+
declare const Button: FunctionComponent<Omit<PropsT, 'theme'> & {
|
|
24
|
+
theme?: ThemeT;
|
|
25
|
+
}>;
|
|
26
|
+
export default Button;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
1
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
2
3
|
type PropT<ValueT> = {
|
|
3
4
|
checked?: ValueT;
|
|
@@ -5,7 +6,7 @@ type PropT<ValueT> = {
|
|
|
5
6
|
label?: React.ReactNode;
|
|
6
7
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
7
8
|
testId?: string;
|
|
8
|
-
theme
|
|
9
|
+
theme?: Theme<'checkbox' | 'container' | 'disabled' | 'indeterminate' | 'label'>;
|
|
9
10
|
};
|
|
10
|
-
declare const
|
|
11
|
-
export default
|
|
11
|
+
declare const Checkbox: <ValueT extends boolean | "indeterminate" = boolean>({ checked, disabled, label, onChange, testId, theme, }: PropT<ValueT>) => ReactNode;
|
|
12
|
+
export default Checkbox;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode, type Ref } from 'react';
|
|
1
|
+
import { type FunctionComponent, type ReactNode, type Ref } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
3
|
type ThemeKeyT = 'children' | 'container' | 'empty' | 'error' | 'errorMessage' | 'focused' | 'input' | 'label';
|
|
4
4
|
type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
@@ -7,7 +7,15 @@ type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
7
7
|
label?: React.ReactNode;
|
|
8
8
|
ref?: Ref<HTMLInputElement>;
|
|
9
9
|
testId?: string;
|
|
10
|
-
theme
|
|
10
|
+
theme?: Theme<ThemeKeyT>;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Themeable input field, based on the standard HTML `<input>` element.
|
|
14
|
+
* @param [props.label] Input label.
|
|
15
|
+
* @param [props.theme] _Ad hoc_ theme.
|
|
16
|
+
* @param [props...] [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
17
|
+
* @param [props...] Any other properties are passed to the underlying
|
|
18
|
+
* `<input>` element.
|
|
19
|
+
*/
|
|
20
|
+
declare const Input: FunctionComponent<PropsT>;
|
|
21
|
+
export default Input;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, type FunctionComponent, type ReactNode } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
|
+
type ThemeT = Theme<'container' | 'overlay'>;
|
|
3
4
|
type PropsT = {
|
|
4
5
|
cancelOnScrolling?: boolean;
|
|
5
6
|
children?: ReactNode;
|
|
@@ -9,7 +10,7 @@ type PropsT = {
|
|
|
9
10
|
style?: CSSProperties;
|
|
10
11
|
testId?: string;
|
|
11
12
|
testIdForOverlay?: string;
|
|
12
|
-
theme:
|
|
13
|
+
theme: ThemeT;
|
|
13
14
|
/** @deprecated */
|
|
14
15
|
containerStyle?: CSSProperties;
|
|
15
16
|
};
|
|
@@ -25,6 +26,8 @@ type PropsT = {
|
|
|
25
26
|
* @param {ModalTheme} [props.theme] _Ad hoc_ theme.
|
|
26
27
|
*/
|
|
27
28
|
declare const BaseModal: FunctionComponent<PropsT>;
|
|
28
|
-
declare const _default: import("@dr.pogodin/react-themes").ThemedComponent<PropsT>;
|
|
29
|
-
export default _default;
|
|
30
29
|
export { BaseModal };
|
|
30
|
+
declare const Modal: FunctionComponent<Omit<PropsT, 'theme'> & {
|
|
31
|
+
theme: ThemeT | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export default Modal;
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
3
|
type ThemeKeyT = 'container' | 'leftSidePanel' | 'mainPanel' | 'rightSidePanel' | 'sidePanel';
|
|
4
4
|
type PropsT = {
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
leftSidePanelContent?: ReactNode;
|
|
7
7
|
rightSidePanelContent?: ReactNode;
|
|
8
|
-
theme
|
|
8
|
+
theme?: Theme<ThemeKeyT>;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Simple and themeable page layout. It keeps the main content centered in
|
|
12
|
+
* a column of limited width, which fills entire viewport on small screens
|
|
13
|
+
* (under `$screen-md = 1024px` size). At larger screens the column keeps
|
|
14
|
+
* `$screen-md` size, and it is centered at the page, surrounded by side
|
|
15
|
+
* panels, where additional content can be displayed.
|
|
16
|
+
*
|
|
17
|
+
* **Children:** Component children are rendered as the content of main panel.
|
|
18
|
+
* @param {object} [props] Component properties.
|
|
19
|
+
* @param {Node} [props.leftSidePanelContent] The content for left side panel.
|
|
20
|
+
* @param {Node} [props.rightSidePanelContent] The content for right side panel.
|
|
21
|
+
* @param {PageLayoutTheme} [props.theme] _Ad hoc_ theme.
|
|
22
|
+
* @param {...any} [props....]
|
|
23
|
+
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
24
|
+
*/
|
|
25
|
+
declare const PageLayout: FunctionComponent<PropsT>;
|
|
26
|
+
export default PageLayout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChangeEventHandler, type FocusEventHandler, type KeyboardEventHandler, type ReactNode } from 'react';
|
|
1
|
+
import { type ChangeEventHandler, type FocusEventHandler, type FunctionComponent, type KeyboardEventHandler, type ReactNode } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
3
|
type ThemeKeyT = 'container' | 'error' | 'errorMessage' | 'hidden' | 'label' | 'textarea';
|
|
4
4
|
type Props = {
|
|
@@ -10,8 +10,8 @@ type Props = {
|
|
|
10
10
|
onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
11
11
|
placeholder?: string;
|
|
12
12
|
testId?: string;
|
|
13
|
-
theme
|
|
13
|
+
theme?: Theme<ThemeKeyT>;
|
|
14
14
|
value?: string;
|
|
15
15
|
};
|
|
16
|
-
declare const
|
|
17
|
-
export default
|
|
16
|
+
declare const TextArea: FunctionComponent<Props>;
|
|
17
|
+
export default TextArea;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
1
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
2
3
|
type ThemeKeyT = 'bouncing' | 'circle' | 'container';
|
|
3
4
|
type PropsT = {
|
|
4
|
-
theme
|
|
5
|
+
theme?: Theme<ThemeKeyT>;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Throbber is an "action in progress" indicator, which renders
|
|
9
|
+
* three bouncing circles as a simple pending activity indicator,
|
|
10
|
+
* and can be further themed to a certain degree.
|
|
11
|
+
* @param {object} [props] Component properties.
|
|
12
|
+
* @param {ThrobberTheme} [props.theme] _Ad hoc_ theme.
|
|
13
|
+
* @param {...any} [props....]
|
|
14
|
+
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
15
|
+
*/
|
|
16
|
+
declare const Throbber: FunctionComponent<PropsT>;
|
|
17
|
+
export default Throbber;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type FunctionComponent, type ReactNode } from 'react';
|
|
2
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
3
3
|
import { type ThemeKeysT as TooltipThemeKeysT, PLACEMENTS } from './Tooltip';
|
|
4
4
|
type PropsT = {
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
placement?: PLACEMENTS;
|
|
7
7
|
tip?: ReactNode;
|
|
8
|
-
theme
|
|
8
|
+
theme?: Theme<'wrapper' | TooltipThemeKeysT>;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Implements a simple to use and themeable tooltip component, _e.g._
|
|
12
|
+
* ```js
|
|
13
|
+
* <WithTooltip tip="This is example tooltip.">
|
|
14
|
+
* <p>Hover to see the tooltip.</p>
|
|
15
|
+
* </WithTooltip>
|
|
16
|
+
* ```
|
|
17
|
+
* **Children:** Children are rendered in the place of `<WithTooltip>`,
|
|
18
|
+
* and when hovered the tooltip is shown. By default the wrapper itself is
|
|
19
|
+
* `<div>` block with `display: inline-block`.
|
|
20
|
+
* @param tip – Anything React is able to render,
|
|
21
|
+
* _e.g._ a tooltip text. This will be the tooltip content.
|
|
22
|
+
* @param {WithTooltipTheme} props.theme _Ad hoc_ theme.
|
|
23
|
+
*/
|
|
24
|
+
declare const WithTooltip: FunctionComponent<PropsT>;
|
|
25
|
+
type ExportT = typeof WithTooltip & {
|
|
12
26
|
PLACEMENTS: typeof PLACEMENTS;
|
|
13
27
|
};
|
|
14
28
|
declare const e: ExportT;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
1
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
2
|
-
type
|
|
3
|
+
type ThemeT = Theme<'container' | 'video'>;
|
|
3
4
|
type PropsT = {
|
|
4
5
|
autoplay?: boolean;
|
|
5
6
|
src: string;
|
|
6
|
-
theme
|
|
7
|
+
theme?: ThemeT;
|
|
7
8
|
title?: string;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* A component for embeding a YouTube video.
|
|
12
|
+
* @param [props] Component properties.
|
|
13
|
+
* @param [props.autoplay] If `true` the video will start to play
|
|
14
|
+
* automatically once loaded.
|
|
15
|
+
* @param [props.src] URL of the video to play. Can be in any of
|
|
16
|
+
* the following formats, and keeps any additional query parameters understood
|
|
17
|
+
* by the YouTube IFrame player:
|
|
18
|
+
* - `https://www.youtube.com/watch?v=NdF6Rmt6Ado`
|
|
19
|
+
* - `https://youtu.be/NdF6Rmt6Ado`
|
|
20
|
+
* - `https://www.youtube.com/embed/NdF6Rmt6Ado`
|
|
21
|
+
* @param [props.theme] _Ad hoc_ theme.
|
|
22
|
+
* @param [props.title] The `title` attribute to add to the player
|
|
23
|
+
* IFrame.
|
|
24
|
+
*/
|
|
25
|
+
declare const YouTubeVideo: FunctionComponent<PropsT>;
|
|
26
|
+
export default YouTubeVideo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FunctionComponent, type ReactNode } from 'react';
|
|
1
2
|
import { type PropsT, type ValueT } from '../common';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
3
|
+
declare const CustomDropdown: FunctionComponent<PropsT<ReactNode, (value: ValueT) => void>>;
|
|
4
|
+
export default CustomDropdown;
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
1
2
|
import { type PropsT } from '../common';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Implements a themeable dropdown list. Internally it is rendered with help of
|
|
5
|
+
* the standard HTML `<select>` element, thus the styling support is somewhat
|
|
6
|
+
* limited.
|
|
7
|
+
* @param [props] Component properties.
|
|
8
|
+
* @param [props.filter] Options filter function. If provided, only
|
|
9
|
+
* those elements of `options` list will be used by the dropdown, for which this
|
|
10
|
+
* filter returns `true`.
|
|
11
|
+
* @param [props.label] Dropdown label.
|
|
12
|
+
* @param [props.onChange] Selection event handler.
|
|
13
|
+
* @param [props.options=[]] Array of dropdown
|
|
14
|
+
* options. For string elements the option value and name will be the same.
|
|
15
|
+
* It is allowed to mix DropdownOption and string elements in the same option
|
|
16
|
+
* list.
|
|
17
|
+
* @param [props.theme] _Ad hoc_ theme.
|
|
18
|
+
* @param [props.value] Currently selected value.
|
|
19
|
+
* @param [props....]
|
|
20
|
+
* [Other theming properties](https://www.npmjs.com/package/@dr.pogodin/react-themes#themed-component-properties)
|
|
21
|
+
*/
|
|
22
|
+
declare const Dropdown: FunctionComponent<PropsT<string>>;
|
|
23
|
+
export default Dropdown;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import type { FunctionComponent, ReactNode } from 'react';
|
|
1
2
|
import { type Theme } from '@dr.pogodin/react-themes';
|
|
2
3
|
import { type OptionsT, type ValueT } from '../common';
|
|
3
|
-
type
|
|
4
|
+
type ThemeT = Theme<'container' | 'label' | 'option' | 'options' | 'selected'>;
|
|
4
5
|
type PropsT = {
|
|
5
|
-
label?:
|
|
6
|
+
label?: ReactNode;
|
|
6
7
|
onChange?: (value: ValueT) => void;
|
|
7
|
-
options?: Readonly<OptionsT<
|
|
8
|
-
theme
|
|
8
|
+
options?: Readonly<OptionsT<ReactNode>>;
|
|
9
|
+
theme?: ThemeT;
|
|
9
10
|
value?: ValueT;
|
|
10
11
|
};
|
|
11
|
-
declare const
|
|
12
|
-
export
|
|
12
|
+
export declare const Switch: FunctionComponent<PropsT>;
|
|
13
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Theme } from '@dr.pogodin/react-themes';
|
|
2
|
-
type
|
|
2
|
+
export type ThemeT = Theme<'active' | 'arrow' | 'container' | 'dropdown' | 'hiddenOption' | 'label' | 'option' | 'select' | 'invalid' | 'upward'>;
|
|
3
3
|
export type ValueT = number | string;
|
|
4
4
|
export type OptionT<NameT> = {
|
|
5
5
|
name?: NameT | null;
|
|
@@ -12,9 +12,8 @@ export type PropsT<NameT, OnChangeT = React.ChangeEventHandler<HTMLSelectElement
|
|
|
12
12
|
onChange?: OnChangeT;
|
|
13
13
|
options: Readonly<OptionsT<NameT>>;
|
|
14
14
|
testId?: string;
|
|
15
|
-
theme:
|
|
15
|
+
theme: ThemeT;
|
|
16
16
|
value?: ValueT;
|
|
17
17
|
};
|
|
18
18
|
/** Returns option value and name as a tuple. */
|
|
19
19
|
export declare function optionValueName<NameT>(option: OptionT<NameT> | ValueT): [ValueT, NameT | ValueT];
|
|
20
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as CustomDropdown } from './CustomDropdown';
|
|
2
2
|
export { default as Dropdown } from './NativeDropdown';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
3
|
+
export { Switch } from './Switch';
|
|
4
|
+
export type { OptionT, OptionsT } from './common';
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import themedImpl, { COMPOSE, PRIORITY, type Theme, ThemeProvider } from '@dr.pogodin/react-themes';
|
|
2
1
|
import { getConfig } from './config';
|
|
3
2
|
import * as isomorphy from './isomorphy';
|
|
4
3
|
import time from './time';
|
|
5
4
|
import * as webpack from './webpack';
|
|
6
5
|
export { assertEmptyObject, type Listener, type ObjectKey, Barrier, Cached, Emitter, Semaphore, withRetries, } from '@dr.pogodin/js-utils';
|
|
6
|
+
export { COMPOSE as THEME_COMPOSE, PRIORITY as THEME_PRIORITY, type Theme, ThemeProvider, useTheme, } from '@dr.pogodin/react-themes';
|
|
7
7
|
export { getSsrContext } from './globalState';
|
|
8
8
|
export { default as splitComponent } from './splitComponent';
|
|
9
|
-
|
|
10
|
-
COMPOSE: typeof COMPOSE;
|
|
11
|
-
PRIORITY: typeof PRIORITY;
|
|
12
|
-
};
|
|
13
|
-
declare const themed: ThemedT;
|
|
14
|
-
export { type Theme, getConfig, isomorphy, themed, ThemeProvider, time, webpack, };
|
|
9
|
+
export { getConfig, isomorphy, time, webpack, };
|
|
@@ -9,6 +9,7 @@ import "core-js/modules/web.dom-exception.stack.js";
|
|
|
9
9
|
|
|
10
10
|
/* global document */
|
|
11
11
|
|
|
12
|
+
import { SEC_MS, timer } from '@dr.pogodin/js-utils';
|
|
12
13
|
import { getBuildInfo } from "../shared/utils/isomorphy/buildInfo";
|
|
13
14
|
let inj;
|
|
14
15
|
export default function getInj() {
|
|
@@ -28,6 +29,8 @@ export default function getInj() {
|
|
|
28
29
|
}
|
|
29
30
|
const target = window.location.href.replace(/^http:/, 'https:');
|
|
30
31
|
window.location.replace(target);
|
|
32
|
+
await timer(3 * SEC_MS);
|
|
33
|
+
throw Error('Failed to move into secure context');
|
|
31
34
|
}
|
|
32
35
|
const {
|
|
33
36
|
key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInj.js","names":["getBuildInfo","inj","getInj","metaElement","document","querySelector","remove","data","atob","content","window","isSecureContext","location","protocol","Error","target","href","replace","key","code","x","charCodeAt","dataBuffer","Uint8Array","from","slice","ivBuffer","keyBuffer","cKey","crypto","subtle","importKey","name","buffer","decrypt","iv","decoder","TextDecoder","res","eval","decode","REACT_UTILS_INJECTION"],"sources":["../../../src/client/getInj.ts"],"sourcesContent":["// Encapsulates retrieval of server-side data injection into HTML template.\n\n/* global document */\n\nimport type { InjT } from 'utils/globalState';\n\nimport { getBuildInfo } from 'utils/isomorphy/buildInfo';\n\nlet inj: InjT | Promise<InjT> | undefined;\n\nexport default function getInj(): InjT | Promise<InjT> {\n inj ??= (async () => {\n const metaElement: HTMLMetaElement | null = typeof document === 'undefined'\n ? null : document.querySelector('meta[itemprop=\"drpruinj\"]');\n\n if (metaElement) {\n metaElement.remove();\n\n // NOTE: Since 2025 there is Uint8Array.fromBase64(), which should be\n // preferred, but it is not supported by older environments yet.\n const data = atob(metaElement.content);\n\n if (!window.isSecureContext) {\n if (window.location.protocol === 'https:') {\n throw Error('Loaded via HTTPS, but it is not considered a secure context');\n } else if (window.location.protocol !== 'http:') {\n throw Error('Unexpected protocol');\n }\n\n const target = window.location.href.replace(/^http:/, 'https:');\n window.location.replace(target);\n }\n\n const { key } = getBuildInfo();\n\n const code = (x: string) => x.charCodeAt(0);\n const dataBuffer = Uint8Array.from(data.slice(16), code);\n const ivBuffer = Uint8Array.from(data.slice(0, 16), code);\n const keyBuffer = Uint8Array.from(atob(key), code);\n\n const cKey = await window.crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'AES-CBC' },\n false,\n ['decrypt'],\n );\n\n const buffer = await window.crypto.subtle.decrypt({\n iv: ivBuffer,\n name: 'AES-CBC',\n }, cKey, dataBuffer);\n\n const decoder = new TextDecoder();\n\n // eslint-disable-next-line no-eval\n const res = eval(`(${decoder.decode(buffer)})`) as InjT;\n\n // NOTE: This is important, to be able to return the injection\n // synchronously once it is initialized.\n inj = res;\n\n return res;\n } else if (typeof window !== 'undefined' && window.REACT_UTILS_INJECTION) {\n const res = window.REACT_UTILS_INJECTION;\n delete window.REACT_UTILS_INJECTION;\n return res;\n }\n\n // Otherwise, a bunch of dependent stuff will easily fail in non-standard\n // environments, where no client-side initialization is performed. Like tests,\n // Docusaurus examples, etc.\n return {};\n })();\n\n return inj;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;
|
|
1
|
+
{"version":3,"file":"getInj.js","names":["SEC_MS","timer","getBuildInfo","inj","getInj","metaElement","document","querySelector","remove","data","atob","content","window","isSecureContext","location","protocol","Error","target","href","replace","key","code","x","charCodeAt","dataBuffer","Uint8Array","from","slice","ivBuffer","keyBuffer","cKey","crypto","subtle","importKey","name","buffer","decrypt","iv","decoder","TextDecoder","res","eval","decode","REACT_UTILS_INJECTION"],"sources":["../../../src/client/getInj.ts"],"sourcesContent":["// Encapsulates retrieval of server-side data injection into HTML template.\n\n/* global document */\n\nimport { SEC_MS, timer } from '@dr.pogodin/js-utils';\n\nimport type { InjT } from 'utils/globalState';\n\nimport { getBuildInfo } from 'utils/isomorphy/buildInfo';\n\nlet inj: InjT | Promise<InjT> | undefined;\n\nexport default function getInj(): InjT | Promise<InjT> {\n inj ??= (async () => {\n const metaElement: HTMLMetaElement | null = typeof document === 'undefined'\n ? null : document.querySelector('meta[itemprop=\"drpruinj\"]');\n\n if (metaElement) {\n metaElement.remove();\n\n // NOTE: Since 2025 there is Uint8Array.fromBase64(), which should be\n // preferred, but it is not supported by older environments yet.\n const data = atob(metaElement.content);\n\n if (!window.isSecureContext) {\n if (window.location.protocol === 'https:') {\n throw Error('Loaded via HTTPS, but it is not considered a secure context');\n } else if (window.location.protocol !== 'http:') {\n throw Error('Unexpected protocol');\n }\n\n const target = window.location.href.replace(/^http:/, 'https:');\n window.location.replace(target);\n\n await timer(3 * SEC_MS);\n throw Error('Failed to move into secure context');\n }\n\n const { key } = getBuildInfo();\n\n const code = (x: string) => x.charCodeAt(0);\n const dataBuffer = Uint8Array.from(data.slice(16), code);\n const ivBuffer = Uint8Array.from(data.slice(0, 16), code);\n const keyBuffer = Uint8Array.from(atob(key), code);\n\n const cKey = await window.crypto.subtle.importKey(\n 'raw',\n keyBuffer,\n { name: 'AES-CBC' },\n false,\n ['decrypt'],\n );\n\n const buffer = await window.crypto.subtle.decrypt({\n iv: ivBuffer,\n name: 'AES-CBC',\n }, cKey, dataBuffer);\n\n const decoder = new TextDecoder();\n\n // eslint-disable-next-line no-eval\n const res = eval(`(${decoder.decode(buffer)})`) as InjT;\n\n // NOTE: This is important, to be able to return the injection\n // synchronously once it is initialized.\n inj = res;\n\n return res;\n } else if (typeof window !== 'undefined' && window.REACT_UTILS_INJECTION) {\n const res = window.REACT_UTILS_INJECTION;\n delete window.REACT_UTILS_INJECTION;\n return res;\n }\n\n // Otherwise, a bunch of dependent stuff will easily fail in non-standard\n // environments, where no client-side initialization is performed. Like tests,\n // Docusaurus examples, etc.\n return {};\n })();\n\n return inj;\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,SAASA,MAAM,EAAEC,KAAK,QAAQ,sBAAsB;AAIpD,SAASC,YAAY;AAErB,IAAIC,GAAqC;AAEzC,eAAe,SAASC,MAAMA,CAAA,EAAyB;EACrDD,GAAG,KAAK,C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AAC,EAAEC,IAAI,CAAC;MAElD,MAAMS,IAAI,GAAG,MAAMlB,MAAM,CAACmB,MAAM,CAACC,MAAM,CAACC,SAAS,CAC/C,KAAK,EACLJ,SAAS,EACT;QAAEK,IAAI,EAAE;MAAU,CAAC,EACnB,KAAK,EACL,CAAC,SAAS,CACZ,CAAC;MAED,MAAMC,MAAM,GAAG,MAAMvB,MAAM,CAACmB,MAAM,CAACC,MAAM,CAACI,OAAO,CAAC;QAChDC,EAAE,EAAET,QAAQ;QACZM,IAAI,EAAE;MACR,CAAC,EAAEJ,IAAI,EAAEN,UAAU,CAAC;MAEpB,MAAMc,OAAO,GAAG,IAAIC,WAAW,CAAC,CAAC;;MAEjC;MACA,MAAMC,GAAG,GAAGC,IAAI,CAAC,IAAIH,OAAO,CAACI,MAAM,CAACP,MAAM,CAAC,GAAG,CAAS;;MAEvD;MACA;MACAhC,GAAG,GAAGqC,GAAG;MAET,OAAOA,GAAG;IACZ,CAAC,MAAM,IAAI,OAAO5B,MAAM,KAAK,WAAW,IAAIA,MAAM,CAAC+B,qBAAqB,EAAE;MACxE,MAAMH,GAAG,GAAG5B,MAAM,CAAC+B,qBAAqB;MACxC,OAAO/B,MAAM,CAAC+B,qBAAqB;MACnC,OAAOH,GAAG;IACZ;;IAEA;IACA;IACA;IACA,OAAO,CAAC,CAAC;EACX,CAAC,EAAE,CAAC;EAEJ,OAAOrC,GAAG;AACZ","ignoreList":[]}
|
package/build/web/index.js
CHANGED
|
@@ -7,5 +7,5 @@ if (global.REACT_UTILS_LIBRARY_LOADED) {
|
|
|
7
7
|
} else global.REACT_UTILS_LIBRARY_LOADED = true;
|
|
8
8
|
export { getGlobalState, GlobalStateProvider, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, withGlobalStateType } from '@dr.pogodin/react-global-state';
|
|
9
9
|
export * from "./shared/components";
|
|
10
|
-
export { assertEmptyObject, Barrier, Cached, Emitter, getConfig, isomorphy, getSsrContext, Semaphore, splitComponent,
|
|
10
|
+
export { assertEmptyObject, Barrier, Cached, Emitter, getConfig, isomorphy, getSsrContext, Semaphore, splitComponent, THEME_COMPOSE, THEME_PRIORITY, ThemeProvider, time, useTheme, webpack, withRetries } from "./shared/utils";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/build/web/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["global","REACT_UTILS_LIBRARY_LOADED","Error","getGlobalState","GlobalStateProvider","newAsyncDataEnvelope","useAsyncCollection","useAsyncData","useGlobalState","withGlobalStateType","assertEmptyObject","Barrier","Cached","Emitter","getConfig","isomorphy","getSsrContext","Semaphore","splitComponent","
|
|
1
|
+
{"version":3,"file":"index.js","names":["global","REACT_UTILS_LIBRARY_LOADED","Error","getGlobalState","GlobalStateProvider","newAsyncDataEnvelope","useAsyncCollection","useAsyncData","useGlobalState","withGlobalStateType","assertEmptyObject","Barrier","Cached","Emitter","getConfig","isomorphy","getSsrContext","Semaphore","splitComponent","THEME_COMPOSE","THEME_PRIORITY","ThemeProvider","time","useTheme","webpack","withRetries"],"sources":["../../src/index.ts"],"sourcesContent":["// It is a safeguard against multiple instances / versions of the library\n// being loaded into environment by mistake (e.g. because of different\n// packages pinning down different exact versions of the lib, thus preventing\n// a proper dedupe and using a single common library version).\nif (global.REACT_UTILS_LIBRARY_LOADED) {\n throw Error('React utils library is already loaded');\n} else global.REACT_UTILS_LIBRARY_LOADED = true;\n\nexport {\n type AsyncCollectionT,\n type AsyncCollectionLoaderT,\n type AsyncDataEnvelopeT,\n type AsyncDataLoaderT,\n type ForceT,\n type UseAsyncDataOptionsT,\n type UseAsyncDataResT,\n type UseGlobalStateResT,\n type ValueOrInitializerT,\n getGlobalState,\n GlobalStateProvider,\n newAsyncDataEnvelope,\n useAsyncCollection,\n useAsyncData,\n useGlobalState,\n withGlobalStateType,\n} from '@dr.pogodin/react-global-state';\n\nexport * from 'components';\n\nexport {\n type BeforeRenderResT,\n type BeforeRenderT,\n type ConfigT,\n type ServerSsrContext,\n type ServerT,\n} from './server';\n\nexport {\n assertEmptyObject,\n Barrier,\n Cached,\n Emitter,\n getConfig,\n isomorphy,\n getSsrContext,\n type Listener,\n type ObjectKey,\n Semaphore,\n splitComponent,\n type Theme,\n THEME_COMPOSE,\n THEME_PRIORITY,\n ThemeProvider,\n time,\n useTheme,\n webpack,\n withRetries,\n} from 'utils';\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,IAAIA,MAAM,CAACC,0BAA0B,EAAE;EACrC,MAAMC,KAAK,CAAC,uCAAuC,CAAC;AACtD,CAAC,MAAMF,MAAM,CAACC,0BAA0B,GAAG,IAAI;AAE/C,SAUEE,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,kBAAkB,EAClBC,YAAY,EACZC,cAAc,EACdC,mBAAmB,QACd,gCAAgC;AAEvC;AAUA,SACEC,iBAAiB,EACjBC,OAAO,EACPC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,SAAS,EACTC,aAAa,EAGbC,SAAS,EACTC,cAAc,EAEdC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,WAAW","ignoreList":[]}
|
|
@@ -176,7 +176,6 @@ export default async function factory(webpackConfig, options) {
|
|
|
176
176
|
default: webpackHotMiddleware
|
|
177
177
|
} = await import(/* webpackChunkName: "server-side-code" */'webpack-hot-middleware');
|
|
178
178
|
const compiler = webpack(webpackConfig);
|
|
179
|
-
if (!compiler) throw Error('Internal error');
|
|
180
179
|
server.use(webpackDevMiddleware(compiler, {
|
|
181
180
|
publicPath,
|
|
182
181
|
serverSideRender: true
|