brut 0.0.20 → 0.0.22
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.
- checksums.yaml +4 -4
- data/.gitignore +24 -3
- data/.nvim.lua +1 -0
- data/Dockerfile.dx +12 -3
- data/Gemfile.lock +9 -7
- data/README.md +0 -7
- data/Rakefile +6 -4
- data/bin/dev +20 -0
- data/bin/docs +27 -0
- data/bin/setup +47 -1
- data/brut-css/.nvim.lua +1 -0
- data/brut-css/README.md +28 -0
- data/brut-css/bin/build +31 -0
- data/brut-css/bin/dev +1 -0
- data/brut-css/bin/docs +15 -0
- data/brut-css/bin/setup +5 -0
- data/brut-css/config/media-queries-all.css +15 -0
- data/brut-css/config/media-queries-minimal.css +5 -0
- data/brut-css/config/postcss.config.cjs +7 -0
- data/brut-css/config/pseudo-classes-all.css +9 -0
- data/brut-css/dx +1 -0
- data/brut-css/package-lock.json +3217 -0
- data/brut-css/package.json +36 -0
- data/brut-css/src/css/appearance.css +145 -0
- data/brut-css/src/css/border.css +522 -0
- data/brut-css/src/css/colors.css +3502 -0
- data/brut-css/src/css/dimensions.css +548 -0
- data/brut-css/src/css/flex.css +179 -0
- data/brut-css/src/css/index.css +13 -0
- data/brut-css/src/css/layout.css +120 -0
- data/brut-css/src/css/list.css +41 -0
- data/brut-css/src/css/positioning.css +354 -0
- data/brut-css/src/css/properties/colors.css +455 -0
- data/brut-css/src/css/properties/index.css +3 -0
- data/brut-css/src/css/properties/spacing.css +140 -0
- data/brut-css/src/css/properties/typography.css +224 -0
- data/brut-css/src/css/reset.css +107 -0
- data/brut-css/src/css/spacing.css +585 -0
- data/brut-css/src/css/typography.css +519 -0
- data/brut-css/src/css/utils.css +104 -0
- data/brut-css/src/docs/1_getting-started/1_overview.md +46 -0
- data/brut-css/src/docs/1_getting-started/2_installation.md +25 -0
- data/brut-css/src/docs/1_getting-started/3_core-concepts.md +75 -0
- data/brut-css/src/docs/1_getting-started/4_simple-example.md +132 -0
- data/brut-css/src/docs/1_getting-started/page.html.ejs +10 -0
- data/brut-css/src/docs/2_properties/page.html.ejs +71 -0
- data/brut-css/src/docs/3_classes/color-demo.html.ejs +31 -0
- data/brut-css/src/docs/3_classes/page.html.ejs +87 -0
- data/brut-css/src/docs/4_customization/1_design-system.md +36 -0
- data/brut-css/src/docs/4_customization/2_breakpoints.md +75 -0
- data/brut-css/src/docs/4_customization/3_pseudo-classes.md +74 -0
- data/brut-css/src/docs/4_customization/4_advanced-configuration.md +40 -0
- data/brut-css/src/docs/4_customization/page.html.ejs +10 -0
- data/brut-css/src/docs/docs.css +98 -0
- data/brut-css/src/docs/includes/body-and-header.html.ejs +30 -0
- data/brut-css/src/docs/includes/footer-and-rest.html.ejs +9 -0
- data/brut-css/src/docs/includes/head.html.ejs +5 -0
- data/brut-css/src/docs/includes/nav.html.ejs +10 -0
- data/brut-css/src/docs/index.html.ejs +32 -0
- data/brut-css/src/docs/prism-twilight.min.css +1 -0
- data/brut-css/src/js/Logger.js +71 -0
- data/brut-css/src/js/build.js +111 -0
- data/brut-css/src/js/cli/CLIArgError.js +7 -0
- data/brut-css/src/js/cli/Debug.js +27 -0
- data/brut-css/src/js/cli/DocsDir.js +16 -0
- data/brut-css/src/js/cli/DocsTemplateSourceDir.js +16 -0
- data/brut-css/src/js/cli/InputFile.js +31 -0
- data/brut-css/src/js/cli/MediaQueryConfigFile.js +10 -0
- data/brut-css/src/js/cli/OutputFile.js +22 -0
- data/brut-css/src/js/cli/ParsedArg.js +17 -0
- data/brut-css/src/js/cli/PathToBrutCSSRoot.js +19 -0
- data/brut-css/src/js/cli/PseudoClassConfigFile.js +11 -0
- data/brut-css/src/js/cli.js +108 -0
- data/brut-css/src/js/docGenerator.js +467 -0
- data/brut-css/src/js/mediaQueryConfigParser.js +98 -0
- data/brut-css/src/js/post-css-plugins/addMediaQueriesPlugin.js +49 -0
- data/brut-css/src/js/post-css-plugins/addPseudoClassesPlugin.js +42 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Category.js +9 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/DocState.js +185 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Documentable.js +8 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Group.js +7 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/ParsedComment.js +73 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Property.js +9 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/PropertyCategory.js +4 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/PropertyGroup.js +8 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/Rule.js +12 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/RuleCategory.js +4 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/RuleGroup.js +8 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/SeeRef.js +5 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin/SeeURL.js +9 -0
- data/brut-css/src/js/post-css-plugins/generateDocumentationPlugin.js +49 -0
- data/brut-css/src/js/post-css-plugins/generateRootCustomPropertiesPlugin.js +45 -0
- data/brut-css/src/js/pseudoClassConfigParser.js +145 -0
- data/brut-js/.projections.json +10 -0
- data/brut-js/README.md +118 -0
- data/brut-js/bin/build +10 -0
- data/brut-js/bin/ci +5 -0
- data/brut-js/bin/setup +5 -0
- data/brut-js/docs/README.md +8 -0
- data/brut-js/docs/jsdoc-plugins/customElementTag.js +8 -0
- data/brut-js/docs/jsdoc-theme/publish.js +692 -0
- data/brut-js/docs/jsdoc-theme/static/scripts/linenumber.js +25 -0
- data/brut-js/docs/jsdoc-theme/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- data/brut-js/docs/jsdoc-theme/static/scripts/prettify/lang-css.js +2 -0
- data/brut-js/docs/jsdoc-theme/static/scripts/prettify/prettify.js +28 -0
- data/brut-js/docs/jsdoc-theme/static/styles/jsdoc-default.css +327 -0
- data/brut-js/docs/jsdoc-theme/static/styles/prettify-jsdoc.css +111 -0
- data/brut-js/docs/jsdoc-theme/static/styles/prettify-tomorrow.css +132 -0
- data/brut-js/docs/jsdoc-theme/tmpl/augments.tmpl +10 -0
- data/brut-js/docs/jsdoc-theme/tmpl/container.tmpl +199 -0
- data/brut-js/docs/jsdoc-theme/tmpl/details.tmpl +143 -0
- data/brut-js/docs/jsdoc-theme/tmpl/example.tmpl +2 -0
- data/brut-js/docs/jsdoc-theme/tmpl/examples.tmpl +13 -0
- data/brut-js/docs/jsdoc-theme/tmpl/exceptions.tmpl +32 -0
- data/brut-js/docs/jsdoc-theme/tmpl/layout.tmpl +38 -0
- data/brut-js/docs/jsdoc-theme/tmpl/mainpage.tmpl +14 -0
- data/brut-js/docs/jsdoc-theme/tmpl/members.tmpl +38 -0
- data/brut-js/docs/jsdoc-theme/tmpl/method.tmpl +131 -0
- data/brut-js/docs/jsdoc-theme/tmpl/modifies.tmpl +14 -0
- data/brut-js/docs/jsdoc-theme/tmpl/params.tmpl +131 -0
- data/brut-js/docs/jsdoc-theme/tmpl/properties.tmpl +108 -0
- data/brut-js/docs/jsdoc-theme/tmpl/returns.tmpl +19 -0
- data/brut-js/docs/jsdoc-theme/tmpl/source.tmpl +8 -0
- data/brut-js/docs/jsdoc-theme/tmpl/tutorial.tmpl +19 -0
- data/brut-js/docs/jsdoc-theme/tmpl/type.tmpl +7 -0
- data/brut-js/docs/jsdoc.config.json +23 -0
- data/brut-js/docs/package-lock.json +343 -0
- data/brut-js/docs/package.json +7 -0
- data/brut-js/package-lock.json +2171 -0
- data/brut-js/package.json +32 -0
- data/brut-js/specs/AjaxSubmit.spec.js +256 -0
- data/brut-js/specs/Autosubmit.spec.js +127 -0
- data/brut-js/specs/ConfirmSubmit.spec.js +193 -0
- data/brut-js/specs/ConstraintViolationMessage.spec.js +33 -0
- data/brut-js/specs/ConstraintViolationMessages.spec.js +29 -0
- data/brut-js/specs/CopyToClipboard.spec.js +35 -0
- data/brut-js/specs/Form.spec.js +181 -0
- data/brut-js/specs/I18nTranslation.spec.js +19 -0
- data/brut-js/specs/LocaleDetection.spec.js +22 -0
- data/brut-js/specs/Message.spec.js +15 -0
- data/brut-js/specs/SpecHelper.js +23 -0
- data/brut-js/specs/Tabs.spec.js +41 -0
- data/brut-js/specs/config/asset_metadata.json +7 -0
- data/brut-js/src/AjaxSubmit.js +384 -0
- data/brut-js/src/Autosubmit.js +63 -0
- data/brut-js/src/BaseCustomElement.js +261 -0
- data/brut-js/src/ConfirmSubmit.js +116 -0
- data/brut-js/src/ConfirmationDialog.js +143 -0
- data/brut-js/src/ConstraintViolationMessage.js +125 -0
- data/brut-js/src/ConstraintViolationMessages.js +98 -0
- data/brut-js/src/CopyToClipboard.js +96 -0
- data/brut-js/src/Form.js +151 -0
- data/brut-js/src/I18nTranslation.js +61 -0
- data/brut-js/src/LocaleDetection.js +117 -0
- data/brut-js/src/Logger.js +90 -0
- data/brut-js/src/Message.js +56 -0
- data/brut-js/src/RichString.js +113 -0
- data/brut-js/src/Tabs.js +168 -0
- data/brut-js/src/Tracing.js +247 -0
- data/brut-js/src/appForTestingOnly.js +15 -0
- data/brut-js/src/index.js +130 -0
- data/brut-js/src/testing/AssetMetadata.js +35 -0
- data/brut-js/src/testing/AssetMetadataLoader.js +25 -0
- data/brut-js/src/testing/CustomElementTest.js +235 -0
- data/brut-js/src/testing/DOMCreator.js +45 -0
- data/brut-js/src/testing/index.js +48 -0
- data/brutrb.com/.vitepress/config.mjs +106 -0
- data/brutrb.com/.vitepress/plugins/jsdocLinker.js +34 -0
- data/brutrb.com/.vitepress/plugins/rdocLinker.js +18 -0
- data/brutrb.com/.vitepress/theme/custom.css +7 -0
- data/brutrb.com/.vitepress/theme/index.js +18 -0
- data/brutrb.com/.vitepress/theme/style.css +149 -0
- data/brutrb.com/ai.md +68 -0
- data/brutrb.com/assets.md +138 -0
- data/brutrb.com/bin/build +5 -0
- data/brutrb.com/bin/deploy +7 -0
- data/brutrb.com/bin/dev +5 -0
- data/brutrb.com/bin/setup +5 -0
- data/brutrb.com/brut-js.md +117 -0
- data/brutrb.com/business-logic.md +55 -0
- data/brutrb.com/cli.md +278 -0
- data/brutrb.com/components.md +243 -0
- data/brutrb.com/configuration.md +257 -0
- data/brutrb.com/css.md +103 -0
- data/brutrb.com/custom-element-tests.md +149 -0
- data/brutrb.com/database-access.md +201 -0
- data/brutrb.com/database-schema.md +312 -0
- data/brutrb.com/deployment.md +66 -0
- data/brutrb.com/dev-environment.md +179 -0
- data/brutrb.com/doc-conventions.md +39 -0
- data/brutrb.com/end-to-end-tests.md +174 -0
- data/brutrb.com/flash-and-session.md +224 -0
- data/brutrb.com/forms.md +866 -0
- data/brutrb.com/getting-started.md +66 -0
- data/brutrb.com/handlers.md +153 -0
- data/brutrb.com/hooks.md +178 -0
- data/brutrb.com/i18n.md +188 -0
- data/brutrb.com/images/Makefile +10 -0
- data/brutrb.com/images/dev-env-overview.dot +54 -0
- data/brutrb.com/images/dev-env-overview.png +0 -0
- data/brutrb.com/images/dev-env-protocol.dot +37 -0
- data/brutrb.com/images/dev-env-protocol.png +0 -0
- data/brutrb.com/images/logo-300.png +0 -0
- data/brutrb.com/images/logo.png +0 -0
- data/brutrb.com/images/overview.graffle +0 -0
- data/brutrb.com/images/overview.png +0 -0
- data/brutrb.com/images/spa.dot +19 -0
- data/brutrb.com/images/spa.png +0 -0
- data/brutrb.com/images/workspace-protocol.dot +44 -0
- data/brutrb.com/images/workspace-protocol.png +0 -0
- data/brutrb.com/index.md +36 -0
- data/brutrb.com/instrumentation.md +183 -0
- data/brutrb.com/javascript.md +122 -0
- data/brutrb.com/jobs.md +14 -0
- data/{doc-src → brutrb.com}/keyword-injection.md +122 -68
- data/brutrb.com/markdown-examples.md +85 -0
- data/brutrb.com/middleware.md +80 -0
- data/brutrb.com/not-released.md +5 -0
- data/brutrb.com/overview.md +404 -0
- data/brutrb.com/package-lock.json +2404 -0
- data/brutrb.com/package.json +11 -0
- data/brutrb.com/pages.md +378 -0
- data/brutrb.com/public/images/logo-300.png +0 -0
- data/brutrb.com/public/images/logo.png +0 -0
- data/brutrb.com/routes.md +215 -0
- data/brutrb.com/security.md +105 -0
- data/brutrb.com/seed-data.md +63 -0
- data/brutrb.com/space-time-continuum.md +85 -0
- data/brutrb.com/tutorial.md +3 -0
- data/brutrb.com/unit-tests.md +148 -0
- data/docker-compose.dx.yml +6 -3
- data/docs/404.html +21 -0
- data/docs/CNAME +1 -0
- data/docs/ai.html +24 -0
- data/docs/api/Brut/BackEnd/SeedData.html +493 -0
- data/docs/api/Brut/BackEnd/Sidekiq/Middlewares/Server/FlushSpans.html +214 -0
- data/docs/api/Brut/BackEnd/Sidekiq/Middlewares/Server.html +125 -0
- data/docs/api/Brut/BackEnd/Sidekiq/Middlewares.html +125 -0
- data/docs/api/Brut/BackEnd/Sidekiq.html +125 -0
- data/docs/api/Brut/BackEnd/Validators/FormValidator.html +414 -0
- data/docs/api/Brut/BackEnd/Validators.html +128 -0
- data/docs/api/Brut/BackEnd.html +132 -0
- data/docs/api/Brut/CLI/App.html +1576 -0
- data/docs/api/Brut/CLI/AppRunner.html +491 -0
- data/docs/api/Brut/CLI/Apps/BuildAssets/All.html +264 -0
- data/docs/api/Brut/CLI/Apps/BuildAssets/CSS.html +306 -0
- data/docs/api/Brut/CLI/Apps/BuildAssets/Images.html +262 -0
- data/docs/api/Brut/CLI/Apps/BuildAssets/JS.html +314 -0
- data/docs/api/Brut/CLI/Apps/BuildAssets.html +183 -0
- data/docs/api/Brut/CLI/Apps/DB/Create.html +365 -0
- data/docs/api/Brut/CLI/Apps/DB/Drop.html +357 -0
- data/docs/api/Brut/CLI/Apps/DB/Migrate.html +383 -0
- data/docs/api/Brut/CLI/Apps/DB/NewMigration.html +335 -0
- data/docs/api/Brut/CLI/Apps/DB/Rebuild.html +329 -0
- data/docs/api/Brut/CLI/Apps/DB/Seed.html +347 -0
- data/docs/api/Brut/CLI/Apps/DB/Status.html +383 -0
- data/docs/api/Brut/CLI/Apps/DB.html +183 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Action/Route.html +303 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Action.html +512 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Component.html +398 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/CustomElementTest.html +374 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/E2ETest.html +410 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Form.html +262 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Page/Route.html +303 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Page.html +480 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/RoutesEditor.html +450 -0
- data/docs/api/Brut/CLI/Apps/Scaffold/Test.html +380 -0
- data/docs/api/Brut/CLI/Apps/Scaffold.html +253 -0
- data/docs/api/Brut/CLI/Apps/Test/Audit.html +464 -0
- data/docs/api/Brut/CLI/Apps/Test/E2e.html +407 -0
- data/docs/api/Brut/CLI/Apps/Test/JS.html +262 -0
- data/docs/api/Brut/CLI/Apps/Test/Run.html +578 -0
- data/docs/api/Brut/CLI/Apps/Test.html +253 -0
- data/docs/api/Brut/CLI/Apps.html +125 -0
- data/docs/api/Brut/CLI/Command.html +2342 -0
- data/docs/api/Brut/CLI/Error.html +139 -0
- data/docs/api/Brut/CLI/ExecutionResults/Result.html +664 -0
- data/docs/api/Brut/CLI/ExecutionResults.html +675 -0
- data/docs/api/Brut/CLI/Executor.html +430 -0
- data/docs/api/Brut/CLI/InvalidOption.html +245 -0
- data/docs/api/Brut/CLI/Options.html +753 -0
- data/docs/api/Brut/CLI/Output.html +699 -0
- data/docs/api/Brut/CLI/SystemExecError.html +451 -0
- data/docs/api/Brut/CLI.html +263 -0
- data/docs/api/Brut/FactoryBot.html +225 -0
- data/docs/api/Brut/Framework/App.html +1097 -0
- data/docs/api/Brut/Framework/Config.html +1045 -0
- data/docs/api/Brut/Framework/Container.html +1379 -0
- data/docs/api/Brut/Framework/Error.html +140 -0
- data/docs/api/Brut/Framework/Errors/AbstractMethod.html +144 -0
- data/docs/api/Brut/Framework/Errors/Bug.html +234 -0
- data/docs/api/Brut/Framework/Errors/MissingConfiguration.html +257 -0
- data/docs/api/Brut/Framework/Errors/MissingParameter.html +273 -0
- data/docs/api/Brut/Framework/Errors/NoClassForPath.html +471 -0
- data/docs/api/Brut/Framework/Errors/NotFound.html +308 -0
- data/docs/api/Brut/Framework/Errors/NotImplemented.html +234 -0
- data/docs/api/Brut/Framework/Errors.html +328 -0
- data/docs/api/Brut/Framework/FussyTypeEnforcement.html +392 -0
- data/docs/api/Brut/Framework/MCP.html +861 -0
- data/docs/api/Brut/Framework/ProjectEnvironment.html +648 -0
- data/docs/api/Brut/Framework.html +129 -0
- data/docs/api/Brut/FrontEnd/AssetPathResolver.html +317 -0
- data/docs/api/Brut/FrontEnd/Component/Helpers.html +326 -0
- data/docs/api/Brut/FrontEnd/Component.html +365 -0
- data/docs/api/Brut/FrontEnd/Components/ConstraintViolations.html +470 -0
- data/docs/api/Brut/FrontEnd/Components/FormTag.html +518 -0
- data/docs/api/Brut/FrontEnd/Components/I18nTranslations.html +317 -0
- data/docs/api/Brut/FrontEnd/Components/Input.html +195 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs/CsrfToken.html +339 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs/InputTag.html +660 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs/RadioButton.html +417 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs/SelectTagWithOptions.html +918 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs/TextareaTag.html +651 -0
- data/docs/api/Brut/FrontEnd/Components/Inputs.html +125 -0
- data/docs/api/Brut/FrontEnd/Components/LocaleDetection.html +367 -0
- data/docs/api/Brut/FrontEnd/Components/PageIdentifier.html +336 -0
- data/docs/api/Brut/FrontEnd/Components/TimeTag.html +655 -0
- data/docs/api/Brut/FrontEnd/Components/Traceparent.html +352 -0
- data/docs/api/Brut/FrontEnd/Components.html +135 -0
- data/docs/api/Brut/FrontEnd/Download.html +467 -0
- data/docs/api/Brut/FrontEnd/Flash.html +1150 -0
- data/docs/api/Brut/FrontEnd/Form.html +1157 -0
- data/docs/api/Brut/FrontEnd/Forms/ConstraintViolation.html +634 -0
- data/docs/api/Brut/FrontEnd/Forms/Input.html +615 -0
- data/docs/api/Brut/FrontEnd/Forms/InputDeclarations.html +547 -0
- data/docs/api/Brut/FrontEnd/Forms/InputDefinition.html +1318 -0
- data/docs/api/Brut/FrontEnd/Forms/RadioButtonGroupInput.html +609 -0
- data/docs/api/Brut/FrontEnd/Forms/RadioButtonGroupInputDefinition.html +587 -0
- data/docs/api/Brut/FrontEnd/Forms/SelectInput.html +613 -0
- data/docs/api/Brut/FrontEnd/Forms/SelectInputDefinition.html +582 -0
- data/docs/api/Brut/FrontEnd/Forms/ValidityState.html +609 -0
- data/docs/api/Brut/FrontEnd/Forms.html +127 -0
- data/docs/api/Brut/FrontEnd/GenericResponse.html +377 -0
- data/docs/api/Brut/FrontEnd/Handler.html +442 -0
- data/docs/api/Brut/FrontEnd/Handlers/CspReportingHandler.html +318 -0
- data/docs/api/Brut/FrontEnd/Handlers/InstrumentationHandler/TraceParent.html +336 -0
- data/docs/api/Brut/FrontEnd/Handlers/InstrumentationHandler.html +399 -0
- data/docs/api/Brut/FrontEnd/Handlers/LocaleDetectionHandler.html +354 -0
- data/docs/api/Brut/FrontEnd/Handlers/MissingHandler/Form.html +151 -0
- data/docs/api/Brut/FrontEnd/Handlers/MissingHandler.html +315 -0
- data/docs/api/Brut/FrontEnd/Handlers.html +125 -0
- data/docs/api/Brut/FrontEnd/HandlingResults.html +339 -0
- data/docs/api/Brut/FrontEnd/HttpMethod.html +661 -0
- data/docs/api/Brut/FrontEnd/HttpStatus.html +496 -0
- data/docs/api/Brut/FrontEnd/InlineSvgLocator.html +284 -0
- data/docs/api/Brut/FrontEnd/Layout.html +318 -0
- data/docs/api/Brut/FrontEnd/Middleware.html +135 -0
- data/docs/api/Brut/FrontEnd/Middlewares/AnnotateBrutOwnedPaths.html +288 -0
- data/docs/api/Brut/FrontEnd/Middlewares/Favicon.html +292 -0
- data/docs/api/Brut/FrontEnd/Middlewares/OpenTelemetrySpan.html +324 -0
- data/docs/api/Brut/FrontEnd/Middlewares/ReloadApp.html +372 -0
- data/docs/api/Brut/FrontEnd/Middlewares.html +125 -0
- data/docs/api/Brut/FrontEnd/Page.html +773 -0
- data/docs/api/Brut/FrontEnd/Pages/MissingPage.html +797 -0
- data/docs/api/Brut/FrontEnd/Pages.html +125 -0
- data/docs/api/Brut/FrontEnd/RequestContext.html +1312 -0
- data/docs/api/Brut/FrontEnd/RouteHook.html +424 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/AgeFlash.html +242 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineScripts.html +249 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineStylesOrScripts/ReportOnly.html +264 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/CSPNoInlineStylesOrScripts.html +261 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/LocaleDetection.html +284 -0
- data/docs/api/Brut/FrontEnd/RouteHooks/SetupRequestContext.html +252 -0
- data/docs/api/Brut/FrontEnd/RouteHooks.html +115 -0
- data/docs/api/Brut/FrontEnd/Routing/FormHandlerRoute.html +227 -0
- data/docs/api/Brut/FrontEnd/Routing/FormRoute.html +305 -0
- data/docs/api/Brut/FrontEnd/Routing/MissingForm.html +324 -0
- data/docs/api/Brut/FrontEnd/Routing/MissingHandler.html +319 -0
- data/docs/api/Brut/FrontEnd/Routing/MissingPage.html +315 -0
- data/docs/api/Brut/FrontEnd/Routing/MissingPath.html +315 -0
- data/docs/api/Brut/FrontEnd/Routing/PageRoute.html +327 -0
- data/docs/api/Brut/FrontEnd/Routing/Route.html +761 -0
- data/docs/api/Brut/FrontEnd/Routing.html +927 -0
- data/docs/api/Brut/FrontEnd/Session.html +1195 -0
- data/docs/api/Brut/FrontEnd.html +134 -0
- data/docs/api/Brut/I18n/BaseMethods.html +931 -0
- data/docs/api/Brut/I18n/ForBackEnd.html +302 -0
- data/docs/api/Brut/I18n/ForCLI.html +302 -0
- data/docs/api/Brut/I18n/ForHTML.html +296 -0
- data/docs/api/Brut/I18n/HTTPAcceptLanguage/AlwaysEnglish.html +316 -0
- data/docs/api/Brut/I18n/HTTPAcceptLanguage.html +930 -0
- data/docs/api/Brut/I18n.html +127 -0
- data/docs/api/Brut/Instrumentation/LoggerSpanExporter.html +435 -0
- data/docs/api/Brut/Instrumentation/OpenTelemetry/NormalizedAttributes.html +286 -0
- data/docs/api/Brut/Instrumentation/OpenTelemetry/Span.html +302 -0
- data/docs/api/Brut/Instrumentation/OpenTelemetry.html +864 -0
- data/docs/api/Brut/Instrumentation.html +126 -0
- data/docs/api/Brut/SinatraHelpers/ClassMethods.html +532 -0
- data/docs/api/Brut/SinatraHelpers.html +281 -0
- data/docs/api/Brut/SpecSupport/ClockSupport.html +383 -0
- data/docs/api/Brut/SpecSupport/ComponentSupport.html +502 -0
- data/docs/api/Brut/SpecSupport/E2ETestServer.html +503 -0
- data/docs/api/Brut/SpecSupport/E2eSupport.html +142 -0
- data/docs/api/Brut/SpecSupport/EnhancedNode.html +403 -0
- data/docs/api/Brut/SpecSupport/FlashSupport.html +278 -0
- data/docs/api/Brut/SpecSupport/GeneralSupport/ClassMethods.html +401 -0
- data/docs/api/Brut/SpecSupport/GeneralSupport.html +195 -0
- data/docs/api/Brut/SpecSupport/HandlerSupport.html +160 -0
- data/docs/api/Brut/SpecSupport/Matchers/HaveConstraintViolation.html +553 -0
- data/docs/api/Brut/SpecSupport/Matchers/HaveHTMLAttribute.html +439 -0
- data/docs/api/Brut/SpecSupport/Matchers.html +125 -0
- data/docs/api/Brut/SpecSupport/RSpecSetup/OptionalSidekiqSupport.html +335 -0
- data/docs/api/Brut/SpecSupport/RSpecSetup.html +602 -0
- data/docs/api/Brut/SpecSupport/SessionSupport.html +196 -0
- data/docs/api/Brut/SpecSupport.html +129 -0
- data/docs/api/Brut.html +225 -0
- data/docs/api/Clock.html +603 -0
- data/docs/api/RichString.html +968 -0
- data/docs/api/SemanticLogger/Appender/Async.html +219 -0
- data/docs/api/Sequel/Extensions/BrutInstrumentation.html +115 -0
- data/docs/api/Sequel/Extensions/BrutMigrations.html +533 -0
- data/docs/api/Sequel/Extensions.html +117 -0
- data/docs/api/Sequel/Plugins/CreatedAt/InstanceMethods.html +105 -0
- data/docs/api/Sequel/Plugins/CreatedAt.html +125 -0
- data/docs/api/Sequel/Plugins/ExternalId/ClassMethods.html +207 -0
- data/docs/api/Sequel/Plugins/ExternalId/InstanceMethods.html +186 -0
- data/docs/api/Sequel/Plugins/ExternalId.html +218 -0
- data/docs/api/Sequel/Plugins/FindBang/ClassMethods.html +202 -0
- data/docs/api/Sequel/Plugins/FindBang.html +125 -0
- data/docs/api/Sequel/Plugins.html +117 -0
- data/docs/api/Sequel.html +117 -0
- data/docs/api/_index.html +1553 -0
- data/docs/api/class_list.html +54 -0
- data/docs/api/css/common.css +1 -0
- data/docs/api/css/full_list.css +58 -0
- data/docs/api/css/style.css +503 -0
- data/docs/api/file.README.html +127 -0
- data/docs/api/file_list.html +59 -0
- data/docs/api/frames.html +22 -0
- data/docs/api/index.html +127 -0
- data/docs/api/js/app.js +344 -0
- data/docs/api/js/full_list.js +242 -0
- data/docs/api/js/jquery.js +4 -0
- data/docs/api/method_list.html +3998 -0
- data/docs/api/top-level-namespace.html +112 -0
- data/docs/assets/ai.md.tZrjP9im.js +1 -0
- data/docs/assets/ai.md.tZrjP9im.lean.js +1 -0
- data/docs/assets/app.D_yaTITQ.js +1 -0
- data/docs/assets/assets.md.D3wunzLx.js +19 -0
- data/docs/assets/assets.md.D3wunzLx.lean.js +1 -0
- data/docs/assets/brut-js.md.o2DAO2s2.js +12 -0
- data/docs/assets/brut-js.md.o2DAO2s2.lean.js +1 -0
- data/docs/assets/business-logic.md.BY4hGy0m.js +1 -0
- data/docs/assets/business-logic.md.BY4hGy0m.lean.js +1 -0
- data/docs/assets/chunks/@localSearchIndexroot.BsN5i0Fi.js +1 -0
- data/docs/assets/chunks/VPLocalSearchBox.B2-ZzyTY.js +8 -0
- data/docs/assets/chunks/framework.1L-BeKqY.js +18 -0
- data/docs/assets/chunks/theme.CfGFVRvE.js +2 -0
- data/docs/assets/cli.md.RmeA2b0i.js +127 -0
- data/docs/assets/cli.md.RmeA2b0i.lean.js +1 -0
- data/docs/assets/components.md.eCttGlN-.js +104 -0
- data/docs/assets/components.md.eCttGlN-.lean.js +1 -0
- data/docs/assets/configuration.md.BRriU0cL.js +78 -0
- data/docs/assets/configuration.md.BRriU0cL.lean.js +1 -0
- data/docs/assets/css.md.DJgj2clw.js +21 -0
- data/docs/assets/css.md.DJgj2clw.lean.js +1 -0
- data/docs/assets/custom-element-tests.md.BrYJQEl3.js +69 -0
- data/docs/assets/custom-element-tests.md.BrYJQEl3.lean.js +1 -0
- data/docs/assets/database-access.md.C7l-Vuvb.js +63 -0
- data/docs/assets/database-access.md.C7l-Vuvb.lean.js +1 -0
- data/docs/assets/database-schema.md.BUjR0VS1.js +63 -0
- data/docs/assets/database-schema.md.BUjR0VS1.lean.js +1 -0
- data/docs/assets/deployment.md.Dbka4OTr.js +1 -0
- data/docs/assets/deployment.md.Dbka4OTr.lean.js +1 -0
- data/docs/assets/dev-env-overview.Gj7NWM8-.png +0 -0
- data/docs/assets/dev-env-protocol.DysDAtnz.png +0 -0
- data/docs/assets/dev-environment.md.BNc8AYiK.js +11 -0
- data/docs/assets/dev-environment.md.BNc8AYiK.lean.js +1 -0
- data/docs/assets/doc-conventions.md.DCfRXXi-.js +1 -0
- data/docs/assets/doc-conventions.md.DCfRXXi-.lean.js +1 -0
- data/docs/assets/end-to-end-tests.md.yfQHC0b5.js +26 -0
- data/docs/assets/end-to-end-tests.md.yfQHC0b5.lean.js +1 -0
- data/docs/assets/flash-and-session.md.BXY8RvT0.js +93 -0
- data/docs/assets/flash-and-session.md.BXY8RvT0.lean.js +1 -0
- data/docs/assets/forms.md.CBTYQ_Cz.js +379 -0
- data/docs/assets/forms.md.CBTYQ_Cz.lean.js +1 -0
- data/docs/assets/getting-started.md.Bz2s1Vjb.js +2 -0
- data/docs/assets/getting-started.md.Bz2s1Vjb.lean.js +1 -0
- data/docs/assets/handlers.md.089DVD3v.js +69 -0
- data/docs/assets/handlers.md.089DVD3v.lean.js +1 -0
- data/docs/assets/hooks.md.C4-moMny.js +80 -0
- data/docs/assets/hooks.md.C4-moMny.lean.js +1 -0
- data/docs/assets/i18n.md.Do9i1qWl.js +23 -0
- data/docs/assets/i18n.md.Do9i1qWl.lean.js +1 -0
- data/docs/assets/index.md.B28EwVpq.js +1 -0
- data/docs/assets/index.md.B28EwVpq.lean.js +1 -0
- data/docs/assets/instrumentation.md.CL6ax7nT.js +35 -0
- data/docs/assets/instrumentation.md.CL6ax7nT.lean.js +1 -0
- data/docs/assets/javascript.md.GWbhRS51.js +31 -0
- data/docs/assets/javascript.md.GWbhRS51.lean.js +1 -0
- data/docs/assets/jobs.md.S-2amAYp.js +1 -0
- data/docs/assets/jobs.md.S-2amAYp.lean.js +1 -0
- data/docs/assets/keyword-injection.md.Dt2tKREs.js +25 -0
- data/docs/assets/keyword-injection.md.Dt2tKREs.lean.js +1 -0
- data/docs/assets/markdown-examples.md.CCFEQO44.js +33 -0
- data/docs/assets/markdown-examples.md.CCFEQO44.lean.js +1 -0
- data/docs/assets/middleware.md.Czz_UlJN.js +20 -0
- data/docs/assets/middleware.md.Czz_UlJN.lean.js +1 -0
- data/docs/assets/not-released.md.BBy28McC.js +1 -0
- data/docs/assets/not-released.md.BBy28McC.lean.js +1 -0
- data/docs/assets/overview.Da81cB9R.png +0 -0
- data/docs/assets/overview.md.CDalkuxV.js +133 -0
- data/docs/assets/overview.md.CDalkuxV.lean.js +1 -0
- data/docs/assets/pages.md.BE3kfOc5.js +122 -0
- data/docs/assets/pages.md.BE3kfOc5.lean.js +1 -0
- data/docs/assets/routes.md.BMM7peut.js +29 -0
- data/docs/assets/routes.md.BMM7peut.lean.js +1 -0
- data/docs/assets/security.md.C668yXCi.js +1 -0
- data/docs/assets/security.md.C668yXCi.lean.js +1 -0
- data/docs/assets/seed-data.md.BvFZlqIk.js +14 -0
- data/docs/assets/seed-data.md.BvFZlqIk.lean.js +1 -0
- data/docs/assets/spa.qejUdp-5.png +0 -0
- data/docs/assets/space-time-continuum.md.KPUIKysQ.js +1 -0
- data/docs/assets/space-time-continuum.md.KPUIKysQ.lean.js +1 -0
- data/docs/assets/style.D73IYGCX.css +1 -0
- data/docs/assets/tutorial.md.BnoGjrdK.js +1 -0
- data/docs/assets/tutorial.md.BnoGjrdK.lean.js +1 -0
- data/docs/assets/unit-tests.md.DUGrnLj5.js +13 -0
- data/docs/assets/unit-tests.md.DUGrnLj5.lean.js +1 -0
- data/docs/assets/workspace-protocol.C0gXsoDb.png +0 -0
- data/docs/assets.html +42 -0
- data/docs/brut-css/brut.css +1 -0
- data/docs/brut-css/brut.max.css +22372 -0
- data/docs/brut-css/classes/appearances.html +783 -0
- data/docs/brut-css/classes/background-colors.html +3529 -0
- data/docs/brut-css/classes/border-colors.html +3529 -0
- data/docs/brut-css/classes/borders.html +2293 -0
- data/docs/brut-css/classes/dimensions.html +2581 -0
- data/docs/brut-css/classes/flex.html +917 -0
- data/docs/brut-css/classes/foreground-colors.html +3261 -0
- data/docs/brut-css/classes/junk-drawer.html +431 -0
- data/docs/brut-css/classes/layout.html +668 -0
- data/docs/brut-css/classes/lists.html +331 -0
- data/docs/brut-css/classes/positioning.html +1751 -0
- data/docs/brut-css/classes/spacings.html +2633 -0
- data/docs/brut-css/classes/typography.html +2206 -0
- data/docs/brut-css/customization/advanced-configuration.html +204 -0
- data/docs/brut-css/customization/breakpoints.html +227 -0
- data/docs/brut-css/customization/design-system.html +197 -0
- data/docs/brut-css/customization/pseudo-classes.html +228 -0
- data/docs/brut-css/docs.css +98 -0
- data/docs/brut-css/getting-started/core-concepts.html +234 -0
- data/docs/brut-css/getting-started/installation.html +190 -0
- data/docs/brut-css/getting-started/overview.html +210 -0
- data/docs/brut-css/getting-started/simple-example.html +285 -0
- data/docs/brut-css/index.html +193 -0
- data/docs/brut-css/prism-twilight.min.css +1 -0
- data/docs/brut-css/properties/colors.html +1548 -0
- data/docs/brut-css/properties/spacings.html +614 -0
- data/docs/brut-css/properties/typography.html +777 -0
- data/docs/brut-js/api/AjaxSubmit.html +374 -0
- data/docs/brut-js/api/AjaxSubmit.js.html +435 -0
- data/docs/brut-js/api/Autosubmit.html +192 -0
- data/docs/brut-js/api/Autosubmit.js.html +114 -0
- data/docs/brut-js/api/BaseCustomElement.html +1091 -0
- data/docs/brut-js/api/BaseCustomElement.js.html +312 -0
- data/docs/brut-js/api/BrutCustomElements.html +172 -0
- data/docs/brut-js/api/BufferedLogger.html +173 -0
- data/docs/brut-js/api/ConfirmSubmit.html +278 -0
- data/docs/brut-js/api/ConfirmSubmit.js.html +167 -0
- data/docs/brut-js/api/ConfirmationDialog.html +425 -0
- data/docs/brut-js/api/ConfirmationDialog.js.html +194 -0
- data/docs/brut-js/api/ConstraintViolationMessage.html +448 -0
- data/docs/brut-js/api/ConstraintViolationMessage.js.html +176 -0
- data/docs/brut-js/api/ConstraintViolationMessages.html +590 -0
- data/docs/brut-js/api/ConstraintViolationMessages.js.html +149 -0
- data/docs/brut-js/api/CopyToClipboard.html +345 -0
- data/docs/brut-js/api/CopyToClipboard.js.html +147 -0
- data/docs/brut-js/api/Form.html +294 -0
- data/docs/brut-js/api/Form.js.html +202 -0
- data/docs/brut-js/api/I18nTranslation.html +409 -0
- data/docs/brut-js/api/I18nTranslation.js.html +112 -0
- data/docs/brut-js/api/LocaleDetection.html +312 -0
- data/docs/brut-js/api/LocaleDetection.js.html +168 -0
- data/docs/brut-js/api/Logger.html +702 -0
- data/docs/brut-js/api/Logger.js.html +141 -0
- data/docs/brut-js/api/Message.html +238 -0
- data/docs/brut-js/api/Message.js.html +107 -0
- data/docs/brut-js/api/PrefixedLogger.html +369 -0
- data/docs/brut-js/api/RichString.html +1049 -0
- data/docs/brut-js/api/RichString.js.html +164 -0
- data/docs/brut-js/api/Tabs.html +295 -0
- data/docs/brut-js/api/Tabs.js.html +219 -0
- data/docs/brut-js/api/Tracing.html +277 -0
- data/docs/brut-js/api/Tracing.js.html +298 -0
- data/docs/brut-js/api/external-CustomElementRegistry.html +140 -0
- data/docs/brut-js/api/external-Performance.html +138 -0
- data/docs/brut-js/api/external-Promise.html +138 -0
- data/docs/brut-js/api/external-ValidityState.html +138 -0
- data/docs/brut-js/api/external-Window.html +233 -0
- data/docs/brut-js/api/external-fetch.html +138 -0
- data/docs/brut-js/api/global.html +400 -0
- data/docs/brut-js/api/index.html +168 -0
- data/docs/brut-js/api/index.js.html +181 -0
- data/docs/brut-js/api/module-testing.html +383 -0
- data/docs/brut-js/api/scripts/linenumber.js +25 -0
- data/docs/brut-js/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- data/docs/brut-js/api/scripts/prettify/lang-css.js +2 -0
- data/docs/brut-js/api/scripts/prettify/prettify.js +28 -0
- data/docs/brut-js/api/styles/jsdoc-default.css +327 -0
- data/docs/brut-js/api/styles/prettify-jsdoc.css +111 -0
- data/docs/brut-js/api/styles/prettify-tomorrow.css +132 -0
- data/docs/brut-js/api/testing.AssetMetadata.html +172 -0
- data/docs/brut-js/api/testing.AssetMetadataLoader.html +171 -0
- data/docs/brut-js/api/testing.CustomElementTest.html +679 -0
- data/docs/brut-js/api/testing.DOMCreator.html +171 -0
- data/docs/brut-js/api/testing_AssetMetadata.js.html +86 -0
- data/docs/brut-js/api/testing_AssetMetadataLoader.js.html +76 -0
- data/docs/brut-js/api/testing_CustomElementTest.js.html +286 -0
- data/docs/brut-js/api/testing_DOMCreator.js.html +96 -0
- data/docs/brut-js/api/testing_index.js.html +99 -0
- data/docs/brut-js.html +35 -0
- data/docs/business-logic.html +24 -0
- data/docs/cli.html +150 -0
- data/docs/components.html +127 -0
- data/docs/configuration.html +101 -0
- data/docs/css.html +44 -0
- data/docs/custom-element-tests.html +92 -0
- data/docs/database-access.html +86 -0
- data/docs/database-schema.html +86 -0
- data/docs/deployment.html +24 -0
- data/docs/dev-environment.html +34 -0
- data/docs/doc-conventions.html +24 -0
- data/docs/end-to-end-tests.html +49 -0
- data/docs/flash-and-session.html +116 -0
- data/docs/forms.html +402 -0
- data/docs/getting-started.html +25 -0
- data/docs/handlers.html +92 -0
- data/docs/hashmap.json +1 -0
- data/docs/hooks.html +103 -0
- data/docs/i18n.html +46 -0
- data/docs/images/logo-300.png +0 -0
- data/docs/images/logo.png +0 -0
- data/docs/index.html +24 -0
- data/docs/instrumentation.html +58 -0
- data/docs/javascript.html +54 -0
- data/docs/jobs.html +24 -0
- data/docs/keyword-injection.html +48 -0
- data/docs/markdown-examples.html +56 -0
- data/docs/middleware.html +43 -0
- data/docs/not-released.html +24 -0
- data/docs/overview.html +156 -0
- data/docs/pages.html +145 -0
- data/docs/routes.html +52 -0
- data/docs/security.html +24 -0
- data/docs/seed-data.html +37 -0
- data/docs/space-time-continuum.html +24 -0
- data/docs/tutorial.html +24 -0
- data/docs/unit-tests.html +36 -0
- data/docs/vp-icons.css +1 -0
- data/lib/brut/back_end/seed_data.rb +19 -2
- data/lib/brut/back_end/sidekiq/middlewares/server.rb +2 -1
- data/lib/brut/back_end/sidekiq/middlewares.rb +2 -1
- data/lib/brut/back_end/sidekiq.rb +2 -1
- data/lib/brut/back_end/validator.rb +5 -1
- data/lib/brut/back_end.rb +4 -2
- data/lib/brut/cli/app_runner.rb +1 -1
- data/lib/brut/cli/apps/test.rb +5 -0
- data/lib/brut/cli.rb +4 -3
- data/lib/brut/factory_bot.rb +0 -5
- data/lib/brut/framework/app.rb +70 -5
- data/lib/brut/framework/config.rb +5 -3
- data/lib/brut/framework/container.rb +3 -2
- data/lib/brut/framework/errors.rb +12 -4
- data/lib/brut/framework/mcp.rb +58 -1
- data/lib/brut/framework/project_environment.rb +6 -2
- data/lib/brut/framework.rb +1 -1
- data/lib/brut/front_end/component.rb +69 -71
- data/lib/brut/front_end/components/constraint_violations.rb +1 -4
- data/lib/brut/front_end/components/form_tag.rb +1 -1
- data/lib/brut/front_end/components/input.rb +3 -3
- data/lib/brut/front_end/components/inputs/csrf_token.rb +1 -1
- data/lib/brut/front_end/components/inputs/{text_field.rb → input_tag.rb} +7 -9
- data/lib/brut/front_end/components/inputs/radio_button.rb +1 -1
- data/lib/brut/front_end/components/inputs/select_tag_with_options.rb +187 -0
- data/lib/brut/front_end/components/inputs/{textarea.rb → textarea_tag.rb} +2 -2
- data/lib/brut/front_end/components/time_tag.rb +2 -1
- data/lib/brut/front_end/form.rb +4 -4
- data/lib/brut/front_end/forms/input.rb +2 -1
- data/lib/brut/front_end/forms/input_definition.rb +5 -2
- data/lib/brut/front_end/forms/radio_button_group_input.rb +2 -1
- data/lib/brut/front_end/forms/radio_button_group_input_definition.rb +2 -2
- data/lib/brut/front_end/forms/select_input.rb +2 -4
- data/lib/brut/front_end/forms/select_input_definition.rb +2 -2
- data/lib/brut/front_end/handler.rb +28 -26
- data/lib/brut/front_end/handlers/csp_reporting_handler.rb +5 -2
- data/lib/brut/front_end/handlers/instrumentation_handler.rb +8 -4
- data/lib/brut/front_end/handlers/locale_detection_handler.rb +9 -5
- data/lib/brut/front_end/handlers/missing_handler.rb +5 -2
- data/lib/brut/front_end/layout.rb +16 -0
- data/lib/brut/front_end/page.rb +52 -29
- data/lib/brut/front_end/request_context.rb +3 -2
- data/lib/brut/front_end/routing.rb +5 -1
- data/lib/brut/front_end.rb +4 -13
- data/lib/brut/i18n/base_methods.rb +167 -79
- data/lib/brut/i18n/for_back_end.rb +4 -0
- data/lib/brut/i18n/for_cli.rb +4 -0
- data/lib/brut/i18n/for_html.rb +32 -4
- data/lib/brut/i18n/http_accept_language.rb +47 -0
- data/lib/brut/instrumentation/open_telemetry.rb +36 -1
- data/lib/brut/instrumentation.rb +3 -5
- data/lib/brut/sinatra_helpers.rb +11 -3
- data/lib/brut/spec_support/component_support.rb +30 -16
- data/lib/brut/spec_support/e2e_support.rb +1 -1
- data/lib/brut/spec_support/e2e_test_server.rb +3 -0
- data/lib/brut/spec_support/general_support.rb +3 -0
- data/lib/brut/spec_support/handler_support.rb +6 -1
- data/lib/brut/spec_support/matcher.rb +1 -0
- data/lib/brut/spec_support/matchers/be_page_for.rb +1 -0
- data/lib/brut/spec_support/matchers/have_html_attribute.rb +1 -0
- data/lib/brut/spec_support/matchers/have_i18n_string.rb +2 -5
- data/lib/brut/spec_support/matchers/have_link_to.rb +1 -0
- data/lib/brut/spec_support/matchers/have_redirected_to.rb +1 -0
- data/lib/brut/spec_support/matchers/have_rendered.rb +1 -0
- data/lib/brut/spec_support/matchers/have_returned_rack_response.rb +44 -0
- data/lib/brut/spec_support.rb +1 -1
- data/lib/brut/version.rb +1 -1
- data/lib/brut.rb +5 -4
- data/lib/sequel/extensions/brut_migrations.rb +1 -1
- metadata +648 -13
- data/doc-src/architecture.md +0 -102
- data/doc-src/assets.md +0 -98
- data/doc-src/forms.md +0 -214
- data/doc-src/handlers.md +0 -83
- data/doc-src/javascript.md +0 -265
- data/doc-src/pages.md +0 -210
- data/doc-src/route-hooks.md +0 -59
- data/lib/brut/front_end/components/inputs/select.rb +0 -117
@@ -0,0 +1,467 @@
|
|
1
|
+
import ejs from "ejs"
|
2
|
+
import fs from "node:fs"
|
3
|
+
import path from "node:path"
|
4
|
+
import markdownit from "markdown-it"
|
5
|
+
import Prism from "prismjs"
|
6
|
+
import beautify from "js-beautify"
|
7
|
+
import Logger from "./Logger.js"
|
8
|
+
|
9
|
+
import loadLanguages from "prismjs/components/index.js"
|
10
|
+
loadLanguages(["html"])
|
11
|
+
|
12
|
+
/** A title has a string usable as a human-readable title, plus a sort key used
|
13
|
+
* to sort pages by their title
|
14
|
+
*/
|
15
|
+
class Title {
|
16
|
+
/** Create a title based on a directory name that may have a prefix used for sorring */
|
17
|
+
static fromDirName(dirName) {
|
18
|
+
const nameWithoutPrefix = dirName.replace(/^\d+_/, '').replace(/\..*$/,'')
|
19
|
+
const title = nameWithoutPrefix.
|
20
|
+
split('-').
|
21
|
+
map(word => word.charAt(0).toUpperCase() + word.slice(1)).
|
22
|
+
join(' ')
|
23
|
+
return new this(title, dirName)
|
24
|
+
}
|
25
|
+
constructor(title, sortKey) {
|
26
|
+
this.title = title
|
27
|
+
this.sortKey = sortKey
|
28
|
+
}
|
29
|
+
toString() { return this.title }
|
30
|
+
static compare(a,b) {
|
31
|
+
if (!a.title) { throw `${a.constructor.name} has no title` }
|
32
|
+
if (!b.title) { throw `${b.constructor.name} has no title` }
|
33
|
+
if (!a.title.sortKey) { throw `${a.constructor.name} has a title, but it's not a Title` }
|
34
|
+
if (!b.title.sortKey) { throw `${b.constructor.name} has a title, but it's not a Title` }
|
35
|
+
return a.title.sortKey.localeCompare(b.title.sortKey)
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
/* A page to generate based on a template */
|
40
|
+
class Page {
|
41
|
+
constructor(pathToPageTemplate, pathToPageOutput) {
|
42
|
+
this.pathToPageTemplate = pathToPageTemplate
|
43
|
+
this.uri = pathToPageOutput
|
44
|
+
}
|
45
|
+
|
46
|
+
static compare(a,b) {
|
47
|
+
Title.compare(a.page, b.page)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
/* A static file that isn't being run through EJS */
|
52
|
+
class StaticFile extends Page {
|
53
|
+
get title() {
|
54
|
+
return Title.fromDirName(path.basename(this.pathToPageTemplate))
|
55
|
+
}
|
56
|
+
generate(outputDirName) {
|
57
|
+
Logger.info("Copying %s from %s", this.uri, this.pathToPageTemplate)
|
58
|
+
fs.copyFileSync(this.pathToPageTemplate, path.join(outputDirName, this.uri))
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
/* A templated page that will be run through EJS */
|
63
|
+
class TemplatePage extends Page {
|
64
|
+
constructor(pathToPageTemplate, pathToPageOutput, pathToPageContent) {
|
65
|
+
super(pathToPageTemplate, pathToPageOutput)
|
66
|
+
this.pathToPageContent = pathToPageContent
|
67
|
+
}
|
68
|
+
get title() {
|
69
|
+
return Title.fromDirName(path.basename(this.pathToPageContent))
|
70
|
+
}
|
71
|
+
generate(outputDirName, pathToBrutCSSRoot, nav) {
|
72
|
+
Logger.info("Generating %s from %s using %s", this.uri, this.pathToPageTemplate, this.pathToPageContent || "no additional content")
|
73
|
+
let htmlContent = null
|
74
|
+
if (this.pathToPageContent) {
|
75
|
+
const contents = fs.readFileSync(this.pathToPageContent, "utf8")
|
76
|
+
if (path.extname(this.pathToPageContent) === ".md") {
|
77
|
+
const markdown = new markdownit({
|
78
|
+
html: true,
|
79
|
+
linkify: true,
|
80
|
+
typographer: true,
|
81
|
+
})
|
82
|
+
htmlContent = markdown.render(contents)
|
83
|
+
}
|
84
|
+
else if (path.extname(this.pathToPageContent) === ".html") {
|
85
|
+
htmlContent = contents
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
throw `Unsupported file type for ${this.pathToPageContent}. Only .md and .html are supported.`
|
89
|
+
}
|
90
|
+
}
|
91
|
+
const html = ejs.render(fs.readFileSync(this.pathToPageTemplate, "utf8"), {
|
92
|
+
nav:nav,
|
93
|
+
pathToBrutCSSRoot: pathToBrutCSSRoot,
|
94
|
+
content: htmlContent || ""
|
95
|
+
}, {
|
96
|
+
filename: this.pathToPageTemplate
|
97
|
+
})
|
98
|
+
const destinationFile = path.join(outputDirName, this.uri)
|
99
|
+
fs.mkdirSync(path.dirname(destinationFile), { recursive: true })
|
100
|
+
fs.writeFileSync(destinationFile, html, "utf8")
|
101
|
+
Logger.info("Wrote %s", destinationFile)
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
/* The page used for a category of custom properties */
|
106
|
+
class PropertiesPage extends TemplatePage {
|
107
|
+
constructor(pathToPageContent, pathToPageOutput, category, parsedDocumentation) {
|
108
|
+
super(pathToPageContent, pathToPageOutput)
|
109
|
+
Logger.debug("Creating PropertiesPage %s for %s", pathToPageContent, category.name)
|
110
|
+
this.category = category
|
111
|
+
this.colorsCategory = parsedDocumentation.classCategories.find( (category) => category.ref == "class-category:foreground-colors" )
|
112
|
+
}
|
113
|
+
get documentationRef() { return this.category.ref }
|
114
|
+
get title() { return Title.fromDirName(this.category.name) }
|
115
|
+
generate(outputDirName, pathToBrutCSSRoot, nav) {
|
116
|
+
const locals = {
|
117
|
+
nav:nav,
|
118
|
+
pathToBrutCSSRoot: pathToBrutCSSRoot,
|
119
|
+
category: this.category,
|
120
|
+
}
|
121
|
+
if ( (this.category.ref == "class-category:foreground-colors") ||
|
122
|
+
(this.category.ref == "class-category:background-colors") ||
|
123
|
+
(this.category.ref == "class-category:border-colors") ) {
|
124
|
+
locals.colorsCategory = this.colorsCategory
|
125
|
+
}
|
126
|
+
|
127
|
+
const html = ejs.render(fs.readFileSync(this.pathToPageTemplate, "utf8"),
|
128
|
+
locals,
|
129
|
+
{
|
130
|
+
filename: this.pathToPageTemplate
|
131
|
+
})
|
132
|
+
const destinationFile = path.join(outputDirName, this.uri)
|
133
|
+
fs.mkdirSync(path.dirname(destinationFile), { recursive: true })
|
134
|
+
fs.writeFileSync(destinationFile, html, "utf8")
|
135
|
+
Logger.debug("Wrote %s", destinationFile)
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
/* The page used for a category of CSS classe */
|
140
|
+
class ClassesPage extends PropertiesPage {
|
141
|
+
}
|
142
|
+
|
143
|
+
/* A section of the nav, which is a title and a bunch of pages it links to */
|
144
|
+
class NavSection {
|
145
|
+
static fromPath(sourcePath, parsedDocumentation) {
|
146
|
+
const basename = path.basename(sourcePath)
|
147
|
+
if (basename.match(/^\d+_properties$/)) {
|
148
|
+
return new PropertiesSection(sourcePath, parsedDocumentation)
|
149
|
+
}
|
150
|
+
if (basename.match(/^\d+_classes/)) {
|
151
|
+
return new ClassesSection(sourcePath, parsedDocumentation)
|
152
|
+
}
|
153
|
+
return new StaticPagesSection(sourcePath)
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
/* The section of the nav for custom properties */
|
158
|
+
class PropertiesSection extends NavSection {
|
159
|
+
constructor(sourcePath, parsedDocumentation) {
|
160
|
+
super()
|
161
|
+
this.categoryTemplate = path.join(sourcePath, "page.html.ejs")
|
162
|
+
if (!fs.existsSync(this.categoryTemplate)) {
|
163
|
+
throw `No category template found at ${this.categoryTemplate}`
|
164
|
+
}
|
165
|
+
this.parsedDocumentation = parsedDocumentation
|
166
|
+
const basename = path.basename(sourcePath)
|
167
|
+
this.uriBase = basename.replace(/^\d+_/,"")
|
168
|
+
this.title = Title.fromDirName(basename)
|
169
|
+
}
|
170
|
+
get items() {
|
171
|
+
return this.parsedDocumentation.propertyCategories.map( (category) => {
|
172
|
+
return {
|
173
|
+
page: new PropertiesPage(
|
174
|
+
this.categoryTemplate,
|
175
|
+
path.join(this.uriBase, category.name) + ".html",
|
176
|
+
category,
|
177
|
+
this.parsedDocumentation,
|
178
|
+
)
|
179
|
+
}
|
180
|
+
})
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
/* The section of the nav for CSS classes */
|
185
|
+
class ClassesSection extends PropertiesSection {
|
186
|
+
|
187
|
+
get items() {
|
188
|
+
return this.parsedDocumentation.classCategories.map( (category) => {
|
189
|
+
return {
|
190
|
+
page: new ClassesPage(
|
191
|
+
this.categoryTemplate,
|
192
|
+
path.join(this.uriBase, category.name) + ".html",
|
193
|
+
category,
|
194
|
+
this.parsedDocumentation)
|
195
|
+
}
|
196
|
+
})
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
/* A section of static pages not based on API docs, but that will be run through EJS */
|
201
|
+
class StaticPagesSection extends NavSection {
|
202
|
+
constructor(sourcePath) {
|
203
|
+
super()
|
204
|
+
this.sourcePath = sourcePath
|
205
|
+
this.pageTemplate = path.join(sourcePath, "page.html.ejs")
|
206
|
+
if (!fs.existsSync(this.pageTemplate)) {
|
207
|
+
throw `No category template found at ${this.pageTemplate}`
|
208
|
+
}
|
209
|
+
|
210
|
+
const basename = path.basename(sourcePath)
|
211
|
+
this.title = Title.fromDirName(basename)
|
212
|
+
|
213
|
+
this.items = []
|
214
|
+
|
215
|
+
fs.readdirSync(sourcePath).forEach((file) => {
|
216
|
+
const fullPath = path.join(sourcePath, file)
|
217
|
+
const stat = fs.statSync(fullPath)
|
218
|
+
if (stat.isDirectory()) {
|
219
|
+
throw `${fullPath} is a directroy. ${sourcePath} may only includes files`
|
220
|
+
}
|
221
|
+
if (file != "page.html.ejs") {
|
222
|
+
const pathToPageOutput = path.join(
|
223
|
+
...path.join(basename, file).split(path.sep).map( (part) => {
|
224
|
+
return part.replace(/^\d+_/,"").replace(/\..*$/,".html")
|
225
|
+
})
|
226
|
+
)
|
227
|
+
this.items.push({
|
228
|
+
page: new TemplatePage(this.pageTemplate, pathToPageOutput, fullPath)
|
229
|
+
})
|
230
|
+
}
|
231
|
+
})
|
232
|
+
this.items.sort(Page.compare)
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
/* Given the description parsed from the source, this expands it to HTML and also
|
237
|
+
* locates all cross-references.
|
238
|
+
*/
|
239
|
+
class ExpandedDescription {
|
240
|
+
constructor(documentedEntry, documentationRefs, pathToBrutCSSRoot) {
|
241
|
+
const unexpandedDescription = documentedEntry.description || ""
|
242
|
+
|
243
|
+
this.doc = unexpandedDescription.replace(/\{([^}]+)\}/g, (_, key) => {
|
244
|
+
const reference = key.trim()
|
245
|
+
let referenced = documentationRefs.refs[reference]
|
246
|
+
if (!referenced) {
|
247
|
+
throw new Error(`Could not find reference to ${reference} in documentation`)
|
248
|
+
}
|
249
|
+
return `[${referenced.title}](${pathToBrutCSSRoot}/${referenced.uri})`
|
250
|
+
})
|
251
|
+
}
|
252
|
+
toHTML() {
|
253
|
+
const markdown = new markdownit({
|
254
|
+
html: true,
|
255
|
+
linkify: true,
|
256
|
+
typographer: true,
|
257
|
+
})
|
258
|
+
return markdown.render(this.doc)
|
259
|
+
}
|
260
|
+
}
|
261
|
+
class ExpandedSee {
|
262
|
+
constructor(see, documentationRefs, pathToBrutCSSRoot) {
|
263
|
+
if (see.ref) {
|
264
|
+
let referenced = documentationRefs.refs[see.ref]
|
265
|
+
if (!referenced) {
|
266
|
+
const [part,rest] = see.ref.split(":",2)
|
267
|
+
const candidates = Object.keys(documentationRefs).filter( (key) => key.startsWith(part) )
|
268
|
+
throw new Error(`Could not find reference to ${see.ref} in documentation ${ candidates }`)
|
269
|
+
}
|
270
|
+
this.doc = `[${referenced.title}](${pathToBrutCSSRoot}/${referenced.uri})`
|
271
|
+
}
|
272
|
+
else {
|
273
|
+
this.doc = `[${see.linkText}](${see.url}) (external)`
|
274
|
+
}
|
275
|
+
}
|
276
|
+
toHTML() {
|
277
|
+
const markdown = new markdownit({
|
278
|
+
html: true,
|
279
|
+
linkify: true,
|
280
|
+
typographer: true,
|
281
|
+
})
|
282
|
+
return markdown.render(this.doc)
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
class Documentation {
|
287
|
+
constructor(templateRootDirName, parsedDocumentation, pathToBrutCSSRoot) {
|
288
|
+
const nav = []
|
289
|
+
const pages = []
|
290
|
+
fs.readdirSync(templateRootDirName).forEach((file) => {
|
291
|
+
const fullPath = path.join(templateRootDirName, file)
|
292
|
+
const stat = fs.statSync(fullPath)
|
293
|
+
if (stat.isDirectory()) {
|
294
|
+
if (file != "includes") {
|
295
|
+
nav.push(NavSection.fromPath(fullPath, parsedDocumentation))
|
296
|
+
}
|
297
|
+
}
|
298
|
+
else {
|
299
|
+
if (this.#isEJS(file)) {
|
300
|
+
pages.push(new TemplatePage(
|
301
|
+
fullPath,
|
302
|
+
file.replace(/^\d+_/,"").replace(/\..*$/,".html")
|
303
|
+
))
|
304
|
+
}
|
305
|
+
else {
|
306
|
+
pages.push(new StaticFile(
|
307
|
+
fullPath,
|
308
|
+
file
|
309
|
+
))
|
310
|
+
}
|
311
|
+
}
|
312
|
+
})
|
313
|
+
nav.sort(Title.compare)
|
314
|
+
this.nav = nav
|
315
|
+
this.pages = pages
|
316
|
+
this.#decorate(parsedDocumentation, pathToBrutCSSRoot)
|
317
|
+
}
|
318
|
+
|
319
|
+
#isEJS(file) {
|
320
|
+
return path.extname(file) === ".ejs"
|
321
|
+
}
|
322
|
+
|
323
|
+
#decorate(parsedDocumentation, pathToBrutCSSRoot) {
|
324
|
+
this.#addTitles(parsedDocumentation)
|
325
|
+
this.#expandReferences(parsedDocumentation, pathToBrutCSSRoot)
|
326
|
+
this.#highlightCode(parsedDocumentation)
|
327
|
+
}
|
328
|
+
|
329
|
+
#highlightCode(parsedDocumentation) {
|
330
|
+
parsedDocumentation.classCategories.forEach( (category) => {
|
331
|
+
category.scales.forEach( (scale) => {
|
332
|
+
scale.rules.forEach( (rule) => {
|
333
|
+
rule.highlightedCode = Prism.highlight(
|
334
|
+
rule.code,
|
335
|
+
Prism.languages.css,
|
336
|
+
"css"
|
337
|
+
)
|
338
|
+
rule.examples.forEach( (example) => {
|
339
|
+
const prettyHTML = beautify.html(example.code.join("\n"), {
|
340
|
+
wrap_line_length: 60,
|
341
|
+
indent_size: 2,
|
342
|
+
})
|
343
|
+
example.highlightedCode = Prism.highlight(
|
344
|
+
prettyHTML,
|
345
|
+
Prism.languages.html,
|
346
|
+
"html"
|
347
|
+
)
|
348
|
+
})
|
349
|
+
})
|
350
|
+
})
|
351
|
+
})
|
352
|
+
}
|
353
|
+
|
354
|
+
#expandReferences(parsedDocumentation, pathToBrutCSSRoot) {
|
355
|
+
const referencedDocumentation = new ReferencedDocumentation(this)
|
356
|
+
parsedDocumentation.propertyCategories.forEach( (category) => {
|
357
|
+
category.descriptionHTML = (new ExpandedDescription(category, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
358
|
+
category.seeLinks = category.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
359
|
+
category.scales.forEach( (scale) => {
|
360
|
+
scale.descriptionHTML = (new ExpandedDescription(scale, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
361
|
+
scale.seeLinks = scale.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
362
|
+
if (!scale.name) {
|
363
|
+
throw new Error(`Scale ${scale.ref}.${scale.constructor.name} has no name`)
|
364
|
+
}
|
365
|
+
scale.properties.forEach( (property) => {
|
366
|
+
property.descriptionHTML = (new ExpandedDescription(property, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
367
|
+
property.seeLinks = property.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
368
|
+
})
|
369
|
+
})
|
370
|
+
})
|
371
|
+
parsedDocumentation.classCategories.forEach( (category) => {
|
372
|
+
category.descriptionHTML = (new ExpandedDescription(category, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
373
|
+
category.seeLinks = category.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
374
|
+
category.scales.forEach( (scale) => {
|
375
|
+
scale.descriptionHTML = (new ExpandedDescription(scale, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
376
|
+
scale.seeLinks = scale.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
377
|
+
scale.rules.forEach( (rule) => {
|
378
|
+
rule.descriptionHTML = (new ExpandedDescription(rule, referencedDocumentation, pathToBrutCSSRoot)).toHTML()
|
379
|
+
rule.seeLinks = rule.sees.map( (see) => (new ExpandedSee(see, referencedDocumentation, pathToBrutCSSRoot)).toHTML() )
|
380
|
+
})
|
381
|
+
})
|
382
|
+
})
|
383
|
+
}
|
384
|
+
|
385
|
+
#addTitles(parsedDocumentation) {
|
386
|
+
parsedDocumentation.propertyCategories.forEach( (category) => {
|
387
|
+
category.title = category.explicitTitle || category.name.split(/-/).map( (part) => {
|
388
|
+
return part.charAt(0).toUpperCase() + part.slice(1)
|
389
|
+
}).join(" ")
|
390
|
+
category.scales.forEach( (scale) => {
|
391
|
+
if (!scale.name) {
|
392
|
+
throw `Scale ${scale.ref}.${JSON.stringify(scale)} has no name`
|
393
|
+
}
|
394
|
+
scale.title = scale.explicitTitle || scale.name.split(/-/).map( (part) => {
|
395
|
+
return part.charAt(0).toUpperCase() + part.slice(1)
|
396
|
+
}).join(" ")
|
397
|
+
})
|
398
|
+
})
|
399
|
+
parsedDocumentation.classCategories.forEach( (category) => {
|
400
|
+
category.title = category.explicitTitle || category.name.split(/-/).map( (part) => {
|
401
|
+
return part.charAt(0).toUpperCase() + part.slice(1)
|
402
|
+
}).join(" ")
|
403
|
+
category.scales.forEach( (scale) => {
|
404
|
+
scale.title = scale.explicitTitle || scale.name.split(/-/).map( (part) => {
|
405
|
+
return part.charAt(0).toUpperCase() + part.slice(1)
|
406
|
+
}).join(" ")
|
407
|
+
})
|
408
|
+
})
|
409
|
+
}
|
410
|
+
}
|
411
|
+
|
412
|
+
class ReferencedDocumentation {
|
413
|
+
constructor(documentation) {
|
414
|
+
this.refs = {}
|
415
|
+
documentation.nav.forEach( (navSection) => {
|
416
|
+
navSection.items.forEach( ({page}) => {
|
417
|
+
if (page.documentationRef) {
|
418
|
+
this.refs[page.documentationRef] = page
|
419
|
+
if (page.category) {
|
420
|
+
page.category.scales.forEach( (scale) => {
|
421
|
+
this.refs[scale.ref] = {
|
422
|
+
title: new Title(scale.title, scale.name),
|
423
|
+
uri: page.uri + `#${scale.ref}`
|
424
|
+
}
|
425
|
+
if (scale.properties) {
|
426
|
+
scale.properties.forEach( (property) => {
|
427
|
+
this.refs[property.ref] = {
|
428
|
+
title: new Title("`" + property.name + "`", property.name),
|
429
|
+
uri: page.uri + `#${property.ref}`
|
430
|
+
}
|
431
|
+
})
|
432
|
+
}
|
433
|
+
else if (scale.rules) {
|
434
|
+
scale.rules.forEach( (rule) => {
|
435
|
+
this.refs[rule.ref] = {
|
436
|
+
title: new Title("`" + rule.selector + "`", rule.selector),
|
437
|
+
uri: page.uri + `#${rule.ref}`
|
438
|
+
}
|
439
|
+
})
|
440
|
+
}
|
441
|
+
})
|
442
|
+
}
|
443
|
+
else {
|
444
|
+
throw `No category for ${page.documentationRef} / ${page.constructor.name}`
|
445
|
+
}
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
Logger.info("Skipping %s because it has no documentation reference", page.uri)
|
449
|
+
}
|
450
|
+
})
|
451
|
+
})
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
const docGenerator = (outputDirName, templateDirName, parsedDocumentation, pathToBrutCSSRoot) => {
|
456
|
+
const documentation = new Documentation(templateDirName, parsedDocumentation, pathToBrutCSSRoot)
|
457
|
+
|
458
|
+
documentation.pages.forEach( page => page.generate(outputDirName, pathToBrutCSSRoot, documentation.nav) )
|
459
|
+
|
460
|
+
documentation.nav.forEach( (navSection) => {
|
461
|
+
navSection.items.forEach( ({page}) => {
|
462
|
+
page.generate(outputDirName, pathToBrutCSSRoot, documentation.nav)
|
463
|
+
})
|
464
|
+
})
|
465
|
+
}
|
466
|
+
|
467
|
+
export default docGenerator
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import fs from "node:fs"
|
2
|
+
import postcss from "postcss"
|
3
|
+
import { parse } from "comment-parser"
|
4
|
+
|
5
|
+
class NormalizedCommentText {
|
6
|
+
constructor(text) {
|
7
|
+
const trimmed = (text || "").trim()
|
8
|
+
const delimitersRemoved = trimmed.replace(/\/\*+/,"").replace(/\*+\//,"")
|
9
|
+
this.normalizedComment = `/**\n ${delimitersRemoved}\n*/`
|
10
|
+
}
|
11
|
+
}
|
12
|
+
class MediaQuery {
|
13
|
+
constructor(rawQuery, documentation, suffix) {
|
14
|
+
this.rawQuery = rawQuery
|
15
|
+
this.documentation = documentation
|
16
|
+
this.suffix = suffix
|
17
|
+
this.error = null
|
18
|
+
}
|
19
|
+
|
20
|
+
isError() { return false }
|
21
|
+
}
|
22
|
+
|
23
|
+
class ParseError {
|
24
|
+
constructor(rawQuery, error) {
|
25
|
+
this.rawQuery = rawQuery
|
26
|
+
this.error = error
|
27
|
+
}
|
28
|
+
isError() { return true }
|
29
|
+
}
|
30
|
+
|
31
|
+
class CommentParsingError {
|
32
|
+
constructor(commentText, error) {
|
33
|
+
this.commentText = commentText
|
34
|
+
this.error = error
|
35
|
+
}
|
36
|
+
isError() { return true }
|
37
|
+
}
|
38
|
+
class ParsedComment {
|
39
|
+
static fromNormalizedCommentText(normalizedCommentText) {
|
40
|
+
const commentParserResult = parse(normalizedCommentText.normalizedComment)
|
41
|
+
if (commentParserResult.length == 0) {
|
42
|
+
return new CommentParsingError(commentText, "Did not contain a preceding comment (which should contain a @suffix tag)")
|
43
|
+
}
|
44
|
+
if (commentParserResult.length > 1) {
|
45
|
+
throw `Something is wrong: Got more than one comment from ${normalizedCommentText.normalizedComment}`
|
46
|
+
}
|
47
|
+
const parsedComment = commentParserResult[0]
|
48
|
+
const suffixTags = parsedComment.tags.filter((tag) => tag.tag === "suffix")
|
49
|
+
if (suffixTags.length == 0) {
|
50
|
+
return new CommentParsingError(normalizedCommentText.normalizedComment, "Did not contain a @suffix tag")
|
51
|
+
}
|
52
|
+
if (suffixTags.length > 1) {
|
53
|
+
return new CommentParsingError(normalizedCommentText.normalizedComment, "Contained more than one @suffix tag")
|
54
|
+
}
|
55
|
+
return new ParsedComment(parsedComment.description, suffixTags[0].name)
|
56
|
+
}
|
57
|
+
|
58
|
+
constructor(documentation, suffix) {
|
59
|
+
this.documentation = documentation
|
60
|
+
this.suffix = suffix
|
61
|
+
this.error = null
|
62
|
+
}
|
63
|
+
|
64
|
+
isError() { return false }
|
65
|
+
}
|
66
|
+
|
67
|
+
const mediaQueryConfigParser = (mediaQueryConfigFile) => {
|
68
|
+
const mediaQueries = [
|
69
|
+
new MediaQuery(null, "The default media query", null)
|
70
|
+
]
|
71
|
+
if (!mediaQueryConfigFile) {
|
72
|
+
return mediaQueries
|
73
|
+
}
|
74
|
+
const css = fs.readFileSync(mediaQueryConfigFile, 'utf8')
|
75
|
+
const parsedCSS = postcss.parse(css, { from: mediaQueryConfigFile })
|
76
|
+
|
77
|
+
|
78
|
+
parsedCSS.walkAtRules('media', (rule) => {
|
79
|
+
const mediaQuery = rule.params.trim()
|
80
|
+
const comment = rule.prev()
|
81
|
+
|
82
|
+
if (!comment || comment.type !== "comment") {
|
83
|
+
mediaQueries.push(new ParseError(mediaQuery, "Must be preceded by a comment"))
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
const parsedComment = ParsedComment.fromNormalizedCommentText(new NormalizedCommentText(comment.text))
|
87
|
+
if (parsedComment.isError()) {
|
88
|
+
mediaQueries.push(new ParseError(mediaQuery, parsedComment.error))
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
mediaQueries.push(new MediaQuery(mediaQuery, parsedComment.documentation, parsedComment.suffix))
|
92
|
+
}
|
93
|
+
}
|
94
|
+
})
|
95
|
+
return mediaQueries
|
96
|
+
}
|
97
|
+
|
98
|
+
export default mediaQueryConfigParser
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import postcss from "postcss"
|
2
|
+
|
3
|
+
const addMediaQueriesPlugin = (mediaQueries) => {
|
4
|
+
return {
|
5
|
+
postcssPlugin: 'add-media-queries',
|
6
|
+
Once(root) {
|
7
|
+
const toAppend = []
|
8
|
+
mediaQueries.forEach( (mediaQuery) => {
|
9
|
+
const atRule = mediaQuery.rawQuery ? postcss.atRule({ name: "media", params: mediaQuery.rawQuery }) : null
|
10
|
+
root.walkRules( (rule) => {
|
11
|
+
if (rule.selector !== ":root") {
|
12
|
+
const cloned = rule.clone();
|
13
|
+
let changedSelectors = false
|
14
|
+
if (mediaQuery.suffix) {
|
15
|
+
cloned.selectors = cloned.selectors.map( (selector) => {
|
16
|
+
if ( selector.startsWith(".") && (selector.lastIndexOf(".") == 0) && selector.indexOf(" ") == -1 ) {
|
17
|
+
changedSelectors = true
|
18
|
+
if (selector.indexOf(":") == -1) {
|
19
|
+
return selector + `-${mediaQuery.suffix}`
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
return selector.replace(/:(.*)$/, `-${mediaQuery.suffix}:$1`)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
return selector
|
27
|
+
}
|
28
|
+
})
|
29
|
+
}
|
30
|
+
if (atRule && changedSelectors) {
|
31
|
+
atRule.append(cloned)
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
// No need to append - this rule is already there
|
35
|
+
}
|
36
|
+
}
|
37
|
+
})
|
38
|
+
if (atRule) {
|
39
|
+
toAppend.push(atRule)
|
40
|
+
}
|
41
|
+
})
|
42
|
+
toAppend.forEach( (rule) => {
|
43
|
+
root.append(rule)
|
44
|
+
})
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
addMediaQueriesPlugin.postcss = true
|
49
|
+
export default addMediaQueriesPlugin
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import postcss from "postcss"
|
2
|
+
|
3
|
+
const addPseudoClassesPlugin = (pseudoClasses) => {
|
4
|
+
return {
|
5
|
+
postcssPlugin: 'add-pseudo-classes',
|
6
|
+
Once(root) {
|
7
|
+
const toAppend = []
|
8
|
+
pseudoClasses.forEach( (pseudoClass) => {
|
9
|
+
const atRule = pseudoClass.surroundAtRule() ? postcss.atRule(pseudoClass.surroundAtRule()) : null
|
10
|
+
root.walkRules( (rule) => {
|
11
|
+
if (rule.selector !== ":root") {
|
12
|
+
if (pseudoClass.includesSelector(rule.selector)) {
|
13
|
+
const cloned = rule.clone();
|
14
|
+
cloned.selectors = cloned.selectors.map(sel => {
|
15
|
+
if (sel.startsWith(".")) {
|
16
|
+
return `.${pseudoClass.prefix}-` + sel.slice(1) + `:${pseudoClass.pseudoClass}`
|
17
|
+
}
|
18
|
+
else {
|
19
|
+
return sel
|
20
|
+
}
|
21
|
+
})
|
22
|
+
if (atRule) {
|
23
|
+
atRule.append(cloned)
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
toAppend.push(cloned)
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
})
|
31
|
+
if (atRule) {
|
32
|
+
toAppend.push(atRule)
|
33
|
+
}
|
34
|
+
})
|
35
|
+
toAppend.forEach( (rule) => {
|
36
|
+
root.append(rule)
|
37
|
+
})
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
addPseudoClassesPlugin.postcss = true
|
42
|
+
export default addPseudoClassesPlugin
|