drive 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7864c84eb75ad2394534293c1a9f3232eaff9b7a69352d84d8e64605aba56ca
4
- data.tar.gz: 6545371dbd8af274b39307dc8139b1cb21ad76f49f4ef15a0ff7478b791eb8fe
3
+ metadata.gz: 6fa008cabe7c5bc9f8e34113911f8ced5cbb45ae333256c0b5344da28f734c9e
4
+ data.tar.gz: a1baf2a48a873cd708723660cae6737dc76fe2c4dab3bef404b0763c6a267162
5
5
  SHA512:
6
- metadata.gz: fc337a89d407e9b9ac35ae10febdffb7d202a056bf6403f6533e0cc289965917b74543fa625ee56a15718a9c0ddd818f03fc1fd7cca9cd02e139cf077033aaf9
7
- data.tar.gz: 3d3b30536d3427158fd118908f8b9ab98f82e3a876d835cb7f62846c1c250bbda0e9a4c680f890de1c79d8ec30f66eb01a08f5ee13b30afbe1d88498c14af057
6
+ metadata.gz: 198e74f24bf24952331f9b4a851e85feaf7e18b2d616048607d43908b1c1526e1f12c25e28739975030ab677078f496cb44b4b2d75df6ef08f43a73dbfa28c5a
7
+ data.tar.gz: 1b606b86c1855d367a71aca17e4be91c3c2144ff32994ceedd5f4417f25e5bc45c3c185dcacad18494d04c219d4650343a8ed17264b80aa9d63578b741d015d8
data/CHANGELOG.md CHANGED
@@ -6,6 +6,33 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 0.8.0 - 2026-11-06
10
+
11
+ * [FEATURE] The easy design system's components, in `easy/components`, which `layouts/easy/site` loads after
12
+ the layout: pills, notes (`note bad`, `note warn`, `note info`, `small-note`), the share bar, the plane card,
13
+ switches, list tools, part tabs, AD cards and their chips, the sign-in modal, tooltips, the pin code, the
14
+ search hero and field, results, latest lists, bands, columns, placeholder bars and step cards. States are
15
+ `is-on`, `is-off`, `is-open`. The dummy app's `/guide` shows every token and component with its markup.
16
+
17
+ * [FEATURE] The easy design system's tokens, base and layout, which every easy app draws its pages with
18
+
19
+ `stylesheet_link_tag "easy/tokens", "easy/base", "easy/layout"` (the colours light and dark,
20
+ Outfit, the reset and utilities, the header, sky band, page and footer), and
21
+ `layouts/easy/site`, which an app's own layout fills with `content_for` (`:easy_head`,
22
+ `:easy_stylesheets`, `:body_class`, `:site_brand_url`, `:site_brand`, `:site_nav`, `:sky_band`,
23
+ `:site_footer`, `:body_end`) and then renders. `easy_icon` and `easy_icon_href` draw the icons of
24
+ one shared sprite, `easy/sprite.svg`.
25
+
26
+ ## 0.7.0 - 2026-10-16
27
+
28
+ * [BREAKING] `Mirrored`, `Counted`, `Run`, `AccessFile` and `Drive::TestHelper` are the `mirroring` gem's
29
+
30
+ An app that mirrors adds `gem 'mirroring'` and declares each mirrored model with
31
+ `mirroring key: :code` (`key: false` where the source names none) in place of `include Mirrored`
32
+ and `KEY`, and includes `Mirroring::TestHelper` in its tests. `Run.record`, `mirror`,
33
+ `include Counted` and `AccessFile` keep their names. Drive no longer needs PostgreSQL, nor ships
34
+ the migrations of runs: an app keeps the `runs` table it has.
35
+
9
36
  ## 0.6.0 - 2026-10-09
10
37
 
11
38
  * [BREAKING] `include RateLimited` sets no limit by itself: a controller calls `rate_limited`
data/README.md CHANGED
@@ -1,15 +1,9 @@
1
1
  # Drive
2
2
 
3
- A Rails engine for the easyFAA apps. Each keeps a copy of what the FAA or the NTSB publishes,
4
- changing only the rows the source did and counting them, and each sits behind Cloudflare and
5
- shows the same error pages.
3
+ A Rails engine for the easyFAA apps. Each sits behind Cloudflare and shows the same error pages.
4
+ A copy of the tables a source publishes is the [`mirroring`](https://github.com/easyfaa/mirroring)
5
+ gem's.
6
6
 
7
- - **`Mirrored`**: a table copying one of the source's tables field for field, as text. A refresh
8
- stages the source's table, then inserts, updates and deletes only the rows the source did.
9
- - **`Counted`**: a table written a record at a time, such as a document fetched by URL.
10
- - **`Run`**: one refresh, in one transaction, the only one running, with how many rows it
11
- inserted, updated and deleted.
12
- - **`AccessFile`**: stages a table of a Microsoft Access file, read with `mdb-export`.
13
7
  - **`RateLimited`**: `rate_limited` holds an address to 20 pages a minute and 200 a day, or the
14
8
  app's own limits, and tells it so in words. A search engine's own crawler has no limit.
15
9
  - **`Crawler`**: whether a request comes from a search engine's crawler: Cloudflare vouches for
@@ -21,8 +15,6 @@ shows the same error pages.
21
15
  - **`NNumber`**, **`Designation`**, **`Serial`**: an N-number, a designation's key and a serial
22
16
  number, as every app reads them.
23
17
 
24
- It needs PostgreSQL.
25
-
26
18
  ## How to install
27
19
 
28
20
  ```bash
@@ -31,55 +23,10 @@ gem install drive
31
23
 
32
24
  ```ruby
33
25
  # Gemfile
34
- gem 'drive', '~> 0.6.0'
35
- ```
36
-
37
- `~> 0.6.0` takes every 0.6.x and stops short of 0.7, which may break what 0.6 does.
38
-
39
- Then copy its migrations, of runs, and run them:
40
-
41
- ```bash
42
- bin/rails drive:install:migrations db:migrate
43
- ```
44
-
45
- ## How to use
46
-
47
- A mirrored table has the source's fields as text columns, plus `source`, `row_key` and
48
- `row_hash`, unique on `source` and `row_key`. Its model says which fields tell a row apart:
49
-
50
- ```ruby
51
- class Engine < ApplicationRecord
52
- include Mirrored
53
-
54
- KEY = %w[code].freeze # [] where the source names none: a row is then told apart by all it says
55
- end
26
+ gem 'drive', '~> 0.7.0'
56
27
  ```
57
28
 
58
- A refresh stages the source's table and mirrors it, inside a run:
59
-
60
- ```ruby
61
- Run.record 'engines' do
62
- staged = AccessFile.new('ENGINE.accdb').stage('ENGINE', Engine.connection)
63
- Engine.mirror staged, source: 'ENGINE'
64
- end
65
- ```
66
-
67
- A table written a record at a time counts each save and delete in the run at hand:
68
-
69
- ```ruby
70
- class Publication < ApplicationRecord
71
- include Counted
72
- end
73
- ```
74
-
75
- Runs commit one at a time, so another app reading the tables directly sees either the last
76
- run's rows or the one before's, never a mix.
77
-
78
- In tests, `Drive::TestHelper#stage` stages rows as a source's file would:
79
-
80
- ```ruby
81
- ActiveSupport.on_load(:active_support_test_case) { include Drive::TestHelper }
82
- ```
29
+ `~> 0.7.0` takes every 0.7.x and stops short of 0.8, which may break what 0.7 does.
83
30
 
84
31
  ## Development
85
32
 
@@ -0,0 +1,27 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <symbol id="i-check" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8" fill="currentColor"/><path d="M4.5 8.2l2.3 2.3 4.7-4.9" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></symbol>
3
+ <symbol id="i-applies" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8" fill="currentColor"/><path d="M8 4.2v4.6" stroke="#fff" stroke-width="2" stroke-linecap="round"/><circle cx="8" cy="11.6" r="1.2" fill="#fff"/></symbol>
4
+ <symbol id="i-maybe" viewBox="0 0 16 16"><circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="2"/><path d="M8 4.2v4.6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="8" cy="11.6" r="1.2" fill="currentColor"/></symbol>
5
+ <symbol id="i-none" viewBox="0 0 16 16"><circle cx="8" cy="8" r="7" fill="none" stroke="currentColor" stroke-width="2"/><path d="M4.8 8h6.4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></symbol>
6
+ <symbol id="i-alert" viewBox="0 0 16 16"><path d="M8 1.6L14.8 13.8H1.2Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"/><path d="M8 6v3.6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="8" cy="11.6" r="1" fill="currentColor"/></symbol>
7
+ <symbol id="i-superseded" viewBox="0 0 16 16"><path d="M3.5 1.75h5.75l3.25 3.25v9.25h-9z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><path d="M9.25 1.75v3.25h3.25" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/><path d="M1.5 14.5L14.5 1.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></symbol>
8
+ <symbol id="i-engine" viewBox="0 0 24 24"><path fill="currentColor" d="M7 4v2h3v2H7l-2 2v3H3v-3H1v8h2v-3h2v3h3l2 2h8v-4h2v3h3V9h-3v3h-2V8h-6V6h3V4z"/></symbol>
9
+ <symbol id="i-propeller" viewBox="0 0 16 16"><g fill="currentColor"><path d="M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z"/><path d="M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z" transform="rotate(120 8 8)"/><path d="M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z" transform="rotate(240 8 8)"/><circle cx="8" cy="8" r="2.1"/></g></symbol>
10
+ <symbol id="i-appliance" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M13.07 6.45L15.31 6.84L15.31 9.16L13.07 9.55L12.68 10.49L13.99 12.35L12.35 13.99L10.49 12.68L9.55 13.07L9.16 15.31L6.84 15.31L6.45 13.07L5.51 12.68L3.65 13.99L2.01 12.35L3.32 10.49L2.93 9.55L0.69 9.16L0.69 6.84L2.93 6.45L3.32 5.51L2.01 3.65L3.65 2.01L5.51 3.32L6.45 2.93L6.84 0.69L9.16 0.69L9.55 2.93L10.49 3.32L12.35 2.01L13.99 3.65L12.68 5.51Z M8 5.6a2.4 2.4 0 1 0 0 4.8a2.4 2.4 0 1 0 0-4.8Z"/></symbol>
11
+ <symbol id="i-newest" viewBox="0 0 16 16"><path d="M4 2.5v10M1.5 10l2.5 2.5L6.5 10M9 4h5.5M9 7.5h4M9 11h2.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></symbol>
12
+ <symbol id="i-oldest" viewBox="0 0 16 16"><path d="M4 13.5v-10M1.5 6L4 3.5 6.5 6M9 4h2.5M9 7.5h4M9 11h5.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></symbol>
13
+ <symbol id="i-search" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="6.5" fill="none" stroke="currentColor" stroke-width="2.4"/><path d="M15.5 15.5l5 5" stroke="currentColor" stroke-width="2.4" stroke-linecap="round"/></symbol>
14
+ <symbol id="i-bookmark" viewBox="0 0 16 16"><path d="M4 1.5h8a.5.5 0 0 1 .5.5v12.3L8 11.2l-4.5 3.1V2a.5.5 0 0 1 .5-.5z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></symbol>
15
+ <symbol id="i-share" viewBox="0 0 16 16"><circle cx="12" cy="3.5" r="2" fill="none" stroke="currentColor" stroke-width="1.5"/><circle cx="4" cy="8" r="2" fill="none" stroke="currentColor" stroke-width="1.5"/><circle cx="12" cy="12.5" r="2" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M5.8 7l4.4-2.5M5.8 9l4.4 2.5" stroke="currentColor" stroke-width="1.5"/></symbol>
16
+ <symbol id="i-link" viewBox="0 0 16 16"><path d="M6.6 9.4l2.8-2.8M7 4.6l1.2-1.2a2.8 2.8 0 0 1 4 4L11 8.6M9 11.4l-1.2 1.2a2.8 2.8 0 0 1-4-4L5 7.4" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></symbol>
17
+ <symbol id="i-out" viewBox="0 0 16 16"><path d="M9 2.5h4.5V7M13.5 2.5L7.5 8.5M11.5 9.5v3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h3" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></symbol>
18
+ <symbol id="i-sun" viewBox="0 0 16 16"><circle cx="8" cy="8" r="3.2" fill="currentColor"/><path d="M8 .8v2M8 13.2v2M.8 8h2M13.2 8h2M2.9 2.9l1.4 1.4M11.7 11.7l1.4 1.4M2.9 13.1l1.4-1.4M11.7 4.3l1.4-1.4" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></symbol>
19
+ <symbol id="i-moon" viewBox="0 0 16 16"><path d="M13.5 10.2A6 6 0 0 1 5.8 2.5a6 6 0 1 0 7.7 7.7z" fill="currentColor"/></symbol>
20
+ <symbol id="i-plane" viewBox="0 0 24 24"><path d="M21 15.5v-2l-8-5V3.2a1.5 1.5 0 0 0-3 0V8.5l-8 5v2l8-2.5v5.2l-2 1.5V21l3.5-1 3.5 1v-1.3l-2-1.5V13z" fill="currentColor"/></symbol>
21
+ <symbol id="s-x" viewBox="0 0 24 24"><path fill="currentColor" d="M17.8 3h3.1l-6.8 7.8L22 21h-6.2l-4.9-6.4L5.3 21H2.2l7.3-8.3L1.9 3h6.3l4.4 5.9zm-1.1 16.2h1.7L7.4 4.7H5.6z"/></symbol>
22
+ <symbol id="s-fb" viewBox="0 0 24 24"><path fill="currentColor" d="M13.6 22v-8.2h2.8l.4-3.3h-3.2V8.4c0-.9.3-1.6 1.6-1.6h1.7V3.9c-.3 0-1.3-.1-2.5-.1-2.5 0-4.2 1.5-4.2 4.3v2.4H7.4v3.3h2.8V22z"/></symbol>
23
+ <symbol id="s-li" viewBox="0 0 24 24"><path fill="currentColor" d="M3.6 8.6h3.7V20.5H3.6zM5.45 2.8a2.15 2.15 0 110 4.3 2.15 2.15 0 010-4.3zM9.6 8.6h3.5v1.6h.1c.5-.9 1.7-1.9 3.5-1.9 3.8 0 4.5 2.5 4.5 5.7v6.5h-3.7v-5.8c0-1.4 0-3.2-1.9-3.2s-2.3 1.5-2.3 3.1v5.9H9.6z"/></symbol>
24
+ <symbol id="s-rd" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M19.7 5.3a1.6 1.6 0 11-1.5 2l-3.3-.7-1 4.4c2.2.1 4.2.8 5.6 1.9a2.2 2.2 0 113 3 4.3 4.3 0 010 .6c0 3.4-4 6.1-8.5 6.1S5.5 19.9 5.5 16.5v-.6a2.2 2.2 0 113-3c1.4-1 3.3-1.7 5.4-1.8l1.2-5.3 4 .9a1.6 1.6 0 01.6-1.4zM9.3 14.2a1.4 1.4 0 100 2.8 1.4 1.4 0 000-2.8zm5.4 0a1.4 1.4 0 100 2.8 1.4 1.4 0 000-2.8zm-5.2 4.3a.5.5 0 00-.3.9c.9.7 2 1 2.8 1s1.9-.3 2.8-1a.5.5 0 10-.6-.8c-.6.5-1.4.8-2.2.8s-1.6-.3-2.2-.8a.5.5 0 00-.3-.1z"/></symbol>
25
+ <symbol id="s-wa" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2a10 10 0 00-8.6 15.1L2 22l5-1.3A10 10 0 1012 2zm0 1.8a8.2 8.2 0 11-4.2 15.3l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 0112 3.8zM8.6 7.2c-.2 0-.5 0-.8.3-.3.3-1 1-1 2.5s1.1 2.9 1.2 3.1c.2.2 2.1 3.3 5.2 4.5 2.6 1 3.1.8 3.7.8.6-.1 1.8-.7 2-1.5.3-.7.3-1.3.2-1.5l-.6-.4-2-1c-.3-.1-.5-.1-.7.1l-.9 1.2c-.2.2-.3.2-.6.1-.3-.2-1.3-.5-2.4-1.5-.9-.8-1.5-1.8-1.7-2.1-.2-.3 0-.5.1-.6l.5-.6.3-.5v-.5l-.9-2.3c-.2-.6-.5-.5-.7-.5z"/></symbol>
26
+ <symbol id="s-em" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" d="M3 5.5h18v13H3zM3.5 6l8.5 7 8.5-7"/></symbol>
27
+ </svg>
@@ -0,0 +1,29 @@
1
+ /* The easy design system's base: Outfit (the headings' face, served from here, one variable file
2
+ for every weight as Google Fonts serves it, ranges and all), the reset, type and utilities. */
3
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:500;font-display:swap;src:url("outfit-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF}
4
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:500;font-display:swap;src:url("outfit-latin.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
5
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:600;font-display:swap;src:url("outfit-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF}
6
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:600;font-display:swap;src:url("outfit-latin.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
7
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:700;font-display:swap;src:url("outfit-latin-ext.woff2") format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF}
8
+ @font-face{font-family:"Outfit";font-style:normal;font-weight:700;font-display:swap;src:url("outfit-latin.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
9
+
10
+ *,*::before,*::after{box-sizing:border-box}
11
+ a,button{-webkit-tap-highlight-color:rgba(0,0,0,0)}
12
+ html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
13
+ html,body{overflow-x:hidden}
14
+ /* hidden makes the body its own scroller, where nothing can stick: clip keeps the page from scrolling sideways without that */
15
+ @supports (overflow-x:clip){html,body{overflow-x:clip}}
16
+ body{margin:0;background:var(--color-bg);color:var(--color-text);min-height:100vh;display:flex;flex-direction:column}
17
+ img,svg{max-width:100%}
18
+ .i{width:1em;height:1em;vertical-align:-.125em;fill:currentColor;flex-shrink:0}
19
+ a{color:var(--color-primary)}
20
+ a:focus,button:focus,input:focus,summary:focus{outline:3px solid var(--color-focus);outline-offset:2px}
21
+ @media (prefers-reduced-motion: reduce){*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
22
+ .no-wrap{white-space:nowrap}
23
+ .visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
24
+ [hidden]{display:none!important}
25
+
26
+ body{font:16px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
27
+ h1,h2,h3,.site-brand{font-family:"Outfit","Helvetica Neue",Arial,sans-serif;font-weight:600;line-height:1.2}
28
+ .phone-only{display:none}
29
+ @media (max-width:560px){.phone-hidden{display:none}.phone-only{display:inline}}
@@ -0,0 +1,283 @@
1
+ /* The easy design system's components, each under its name (inventory.md): its parts start with
2
+ its name, its variants are one more word, its states start with is-. */
3
+
4
+ /* pill: every action button (primary, soft); share-bar: bookmark, share to networks, copy link */
5
+ /* As much room above the buttons as below them: 8px under each, then the status line (4px + 1.5em of 14px). */
6
+ .share-bar{margin:28px 0 0;padding:33px 0 0;border-top:1px solid var(--color-line);text-align:center;max-width:100%}
7
+ .share-bar-list{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}
8
+ .share-bar-list li{margin:0 8px 8px 0}
9
+ .share-bar-button{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:44px;height:44px;border-radius:50%;border:0;background:transparent;color:var(--color-text-2);cursor:pointer;padding:0;font:inherit;text-decoration:none}
10
+ .share-bar-button .i{width:22px;height:22px;display:block}
11
+ .share-bar-button.x{color:#000}.share-bar-button.fb{color:#1877f2}.share-bar-button.li{color:#0a66c2}.share-bar-button.rd{color:#ff4500}.share-bar-button.wa{color:#1fa855}.share-bar-button.em{color:var(--color-text-2)}
12
+ :root[data-theme="dark"] .share-bar-button.x{color:#f1f2f3}
13
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .share-bar-button.x{color:#f1f2f3}}
14
+ .share-bar-button.cp{border:1px solid var(--color-line);background:transparent;color:var(--color-text-2)}
15
+ .share-bar-button:focus-visible{-webkit-filter:brightness(1.12);filter:brightness(1.12)}
16
+ @media (hover:hover){.share-bar-button:hover{-webkit-filter:brightness(1.12);filter:brightness(1.12)}.share-bar-button.cp:hover{background:var(--color-surface-2)}}
17
+ .pill{display:inline-block;height:44px;line-height:42px;padding:0 16px;border-radius:22px;border:1px solid var(--color-primary);font:inherit;font-size:15px;font-weight:600;cursor:pointer}
18
+ .pill .i{margin-right:7px;vertical-align:-2px}
19
+ .pill.primary{background:var(--color-primary);color:var(--color-on-primary)}
20
+ .pill.soft{background:var(--color-primary-soft);color:var(--color-on-primary-soft);border-color:var(--color-primary-soft)}
21
+ .share-bar-list .share-bar-sep{width:1px;height:28px;background:var(--color-line);margin:0 12px 8px 4px}
22
+ @media (max-width:480px){.share-bar-list .share-bar-sep{display:none}}
23
+ .share-bar-status{min-height:1.5em;margin:4px 0 0;font-size:14px;color:var(--color-text-2)}
24
+
25
+ /* plane-card: the navy card with the big title and its facts (glance: the facts alone, boxed); title-row: a title with something beside it; key-values: label and value rows */
26
+ .plane-card{border:1px solid var(--color-line);border-radius:18px;overflow:hidden;background:var(--color-bg);box-shadow:0 1px 3px rgba(0,0,0,.06)}
27
+ .plane-card-head{background-color:var(--color-midnight);color:var(--color-bg);padding:24px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between}
28
+ .plane-card-head .plane-card-cta{margin:8px 0 8px 16px}
29
+ @media (max-width:640px){.plane-card-head .plane-card-cta{flex:1 1 100%;margin:20px 0 0;text-align:center}.plane-card-cta .alert-cta{display:block;padding:12px 16px}}
30
+ :root[data-theme="dark"] .plane-card-head{background-color:#0c2338;color:#f1f2f3}
31
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .plane-card-head{background-color:#0c2338;color:#f1f2f3}}
32
+ .plane-card-head h1{margin:0;font-size:40px;letter-spacing:.02em}
33
+ .plane-card-head p{margin:4px 0 0;font-size:18px;opacity:.9}
34
+ .plane-card-facts{display:flex;flex-wrap:wrap;margin:0;padding:12px 16px}
35
+ .plane-card-facts div{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%;padding:8px;min-width:0}
36
+ @media (min-width:880px){.plane-card-facts div{-ms-flex-preferred-size:25%;flex-basis:25%;max-width:25%}}
37
+ @media (max-width:380px){.plane-card-facts div{-ms-flex-preferred-size:100%;flex-basis:100%;max-width:100%}}
38
+ .plane-card-facts dt{font-size:13px;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.05em}
39
+ .plane-card-facts dd{margin:2px 0 0;font-weight:600}
40
+ .plane-card-facts.glance{border:1px solid var(--color-line);border-radius:12px;margin:16px 0 0}.plane-card-foot{border-top:1px solid var(--color-line);padding:14px 24px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;background:var(--color-surface-1)}
41
+ .plane-card-foot p{margin:4px 0}
42
+ .title-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between}
43
+ .title-row h1{margin:0 12px 0 0}
44
+ .title-row p{margin:0;color:var(--color-text-2);text-align:right}
45
+ .key-values{margin:0}
46
+ .key-values div{display:flex;justify-content:space-between;border-bottom:1px solid var(--color-surface-3);padding:8px 0}
47
+ .key-values div:last-child{border-bottom:0}
48
+ .key-values dt{color:var(--color-text-muted);margin-right:12px}
49
+ .key-values dd{margin:0;font-weight:600;text-align:right}
50
+
51
+ /* switches: counts that turn a list on and off; list-tools: the row holding them, the sort button and the word search */
52
+ .switches{display:flex;flex-wrap:wrap;align-items:center;margin:0 -6px;padding:0;list-style:none}
53
+ .switches li{margin:6px;padding:5px 8px;border-radius:12px;font-weight:600}
54
+ .switches .ok{background:var(--color-bad-bg);color:var(--color-bad)}
55
+ .switches .warn{background:var(--color-warn-bg);color:var(--color-warn)}
56
+ .switches .all{background:var(--color-surface-2);color:var(--color-text)}
57
+ .switches .none{background:var(--color-surface-2);color:var(--color-text-muted);font-weight:500}
58
+ .switches .none a{color:inherit;text-decoration:none}
59
+ .switches .none a:hover{text-decoration:underline}
60
+ .switches .i{margin-right:6px}
61
+ .switches .switches-toggle{cursor:pointer;user-select:none;-webkit-user-select:none;border:2px solid transparent}
62
+ .switches .switches-toggle:focus{outline:0}
63
+ .switches .switches-toggle:focus-visible{outline:3px solid var(--color-focus);outline-offset:2px}
64
+ /* Each badge a switch, drawn as Bootstrap 6 draws one: a track, gray and bordered when off, filled
65
+ when on, with a white knob that slides across. The parts are gray; the levels keep their colors,
66
+ the good news ("do not apply", "superseded") in green. */
67
+ .switches li.switches-toggle{position:relative;padding-left:52px;border:1px solid var(--color-line)}
68
+ .switches li.switches-toggle::before{content:"";position:absolute;left:9px;top:50%;margin-top:-10px;width:35px;height:20px;box-sizing:border-box;border:1px solid var(--color-primary);border-radius:10rem;background:var(--color-primary);box-shadow:inset 0 1px 2px rgba(0,0,0,.05);transition:background-color .15s ease-in-out}
69
+ .switches li.switches-toggle::after{content:"";position:absolute;left:26px;top:50%;margin-top:-8px;width:16px;height:16px;border-radius:10rem;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.1);transition:left .15s ease-in-out}
70
+ .switches li.switches-toggle.is-off{background:transparent;color:var(--color-text-muted)}
71
+ .switches li.switches-toggle.is-off::before{background:var(--color-surface-3);border-color:var(--color-line)}
72
+ .switches li.switches-toggle.is-off::after{left:11px}
73
+ .switches.parts li{background:var(--color-surface-1);color:var(--color-text)}
74
+ .switches.levels .none{background:var(--color-ok-bg);color:var(--color-ok);font-weight:600}
75
+ .switches-line{display:flex;align-items:center;justify-content:space-between}
76
+ .switches-line .switches{flex:1 1 auto}
77
+ .list-tools{margin:6px 0 6px}
78
+ .list-tools[hidden]{display:none}
79
+ .word-search{display:flex;align-items:center;border:1px solid var(--color-line);border-radius:8px;background:var(--color-bg);padding:0 10px}
80
+ .word-search:focus-within{border-color:var(--color-primary);box-shadow:0 0 0 3px var(--color-primary-soft)}
81
+ .word-search .i{color:var(--color-text-muted);margin-right:8px;flex:none}
82
+ .word-search input{flex:1;min-width:0;border:0;background:transparent;color:var(--color-text);font:inherit;font-size:16px;padding:5px 0;outline:0}
83
+ .switches li.sort-button-item{margin:0 0 0 auto;padding:0;border:0;background:none}
84
+ .sort-button{flex:none;margin:6px 0 6px 12px;display:inline-flex;align-items:center;border:0;border-radius:8px;background:none;color:var(--color-text);font:inherit;font-size:15px;font-weight:600;padding:8px 4px;cursor:pointer;white-space:nowrap}
85
+ .sort-button .i{margin-right:8px}
86
+ .sort-button:hover{color:var(--color-primary)}
87
+
88
+ /* report: a list with its sticky head; part-tabs: Airframe, Engine, Propeller, Appliances, each with its panel */
89
+ .report-head{background:var(--color-bg);margin:24px -16px 8px;padding:12px 16px 24px;border-bottom:1px solid var(--color-line)}
90
+ .report-head h2{font-size:26px;margin:0 0 8px}
91
+ @media (max-width:600px){.report-head h2{font-size:20px;margin-bottom:4px}}
92
+ .report-head .switches{margin-bottom:6px}
93
+ .report-head p{margin:6px 0 0;color:var(--color-text-2)}
94
+ .part-tabs{display:flex;flex-wrap:wrap;align-items:flex-end;margin:24px 0 0;padding:0;list-style:none;border-bottom:1px solid var(--color-line)}
95
+ .part-tabs li{margin:0 4px -1px 0}
96
+ .part-tabs a{display:block;padding:12px 16px;border:1px solid transparent;border-bottom:0;border-radius:12px 12px 0 0;color:var(--color-text-2);text-decoration:none;font-weight:600}
97
+ .part-tabs a .i{margin-right:7px}
98
+ .part-tabs a:hover{color:var(--color-text);background:var(--color-surface-1)}
99
+ .part-tabs .n{font-weight:400;color:var(--color-text-muted);margin-left:5px}
100
+ .part-tabs a.is-on{background:var(--color-bg);border-color:var(--color-line);border-top:3px solid var(--color-text-2);padding-top:10px;color:var(--color-text)}
101
+ /* A clicked tab shows it's chosen without the focus ring, which a keyboard still gets. */
102
+ .part-tabs a:focus{outline:0}
103
+ .part-tabs a:focus-visible{outline:3px solid var(--color-focus);outline-offset:2px}
104
+ .part-tabs .part-tabs-records{margin:0 0 -1px auto}
105
+ @media (max-width:640px){.part-tabs a{padding:10px 9px;font-size:15px}.part-tabs a.is-on{padding-top:8px}.part-tabs .n{display:none}}
106
+ .part-tabs-panel{border:1px solid var(--color-line);border-top:0;border-radius:0 0 14px 14px;padding:18px 18px 4px;margin-bottom:16px}
107
+ .has-js .part-tabs-panel.is-off{display:none}
108
+ .part-tabs-panel > h2{font-size:22px;margin:0 0 10px}
109
+ .has-js .part-tabs-panel > h2{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
110
+ .report .report-head{position:-webkit-sticky;position:sticky;top:0;z-index:10}
111
+ @media (min-width:601px){.report .report-head{top:61px}}
112
+
113
+ /* ad-card: one AD in a list, its edge the level's colour, its icon the part's; level-chip; tie-chip; why-box; chip-list */
114
+ .ad-card-list{list-style:none;margin:16px 0 0;padding:0}
115
+ .ad-card{position:relative;border:1px solid var(--color-line);border-left-width:6px;border-radius:14px;padding:18px 20px;margin:0 0 14px;background:var(--color-bg)}
116
+ .ad-card.applies{border-left-color:var(--color-bad)}
117
+ .ad-card.may_apply{border-left-color:var(--color-warn-line)}
118
+ .ad-card.not_applying{border-left-color:var(--color-ok-line);background:var(--color-surface-1)}
119
+ .ad-card.not_applying h4 a{color:var(--color-text-2)}
120
+ /* What of the aircraft an AD reaches it through: its icon, repeated down the card's left side,
121
+ so the edge's color is the level's alone. */
122
+ .ad-card.airframe,.ad-card.engine,.ad-card.propeller,.ad-card.appliance{padding-left:44px;background-repeat:repeat-y;background-position:14px 20px;background-size:16px auto}
123
+ .ad-card.airframe{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 44'%3E%3Cpath fill='%238c96a0' fill-opacity='.45' d='M21 15.5v-2l-8-5V3.2a1.5 1.5 0 0 0-3 0V8.5l-8 5v2l8-2.5v5.2l-2 1.5V21l3.5-1 3.5 1v-1.3l-2-1.5V13z'/%3E%3C/svg%3E")}
124
+ .ad-card.engine{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 44'%3E%3Cpath fill='%238c96a0' fill-opacity='.45' d='M7 4v2h3v2H7l-2 2v3H3v-3H1v8h2v-3h2v3h3l2 2h8v-4h2v3h3V9h-3v3h-2V8h-6V6h3V4z'/%3E%3C/svg%3E")}
125
+ .ad-card.propeller{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 29'%3E%3Cg fill='%238c96a0' fill-opacity='.45'%3E%3Cpath d='M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z'/%3E%3Cpath d='M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z' transform='rotate(120 8 8)'/%3E%3Cpath d='M8 7.4C5.4 6 5.3 2.1 8 .5c2.7 1.6 2.6 5.5 0 6.9z' transform='rotate(240 8 8)'/%3E%3Ccircle cx='8' cy='8' r='2.1'/%3E%3C/g%3E%3C/svg%3E")}
126
+ .ad-card.appliance{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 29'%3E%3Cpath fill='%238c96a0' fill-opacity='.45' fill-rule='evenodd' d='M13.07 6.45L15.31 6.84L15.31 9.16L13.07 9.55L12.68 10.49L13.99 12.35L12.35 13.99L10.49 12.68L9.55 13.07L9.16 15.31L6.84 15.31L6.45 13.07L5.51 12.68L3.65 13.99L2.01 12.35L3.32 10.49L2.93 9.55L0.69 9.16L0.69 6.84L2.93 6.45L3.32 5.51L2.01 3.65L3.65 2.01L5.51 3.32L6.45 2.93L6.84 0.69L9.16 0.69L9.55 2.93L10.49 3.32L12.35 2.01L13.99 3.65L12.68 5.51Z M8 5.6a2.4 2.4 0 1 0 0 4.8a2.4 2.4 0 1 0 0-4.8Z'/%3E%3C/svg%3E")}
127
+ .ad-card.superseded{border-left-color:var(--color-ok-line);background:var(--color-surface-1)}
128
+ .ad-card.superseded h4 a{color:var(--color-text-2)}
129
+ .ad-card-replaced-by{font-family:"Outfit","Helvetica Neue",Arial,sans-serif;font-weight:400;font-size:19px;line-height:1.2;margin:10px 0 2px;color:var(--color-text-2)}
130
+ .ad-card-replaced-by a{font-weight:600;text-decoration:none}
131
+ .ad-card-replaced-by a:hover{text-decoration:underline}
132
+ ol.ad-card-list li.ad-card.superseded{display:none}
133
+ ol.ad-card-list.js-live li.ad-card.superseded{display:block}
134
+ .ad-card-top{position:relative;display:flex;flex-wrap:wrap;align-items:center}
135
+ .ad-card-top > *{margin:0 10px 6px 0}
136
+ .level-chip{display:inline-block;font-weight:700;font-size:14px;padding:5px 10px;border-radius:999px}
137
+ .level-chip .i{margin-right:5px}
138
+ .level-chip.applies{background:var(--color-bad-bg);color:var(--color-bad)}
139
+ .level-chip.may_apply{background:var(--color-warn-bg);color:var(--color-warn)}
140
+ .level-chip.not_applying{background:var(--color-ok-bg);color:var(--color-ok)}
141
+ .level-chip.superseded{background:var(--color-ok-bg);color:var(--color-ok)}
142
+ .ad-card-top .ad-card-kind{font-size:14px;padding:5px 10px;border-radius:999px;background:var(--color-surface-2)}
143
+ .tie-chip{font-size:13px;color:var(--color-text-2);border:1px solid var(--color-line);border-radius:999px;padding:4px 10px}
144
+ .ad-card-effective{font-size:14px;color:var(--color-text-muted);margin-left:auto!important}
145
+ .ad-card h3,.ad-card h4{font-family:"Outfit","Helvetica Neue",Arial,sans-serif;font-weight:600;font-size:19px;line-height:1.2;margin:4px 0 6px}
146
+ .ad-card h3 a,.ad-card h4 a{text-decoration:none}
147
+ .ad-card h3 a:hover,.ad-card h4 a:hover{text-decoration:underline}
148
+ .ad-card h3 .t,.ad-card h4 .t{display:block;font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;font-weight:400;color:var(--color-text-2);font-size:16px;margin-top:2px}
149
+ .why-box{margin:8px 0 0;padding:12px 14px;border-radius:10px;background:var(--color-surface-1)}
150
+ .why-box b{display:block;font-size:13px;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-muted);margin-bottom:2px}
151
+ .chip-list{list-style:none;margin:0 -4px 16px;padding:0;display:flex;flex-wrap:wrap}
152
+ .chip-list li{margin:4px;padding:6px 12px;border-radius:999px;background:var(--color-surface-2);font-size:14px}
153
+ .chip-list .in{background:var(--color-ok-bg);color:var(--color-ok);font-weight:600}
154
+ .chip-list .part .i{margin-right:6px}
155
+ .level-chip.reaches{background:var(--color-surface-2);color:var(--color-text)}
156
+ .ad-card.reaches{border-left-color:var(--color-surface-3)}
157
+
158
+ /* ad-card and level-chip, the accidents' level */
159
+ .ad-card.accident{border-left-color:var(--color-warn-line)}
160
+ .level-chip.event{background:var(--color-warn-bg);color:var(--color-warn)}
161
+
162
+ /* modal: a dialog; tooltip: a hover or tap explanation; pin-code: the six-digit code */
163
+ .modal{display:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:50;background:rgba(11,30,58,.55);align-items:center;justify-content:center;padding:16px}
164
+ .modal:target,.modal.is-open{display:flex}
165
+ .modal-box{position:relative;width:100%;max-width:760px;max-height:100%;overflow:auto;background:var(--color-bg);color:var(--color-text);border-radius:18px;padding:28px 24px 24px;box-shadow:0 20px 50px rgba(0,0,0,.3)}
166
+ .modal-box h2{font-size:22px;margin:0 32px 6px 0}
167
+ .modal-box h2 > span[aria-hidden="true"]:first-child{margin-right:.35em}
168
+ .modal-x{position:absolute;top:10px;right:14px;font-size:28px;line-height:1;color:var(--color-text-muted);text-decoration:none}
169
+ /* The dialog gives the ✕ focus when it opens: ringed only for a keyboard, as a clicked link is not */
170
+ .modal-x:focus{outline:0}
171
+ .modal-x:focus-visible{outline:3px solid var(--color-focus);outline-offset:2px}
172
+ .tooltip{display:inline-block;margin:0 10px 6px 0}
173
+ a.tooltip-trigger{text-decoration:none;cursor:help}
174
+ a.tooltip-trigger:hover,a.tooltip-trigger:focus{box-shadow:0 0 0 2px currentColor}
175
+ .tooltip-pop{display:none;position:absolute;left:0;top:100%;z-index:5;margin-top:4px;width:100%;max-width:28rem;padding:12px 14px;border-radius:10px;background:var(--color-text);color:var(--color-bg);font-size:14px;line-height:1.45;box-shadow:0 6px 20px rgba(0,0,0,.25)}
176
+ .tooltip-pop strong{color:inherit}
177
+ .tooltip:hover .tooltip-pop,.tooltip-trigger:focus + .tooltip-pop,.tooltip.is-open .tooltip-pop{display:block}
178
+ .tooltip.is-shut .tooltip-pop{display:none!important}
179
+ .modal-lede{margin:0 0 4px;color:var(--color-text-2)}
180
+ .modal-fine{margin:14px 0 0;font-size:13px;color:var(--color-text-muted)}
181
+ /* The sign-in code: one real field over six slots (shared/_sign_in), as bh's pin_field draws
182
+ one. Until the script has drawn them, the field shows as any other. */
183
+ .pin-code{position:relative;max-width:380px;margin:14px auto 4px}
184
+ .pin-code-slots{display:none}
185
+ .pin-code.is-drawn .pin-code-slots{display:flex}
186
+ .pin-code-slots span{flex:1 1 0;min-width:0;height:56px;margin:0 4px;border:1px solid var(--color-line);border-radius:10px;background:var(--color-bg);display:flex;align-items:center;justify-content:center;font:600 26px/1 "Outfit","Helvetica Neue",Arial,sans-serif}
187
+ .pin-code-slots span.is-active{border-color:var(--color-focus);box-shadow:0 0 0 3px var(--color-primary-soft)}
188
+ .pin-code-input{display:block;width:100%;box-sizing:border-box;height:56px;padding:0 12px;border:1px solid var(--color-line);border-radius:10px;font-family:inherit;font-weight:600;font-size:24px;line-height:1;letter-spacing:.3em;text-align:center;background:var(--color-bg);color:var(--color-text)}
189
+ .pin-code.is-drawn .pin-code-input{position:absolute;top:0;left:0;height:100%;opacity:0;font-size:16px;cursor:text}
190
+
191
+ /* pin-code, refused */
192
+ .pin-code.is-invalid .pin-code-slots span,.pin-code.is-invalid .pin-code-input{border-color:var(--color-bad)}
193
+ .pin-code.is-invalid .pin-code-slots span.is-active{box-shadow:0 0 0 3px var(--color-bad-bg)}
194
+
195
+ /* note (warn, info): a boxed message; small-note: small grey text beside what it explains */
196
+ .note.warn{border:1px solid var(--color-warn-line);background:var(--color-warn-bg);color:var(--color-warn);padding:12px 16px;border-radius:12px;margin:16px 0}
197
+ .small-note,.note.info{font-size:14px;color:var(--color-text-muted)}
198
+ .note.info{background:var(--color-surface-1);border-left:4px solid var(--color-warn-line);padding:12px 16px;border-radius:0 8px 8px 0;margin:16px 0 32px 0}
199
+
200
+ /* search-hero: the home page's big search, its lede and figures; search-form and search-field: a labelled search box (mini: the small one); search-hint: the tries and recent pages under it; results: search results */
201
+ .search-hero{background:var(--color-sky-band-top);background:linear-gradient(180deg,var(--color-sky-band-top),var(--color-sky-band-bottom));padding:20px 0 12px;text-align:center}
202
+ .search-hero h1{font-size:30px;margin:0 auto 0px;color:var(--color-midnight)}
203
+ @media (min-width:720px){.search-hero h1{font-size:44px}}
204
+ .search-hero-lede{font-size:18px;color:var(--color-text-2);max-width:43rem;margin:0 auto 18px}
205
+ .search-form{max-width:40rem;margin:0 auto;text-align:left}
206
+ .search-form label{display:block;font-weight:600;margin-bottom:8px;text-align:center}
207
+ @media (max-width:430px){.search-form label{font-size:13px}}
208
+ .search-field{display:flex;background:var(--color-bg);border:2px solid var(--color-primary);border-radius:14px;box-shadow:0 6px 24px rgba(11,30,58,.12);overflow:hidden}
209
+ .search-field input{flex:1;min-width:0;width:100%;border:0;background:transparent;color:var(--color-text);font-size:20px;padding:16px 18px;font-family:inherit}
210
+ /* The field, rounded, shows where typing goes: the input's own outline would be square inside it. */
211
+ .search-field input:focus{outline:0}
212
+ .search-field:focus-within{box-shadow:0 0 0 4px var(--color-primary-soft);border-color:var(--color-focus)}
213
+ .search-field button{border:0;background:var(--color-primary);color:var(--color-on-primary);font:600 18px/1 inherit;font-family:inherit;padding:0 22px;cursor:pointer;min-width:56px}
214
+ .search-field button .i{width:22px;height:22px;vertical-align:-5px}
215
+ /* A click on the button draws no ring over the field; a keyboard's focus is ringed inside it. */
216
+ .search-field button:focus{outline:0}
217
+ .search-field button:focus-visible{outline:3px solid var(--color-on-primary);outline-offset:-6px}
218
+ @media (max-width:480px){.search-field button .t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}}
219
+ .search-hint{color:var(--color-text-2);font-size:15px;margin:4px 0 0;text-align:center}
220
+ .search-hint a{display:inline-block;margin:12px 6px 0;padding:6px 12px;border-radius:999px;background:var(--color-primary-soft);color:var(--color-on-primary-soft);text-decoration:none;font-variant-numeric:tabular-nums}
221
+ .search-hint a:hover{text-decoration:underline}
222
+ .search-form + .search-hint{margin-left:auto;margin-right:auto}
223
+ /* A page the member opened, in place of a Try pill: its link and its × share one pill, which takes
224
+ the focus ring for either. */
225
+ .search-hint .search-hint-recent{display:inline-flex;align-items:center;margin:12px 6px 0;padding:0 3px 0 0;border-radius:999px;background:var(--color-primary-soft);color:var(--color-on-primary-soft)}
226
+ .search-hint .search-hint-recent a{margin:0;padding:6px 4px 6px 12px;background:none}
227
+ .search-hint .search-hint-recent a:focus{outline:0;text-decoration:underline}
228
+ .search-hint .search-hint-recent form{display:inline}
229
+ .search-hint .search-hint-recent .x-button{width:26px;height:26px}
230
+ .search-hint .search-hint-recent .x-button:focus{outline:0}
231
+ .search-hint .search-hint-recent:focus-within{outline:3px solid var(--color-focus);outline-offset:2px}
232
+ .mini label{display:block;font-weight:600;margin-bottom:6px}
233
+ .mini .search-field{border-width:1px;box-shadow:none;border-radius:10px}
234
+ .mini .search-field:focus-within{box-shadow:0 0 0 3px var(--color-primary-soft)}
235
+ .mini .search-field input{font-size:17px;padding:12px}
236
+ .mini .search-field button{font-size:16px;padding:0 14px}
237
+ .results{padding-bottom:48px}
238
+ .results h2{font-size:20px;margin:32px 0 8px}
239
+ .results ul{list-style:none;margin:0;padding:0}
240
+ .results li{margin:0 0 8px}
241
+ .results li a{display:flex;align-items:center;gap:8px;padding:12px 16px;border:1px solid var(--color-line);border-radius:12px;background:var(--color-bg);text-decoration:none;color:var(--color-primary);font-weight:600}
242
+ .results li a::after{content:"\203A";margin-left:auto;padding-left:12px;font-size:24px;line-height:1;color:var(--color-text-muted)}
243
+ .results li a:hover{background:var(--color-surface-1);border-color:var(--color-primary)}
244
+ .results li a:hover .results-name{text-decoration:underline}
245
+ .results .results-meta{color:var(--color-text-muted);font-weight:400;font-size:15px;white-space:nowrap}
246
+ .results .results-pick{color:var(--color-text-2);margin:4px 0 0}
247
+
248
+ /* search-hint, recent pages; search-hero's figures */
249
+ .search-hint.recent-pages{margin:14px 0 0}
250
+ .search-hint.recent-pages[hidden]{display:none}
251
+ .search-hero-stats{list-style:none;display:flex;flex-wrap:wrap;justify-content:center;margin:22px auto 0;padding:0;max-width:56rem}
252
+ .search-hero-stats li{flex:1 1 12rem;margin:6px;color:var(--color-text-2);font-size:15px}
253
+ .search-hero-stats strong{display:block;color:var(--color-midnight);font:700 30px/1.1 "Outfit","Helvetica Neue",Arial,sans-serif;font-variant-numeric:tabular-nums}
254
+
255
+ /* band: a section with a heading; latest-list: a dated list; columns: main and side */
256
+ .band{padding-top:20px;padding-bottom:20px}
257
+ .band h2{font-size:22px;margin:0 0 12px}
258
+ .band .latest-list + h2{margin-top:32px}
259
+ .latest-list{list-style:none;margin:0;padding:0;border-top:1px solid var(--color-line)}
260
+ .latest-list li{border-bottom:1px solid var(--color-line)}
261
+ .latest-list a{display:flex;flex-wrap:wrap;align-items:baseline;padding:9px 4px;text-decoration:none;color:var(--color-text)}
262
+ .latest-list a:hover .latest-list-num{text-decoration:underline}
263
+ .latest-list-num{font-variant-numeric:tabular-nums;font-weight:600;color:var(--color-primary);margin-right:12px;white-space:nowrap}
264
+ .latest-list .latest-list-title{overflow-wrap:anywhere;min-width:0}
265
+ .latest-list .latest-list-when{margin-left:auto;color:var(--color-text-muted);font-size:14px;padding-left:12px}
266
+ @media (max-width:560px){.latest-list a{flex-direction:column;align-items:flex-start}.latest-list .latest-list-when{margin-left:0;padding-left:0}}
267
+ .columns{display:flex;flex-wrap:wrap;margin:24px -12px 0}
268
+ .columns > *{padding:0 12px}
269
+ .columns-main{flex:2 1 28rem;min-width:0}
270
+ .columns-side{flex:1 1 16rem;min-width:0}
271
+
272
+ /* placeholder-bar (b1 to b4): grey bars standing in for hidden text */
273
+ .placeholder-bar{display:block;height:10px;border-radius:5px;background:var(--color-surface-3);margin:0 0 8px}
274
+ .placeholder-bar.b1{width:22%}.placeholder-bar.b2{width:68%;height:14px}.placeholder-bar.b3{width:84%}.placeholder-bar.b4{width:46%}
275
+
276
+ /* step-cards: numbered cards, one per step (steps-bar stays easyAnnual's progress bar) */
277
+ .step-cards{list-style:none;margin:28px auto 0;padding:0;display:flex;flex-wrap:wrap;max-width:56rem;text-align:left;counter-reset:step}
278
+ .step-cards{margin-left:-8px;margin-right:-8px}
279
+ .step-cards li{flex:1 1 14rem;margin:8px;padding:14px 20px 18px;position:relative;border:1px solid var(--color-line);border-radius:14px;background:var(--color-bg)}
280
+ /* The step's number beside its title, the line under both. */
281
+ .step-cards li::before{counter-increment:step;content:counter(step);position:absolute;left:20px;top:12px;color:var(--color-sky);font:700 34px/1 "Outfit","Helvetica Neue",Arial,sans-serif}
282
+ .step-cards h2{font-size:18px;margin:0 0 6px;padding-left:38px;line-height:34px}
283
+ .step-cards p{margin:0;color:var(--color-text-2);font-size:15px}
@@ -0,0 +1,43 @@
1
+ /* The easy design system's layout (layouts/easy/site): the skip link, the header with the app's
2
+ brand and nav, the theme toggle, the sky band, the page and its width, and the footer. */
3
+ .skip-link{position:absolute;left:-9999px;top:0;z-index:10;background:var(--color-bg);color:var(--color-primary);padding:12px 16px}
4
+ .skip-link:focus{left:8px;top:8px}
5
+ .i-moon{display:none}
6
+ :root[data-theme="dark"] .i-sun{display:none}
7
+ :root[data-theme="dark"] .i-moon{display:inline-block}
8
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .i-sun{display:none}:root:not([data-theme="light"]) .i-moon{display:inline-block}}
9
+ .page-width{max-width:68rem;margin:0 auto;padding:0 16px}
10
+ .site-header{border-bottom:1px solid var(--color-line);background:var(--color-bg)}
11
+ .site-header .page-width{display:flex;align-items:center;justify-content:space-between;min-height:60px}
12
+ .site-header .page-width>div{white-space:nowrap}
13
+ .site-brand{display:inline-block;text-decoration:none;white-space:nowrap;line-height:0}
14
+ .site-nav{display:inline}
15
+ .site-nav a{margin-left:16px;color:var(--color-text-2);text-decoration:none;padding:10px 0;display:inline-block}
16
+ .site-nav a:hover{color:var(--color-primary);text-decoration:underline}
17
+ .site-nav form{display:inline}
18
+ .site-nav form button{margin-left:16px;background:none;border:0;padding:10px 0;font:inherit;color:var(--color-text-2);cursor:pointer;text-decoration:none;display:inline-block}
19
+ .site-nav form button:hover{color:var(--color-primary);text-decoration:underline}
20
+ @media (max-width:560px){.site-nav a.phone-hidden{display:none}}
21
+ .theme-toggle{margin-left:12px;background:transparent;color:var(--color-text-2);border:1px solid var(--color-line);border-radius:999px;padding:8px 12px;font:inherit;font-size:14px;cursor:pointer;min-height:40px}
22
+ .theme-toggle .i{margin:0}
23
+ .theme-toggle-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
24
+ /* On a laptop the header stays at the top as the page scrolls. */
25
+ @media (min-width:601px){.site-header{position:-webkit-sticky;position:sticky;top:0;z-index:20}}
26
+
27
+ /* Blue fading to white under the header, across the whole window; slim on the pages that need room. */
28
+ .sky-band{background:var(--color-sky-band-top);background:linear-gradient(180deg,var(--color-sky-band-top),var(--color-sky-band-bottom));margin:0 0 20px;padding:16px 0}
29
+ .sky-band.slim{padding:6px 0;margin:0 0 14px}
30
+
31
+ /* The page: its width, or the whole window (wide) for content that lays out its own (.page-width). */
32
+ .page{max-width:68rem;margin:0 auto;padding:0 16px;flex:1 0 auto;align-self:stretch;width:100%}
33
+ .page.wide{max-width:none;padding:0}
34
+
35
+ .site-footer{background:var(--color-surface-1);border-top:1px solid var(--color-line);font-size:15px;color:var(--color-text-2)}
36
+ .site-footer-inner{max-width:68rem;margin:0 auto;padding:0 16px}
37
+ .site-footer a{color:var(--color-text-2)}
38
+ .site-footer a:hover{color:var(--color-primary)}
39
+ .site-footer-note{text-align:center;margin:0 auto;padding:12px 0;line-height:1.7}
40
+ .site-footer-bar{padding:12px;text-align:center;font-size:14px}
41
+ .site-footer-bar ul{list-style:none;margin:0;padding:0}
42
+ .site-footer-bar li{display:inline-block;margin:0 10px}
43
+ .site-footer-bar li a{display:inline-block;padding:6px 0}
@@ -0,0 +1,6 @@
1
+ /* The easy design system's tokens: every colour any easy app draws with, light and dark. The
2
+ dark ones follow the system unless the visitor picks a theme (data-theme on <html>). Plain hex:
3
+ every page has to work on old iPhones, Androids and Windows browsers. */
4
+ :root{color-scheme:light;--color-bg:#ffffff;--color-surface-1:#f6f7f8;--color-surface-2:#f1f2f3;--color-surface-3:#e2e5e7;--color-text:#2c2f32;--color-text-2:#50575d;--color-text-muted:#636c74;--color-line:#c6cbcf;--color-primary:#1a70d0;--color-on-primary:#ffffff;--color-primary-soft:#dfe5ff;--color-on-primary-soft:#215aa5;--color-ok:#19753e;--color-bad:#b3261e;--color-bad-bg:#fbe3e0;--color-bad-line:#ee9b93;--color-ok-bg:#d8f0dd;--color-ok-line:#87d29a;--color-warn:#7e6317;--color-warn-bg:#fff4d5;--color-warn-line:#ffde80;--color-engine-bg:#f3e6d8;--color-engine:#6f4219;--color-engine-line:#c08a57;--color-propeller-bg:#ece4f7;--color-propeller:#5b2a86;--color-propeller-line:#a47fd0;--color-appliance-bg:#d9f0ec;--color-appliance:#1b5e55;--color-appliance-line:#6fb3a8;--color-midnight:#0b1e3a;--color-sky:#5aa9e6;--color-focus:#1a70d0;--color-sky-band-top:#eaf3fb;--color-sky-band-bottom:#ffffff;}
5
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){color-scheme:dark;--color-bg:#131415;--color-surface-1:#202223;--color-surface-2:#2c2f32;--color-surface-3:#3d4347;--color-text:#f1f2f3;--color-text-2:#abb2b8;--color-text-muted:#8c96a0;--color-line:#50575d;--color-primary:#689dff;--color-on-primary:#131415;--color-primary-soft:#1d3155;--color-on-primary-soft:#bccdff;--color-ok:#59c27a;--color-bad:#ff8a80;--color-bad-bg:#4a1d1a;--color-bad-line:#c4453a;--color-ok-bg:#173e24;--color-ok-line:#13924c;--color-warn:#ffd352;--color-warn-bg:#564415;--color-warn-line:#d2a511;--color-engine-bg:#3d2a1a;--color-engine:#e8c29c;--color-engine-line:#9a6a3a;--color-propeller-bg:#2e1f44;--color-propeller:#d6bdf2;--color-propeller-line:#7a55a8;--color-appliance-bg:#16332f;--color-appliance:#9fd9cf;--color-appliance-line:#3f8a7f;--color-midnight:#cfe3f6;--color-sky:#5aa9e6;--color-focus:#689dff;--color-sky-band-top:#0c2338;--color-sky-band-bottom:#131415;}}
6
+ :root[data-theme="dark"]{color-scheme:dark;--color-bg:#131415;--color-surface-1:#202223;--color-surface-2:#2c2f32;--color-surface-3:#3d4347;--color-text:#f1f2f3;--color-text-2:#abb2b8;--color-text-muted:#8c96a0;--color-line:#50575d;--color-primary:#689dff;--color-on-primary:#131415;--color-primary-soft:#1d3155;--color-on-primary-soft:#bccdff;--color-ok:#59c27a;--color-bad:#ff8a80;--color-bad-bg:#4a1d1a;--color-bad-line:#c4453a;--color-ok-bg:#173e24;--color-ok-line:#13924c;--color-warn:#ffd352;--color-warn-bg:#564415;--color-warn-line:#d2a511;--color-engine-bg:#3d2a1a;--color-engine:#e8c29c;--color-engine-line:#9a6a3a;--color-propeller-bg:#2e1f44;--color-propeller:#d6bdf2;--color-propeller-line:#7a55a8;--color-appliance-bg:#16332f;--color-appliance:#9fd9cf;--color-appliance-line:#3f8a7f;--color-midnight:#cfe3f6;--color-sky:#5aa9e6;--color-focus:#689dff;--color-sky-band-top:#0c2338;--color-sky-band-bottom:#131415;}
@@ -0,0 +1,20 @@
1
+ module Drive
2
+ # The easy design system's icons, for every view of every app (Drive::Engine): one sprite every
3
+ # page shares (app/assets/images/easy/sprite.svg), one file the browser keeps for a year rather
4
+ # than a copy in every page.
5
+ module EasyHelper
6
+ # Where an icon is in the sprite: its address, then the icon's id after the #.
7
+ # @param name [String] "sun", "newest": its id in the sprite, without the i-.
8
+ # @param kind ["i", "s"] an icon of the design system's, or a social network's.
9
+ def easy_icon_href(name, kind = 'i') = "#{asset_path 'easy/sprite.svg'}##{kind}-#{name}"
10
+
11
+ # An icon, hidden from screen readers: the text beside it says what it is.
12
+ # @param href [String] easy_icon_href's answer, or a name in the sprite.
13
+ # @param class [String] the svg's classes, "i" for an icon drawn the size of the text around it.
14
+ def easy_icon(href, class: 'i')
15
+ href = easy_icon_href(href) unless href.include?('#')
16
+ # Both hrefs: the old Safaris every page is meant for read only xlink:href.
17
+ tag.svg(tag.use('xlink:href': href, href:), class:, aria: { hidden: true }, focusable: false)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,49 @@
1
+ <%# The page every easy app draws: an app's own layout fills the slots, then renders this one
2
+ (render template: "layouts/easy/site").
3
+ - :easy_head, its title, metas and links;
4
+ - :easy_stylesheets, its own stylesheets, after the shared ones;
5
+ - :body_class, the body's classes;
6
+ - :site_brand_url and :site_brand, where its logo goes and the logo;
7
+ - :site_nav, its links, sign in or out;
8
+ - :sky_band, "full" or "slim", for the band under the header; then the page is wide;
9
+ - :site_footer, its footer's lines and links;
10
+ - :body_end, its scripts. -%>
11
+ <!doctype html>
12
+ <html lang="en">
13
+ <head>
14
+ <meta charset="utf-8">
15
+ <meta name="viewport" content="width=device-width, initial-scale=1">
16
+ <%= yield :easy_head %>
17
+ <%# The headings' face, asked for with the stylesheet rather than once it is read (easy/base.css). -%>
18
+ <%= preload_link_tag asset_path("easy/outfit-latin.woff2"), as: "font", type: "font/woff2", crossorigin: "anonymous" %>
19
+ <%= stylesheet_link_tag "easy/tokens", "easy/base", "easy/layout", "easy/components" %>
20
+ <%= yield :easy_stylesheets %>
21
+ <script>(function(){document.documentElement.className+=' has-js';try{var t=localStorage.getItem('theme');if(t==='dark'||t==='light'){document.documentElement.setAttribute('data-theme',t)}}catch(e){}})();</script>
22
+ </head>
23
+ <body class="<%= content_for(:body_class) %>">
24
+ <a class="skip-link" href="#main">Skip to content</a>
25
+ <header class="site-header">
26
+ <div class="page-width">
27
+ <%= link_to content_for(:site_brand_url) || "/", class: "site-brand" do %><%= yield :site_brand %><% end %>
28
+ <div>
29
+ <nav class="site-nav" aria-label="Site"><%= yield :site_nav %></nav>
30
+ <button type="button" class="theme-toggle js-theme" aria-pressed="false">
31
+ <%= easy_icon "sun", class: "i i-sun" %><%= easy_icon "moon", class: "i i-moon" %><span class="theme-toggle-label">Dark theme</span>
32
+ </button>
33
+ </div>
34
+ </div>
35
+ </header>
36
+ <% if content_for?(:sky_band) %>
37
+ <div class="sky-band<%= " slim" if content_for(:sky_band) == "slim" %>"></div>
38
+ <% end %>
39
+ <main id="main" class="page<%= " wide" if content_for?(:sky_band) %>">
40
+ <%= yield %>
41
+ </main>
42
+ <footer id="footer" class="site-footer">
43
+ <div class="site-footer-inner">
44
+ <%= yield :site_footer %>
45
+ </div>
46
+ </footer>
47
+ <%= yield :body_end %>
48
+ </body>
49
+ </html>
data/lib/drive/engine.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module Drive
2
- # Lends the host its models (Run, Mirrored, Counted, AccessFile, Crawler, NNumber, Designation,
3
- # Serial), RateLimited, the error pages and the migrations of runs
4
- # (`bin/rails drive:install:migrations`).
2
+ # Lends the host its models (Crawler, NNumber, Designation, Serial), RateLimited, the error
3
+ # pages and the easy design system (layouts/easy/site, easy/*.css, its fonts and icons).
5
4
  class Engine < ::Rails::Engine
6
5
  engine_name 'drive'
7
6
 
@@ -24,5 +23,10 @@ module Drive
24
23
  get 'down.html', to: 'drive/errors#down', format: false
25
24
  end
26
25
  end
26
+
27
+ # The design system's icons in every view, beside its layout (layouts/easy/site).
28
+ initializer 'drive.easy_helper' do
29
+ ActiveSupport.on_load(:action_view) { include Drive::EasyHelper }
30
+ end
27
31
  end
28
32
  end
data/lib/drive/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Drive
2
2
  # Version of the gem, read by the gemspec.
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.8.0'.freeze
4
4
  end
data/lib/drive.rb CHANGED
@@ -3,8 +3,7 @@ require 'drive/inflections'
3
3
  require 'drive/cloudflare'
4
4
  require 'drive/engine'
5
5
 
6
- # What the easyFAA apps share: a copy of the tables another source publishes, changing only the
7
- # rows the source did (Mirrored, Counted, Run), and what every app in front of Cloudflare needs
8
- # alike (Drive::Cloudflare, Crawler, RateLimited, the error pages, NNumber, Designation, Serial).
6
+ # What every easyFAA app in front of Cloudflare needs alike: Drive::Cloudflare, Crawler,
7
+ # RateLimited, the error pages, NNumber, Designation and Serial.
9
8
  module Drive
10
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
@@ -9,34 +9,6 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: csv
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: pg
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
12
  - !ruby/object:Gem::Dependency
41
13
  name: rails
42
14
  requirement: !ruby/object:Gem::Requirement
@@ -51,8 +23,7 @@ dependencies:
51
23
  - - ">="
52
24
  - !ruby/object:Gem::Version
53
25
  version: '8.1'
54
- description: 'A Rails engine for the easyFAA apps: each mirrors a public source (the
55
- FAA, the NTSB) table for table, changing only the rows the source did, and each
26
+ description: 'A Rails engine for the easyFAA apps: each sits behind Cloudflare and
56
27
  shows the same error pages, limits, crawlers and N-numbers.'
57
28
  email:
58
29
  - claudiob@users.noreply.github.com
@@ -63,26 +34,27 @@ files:
63
34
  - CHANGELOG.md
64
35
  - MIT-LICENSE
65
36
  - README.md
37
+ - app/assets/fonts/easy/outfit-latin-ext.woff2
38
+ - app/assets/fonts/easy/outfit-latin.woff2
39
+ - app/assets/images/easy/sprite.svg
40
+ - app/assets/stylesheets/easy/base.css
41
+ - app/assets/stylesheets/easy/components.css
42
+ - app/assets/stylesheets/easy/layout.css
43
+ - app/assets/stylesheets/easy/tokens.css
66
44
  - app/controllers/concerns/rate_limited.rb
67
45
  - app/controllers/drive/errors_controller.rb
68
- - app/models/access_file.rb
69
- - app/models/concerns/counted.rb
70
- - app/models/concerns/mirrored.rb
46
+ - app/helpers/drive/easy_helper.rb
71
47
  - app/models/crawler.rb
72
48
  - app/models/designation.rb
73
- - app/models/drive/current.rb
74
49
  - app/models/n_number.rb
75
- - app/models/run.rb
76
50
  - app/models/serial.rb
77
51
  - app/views/drive/errors/show.html.erb
78
52
  - app/views/layouts/drive/errors.html.erb
79
- - db/migrate/20261005100000_create_runs_and_changes.rb
80
- - db/migrate/20261006100000_drop_changes.rb
53
+ - app/views/layouts/easy/site.html.erb
81
54
  - lib/drive.rb
82
55
  - lib/drive/cloudflare.rb
83
56
  - lib/drive/engine.rb
84
57
  - lib/drive/inflections.rb
85
- - lib/drive/test_helper.rb
86
58
  - lib/drive/version.rb
87
59
  homepage: https://github.com/easyfaa/drive
88
60
  licenses:
@@ -105,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
77
  - !ruby/object:Gem::Version
106
78
  version: '0'
107
79
  requirements: []
108
- rubygems_version: 4.0.3
80
+ rubygems_version: 4.0.20
109
81
  specification_version: 4
110
- summary: 'What the easyFAA apps share: mirrored FAA and NTSB tables, and more.'
82
+ summary: 'What the easyFAA apps share: error pages, Cloudflare, limits and N-numbers.'
111
83
  test_files: []
@@ -1,47 +0,0 @@
1
- require 'csv'
2
-
3
- # A Microsoft Access database, as DRS and the NTSB publish theirs, read with mdb-export (mdbtools).
4
- class AccessFile
5
- # The mdb-export command, writing dates with their century, which it leaves out by default.
6
- EXPORT = ['mdb-export', '-D', '%Y-%m-%d', '-T', '%Y-%m-%d %H:%M:%S'].freeze
7
-
8
- # @param path [String] .accdb or .mdb file.
9
- def initialize(path)
10
- @path = path
11
- end
12
-
13
- # Copies a table into a temporary one of text columns, dropped when the transaction commits:
14
- # "AD Number" is ad_number, and the table's own id is access_id.
15
- # @param table [String] table name in the Access file, such as AD_DATA or events.
16
- # @param connection [ActiveRecord::ConnectionAdapters::PostgreSQLAdapter] inside a transaction.
17
- # @return [String] temporary table.
18
- def stage(table, connection)
19
- staged = "staged_#{column table}"
20
- IO.popen [*EXPORT, @path, table], 'rb' do |io|
21
- columns = CSV.parse_line(io.gets.force_encoding(Encoding::UTF_8)).map { column it }
22
- connection.execute "DROP TABLE IF EXISTS #{staged}"
23
- connection.execute <<~SQL.squish
24
- CREATE TEMP TABLE #{staged} (#{columns.map { %("#{it}" text) }.join ', '}) ON COMMIT DROP
25
- SQL
26
- copy io, staged, connection.raw_connection
27
- end
28
- staged
29
- end
30
-
31
- private
32
-
33
- def column(name)
34
- column = name.strip.downcase.gsub(/[^a-z0-9]+/, '_').delete_prefix('_').delete_suffix('_')
35
- # An Access table's own counter, named apart from the id Rails gives every row.
36
- column == 'id' ? 'access_id' : column
37
- end
38
-
39
- def copy(io, staged, raw)
40
- raw.copy_data "COPY #{staged} FROM STDIN WITH (FORMAT csv)" do
41
- while (chunk = io.read(1 << 20))
42
- # Some narratives carry null bytes, which PostgreSQL cannot keep in text.
43
- raw.put_copy_data chunk.delete("\x00")
44
- end
45
- end
46
- end
47
- end
@@ -1,17 +0,0 @@
1
- # A table written a record at a time, each save and delete counted in the current run.
2
- module Counted
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- after_save :count_upsert, if: :saved_changes?
7
- after_destroy :count_delete
8
- end
9
-
10
- private
11
-
12
- def count_upsert
13
- Run.current.tally(**(previously_new_record? ? { inserted: 1 } : { updated: 1 }))
14
- end
15
-
16
- def count_delete = Run.current.tally(deleted: 1)
17
- end
@@ -1,90 +0,0 @@
1
- # A table copying a source's table field for field as text, changing only the rows the source did.
2
- module Mirrored
3
- extend ActiveSupport::Concern
4
-
5
- # The columns this app adds to what the source published.
6
- OWN = %w[id source row_key row_hash created_at updated_at].freeze
7
-
8
- included do
9
- # A source's own `type` column is data, not Rails' single-table inheritance.
10
- self.inheritance_column = nil
11
- end
12
-
13
- class_methods do
14
- # Brings the rows from one source in line with a table staged from it, in the current run.
15
- # @param staged [String] temporary table holding what the source publishes.
16
- # @param source [String] file or document type the rows come from.
17
- # @return [Hash{Symbol => Integer}] how many rows were inserted, updated and deleted.
18
- def mirror(staged, source:)
19
- stage_incoming staged
20
- counts = { inserted: inserted(source), updated: updated(source), deleted: deleted(source) }
21
- apply source
22
- counts.tap { Run.current.tally(**it) }
23
- end
24
-
25
- private
26
-
27
- def fields = column_names - OWN
28
-
29
- def stage_incoming(staged)
30
- present = connection.columns(staged).map(&:name)
31
- picked = fields.map { |field| present.include?(field) ? %(s."#{field}") : 'NULL::text' }
32
- hash = "md5(ROW(#{picked.join ', '})::text)"
33
- keys = self::KEY.map { %(s."#{it}") }
34
- connection.execute 'DROP TABLE IF EXISTS mirror_incoming'
35
- connection.execute <<~SQL.squish
36
- CREATE TEMP TABLE mirror_incoming ON COMMIT DROP AS
37
- SELECT DISTINCT ON (row_key) * FROM (
38
- SELECT #{picked.zip(fields).map { |value, field| %(#{value} AS "#{field}") }.join ', '},
39
- #{keys.any? ? "concat_ws('|', #{keys.join ', '})" : hash} AS row_key,
40
- #{hash} AS row_hash
41
- FROM #{staged} s
42
- ) rows ORDER BY row_key, row_hash
43
- SQL
44
- connection.execute 'CREATE INDEX ON mirror_incoming (row_key)'
45
- connection.execute 'ANALYZE mirror_incoming'
46
- end
47
-
48
- def inserted(source)
49
- rows <<~SQL.squish
50
- FROM mirror_incoming i
51
- WHERE NOT EXISTS (SELECT 1 FROM #{quoted_table_name} t
52
- WHERE t.source = #{connection.quote source} AND t.row_key = i.row_key)
53
- SQL
54
- end
55
-
56
- def updated(source)
57
- rows <<~SQL.squish
58
- FROM mirror_incoming i JOIN #{quoted_table_name} t USING (row_key)
59
- WHERE t.source = #{connection.quote source} AND t.row_hash <> i.row_hash
60
- SQL
61
- end
62
-
63
- def deleted(source)
64
- rows <<~SQL.squish
65
- FROM #{quoted_table_name} i
66
- WHERE i.source = #{connection.quote source}
67
- AND NOT EXISTS (SELECT 1 FROM mirror_incoming n WHERE n.row_key = i.row_key)
68
- SQL
69
- end
70
-
71
- def rows(from) = connection.select_value("SELECT count(*) #{from}").to_i
72
-
73
- def apply(source)
74
- quoted = fields.map { connection.quote_column_name it }
75
- connection.delete <<~SQL.squish
76
- DELETE FROM #{quoted_table_name} t WHERE t.source = #{connection.quote source}
77
- AND NOT EXISTS (SELECT 1 FROM mirror_incoming n WHERE n.row_key = t.row_key)
78
- SQL
79
- connection.execute <<~SQL.squish
80
- INSERT INTO #{quoted_table_name} AS t
81
- (source, row_key, row_hash, #{quoted.join ', '}, created_at, updated_at)
82
- SELECT #{connection.quote source}, row_key, row_hash, #{quoted.join ', '}, now(), now()
83
- FROM mirror_incoming
84
- ON CONFLICT (source, row_key) DO UPDATE SET row_hash = excluded.row_hash,
85
- #{quoted.map { "#{it} = excluded.#{it}" }.join ', '}, updated_at = now()
86
- WHERE t.row_hash <> excluded.row_hash
87
- SQL
88
- end
89
- end
90
- end
@@ -1,7 +0,0 @@
1
- module Drive
2
- # The run of the refresh at hand, which every change belongs to.
3
- class Current < ActiveSupport::CurrentAttributes
4
- # The run every change of the refresh at hand belongs to.
5
- attribute :run
6
- end
7
- end
data/app/models/run.rb DELETED
@@ -1,33 +0,0 @@
1
- # One refresh of a source: when it started and finished, and how many rows it changed.
2
- class Run < ApplicationRecord
3
- # The lock every refresh takes, so runs commit one at a time.
4
- LOCK = 1_729_001
5
-
6
- # Refreshes a source inside one transaction, the only one running, recording what it changed.
7
- # @param source [String] what is refreshed, such as "registry".
8
- # @return [Run] finished run.
9
- def self.record(source)
10
- transaction do
11
- connection.execute "SELECT pg_advisory_xact_lock(#{LOCK})"
12
- run = create! source:, started_at: Time.current
13
- Drive::Current.set(run:) { yield run }
14
- run.tap { it.update! finished_at: Time.current }
15
- end
16
- end
17
-
18
- # @return [Run] run of the refresh at hand.
19
- def self.current = Drive::Current.run
20
-
21
- # Adds what a table's refresh did to this run's counts.
22
- # @param inserted [Integer] rows inserted.
23
- # @param updated [Integer] rows updated.
24
- # @param deleted [Integer] rows deleted.
25
- def tally(inserted: 0, updated: 0, deleted: 0)
26
- self.inserted += inserted
27
- self.updated += updated
28
- self.deleted += deleted
29
- end
30
-
31
- # @return [String] source and start, as the runs' table names a run.
32
- def to_s = "#{source} #{started_at.to_fs :db}"
33
- end
@@ -1,28 +0,0 @@
1
- # Each refresh of a source (a run), and every row it inserted, changed or deleted (a change),
2
- # which is the feed another app follows by the change's id.
3
- class CreateRunsAndChanges < ActiveRecord::Migration[8.1]
4
- def change
5
- create_enum :operation, %w[ upsert delete ]
6
-
7
- create_table :runs do |t|
8
- t.text :source, null: false
9
- t.integer :inserted, default: 0, null: false
10
- t.integer :updated, default: 0, null: false
11
- t.integer :deleted, default: 0, null: false
12
- t.datetime :started_at, null: false
13
- t.datetime :finished_at
14
- t.virtual :name, type: :text, as: "source || ' #' || id", stored: true
15
- end
16
-
17
- create_table :changes do |t|
18
- t.enum :operation, enum_type: :operation, null: false
19
- t.text :kind, null: false
20
- t.text :source, null: false
21
- t.text :row_key, null: false
22
- t.references :run, null: false, foreign_key: true
23
- t.jsonb :record
24
- t.datetime :created_at, null: false
25
- t.index %i[ kind row_key ]
26
- end
27
- end
28
- end
@@ -1,16 +0,0 @@
1
- class DropChanges < ActiveRecord::Migration[8.1]
2
- def change
3
- drop_table :changes do |t|
4
- t.enum :operation, enum_type: :operation, null: false
5
- t.text :kind, null: false
6
- t.text :source, null: false
7
- t.text :row_key, null: false
8
- t.references :run, null: false, foreign_key: true
9
- t.jsonb :record
10
- t.datetime :created_at, null: false
11
- t.index %i[kind row_key]
12
- end
13
-
14
- drop_enum :operation, %w[upsert delete]
15
- end
16
- end
@@ -1,20 +0,0 @@
1
- module Drive
2
- # What a host's tests need to mirror rows without a source's file.
3
- module TestHelper
4
- # Stages rows as a source's file would, a text column per field, for a model to mirror.
5
- # @param table [String] temporary table to create.
6
- # @param rows [Array<Hash{String => String}>] the rows, each by field.
7
- # @return [String] the table.
8
- def stage(table, rows)
9
- columns = rows.flat_map(&:keys).uniq
10
- connection = ActiveRecord::Base.connection
11
- connection.execute "DROP TABLE IF EXISTS #{table}"
12
- connection.execute "CREATE TEMP TABLE #{table} (#{columns.map { %("#{it}" text) }.join ', '})"
13
- rows.each do |row|
14
- values = columns.map { connection.quote row[it] }
15
- connection.execute "INSERT INTO #{table} VALUES (#{values.join ', '})"
16
- end
17
- table
18
- end
19
- end
20
- end