@akanjs/cli 0.0.142 → 0.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/cjs/index.js +2437 -3204
- package/cjs/src/guidelines/___library/sharedUiStructureDescription.en.md +786 -0
- package/cjs/src/guidelines/___library/utilUiStructureDescription.en.md +395 -0
- package/cjs/src/guidelines/___lint/lintRuleDescription.en.md +64 -0
- package/cjs/src/guidelines/___module/moduleStructureDescription.en.md +80 -0
- package/cjs/src/guidelines/componentRule/componentRule.instruction.md +732 -0
- package/cjs/src/guidelines/databaseModule/databaseModule.instruction.md +691 -0
- package/cjs/src/guidelines/enumConstant/enumConstant.instruction.md +232 -0
- package/cjs/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +611 -0
- package/cjs/src/guidelines/framework/framework.instruction.md +1112 -0
- package/cjs/src/guidelines/modelConstant/modelConstant.instruction.md +958 -0
- package/cjs/src/guidelines/modelDictionary/modelDictionary.instruction.md +583 -0
- package/cjs/src/guidelines/modelDocument/modelDocument.instruction.md +683 -0
- package/cjs/src/guidelines/modelService/modelService.instruction.md +935 -0
- package/cjs/src/guidelines/modelSignal/modelSignal.instruction.md +588 -0
- package/cjs/src/guidelines/modelStore/modelStore.instruction.md +591 -0
- package/cjs/src/guidelines/modelTemplate/modelTemplate.instruction.md +577 -0
- package/cjs/src/guidelines/modelUnit/modelUnit.instruction.md +833 -0
- package/cjs/src/guidelines/modelUtil/modelUtil.instruction.md +752 -0
- package/cjs/src/guidelines/modelView/modelView.instruction.md +1005 -0
- package/cjs/src/guidelines/modelZone/modelZone.instruction.md +528 -0
- package/cjs/src/guidelines/scalarConstant/scalarConstant.instruction.md +489 -0
- package/cjs/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +347 -0
- package/cjs/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +318 -0
- package/cjs/src/guidelines/utilUiUsage/utilUiUsage.instruction.md +339 -0
- package/cjs/src/templates/module/__model__.dictionary.js +4 -5
- package/esm/index.js +2524 -3286
- package/esm/src/guidelines/___library/sharedUiStructureDescription.en.md +786 -0
- package/esm/src/guidelines/___library/utilUiStructureDescription.en.md +395 -0
- package/esm/src/guidelines/___lint/lintRuleDescription.en.md +64 -0
- package/esm/src/guidelines/___module/moduleStructureDescription.en.md +80 -0
- package/esm/src/guidelines/componentRule/componentRule.instruction.md +732 -0
- package/esm/src/guidelines/databaseModule/databaseModule.instruction.md +691 -0
- package/esm/src/guidelines/enumConstant/enumConstant.instruction.md +232 -0
- package/esm/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +611 -0
- package/esm/src/guidelines/framework/framework.instruction.md +1112 -0
- package/esm/src/guidelines/modelConstant/modelConstant.instruction.md +958 -0
- package/esm/src/guidelines/modelDictionary/modelDictionary.instruction.md +583 -0
- package/esm/src/guidelines/modelDocument/modelDocument.instruction.md +683 -0
- package/esm/src/guidelines/modelService/modelService.instruction.md +935 -0
- package/esm/src/guidelines/modelSignal/modelSignal.instruction.md +588 -0
- package/esm/src/guidelines/modelStore/modelStore.instruction.md +591 -0
- package/esm/src/guidelines/modelTemplate/modelTemplate.instruction.md +577 -0
- package/esm/src/guidelines/modelUnit/modelUnit.instruction.md +833 -0
- package/esm/src/guidelines/modelUtil/modelUtil.instruction.md +752 -0
- package/esm/src/guidelines/modelView/modelView.instruction.md +1005 -0
- package/esm/src/guidelines/modelZone/modelZone.instruction.md +528 -0
- package/esm/src/guidelines/scalarConstant/scalarConstant.instruction.md +489 -0
- package/esm/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +347 -0
- package/esm/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +318 -0
- package/esm/src/guidelines/utilUiUsage/utilUiUsage.instruction.md +339 -0
- package/esm/src/templates/module/__model__.dictionary.js +4 -5
- package/package.json +3 -1
- package/src/guideline/guideline.command.d.ts +7 -0
- package/src/guideline/guideline.prompt.d.ts +15 -0
- package/src/guideline/guideline.runner.d.ts +5 -0
- package/src/guideline/guideline.script.d.ts +6 -0
- package/src/guidelines/___library/sharedUiStructureDescription.en.md +786 -0
- package/src/guidelines/___library/utilUiStructureDescription.en.md +395 -0
- package/src/guidelines/___lint/lintRuleDescription.en.md +64 -0
- package/src/guidelines/___module/moduleStructureDescription.en.md +80 -0
- package/src/guidelines/componentRule/componentRule.instruction.md +732 -0
- package/src/guidelines/databaseModule/databaseModule.instruction.md +691 -0
- package/src/guidelines/enumConstant/enumConstant.instruction.md +232 -0
- package/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +611 -0
- package/src/guidelines/framework/framework.instruction.md +1112 -0
- package/src/guidelines/modelConstant/modelConstant.instruction.md +958 -0
- package/src/guidelines/modelDictionary/modelDictionary.instruction.md +583 -0
- package/src/guidelines/modelDocument/modelDocument.instruction.md +683 -0
- package/src/guidelines/modelService/modelService.instruction.md +935 -0
- package/src/guidelines/modelSignal/modelSignal.instruction.md +588 -0
- package/src/guidelines/modelStore/modelStore.instruction.md +591 -0
- package/src/guidelines/modelTemplate/modelTemplate.instruction.md +577 -0
- package/src/guidelines/modelUnit/modelUnit.instruction.md +833 -0
- package/src/guidelines/modelUtil/modelUtil.instruction.md +752 -0
- package/src/guidelines/modelView/modelView.instruction.md +1005 -0
- package/src/guidelines/modelZone/modelZone.instruction.md +528 -0
- package/src/guidelines/scalarConstant/scalarConstant.instruction.md +489 -0
- package/src/guidelines/scalarDictionary/scalarDictionary.instruction.md +347 -0
- package/src/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +318 -0
- package/src/guidelines/utilUiUsage/utilUiUsage.instruction.md +339 -0
- package/src/module/module.command.d.ts +6 -8
- package/src/module/module.prompt.d.ts +2 -15
- package/src/module/module.request.d.ts +22 -18
- package/src/module/module.runner.d.ts +4 -20
- package/src/module/module.script.d.ts +6 -7
- package/src/scalar/scalar.command.d.ts +7 -0
- package/src/scalar/scalar.prompt.d.ts +23 -0
- package/src/scalar/scalar.runner.d.ts +13 -0
- package/src/scalar/scalar.script.d.ts +6 -0
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/forgotpassword/page.js +0 -47
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/page.js +0 -128
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/privacy/page.js +0 -42
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/signin/page.js +0 -50
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/termsofservice/page.js +0 -41
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(public)/unknown/page.js +0 -51
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(user)/layout.js +0 -43
- package/cjs/src/templates/app/app/[lang]/(__appName__)/(user)/self/page.js +0 -60
- package/cjs/src/templates/app/app/[lang]/(__appName__)/layout.js +0 -54
- package/cjs/src/templates/app/app/[lang]/(__appName__)/styles.css.template +0 -19
- package/cjs/src/templates/app/app/[lang]/admin/layout.js +0 -54
- package/cjs/src/templates/app/app/[lang]/admin/page.js +0 -63
- package/cjs/src/templates/app/app/csr.js +0 -34
- package/cjs/src/templates/app/app/index.html.template +0 -13
- package/cjs/src/templates/app/app/layout.js +0 -38
- package/cjs/src/templates/app/capacitor.config.ts.template +0 -8
- package/cjs/src/templates/app/env/env.client.debug.ts.template +0 -7
- package/cjs/src/templates/app/env/env.client.develop.ts.template +0 -7
- package/cjs/src/templates/app/env/env.client.local.ts.template +0 -7
- package/cjs/src/templates/app/env/env.client.main.ts.template +0 -7
- package/cjs/src/templates/app/env/env.client.testing.ts.template +0 -7
- package/cjs/src/templates/app/env/env.server.debug.ts.template +0 -15
- package/cjs/src/templates/app/env/env.server.develop.ts.template +0 -15
- package/cjs/src/templates/app/env/env.server.local.ts.template +0 -15
- package/cjs/src/templates/app/env/env.server.main.ts.template +0 -15
- package/cjs/src/templates/app/env/env.server.testing.ts.template +0 -7
- package/cjs/src/templates/app/lib/setting/Setting.Template.js +0 -57
- package/cjs/src/templates/app/lib/setting/Setting.Unit.js +0 -38
- package/cjs/src/templates/app/lib/setting/Setting.Util.js +0 -34
- package/cjs/src/templates/app/lib/setting/Setting.View.js +0 -51
- package/cjs/src/templates/app/lib/setting/Setting.Zone.js +0 -80
- package/cjs/src/templates/app/lib/setting/index.js +0 -61
- package/cjs/src/templates/app/lib/summary/Summary.Template.js +0 -43
- package/cjs/src/templates/app/lib/summary/Summary.Unit.js +0 -38
- package/cjs/src/templates/app/lib/summary/Summary.Util.js +0 -33
- package/cjs/src/templates/app/lib/summary/Summary.View.js +0 -51
- package/cjs/src/templates/app/lib/summary/Summary.Zone.js +0 -62
- package/cjs/src/templates/app/lib/summary/index.js +0 -67
- package/cjs/src/templates/app/lib/user/User.Template.js +0 -65
- package/cjs/src/templates/app/lib/user/User.Unit.js +0 -38
- package/cjs/src/templates/app/lib/user/User.Util.js +0 -94
- package/cjs/src/templates/app/lib/user/User.View.js +0 -66
- package/cjs/src/templates/app/lib/user/User.Zone.js +0 -74
- package/cjs/src/templates/app/lib/user/index.js +0 -61
- package/cjs/src/templates/app/page.test.ts.template +0 -10
- package/cjs/src/templates/app/playwright.config.ts.template +0 -6
- package/cjs/src/templates/app/postcss.config.js.template +0 -10
- package/cjs/src/templates/app/public/manifest.json.template +0 -67
- package/cjs/src/templates/app/tsconfig.json.template +0 -22
- package/cjs/src/templates/app/tsconfig.spec.json.template +0 -7
- package/cjs/src/templates/app/ui/Footer.js +0 -67
- package/cjs/src/templates/app/ui/MainHeader.js +0 -131
- package/cjs/src/templates/crudPages/[__model__Id]/edit/page.js +0 -73
- package/cjs/src/templates/crudPages/[__model__Id]/page.js +0 -83
- package/cjs/src/templates/crudPages/new/page.js +0 -70
- package/cjs/src/templates/crudPages/page.js +0 -71
- package/cjs/src/templates/libRoot/.gitignore.template +0 -15
- package/cjs/src/templates/libRoot/env/env.server.example.ts.template +0 -7
- package/cjs/src/templates/libRoot/env/env.server.testing.ts.template +0 -7
- package/cjs/src/templates/libRoot/lib/setting/Setting.Template.js +0 -57
- package/cjs/src/templates/libRoot/lib/setting/Setting.Unit.js +0 -38
- package/cjs/src/templates/libRoot/lib/setting/Setting.Util.js +0 -34
- package/cjs/src/templates/libRoot/lib/setting/Setting.View.js +0 -51
- package/cjs/src/templates/libRoot/lib/setting/Setting.Zone.js +0 -80
- package/cjs/src/templates/libRoot/lib/setting/index.js +0 -61
- package/cjs/src/templates/libRoot/lib/summary/Summary.Template.js +0 -43
- package/cjs/src/templates/libRoot/lib/summary/Summary.Unit.js +0 -38
- package/cjs/src/templates/libRoot/lib/summary/Summary.Util.js +0 -33
- package/cjs/src/templates/libRoot/lib/summary/Summary.View.js +0 -51
- package/cjs/src/templates/libRoot/lib/summary/Summary.Zone.js +0 -62
- package/cjs/src/templates/libRoot/lib/summary/index.js +0 -67
- package/cjs/src/templates/libRoot/lib/user/User.Template.js +0 -65
- package/cjs/src/templates/libRoot/lib/user/User.Unit.js +0 -38
- package/cjs/src/templates/libRoot/lib/user/User.Util.js +0 -94
- package/cjs/src/templates/libRoot/lib/user/User.View.js +0 -66
- package/cjs/src/templates/libRoot/lib/user/User.Zone.js +0 -74
- package/cjs/src/templates/libRoot/lib/user/index.js +0 -61
- package/cjs/src/templates/libRoot/package.json.template +0 -4
- package/cjs/src/templates/libRoot/tsconfig.json.template +0 -13
- package/cjs/src/templates/libRoot/tsconfig.spec.json.template +0 -7
- package/cjs/src/templates/localDev/docker-compose.yaml.template +0 -36
- package/cjs/src/templates/module/__Model__.Template.js +0 -54
- package/cjs/src/templates/module/__Model__.Unit.js +0 -42
- package/cjs/src/templates/module/__Model__.Util.js +0 -70
- package/cjs/src/templates/module/__Model__.View.js +0 -48
- package/cjs/src/templates/module/__Model__.Zone.js +0 -83
- package/cjs/src/templates/module/index.js +0 -61
- package/cjs/src/templates/pkgRoot/tsconfig.json.template +0 -15
- package/cjs/src/templates/workspaceRoot/.env.template +0 -20
- package/cjs/src/templates/workspaceRoot/.gitignore.template +0 -118
- package/cjs/src/templates/workspaceRoot/.prettierignore.template +0 -10
- package/cjs/src/templates/workspaceRoot/.prettierrc.json.template +0 -6
- package/cjs/src/templates/workspaceRoot/.swcrc.template +0 -9
- package/cjs/src/templates/workspaceRoot/.vscode/settings.json.template +0 -13
- package/cjs/src/templates/workspaceRoot/README.md.template +0 -37
- package/cjs/src/templates/workspaceRoot/eslint.config.ts.template +0 -3
- package/cjs/src/templates/workspaceRoot/package.json.template +0 -43
- package/cjs/src/templates/workspaceRoot/tsconfig.json.template +0 -29
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/forgotpassword/page.js +0 -27
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/page.js +0 -108
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/privacy/page.js +0 -22
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/signin/page.js +0 -30
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/termsofservice/page.js +0 -21
- package/esm/src/templates/app/app/[lang]/(__appName__)/(public)/unknown/page.js +0 -31
- package/esm/src/templates/app/app/[lang]/(__appName__)/(user)/layout.js +0 -23
- package/esm/src/templates/app/app/[lang]/(__appName__)/(user)/self/page.js +0 -40
- package/esm/src/templates/app/app/[lang]/(__appName__)/layout.js +0 -34
- package/esm/src/templates/app/app/[lang]/(__appName__)/styles.css.template +0 -19
- package/esm/src/templates/app/app/[lang]/admin/layout.js +0 -34
- package/esm/src/templates/app/app/[lang]/admin/page.js +0 -43
- package/esm/src/templates/app/app/csr.js +0 -14
- package/esm/src/templates/app/app/index.html.template +0 -13
- package/esm/src/templates/app/app/layout.js +0 -18
- package/esm/src/templates/app/capacitor.config.ts.template +0 -8
- package/esm/src/templates/app/env/env.client.debug.ts.template +0 -7
- package/esm/src/templates/app/env/env.client.develop.ts.template +0 -7
- package/esm/src/templates/app/env/env.client.local.ts.template +0 -7
- package/esm/src/templates/app/env/env.client.main.ts.template +0 -7
- package/esm/src/templates/app/env/env.client.testing.ts.template +0 -7
- package/esm/src/templates/app/env/env.server.debug.ts.template +0 -15
- package/esm/src/templates/app/env/env.server.develop.ts.template +0 -15
- package/esm/src/templates/app/env/env.server.local.ts.template +0 -15
- package/esm/src/templates/app/env/env.server.main.ts.template +0 -15
- package/esm/src/templates/app/env/env.server.testing.ts.template +0 -7
- package/esm/src/templates/app/lib/setting/Setting.Template.js +0 -37
- package/esm/src/templates/app/lib/setting/Setting.Unit.js +0 -18
- package/esm/src/templates/app/lib/setting/Setting.Util.js +0 -14
- package/esm/src/templates/app/lib/setting/Setting.View.js +0 -31
- package/esm/src/templates/app/lib/setting/Setting.Zone.js +0 -60
- package/esm/src/templates/app/lib/setting/index.js +0 -41
- package/esm/src/templates/app/lib/summary/Summary.Template.js +0 -23
- package/esm/src/templates/app/lib/summary/Summary.Unit.js +0 -18
- package/esm/src/templates/app/lib/summary/Summary.Util.js +0 -13
- package/esm/src/templates/app/lib/summary/Summary.View.js +0 -31
- package/esm/src/templates/app/lib/summary/Summary.Zone.js +0 -42
- package/esm/src/templates/app/lib/summary/index.js +0 -47
- package/esm/src/templates/app/lib/user/User.Template.js +0 -45
- package/esm/src/templates/app/lib/user/User.Unit.js +0 -18
- package/esm/src/templates/app/lib/user/User.Util.js +0 -74
- package/esm/src/templates/app/lib/user/User.View.js +0 -46
- package/esm/src/templates/app/lib/user/User.Zone.js +0 -54
- package/esm/src/templates/app/lib/user/index.js +0 -41
- package/esm/src/templates/app/page.test.ts.template +0 -10
- package/esm/src/templates/app/playwright.config.ts.template +0 -6
- package/esm/src/templates/app/postcss.config.js.template +0 -10
- package/esm/src/templates/app/public/manifest.json.template +0 -67
- package/esm/src/templates/app/tsconfig.json.template +0 -22
- package/esm/src/templates/app/tsconfig.spec.json.template +0 -7
- package/esm/src/templates/app/ui/Footer.js +0 -47
- package/esm/src/templates/app/ui/MainHeader.js +0 -111
- package/esm/src/templates/crudPages/[__model__Id]/edit/page.js +0 -53
- package/esm/src/templates/crudPages/[__model__Id]/page.js +0 -63
- package/esm/src/templates/crudPages/new/page.js +0 -50
- package/esm/src/templates/crudPages/page.js +0 -51
- package/esm/src/templates/libRoot/.gitignore.template +0 -15
- package/esm/src/templates/libRoot/env/env.server.example.ts.template +0 -7
- package/esm/src/templates/libRoot/env/env.server.testing.ts.template +0 -7
- package/esm/src/templates/libRoot/lib/setting/Setting.Template.js +0 -37
- package/esm/src/templates/libRoot/lib/setting/Setting.Unit.js +0 -18
- package/esm/src/templates/libRoot/lib/setting/Setting.Util.js +0 -14
- package/esm/src/templates/libRoot/lib/setting/Setting.View.js +0 -31
- package/esm/src/templates/libRoot/lib/setting/Setting.Zone.js +0 -60
- package/esm/src/templates/libRoot/lib/setting/index.js +0 -41
- package/esm/src/templates/libRoot/lib/summary/Summary.Template.js +0 -23
- package/esm/src/templates/libRoot/lib/summary/Summary.Unit.js +0 -18
- package/esm/src/templates/libRoot/lib/summary/Summary.Util.js +0 -13
- package/esm/src/templates/libRoot/lib/summary/Summary.View.js +0 -31
- package/esm/src/templates/libRoot/lib/summary/Summary.Zone.js +0 -42
- package/esm/src/templates/libRoot/lib/summary/index.js +0 -47
- package/esm/src/templates/libRoot/lib/user/User.Template.js +0 -45
- package/esm/src/templates/libRoot/lib/user/User.Unit.js +0 -18
- package/esm/src/templates/libRoot/lib/user/User.Util.js +0 -74
- package/esm/src/templates/libRoot/lib/user/User.View.js +0 -46
- package/esm/src/templates/libRoot/lib/user/User.Zone.js +0 -54
- package/esm/src/templates/libRoot/lib/user/index.js +0 -41
- package/esm/src/templates/libRoot/package.json.template +0 -4
- package/esm/src/templates/libRoot/tsconfig.json.template +0 -13
- package/esm/src/templates/libRoot/tsconfig.spec.json.template +0 -7
- package/esm/src/templates/localDev/docker-compose.yaml.template +0 -36
- package/esm/src/templates/module/__Model__.Template.js +0 -34
- package/esm/src/templates/module/__Model__.Unit.js +0 -22
- package/esm/src/templates/module/__Model__.Util.js +0 -50
- package/esm/src/templates/module/__Model__.View.js +0 -28
- package/esm/src/templates/module/__Model__.Zone.js +0 -63
- package/esm/src/templates/module/index.js +0 -41
- package/esm/src/templates/pkgRoot/tsconfig.json.template +0 -15
- package/esm/src/templates/workspaceRoot/.env.template +0 -20
- package/esm/src/templates/workspaceRoot/.gitignore.template +0 -118
- package/esm/src/templates/workspaceRoot/.prettierignore.template +0 -10
- package/esm/src/templates/workspaceRoot/.prettierrc.json.template +0 -6
- package/esm/src/templates/workspaceRoot/.swcrc.template +0 -9
- package/esm/src/templates/workspaceRoot/.vscode/settings.json.template +0 -13
- package/esm/src/templates/workspaceRoot/README.md.template +0 -37
- package/esm/src/templates/workspaceRoot/eslint.config.ts.template +0 -3
- package/esm/src/templates/workspaceRoot/package.json.template +0 -43
- package/esm/src/templates/workspaceRoot/tsconfig.json.template +0 -29
- package/src/application/application.prompt.d.ts +0 -2
- package/src/templates/app/app/[lang]/(__appName__)/(public)/forgotpassword/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(public)/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(public)/privacy/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(public)/signin/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(public)/termsofservice/page.d.ts +0 -10
- package/src/templates/app/app/[lang]/(__appName__)/(public)/unknown/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(user)/layout.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/(user)/self/page.d.ts +0 -9
- package/src/templates/app/app/[lang]/(__appName__)/layout.d.ts +0 -9
- package/src/templates/app/app/[lang]/admin/layout.d.ts +0 -9
- package/src/templates/app/app/[lang]/admin/page.d.ts +0 -9
- package/src/templates/app/app/csr.d.ts +0 -9
- package/src/templates/app/app/layout.d.ts +0 -9
- package/src/templates/app/lib/setting/Setting.Template.d.ts +0 -9
- package/src/templates/app/lib/setting/Setting.Unit.d.ts +0 -9
- package/src/templates/app/lib/setting/Setting.Util.d.ts +0 -9
- package/src/templates/app/lib/setting/Setting.View.d.ts +0 -9
- package/src/templates/app/lib/setting/Setting.Zone.d.ts +0 -9
- package/src/templates/app/lib/setting/index.d.ts +0 -9
- package/src/templates/app/lib/summary/Summary.Template.d.ts +0 -9
- package/src/templates/app/lib/summary/Summary.Unit.d.ts +0 -9
- package/src/templates/app/lib/summary/Summary.Util.d.ts +0 -9
- package/src/templates/app/lib/summary/Summary.View.d.ts +0 -9
- package/src/templates/app/lib/summary/Summary.Zone.d.ts +0 -9
- package/src/templates/app/lib/summary/index.d.ts +0 -9
- package/src/templates/app/lib/user/User.Template.d.ts +0 -9
- package/src/templates/app/lib/user/User.Unit.d.ts +0 -9
- package/src/templates/app/lib/user/User.Util.d.ts +0 -9
- package/src/templates/app/lib/user/User.View.d.ts +0 -9
- package/src/templates/app/lib/user/User.Zone.d.ts +0 -9
- package/src/templates/app/lib/user/index.d.ts +0 -9
- package/src/templates/app/ui/Footer.d.ts +0 -9
- package/src/templates/app/ui/MainHeader.d.ts +0 -10
- package/src/templates/crudPages/[__model__Id]/edit/page.d.ts +0 -11
- package/src/templates/crudPages/[__model__Id]/page.d.ts +0 -11
- package/src/templates/crudPages/new/page.d.ts +0 -11
- package/src/templates/crudPages/page.d.ts +0 -11
- package/src/templates/libRoot/lib/setting/Setting.Template.d.ts +0 -9
- package/src/templates/libRoot/lib/setting/Setting.Unit.d.ts +0 -9
- package/src/templates/libRoot/lib/setting/Setting.Util.d.ts +0 -9
- package/src/templates/libRoot/lib/setting/Setting.View.d.ts +0 -9
- package/src/templates/libRoot/lib/setting/Setting.Zone.d.ts +0 -9
- package/src/templates/libRoot/lib/setting/index.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/Summary.Template.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/Summary.Unit.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/Summary.Util.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/Summary.View.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/Summary.Zone.d.ts +0 -9
- package/src/templates/libRoot/lib/summary/index.d.ts +0 -9
- package/src/templates/libRoot/lib/user/User.Template.d.ts +0 -9
- package/src/templates/libRoot/lib/user/User.Unit.d.ts +0 -9
- package/src/templates/libRoot/lib/user/User.Util.d.ts +0 -9
- package/src/templates/libRoot/lib/user/User.View.d.ts +0 -9
- package/src/templates/libRoot/lib/user/User.Zone.d.ts +0 -9
- package/src/templates/libRoot/lib/user/index.d.ts +0 -9
- package/src/templates/module/__Model__.Template.d.ts +0 -11
- package/src/templates/module/__Model__.Unit.d.ts +0 -11
- package/src/templates/module/__Model__.Util.d.ts +0 -11
- package/src/templates/module/__Model__.View.d.ts +0 -11
- package/src/templates/module/__Model__.Zone.d.ts +0 -11
- package/src/templates/module/index.d.ts +0 -11
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# Scalar Dictionary Implementation Guide for Akan.js
|
|
2
|
+
|
|
3
|
+
## Purpose of Scalar Dictionary Files
|
|
4
|
+
|
|
5
|
+
Scalar dictionary files in Akan.js provide internationalization (i18n) support by:
|
|
6
|
+
|
|
7
|
+
- Defining translations for model names, fields, and enum values
|
|
8
|
+
- Supporting multiple languages (primarily English and Korean)
|
|
9
|
+
- Enabling consistent terminology across the application
|
|
10
|
+
- Providing field descriptions for documentation and tooltips
|
|
11
|
+
- Maintaining type safety with the constant model definition
|
|
12
|
+
- Creating a centralized translation source for UI components
|
|
13
|
+
|
|
14
|
+
## File Structure and Location
|
|
15
|
+
|
|
16
|
+
### Location Convention
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
{app,lib}/
|
|
20
|
+
└── */lib/__scalar/
|
|
21
|
+
└── <scalarName>/ // camelCase directory
|
|
22
|
+
├── <scalarName>.constant.ts // model definition
|
|
23
|
+
└── <scalarName>.dictionary.ts // translations
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Basic Structure
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { ModelDictionary } from "@akanjs/dictionary";
|
|
30
|
+
import type { YourModel } from "./your-model.constant";
|
|
31
|
+
|
|
32
|
+
const modelDictionary = {
|
|
33
|
+
// Required model metadata
|
|
34
|
+
modelName: ["Model Name", "모델 이름"],
|
|
35
|
+
modelDesc: ["Model description", "모델 설명"],
|
|
36
|
+
|
|
37
|
+
// Field translations with descriptions
|
|
38
|
+
fieldName: ["Field Label", "필드 라벨"],
|
|
39
|
+
"desc-fieldName": ["Field description", "필드 설명"],
|
|
40
|
+
|
|
41
|
+
// Enum translations with descriptions
|
|
42
|
+
"enum-status-active": ["Active", "활성"],
|
|
43
|
+
"enumdesc-status-active": ["Active status", "활성 상태"],
|
|
44
|
+
} satisfies ModelDictionary<YourModel>;
|
|
45
|
+
|
|
46
|
+
export const yourModelDictionary = modelDictionary;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Required Imports
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { ModelDictionary } from "@akanjs/dictionary";
|
|
53
|
+
import type { YourModel } from "./your-model.constant";
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Translation Patterns
|
|
57
|
+
|
|
58
|
+
### 1. Model Metadata (Required)
|
|
59
|
+
|
|
60
|
+
Every scalar dictionary must include these two translations at the beginning:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
modelName: ["User", "사용자"], // Short display name
|
|
64
|
+
modelDesc: ["User account", "사용자 계정"], // Longer description
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Field Translations
|
|
68
|
+
|
|
69
|
+
Each field from the constant file must have both a label and description:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Field label
|
|
73
|
+
username: ["Username", "사용자명"],
|
|
74
|
+
|
|
75
|
+
// Field description (must follow immediately after the field)
|
|
76
|
+
"desc-username": ["User's login name", "로그인에 사용하는 이름"],
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. Enum Value Translations
|
|
80
|
+
|
|
81
|
+
Each enum value must have both a label and description:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Enum value label
|
|
85
|
+
"enum-status-active": ["Active", "활성"],
|
|
86
|
+
|
|
87
|
+
// Enum value description (must follow immediately)
|
|
88
|
+
"enumdesc-status-active": ["Account is active", "계정이 활성화됨"],
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 4. Custom Translations (Optional)
|
|
92
|
+
|
|
93
|
+
Additional translations specific to this model but not tied to fields:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
userProfileTitle: ["User Profile", "사용자 프로필"],
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Section Organization
|
|
100
|
+
|
|
101
|
+
Use comment separators to organize your translations:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// * ==================== Model ==================== * //
|
|
105
|
+
username: ["Username", "사용자명"],
|
|
106
|
+
"desc-username": ["User's login name", "로그인에 사용하는 이름"],
|
|
107
|
+
// * ==================== Model ==================== * //
|
|
108
|
+
|
|
109
|
+
// * ==================== Enums ==================== * //
|
|
110
|
+
"enum-status-active": ["Active", "활성"],
|
|
111
|
+
"enumdesc-status-active": ["Account is active", "계정이 활성화됨"],
|
|
112
|
+
// * ==================== Enums ==================== * //
|
|
113
|
+
|
|
114
|
+
// * ==================== Custom ==================== * //
|
|
115
|
+
userProfileTitle: ["User Profile", "사용자 프로필"],
|
|
116
|
+
// * ==================== Custom ==================== * //
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Type Safety
|
|
120
|
+
|
|
121
|
+
Always use the `satisfies` operator with `ModelDictionary<YourModel>` to ensure:
|
|
122
|
+
|
|
123
|
+
1. All required fields from the model are translated
|
|
124
|
+
2. Field names match exactly
|
|
125
|
+
3. Typescript will catch typos and missing fields
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
} satisfies ModelDictionary<YourModel>; // Type safety check
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Validation Rules and Checklist
|
|
132
|
+
|
|
133
|
+
### Required Elements
|
|
134
|
+
|
|
135
|
+
- [ ] Import `ModelDictionary` from `@akanjs/dictionary`
|
|
136
|
+
- [ ] Import the model type from the constant file
|
|
137
|
+
- [ ] Include `modelName` and `modelDesc` translations
|
|
138
|
+
- [ ] Translate all fields from the model
|
|
139
|
+
- [ ] Add descriptions for all fields with `desc-` prefix
|
|
140
|
+
- [ ] Translate all enum values with `enum-field-value` pattern
|
|
141
|
+
- [ ] Add descriptions for all enum values with `enumdesc-` prefix
|
|
142
|
+
- [ ] Use `satisfies ModelDictionary<YourModel>` for type checking
|
|
143
|
+
- [ ] Export with the correct naming convention
|
|
144
|
+
|
|
145
|
+
### Translation Arrays
|
|
146
|
+
|
|
147
|
+
- [ ] Each translation is a tuple with exactly two elements
|
|
148
|
+
- [ ] First element is English translation
|
|
149
|
+
- [ ] Second element is Korean translation
|
|
150
|
+
- [ ] No trailing punctuation in translations
|
|
151
|
+
- [ ] First letter capitalized in English
|
|
152
|
+
|
|
153
|
+
### Organization
|
|
154
|
+
|
|
155
|
+
- [ ] Group fields with their descriptions
|
|
156
|
+
- [ ] Group enum values with their descriptions
|
|
157
|
+
- [ ] Use standard comment separators
|
|
158
|
+
- [ ] Place model metadata first, then fields, then enums
|
|
159
|
+
|
|
160
|
+
## Common Mistakes and Fixes
|
|
161
|
+
|
|
162
|
+
### 1. Missing Field Description
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// ❌ Wrong (missing description)
|
|
166
|
+
username: ["Username", "사용자명"],
|
|
167
|
+
|
|
168
|
+
// ✅ Correct
|
|
169
|
+
username: ["Username", "사용자명"],
|
|
170
|
+
"desc-username": ["User's login name", "로그인에 사용하는 이름"],
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 2. Incorrect Enum Naming Pattern
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
// ❌ Wrong (incorrect format)
|
|
177
|
+
"enum_status_active": ["Active", "활성"],
|
|
178
|
+
// or
|
|
179
|
+
"enumStatus-active": ["Active", "활성"],
|
|
180
|
+
|
|
181
|
+
// ✅ Correct
|
|
182
|
+
"enum-status-active": ["Active", "활성"],
|
|
183
|
+
"enumdesc-status-active": ["Account is active", "계정이 활성화됨"],
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 3. Missing Model Metadata
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// ❌ Wrong (missing required metadata)
|
|
190
|
+
const modelDictionary = {
|
|
191
|
+
username: ["Username", "사용자명"],
|
|
192
|
+
// ...
|
|
193
|
+
|
|
194
|
+
// ✅ Correct
|
|
195
|
+
const modelDictionary = {
|
|
196
|
+
modelName: ["User", "사용자"],
|
|
197
|
+
modelDesc: ["User account", "사용자 계정"],
|
|
198
|
+
username: ["Username", "사용자명"],
|
|
199
|
+
// ...
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 4. Incorrect Translation Array Format
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// ❌ Wrong (single string, not a tuple)
|
|
206
|
+
username: "Username",
|
|
207
|
+
// or
|
|
208
|
+
username: ["Username"],
|
|
209
|
+
|
|
210
|
+
// ✅ Correct
|
|
211
|
+
username: ["Username", "사용자명"],
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 5. Missing Type Safety
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// ❌ Wrong (no type checking)
|
|
218
|
+
export const userDictionary = modelDictionary;
|
|
219
|
+
|
|
220
|
+
// ✅ Correct
|
|
221
|
+
const modelDictionary = {
|
|
222
|
+
// ...
|
|
223
|
+
} satisfies ModelDictionary<User>;
|
|
224
|
+
|
|
225
|
+
export const userDictionary = modelDictionary;
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Best Practices
|
|
229
|
+
|
|
230
|
+
### 1. Order Translations Logically
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
// First: model metadata
|
|
234
|
+
modelName: ["User", "사용자"],
|
|
235
|
+
modelDesc: ["User account", "사용자 계정"],
|
|
236
|
+
|
|
237
|
+
// Second: fields with descriptions
|
|
238
|
+
username: ["Username", "사용자명"],
|
|
239
|
+
"desc-username": ["User's login name", "로그인에 사용하는 이름"],
|
|
240
|
+
|
|
241
|
+
// Third: enum values with descriptions
|
|
242
|
+
"enum-status-active": ["Active", "활성"],
|
|
243
|
+
"enumdesc-status-active": ["Account is active", "계정이 활성화됨"],
|
|
244
|
+
|
|
245
|
+
// Last: custom translations
|
|
246
|
+
profileHeading: ["Profile Details", "프로필 상세정보"],
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 2. Use Clear Comment Separators
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
// * ==================== Model ==================== * //
|
|
253
|
+
// Fields go here
|
|
254
|
+
// * ==================== Model ==================== * //
|
|
255
|
+
|
|
256
|
+
// * ==================== Enums ==================== * //
|
|
257
|
+
// Enum translations go here
|
|
258
|
+
// * ==================== Enums ==================== * //
|
|
259
|
+
|
|
260
|
+
// * ==================== Custom ==================== * //
|
|
261
|
+
// Custom translations go here
|
|
262
|
+
// * ==================== Custom ==================== * //
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 3. Match Constant File Structure
|
|
266
|
+
|
|
267
|
+
Follow the same field order as in the constant file for easier maintenance.
|
|
268
|
+
|
|
269
|
+
### 4. Naming Conventions
|
|
270
|
+
|
|
271
|
+
- Export name should match model name: `userDictionary` for `User` model
|
|
272
|
+
- Field names must exactly match the constant file
|
|
273
|
+
- Use kebab-case for prefix separators: `desc-`, `enum-`, `enumdesc-`
|
|
274
|
+
|
|
275
|
+
### 5. Consistent Translation Style
|
|
276
|
+
|
|
277
|
+
- First letter capitalized for English
|
|
278
|
+
- No trailing punctuation
|
|
279
|
+
- Keep translations concise but clear
|
|
280
|
+
- Be consistent in terminology
|
|
281
|
+
|
|
282
|
+
## Full Example
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
// File: apps/example/lib/__scalar/user/user.dictionary.ts
|
|
286
|
+
import { ModelDictionary } from "@akanjs/dictionary";
|
|
287
|
+
import type { User } from "./user.constant";
|
|
288
|
+
|
|
289
|
+
const modelDictionary = {
|
|
290
|
+
modelName: ["User", "사용자"],
|
|
291
|
+
modelDesc: ["System user account", "시스템 사용자 계정"],
|
|
292
|
+
|
|
293
|
+
// * ==================== Model ==================== * //
|
|
294
|
+
username: ["Username", "사용자명"],
|
|
295
|
+
"desc-username": ["Unique login identifier", "고유 로그인 식별자"],
|
|
296
|
+
|
|
297
|
+
email: ["Email", "이메일"],
|
|
298
|
+
"desc-email": ["Contact email address", "연락용 이메일 주소"],
|
|
299
|
+
|
|
300
|
+
displayName: ["Display Name", "표시 이름"],
|
|
301
|
+
"desc-displayName": ["Public name shown to others", "다른 사용자에게 표시되는 이름"],
|
|
302
|
+
|
|
303
|
+
status: ["Status", "상태"],
|
|
304
|
+
"desc-status": ["Account status", "계정 상태"],
|
|
305
|
+
|
|
306
|
+
lastLoginAt: ["Last Login", "마지막 로그인"],
|
|
307
|
+
"desc-lastLoginAt": ["Most recent login time", "가장 최근 로그인 시간"],
|
|
308
|
+
// * ==================== Model ==================== * //
|
|
309
|
+
|
|
310
|
+
// * ==================== Enums ==================== * //
|
|
311
|
+
"enum-status-active": ["Active", "활성"],
|
|
312
|
+
"enumdesc-status-active": ["Account is enabled and usable", "계정이 활성화되어 사용 가능함"],
|
|
313
|
+
|
|
314
|
+
"enum-status-inactive": ["Inactive", "비활성"],
|
|
315
|
+
"enumdesc-status-inactive": ["Account is temporarily disabled", "계정이 일시적으로 비활성화됨"],
|
|
316
|
+
|
|
317
|
+
"enum-status-banned": ["Banned", "차단됨"],
|
|
318
|
+
"enumdesc-status-banned": ["Account is permanently disabled", "계정이 영구적으로 비활성화됨"],
|
|
319
|
+
|
|
320
|
+
"enum-status-pending": ["Pending", "대기 중"],
|
|
321
|
+
"enumdesc-status-pending": ["Account awaiting verification", "계정 인증 대기 중"],
|
|
322
|
+
// * ==================== Enums ==================== * //
|
|
323
|
+
|
|
324
|
+
// * ==================== Custom ==================== * //
|
|
325
|
+
profileHeading: ["User Profile", "사용자 프로필"],
|
|
326
|
+
accountSettings: ["Account Settings", "계정 설정"],
|
|
327
|
+
loginHistory: ["Login History", "로그인 기록"],
|
|
328
|
+
// * ==================== Custom ==================== * //
|
|
329
|
+
} satisfies ModelDictionary<User>;
|
|
330
|
+
|
|
331
|
+
export const userDictionary = modelDictionary;
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Summary Checklist
|
|
335
|
+
|
|
336
|
+
1. **Imports**: Import `ModelDictionary` and model type
|
|
337
|
+
2. **Metadata**: Include `modelName` and `modelDesc`
|
|
338
|
+
3. **Fields**: Translate all model fields with descriptions
|
|
339
|
+
4. **Enums**: Translate all enum values with descriptions
|
|
340
|
+
5. **Format**: Use proper prefix patterns (`desc-`, `enum-`, `enumdesc-`)
|
|
341
|
+
6. **Arrays**: Use two-element arrays for all translations
|
|
342
|
+
7. **Organization**: Group related translations with comment separators
|
|
343
|
+
8. **Type Safety**: Use `satisfies ModelDictionary<YourModel>`
|
|
344
|
+
9. **Export**: Name the export to match the model name
|
|
345
|
+
10. **Completeness**: Ensure all fields and enums from the constant file are translated
|
|
346
|
+
|
|
347
|
+
Following these guidelines will ensure your scalar dictionary files are complete, consistent, and maintainable across the Akan.js framework.
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Using Shared UI Components in Akan.js
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `@shared/ui` library in the Akan.js framework provides a comprehensive set of React components designed for building data-driven applications. This library follows consistent patterns and deeply integrates with the application's store system, making it efficient to develop complex UIs with minimal code.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Store-Centric Architecture**: Seamless integration with standardized store slices using naming conventions
|
|
10
|
+
- **Type-Safe Components**: Extensive TypeScript generic usage for compile-time safety
|
|
11
|
+
- **Internationalization**: Built-in multi-language support throughout all components
|
|
12
|
+
- **Responsive Design**: Mobile-first approach with adaptive breakpoints
|
|
13
|
+
- **Performance Optimized**: Components use memoization, lazy loading, and efficient rendering strategies
|
|
14
|
+
- **Accessibility Compliant**: Proper ARIA attributes and keyboard navigation
|
|
15
|
+
- **Extensible Architecture**: Plugin systems and customizable renderers
|
|
16
|
+
- **Unidirectional Data Flow**: Predictable state management patterns
|
|
17
|
+
|
|
18
|
+
## Getting Started
|
|
19
|
+
|
|
20
|
+
### Importing Components
|
|
21
|
+
|
|
22
|
+
All UI components are available as named exports from the `@shared/ui` package:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Field, Data, Load, Model, System, Only, Editor, Property } from "@shared/ui";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Each namespace contains specialized components for specific use cases:
|
|
29
|
+
|
|
30
|
+
- **Field**: Form inputs and data entry components
|
|
31
|
+
- **Data**: Data visualization and management interfaces
|
|
32
|
+
- **Load**: Data loading patterns with SSR/CSR support
|
|
33
|
+
- **Model**: CRUD operations with modal and inline editing
|
|
34
|
+
- **System**: Application-level providers and utilities
|
|
35
|
+
- **Only**: Conditional rendering based on user state and device
|
|
36
|
+
- **Editor**: Rich text editing capabilities
|
|
37
|
+
- **Property**: Metadata-driven property editing
|
|
38
|
+
|
|
39
|
+
### Component Organization in Your Module
|
|
40
|
+
|
|
41
|
+
When building a module in Akan.js, you should organize your components following the pattern:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
/lib/myFeature/
|
|
45
|
+
MyFeature.constant.ts # Types, GraphQL schema, enums
|
|
46
|
+
MyFeature.service.ts # Business logic and database operations
|
|
47
|
+
MyFeature.signal.ts # Client state management and API calls
|
|
48
|
+
MyFeature.store.ts # Zustand store definitions
|
|
49
|
+
MyFeature.Template.tsx # Form templates for create/edit
|
|
50
|
+
MyFeature.Unit.tsx # Card/list item components
|
|
51
|
+
MyFeature.View.tsx # Full page views
|
|
52
|
+
MyFeature.Zone.tsx # Layout containers
|
|
53
|
+
MyFeature.Util.tsx # Utility components
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Usage Examples
|
|
57
|
+
|
|
58
|
+
### 1. Basic Form Fields
|
|
59
|
+
|
|
60
|
+
Form fields are used for data entry and are integrated with the validation system:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { Field } from "@shared/ui";
|
|
64
|
+
import { usePage } from "@shared/client";
|
|
65
|
+
|
|
66
|
+
const MyComponent = () => {
|
|
67
|
+
const { l } = usePage(); // For internationalization
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<Field.Text
|
|
72
|
+
label={l.field("myModel", "title")}
|
|
73
|
+
desc={l.desc("myModel", "title")}
|
|
74
|
+
value={formState.title}
|
|
75
|
+
onChange={(value) => st.do.setTitleOnMyModel(value)}
|
|
76
|
+
nullable={false}
|
|
77
|
+
maxlength={100}
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<Field.Number
|
|
81
|
+
label={l.field("myModel", "amount")}
|
|
82
|
+
desc={l.desc("myModel", "amount")}
|
|
83
|
+
value={formState.amount}
|
|
84
|
+
onChange={(value) => st.do.setAmountOnMyModel(value)}
|
|
85
|
+
min={0}
|
|
86
|
+
max={1000}
|
|
87
|
+
unit="KRW"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<Field.ToggleSelect
|
|
91
|
+
label={l.field("myModel", "status")}
|
|
92
|
+
desc={l.desc("myModel", "status")}
|
|
93
|
+
value={formState.status}
|
|
94
|
+
items={cnst.Status}
|
|
95
|
+
onChange={(status) => st.do.setStatusOnMyModel(status)}
|
|
96
|
+
model="myModel"
|
|
97
|
+
field="status"
|
|
98
|
+
/>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 2. Data Management Components
|
|
105
|
+
|
|
106
|
+
Data components are used to display and manage collections of data:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { Data, Model } from "@shared/ui";
|
|
110
|
+
|
|
111
|
+
export const MyFeatureAdmin = ({ sliceName = "myFeature" }) => {
|
|
112
|
+
return (
|
|
113
|
+
<Data.ListContainer
|
|
114
|
+
sliceName={sliceName}
|
|
115
|
+
renderItem={MyFeature.Unit.Card}
|
|
116
|
+
renderDashboard={MyFeature.Util.Stat}
|
|
117
|
+
renderTemplate={MyFeature.Template.General}
|
|
118
|
+
renderView={(myFeature) => <MyFeature.View.General myFeature={myFeature} />}
|
|
119
|
+
columns={["id", "title", "status", "createdAt"]}
|
|
120
|
+
actions={(myFeature) => ["remove", "edit", "view"]}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 3. Loading and Data Fetching
|
|
127
|
+
|
|
128
|
+
Load components handle data fetching and state management:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { Load } from "@shared/ui";
|
|
132
|
+
|
|
133
|
+
export const MyFeatureView = ({ id }) => {
|
|
134
|
+
return (
|
|
135
|
+
<Load.View
|
|
136
|
+
loader={() => fetch.myFeature(id)}
|
|
137
|
+
render={(myFeature) => (
|
|
138
|
+
<div className="space-y-4 p-4">
|
|
139
|
+
<h1>{myFeature.title}</h1>
|
|
140
|
+
<p>{myFeature.description}</p>
|
|
141
|
+
</div>
|
|
142
|
+
)}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const MyFeatureList = () => {
|
|
148
|
+
return (
|
|
149
|
+
<Load.Units
|
|
150
|
+
init={st.do.initMyFeature}
|
|
151
|
+
renderItem={(myFeature) => <MyFeature.Unit.Card key={myFeature.id} myFeature={myFeature} />}
|
|
152
|
+
filter={(myFeature) => myFeature.isActive}
|
|
153
|
+
sort={(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 4. CRUD Operations
|
|
160
|
+
|
|
161
|
+
Model components handle create, read, update and delete operations:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import { Model } from "@shared/ui";
|
|
165
|
+
|
|
166
|
+
export const CreateMyFeature = () => {
|
|
167
|
+
return (
|
|
168
|
+
<Model.NewWrapper sliceName="myFeature">
|
|
169
|
+
<button className="btn btn-primary">Create New</button>
|
|
170
|
+
</Model.NewWrapper>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export const EditMyFeature = ({ id }) => {
|
|
175
|
+
return (
|
|
176
|
+
<Model.EditModal
|
|
177
|
+
sliceName="myFeature"
|
|
178
|
+
id={id}
|
|
179
|
+
renderTitle={(myFeature) => `Edit ${myFeature.title}`}
|
|
180
|
+
onSubmit="closeModal"
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const ViewMyFeature = ({ id }) => {
|
|
186
|
+
return (
|
|
187
|
+
<Model.ViewModal
|
|
188
|
+
id={id}
|
|
189
|
+
renderView={(myFeature) => <MyFeature.View.General myFeature={myFeature} />}
|
|
190
|
+
renderAction={(myFeature) => (
|
|
191
|
+
<Model.EditWrapper sliceName="myFeature" id={myFeature.id}>
|
|
192
|
+
<button className="btn btn-secondary">Edit</button>
|
|
193
|
+
</Model.EditWrapper>
|
|
194
|
+
)}
|
|
195
|
+
/>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 5. Conditional Rendering
|
|
201
|
+
|
|
202
|
+
Only components handle conditional rendering based on user roles or device:
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { Only } from "@shared/ui";
|
|
206
|
+
|
|
207
|
+
export const AdminFeature = () => {
|
|
208
|
+
return (
|
|
209
|
+
<Only.Admin roles={["superadmin", "manager"]}>
|
|
210
|
+
<div className="bg-red-100 p-4">Admin Only Content</div>
|
|
211
|
+
</Only.Admin>
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export const MobileFeature = () => {
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
<Only.Mobile>
|
|
219
|
+
<div className="compact-view">Mobile View</div>
|
|
220
|
+
</Only.Mobile>
|
|
221
|
+
|
|
222
|
+
<Only.Web>
|
|
223
|
+
<div className="expanded-view">Desktop View</div>
|
|
224
|
+
</Only.Web>
|
|
225
|
+
</>
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Integration with Store System
|
|
231
|
+
|
|
232
|
+
The components integrate deeply with the Akan.js store system using standardized naming conventions:
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
// Field.ParentId example
|
|
236
|
+
<Field.ParentId
|
|
237
|
+
label="Organization"
|
|
238
|
+
sliceName="orgInUser" // References st.slice.orgInUser
|
|
239
|
+
value={userForm.org}
|
|
240
|
+
onChange={st.do.setOrgOnUser}
|
|
241
|
+
renderOption={(org) => org.name}
|
|
242
|
+
/>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The components automatically use naming conventions to interact with your store:
|
|
246
|
+
|
|
247
|
+
- `${modelName}List` for accessing list data
|
|
248
|
+
- `init${ModelName}` for initialization functions
|
|
249
|
+
- `${modelName}Form` for form state
|
|
250
|
+
- `add${ModelName}Files` for file uploads
|
|
251
|
+
|
|
252
|
+
## Common Patterns
|
|
253
|
+
|
|
254
|
+
### Render Props
|
|
255
|
+
|
|
256
|
+
Many components use render props for customization:
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
<Data.ListContainer
|
|
260
|
+
renderItem={(item) => <MyItem item={item} />}
|
|
261
|
+
renderDashboard={(props) => <MyDashboard {...props} />}
|
|
262
|
+
renderTemplate={(form) => <MyTemplate form={form} />}
|
|
263
|
+
renderView={(model) => <MyView model={model} />}
|
|
264
|
+
/>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Internationalization
|
|
268
|
+
|
|
269
|
+
Components automatically integrate with the internationalization system:
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
const { l } = usePage();
|
|
273
|
+
|
|
274
|
+
<Field.Text label={l.field("user", "name")} desc={l.desc("user", "name")} placeholder={l("user.namePlaceholder")} />;
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### State Management Integration
|
|
278
|
+
|
|
279
|
+
Components seamlessly integrate with the state management:
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
<Field.ToggleSelect value={userForm.role} onChange={(role) => st.do.setRoleOnUser(role)} items={cnst.UserRole} />
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Best Practices
|
|
286
|
+
|
|
287
|
+
1. **Use the appropriate component type** for each part of your feature:
|
|
288
|
+
|
|
289
|
+
- Use **Field** components for data entry
|
|
290
|
+
- Use **Data** components for data visualization and management
|
|
291
|
+
- Use **Load** components for data fetching
|
|
292
|
+
- Use **Model** components for CRUD operations
|
|
293
|
+
|
|
294
|
+
2. **Leverage the internationalization system** by using the `l` function for all user-facing text
|
|
295
|
+
|
|
296
|
+
3. **Follow the naming conventions** for store slices and actions to ensure proper integration
|
|
297
|
+
|
|
298
|
+
4. **Use render props** for customization rather than creating custom components
|
|
299
|
+
|
|
300
|
+
5. **Utilize conditional rendering** with Only components rather than conditional logic in your components
|
|
301
|
+
|
|
302
|
+
6. **Structure your modules** following the Akan.js pattern with separate files for each concern
|
|
303
|
+
|
|
304
|
+
## Troubleshooting
|
|
305
|
+
|
|
306
|
+
Common issues and solutions:
|
|
307
|
+
|
|
308
|
+
1. **Component not updating when store changes**: Ensure you're using the correct store slice name and following naming conventions
|
|
309
|
+
|
|
310
|
+
2. **Field validation errors**: Check the validation rules and ensure you're providing the correct props (minlength, maxlength, etc.)
|
|
311
|
+
|
|
312
|
+
3. **Data not loading**: Verify that the loader function is correctly implemented and returning data in the expected format
|
|
313
|
+
|
|
314
|
+
4. **Missing translations**: Ensure that all keys are defined in your dictionary files and that you're using the correct model and field names
|
|
315
|
+
|
|
316
|
+
## Conclusion
|
|
317
|
+
|
|
318
|
+
The shared UI library provides a comprehensive set of components for building data-driven applications with Akan.js. By following the patterns and conventions outlined in this guide, you can efficiently build complex UIs with minimal code.
|