diff --git a/ASSETS.md b/ASSETS.md index a422fc2..59b8396 100644 --- a/ASSETS.md +++ b/ASSETS.md @@ -7,7 +7,7 @@ - `public/icons/`:从项目原生 SVG 图标导出,母版及方法见 `docs/design/app-icon/v1/README.md`,随项目代码采用 MIT。 - `public/assets/city/`:保留的设计源素材,包含项目专用的 AI 生成透明建筑、植被、地面、奇观和城郊图片。源文件不再直接进入下一版发行包;代码的 MIT 声明不另行承诺这些位图的独立复用授权。 - 城市高速路牌的[正式母版与制作说明](docs/design/city-wayposts/v2/README.md)记录了两色预烘焙流程和投影标定。外环组织广告牌复用[铜绿铸铁牌架原画与标定](docs/design/city-wayposts/organization-billboard/README.md),各组织的图标来自当前主页。 -- `public/assets/city-runtime/`:由设计源素材及标定流程生成的 107 张运行 PNG,发行时复制到 `assets/city/`。城郊地纹、山脊、雪山和草场的原画、来源与尺寸见[城郊素材记录](docs/design/city-outskirts/v3/SOURCES.md)。 +- `public/assets/city-runtime/`:由设计源素材及标定流程生成的 109 张运行 PNG,发行时复制到 `assets/city/`。城郊地纹、山脊、雪山和草场的原画、来源与尺寸见[城郊素材记录](docs/design/city-outskirts/v3/SOURCES.md)。外环与出城公路使用[梁桥位图素材](docs/design/city-transport/v5/README.md)。 - SVG 投影模板、标定 JSON 与程序绘制道路属于项目代码;运行时只使用本地资源。 - `public/assets/calendar/`:微缩城市的十二张 WebP 复用 1×1 运行素材 `garden-butterfly`、`cottage-gable`、`courtyard-flat`、`low-terrace`、`res-mansard-stucco`、`civic-clinic`、`res-limestone-bay`、`apartment-h2-b`、`res-sawtooth-duplex`、`office-h3-b`、`office-h3-a`、`tower-h4-b`。裁掉透明留边并缩至长边不超过 184 像素。十二项合计 121,642 字节,发行时复制到 `assets/calendar/`。 diff --git a/PRIVACY.md b/PRIVACY.md index 21ba440..747a493 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -1,6 +1,6 @@ # CodeYears 隐私说明 -更新于 2026-11-20。本说明适用于随附此文件的扩展构建。 +更新于 2026-11-21。本说明适用于随附此文件的扩展构建。 CodeYears 在 GitHub 个人页把每日贡献绘成城市。扩展免费,无需 GitHub Token、独立账号或后台服务。 @@ -16,6 +16,8 @@ CodeYears 在 GitHub 个人页把每日贡献绘成城市。扩展免费,无 贡献请求只发往 GitHub 同源页面。网页结构和语言会影响解析。扩展不通过 Cookie API 读取凭据,不收集邮箱或密码,也没有遥测、广告或分析服务。 +打开大规模城市时,扩展另向 GitHub 公开 REST 接口 `api.github.com` 匿名读取当前主页账号拥有的公开仓库。扩展只使用仓库名称和 UTC 创建日期,按所选公历年份在环外住宅中显示。这项请求不携带会话凭据或 Token,结果只在当前主页的扩展面板内复用。仓库创建日期不参与贡献计数。 + ## 本地贡献缓存与删除 年度日期、数量、抓取时间和格式版本保存在当前设备的扩展本地存储中,按访问者、主页和年份隔离。身份未知时不读写年度缓存。新构建不复用旧版按登录访客抓取的缓存。完整 HTML 不进入缓存。 diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 51e0ed0..56bb815 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -29,3 +29,213 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` + +## Material Design Icons + +城市罗盘使用 Pictogrammers 的 `compass-rose` 图形,加上方位字母并按地图轴旋转。原图采用 Apache License 2.0。 + +[原图](https://github.com/Templarian/MaterialDesign/blob/master/svg/compass-rose.svg) · [图标许可](https://github.com/Templarian/MaterialDesign/blob/master/LICENSE) + +```text + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +``` diff --git a/docs/DATA_AND_PRIVACY.md b/docs/DATA_AND_PRIVACY.md index 01dcf31..dac87cb 100644 --- a/docs/DATA_AND_PRIVACY.md +++ b/docs/DATA_AND_PRIVACY.md @@ -1,5 +1,7 @@ # 数据与隐私 +0.1.5 试验的仓库住宅在打开大规模 City 后,从 `api.github.com/users/{login}/repos` 以匿名请求分批读取当前主页账号的公开仓库。只保留名称和 GitHub 给出的 UTC 创建日期到当前面板内存,按创建日期的公历年筛选。选取不同年份复用这一公开列表,刷新会重新读取,离开页面会释放。该记录独立于贡献数据,读取失败时贡献城市仍可用。 + 2026-11-20 贡献图样式 `codeyears:ui:appearance` 和城市页签显隐 `codeyears:ui:show-city` 分别保存在本机。样式可选 `native` 或 `miniature`,默认 `native`。城市页签默认显示。旧样式值 `city` 和 `off` 都按原图处理,旧微缩偏好继续适用。微缩视图读取 GitHub 当前日历的日期和显示档位,档位只用于选造型。日期提示继续由 GitHub 提供。微缩视图不推算数量、不请求历史、活动或访问者信息,也不读写年度缓存。 2026-11-19,城市静态车流使用当前主页资料栏可直接读取的粉丝数和关注数。计数缺省时采用基础密度。数字只在当前页面用于布车,转化为装饰强度并随道路规模封顶。 diff --git a/docs/PRODUCT.md b/docs/PRODUCT.md index ecd3831..5aa8978 100644 --- a/docs/PRODUCT.md +++ b/docs/PRODUCT.md @@ -1,8 +1,16 @@ # 产品定义 +0.1.5 试验为外环、年度大道和季度道路两侧留出窄种植带,在直段连植宽冠树,桥头和路口留空。地图左上角使用透明底的白色八芒罗盘,N 和 S 随盘面旋转。河带两岸沿用同一大道编号,分别在英文路名后标 `N BANK` 和 `S BANK`。 + +每个公开仓库用三栋固定尺寸的住宅表示。按 UTC 创建日期,上半年在西侧外环,下半年在东侧外环,同侧再按公历年排列。住宅沿路排满后向外排成村落。同年外环直段无处可建时,优先沿同年同侧的出城路靠城区一段排布,再考虑同侧最近的可用路段。悬停、点选或聚焦住宅时,卡片显示仓库名称和真实创建日期。贡献建筑和合计来自每日贡献。田野村落用于景观。 + +组织牌集中在北侧和南侧外环。每侧四个街区,各街区最多两块,整座城市最多十六块。端部缺街区时,沿同一街区轴向内找相邻年份露出的外环。牌脚退到路旁树列外侧,与树列之间留出空地。南北城际公路优先对准第二和第三街区之间的中路,短街区可从相邻一条纵路接出。 + +主河两端穿过外环后,各直行 14 个地图格再转弯,支流在这段直河之外汇入。外环、城区之间的连接路和出城公路以精绘位图显示桥侧、护栏和水中桥墩,桥面接上对应车幅和标线。四车道和八车道共用桥型,跨水直段沿地图的两条轴线放置,转弯留在桥头之外。沿河谷分出的三条细支流各接一座小湖。郊外全景沿用四种地纹及其过渡,放大时逐渐显出草叶朝同一方向的细密短草。 + 2026-11-20 贡献区默认显示「城市」和「贡献图」页签。点击「城市」按需加载多年场景。工具栏弹窗顶部的「城市」分组提供页签显隐与快捷打开入口。贡献图样式独立设置,默认显示 GitHub 原图,同时显示两个页签时也可用页内按钮切换微缩城市。微缩城市通过 CSS 把原生日格的圆角设为 50%,沿用 GitHub 的细实线边框。建筑在原日期区内错列绘制并叠在日格上方。背景沿原日期区的矩形范围填色,底色跟随 GitHub 主题。五档图例用圆点和四级建筑示意。房型从原有 1×1 运行素材中按 GitHub 档位随机选取,顶部建筑缩小以适应边界。日期操作和提示继续由 GitHub 提供。两项设置同步到已打开的个人主页。 -工具栏弹窗在当前标签为有贡献图的 GitHub 个人主页时开放设置与城市快捷打开。「打开城市」是主要操作,保存反馈出现在对应设置组下。在其他页面显示说明,城市、贡献图样式和语言控件置灰。页脚提供版本信息、对应界面语言的产品官网、关于作者、GitHub 仓库和问题反馈页。「关于作者」进入弹窗内的二级页面,介绍作者并列出其他四款 Chrome 扩展。各外部链接由用户点击后在新标签页打开。 +工具栏弹窗在当前标签为有贡献图的 GitHub 个人主页时开放设置与城市快捷打开。「打开城市」是主要操作,保存反馈出现在对应设置组下。在其他页面显示说明,城市、贡献图样式和语言控件置灰。Chrome 尚未授权自动访问 GitHub 时,弹窗说明如何开启对 `github.com` 的自动访问,并提供当前扩展的详情入口。页脚提供版本信息、对应界面语言的产品官网、关于作者、GitHub 仓库和问题反馈页。「关于作者」进入弹窗内的二级页面,介绍作者并列出其他四款 Chrome 扩展。各外部链接由用户点击后在新标签页打开。 0.1.3 远郊由成片的林木山脊和丘陵覆盖,城区和河谷之间保留开阔低地,较宽阔的远景可以看见雪山。野外地面由浅草、湿苔、碎石草地和偏干草地按地图坐标随机拼接,相邻纹理沿边缘逐渐混合。主河经过城区桥梁,城外沿不同方向转入河谷。支流沿途拓宽成小湖,河谷里还有独立的小湖。出城路牌靠近城区,公路过牌后依据山体轮廓与实际岸线找通路,优先沿岸,必须跨水时选择较窄的过河点,桥面和护栏随两岸位置接续。公路继续延伸到视野边缘。道路较宽时布车更密,当前资料栏的粉丝数与关注数温和调整整体密度。进入城市时随机生成静态车阵,查看期间缩放和平移复用原有车辆位置。 @@ -10,7 +18,7 @@ 0.1.3 候选版以 GitHub 个人主页列出的最早年度为注册年基准,每五年划为一个固定城区。选择年份时,只显示区间内的部分。以 2009 年开始的主页为例,城区始于 2009、2014、2019、2024 年。城区道路、河带和桥梁共用这些边界。两侧露在外环的城区各可接出一条公路,最前和最后的城区还可以向地图端部出城。出口数量取决于实际边界和向外的通路,单一城区最多四条。当前主页 Bio 的个人账号按出现顺序填入可用的路牌,跳过本人、组织和重复账号,剩余牌面留白。外环道路上的组织广告牌链接到该组织的 GitHub 主页,取自 Organizations 列表、Bio 和资料栏中的组织,按账号去重。出城、返程和展示组织各有独立用途。「全景」按城区和已命名路牌的范围取景,包含独立返程牌。每次进入城市时重新布置静态车辆,同一次查看中缩放、拖动和从后台回到页面时保留原车阵。车辆只用于装饰,道路繁忙程度不参与贡献统计。城外地纹在远景降低对比,近景逐渐显出草叶细纹。 -点击空白出口牌可在原地查看连接朋友的方法。本人主页提示在 GitHub 的 Bio 中写入 `@用户名`,他人主页说明出口取自该主页主人的 Bio。「更多」中的「路牌和出口从哪里来?」说明出城道路、返程牌和外环组织牌各自的来源。 +点击空白出口牌可在原地查看连接朋友的方法。本人主页提示修改 GitHub 的 Bio,他人主页说明出口取自该主页主人的 Bio。两种情况下均可复制句式示例,将 `@username` 换成朋友的 GitHub 用户名后粘贴到自己的 Bio。「更多」中的「路牌和出口从哪里来?」说明出城道路、返程牌和外环组织牌各自的来源。「数据隐私」说明本人和访客各自可见的贡献,以及环外村庄的仓库创建记录。 同一座城市内,分离的城区之间用双向四车道连接,每个方向各两条。连接路比城区内的季度支路宽,路面为八车道外环的一半。中央双黄线分隔方向,每个方向用一条白色虚线分隔车道,标线沿转弯延续。 diff --git a/docs/design/city-outskirts/v3/SOURCES.md b/docs/design/city-outskirts/v3/SOURCES.md index a4e6d08..71c2ac0 100644 --- a/docs/design/city-outskirts/v3/SOURCES.md +++ b/docs/design/city-outskirts/v3/SOURCES.md @@ -36,3 +36,31 @@ One transparent raster sprite for the terrain of CodeYears, a realistic miniatur 连绵的山体组采用同样的等轴角度和光照,以右侧高峰、左下方低丘、山鞍和相连的林地坡脚改变轮廓。通过 ImageGen 根据文字描述生成。道路用的 `src/renderers/city-relief-outlines.json` 从运行 PNG 的透明度提取。等比缩窄到 144 像素,逐行取透明度至少 200 的最左和最右点,计算凸包并移除近共线顶点,使用 0 至 1 的归一化坐标。 四格地纹由 ImageGen 根据文字描述生成。左上为浅草,右上为湿苔,左下为带碎石的草地,右下为偏干短草。四格使用相同的正俯视角、细节尺度及漫射光。扩展取样时从每格内缩 4%,解码后为各格加上渐隐边,再统一做等轴投影。 + +## 近景细草 + +2026-11-21 用内置 ImageGen 根据文字单独生成细草母版。两个方向各保留 1200 像素,并用剩余 54 像素从尾部到头部渐变衔接,重复时接缝两侧取自母版的相邻像素。按 sRGB 通道去掉母版均值,将偏差乘 0.62 后以 `(113, 138, 63)` 为新均值,调成与地图接近的草绿色。运行 PNG 使用 256 色索引,无抖动。与索引前的三通道图比较,平均绝对误差为 0.72/255,无尺寸插值。 + +| 文件 | 规格 | 字节 | SHA-256 | +| --- | --- | ---: | --- | +| `short-grass-source.png` | 1254 × 1254,原始 PNG | 4,217,827 | `8f4ff1ada6510aa4f93a1cfa43097f662534329e43ac64f4650c62ee814c137c` | +| `short-grass-runtime.png` | 1200 × 1200,旧版运行 PNG,保留作对照 | 1,418,596 | `58232dbe3785837543283349e93bbcf97a9e098a309cc74734d47a27c87922a3` | + +生成提示见下。 + +```text +Use case: stylized-concept. Asset type: one production ground texture for the outskirts of a detailed miniature isometric city. Generate a square, opaque, high-resolution raster at the largest native square resolution supported. View the grass directly overhead, orthographic and entirely flat. Fill every pixel edge to edge with dense, short living meadow grass. The game renderer will supply the isometric projection. Render tiny, crisp individual grass blades and subtle small clover-like foliage with irregular directions and natural spacing. Aim for genuinely fine leaf detail at 100% zoom, with hundreds of small tufts across the frame and no dominant clumps or sharp scratches. Overall color is a fresh medium warm meadow green, approximately #74874c, with modest variations of leaf green and spring olive. Soft even overhead daylight, low contrast at larger scales, no vignette, diagonal bands, mowing stripes, specular shine, black shadows, crosshatching, oversized thatch, exposed soil, rocks, flowers, paths, borders, shapes, text or objects. Make the left and right edges match, and the top and bottom edges match, so the square repeats seamlessly. Single texture with no sample sheet or gutters. Believable hand-rendered natural material for a refined realistic miniature. +``` + +## 单向短草 + +2026-11-21 用内置 ImageGen 根据文字生成球场式短草。草叶在母版中大致沿横向排列,经原有等轴投影后顺着地图的斜向铺开。沿用 1200 像素的取样范围与 54 像素叠边,以 `(113, 138, 63)` 为调色中心,通道对比系数取 0.49。运行图为 256 色索引 PNG,无抖动,量化平均绝对误差为 0.31/255。 + +| 文件 | 规格 | 字节 | SHA-256 | +| --- | --- | ---: | --- | +| `fairway-grass-source.png` | 1254 × 1254,原始 PNG | 3,553,813 | `41b8e023a074e0d4151c770e188f85099e2b5b5fc2413909b943777a84bd9119` | +| `public/assets/city-runtime/outskirts-grass-fairway.png` | 1200 × 1200,索引色 PNG | 1,395,988 | `6b2ad3cea44ebf4e5a01b5b16a80737b2f3925c9545ceb78ec94814006fdb116` | + +```text +Use case: stylized-concept. Asset type: a single seamless square raster texture for the ground of a detailed miniature isometric map. Render closely mown golf green turf in an exactly overhead orthographic view, flat and edge to edge. The grass has a single gentle grain running left to right across the entire sheet, like short turf laid in one direction by a roller. Use thousands of very short, fine blades, almost all leaning to the right, with subtle variations in length and random spacing. At a glance it should read as a calm, continuous lawn with a faint directional sheen. At full resolution tiny blades are visible. Soft diffuse daylight and harmonious medium spring greens, near #748950, with restrained local contrast and a quiet matte finish. The single grain must be visible without broad streaks or high-contrast mowing stripes. No alternating light and dark bands, ridges, lines of planting, long curled strands, crosshatching, bunches, clover, exposed dirt, pebbles, flowers, shadows from objects, paths, holes, boundaries, lettering or watermark. No camera tilt, vanishing point, patch silhouette, grid, or gutters. Make the left and right edges match and the top and bottom edges match for repeating use. Produce one full-bleed image at the highest available native square resolution. +``` diff --git a/docs/design/city-outskirts/v3/fairway-grass-source.png b/docs/design/city-outskirts/v3/fairway-grass-source.png new file mode 100644 index 0000000..4135a58 Binary files /dev/null and b/docs/design/city-outskirts/v3/fairway-grass-source.png differ diff --git a/docs/design/city-outskirts/v3/short-grass-runtime.png b/docs/design/city-outskirts/v3/short-grass-runtime.png new file mode 100644 index 0000000..be09770 Binary files /dev/null and b/docs/design/city-outskirts/v3/short-grass-runtime.png differ diff --git a/docs/design/city-outskirts/v3/short-grass-source.png b/docs/design/city-outskirts/v3/short-grass-source.png new file mode 100644 index 0000000..7c15978 Binary files /dev/null and b/docs/design/city-outskirts/v3/short-grass-source.png differ diff --git a/docs/design/city-transport/v5/README.md b/docs/design/city-transport/v5/README.md new file mode 100644 index 0000000..4b6e06d --- /dev/null +++ b/docs/design/city-transport/v5/README.md @@ -0,0 +1,16 @@ +# 外环和出城公路梁桥 + +2026-11-21 使用内置 ImageGen 根据文字制作。原画提供金属栏杆、浅色石缘、钢梁、混凝土桥墩和沥青质感。 + +| 文件 | 规格 | 字节 | SHA-256 | +| --- | --- | ---: | --- | +| `arterial-bridge-source.png` | 1774 × 887,原画 RGBA PNG | 1,742,198 | `c1c3457258ba6ba05f4f43355b9c92049568a1ca8b3e1a0eed433455e2544f8e` | +| `public/assets/city-runtime/transport-bridge-arterial.png` | 1440 × 1155,标定图集 PNG | 856,761 | `fd99ad00830d41ddd006c75e2477f42134b550ceec50ee3935755fcb8684afe8` | + +沿两侧真实台缘校正原画。由近端到远端,远侧取 `(43,682) → (1502,68)`,近侧取 `(267,784) → (1682,184)`。按纵向位置取样,并沿每列以台缘为纵坐标零点分别抽出栏杆和梁侧。两格各高 464 像素,台缘在格内第 112 像素。裁去近侧台缘以上的沥青色,保留栏杆间的空隙。独立桥墩取近侧校正后第 528 列起的 390 列,从台缘向下 125 像素起取 227 行。沥青灰度从原画 `(980,313)` 起取 96 × 96 像素,以 128 为中性。沥青和桥墩依次放在图集底行。运行标定见 `src/renderers/city-bridge-levels.json`。 + +四车道及八车道沿道路两侧和中心实测岸线定跨,分别把两个栏杆位图定位到车行面边缘。另一条地图轴使用水平镜像,岸线改变跨长时栏柱仍保持竖直。沥青纹理沿用公路的车道线,窄溪用单跨,足够宽的水段独立放中墩。 + +```text +Use case: stylized-concept. Asset type: production transparent isometric modern road bridge artwork for an original miniature contribution city. One isolated, straight concrete and steel highway girder bridge with precise orthographic 2:1 isometric projection. The straight road axis climbs on the screen from the close lower left end to the far upper right end at slope -0.5 in screen pixels, and the transverse end edges have slope +0.5. Only the bridge, tightly but fully framed, landscape aspect ratio, with comfortable transparent padding. A moderately broad roadway suited for a two-way multi-lane city arterial, bridge deck length about twice its driveable width. Keep the gray asphalt plane completely unmarked: the engine will put all lanes and road markings in. Both square road ends are clean and open to continue into real road segments. On both sides use finely painted warm light gray concrete wheel curbs and continuous low guardrails with distinct narrow posts and two softly weathered metal rails, well separated from the asphalt. A muted gray-green continuous girder on the visible front side and a short broad concrete center pier below, crisp vertical pier sides, small surface texture and rich but restrained highlights. Refined realistic architectural miniatures, matte finish, diffuse upper-left daylight, subdued coordinated warm concrete and desaturated gray-green steel. Single uninterrupted straight span, flat deck, straight parallel rail lines, bilateral geometry, no lamps, cars, signs, road stripes, land, ground slab, water, environment, frame, skyline, labels, or shadows detached from the bridge. Crisp model surfaces, no visible perspective convergence or cinematic view. Genuine transparent background. +``` diff --git a/docs/design/city-transport/v5/arterial-bridge-source.png b/docs/design/city-transport/v5/arterial-bridge-source.png new file mode 100644 index 0000000..a9e0279 Binary files /dev/null and b/docs/design/city-transport/v5/arterial-bridge-source.png differ diff --git a/docs/reports/CITY-ROADSIDE-REPOSITORY-LANDMARKS.md b/docs/reports/CITY-ROADSIDE-REPOSITORY-LANDMARKS.md new file mode 100644 index 0000000..38c25fe --- /dev/null +++ b/docs/reports/CITY-ROADSIDE-REPOSITORY-LANDMARKS.md @@ -0,0 +1,107 @@ +# 0.1.5 道路绿化与环外仓库地标 + +2026-11-21。基线是合入 0.1.4 的主干提交 `085aa52`。本轮试验使用现有树木和住宅素材。 + +## 复现 + +1. 运行 `npm ci` 和 `npm run build`。在 macOS Chrome 158.0.8127.36 的全新未登录配置加载 `dist/`。 +2. 打开 `https://github.com/wxy#codeyears-city?from=2017&to=2026`。等待日期范围和贡献合计出现。用同一日期范围打开保存的 0.1.4 构建做对照。 +3. 展开地图,点「全景」。检查左上角方向标、环外的住宅和装饰小村。直接悬停环外住宅,将鼠标移动到卡片上并滚动列表。检查键盘聚焦与 Esc。放大到河带,检查两岸的英文路名和道路两侧树列。 +4. 在新配置用 DevTools 阻断 `*://api.github.com/users/wxy/repos*`,检查贡献图仍可用以及「更多」中的提示。用 DevTools Fetch 分别提供 100 条与 5 条同一五年城区的公开仓库样本,首页带 `Link: ...; rel="next"`,复现分页。 +5. 运行 `python3 scripts/package-city.py --output-dir <临时目录>` 与 `python3 scripts/verify-city-package.py <临时目录>/codeyears-0.1.5-city.zip`。 + +## 实际结果 + +- 公开主页的 2017–2026 选区显示 55,943 次贡献,覆盖 2017-01-02 至 2026-11-21。0.1.4 的对照合计与覆盖日期相同。0.1.5 的三个地标分别列出 7、10 和 17 个公开仓库。抽查卡片名称和日期与 Chrome 收到的 GitHub 公开 REST 响应一致。观察到一页 HTTP 200 请求,未发送 Cookie 或 Authorization。 +- 三个住宅组各有五栋房屋。鼠标直接悬停房屋打开日期列表,静止图面没有年份牌。移入卡片仍可阅读,滚轮滚动列表时地图倍率保持原值。键盘聚焦同样打开卡片,Esc 先收起卡片并留在展开的地图中。阻断接口时只有仓库提示,贡献城市仍可用。两页受控数据共 105 条,在一个对应住宅组的卡片中完整出现。 +- 在 1440 × 1024 的全景中检查方向标、环外的三个住宅组和田野聚落。拉近到 295% 后,能同时读出 `10TH AVE N BANK` 和 `10TH AVE S BANK`,河岸和楼旁有连续植树,桥头和交叉口留空。 +- 通过 TypeScript、Vite 和发行包核验。ZIP 137 项,33,442,701 字节,SHA-256 为 `ce244d2e94b0e2bfad3712e8836600c5a08243ec387daaf62647d69aa797d4c5`。 + +本轮覆盖匿名公开主页的 Chrome 路径。Edge 与完整硬件性能预算另行验收。 + +## 11 月 21 日后续修订 + +### 引桥与布置 + +种植带加入后,原引桥每端离岸路实际车行边缘差 0.64 个世界单位,坡脚还沿用包含种植带的 2.48 格宽度。现从实际岸路边缘起坡,用 1.2 格两车道车幅接回路面。种植带内的宽冠树在直路沿轴密植,并让出实际引桥。仓库住宅沿外环直段按创建日期的公历年排列,密度高时缩小同年院落。没有同年可建直段时使用相邻可用路段,卡片继续标出实际年份。 + +### 复现与结果 + +1. 运行 `npm run build -- --outDir <系统临时目录>/dist` 和 `git diff --check`。通过独立 macOS Chrome 158 的 `Extensions.loadUnpacked` 加载这一构建,再在另一个未登录配置加载上一版 `fe6ceda`。 +2. 两个配置均访问 `https://github.com/wxy#codeyears-city?from=2017&to=2026`。等到贡献总数出现,再展开并全景复位。两版均显示 55,944 次贡献,区间为 2017-01-02–2026-11-21。新版 34 个公开仓库分为 34 组住宅,每组三栋。直接悬停住宅打开对应名称和日期,鼠标移开后收起。按钮聚焦也能打开,Esc 收起卡片并留在展开地图。浏览器未报告页面脚本异常。 +3. 核对浅色、深色罗盘。星形与字母在同一个 SVG 中旋转,背景透明,边框为 0。N 在右上,S 在左下,连接两字母中心的屏幕斜率约为 -0.5。把指针移到全景的河带桥面,滚轮放大至 299%,对照两版引桥边缘、树冠间距及桥口留空。 +4. 同一路径仅替换仓库接口响应,提供同一公历年 105 条仓库记录,首页 100 条并给出下一页链接,末页 5 条。其中一条日期为 2023-01-01,用来区分公历年与 ISO 周年。两页均读取,105 组住宅都能找到各自的卡片,全部标为 2023 年。 + +这轮浏览器验收使用已退出的 Chrome 配置。分页压力检查使用受控响应,画面检查覆盖公开主页与上述取景。Edge、登录态和完整硬件性能预算另行验收。 + +## 东西住宅、南北组织牌与外环桥 + +基线为 `1f7d176`。在同一张 2017–2026 公开城市上,基线将三个组织全部放入名录。住宅尚未加入时,牌位仍为零。用同一批候选位置临时排除路侧树后,三个组织均可落位。新版把南北两侧各划为四个组织牌席位,再裁去遮住牌面的路树。 + +使用 `npm run build -- --outDir <系统临时目录>/dist` 构建。以 macOS Chrome 158、1440 × 1024 视口和未登录的独立配置加载扩展。打开 `https://github.com/wxy#codeyears-city?from=2017&to=2026`,等待贡献合计并展开到全景。 + +- 实际显示 14 组上半年住宅在西侧、20 组下半年住宅在东侧。根据同一等轴测投影反解屏幕坐标,东西两侧的 X 范围分开。住宅悬停卡片和组织牌链接均可用。三个公开组织都出现在南北外环。贡献合计为 55,944,与基线一致。 +- 同一路径在主页资料卡增加九个测试组织,保留三个公开组织。南北各显示四块牌,剩余四个进入名录。将仓库接口替换为两页共 105 条记录,交替使用 `2023-06-30T23:59:59Z` 与 `2023-07-01T00:00:00Z`。53 组落在西侧、52 组在东侧,两页均被读取。 +- 全景下将指针移到两条城内河流各自的东西外环交点,滚轮放大到约 299%。四处均看见河道穿过环路后延伸到城外、同一车道轴上的八车道桥面、两侧护栏与桥墩。桥跨从真实岸线计算,归入原有静态地面缓存。 + +TypeScript、Vite 和差异格式检查通过。公开主页和受控边界输入分别验证,未覆盖登录态、Edge 和完整硬件预算。临时浏览器资料、截图和构建对照按本轮验收清理。 + +## 亮绿草地、外排住宅与南北端点 + +基线是 `679323e`。用 `npm run build -- --outDir <系统临时目录>/dist` 构建,分别在独立未登录的 Chrome 158 配置打开公开 `wxy` 主页的 2017–2026 城市,展开后使用全景和滚轮近景对照。另检查 2024–2026 的短年份范围。 + +- 草地在预处理原地纹时提亮、增绿,继续复用原图和细纹。城外增加三组细支流及末端小湖,水面、岸线和道路布置使用同一套水道几何。检查全景和约 299% 近景的河岸、外环桥与地纹。 +- 公开响应给出 12 个 2026 年创建的仓库,基线与新版均找到 12 组画布内住宅及对应卡片。在 53% 全景中,抽取各组首栋房屋的命中矩形,基线宽 0.4–1.3 像素,新版为 1.9–3.9 像素。近景看到基线小屋在路肩外、部分靠着树冠,新版保持房型原尺度并向路外展开。三年范围也保留 12 组,含 17 组全部年份住宅。 +- 以 2021–2023 的公历日生成完整贡献输入与每年只有前五个月非零的输入,通过正式有机布局查看南北出口。完整街区均沿中路 X=29.72 接出,短街区沿相邻纵路 X=14.24 接出。只将北端首年截短时,北侧缺失的第三、第四街区的牌位沿同一街区轴落在下一年露出的外环。 +- 打包构建的画布导出可读,公开页与短年份页面均无页面脚本异常。公开合计在先后对照之间增加一次贡献,本轮以每次读取的实际值为准。 +- 同一公开页受控加入 17 个组织,合计 20 个,并将仓库接口改为 105 条 2026 年公开记录,分两页、跨 6 月 30 日和 7 月 1 日。105 组住宅均排入同侧固定尺寸院落,组织牌显示 16 块。最后一个靠较窄南端的牌位沿同一街区向外错开。超额组织和「组织 +N」均不显示。 + +## 2025 年东侧出城路边的住宅 + +基线为 `f28376d`。执行 `npm run build -- --outDir <系统临时目录>/dist` 和 `git diff --check`。在 macOS Chrome 158.0.8127.36 的独立未登录配置加载扩展,打开 `https://github.com/wxy#codeyears-city?from=2017&to=2026`,展开并复位到全景。基线也检查 2024–2026 的地图。 + +- 两个年份范围的基线中,2025 年东侧的出城路与圆角合计占满当年外环的候选位置。地图把 2025-11-02 创建的公开仓库住宅排到了 2024 年东侧外环。新版将该组住宅放到 2025 年东侧出城路的北侧,沿路距离路口约 4.17 个世界单位。悬停房屋打开对应日期的卡片。 +- 在 2024–2026 地图上把仓库接口替换为 2025 年 6 月 30 日一条、7 月 1 日至 15 日每天一条、2026 年 10 月 19 日一条。用临时诊断构建记录院落位置。15 组下半年住宅先填满出城路两侧靠路的首排,再向路外加排。每组的三栋房屋维持原尺寸,地基均在路面外。6 月 30 日的一组仍在西侧外环。 +- 正式构建在浅、深色下实测罗盘路径与 N/S 均为纯白色,底部透明且无投影。浏览器未报页面脚本异常。本轮覆盖公开主页和上述受控场景,登录态与 Edge 未验收。 + +## 组织牌让开路树 + +沿用上节的构建和 Chrome 公开主页路径。全景对照基线和新版的南北外环,悬停组织牌并核对提示与组织链接。基线默认牌脚距车行边缘 0.95 格,三块牌落位时剔除了 13 棵路树。新版默认退到 2.3 格,按斜向牌体实际覆盖的范围判断前景树遮挡。正式构建仍可看到并悬停三块公开组织牌。 + +同一十年场景在资料卡追加 17 个组织链接。新版显示北侧八块、南侧八块,各牌距车行边缘 2.3–4.7 格。临时诊断构建记录到全部 2,833 棵路树均保留。通过 TypeScript、Vite 和差异格式检查。 + +## 高分辨率近景草地 + +基线为 `38e86f4`。旧版每格约 530 × 530 像素的地纹覆盖 27 个世界格,放大时叠加从同一图集提取并增强的 690 × 690 灰度纹。新版在城市初始化时解码一张独立的 1200 × 1200 细草 PNG,每 6 个世界格重复。按视口比例渐入,最高覆盖 90%,底图继续提供浅草、湿苔、碎石和偏干地块的颜色。取消运行时生成灰度纹的步骤。已有背景缓存负责绘制和平移刷新,纹理随城市素材释放。新增运行素材 1,418,596 字节,约增加 3.85 MB 的纹理画布像素容量,属于尺寸估算。 + +1. 用 `npm run build -- --outDir <系统临时目录>/dist` 构建,分别在独立未登录的 macOS Chrome 158.0.8127.36 配置加载基线和新版。以 1440 × 1024 视口打开 `https://github.com/wxy#codeyears-city?from=2018&to=2026`,等待合计,展开地图并复位到全景。 +2. 把全景宽度 45.5%、高度 77.5% 的草地拖到中心,分别放大到 299% 和最高 1,193%。在上限继续滚轮并平移,核对纹理与镜头一起移动、倍率保持,复位后回到 53% 全景。另用设备像素比 2 复验新版的上限取景,画布实际尺寸为 2097 × 1391。 +3. 两版均显示 54,035 次贡献。全景草地的 84 × 51 像素样本逐像素一致。最大倍率的同一份 540 × 360 像素草地样本以 8 像素半径高斯模糊后,其灰度标准差由 8.32 降至 1.85。视觉上大片深浅斑纹减弱,细草叶仍可辨。原地和平移后的取景未见明显接缝,浏览器无页面脚本异常。 + +TypeScript、Vite 和差异格式检查通过。以 `scripts/package-city.py --output-dir <系统临时目录>/package` 打包,并以 `scripts/verify-city-package.py <系统临时目录>/package/codeyears-0.1.5-city.zip` 核验 138 项共 34,866,817 字节,包含运行草地图。完整硬件性能预算与 Edge 未验收。本轮覆盖公开 Chrome 主页、不同像素比和画布导出。 + +### 单向短草对照 + +以 `c37b91a` 为基线,用同一 Chrome 版本、公开年份范围、视口、取景点和构建命令分别查看两版。新版加载 1200 × 1200 的球场式短草素材,两版均显示 54,035 次贡献。53% 全景抽查的 84 × 51 像素区域逐像素一致。1,193% 的 540 × 360 像素草地样本中,主草纹沿左上至右下的方向,灰度标准差由 12.47 降至 6.96。上限平移后再看,草叶方向一致,未见明显接缝。 + +TypeScript、Vite、差异格式检查与 138 项包体验证通过。新运行图为 1,395,988 字节,前一版运行图移到设计目录留作对照。本次仅覆盖公开 Chrome 的素材加载、取景和导出。 + +## 外环和城外公路的位图桥 + +基线为 `cac2819`。公开主页的十年地图中,基线有两处城外公路斜向跨水。两处路从同一水道截面的两侧采样点穿过,中心线恰好落在相邻截面的共边上。现在过水判定包含这条共边,出城路在岸上寻找沿地图轴向的两端落点。引桥附近只在干地圆滑转向。 + +1. 用 `npm run build -- --outDir <系统临时目录>/dist` 构建。在独立未登录的 macOS Chrome 158.0.8127.36 配置加载扩展,以 1440 × 1024 视口打开公开 `wxy` 主页。选择 2017–2026、2024–2026 和 2022–2025,展开并复位到全景。最后一组加载正式未加观测代码的构建,浏览器成功读取位图,画布可导出。 +2. 在临时诊断构建记录道路中心和左右缘的过水区间。十年地图显示四处八车道外环桥、五处四车道出城桥,三年地图显示三处四车道出城桥,记录到的过水直段都沿地图轴线。537% 查看外环与两种方向的出城桥,栏杆贴着原车行缘,车道线从桥头接续。窄溪钢梁落在两岸,宽跨的中墩可见于实测水段。 +3. 将临时 2022–2025 地图中的跨水外环车幅改为受控的四车道 1.6 格。四处外环桥同样按窄车幅放置,出城路沿用原车幅。此项只验证四车道外环与桥的接合。正式地图在该场景按原路网选择八车道外环。 + +TypeScript、Vite、差异格式检查和 139 项包体验证通过。新增图集 856,761 字节,解码后沿用原城市素材生命周期。外环桥随地面缓存,出城桥随可见道路重算,未增加帧调度。本轮覆盖指定公开地图与受控四车道外环,登录态、Edge 和完整硬件预算未验收。 + +## 主河两端的外环直段 + +以 `cb0c494` 为基线。用 `npm run build -- --outDir <系统临时目录>/dist` 构建,在 1440 × 1024 的独立未登录 Chrome 158.0.8127.36 配置打开公开 `wxy` 主页。选中对应年份后展开地图、复位至全景,并导出画布对照。 + +- 十年地图中,基线从相邻街区的河带端点开始计算弯道。较短的一条主河在东侧最外路缘处已偏离城内河轴约 3.56 格。新版以全城最外路缘为基准,在东、西两端各保留 14 格直段,再平滑转弯,支流汇口位于直段之外。 +- 临时诊断构建在 2017–2026 和 2022–2025 的六个河口,从外环路缘起每半格记录主河中心点,前 14 格横向偏移均为零,之后可见河湾。两组范围的 24 和 31 个道路中心或路缘过水区间均位于顺直路段。2022–2025 的第一次试排曾有一段不到 0.01 格的弯道路缘触水,增加 0.10 格岸边余量后复测通过。 +- 2024–2026 另用正式构建复核,城区无主河带时仍可打开城市、加载城外位图桥并导出画布。三个范围均无页面脚本异常。 + +TypeScript、Vite、差异格式检查与 139 项包体验证通过。本轮实测覆盖公开 Chrome 地图。 diff --git a/package-lock.json b/package-lock.json index 2a0b266..3931720 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "codeyears", - "version": "0.1.4", + "version": "0.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codeyears", - "version": "0.1.4", + "version": "0.1.5", "dependencies": { "three": "0.186.1" }, diff --git a/package.json b/package.json index 8925552..e8df3bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codeyears", - "version": "0.1.4", + "version": "0.1.5", "private": true, "license": "MIT", "description": "免费的 GitHub 贡献历史可视化浏览器扩展", diff --git a/popup.html b/popup.html index 5dfc4da..b0c29a6 100644 --- a/popup.html +++ b/popup.html @@ -26,7 +26,9 @@ body { margin: 0; inline-size: 350px; } main { padding: 16px; } h1 { margin: 0 0 14px; font-size: 19px; letter-spacing: -.02em; } - #profile-required { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; } + #profile-required, #site-access-hint { margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; } + #site-access-hint p { margin: 0 0 6px; } + #extension-details { min-block-size: 28px; color: var(--accent); } fieldset { margin: 0; min-inline-size: 0; padding: 0; border: 0; } #appearance, .language { margin-block-start: 14px; } legend { padding: 0; margin-block-end: 6px; font-weight: 600; } @@ -69,6 +71,10 @@

+
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index 23de4b4..27c1e41 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -1,4 +1,13 @@ { + "cityCompass": { + "message": "Map compass. North is upper right and south is lower left." + }, + "repositoryCreations": { + "message": "Public repository creations" + }, + "repositoryReadFailed": { + "message": "Could not load public repository creation dates from GitHub. Refresh to retry." + }, "extensionName": { "message": "CodeYears: GitHub Contribution City" }, @@ -135,7 +144,19 @@ "message": "Drag to pan and scroll to zoom. “Fit view” restores the full city. Data fills the field as it arrives; unavailable areas remain empty. Frame your view, then right-click the canvas and choose “Save image as…” or “Copy image”." }, "dataHelp": { - "message": "Your city uses the daily counts visible to your signed-in account on your own profile. Other cities show the public calendar, including any anonymous private counts their owners share. Dates shown beside the total follow complete ISO weeks. Missing dates are left unfilled." + "message": "Dates shown beside the total follow complete ISO weeks. Missing dates are left unfilled." + }, + "dataPrivacy": { + "message": "Data privacy" + }, + "privateContributionsOwner": { + "message": "When you view your own city, CodeYears verifies your GitHub session. Your totals include private contributions that GitHub shows to you." + }, + "privateContributionsVisitors": { + "message": "Visitors see the public contribution calendar. If the profile owner shares private contributions in GitHub’s contribution settings, visitors see the daily counts for those contributions. Repository names and activity details stay private." + }, + "repositoryCreationsPrivacy": { + "message": "Villages outside the ring road show creation dates for public repositories only. These records stay in the current page and do not count toward the city’s contribution total." }, "identityUnknown": { "message": "Identity unknown; cache is not used" @@ -200,6 +221,12 @@ "popupWrongPage": { "message": "Open a GitHub personal profile with a contribution calendar to change these settings." }, + "popupSiteAccess": { + "message": "To show the City tab automatically on GitHub profiles, turn on automatic access to github.com in extension details." + }, + "popupExtensionDetails": { + "message": "Open extension details" + }, "popupNotReady": { "message": "Retry after the contribution calendar has loaded on the GitHub profile." }, @@ -423,17 +450,35 @@ "message": "This exit has no destination yet" }, "emptyExitOwner": { - "message": "On your GitHub profile, choose Edit profile. In Bio, mention a friend by their GitHub username, such as @octocat, then save. Exits follow the order of the mentions in your bio." + "message": "On your GitHub profile, choose Edit profile, mention a friend in your bio, then save. Exits follow the order of your mentions." }, "emptyExitVisitor": { - "message": "These exits come from @$1’s profile bio. To connect a friend’s city to your own, mention their GitHub username in your own bio, for example @octocat." + "message": "These exits come from @$1’s profile bio. To connect a friend’s city to yours, mention them in your own bio." + }, + "bioExamplesHint": { + "message": "Copy a line to your bio. Replace @username with the person’s GitHub username and keep the @." + }, + "bioExampleCollaborator": { + "message": "I collaborate with $1" + }, + "bioExampleFriend": { + "message": "My friend $1" + }, + "bioExampleOpenSource": { + "message": "I work on open source with $1" + }, + "copyBioExample": { + "message": "Copy" + }, + "bioExampleCopied": { + "message": "Copied" + }, + "bioExampleCopyFailed": { + "message": "Couldn’t copy. Select the example to copy it manually." }, "closeRoadInfo": { "message": "Close road sign details" }, - "cityOrganizations": { - "message": "Organizations" - }, "cityName": { "message": "@$1’s city" }, diff --git a/public/_locales/zh_CN/messages.json b/public/_locales/zh_CN/messages.json index d1bf223..2a23e89 100644 --- a/public/_locales/zh_CN/messages.json +++ b/public/_locales/zh_CN/messages.json @@ -1,4 +1,13 @@ { + "cityCompass": { + "message": "地图方向标。右上方为北,左下方为南。" + }, + "repositoryCreations": { + "message": "公开仓库创建记录" + }, + "repositoryReadFailed": { + "message": "暂时无法从 GitHub 读取公开仓库创建日期。可刷新重试。" + }, "extensionName": { "message": "CodeYears:GitHub 贡献之城" }, @@ -135,7 +144,19 @@ "message": "拖动平移,滚轮缩放。“全景”恢复完整取景。场地随已读取的数据逐步填入,未返回的区域保持待填充。调整好画面后,在图上右键选择“图片存储为…”或“复制图片”。" }, "dataHelp": { - "message": "本人城市使用 GitHub 当前向你显示的每日贡献。其他城市使用公开日历,包含对方主动公开的匿名私有贡献数。合计旁显示按完整周选取的实际日期,缺失日期留空。" + "message": "合计旁显示按完整周选取的实际日期,缺失日期留空。" + }, + "dataPrivacy": { + "message": "数据隐私" + }, + "privateContributionsOwner": { + "message": "看自己的城市时,扩展会核对 GitHub 登录身份。城市合计包括 GitHub 向本人显示的私有贡献。" + }, + "privateContributionsVisitors": { + "message": "访客看到的是公开贡献日历。如果主页主人在 GitHub 贡献设置中公开了私有贡献,访客也会看到这部分的每日数量,仓库名称和详情仍然保密。" + }, + "repositoryCreationsPrivacy": { + "message": "环外村庄只展示公开仓库的创建日期,记录仅在此次页面内使用。创建仓库不计入城市贡献。" }, "identityUnknown": { "message": "身份未识别,本次不读写缓存" @@ -200,6 +221,12 @@ "popupWrongPage": { "message": "请在 GitHub 个人主页的贡献区打开这些设置。" }, + "popupSiteAccess": { + "message": "要让城市页签随 GitHub 个人主页自动出现,请在扩展详情的「自动允许访问以下网站」下开启 github.com。" + }, + "popupExtensionDetails": { + "message": "打开扩展详情" + }, "popupNotReady": { "message": "请在 GitHub 个人主页的贡献日历加载完成后重试。" }, @@ -423,17 +450,35 @@ "message": "这个出口还没有目的地" }, "emptyExitOwner": { - "message": "在你的 GitHub 主页选择「Edit profile」,在个人简介(Bio)中用 @ 提及朋友的 GitHub 用户名,例如 @octocat,然后保存。对方的城市就会按提及顺序出现在出口牌上。" + "message": "在你的 GitHub 主页选择「Edit profile」,在个人简介(Bio)中提及朋友并保存。对方的城市会按提及顺序出现在出口牌上。" }, "emptyExitVisitor": { - "message": "这里的出口取自 @$1 的个人简介(Bio)。想在你自己的城市连接朋友,可以在自己的 Bio 中写上对方的 GitHub 用户名,例如 @octocat。" + "message": "这里的出口取自 @$1 的个人简介(Bio)。想在自己的城市连接朋友,可以在你自己的 Bio 中提及对方。" + }, + "bioExamplesHint": { + "message": "复制一句到你的 Bio,把 @username 换成对方的 GitHub 用户名,保留 @。" + }, + "bioExampleCollaborator": { + "message": "我的合作伙伴 $1" + }, + "bioExampleFriend": { + "message": "我的朋友 $1" + }, + "bioExampleOpenSource": { + "message": "我和 $1 一起做开源" + }, + "copyBioExample": { + "message": "复制" + }, + "bioExampleCopied": { + "message": "已复制" + }, + "bioExampleCopyFailed": { + "message": "无法自动复制,请选中句式手动复制。" }, "closeRoadInfo": { "message": "关闭路牌说明" }, - "cityOrganizations": { - "message": "组织" - }, "cityName": { "message": "@$1 的城市" }, diff --git a/public/assets/city-runtime/outskirts-grass-fairway.png b/public/assets/city-runtime/outskirts-grass-fairway.png new file mode 100644 index 0000000..31066f3 Binary files /dev/null and b/public/assets/city-runtime/outskirts-grass-fairway.png differ diff --git a/public/assets/city-runtime/transport-bridge-arterial.png b/public/assets/city-runtime/transport-bridge-arterial.png new file mode 100644 index 0000000..980fe56 Binary files /dev/null and b/public/assets/city-runtime/transport-bridge-arterial.png differ diff --git a/public/manifest.json b/public/manifest.json index ae4bb18..c134a6f 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "__MSG_extensionName__", - "version": "0.1.4", + "version": "0.1.5", "default_locale": "en", "description": "__MSG_extensionDescription__", "permissions": ["activeTab", "scripting", "storage"], diff --git a/src/data/repository-creations.ts b/src/data/repository-creations.ts new file mode 100644 index 0000000..9a2503f --- /dev/null +++ b/src/data/repository-creations.ts @@ -0,0 +1,28 @@ +export interface RepositoryCreation { + name: string; + date: string; +} + +/** Public metadata for the profile being viewed, independent of the visitor's GitHub session. */ +export async function loadRepositoryCreations(login: string, signal: AbortSignal): Promise { + const url = new URL(`https://api.github.com/users/${encodeURIComponent(login)}/repos`); + url.search = 'type=owner&sort=created&direction=desc&per_page=100'; + const creations = new Map(); + for (let page = 1; ; page++) { + url.searchParams.set('page', String(page)); + const response = await fetch(url, { + credentials: 'omit', signal, headers: { Accept: 'application/vnd.github+json' }, + }); + if (!response.ok) throw new Error(`Repository metadata: HTTP ${response.status}`); + const entries: unknown = await response.json(); + if (!Array.isArray(entries)) throw new Error('Repository metadata: invalid list'); + for (const repo of entries) { + if (typeof repo?.name !== 'string' || typeof repo.created_at !== 'string') continue; + const created = Date.parse(repo.created_at); + if (!Number.isFinite(created)) continue; + creations.set(repo.name.toLowerCase(), { name: repo.name, date: new Date(created).toISOString().slice(0, 10) }); + } + if (!response.headers.get('link')?.includes('rel="next"')) break; + } + return [...creations.values()]; +} diff --git a/src/extension/city-hover.ts b/src/extension/city-hover.ts index 6c30661..d3c4a5f 100644 --- a/src/extension/city-hover.ts +++ b/src/extension/city-hover.ts @@ -150,7 +150,7 @@ export function createCityHover(host:HTMLElement,options:{ let touch:{id:number;x:number;y:number}|undefined; const down=(event:PointerEvent)=>{ hide();touch=undefined; - if(event.pointerType==='touch'&&event.isPrimary&&!(event.target instanceof Element&&event.target.closest('a,button,.city-organization-layer'))){ + if(event.pointerType==='touch'&&event.isPrimary&&!(event.target instanceof Element&&event.target.closest('a,button,.city-organization-layer,.repository-site'))){ touch={id:event.pointerId,x:event.clientX,y:event.clientY}; } }; @@ -159,7 +159,7 @@ export function createCityHover(host:HTMLElement,options:{ if(touch?.id===event.pointerId&&Math.hypot(event.clientX-touch.x,event.clientY-touch.y)>6)touch=undefined; return; } - if(event.buttons || event.target instanceof Element && event.target.closest('.city-organization-layer')){hide();return} + if(event.buttons || event.target instanceof Element && event.target.closest('.city-organization-layer,.repository-site')){hide();return} const rect=host.getBoundingClientRect(); card.removeAttribute('aria-live');select(event.clientX-rect.left,event.clientY-rect.top,false); }; diff --git a/src/extension/city-roads.ts b/src/extension/city-roads.ts index daf67c4..c969aa3 100644 --- a/src/extension/city-roads.ts +++ b/src/extension/city-roads.ts @@ -20,11 +20,23 @@ export function createCityRoads(host: HTMLElement, options: RoadOptions) { host.innerHTML = ``; const closeButton = host.querySelector('button')!, list = host.querySelector('ul')!; const heading = host.querySelector('h3')!, note = host.querySelector('p')!; + const examples = host.querySelector('.bio-examples')!; + const exampleList = examples.querySelector('ul')!, copyStatus = examples.querySelector('.copy-status')!; + let copyTimeout: number | undefined; + function clearCopyStatus() { + window.clearTimeout(copyTimeout); + copyStatus.textContent = ''; + } function close(restoreFocus = false) { host.hidden = true; + clearCopyStatus(); if (restoreFocus) opener?.focus({ preventScroll: true }); opener = undefined; } @@ -66,8 +78,23 @@ export function createCityRoads(host: HTMLElement, options: RoadOptions) { return row; })); const language = options.language(); + examples.hidden = true; showPanel(anchor, text(language, 'returnRoadHeading'), text(language, 'returnRoadLocal')); } + async function copyBioExample(value: string) { + clearCopyStatus(); + try { + await navigator.clipboard.writeText(value); + copyStatus.textContent = text(options.language(), 'bioExampleCopied'); + } catch { + copyStatus.textContent = text(options.language(), 'bioExampleCopyFailed'); + } + copyTimeout = window.setTimeout(clearCopyStatus, 3000); + } + exampleList.addEventListener('command', event => { + if ((event as CommandEvent).command === '--copy') void copyBioExample((event.target as HTMLElement).textContent!); + }, { capture: true, signal }); + function emptyExit(slot: number): CityRoadControl { const sign = document.createElement('button'); sign.type = 'button'; @@ -80,6 +107,23 @@ export function createCityRoads(host: HTMLElement, options: RoadOptions) { const context = options.currentContext(), language = options.language(); const hint = isProfileOwner(context) ? 'emptyExitOwner' : 'emptyExitVisitor'; list.replaceChildren(); + const phrases = ['bioExampleCollaborator', 'bioExampleFriend', 'bioExampleOpenSource'] as const; + exampleList.replaceChildren(...phrases.map((phrase, index) => { + const row = document.createElement('li'); + const example = document.createElement('span'); + example.id = `road-bio-example-${index}`; + example.textContent = text(language, phrase, ['@username']); + const copy = document.createElement('button'); + copy.type = 'button'; + copy.textContent = text(language, 'copyBioExample'); + copy.setAttribute('aria-describedby', example.id); + copy.setAttribute('command', '--copy'); + copy.setAttribute('commandfor', example.id); + if (!('CommandEvent' in window)) copy.onclick = () => { void copyBioExample(example.textContent!); }; + row.append(example, copy); + return row; + })); + examples.hidden = false; showPanel(sign, text(language, 'emptyExitHeading'), text(language, hint, [context.profileLogin])); }; return { sign, label: '', returning: false }; @@ -149,5 +193,5 @@ export function createCityRoads(host: HTMLElement, options: RoadOptions) { exitCount = count; refresh(mentions); }, - dispose() { lifetime.abort(); host.replaceChildren(); } }; + dispose() { clearCopyStatus(); lifetime.abort(); host.replaceChildren(); } }; } diff --git a/src/extension/content.ts b/src/extension/content.ts index 5ed90e3..2b7537f 100644 --- a/src/extension/content.ts +++ b/src/extension/content.ts @@ -9,6 +9,7 @@ import { isProfileOwner } from "../platform/github/types"; import { clearContributionCache, confirmViewer, sameContext, ViewerChangedError } from "../platform/github/load-year"; import { loadContributionHistory } from "../platform/github/load-history"; import { isoYearStart } from "../data/iso-week"; +import { loadRepositoryCreations, type RepositoryCreation } from "../data/repository-creations"; import type { ContributionLandscape } from "../renderers/landscape"; import type { DailyContribution } from "../data/types"; @@ -51,6 +52,22 @@ export function mountCityPanel(host: HTMLElement, toolbarHost: HTMLElement, sett .scene-wrap { position:relative; height:340px; min-height:260px; } #scene { position:relative; width:100%; height:100%; background:transparent; } #scene:focus-visible { outline:3px solid #268f80; outline-offset:-3px; border-radius:6px; } + .compass { position:absolute; z-index:1; top:10px; left:10px; width:56px; height:56px; color:#fff; pointer-events:none; } + /* The map projects north (negative Z) toward the upper right at 26.565° above horizontal. */ + .compass > svg { display:block; width:100%; height:100%; fill:currentColor; rotate:63.435deg; transform-origin:center; } + .compass text { font:600 10px system-ui,sans-serif; text-anchor:middle; dominant-baseline:central; } + .repository-sites { position:absolute; z-index:2; inset:0; overflow:hidden; pointer-events:none; } + .repository-site { position:absolute; pointer-events:none; } + .repository-site[data-open] { pointer-events:auto; } + .repository-site button { position:relative; display:block; width:100%; height:100%; border:0; padding:0; background:transparent; pointer-events:none; } + .repository-site button:active { transform:none; } + .repository-house { position:absolute; pointer-events:auto; cursor:pointer; } + .repository-site:focus-within,.repository-site:hover { z-index:1; } + .repository-card { position:absolute; top:100%; padding:10px 12px; overflow:auto; overscroll-behavior:contain; touch-action:pan-y; cursor:auto; border:1px solid var(--borderColor-default,#d1d9e0); border-radius:8px; background:var(--bgColor-default,#fff); box-shadow:0 6px 24px #0003; font-size:12px; } + .repository-site[data-above] .repository-card { top:auto; bottom:100%; } + .repository-card ul { list-style:none; padding:0; margin:5px 0 0; } + .repository-card li { display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding:3px 0; overflow-wrap:anywhere; } + .repository-card time { flex:none; color:var(--fgColor-muted,#59636e); font-variant-numeric:tabular-nums; } .building-hover { position:absolute; z-index:4; pointer-events:none; width:max-content; max-width:min(340px,calc(100% - 16px)); overflow:hidden; margin:0; padding:11px 13px; border:1px solid var(--borderColor-default,#d1d9e0); border-radius:10px; background:color-mix(in srgb,var(--bgColor-default,#fff) 78%,transparent); backdrop-filter:blur(6px); box-shadow:0 6px 24px #0002; font-size:12px; line-height:1.65; overflow-wrap:anywhere; opacity:0; transition:opacity 90ms ease-out; } .building-hover[data-open] { opacity:1; transition-duration:120ms; } .building-hover-note { color:var(--fgColor-muted,#59636e); font-size:11px; } @@ -76,9 +93,13 @@ export function mountCityPanel(host: HTMLElement, toolbarHost: HTMLElement, sett #road-returns { position:absolute; z-index:5; width:320px; max-width:calc(100% - 16px); max-height:calc(100% - 16px); overflow:auto; padding:14px; border:1px solid var(--borderColor-default,#d1d9e0); border-radius:10px; background:var(--bgColor-default,#fff); box-shadow:0 8px 24px #0002; } #road-returns header { display:flex; align-items:center; justify-content:space-between; gap:8px; } #road-returns h3 { margin:0; font-size:13px; } #road-returns p { margin:10px 0 0; } - #road-returns button { border:0; background:transparent; padding:0 4px; font-size:20px; line-height:1; } + #road-returns header button { border:0; background:transparent; padding:0 4px; font-size:20px; line-height:1; } #road-returns ul { list-style:none; margin:6px 0; padding:0; overflow-wrap:anywhere; } #road-returns li { padding:5px 0; } #road-returns a { color:var(--fgColor-accent,#0969da); text-decoration:none; } #road-returns a:hover { text-decoration:underline; } + #road-returns .bio-examples li { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; } + #road-returns .bio-examples span { user-select:text; } + #road-returns .bio-examples button { min-inline-size:24px; min-block-size:24px; } + #road-returns .copy-status { margin:0; min-height:1.6em; } .language { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; padding-bottom:12px; border-bottom:1px solid var(--borderColor-default,#d1d9e0); } .more-panel h3 { margin:0 0 8px; font-size:12px; font-weight:600; } .more-section + .more-section { margin-top:12px; padding-top:12px; border-top:1px solid var(--borderColor-default,#d1d9e0); } @@ -100,6 +121,15 @@ export function mountCityPanel(host: HTMLElement, toolbarHost: HTMLElement, sett
+