codeplay-common 4.2.4 → 4.2.6

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.
@@ -1,242 +1,242 @@
1
- # Framework7 `.f7` New Page Standard (Cross-App)
2
-
3
- ## Source-of-truth and project scope
4
- Use these files as mandatory baseline before creating any new page:
5
- `AGENTS.md`, `AGENTS\agents.md`, existing pages under `src\pages`, `src\js\routes.js`, and theme files under `src\theme`.
6
- Use the matching project’s actual files for any app where you are implementing this standard.
7
-
8
- ## Required page shape
9
- Every new page file must use `.f7` with exactly one `<template>` and one `<script>`.
10
- The root DOM must be one `.page` element with `data-name`.
11
-
12
- Minimum skeleton:
13
- ```html
14
- <template>
15
- <div class="page" data-name="newPage">
16
- <!-- optional navbar -->
17
- <!-- page content -->
18
- </div>
19
- </template>
20
- <script>
21
- export default (props, { $f7, $el, $on }) => {
22
- // lifecycle + handlers
23
- return $render;
24
- };
25
- </script>
26
- ```
27
-
28
- ## Route integration rule
29
- After creating any new `.f7` page, add it to `src\js\routes.js` with lazy async loading and route names ending in `/`, matching existing app routes.
30
- Use this style:
31
- ```js
32
- {
33
- path: '/NewPageName/',
34
- //component: newPageImport
35
- async async({ resolve }) {
36
- const page = await import('../pages/newpage.f7');
37
- resolve({ component: page.default });
38
- },
39
- },
40
- ```
41
-
42
- Match the existing conventions exactly:
43
- - path names use PascalCase and trailing slash.
44
- - import path should point to `../pages/<file>.f7`.
45
- - component is resolved from `page.default`.
46
-
47
- ## Back button rule (required)
48
- All new pages must use the shared back handler from `src/js/back.js`.
49
-
50
- Add this import:
51
- ```js
52
- import { backButtonPress } from './../js/back.js';
53
- ```
54
-
55
- Use `backButtonPress` for every page back action in navbars, back links, and custom back controls.
56
-
57
- ```html
58
- <div class="left">
59
- <div class="link" @click="${backButtonPress}">
60
- <img src="${backImage}" class="backIconImg"></img>
61
- </div>
62
- </div>
63
- ```
64
-
65
- Do not use custom `router.back()` or manual `window.history.back()` in new pages.
66
- If a page requires a custom close/exit confirmation, keep it inside `backButtonPress` central flow or `common` helpers, then wire the same handler.
67
-
68
- The central `backButtonPress` flow must preserve the actual navigation source:
69
- - Home keeps the app's existing exit-confirmation behavior.
70
- - Pages with explicit product behavior may keep a named destination in `src/js/back.js`.
71
- - All other pages must use the main Framework7 router history to return to the previous page.
72
- - If no previous route exists, the central handler must return to Home.
73
- - Do not add page-local back methods or hardcode Home in ordinary secondary pages.
74
-
75
- When a page has popups/sheets/dialogs open, verify the shared handler’s behavior for overlays before adding extra back logic.
76
-
77
- ## Template structure (strict)
78
- Use Framework7 layout components before any custom markup.
79
- For pages with header actions use `.navbar` with `.navbar-bg`.
80
- If theme color is needed, include `.theme-navbarBackColor`.
81
- For content use `.page-content`.
82
- For tab rows use `.subnavbar` + `.toolbar.toolbar-top.tabbar`.
83
- For bottom action bars use `.toolbar.toolbar-bottom.tabbar`.
84
-
85
- Examples:
86
- `<div class="navbar"> <div class="navbar-bg theme-navbarBackColor"></div> <div class="navbar-inner">...</div> </div>`
87
-
88
- `<div class="subnavbar theme-navbarBackColor"><div class="subnavbar-inner"><div class="toolbar toolbar-top tabbar">...</div></div></div>`
89
-
90
- `<div class="toolbar toolbar-bottom tabbar theme-navbarBackColor"><div class="toolbar-inner">...</div></div>`
91
-
92
- ## Framework7 custom component enable/disable rule
93
- If a new page uses a component beyond the currently enabled baseline, update these files first:
94
- - `src/js/framework7-custom.js`
95
- - `src/assets/css/framework7-custom.less`
96
-
97
- Enable a component by uncommenting both:
98
- - JS import and registration in `src/js/framework7-custom.js`
99
- - matching LESS import in `src/assets/css/framework7-custom.less`
100
-
101
- Disable a component by commenting both import/registration and LESS import.
102
- Keep JS and LESS changes synchronized for each enabled component.
103
-
104
- Keep this section app-agnostic.
105
- For each app, enable only components that are required by that app and keep JS/LESS toggles synchronized in that app's own `framework7-custom` files.
106
-
107
- ## Grid and list policy
108
- Use Framework7 utilities for columns:
109
- `grid`, `grid-cols-*`, `grid-gap`, `display-flex`, and standard alignment classes.
110
- Use framework list classes:
111
- `list`, `list media-list`, `item-content`, `item-inner`, `item-title`.
112
- Do not create new custom grid/list styles unless existing utilities are impossible.
113
-
114
- ## Navbar and status-bar behavior
115
- If page has a header, add theme activation in lifecycle:
116
- ```js
117
- $on("pageBeforeIn", () => {
118
- ThemeController.activateForPage({
119
- navColor: 'white',
120
- statusColor: 'white',
121
- navIsAutoMode: false,
122
- statusIsAutoMode: false,
123
- navCanChangeInNavScroll: false,
124
- statusCanChangeInNavScroll: true
125
- });
126
- });
127
- ```
128
-
129
- If page needs translation updates, listen to app theme event in `pageInit`.
130
-
131
- ## Sheet / popup / popover / dialog usage
132
- Use Framework7 APIs to create these controls.
133
- Do not hand-style internals as ad-hoc floating containers.
134
- For sheets use `sheet` element + `$f7.sheet.create`.
135
- For popups use `$f7.popup.create`.
136
- For popovers use `$f7.popover.create`.
137
- For completion dialogs always set back behavior using dialog options, for example `dialogClass: 'namepopup-dialog dialog-back-no-close'`.
138
-
139
- For non-dismissible bottom sheet/popups, use proper F7 class + safe-area aware spacing from shared styles.
140
-
141
- ## FAB policy
142
- Use `.fab` and `.fab-button` classes only.
143
- Avoid building custom floating action components with fixed positioned custom HTML.
144
- If using FAB for mobile actions, set `right`, `bottom`, and alignment with F7 classes and existing utilities.
145
-
146
- ## Styling policy for new pages
147
- Avoid inline style attributes in new pages.
148
- Do not add custom CSS classes directly inside `.f7` unless truly unavoidable.
149
- Also follow all theme rules in this app’s theme notes file (for example `src\theme\<theme-folder>\Notes.txt`) when designing page visuals.
150
- If style is needed, define it in:
151
- `src\theme\theme-x.x\theme.less`, `src\theme\theme-x.x\theme-dialog.less`, or `src\assets\css\common-x.x.less`.
152
- All theme helper classes should be prefixed with `t-`.
153
- Prefer theme classes like `theme-navbarBackColor`, `t-fade-img`, existing ripple utility classes, and shared page-level helper classes.
154
-
155
- Theme file musts / reminders from `<theme-folder>\Notes.txt` (for example `theme-x.x\Notes.txt`):
156
- - Prefer Framework7 classes first; only fallback to theme css when not possible.
157
- - Use `theme-navbarBackColor` for navbar color consistency.
158
- - Reuse existing utility variables like `--bg-main1`, `--bg-main2`, `--bg-main2-text`, `--tab-active-bg`, `--tab-inactive-text`, etc.
159
- - Use shared theme class prefix `t-*` for all new custom theme classes.
160
- - For images that must change by theme, use `data-image-light` / `data-image-dark` and call `ThemeController.activateForPage()` when needed.
161
- - Theme-related changes should go to `src/theme/css/custom.less`, `src/theme/css/light.less`, or `src/theme/css/dark.less` only.
162
- - For light/dark and system behavior checks, use existing `ThemeController` helpers.
163
- - Do not change protected shared styles directly on a page with inline or per-page overrides unless explicitly required.
164
-
165
- Do not modify `www` and do not edit protected shared files unless user explicitly grants permission.
166
- Protected list is in `AGENTS.md`.
167
-
168
- If you notice a missing instruction between this file and `Notes.txt`, update this instruction file first and follow the stricter one.
169
-
170
- ## Handler and event rules
171
- Keep template event bindings minimal and avoid large inline arrow expressions in markup.
172
- Define handlers as named functions and bind directly.
173
- Keep DOM queries inside lifecycle events only.
174
-
175
- Good pattern:
176
- `@click="${onOpenMenu}"`, `@click="${openTemplatePopup}"`, `@click="${goBack}"`
177
- Avoid repeating heavy anonymous callbacks inside markup.
178
-
179
- ## Reuse over duplication
180
- Before creating helpers, check existing exported helpers in project js folders.
181
- Prefer reuse of common functions in shared modules.
182
- Do not introduce duplicate utilities for back navigation, theme switching, popover/popup creation, dialogs, toasts, or storage.
183
-
184
- ## Shared method first (required)
185
- Before adding new helper methods, always search and reuse existing common methods in the project.
186
- If a shared method already exists, do not create a new one.
187
-
188
- Important shared method source for new pages:
189
- - `./../js/common-x.x.js`
190
- - theme/controller helpers already imported in existing pages (for example `ThemeController`)
191
-
192
- From the project update notes:
193
- - For back handling in app shell, `capacitor-app.js` must import:
194
- `import { backButtonCheckAndExit } from './common-x.x.js';`
195
- and call `backButtonCheckAndExit();` inside `handleAndroidBackButton`.
196
- - If a new page needs spinner stop, import:
197
- `import { stopSpinner } from './../js/common-x.x.js';`
198
-
199
- Commonly available methods to prefer (examples):
200
- - `hideForMethod`
201
- - `shareApp` (with `noAppOpenShowUntilResume`)
202
- - `shareContent` (with `noAppOpenShowUntilResume`)
203
- - `rateUs` (with `noAppOpenShowUntilResume`)
204
- - `gotoPrivacypolicy` (with `noAppOpenShowUntilResume`)
205
- - `openDeveloperApps` (with `noAppOpenShowUntilResume`)
206
- - `bugReportPopup`
207
- - `showToast`
208
- - `showSpinner`, `stopSpinner`
209
- - `showAlertBox`
210
- - `setLocalStorage`, `getLocalStorage`, `removeLocalStorage`
211
- - `getExactContentHeight`
212
- - `confirmDialog`
213
- - `setNavBarColor`, `setStatusBarColor` (order note: call `setNavBarColor` first)
214
- - `manageStorage(key).setState/getState/removeState`
215
- - `initTouchableImages` for touch feedback animations
216
- - `activateLogTracker`, `getConsoleData` (testing only)
217
-
218
- Notes:
219
- - `showPage`, `backButtonPress`, and theme-related helpers should remain consistent with existing patterns.
220
- - Deprecated / removed methods from older notes should not be reintroduced.
221
-
222
- ## Required quality checklist before returning page code
223
- Page file name and `data-name` are unique.
224
- Navbar, page-content, and footer toolbar structure use Framework7 classes.
225
- No new inline style blocks are used unless the exception is explicitly justified.
226
- No hardcoded `background-color` at page element level unless required by theme variant.
227
- No direct edits to protected files were made.
228
- New route is added in `src\js\routes.js`.
229
- At least one existing Framework7 component is used for each required UI area.
230
- Theme activation and lifecycle usage is present when page has a header.
231
- If dialog cannot close on back press, `dialogClass` rule is set at call site.
232
-
233
- ## Response rule for this repo
234
- When codegen is requested from this file, follow this instruction order first:
235
- structure, route, template layout, theme integration, handlers, then script wiring.
236
-
237
-
238
-
239
-
240
-
241
-
1
+ # Framework7 `.f7` New Page Standard (Cross-App)
2
+
3
+ ## Source-of-truth and project scope
4
+ Use these files as mandatory baseline before creating any new page:
5
+ `AGENTS.md`, `AGENTS\agents.md`, existing pages under `src\pages`, `src\js\routes.js`, and theme files under `src\theme`.
6
+ Use the matching project’s actual files for any app where you are implementing this standard.
7
+
8
+ ## Required page shape
9
+ Every new page file must use `.f7` with exactly one `<template>` and one `<script>`.
10
+ The root DOM must be one `.page` element with `data-name`.
11
+
12
+ Minimum skeleton:
13
+ ```html
14
+ <template>
15
+ <div class="page" data-name="newPage">
16
+ <!-- optional navbar -->
17
+ <!-- page content -->
18
+ </div>
19
+ </template>
20
+ <script>
21
+ export default (props, { $f7, $el, $on }) => {
22
+ // lifecycle + handlers
23
+ return $render;
24
+ };
25
+ </script>
26
+ ```
27
+
28
+ ## Route integration rule
29
+ After creating any new `.f7` page, add it to `src\js\routes.js` with lazy async loading and route names ending in `/`, matching existing app routes.
30
+ Use this style:
31
+ ```js
32
+ {
33
+ path: '/NewPageName/',
34
+ //component: newPageImport
35
+ async async({ resolve }) {
36
+ const page = await import('../pages/newpage.f7');
37
+ resolve({ component: page.default });
38
+ },
39
+ },
40
+ ```
41
+
42
+ Match the existing conventions exactly:
43
+ - path names use PascalCase and trailing slash.
44
+ - import path should point to `../pages/<file>.f7`.
45
+ - component is resolved from `page.default`.
46
+
47
+ ## Back button rule (required)
48
+ All new pages must use the shared back handler from `src/js/back.js`.
49
+
50
+ Add this import:
51
+ ```js
52
+ import { backButtonPress } from './../js/back.js';
53
+ ```
54
+
55
+ Use `backButtonPress` for every page back action in navbars, back links, and custom back controls.
56
+
57
+ ```html
58
+ <div class="left">
59
+ <div class="link" @click="${backButtonPress}">
60
+ <img src="${backImage}" class="backIconImg"></img>
61
+ </div>
62
+ </div>
63
+ ```
64
+
65
+ Do not use custom `router.back()` or manual `window.history.back()` in new pages.
66
+ If a page requires a custom close/exit confirmation, keep it inside `backButtonPress` central flow or `common` helpers, then wire the same handler.
67
+
68
+ The central `backButtonPress` flow must preserve the actual navigation source:
69
+ - Home keeps the app's existing exit-confirmation behavior.
70
+ - Pages with explicit product behavior may keep a named destination in `src/js/back.js`.
71
+ - All other pages must use the main Framework7 router history to return to the previous page.
72
+ - If no previous route exists, the central handler must return to Home.
73
+ - Do not add page-local back methods or hardcode Home in ordinary secondary pages.
74
+
75
+ When a page has popups/sheets/dialogs open, verify the shared handler’s behavior for overlays before adding extra back logic.
76
+
77
+ ## Template structure (strict)
78
+ Use Framework7 layout components before any custom markup.
79
+ For pages with header actions use `.navbar` with `.navbar-bg`.
80
+ If theme color is needed, include `.theme-navbarBackColor`.
81
+ For content use `.page-content`.
82
+ For tab rows use `.subnavbar` + `.toolbar.toolbar-top.tabbar`.
83
+ For bottom action bars use `.toolbar.toolbar-bottom.tabbar`.
84
+
85
+ Examples:
86
+ `<div class="navbar"> <div class="navbar-bg theme-navbarBackColor"></div> <div class="navbar-inner">...</div> </div>`
87
+
88
+ `<div class="subnavbar theme-navbarBackColor"><div class="subnavbar-inner"><div class="toolbar toolbar-top tabbar">...</div></div></div>`
89
+
90
+ `<div class="toolbar toolbar-bottom tabbar theme-navbarBackColor"><div class="toolbar-inner">...</div></div>`
91
+
92
+ ## Framework7 custom component enable/disable rule
93
+ If a new page uses a component beyond the currently enabled baseline, update these files first:
94
+ - `src/js/framework7-custom.js`
95
+ - `src/assets/css/framework7-custom.less`
96
+
97
+ Enable a component by uncommenting both:
98
+ - JS import and registration in `src/js/framework7-custom.js`
99
+ - matching LESS import in `src/assets/css/framework7-custom.less`
100
+
101
+ Disable a component by commenting both import/registration and LESS import.
102
+ Keep JS and LESS changes synchronized for each enabled component.
103
+
104
+ Keep this section app-agnostic.
105
+ For each app, enable only components that are required by that app and keep JS/LESS toggles synchronized in that app's own `framework7-custom` files.
106
+
107
+ ## Grid and list policy
108
+ Use Framework7 utilities for columns:
109
+ `grid`, `grid-cols-*`, `grid-gap`, `display-flex`, and standard alignment classes.
110
+ Use framework list classes:
111
+ `list`, `list media-list`, `item-content`, `item-inner`, `item-title`.
112
+ Do not create new custom grid/list styles unless existing utilities are impossible.
113
+
114
+ ## Navbar and status-bar behavior
115
+ If page has a header, add theme activation in lifecycle:
116
+ ```js
117
+ $on("pageBeforeIn", () => {
118
+ ThemeController.activateForPage({
119
+ navColor: 'white',
120
+ statusColor: 'white',
121
+ navIsAutoMode: false,
122
+ statusIsAutoMode: false,
123
+ navCanChangeInNavScroll: false,
124
+ statusCanChangeInNavScroll: true
125
+ });
126
+ });
127
+ ```
128
+
129
+ If page needs translation updates, listen to app theme event in `pageInit`.
130
+
131
+ ## Sheet / popup / popover / dialog usage
132
+ Use Framework7 APIs to create these controls.
133
+ Do not hand-style internals as ad-hoc floating containers.
134
+ For sheets use `sheet` element + `$f7.sheet.create`.
135
+ For popups use `$f7.popup.create`.
136
+ For popovers use `$f7.popover.create`.
137
+ For completion dialogs always set back behavior using dialog options, for example `dialogClass: 'namepopup-dialog dialog-back-no-close'`.
138
+
139
+ For non-dismissible bottom sheet/popups, use proper F7 class + safe-area aware spacing from shared styles.
140
+
141
+ ## FAB policy
142
+ Use `.fab` and `.fab-button` classes only.
143
+ Avoid building custom floating action components with fixed positioned custom HTML.
144
+ If using FAB for mobile actions, set `right`, `bottom`, and alignment with F7 classes and existing utilities.
145
+
146
+ ## Styling policy for new pages
147
+ Avoid inline style attributes in new pages.
148
+ Do not add custom CSS classes directly inside `.f7` unless truly unavoidable.
149
+ Also follow all theme rules in this app’s theme notes file (for example `src\theme\<theme-folder>\Notes.txt`) when designing page visuals.
150
+ If style is needed, define it in:
151
+ `src\theme\theme-x.x\theme.less`, `src\theme\theme-x.x\theme-dialog.less`, or `src\assets\css\common-x.x.less`.
152
+ All theme helper classes should be prefixed with `t-`.
153
+ Prefer theme classes like `theme-navbarBackColor`, `t-fade-img`, existing ripple utility classes, and shared page-level helper classes.
154
+
155
+ Theme file musts / reminders from `<theme-folder>\Notes.txt` (for example `theme-x.x\Notes.txt`):
156
+ - Prefer Framework7 classes first; only fallback to theme css when not possible.
157
+ - Use `theme-navbarBackColor` for navbar color consistency.
158
+ - Reuse existing utility variables like `--bg-main1`, `--bg-main2`, `--bg-main2-text`, `--tab-active-bg`, `--tab-inactive-text`, etc.
159
+ - Use shared theme class prefix `t-*` for all new custom theme classes.
160
+ - For images that must change by theme, use `data-image-light` / `data-image-dark` and call `ThemeController.activateForPage()` when needed.
161
+ - Theme-related changes should go to `src/theme/css/custom.less`, `src/theme/css/light.less`, or `src/theme/css/dark.less` only.
162
+ - For light/dark and system behavior checks, use existing `ThemeController` helpers.
163
+ - Do not change protected shared styles directly on a page with inline or per-page overrides unless explicitly required.
164
+
165
+ Do not modify `www` and do not edit protected shared files unless user explicitly grants permission.
166
+ Protected list is in `AGENTS.md`.
167
+
168
+ If you notice a missing instruction between this file and `Notes.txt`, update this instruction file first and follow the stricter one.
169
+
170
+ ## Handler and event rules
171
+ Keep template event bindings minimal and avoid large inline arrow expressions in markup.
172
+ Define handlers as named functions and bind directly.
173
+ Keep DOM queries inside lifecycle events only.
174
+
175
+ Good pattern:
176
+ `@click="${onOpenMenu}"`, `@click="${openTemplatePopup}"`, `@click="${goBack}"`
177
+ Avoid repeating heavy anonymous callbacks inside markup.
178
+
179
+ ## Reuse over duplication
180
+ Before creating helpers, check existing exported helpers in project js folders.
181
+ Prefer reuse of common functions in shared modules.
182
+ Do not introduce duplicate utilities for back navigation, theme switching, popover/popup creation, dialogs, toasts, or storage.
183
+
184
+ ## Shared method first (required)
185
+ Before adding new helper methods, always search and reuse existing common methods in the project.
186
+ If a shared method already exists, do not create a new one.
187
+
188
+ Important shared method source for new pages:
189
+ - `./../js/common-x.x.js`
190
+ - theme/controller helpers already imported in existing pages (for example `ThemeController`)
191
+
192
+ From the project update notes:
193
+ - For back handling in app shell, `capacitor-app.js` must import:
194
+ `import { backButtonCheckAndExit } from './common-x.x.js';`
195
+ and call `backButtonCheckAndExit();` inside `handleAndroidBackButton`.
196
+ - If a new page needs spinner stop, import:
197
+ `import { stopSpinner } from './../js/common-x.x.js';`
198
+
199
+ Commonly available methods to prefer (examples):
200
+ - `hideForMethod`
201
+ - `shareApp` (with `noAppOpenShowUntilResume`)
202
+ - `shareContent` (with `noAppOpenShowUntilResume`)
203
+ - `rateUs` (with `noAppOpenShowUntilResume`)
204
+ - `gotoPrivacypolicy` (with `noAppOpenShowUntilResume`)
205
+ - `openDeveloperApps` (with `noAppOpenShowUntilResume`)
206
+ - `bugReportPopup`
207
+ - `showToast`
208
+ - `showSpinner`, `stopSpinner`
209
+ - `showAlertBox`
210
+ - `setLocalStorage`, `getLocalStorage`, `removeLocalStorage`
211
+ - `getExactContentHeight`
212
+ - `confirmDialog`
213
+ - `setNavBarColor`, `setStatusBarColor` (order note: call `setNavBarColor` first)
214
+ - `manageStorage(key).setState/getState/removeState`
215
+ - `initTouchableImages` for touch feedback animations
216
+ - `activateLogTracker`, `getConsoleData` (testing only)
217
+
218
+ Notes:
219
+ - `showPage`, `backButtonPress`, and theme-related helpers should remain consistent with existing patterns.
220
+ - Deprecated / removed methods from older notes should not be reintroduced.
221
+
222
+ ## Required quality checklist before returning page code
223
+ Page file name and `data-name` are unique.
224
+ Navbar, page-content, and footer toolbar structure use Framework7 classes.
225
+ No new inline style blocks are used unless the exception is explicitly justified.
226
+ No hardcoded `background-color` at page element level unless required by theme variant.
227
+ No direct edits to protected files were made.
228
+ New route is added in `src\js\routes.js`.
229
+ At least one existing Framework7 component is used for each required UI area.
230
+ Theme activation and lifecycle usage is present when page has a header.
231
+ If dialog cannot close on back press, `dialogClass` rule is set at call site.
232
+
233
+ ## Response rule for this repo
234
+ When codegen is requested from this file, follow this instruction order first:
235
+ structure, route, template layout, theme integration, handlers, then script wiring.
236
+
237
+
238
+
239
+
240
+
241
+
242
242
  if you are using $$ you must import dom7