tiun 0.0.2.1 → 0.1.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.
- checksums.yaml +4 -4
- data/.forgejo/workflows/codeberg-tests.yml +226 -0
- data/.gitignore +7 -3
- data/.prettierrc.json +5 -0
- data/.rubocop.yml +221 -0
- data/AGENTS.md +132 -0
- data/Appraisals +18 -0
- data/CONTRIBUTING.md +80 -0
- data/CONTRIBUTING.ru.md +326 -0
- data/Gemfile +20 -1
- data/README.md +52 -23
- data/README.ru.md +72 -0
- data/Rakefile +10 -4
- data/TODO +2 -6
- data/bin/console +4 -3
- data/config/cucumber.yml +1 -0
- data/cucumber.mjs +6 -0
- data/docs/backend.md +73 -0
- data/docs/backend.ru.md +73 -0
- data/docs/components/approved.md +39 -0
- data/docs/components/approved.ru.md +39 -0
- data/docs/components/attachment-field.md +7 -0
- data/docs/components/attachment-field.ru.md +8 -0
- data/docs/components/attachment.md +48 -0
- data/docs/components/attachment.ru.md +48 -0
- data/docs/components/avatar.md +39 -0
- data/docs/components/avatar.ru.md +37 -0
- data/docs/components/chip.md +119 -0
- data/docs/components/chip.ru.md +99 -0
- data/docs/components/configuration.md +137 -0
- data/docs/components/configuration.ru.md +138 -0
- data/docs/components/daylight.md +41 -0
- data/docs/components/daylight.ru.md +41 -0
- data/docs/components/defaults.md +148 -0
- data/docs/components/defaults.ru.md +149 -0
- data/docs/components/documents.md +64 -0
- data/docs/components/documents.ru.md +64 -0
- data/docs/components/external-form-fields.ru.md +137 -0
- data/docs/components/external-renderers.md +50 -0
- data/docs/components/external-renderers.ru.md +51 -0
- data/docs/components/feedback.md +76 -0
- data/docs/components/feedback.ru.md +76 -0
- data/docs/components/footer.md +49 -0
- data/docs/components/footer.ru.md +49 -0
- data/docs/components/forms.md +177 -0
- data/docs/components/forms.ru.md +177 -0
- data/docs/components/images.md +111 -0
- data/docs/components/images.ru.md +111 -0
- data/docs/components/index.md +140 -0
- data/docs/components/index.ru.md +140 -0
- data/docs/components/intro.md +150 -0
- data/docs/components/intro.ru.md +150 -0
- data/docs/components/login.md +600 -0
- data/docs/components/login.ru.md +602 -0
- data/docs/components/methods.md +59 -0
- data/docs/components/methods.ru.md +59 -0
- data/docs/components/player.md +72 -0
- data/docs/components/player.ru.md +69 -0
- data/docs/components/profile.md +82 -0
- data/docs/components/profile.ru.md +82 -0
- data/docs/components/record-manager.md +69 -0
- data/docs/components/record-manager.ru.md +69 -0
- data/docs/components/row-column.ru.md +51 -0
- data/docs/components/rtfer.md +76 -0
- data/docs/components/rtfer.ru.md +76 -0
- data/docs/components/schema-calendar.md +86 -0
- data/docs/components/schema-calendar.ru.md +84 -0
- data/docs/components/schema-records.md +166 -0
- data/docs/components/schema-records.ru.md +166 -0
- data/docs/components/signup.md +194 -0
- data/docs/components/signup.ru.md +194 -0
- data/docs/components/slug-flow.md +97 -0
- data/docs/components/slug-flow.ru.md +59 -0
- data/docs/components/stockee.md +21 -0
- data/docs/components/stockee.ru.md +21 -0
- data/docs/components/text-views.md +64 -0
- data/docs/components/text-views.ru.md +57 -0
- data/docs/components/theme.md +212 -0
- data/docs/components/theme.ru.md +212 -0
- data/docs/components/tooltip.md +37 -0
- data/docs/components/tooltip.ru.md +30 -0
- data/docs/components/validation.md +153 -0
- data/docs/components/validation.ru.md +154 -0
- data/docs/components.md +31 -0
- data/docs/components.ru.md +31 -0
- data/docs/controller-names.md +23 -0
- data/docs/controller-names.ru.md +23 -0
- data/docs/examples/dneslov-frontend.md +38 -0
- data/docs/examples/dneslov-frontend.ru.md +39 -0
- data/docs/examples/dneslov-frontend.yaml +266 -0
- data/docs/frontend.md +316 -0
- data/docs/frontend.ru.md +332 -0
- data/docs/migrations/component-configuration.md +48 -0
- data/docs/migrations/component-configuration.ru.md +40 -0
- data/docs/migrations/component-shell-proposal.md +108 -0
- data/docs/migrations/component-shell-proposal.ru.md +150 -0
- data/docs/migrations/theme-layout.md +83 -0
- data/docs/migrations/theme-layout.ru.md +97 -0
- data/docs/reference.md +45 -0
- data/docs/reference.ru.md +1763 -0
- data/docs/resources.md +348 -0
- data/docs/resources.ru.md +349 -0
- data/docs/tasks/DNE-542.md +11 -0
- data/docs/tasks/DNE-566.md +8 -0
- data/docs/tasks/chip-segments.md +54 -0
- data/docs/tasks/configured-profile.md +73 -0
- data/docs/tasks/frontend/auth-form.md +7 -0
- data/docs/tasks/frontend/avatar.md +5 -0
- data/docs/tasks/frontend/component-removal.md +11 -0
- data/docs/tasks/frontend/dynamic-field.md +6 -0
- data/docs/tasks/frontend/field-caption.md +38 -0
- data/docs/tasks/frontend/form-core.md +65 -0
- data/docs/tasks/frontend/form-field-context.md +16 -0
- data/docs/tasks/frontend/form-session-renewal.md +58 -0
- data/docs/tasks/frontend/frontend-components.md +7 -0
- data/docs/tasks/frontend/frontend-docs.md +6 -0
- data/docs/tasks/frontend/frontend-layout.md +13 -0
- data/docs/tasks/frontend/frontend-methods.md +15 -0
- data/docs/tasks/frontend/frontend-other.md +13 -0
- data/docs/tasks/frontend/frontend-services.md +7 -0
- data/docs/tasks/frontend/fusion.md +22 -0
- data/docs/tasks/frontend/heading-core.md +5 -0
- data/docs/tasks/frontend/i18n-scope.md +37 -0
- data/docs/tasks/frontend/index-runtime.md +48 -0
- data/docs/tasks/frontend/inline-form.md +7 -0
- data/docs/tasks/frontend/intro-core.md +11 -0
- data/docs/tasks/frontend/login.md +8 -0
- data/docs/tasks/frontend/menu-branch.md +5 -0
- data/docs/tasks/frontend/paginator.md +7 -0
- data/docs/tasks/frontend/records-core.md +35 -0
- data/docs/tasks/frontend/resource-source-core.md +12 -0
- data/docs/tasks/frontend/signup.md +8 -0
- data/docs/tasks/frontend/span-body.md +16 -0
- data/docs/tasks/frontend/text-commonee.md +48 -0
- data/docs/tasks/frontend/theme-field.md +31 -0
- data/docs/tasks/frontend/theme-menu.md +8 -0
- data/docs/tasks/frontend/theme-settings.md +10 -0
- data/docs/tasks/frontend/view-content-core.md +12 -0
- data/docs/tasks/frontend/view-source-core.md +12 -0
- data/docs/tasks/ruby-extension-compatibility.ru.md +74 -0
- data/docs/tasks/todo-code-climate.md +8 -0
- data/docs/tasks/todo-compatibility.md +50 -0
- data/docs/tasks/todo-reek.md +5 -0
- data/docs/tasks/todo-yard-inch.md +7 -0
- data/eslint.config.mjs +15 -0
- data/exe/tiun +1 -0
- data/gemfiles/rails_7_0.gemfile +16 -0
- data/gemfiles/rails_7_2.gemfile +17 -0
- data/lib/config/locale/browser.en.yml +43 -0
- data/lib/config/locale/browser.ru.yml +35 -0
- data/lib/config/locale/confirmation.en.yml +16 -0
- data/lib/config/locale/confirmation.ru.yml +16 -0
- data/lib/config/locale/errors.en.yml +57 -0
- data/lib/config/locale/errors.ru.yml +47 -0
- data/lib/config/locale/form_delay.en.yml +11 -0
- data/lib/config/locale/form_delay.ru.yml +11 -0
- data/lib/config/locale/recovery.en.yml +14 -0
- data/lib/config/locale/ru.yml +272 -6
- data/lib/config/routes.rb +5 -11
- data/lib/tasks/tiun/translations.rake +12 -0
- data/lib/tiun/actor/validate.rb +3 -2
- data/lib/tiun/actor.rb +13 -10
- data/lib/tiun/api_not_found.rb +16 -0
- data/lib/tiun/attributes.rb +8 -7
- data/lib/tiun/auth/attribute_models.rb +32 -0
- data/lib/tiun/auth/controller/discord.rb +26 -0
- data/lib/tiun/auth/controller/facebook.rb +62 -0
- data/lib/tiun/auth/controller/github.rb +37 -0
- data/lib/tiun/auth/controller/kakao.rb +33 -0
- data/lib/tiun/auth/controller/oauth.rb +167 -0
- data/lib/tiun/auth/controller/ok.rb +8 -0
- data/lib/tiun/auth/controller/telegram.rb +188 -0
- data/lib/tiun/auth/controller/vk.rb +85 -0
- data/lib/tiun/auth/controller/wechat.rb +58 -0
- data/lib/tiun/auth/controller/weibo.rb +28 -0
- data/lib/tiun/auth/controller.rb +467 -150
- data/lib/tiun/auth/json_session.rb +19 -0
- data/lib/tiun/auth/token_identity.rb +37 -0
- data/lib/tiun/auth/user_identity.rb +27 -0
- data/lib/tiun/auth/views/oauth_address.html.erb +23 -0
- data/lib/tiun/auth.rb +184 -45
- data/lib/tiun/carrier_wave_store.rb +59 -0
- data/lib/tiun/cli.rb +52 -32
- data/lib/tiun/concern/resources.rb +85 -0
- data/lib/tiun/config_source.rb +52 -0
- data/lib/tiun/content_range.rb +123 -0
- data/lib/tiun/context/merge.rb +117 -0
- data/lib/tiun/context.rb +39 -0
- data/lib/tiun/controller/auth/identity.rb +201 -0
- data/lib/tiun/controller/auth/registration.rb +23 -0
- data/lib/tiun/controller/auth.rb +198 -0
- data/lib/tiun/controller/auto.rb.erb +10 -0
- data/lib/tiun/controller/base/actions.rb +156 -0
- data/lib/tiun/controller/base/assignment.rb +101 -0
- data/lib/tiun/controller/base/parameters.rb +198 -0
- data/lib/tiun/controller/base/params.rb +166 -0
- data/lib/tiun/controller/base/records.rb +107 -0
- data/lib/tiun/controller/base/representation.rb +97 -0
- data/lib/tiun/controller/base/scopes.rb +132 -0
- data/lib/tiun/controller/base.rb +52 -0
- data/lib/tiun/controller/component_assets.rb +96 -0
- data/lib/tiun/controller/meta.rb +248 -0
- data/lib/tiun/controller/translations.rb +22 -0
- data/lib/tiun/controller.rb +13 -0
- data/lib/tiun/core/boot.rb +210 -0
- data/lib/tiun/core/contexts.rb +53 -0
- data/lib/tiun/core/controller_contexts.rb +42 -0
- data/lib/tiun/core/defaults.rb +215 -0
- data/lib/tiun/core/evaluation.rb +105 -0
- data/lib/tiun/core/field_attributes.rb +78 -0
- data/lib/tiun/core/files.rb +153 -0
- data/lib/tiun/core/generation.rb +234 -0
- data/lib/tiun/core/methods.rb +104 -0
- data/lib/tiun/core/names.rb +140 -0
- data/lib/tiun/core/registry.rb +97 -0
- data/lib/tiun/core/reloading.rb +77 -0
- data/lib/tiun/core/resources.rb +308 -0
- data/lib/tiun/core/routing/forward.rb +206 -0
- data/lib/tiun/core/routing.rb +323 -0
- data/lib/tiun/core/types.rb +88 -0
- data/lib/tiun/core.rb +26 -0
- data/lib/tiun/core_helper.rb +85 -13
- data/lib/tiun/engine.rb +64 -20
- data/lib/tiun/error_handling.rb +121 -0
- data/lib/tiun/hooks.rb +131 -0
- data/lib/tiun/mailer/confirmation.rb +37 -0
- data/lib/tiun/mailer/recovery.rb +16 -0
- data/lib/tiun/migration.rb +72 -50
- data/lib/tiun/mixins.rb +128 -19
- data/lib/tiun/model/account/identity.rb +93 -0
- data/lib/tiun/model/account.rb +180 -7
- data/lib/tiun/model/auth/bcrypt.rb +47 -0
- data/lib/tiun/model/auth.rb +162 -36
- data/lib/tiun/model/auto.rb.erb +12 -0
- data/lib/tiun/model/me.rb +133 -0
- data/lib/tiun/model/settings.rb +186 -0
- data/lib/tiun/model/token/recovery.rb +48 -0
- data/lib/tiun/model/token.rb +37 -3
- data/lib/tiun/model.rb +82 -69
- data/lib/tiun/notification/service.rb +18 -0
- data/lib/tiun/notification.rb +6 -0
- data/lib/tiun/policy/default.rb +7 -0
- data/lib/tiun/policy.rb +84 -8
- data/lib/tiun/proceed/allowed_errors.rb +217 -0
- data/lib/tiun/proceed/auth.rb +50 -0
- data/lib/tiun/proceed/description.rb +89 -0
- data/lib/tiun/proceed/enums.rb +225 -0
- data/lib/tiun/proceed/hooks.rb +51 -0
- data/lib/tiun/proceed/pass_over_paths.rb +40 -0
- data/lib/tiun/proceed/policy.rb +172 -0
- data/lib/tiun/proceed/registration.rb +69 -0
- data/lib/tiun/proceed/schemas/component_nodes.rb +436 -0
- data/lib/tiun/proceed/schemas/constants.rb +116 -0
- data/lib/tiun/proceed/schemas/content.rb +68 -0
- data/lib/tiun/proceed/schemas/definitions.rb +181 -0
- data/lib/tiun/proceed/schemas/dictionary.rb +144 -0
- data/lib/tiun/proceed/schemas/fields.rb +182 -0
- data/lib/tiun/proceed/schemas/models.rb +50 -0
- data/lib/tiun/proceed/schemas/spans.rb +86 -0
- data/lib/tiun/proceed/schemas/values.rb +94 -0
- data/lib/tiun/proceed/schemas/view_paths.rb +86 -0
- data/lib/tiun/proceed/schemas/view_readiness.rb +51 -0
- data/lib/tiun/proceed/schemas/views.rb +192 -0
- data/lib/tiun/proceed/schemas.rb +137 -0
- data/lib/tiun/proceed/services.rb +79 -0
- data/lib/tiun/proceed/token_lifetimes.rb +49 -0
- data/lib/tiun/proceed/translations.rb +45 -0
- data/lib/tiun/proceed/versions.rb +315 -0
- data/lib/tiun/proceed.rb +23 -0
- data/lib/tiun/router.rb +40 -0
- data/lib/tiun/routes/mounts.rb +277 -0
- data/lib/tiun/routes.rb +150 -0
- data/lib/tiun/service/auto.rb.erb +5 -0
- data/lib/tiun/service/email_confirmation.rb +36 -0
- data/lib/tiun/service/job.rb +16 -0
- data/lib/tiun/service.rb +82 -0
- data/lib/tiun/services/translation.rb +297 -0
- data/lib/tiun/themes.rb +98 -0
- data/lib/tiun/translations/database.rb +72 -0
- data/lib/tiun/translations.rb +279 -0
- data/lib/tiun/version.rb +3 -3
- data/lib/tiun.rb +79 -486
- data/package-lock.json +4836 -0
- data/package.json +103 -0
- data/scripts/build-application.mjs +39 -0
- data/scripts/build-css.mjs +21 -0
- data/scripts/ci-badges.mjs +54 -0
- data/scripts/ci-badges.test.mjs +46 -0
- data/scripts/ci-coverage.mjs +26 -0
- data/scripts/ci-quality.mjs +80 -0
- data/scripts/ci-quality.sh +21 -0
- data/scripts/ci-quality.test.mjs +59 -0
- data/scripts/clean.mjs +3 -0
- data/scripts/publish-ci-badges.sh +45 -0
- data/src/auth/configuration.ts +50 -0
- data/src/browser/contracts.js +7 -0
- data/src/browser/mount.d.ts +26 -0
- data/src/browser/mount.jsx +1 -0
- data/src/browser/styles.js +17 -0
- data/src/browser/tiun.scss +23 -0
- data/src/browser/tiun.ts +1 -0
- data/src/calendar/configuration.ts +98 -0
- data/src/components/Avatar.tsx +45 -0
- data/src/components/Calendar.tsx +441 -0
- data/src/components/CatchWrapper.tsx +55 -0
- data/src/components/Chip.tsx +267 -0
- data/src/components/Column.tsx +13 -0
- data/src/components/Component.tsx +1039 -0
- data/src/components/Enum.tsx +142 -0
- data/src/components/Figure.tsx +11 -0
- data/src/components/FlexText.tsx +101 -0
- data/src/components/Footer.tsx +13 -0
- data/src/components/Grid.tsx +36 -0
- data/src/components/Heading.tsx +64 -0
- data/src/components/Image.tsx +168 -0
- data/src/components/Index.tsx +391 -0
- data/src/components/Intro.tsx +536 -0
- data/src/components/Loader.tsx +116 -0
- data/src/components/Lorem.tsx +379 -0
- data/src/components/Markdown.d.ts +17 -0
- data/src/components/Markdown.jsx +118 -0
- data/src/components/Menu.tsx +50 -0
- data/src/components/Modal.tsx +143 -0
- data/src/components/Paginator.tsx +265 -0
- data/src/components/Player.tsx +269 -0
- data/src/components/Records.tsx +1063 -0
- data/src/components/Row.tsx +193 -0
- data/src/components/Span.tsx +122 -0
- data/src/components/Step.tsx +19 -0
- data/src/components/Stockee.tsx +50 -0
- data/src/components/Toast.tsx +125 -0
- data/src/components/Tooltip.tsx +214 -0
- data/src/components/View.tsx +278 -0
- data/src/components/_palette.scss +26 -0
- data/src/components/calendar-browser.scss +133 -0
- data/src/components/calendar.scss +217 -0
- data/src/components/chip-browser.scss +270 -0
- data/src/components/chips.scss +95 -0
- data/src/components/column.scss +4 -0
- data/src/components/dashboard-browser.scss +81 -0
- data/src/components/dashboard.scss +117 -0
- data/src/components/description-browser.scss +112 -0
- data/src/components/document.scss +43 -0
- data/src/components/enum-browser.scss +33 -0
- data/src/components/enums.scss +56 -0
- data/src/components/footer.scss +51 -0
- data/src/components/form/ActionButton.tsx +66 -0
- data/src/components/form/Attachment.tsx +200 -0
- data/src/components/form/Block.tsx +55 -0
- data/src/components/form/BooleanBox.tsx +58 -0
- data/src/components/form/Collection.tsx +89 -0
- data/src/components/form/DynamicInput.tsx +806 -0
- data/src/components/form/ErrorSpan.tsx +17 -0
- data/src/components/form/ExternalField.tsx +554 -0
- data/src/components/form/FieldCaption.tsx +35 -0
- data/src/components/form/Form.tsx +407 -0
- data/src/components/form/HiddenField.tsx +10 -0
- data/src/components/form/JsonEditor.tsx +443 -0
- data/src/components/form/Login.tsx +381 -0
- data/src/components/form/NumberField.tsx +75 -0
- data/src/components/form/Pressee.tsx +101 -0
- data/src/components/form/RtferField.tsx +94 -0
- data/src/components/form/SelectField.tsx +73 -0
- data/src/components/form/SlugFlow.tsx +296 -0
- data/src/components/form/TextArea.tsx +5 -0
- data/src/components/form/TextField.tsx +6 -0
- data/src/components/form/Wye.tsx +67 -0
- data/src/components/form/auth.scss +366 -0
- data/src/components/form/changes.ts +239 -0
- data/src/components/form/context.ts +31 -0
- data/src/components/form/createForm.tsx +109 -0
- data/src/components/form/dynamic-field.scss +20 -0
- data/src/components/form/dynamicMatching.ts +44 -0
- data/src/components/form/form-browser.scss +106 -0
- data/src/components/form/forms.scss +1570 -0
- data/src/components/form/formsLib.ts +76 -0
- data/src/components/form/identity.ts +10 -0
- data/src/components/form/input.scss +37 -0
- data/src/components/form/layout.ts +72 -0
- data/src/components/form/login-browser.scss +30 -0
- data/src/components/form/render.tsx +94 -0
- data/src/components/form/resourceFields.ts +87 -0
- data/src/components/form/types.ts +214 -0
- data/src/components/form/values.ts +266 -0
- data/src/components/image.scss +67 -0
- data/src/components/intro-browser.scss +106 -0
- data/src/components/intro.scss +158 -0
- data/src/components/loader.scss +86 -0
- data/src/components/menu.scss +24 -0
- data/src/components/player.scss +48 -0
- data/src/components/records-browser.scss +62 -0
- data/src/components/records.scss +181 -0
- data/src/components/row.scss +31 -0
- data/src/components/stockee.scss +26 -0
- data/src/components/theme-palettes/compat.scss +15 -0
- data/src/components/theme-palettes/dark.scss +237 -0
- data/src/components/theme-palettes/light.scss +21 -0
- data/src/components/theme.scss +34 -0
- data/src/components/tiun_core.scss +9 -0
- data/src/components/toast.scss +63 -0
- data/src/components/tooltip.scss +22 -0
- data/src/components/view-browser.scss +321 -0
- data/src/components/view-controls.scss +385 -0
- data/src/concern/application.ts +56 -0
- data/src/concern/calendarViewProps.ts +28 -0
- data/src/concern/chipViewProps.ts +60 -0
- data/src/concern/documentHead.ts +66 -0
- data/src/concern/i18n.ts +70 -0
- data/src/concern/resourceRequest.ts +25 -0
- data/src/concern/schemaText.ts +6 -0
- data/src/concern/slugFlowProps.ts +76 -0
- data/src/concern/spanOptions.ts +37 -0
- data/src/concern/spansViewProps.tsx +103 -0
- data/src/concern/useFormAccess.ts +324 -0
- data/src/concern/useRecordsResource.ts +60 -0
- data/src/config/application.ts +57 -0
- data/src/config/componentDefaults.ts +106 -0
- data/src/config/components.ts +436 -0
- data/src/config/names.ts +72 -0
- data/src/config/records.ts +34 -0
- data/src/decorators/buttonBehaviours.tsx +46 -0
- data/src/decorators/configuration.ts +104 -0
- data/src/decorators/validation.ts +52 -0
- data/src/decorators/withAppearance.tsx +45 -0
- data/src/decorators/withCaption.tsx +21 -0
- data/src/decorators/withChildren.tsx +31 -0
- data/src/decorators/withClose.scss +37 -0
- data/src/decorators/withClose.tsx +44 -0
- data/src/decorators/withColumn.tsx +111 -0
- data/src/decorators/withDiscordAuth.tsx +4 -0
- data/src/decorators/withExternalAuth.tsx +50 -0
- data/src/decorators/withFacebookAuth.tsx +4 -0
- data/src/decorators/withField.tsx +91 -0
- data/src/decorators/withForm.tsx +365 -0
- data/src/decorators/withGithubAuth.tsx +4 -0
- data/src/decorators/withKakaoAuth.tsx +4 -0
- data/src/decorators/withMenuBranch.scss +45 -0
- data/src/decorators/withMenuBranch.tsx +109 -0
- data/src/decorators/withOkAuth.tsx +4 -0
- data/src/decorators/withPlayerList.tsx +77 -0
- data/src/decorators/withQuickLinkMark.ts +57 -0
- data/src/decorators/withRecordForm.tsx +561 -0
- data/src/decorators/withRequestActivity.scss +7 -0
- data/src/decorators/withRequestActivity.tsx +21 -0
- data/src/decorators/withRouter.tsx +395 -0
- data/src/decorators/withRouterLink.tsx +54 -0
- data/src/decorators/withTelegramAuth.tsx +4 -0
- data/src/decorators/withTextControl.tsx +194 -0
- data/src/decorators/withUnique.scss +39 -0
- data/src/decorators/withUnique.tsx +172 -0
- data/src/decorators/withUnsavedChanges.scss +39 -0
- data/src/decorators/withUnsavedChanges.tsx +312 -0
- data/src/decorators/withValidation.ts +38 -0
- data/src/decorators/withVkAuth.tsx +4 -0
- data/src/decorators/withWechatAuth.tsx +4 -0
- data/src/decorators/withWeiboAuth.tsx +4 -0
- data/src/intro/config.ts +72 -0
- data/src/intro/position.ts +70 -0
- data/src/layout/units.ts +21 -0
- data/src/records/types.ts +67 -0
- data/src/routing/nativePaths.ts +16 -0
- data/src/routing/routes.ts +337 -0
- data/src/schema/Schema.ts +2034 -0
- data/src/schema/dates.ts +17 -0
- data/src/schema.ts +274 -0
- data/src/services/Meta.ts +64 -0
- data/src/services/Resource.ts +480 -0
- data/src/services/Stock.ts +156 -0
- data/src/services/browser/requestActivity.d.ts +7 -0
- data/src/services/browser/requestActivity.js +119 -0
- data/src/services/browser/slugColor.js +13 -0
- data/src/services/calendar/clock.ts +169 -0
- data/src/services/calendar/dates.ts +127 -0
- data/src/services/calendar/daylight.ts +301 -0
- data/src/services/calendar/useCalendarDaylight.ts +76 -0
- data/src/services/calendar/utcTimeSource.ts +41 -0
- data/src/services/enumLookup.ts +96 -0
- data/src/services/form/blankCondition.ts +61 -0
- data/src/services/form/hoardValidation.ts +84 -0
- data/src/services/i18n/I18n.ts +227 -0
- data/src/services/i18n/messages.ts +185 -0
- data/src/services/load.ts +60 -0
- data/src/services/methods/aboutData.d.ts +9 -0
- data/src/services/methods/aboutData.js +32 -0
- data/src/services/methods/calendarChoices.d.ts +1 -0
- data/src/services/methods/calendarChoices.js +9 -0
- data/src/services/methods/eventDates.ts +96 -0
- data/src/services/methods/forms.ts +22 -0
- data/src/services/methods/mount.jsx +34 -0
- data/src/services/methods/paschal.ts +45 -0
- data/src/services/methods/prepared.ts +193 -0
- data/src/services/methods/query.ts +30 -0
- data/src/services/methods/registry.ts +22 -0
- data/src/services/methods/resolveReadResource.ts +57 -0
- data/src/services/methods.ts +156 -0
- data/src/services/records/range.ts +39 -0
- data/src/services/records/resource.ts +90 -0
- data/src/services/records/useRecordPages.ts +266 -0
- data/src/services/session/renewal.ts +394 -0
- data/src/services/textLink.ts +11 -0
- data/src/services/timer.ts +25 -0
- data/src/services/useAppearance.ts +496 -0
- data/src/services/useSwitch.ts +146 -0
- data/src/theme/cache.ts +88 -0
- data/src/theme/configuration.ts +261 -0
- data/src/theme/context.ts +48 -0
- data/src/theme/resource.ts +106 -0
- data/tiun.gemspec +53 -45
- data/tools/rubocop/compact_block_braces.rb +39 -0
- data/tools/rubocop/i18n_decorators.rb +15 -0
- data/tools/rubocop/spacing.rb +96 -0
- data/tsconfig.build.json +26 -0
- data/tsconfig.json +27 -0
- metadata +628 -72
- data/.rspec +0 -3
- data/.travis.yml +0 -7
- data/lib/tiun/autocontroller.rb.erb +0 -20
- data/lib/tiun/autolistserializer.rb.erb +0 -9
- data/lib/tiun/automodel.rb.erb +0 -10
- data/lib/tiun/autoserializer.rb.erb +0 -9
- data/lib/tiun/base.rb +0 -405
- data/lib/tiun/core_controller.rb +0 -6
- data/lib/tiun/list_serializer.rb +0 -20
- data/lib/tiun/meta_controller.rb +0 -13
- data/lib/tiun/serializer.rb +0 -31
- /data/lib/tiun/{automigration.rb.erb → migration/auto.rb.erb} +0 -0
- /data/lib/tiun/{autopolicy.rb.erb → policy/auto.rb.erb} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Поле Rtfer
|
|
2
|
+
|
|
3
|
+
[English](rtfer.md)
|
|
4
|
+
|
|
5
|
+
Пакет `tiun` включает собственный HTML-редактор. Поле `of: rtfer` поддерживает визуальное редактирование, исходный HTML и команды жирного, курсивного и подчёркнутого текста без зависимости от стороннего редактора.
|
|
6
|
+
|
|
7
|
+
## Изменение статьи
|
|
8
|
+
|
|
9
|
+
При открытии `/articles/7/edit` форма читает статью через GET. Редактор показывает HTML из `text`. Кнопка сохранения отправляет актуальный HTML через PUT на тот же ресурс в теле `{"article":{"text":"<p>Изменённая статья</p>"}}`. Задайте переводы `articles.text` и `articles.edit` в локали приложения.
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
types:
|
|
13
|
+
- name: article
|
|
14
|
+
fields:
|
|
15
|
+
- name: id
|
|
16
|
+
kind: integer
|
|
17
|
+
- name: text
|
|
18
|
+
kind: string
|
|
19
|
+
|
|
20
|
+
components:
|
|
21
|
+
- name: article_edit
|
|
22
|
+
of: view
|
|
23
|
+
mount_to: /articles/:id:integer/edit
|
|
24
|
+
children:
|
|
25
|
+
- name: article_editor
|
|
26
|
+
of: form
|
|
27
|
+
resources:
|
|
28
|
+
access: articles.member
|
|
29
|
+
allow: [get, put]
|
|
30
|
+
fields:
|
|
31
|
+
- name: text
|
|
32
|
+
of: rtfer
|
|
33
|
+
title: ':articles.text'
|
|
34
|
+
placeholder: ':articles.edit'
|
|
35
|
+
required: true
|
|
36
|
+
|
|
37
|
+
resources:
|
|
38
|
+
- name: articles.member
|
|
39
|
+
path: /api/v0/articles/:id.json
|
|
40
|
+
root: article
|
|
41
|
+
methods:
|
|
42
|
+
- name: get
|
|
43
|
+
kind: article
|
|
44
|
+
- name: put
|
|
45
|
+
kind: article
|
|
46
|
+
args:
|
|
47
|
+
- name: text
|
|
48
|
+
kind: string
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`Index` загружает этот конфиг через ресурс метаданных.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { createRoot } from "react-dom/client"
|
|
55
|
+
import { Index } from "tiun"
|
|
56
|
+
import "tiun/forms.css"
|
|
57
|
+
|
|
58
|
+
createRoot(document.getElementById("app")!).render(<Index />)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Для создания записи укажите `resources.create` и разрешите `post`. Перед публичным показом HTML очищает приложение. [Формы и модалы](forms.ru.md)
|
|
62
|
+
|
|
63
|
+
## Настройки поля
|
|
64
|
+
|
|
65
|
+
В YAML используется `snake_case`, то есть слова через подчёркивание, например `mount_to`. Двоеточием начинается ссылка на перевод. `$`-привязка читает данные, например `data: $article` у формы. Редактор читает и меняет строку HTML по имени поля.
|
|
66
|
+
|
|
67
|
+
| Поле YAML | Тип и назначение |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `components[].children[].fields[].of` | Обязательная строка `rtfer`. Выбирает редактор HTML. |
|
|
70
|
+
| `components[].children[].fields[].name` | Обязательная строка. Имя поля в записи и в ресурсе записи, например `text`. |
|
|
71
|
+
| `components[].children[].fields[].title` | Необязательная ссылка на перевод. Задаёт видимую подпись и доступное имя редактора. При отсутствии подписи для доступного имени берётся подсказка или имя поля. |
|
|
72
|
+
| `components[].children[].fields[].placeholder` | Необязательная ссылка на перевод. Подсказка в пустом редакторе. По умолчанию `:tiun.components.rtfer.placeholder`. |
|
|
73
|
+
| `components[].children[].fields[].required` | Необязательное логическое значение, по умолчанию `false`. При `true` форма показывает ошибку и блокирует отправку, пока строка HTML пуста. |
|
|
74
|
+
| `components[].children[].fields[].readonly` | Необязательное логическое значение, по умолчанию `false`. При `true` редактор показывает HTML в режиме чтения. |
|
|
75
|
+
| `components[].children[].fields[].disabled` | Необязательное логическое значение, по умолчанию `false`. При `true` редактор заблокирован. Форма также блокирует редактор во время сохранения. |
|
|
76
|
+
| `components[].children[].fields[].validations` | Необязательное отображение имён проверок на ссылки на перевод. По умолчанию дополнительных проверок нет. Форма показывает переведённую ошибку рядом с редактором. |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
|
|
3
|
+
[Русский](schema-calendar.ru.md)
|
|
4
|
+
|
|
5
|
+
The rectangular calendar style was adapted from [eakarpov's calendar stylesheet](https://github.com/eakarpov/dneslov-web/blob/d281e2dfd375efaf340c7e767d920d46772ced97/src/app/components/Calendar/styles.scss).
|
|
6
|
+
|
|
7
|
+
Each calendar holds its own selection and gets today's date from its clock. This example starts on 18 November 2026 in the Julian calendar and displays the Revised Julian date for comparison. For the YAML version, register `change_date` in `registry.methods` with the same `onUpdate` callback used by the React example. Record fields such as an event's `year_date` stay on that record.
|
|
8
|
+
|
|
9
|
+
YAML keys use underscores, as in `with_date`. A style value such as `$appearance.calendar_style` reads the field from the data passed to the calendar.
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
settings:
|
|
13
|
+
components:
|
|
14
|
+
calendar:
|
|
15
|
+
calendars: [julian, neojulian]
|
|
16
|
+
style: ortho
|
|
17
|
+
on_update: change_date
|
|
18
|
+
calendars:
|
|
19
|
+
- name: julian
|
|
20
|
+
time_zone: Europe/Zurich
|
|
21
|
+
catch_from: https://worldtimeapi.org/api/timezone/Etc/UTC
|
|
22
|
+
catch_period: 1d
|
|
23
|
+
- name: neojulian
|
|
24
|
+
time_zone: Europe/Zurich
|
|
25
|
+
components:
|
|
26
|
+
- name: church_calendar
|
|
27
|
+
of: calendar
|
|
28
|
+
with_date: "18.11.2026"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Calendar, utcTimeSource } from "tiun"
|
|
33
|
+
import "tiun/calendar.css"
|
|
34
|
+
|
|
35
|
+
const timeSource = utcTimeSource("https://worldtimeapi.org/api/timezone/Etc/UTC")
|
|
36
|
+
|
|
37
|
+
const calendar = <Calendar
|
|
38
|
+
typesUsed={["julian", "neojulian"]}
|
|
39
|
+
style="ortho"
|
|
40
|
+
initialDate="18.11.2026"
|
|
41
|
+
calendarClocks={{
|
|
42
|
+
julian: {
|
|
43
|
+
timeZone: "Europe/Zurich",
|
|
44
|
+
timeSource,
|
|
45
|
+
timeSyncIntervalMs: 86_400_000
|
|
46
|
+
},
|
|
47
|
+
neojulian: {
|
|
48
|
+
timeZone: "Europe/Zurich"
|
|
49
|
+
}
|
|
50
|
+
}}
|
|
51
|
+
onUpdate={changeDate}
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Parameters
|
|
56
|
+
|
|
57
|
+
| Property | Purpose |
|
|
58
|
+
| --- | --- |
|
|
59
|
+
| `settings.components.calendar` | Optional mapping of shared calendar properties. An explicit node property takes precedence. |
|
|
60
|
+
| `components[].calendars` | Optional nonempty list of unique names declared in `calendars`. The first starts active, and the second supplies comparison dates. Built-in default `[atomic]`. |
|
|
61
|
+
| `components[].style` | Optional string. `round` uses rounded controls and is the default. `ortho` uses rectangular controls. |
|
|
62
|
+
| `components[].with_date` | Optional DD.MM.YYYY date in the active calendar, with year 2–9998. Defaults to today. The YAML value initializes local selection. |
|
|
63
|
+
| `components[].first_day` | Optional integer from 0 (Sunday) to 6 (Saturday). Defaults to 1 (Monday) for Gregorian and 0 otherwise. |
|
|
64
|
+
| `components[].initial_month` | Optional mapping with integer `year` (2–9998) and `month` (1–12). Defaults to the selected date’s month. |
|
|
65
|
+
| `components[].initial_view` | Optional string. `days` displays days (default), `months` displays months, `years` displays years. |
|
|
66
|
+
| `components[].class` | Optional CSS class string for the calendar root. |
|
|
67
|
+
| `components[].now` | Optional number of milliseconds since the Unix epoch. Otherwise the calendar uses its clock. |
|
|
68
|
+
| `components[].on_update` | Optional method name. Register its `onUpdate` callback in `registry.methods`. Selection stays local by default. |
|
|
69
|
+
| `calendars[].name` | Required string. `atomic` uses UTC, `gregorian` is Gregorian, `julian` is Julian, and `neojulian` is Revised Julian. |
|
|
70
|
+
| `calendars[].time_zone` | Optional IANA zone such as `Europe/Zurich`. Defaults to the device zone. `atomic` always uses UTC. |
|
|
71
|
+
| `calendars[].catch_from` | Optional absolute external HTTP(S) URL returning an ISO UTC timestamp in `utc_datetime`. Defaults to the device clock. |
|
|
72
|
+
| `calendars[].catch_period` | Optional positive integer with `s` (seconds), `m` (minutes), `h` (hours), or `d` (days). Maximum 2,147,483,647 ms. Defaults to one hour. |
|
|
73
|
+
|
|
74
|
+
`onUpdate` receives `withDate` (DD.MM.YYYY), `primaryType`, and `secondaryType` (the comparison calendar or `null`). Pass React's `withDate` for a controlled selection. `initialDate` initializes local selection.
|
|
75
|
+
|
|
76
|
+
Calendars that share a URL share clock polling. Requests carry no cookies or authorization headers. [Daylight services](daylight.md)
|
|
77
|
+
|
|
78
|
+
## Orthodox Paschalion
|
|
79
|
+
|
|
80
|
+
The `пасхалия` function accepts an integer year from 1 through 9999 and returns the date of Orthodox Easter in the Julian calendar.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { пасхалия } from "tiun"
|
|
84
|
+
|
|
85
|
+
пасхалия(2026) // { year: 2026, month: 3, day: 30 }
|
|
86
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Календарь
|
|
2
|
+
|
|
3
|
+
[English](schema-calendar.md)
|
|
4
|
+
|
|
5
|
+
У каждого календаря свой выбранный день. Сегодняшнюю дату он вычисляет по своим часам. В примере календарь начинается с 18 ноября 2026 года по юлианскому календарю и показывает новоюлианскую дату для сравнения. Для YAML зарегистрируйте `change_date` в `registry.methods` с тем же обработчиком `onUpdate`, что в примере React. Поле события `year_date` остаётся в записи события.
|
|
6
|
+
|
|
7
|
+
Имена YAML записываются с подчёркиваниями, например `with_date`. Значение `$appearance.calendar_style` в `style` читает поле из данных календаря.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
settings:
|
|
11
|
+
components:
|
|
12
|
+
calendar:
|
|
13
|
+
calendars: [julian, neojulian]
|
|
14
|
+
style: ortho
|
|
15
|
+
on_update: change_date
|
|
16
|
+
calendars:
|
|
17
|
+
- name: julian
|
|
18
|
+
time_zone: Europe/Zurich
|
|
19
|
+
catch_from: https://worldtimeapi.org/api/timezone/Etc/UTC
|
|
20
|
+
catch_period: 1d
|
|
21
|
+
- name: neojulian
|
|
22
|
+
time_zone: Europe/Zurich
|
|
23
|
+
components:
|
|
24
|
+
- name: church_calendar
|
|
25
|
+
of: calendar
|
|
26
|
+
with_date: "18.11.2026"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Calendar, utcTimeSource } from "tiun"
|
|
31
|
+
import "tiun/calendar.css"
|
|
32
|
+
|
|
33
|
+
const timeSource = utcTimeSource("https://worldtimeapi.org/api/timezone/Etc/UTC")
|
|
34
|
+
|
|
35
|
+
const calendar = <Calendar
|
|
36
|
+
typesUsed={["julian", "neojulian"]}
|
|
37
|
+
style="ortho"
|
|
38
|
+
initialDate="18.11.2026"
|
|
39
|
+
calendarClocks={{
|
|
40
|
+
julian: {
|
|
41
|
+
timeZone: "Europe/Zurich",
|
|
42
|
+
timeSource,
|
|
43
|
+
timeSyncIntervalMs: 86_400_000
|
|
44
|
+
},
|
|
45
|
+
neojulian: {
|
|
46
|
+
timeZone: "Europe/Zurich"
|
|
47
|
+
}
|
|
48
|
+
}}
|
|
49
|
+
onUpdate={changeDate}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Параметры
|
|
54
|
+
|
|
55
|
+
| Параметр | Назначение |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `settings.components.calendar` | Необязательный словарь общих свойств календаря. Свойство узла имеет приоритет. |
|
|
58
|
+
| `components[].calendars` | Необязательный непустой список уникальных имён из `calendars`. Первый календарь активен при открытии, второй даёт даты для сравнения. Встроенное умолчание `[atomic]`. |
|
|
59
|
+
| `components[].style` | Необязательная строка. `round` использует скруглённые кнопки и действует по умолчанию. `ortho` использует прямоугольные кнопки. |
|
|
60
|
+
| `components[].with_date` | Необязательная дата ДД.ММ.ГГГГ в активном календаре с годом от 2 до 9998. Задаёт начальный выбор. По умолчанию выбран сегодняшний день. |
|
|
61
|
+
| `components[].first_day` | Необязательное целое от 0 (воскресенье) до 6 (суббота). Умолчание для григорианского календаря — 1 (понедельник), для остальных — 0. |
|
|
62
|
+
| `components[].initial_month` | Необязательный словарь с целыми `year` (2–9998) и `month` (1–12). По умолчанию открывается месяц выбранной даты. |
|
|
63
|
+
| `components[].initial_view` | Необязательная строка. `days` показывает дни (умолчание), `months` — месяцы, `years` — годы. |
|
|
64
|
+
| `components[].class` | Необязательная строка классов CSS корневого элемента. |
|
|
65
|
+
| `components[].now` | Необязательное число миллисекунд с начала эпохи Unix. По умолчанию календарь использует свои часы. |
|
|
66
|
+
| `components[].on_update` | Необязательное имя метода с обработчиком `onUpdate` в `registry.methods`. По умолчанию выбор хранится локально без вызова метода. |
|
|
67
|
+
| `calendars[].name` | Обязательная строка. `atomic` использует UTC, `gregorian` — григорианский, `julian` — юлианский, `neojulian` — новоюлианский календарь. |
|
|
68
|
+
| `calendars[].time_zone` | Необязательный часовой пояс IANA, например `Europe/Zurich`. По умолчанию берётся пояс устройства. `atomic` всегда использует UTC. |
|
|
69
|
+
| `calendars[].catch_from` | Необязательный внешний URL HTTP(S). Служба возвращает время UTC в формате ISO в поле `utc_datetime`. По умолчанию используются часы устройства. |
|
|
70
|
+
| `calendars[].catch_period` | Необязательная строка из положительного целого и единицы `s` (секунды), `m` (минуты), `h` (часы) или `d` (дни). Предел 2 147 483 647 мс. Умолчание — один час. |
|
|
71
|
+
|
|
72
|
+
`onUpdate` получает `withDate` (ДД.ММ.ГГГГ), `primaryType` и `secondaryType` (календарь для сравнения или `null`). В React за управляемый выбор отвечает `withDate`, за начальную дату локального выбора — `initialDate`.
|
|
73
|
+
|
|
74
|
+
Календари с одним URL сверяют часы через общий таймер. Запросы идут без cookies и заголовков авторизации. [Дневное оформление](daylight.ru.md)
|
|
75
|
+
|
|
76
|
+
## Православная пасхалия
|
|
77
|
+
|
|
78
|
+
Функция `пасхалия` принимает целый год от 1 до 9999. Она возвращает дату православной Пасхи в юлианском календаре.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { пасхалия } from "tiun"
|
|
82
|
+
|
|
83
|
+
пасхалия(2026) // { year: 2026, month: 3, day: 30 }
|
|
84
|
+
```
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Configured record lists
|
|
2
|
+
|
|
3
|
+
[Русский](schema-records.ru.md)
|
|
4
|
+
|
|
5
|
+
A Records component renders the rows delivered by its Loader child. The example uses the shared loader to read `rite.index`. Add `of: rites` to a View’s children to render that list on a page. In React, pass the same loaded rows as `rites` or render the named configuration through `Component`.
|
|
6
|
+
|
|
7
|
+
`[]` denotes an array item in the reference table. `$title` reads a field of the current record. YAML keys use underscores, as in `autoload_upto`.
|
|
8
|
+
|
|
9
|
+
Loader keeps the count of fetched records and displays its progress. It hands each page to Records, which owns the array of records.
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
settings:
|
|
13
|
+
components:
|
|
14
|
+
records:
|
|
15
|
+
children:
|
|
16
|
+
- name: loader
|
|
17
|
+
of: loader
|
|
18
|
+
actions:
|
|
19
|
+
index: "^"
|
|
20
|
+
components:
|
|
21
|
+
- name: rites
|
|
22
|
+
of: records
|
|
23
|
+
view: table
|
|
24
|
+
actions:
|
|
25
|
+
index: rite.index
|
|
26
|
+
children:
|
|
27
|
+
- name: row
|
|
28
|
+
of: row
|
|
29
|
+
uid: $id
|
|
30
|
+
children:
|
|
31
|
+
- name: title
|
|
32
|
+
of: lorem
|
|
33
|
+
text: $title
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Records } from "tiun"
|
|
38
|
+
import "tiun/records.css"
|
|
39
|
+
|
|
40
|
+
<Records
|
|
41
|
+
view="table"
|
|
42
|
+
items={rites}
|
|
43
|
+
getKey={rite => rite.id}
|
|
44
|
+
columns={[
|
|
45
|
+
{
|
|
46
|
+
key: "title",
|
|
47
|
+
render: rite => rite.title
|
|
48
|
+
}
|
|
49
|
+
]}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Parameters
|
|
54
|
+
|
|
55
|
+
| Property | Purpose |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `components[].actions.index` | Optional resource name with an allowed GET in metadata. Falls back to `pagination.resource`. |
|
|
58
|
+
| `components[].remove_label` | Optional field path or list of parts for the deletion question. A nested list supplies alternatives for one part in order. For example, `[memory_short_name, [title, kind]]` shows “Name · Kind” when the title is blank. Defaults to `title`, then `short_name`. With no text label the question is “Delete this record?”. |
|
|
59
|
+
| `components[].props` | Optional comma-separated string. Under a `View`, `^event_id:event` selects the route parameter `event_id` and names it `event`. `^filter` selects the URL query passed by `Index` to a configured `View`; one value is a string and repeated keys are arrays of strings. A direct `View` caller can supply its own filter map. The default selects no props. |
|
|
60
|
+
| `components[].pagination.resource` | Optional legacy resource name, used when `actions.index` is absent. |
|
|
61
|
+
| `settings.components.records.children` | Optional array of shared definitions. The first `of: loader` supplies the shared loader. The built-in default has `actions.index: "^"`. |
|
|
62
|
+
| `settings.components.records.children[].actions.index` | Optional string. `^` (default) inherits the same property from Records, `^actions.index` names it explicitly, and a resource name selects its own GET. |
|
|
63
|
+
| `components[].children[].actions.index` | Optional resource name or inheritance reference (`^` or `^actions.index`). On the local Loader it overrides the shared definition. Defaults to `^`. |
|
|
64
|
+
| `components[].children[].props` | Optional comma-separated string. For example, `^event, ^filter` passes `event` and `filter` from Records to Loader. `filter` must be a map of GET query parameters. Other selected fields fill resource path segments with matching names. The default selects no props. |
|
|
65
|
+
| `components[].loader` | Optional name of the component that presents loading, empty or error states. Records supplies its own feedback by default. |
|
|
66
|
+
| `components[].view` | Optional string. `table` lays out rows in a table, `grid` creates an even grid, `stack` stacks items in columns, `collapsible` displays expandable rows (configured default). |
|
|
67
|
+
| `components[].width` | Optional number in rem for item width in grid and stack layouts. Defaults to 10. |
|
|
68
|
+
| `components[].gap` | Optional number in rem for spacing between items. Defaults to 0.5. |
|
|
69
|
+
| `components[].children[].uid` | Optional row key binding, literal or array. Defaults to `$id`. Use an array, such as `[$id, $abbreviation]`, for a composite key. |
|
|
70
|
+
| `components[].pagination.per` | Optional positive integer for page size. Defaults to 25. |
|
|
71
|
+
| `components[].pagination.kind` | Optional string. `button` shows a load-more button for manual requests. The Loader meteor appears inside the button while it waits for the response. `hidden` loads automatically without a button or meteor (default). |
|
|
72
|
+
| `components[].pagination.autoload_upto` | Optional number of automatically loaded pages. Without a limit, the list continues loading at the boundary. |
|
|
73
|
+
| `components[].pagination.range_unit` | Optional string. `records` counts items (default), `pages` counts pages. |
|
|
74
|
+
| `components[].pagination.view_as` | Optional string. Both `text` and `circle` use the standard round button with a “Load more” tooltip. The same button appears when this field is omitted. |
|
|
75
|
+
|
|
76
|
+
The default table fits the available width and keeps every column visible. Headings and cells stay on one line. Standard text and Markdown show the first 40 characters followed by `...` when shortened. The table also clips text that exceeds the column width. Hover over or focus a clipped value to read it in full.
|
|
77
|
+
|
|
78
|
+
`Content-Range` determines the end of the list. The button disappears after the final page. Failed reads keep the existing rows available and can be retried. Images can use the record’s `width` and `height`, or bind another field explicitly.
|
|
79
|
+
|
|
80
|
+
Component names must be unique, including after PascalCase normalization. The built-in kind comes from `of`, so an image page may still have the name `image`. [Record actions](record-manager.md) · [Legacy gallery fixture](../../features/fixtures/config/schemas/dneslov_gallery.yaml)
|
|
81
|
+
|
|
82
|
+
## Event gallery
|
|
83
|
+
|
|
84
|
+
The page `/gallery/event/17?c=mine&d=ю11.11.2026` requests `/api/gallery/event/17.json?c=mine&d=ю11.11.2026`. `Index` passes the URL query to the configured `View` as `filter`. Records and its Loader forward it through `props: ^filter`, including on later pages. A direct `View` caller can provide the same filter explicitly. `Picture.by_event` selects the images for the generated `index` action.
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
components:
|
|
88
|
+
- name: event_gallery
|
|
89
|
+
of: view
|
|
90
|
+
mount_to: /gallery/event/{event_id:integer}
|
|
91
|
+
children:
|
|
92
|
+
- name: pictures
|
|
93
|
+
of: records
|
|
94
|
+
view: grid
|
|
95
|
+
actions:
|
|
96
|
+
index: event.gallery
|
|
97
|
+
props: "^event_id:event, ^filter"
|
|
98
|
+
children:
|
|
99
|
+
- name: loader
|
|
100
|
+
of: loader
|
|
101
|
+
props: "^event, ^filter"
|
|
102
|
+
- name: row
|
|
103
|
+
of: row
|
|
104
|
+
uid: $uid
|
|
105
|
+
children:
|
|
106
|
+
- name: image
|
|
107
|
+
of: image
|
|
108
|
+
url: $thumb_url
|
|
109
|
+
tooltip: $title
|
|
110
|
+
|
|
111
|
+
types:
|
|
112
|
+
- name: gallery_image
|
|
113
|
+
model: Picture
|
|
114
|
+
fields:
|
|
115
|
+
- name: uid
|
|
116
|
+
kind: string
|
|
117
|
+
- name: title
|
|
118
|
+
kind: string
|
|
119
|
+
- name: thumb_url
|
|
120
|
+
kind: string
|
|
121
|
+
|
|
122
|
+
resources:
|
|
123
|
+
- name: event.gallery
|
|
124
|
+
path: /api/gallery/event/:event.json
|
|
125
|
+
methods:
|
|
126
|
+
- name: get
|
|
127
|
+
action: index
|
|
128
|
+
kind: gallery_image
|
|
129
|
+
args:
|
|
130
|
+
- name: event
|
|
131
|
+
kind: natural
|
|
132
|
+
- name: c
|
|
133
|
+
kind: string
|
|
134
|
+
- name: d
|
|
135
|
+
kind: string
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { Index, View } from "tiun"
|
|
140
|
+
import type { RouteViewProps } from "tiun"
|
|
141
|
+
import "tiun/records.css"
|
|
142
|
+
|
|
143
|
+
function EventGallery({ schema, view, router }: RouteViewProps<unknown>) {
|
|
144
|
+
return <View
|
|
145
|
+
schema={schema}
|
|
146
|
+
view={view}
|
|
147
|
+
router={router}
|
|
148
|
+
filter={{
|
|
149
|
+
c: router.query.get("c") ?? "",
|
|
150
|
+
d: router.query.get("d") ?? ""
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const gallery = <Index components={{
|
|
156
|
+
event_gallery: EventGallery
|
|
157
|
+
}} />
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
When the route is defined in metadata, the regular `Index` needs no custom route component:
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { Index } from "tiun"
|
|
164
|
+
|
|
165
|
+
const gallery = <Index />
|
|
166
|
+
```
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Настроенные списки записей
|
|
2
|
+
|
|
3
|
+
[English](schema-records.md)
|
|
4
|
+
|
|
5
|
+
Records показывает строки, которые передаёт элемент челяди Loader. В примере общий Loader читает ресурс `rite.index`. Чтобы вывести список на странице, добавьте в челядь вида `of: rites`. В React передайте те же загруженные строки в `rites` или отрисуйте именованное определение через `Component`.
|
|
6
|
+
|
|
7
|
+
`[]` обозначает элемент массива. `$title` читает поле текущей записи. Имена YAML пишутся с подчёркиваниями, например `autoload_upto`.
|
|
8
|
+
|
|
9
|
+
Loader хранит число загруженных записей и показывает ход загрузки. Полученную порцию он передаёт в Records, где хранится массив записей.
|
|
10
|
+
|
|
11
|
+
```yaml
|
|
12
|
+
settings:
|
|
13
|
+
components:
|
|
14
|
+
records:
|
|
15
|
+
children:
|
|
16
|
+
- name: loader
|
|
17
|
+
of: loader
|
|
18
|
+
actions:
|
|
19
|
+
index: "^"
|
|
20
|
+
components:
|
|
21
|
+
- name: rites
|
|
22
|
+
of: records
|
|
23
|
+
view: table
|
|
24
|
+
actions:
|
|
25
|
+
index: rite.index
|
|
26
|
+
children:
|
|
27
|
+
- name: row
|
|
28
|
+
of: row
|
|
29
|
+
uid: $id
|
|
30
|
+
children:
|
|
31
|
+
- name: title
|
|
32
|
+
of: lorem
|
|
33
|
+
text: $title
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Records } from "tiun"
|
|
38
|
+
import "tiun/records.css"
|
|
39
|
+
|
|
40
|
+
<Records
|
|
41
|
+
view="table"
|
|
42
|
+
items={rites}
|
|
43
|
+
getKey={rite => rite.id}
|
|
44
|
+
columns={[
|
|
45
|
+
{
|
|
46
|
+
key: "title",
|
|
47
|
+
render: rite => rite.title
|
|
48
|
+
}
|
|
49
|
+
]}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Параметры
|
|
54
|
+
|
|
55
|
+
| Параметр | Назначение |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `components[].actions.index` | Необязательное имя ресурса с разрешённым GET в метаданных. Запасное значение берётся из `pagination.resource`. |
|
|
58
|
+
| `components[].remove_label` | Необязательная строка с путём к полю или массив частей подписи в вопросе об удалении. Вложенный массив задаёт поля в порядке предпочтения для одной части. Например, `[memory_short_name, [title, kind]]` даёт «Память · Вид» при пустом заголовке. Умолчание — `title`, затем `short_name`. Без текстовой подписи отображается «Удалить эту запись?». |
|
|
59
|
+
| `components[].props` | Необязательная строка с именами через запятую. Под `View` запись `^event_id:event` выбирает параметр маршрута `event_id` и передаёт его под именем `event`. `^filter` выбирает query-словарь, который `Index` передаёт настроенному `View`; одиночное значение — строка, повторяющиеся ключи — массив строк. Вызывающий `View` напрямую может передать свой словарь. По умолчанию свойства не выбраны. |
|
|
60
|
+
| `components[].pagination.resource` | Необязательное имя ресурса прежних конфигураций. Действует при отсутствии `actions.index`. |
|
|
61
|
+
| `settings.components.records.children` | Необязательный массив общих определений. Первый узел с `of: loader` выбирает общий Loader. Встроенное умолчание содержит `actions.index: "^"`. |
|
|
62
|
+
| `settings.components.records.children[].actions.index` | Необязательная строка. `^` (умолчание) наследует одноимённое свойство Records, `^actions.index` указывает его явно, имя ресурса выбирает отдельный GET. |
|
|
63
|
+
| `components[].children[].actions.index` | Необязательное имя ресурса или ссылка на родителя (`^` либо `^actions.index`). У локального Loader переопределяет общее определение. Умолчание — `^`. |
|
|
64
|
+
| `components[].children[].props` | Необязательная строка с именами через запятую. Например, `^event, ^filter` передаёт значения `event` и `filter` из `Records` в Loader. `filter` должен быть словарём параметров GET. Другие выбранные поля заполняют одноимённые сегменты пути ресурса. По умолчанию свойства не выбраны. |
|
|
65
|
+
| `components[].loader` | Необязательное имя компонента для отображения загрузки, пустого списка и ошибки. Встроенные состояния показывает Records. |
|
|
66
|
+
| `components[].view` | Необязательная строка. `table` выводит таблицу, `grid` — сетку, `stack` — укладку по столбцам, `collapsible` — раскрываемые строки (умолчание конфигурации). |
|
|
67
|
+
| `components[].width` | Необязательная ширина элемента в rem для сетки и укладки. Умолчание — 10. |
|
|
68
|
+
| `components[].gap` | Необязательный промежуток между элементами в rem. Умолчание — 0.5. |
|
|
69
|
+
| `components[].children[].uid` | Необязательный ключ строки: привязка, литерал или массив. Умолчание — `$id`. Для составного ключа используйте массив, например `[$id, $abbreviation]`. |
|
|
70
|
+
| `components[].pagination.per` | Необязательное положительное целое, размер порции. Умолчание — 25. |
|
|
71
|
+
| `components[].pagination.kind` | Необязательная строка. `button` показывает кнопку ручной догрузки. Пока идёт запрос, метеор Loader виден внутри кнопки. `hidden` догружает автоматически без кнопки и метеора (умолчание). |
|
|
72
|
+
| `components[].pagination.autoload_upto` | Необязательное число автоматически загружаемых порций. Без предела список догружает порции у границы. |
|
|
73
|
+
| `components[].pagination.range_unit` | Необязательная строка. `records` считает записи (умолчание), `pages` — страницы. |
|
|
74
|
+
| `components[].pagination.view_as` | Необязательная строка. При `text` и `circle` показывается штатный кругляш с подсказкой «Загрузить ещё». Такой же кругляш используется по умолчанию. |
|
|
75
|
+
|
|
76
|
+
По умолчанию все столбцы таблицы умещаются в доступную ширину. Заголовки и ячейки занимают одну строку. Обычный текст и Markdown длиннее 40 знаков сокращаются до первых 40 знаков с `...`. Если колонка уже текста, таблица также сокращает его по ширине. Полный текст можно прочитать при наведении или фокусе с клавиатуры.
|
|
77
|
+
|
|
78
|
+
Конец списка определяется по `Content-Range`. После последней порции кнопка исчезает. При ошибке загруженные строки остаются видны, а запрос можно повторить. Изображение может использовать поля `width` и `height` записи или явные привязки к другим полям.
|
|
79
|
+
|
|
80
|
+
Имена компонентов должны быть уникальны и после преобразования в PascalCase. Встроенный тип задаётся через `of`, поэтому вид можно назвать `image`. [Действия с записями](record-manager.ru.md) · [Старая фикстура галереи](../../features/fixtures/config/schemas/dneslov_gallery.yaml)
|
|
81
|
+
|
|
82
|
+
## Изразцы события
|
|
83
|
+
|
|
84
|
+
Вид `/gallery/event/17?c=mine&d=ю11.11.2026` запрашивает `/api/gallery/event/17.json?c=mine&d=ю11.11.2026`. `Index` передаёт query адреса настроенному `View` как `filter`. Records и его Loader передают словарь через `props: ^filter`, в том числе при догрузке следующих порций. Вызывающий `View` напрямую может передать такой же фильтр явно. `Picture.by_event` выбирает изображения события для штатного `index`.
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
components:
|
|
88
|
+
- name: event_gallery
|
|
89
|
+
of: view
|
|
90
|
+
mount_to: /gallery/event/{event_id:integer}
|
|
91
|
+
children:
|
|
92
|
+
- name: pictures
|
|
93
|
+
of: records
|
|
94
|
+
view: grid
|
|
95
|
+
actions:
|
|
96
|
+
index: event.gallery
|
|
97
|
+
props: "^event_id:event, ^filter"
|
|
98
|
+
children:
|
|
99
|
+
- name: loader
|
|
100
|
+
of: loader
|
|
101
|
+
props: "^event, ^filter"
|
|
102
|
+
- name: row
|
|
103
|
+
of: row
|
|
104
|
+
uid: $uid
|
|
105
|
+
children:
|
|
106
|
+
- name: image
|
|
107
|
+
of: image
|
|
108
|
+
url: $thumb_url
|
|
109
|
+
tooltip: $title
|
|
110
|
+
|
|
111
|
+
types:
|
|
112
|
+
- name: gallery_image
|
|
113
|
+
model: Picture
|
|
114
|
+
fields:
|
|
115
|
+
- name: uid
|
|
116
|
+
kind: string
|
|
117
|
+
- name: title
|
|
118
|
+
kind: string
|
|
119
|
+
- name: thumb_url
|
|
120
|
+
kind: string
|
|
121
|
+
|
|
122
|
+
resources:
|
|
123
|
+
- name: event.gallery
|
|
124
|
+
path: /api/gallery/event/:event.json
|
|
125
|
+
methods:
|
|
126
|
+
- name: get
|
|
127
|
+
action: index
|
|
128
|
+
kind: gallery_image
|
|
129
|
+
args:
|
|
130
|
+
- name: event
|
|
131
|
+
kind: natural
|
|
132
|
+
- name: c
|
|
133
|
+
kind: string
|
|
134
|
+
- name: d
|
|
135
|
+
kind: string
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { Index, View } from "tiun"
|
|
140
|
+
import type { RouteViewProps } from "tiun"
|
|
141
|
+
import "tiun/records.css"
|
|
142
|
+
|
|
143
|
+
function EventGallery({ schema, view, router }: RouteViewProps<unknown>) {
|
|
144
|
+
return <View
|
|
145
|
+
schema={schema}
|
|
146
|
+
view={view}
|
|
147
|
+
router={router}
|
|
148
|
+
filter={{
|
|
149
|
+
c: router.query.get("c") ?? "",
|
|
150
|
+
d: router.query.get("d") ?? ""
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const gallery = <Index components={{
|
|
156
|
+
event_gallery: EventGallery
|
|
157
|
+
}} />
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Если маршрут задан в метаданных, обычному `Index` компонент маршрута не нужен:
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { Index } from "tiun"
|
|
164
|
+
|
|
165
|
+
const gallery = <Index />
|
|
166
|
+
```
|